ApplyController.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\shop\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 2021.1.8
  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. $mobile = isset($get['mobile']) && !empty($get['mobile']) && stringUtil::isMobile($get['mobile']) ? $get['mobile'] : 0;
  55. if (empty($mobile)) {
  56. util::fail('请填写正确手机号');
  57. }
  58. $admin = AdminService::getById($this->adminId);
  59. ApplyService::addApply($get);
  60. $wxBase = WxBaseService::getWxBase();
  61. $wxAliasName = isset($wxBase['wxAliasName']) && !empty($wxBase['wxAliasName']) ? $wxBase['wxAliasName'] : 'ihuahuibao';
  62. $focus = isset($admin['subscribe']) ? $admin['subscribe'] : 0;
  63. $data = ['focus' => $focus, 'wxAliasName' => $wxAliasName];
  64. util::success($data);
  65. }
  66. //申请状态
  67. public function actionApplyStatus()
  68. {
  69. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  70. $status = -1;
  71. util::success(['status' => $status]);
  72. }
  73. //地图相关信息 shish 2020.1.14
  74. public function actionRegionRelate()
  75. {
  76. $regionTree = RegionService::tree();
  77. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  78. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  79. util::success($out);
  80. }
  81. //获取申请的验证码 shish 2020.2.23
  82. public function actionGetValidateCode()
  83. {
  84. $mobile = Yii::$app->request->get('mobile');
  85. util::success(['code' => rand(1111, 9999)]);
  86. }
  87. }