|
@@ -33,5 +33,65 @@ class Lottery extends Backend
|
|
|
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
|
|
*/
|
|
|
|
|
|
+ //过滤
|
|
|
+ public function filter($ids = null){
|
|
|
+ $row = $this->model->get($ids);
|
|
|
+ if (!$row) {
|
|
|
+ $this->error(__('No Results were found'));
|
|
|
+ }
|
|
|
+ $adminIds = $this->getDataLimitAdminIds();
|
|
|
+ if (is_array($adminIds)) {
|
|
|
+ if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
|
|
+ $this->error(__('You have no permission'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $code = $row->code;
|
|
|
+ $arr = explode('-',$code);
|
|
|
+ if(count($arr) != 5){
|
|
|
+ $this->error('录入code有问题!');
|
|
|
+ }
|
|
|
+
|
|
|
+ $tickets = new \app\admin\model\lottery\Tickets;
|
|
|
+
|
|
|
+ $whereAll = [
|
|
|
+ 't1' =>$arr[0],
|
|
|
+ 't2' =>$arr[1],
|
|
|
+ 't3' =>$arr[2],
|
|
|
+ 't4' =>$arr[3],
|
|
|
+ 't5' =>$arr[4],
|
|
|
+ ];
|
|
|
+ //先去掉 5个的
|
|
|
+ $tickets->where($whereAll)->update(['deletetime'=>time()]);
|
|
|
+
|
|
|
+ //去掉 4个 的 5 种
|
|
|
+ foreach ($arr as $k => $v) {
|
|
|
+ $where5= $whereAll;
|
|
|
+ $key = "t" . ($k+1);
|
|
|
+ unset($where5[$key]);
|
|
|
+ $where4 = $where5;
|
|
|
+ $tickets->where($where4)->update(['deletetime'=>time()]);
|
|
|
+ echo $tickets->getLastsql()."</br>";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //去掉 3个的 c5 3 10 种情况
|
|
|
+ $count = count($arr);
|
|
|
+ for ($i=1; $i<=$count; $i++) {
|
|
|
+
|
|
|
+ for ($j=$i+1; $j <=$count ; $j++) {
|
|
|
+ $where5= $whereAll;
|
|
|
+ unset($where5["t".$i]);
|
|
|
+ unset($where5["t".$j]);
|
|
|
+ //echo "t".$i .'==='."t".$j ."</br>";
|
|
|
+ $where3 = $where5;
|
|
|
+ $tickets->where($where3)->update(['deletetime'=>time()]);
|
|
|
+ echo $tickets->getLastsql()."</br>";
|
|
|
+
|
|
|
+ }
|
|
|
+ // code...
|
|
|
+ }
|
|
|
+
|
|
|
+ //$this->success("成功过滤掉".$row['title'].'号码!');
|
|
|
+ }
|
|
|
|
|
|
}
|