SupplierGoods.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. namespace app\operate\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 供货商商品
  7. * Class SupplierGoods
  8. * @package app\mall\controller
  9. */
  10. class SupplierGoods extends Controller
  11. {
  12. /**
  13. * 绑定数据表
  14. * @var string
  15. */
  16. protected $table = 'SupplierGoods';
  17. /**
  18. * 供货商商品列表
  19. * @auth true
  20. * @menu true
  21. * @throws \think\Exception
  22. * @throws \think\db\exception\DataNotFoundException
  23. * @throws \think\db\exception\ModelNotFoundException
  24. * @throws \think\exception\DbException
  25. * @throws \think\exception\PDOException
  26. */
  27. public function index()
  28. {
  29. $this->title = '供货商商品列表';
  30. $supplier_id = input('get.id');
  31. $this->supplier_id = $supplier_id;
  32. $query = $this->_query($this->table)->where('is_deleted',0)->where('supplier_id',$supplier_id);
  33. $query->like('name');
  34. if(input('place')) $query->where('place',input('place'));
  35. $query->order(' sort desc , id desc')->page();
  36. }
  37. /**
  38. * 数据列表处理
  39. * @auth true
  40. * @menu true
  41. * @param array $data
  42. * @throws \think\db\exception\DataNotFoundException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. * @throws \think\exception\DbException
  45. */
  46. protected function _index_page_filter(&$data)
  47. {
  48. }
  49. /**
  50. * 添加供货商商品
  51. * @auth true
  52. * @menu true
  53. * @throws \think\Exception
  54. * @throws \think\db\exception\DataNotFoundException
  55. * @throws \think\db\exception\ModelNotFoundException
  56. * @throws \think\exception\DbException
  57. * @throws \think\exception\PDOException
  58. */
  59. public function add()
  60. {
  61. $this->title = '添加供货商商品';
  62. $this->_form($this->table, 'form');
  63. }
  64. /**
  65. * 编辑供货商商品
  66. * @auth true
  67. * @menu true
  68. * @throws \think\Exception
  69. * @throws \think\db\exception\DataNotFoundException
  70. * @throws \think\db\exception\ModelNotFoundException
  71. * @throws \think\exception\DbException
  72. * @throws \think\exception\PDOException
  73. */
  74. public function edit()
  75. {
  76. $this->place_desc =['','视频首页'];
  77. $this->title = '编辑供货商商品';
  78. $this->supplier_id = input('supplier_id');
  79. $this->_form($this->table, 'form');
  80. }
  81. /**
  82. * 启用
  83. * @auth true
  84. * @menu true
  85. * @throws \think\Exception
  86. * @throws \think\exception\PDOException
  87. */
  88. public function enable()
  89. {
  90. $this->_save($this->table, ['status' => 1]);
  91. }
  92. /**
  93. * 删除
  94. * @auth true
  95. * @menu true
  96. * @throws \think\Exception
  97. * @throws \think\exception\PDOException
  98. */
  99. public function del()
  100. {
  101. $this->_save($this->table, ['is_deleted' => 1]);
  102. }
  103. /**
  104. * 表单数据处理
  105. * @auth true
  106. * @menu true
  107. * @param array $data
  108. */
  109. protected function _form_filter(&$data)
  110. {
  111. $data['create_at'] = date('Y-m-d H:i:s');
  112. }
  113. }