ApplyController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace www\controllers;
  3. use biz\saas\services\ApplyService;
  4. use biz\saas\services\RegionService;
  5. use common\components\util;
  6. use Yii;
  7. use yii\web\Controller;
  8. class ApplyController extends BaseController
  9. {
  10. //申请列表
  11. public function actionList()
  12. {
  13. $where = [];
  14. $list = ApplyService::getApplyList($where);
  15. util::success($list);
  16. }
  17. //审核
  18. public function actionCheck()
  19. {
  20. $id = Yii::$app->request->post('id');
  21. $status = Yii::$app->request->post('status', 0);
  22. $remark = Yii::$app->request->post('remark', '');
  23. $apply = ApplyService::getById($id);
  24. if (empty($apply)) {
  25. util::fail('找不到申请记录');
  26. }
  27. if ($apply['status'] != 0) {
  28. util::fail('已经审过了');
  29. }
  30. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  31. if ($status == 1) {
  32. ApplyService::pass($id);
  33. }
  34. util::success('操作成功');
  35. }
  36. //申请试用登记 shish 2020.1.11
  37. public function actionRegister()
  38. {
  39. $post = Yii::$app->request->post();
  40. $rand = rand(0, 1);
  41. $data = ['focus' => 1, 'qrCode' => ''];
  42. if ($rand == 0) {
  43. $data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
  44. }
  45. util::success($data);
  46. }
  47. //申请状态
  48. public function actionApplyStatus()
  49. {
  50. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  51. $status = rand(0, 4);
  52. util::success(['status' => $status]);
  53. }
  54. //地图相关信息 shish 2020.1.14
  55. public function actionRegionRelate()
  56. {
  57. $regionTree = RegionService::tree();
  58. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  59. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  60. util::success($out);
  61. }
  62. }