StoreProductProtection.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\v1\product;
  12. use app\adminapi\controller\AuthController;
  13. use app\services\product\product\StoreProductProtectionServices;
  14. use think\facade\App;
  15. class StoreProductProtection extends AuthController
  16. {
  17. public function __construct(App $app, StoreProductProtectionServices $services)
  18. {
  19. parent::__construct($app);
  20. $this->services = $services;
  21. }
  22. public function protectionList()
  23. {
  24. $where = $this->request->getMore([
  25. ['title', ''],
  26. ['status', '']
  27. ]);
  28. $where['is_del'] = 0;
  29. return app('json')->success($this->services->protectionList($where));
  30. }
  31. public function protectionInfo($id)
  32. {
  33. if (!$id) return app('json')->fail('参数错误');
  34. $info = $this->services->protectionInfo($id);
  35. return app('json')->success($info);
  36. }
  37. public function protectionForm($id)
  38. {
  39. return app('json')->success($this->services->protectionForm($id));
  40. }
  41. public function protectionSave($id)
  42. {
  43. $data = $this->request->postMore([
  44. ['title', ''],
  45. ['content', ''],
  46. ['image', ''],
  47. ['sort', 0],
  48. ['status', 0]
  49. ]);
  50. $this->services->protectionSave($id, $data);
  51. return app('json')->success('保存成功');
  52. }
  53. public function protectionStatus($id, $status)
  54. {
  55. if (!$id) return app('json')->fail('参数错误');
  56. $this->services->protectionStatus($id, $status);
  57. return app('json')->success('修改成功');
  58. }
  59. public function protectionDel($id)
  60. {
  61. if (!$id) return app('json')->fail('参数错误');
  62. $this->services->protectionDel($id);
  63. return app('json')->success('删除成功');
  64. }
  65. }