post(); $data['org_id'] = cur_org_id(); $result = validate('Monitor')->check($data,[],''); if(true !== $result){ $this->error = validate('Monitor')->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 getMonitors($orgId,$limit=10){ $map[] = ['org_id','=',$orgId]; $map[] = ['del','=',0]; $map[] = ['enable','=',1]; $lists = Db::name("monitor")->where($map)->field('id,title,url,img')->limit($limit)->order('id desc')->select(); foreach ($lists as $k=>$v){ $lists[$k]['url'] = url("h5/Index/monitor",['id'=>think_encrypt($v['id'])],false,true); } return $lists; } }