ApplyController.php 1.9 KB

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