error('请先获取定位'); return $this->success('获取成功',RescueModel::lst($this->cid,$latitude,$longitude,$page,$limit,$this->auth->getUserinfo()['id'],1,1)); } public function create(Request $request) { $where = UtilService::postMore( [ ['name',''], ['phone',''], ['institution_id',0], ['volunteer_id',0], ['address',''], ['latitude',''], ['longitude',''], ['certificateimage',''], ],$request ); if($where['name']=='')$this->error('姓名不能为空'); if($where['phone']=='')$this->error('电话不能为空'); if($where['address']=='')$this->error('地址信息不能为空'); if($where['certificateimage']=='')$this->error('证书不能为空'); $where['cid'] = $this->cid; $where['user_id'] = $this->auth->getUserinfo()['id']; if(RescueModel::where('user_id',$where['user_id'])->where('status','>',-1)->find()) $this->error('已经存,不能重复申请'); if(!RescueModel::create1($where)) { $this->error(RescueModel::getErrorInfo()); } $this->success('创建成功'); } public function applylst(Request $request) { return $this->success('获取成功',RescueModel::lst($this->cid,'','',1,10,$this->auth->getUserinfo()['id'],-2)); } public function sos_create(Request $request) { $where = UtilService::postMore( [ ['mobile',''], ['address',''], ['latitude',''], ['longitude',''], ['rescuers_id',0], ['rescuers_user_id',0], ['from','weixin'], ['re_url',''], ],$request ); if($where['rescuers_id']==0) $this->error('选择救授人员'); if($where['latitude']=='' || $where['longitude']=='') $this->error('请先获取定位'); $where['user_id'] = $this->auth->getUserinfo()['id']; $where['cid'] = $this->cid; if(Sos::sos_create($where)) $this->success('创建成功'); $this->error(Sos::getErrorInfo()); } public function lst(Request $request) { $where = UtilService::getMore( [ ['page',1], ['limit',10], ['type',0], ['status',-3], ['latitude',''], ['longitude',''], ], $request ); $where['user_id'] = 0;$where['rescue_id']=0; if($where['type']==0) { $where['user_id']= $this->auth->getUserinfo()['id']; } else { $where['rescuers_user_id']= $this->auth->getUserinfo()['id']; } return $this->success('获取成功',SosBill::lst($where)); } public function setstatus(Request $request) { $where = UtilService::postMore( [ ['status',1], ['process_remark',''], ],$request ); $where['processtime'] = time(); SosBill::where('id',input('id',0))->update($where); $this->success('处理完成'); } public function sos_del(Request $request) { $id = input('id'); if(SosBill::where('sos_id',$id)->where('status','<',1)->find()) { SosBill::where('sos_id',$id)->where('status','<',1)->delete(); $this->success('删除成功'); } $this->error('已删除或已接受'); } }