Tiaoshiweixiulogo.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace app\company\controller;
  3. use app\common\controller\Apic;
  4. use think\Db;
  5. /**
  6. * 调试维修logo
  7. */
  8. class Tiaoshiweixiulogo extends Apic
  9. {
  10. protected $noNeedLogin = [];
  11. protected $noNeedRight = ['info'];
  12. protected $table = 'tiaoshiweixiu_logo';
  13. public function index(){
  14. $list = Db::name($this->table)->where('company_id',$this->auth->company_id)->order('id desc')->select();
  15. $list = list_domain_image($list,['image']);
  16. $this->success(1,$list);
  17. }
  18. public function add(){
  19. $data = [
  20. 'title' => input('title',''),
  21. 'image' => input('image',''),
  22. 'company_id' => $this->auth->company_id,
  23. 'updatetime' => time(),
  24. ];
  25. Db::name($this->table)->insertGetId($data);
  26. $this->success();
  27. }
  28. public function info(){
  29. $id = input('id',0);
  30. $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
  31. $info = info_domain_image($info,['image']);
  32. $this->success(1,$info);
  33. }
  34. public function edit(){
  35. $id = input('id',0);
  36. $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
  37. if(empty($info)){
  38. $this->error('没找到该信息,请刷新重试');
  39. }
  40. $data = [
  41. 'title' => input('title',''),
  42. 'image' => input('image',''),
  43. 'updatetime' => time(),
  44. ];
  45. Db::name($this->table)->where('id',$id)->update($data);
  46. $this->success();
  47. }
  48. public function del(){
  49. $ids = input('ids','');
  50. $ids = explode(',',$ids);
  51. if (empty($ids)) {
  52. $this->error();
  53. }
  54. Db::name($this->table)->where('id','IN',$ids)->where('company_id',$this->auth->company_id)->delete();
  55. $this->success();
  56. }
  57. }