ApplyController.php 855 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace saas\controllers;
  3. use biz\saas\services\ApplyService;
  4. use common\components\util;
  5. use Yii;
  6. use yii\web\Controller;
  7. class ApplyController extends BaseController
  8. {
  9. //申请列表
  10. public function actionList()
  11. {
  12. $where = [];
  13. $list = ApplyService::getApplyList($where);
  14. util::success($list);
  15. }
  16. //审核
  17. public function actionCheck()
  18. {
  19. $id = Yii::$app->request->post('id');
  20. $status = Yii::$app->request->post('status', 0);
  21. $remark = Yii::$app->request->post('remark', '');
  22. $apply = ApplyService::getById($id);
  23. if (empty($apply)) {
  24. util::fail('找不到申请记录');
  25. }
  26. if ($apply['status'] != 0) {
  27. util::fail('已经审过了');
  28. }
  29. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  30. if ($status == 1) {
  31. ApplyService::pass($id);
  32. }
  33. util::success('操作成功');
  34. }
  35. }