| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | 
							- <?php
 
- namespace app\common\model;
 
- use think\Db;
 
- class DisinfectionTodo extends Base {
 
-     protected $createTime = 'create_time';
 
-     protected $updateTime = 'update_time';
 
-     public $table = 'disinfection_todo';
 
-     protected $validateName = 'DisinfectionTodo';
 
-     public function updates(){
 
-         $data = request()->post();
 
-         $data['org_id'] =cur_org_id();
 
-         $result = validate($this->validateName)->check($data,[],'');
 
-         if(true !== $result){
 
-             $this->error = validate($this->validateName)->getError();
 
-             return false;
 
-         }
 
- //        $data['img'] = isset($data['img'])?$data['img']:'';
 
-         $id = $data['id'];
 
-         unset($data['id']);
 
-         if($id > 0){
 
-             $data['update_time'] = date('Y-m-d H:i:s');
 
-             $ret = $this->allowField(true)->save($data,['id'=>$id]);
 
-         }else{
 
-             $data['create_time'] = date('Y-m-d H:i:s');
 
-             $ret = $this->allowField(true)->save($data);
 
-         }
 
-         if(!$ret){
 
-             $this->error = '操作失败';
 
-             return false;
 
-         }
 
- //        $name = '任务工作项';
 
- //        $content = $name.':新增';
 
- //        if($id > 0){
 
- //            $content = $name.':编辑';
 
- //            $data['id'] = $id;
 
- //        }else{
 
- //            $data['id'] = $this->id;
 
- //        }
 
- //        model('ActionLog')->addlog(is_login(),27,$content,$data,cur_org_id());
 
-         return true;
 
-     }
 
-     /**
 
-      * 获取检查项列表
 
-      *
 
-      * @author wst
 
-      * @date   2021/9/6 15:00
 
-      * @return array
 
-      */
 
-     public function list(){
 
-         $where['del']=0;
 
-         $where['enable']=1;
 
-         $where['org_id']=cur_org_id();
 
-         $dailyForm=$this->field('id,content as title')->where($where)->select()->toArray();
 
-         return $dailyForm;
 
-     }
 
-     /**
 
-      * 根据id获取检查项列表
 
-      *
 
-      * @author wst
 
-      * @date   2021/9/6 15:00
 
-      * @return array
 
-      */
 
-     public function getByIdList($id){
 
-         $dailyForm = Db::name('daily_form')
 
-             ->where('enable',1)
 
-             ->where('del',0)
 
-             ->whereIn('id',explode(',',$id))
 
-             ->select();
 
-         $ids = [];
 
-         foreach ($dailyForm as $k=>$v){
 
-             $ids[$k]=(string)$v['id'];
 
-         }
 
-         return $ids;
 
-     }
 
- }
 
 
  |