ApplyController.php 2.3 KB

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