model = new \app\admin\model\lottery\Lottery; } /** * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 * 需要将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()."
"; } //去掉 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 ."
"; $where3 = $where5; $tickets->where($where3)->update(['deletetime'=>time()]); echo $tickets->getLastsql()."
"; } // code... } //$this->success("成功过滤掉".$row['title'].'号码!'); } }