post(); $data['org_id'] =cur_org_id(); $result = validate($this->validateName)->check($data,[],''); if(true !== $result){ $this->error = validate($this->validateName)->getError(); return false; } $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; } 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; } }