ApplyController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace shop\controllers;
  3. use biz\admin\services\ShopAdminService;
  4. use biz\saas\services\ApplyService;
  5. use biz\wx\services\WxBaseService;
  6. use biz\wx\services\WxOpenService;
  7. use common\components\stringUtil;
  8. use Yii;
  9. use common\components\util;
  10. use biz\admin\services\AdminService;
  11. use biz\saas\classes\ApplyClass;
  12. use biz\saas\services\RegionService;
  13. use yii\web\Controller;
  14. class ApplyController extends BaseController
  15. {
  16. //我的代理 shish 2019.12.26
  17. public function actionList()
  18. {
  19. $status = Yii::$app->request->get('status', 0);
  20. $where = [];
  21. $where['introMerchantId'] = $this->merchantId;
  22. if ($status != -1) {
  23. $where['status'] = $status;
  24. }
  25. $data = ApplyService::getApplyList($where);
  26. util::success($data);
  27. }
  28. //审核
  29. public function actionCheck()
  30. {
  31. $id = Yii::$app->request->post('id');
  32. $status = Yii::$app->request->post('status', 0);
  33. $remark = Yii::$app->request->post('remark', '');
  34. $apply = ApplyService::getById($id);
  35. if (empty($apply)) {
  36. util::fail('找不到申请记录');
  37. }
  38. if ($apply['status'] != 0) {
  39. util::fail('已经审过了');
  40. }
  41. if ($status == 1) {
  42. ApplyService::pass($id);
  43. }
  44. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  45. util::success('操作成功');
  46. }
  47. //申请试用 shish 2020.1.11
  48. public function actionRegister()
  49. {
  50. $get = Yii::$app->request->get();
  51. $get['adminId'] = $this->adminId;
  52. $get['long'] = isset($get['longitude']) ? $get['longitude'] : '';
  53. $get['lat'] = isset($get['latitude']) ? $get['latitude'] : '';
  54. $introMerchantId = isset($get['introMerchantId']) && !empty($get['introMerchantId']) ? $get['introMerchantId'] : 0;
  55. if (empty($introMerchantId)) {
  56. util::fail('只有邀请了才能注册哦~');
  57. }
  58. $mobile = isset($get['mobile']) && !empty($get['mobile']) && stringUtil::isMobile($get['mobile']) ? $get['mobile'] : 0;
  59. if (empty($mobile)) {
  60. util::fail('请填写正确手机号');
  61. }
  62. $admin = AdminService::getById($this->adminId);
  63. ApplyService::addApply($get);
  64. $wxBase = WxBaseService::getWxBase();
  65. $wxAliasName = isset($wxBase['wxAliasName']) && !empty($wxBase['wxAliasName']) ? $wxBase['wxAliasName'] : 'ihuahuibao';
  66. $focus = isset($admin['subscribe']) ? $admin['subscribe'] : 0;
  67. $data = ['focus' => $focus, 'wxAliasName' => $wxAliasName];
  68. util::success($data);
  69. }
  70. //申请状态
  71. public function actionApplyStatus()
  72. {
  73. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  74. $status = -1;
  75. util::success(['status' => $status]);
  76. }
  77. //地图相关信息 shish 2020.1.14
  78. public function actionRegionRelate()
  79. {
  80. $regionTree = RegionService::tree();
  81. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  82. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  83. util::success($out);
  84. }
  85. //获取申请的验证码 shish 2020.2.23
  86. public function actionGetValidateCode()
  87. {
  88. $mobile = Yii::$app->request->get('mobile');
  89. util::success(['code' => rand(1111, 9999)]);
  90. }
  91. }