ApplyController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * @link:http://www.goodmall.com/
  4. * @copyright: Copyright (c) 2022
  5. * Created by PhpStorm
  6. * Author: zmz
  7. * Date: 2022-10-18
  8. * Time: 09:09
  9. */
  10. namespace addons\CircleDistribution\backend\controllers;
  11. use addons\CircleDistribution\common\models\DistributionApply;
  12. use Yii;
  13. class ApplyController extends BaseController
  14. {
  15. public $enableCsrfValidation = false;
  16. /**
  17. * @desc:列表
  18. * @Author: hua
  19. * @Date: 2021/11/25
  20. * @Time: 17:40
  21. * @Copyright: copyright (c) 2021 广东七件事集团
  22. * @return mixed|string|void
  23. */
  24. public function actionIndex()
  25. {
  26. if (\Yii::$app->request->isAjax) {
  27. if (\Yii::$app->request->isGet) {
  28. $params = \Yii::$app->request->get();
  29. $get['mall_id'] = $this->mall_id;
  30. $params['where'] = [['mall_id' => $this->mall_id]];
  31. $params['with'] = ['user'];
  32. $params['order'] = 'id desc';
  33. $params['limit'] = 10;
  34. $pageData = DistributionApply::listPage($params, false);
  35. if ($pageData === false) return $this->error(DistributionApply::getStaticError());
  36. return $this->success('操作成功', $pageData);
  37. }
  38. }
  39. return $this->render('index', []);
  40. }
  41. /**
  42. * @desc:审核
  43. * @Author: hua
  44. * @Date: 2021/11/25
  45. * @Time: 18:19
  46. * @Copyright: copyright (c) 2021 广东七件事集团
  47. * @return mixed|string|void
  48. */
  49. public function actionCheck()
  50. {
  51. if (\Yii::$app->request->isAjax) {
  52. if (\Yii::$app->request->isPost) {
  53. $params = \Yii::$app->request->post();
  54. $res = Yii::$app->services->validate->validate($params, [
  55. [['id', 'check_status'], 'required'],
  56. [['check_remark'], 'safe'],
  57. ]);
  58. if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  59. $params['mall_id'] = $this->mall_id;
  60. if ($params['check_status'] == 2 && empty($params['check_remark'])) return $this->error('请填写审核不通过的原因');
  61. $res = DistributionApply::setData($params);
  62. if ($res === false) return $this->error(DistributionApply::getStaticError());
  63. return $this->success('操作成功');
  64. }
  65. }
  66. }
  67. }