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; } public function getList(){ $list =$this ->where('org_id',cur_org_id()) ->where('del',0) ->where('enable',1) ->select() ->toArray(); return $list; } /** * 获取地点列表 * @param $type */ public function list($page,$size,$orgId){ $map[] = ['org_id','=',$orgId]; $map[] = ['del','=',0]; $map[] = ['enable','=',1]; $map[]=['','exp',Db::raw("FIND_IN_SET(7,types)")]; $lists = Db::name('address') ->where($map) ->order('id desc') ->field('id,title,remark,sn,x,y') ->limit(($page-1)*$size,$size) ->select(); return $lists?$lists:[]; } }