ApplyController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. //申请试用登记 shish 2020.1.11
  36. public function actionRegister()
  37. {
  38. $post = Yii::$app->request->post();
  39. $rand = rand(0, 1);
  40. $data = ['focus' => 1, 'qrCode' => ''];
  41. if ($rand == 0) {
  42. $data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
  43. }
  44. util::success($data);
  45. }
  46. //申请状态
  47. public function actionApplyStatus()
  48. {
  49. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  50. $status = rand(0, 4);
  51. util::success(['status' => $status]);
  52. }
  53. }