ApplyController.php 1.9 KB

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