SupplierApply.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\v1\supplier;
  12. use app\controller\admin\AuthController;
  13. use app\services\supplier\LoginServices;
  14. use app\services\supplier\SystemSupplierServices;
  15. use app\services\system\SystemUserApplyServices;
  16. use think\facade\App;
  17. /**
  18. * 供应商申请
  19. * Class SupplierApply
  20. * @package app\controller\admin\v1\supplier
  21. */
  22. class SupplierApply extends AuthController
  23. {
  24. /**
  25. * 供应商申请类型
  26. * @var int
  27. */
  28. protected $type = 2;
  29. /**
  30. * 构造方法
  31. * SupplierApply constructor.
  32. * @param App $app
  33. * @param SystemUserApplyServices $services
  34. */
  35. public function __construct(App $app, SystemUserApplyServices $services)
  36. {
  37. parent::__construct($app);
  38. $this->services = $services;
  39. }
  40. /**
  41. * 获取供应商列表
  42. * @return mixed
  43. */
  44. public function index()
  45. {
  46. $where = $this->request->getMore([
  47. ['data', '', '', 'time'],
  48. ['status', ],
  49. [['keyword', 's'], ''],
  50. ]);
  51. $where['is_del'] = 0;
  52. $where['type'] = $this->type;
  53. return $this->success($this->services->getApplyList($where));
  54. }
  55. /**
  56. * 获取供应商信息
  57. * @return mixed
  58. */
  59. public function read($id)
  60. {
  61. if (!$id) return $this->fail('缺少参数');
  62. return $this->success($this->services->get((int)$id));
  63. }
  64. /**
  65. * 审核商品表单
  66. * @param $id
  67. * @return mixed
  68. */
  69. public function verifyForm($id)
  70. {
  71. if (!$id) {
  72. return $this->fail('缺少参数');
  73. }
  74. return $this->success($this->services->verifyForm((int)$id));
  75. }
  76. /**
  77. * 申请审核
  78. * @param $id
  79. * @return mixed
  80. */
  81. public function verifyApply($id)
  82. {
  83. if (!$id) return $this->fail('缺少参数');
  84. $data = $this->request->postMore([
  85. ['status', 1],
  86. ['fail_msg', '']
  87. ]);
  88. return $this->success('操作成功', $this->services->verifyApply((int)$id, $data));
  89. }
  90. /**
  91. * 备注表单
  92. * @param $id
  93. * @return mixed
  94. */
  95. public function markForm($id)
  96. {
  97. if (!$id) {
  98. return $this->fail('缺少参数');
  99. }
  100. return $this->success($this->services->markForm((int)$id));
  101. }
  102. /**
  103. * 备注
  104. * @param $id
  105. * @return mixed
  106. */
  107. public function mark($id)
  108. {
  109. if (!$id) return $this->fail('缺少参数');
  110. [$mark] = $this->request->postMore([
  111. ['mark', ''],
  112. ], true);
  113. if (!$mark) {
  114. return $this->fail('请输入备注');
  115. }
  116. $this->services->update($id, ['mark' => $mark]);
  117. return $this->success('备注成功!');
  118. }
  119. /**
  120. * 删除申请
  121. * @param $id
  122. * @return mixed
  123. */
  124. public function delete($id)
  125. {
  126. if (!$id) return $this->fail('删除失败,缺少参数');
  127. $this->services->update((int)$id, ['is_del' => 1]);
  128. return $this->success('删除成功!');
  129. }
  130. }