1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace app\api\controller\screen;
- use app\hander\HelpHander;
- use think\Controller;
- use think\Db;
- /**
- * 大屏接口
- */
- class Index extends Controller
- {
- protected $sid = 0;
- protected $orgId = 0;
- protected function initialize()
- {
- parent::initialize();
- $token = input('token','','trim');
- $str = think_decrypt($token);
- // $str = '1|3';
- $data = $str?explode('|',$str):[];
- if(count($data) != 2){
- HelpHander::error('参数错误');
- }
- $this->sid = $data[0];
- $this->orgId = $data[1];
- }
- // 大屏详情
- public function info(){
- $ret = model('Screen')->getInfo($this->sid,$this->orgId);
- if(!$ret){
- HelpHander::error('大屏不存在');
- }
- HelpHander::success($ret);
- }
- // 获取大屏紧急联系人或图片
- public function getOrgInfo(){
- $data = [
- 'name' => model('Config')->getConfig('org_emergency_name',$this->orgId),
- 'phone' => model('Config')->getConfig('org_emergency_phone',$this->orgId),
- 'img' => model('Config')->getConfig('org_screen_img',$this->orgId)
- ];
- HelpHander::success($data);
- }
- // 日常工作任务记录
- public function dailyTaskRecord(){
- $map[] = ['org_id','=',$this->orgId];
- $map[] = ['task_id','>',0];
- $lists = Db::name('daily_record')
- ->where($map)
- ->field('user_id,task_id,daily_id')
- ->limit(20)
- ->order('id desc')
- ->select();
- $data = [];
- foreach ($lists as $k=>$v){
- $uname = Db::name('user')->where('id',$v['user_id'])->value('real_name');
- $task = Db::name('daily_task')->where('id',$v['task_id'])->value('title');
- $daily = Db::name('daily')->where('id',$v['daily_id'])->value('title');
- $data[] = [$daily,$task,$uname];
- }
- HelpHander::success($data);
- }
- public function getMonitor(){
- $list = model('Monitor')->getMonitors($this->orgId,10);
- $data = [
- 'info'=>isset($list[0])?$list[0]:null,
- 'info1'=>isset($list[1])?$list[1]:null,
- 'info2'=>isset($list[2])?$list[2]:null,
- 'info3'=>isset($list[3])?$list[3]:null,
- 'info4'=>isset($list[4])?$list[4]:null,
- 'info5'=>isset($list[5])?$list[5]:null,
- 'info6'=>isset($list[6])?$list[6]:null,
- 'info7'=>isset($list[7])?$list[7]:null,
- 'info8'=>isset($list[8])?$list[8]:null,
- 'info9'=>isset($list[9])?$list[9]:null,
- ];
- HelpHander::success($data);
- }
- }
|