0
0

Screen.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\common\model;
  3. use think\Db;
  4. class Screen extends Base{
  5. protected $autoWriteTimestamp = 'datetime';
  6. protected $createTime = 'create_time';
  7. protected $updateTime = 'update_time';
  8. public function updates(){
  9. $data = request()->post();
  10. if(!$data['id']){
  11. $data['org_id'] = cur_org_id();
  12. }
  13. if($data['type'] == 1){
  14. $data['url'] = '';
  15. }else{
  16. $data['tid'] = 0;
  17. $data['content'] = '';
  18. }
  19. return $this->updateInfo($data,'Screen','');
  20. }
  21. // 大屏接口获取详情
  22. public function getInfo($id,$orgId){
  23. $info = Db::name('screen')->where('id',$id)->where('del',0)->find();
  24. if($info){
  25. $info['org_id'] = $orgId;
  26. $temp = Db::name('screen_template')->where('id',$info['tid'])->value('name');
  27. $info['temp_name'] = $temp?$temp:'';
  28. $content = $info['content']?json_decode($info['content'],true):[];
  29. foreach ($content as $k=>$v){
  30. $module = Db::name('screen_module')->where('id',$v['mid'])->value('name');
  31. $content[$k]['name'] = $module?$module:'';
  32. }
  33. $info['content'] = $content;
  34. $org = Db::name('org')->where('id',$info['org_id'])->value('name');
  35. $info['org_name'] = $org?$org:'';
  36. }
  37. return $info;
  38. }
  39. }