1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\common\model;
- use think\Db;
- class Screen extends Base{
- protected $autoWriteTimestamp = 'datetime';
- protected $createTime = 'create_time';
- protected $updateTime = 'update_time';
- public function updates(){
- $data = request()->post();
- if(!$data['id']){
- $data['org_id'] = cur_org_id();
- }
- if($data['type'] == 1){
- $data['url'] = '';
- }else{
- $data['tid'] = 0;
- $data['content'] = '';
- }
- return $this->updateInfo($data,'Screen','');
- }
- // 大屏接口获取详情
- public function getInfo($id,$orgId){
- $info = Db::name('screen')->where('id',$id)->where('del',0)->find();
- if($info){
- $info['org_id'] = $orgId;
- $temp = Db::name('screen_template')->where('id',$info['tid'])->value('name');
- $info['temp_name'] = $temp?$temp:'';
- $content = $info['content']?json_decode($info['content'],true):[];
- foreach ($content as $k=>$v){
- $module = Db::name('screen_module')->where('id',$v['mid'])->value('name');
- $content[$k]['name'] = $module?$module:'';
- }
- $info['content'] = $content;
- $org = Db::name('org')->where('id',$info['org_id'])->value('name');
- $info['org_name'] = $org?$org:'';
- }
- return $info;
- }
- }
|