ApplyController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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['introSjId'] = $this->sjId;
  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. $post = Yii::$app->request->post();
  51. $post['adminId'] = $this->adminId;
  52. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  53. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  54. $post['from'] = ApplyClass::FROM_RETAIL;
  55. $style = $post['style'] ?? MerchantClass::STYLE_RETAIL;
  56. if (isset($post['mobile']) == false) {
  57. util::fail('请填写手机号');
  58. }
  59. if (stringUtil::isMobile($post['mobile']) == false) {
  60. util::fail('请填写正确手机号');
  61. }
  62. ApplyService::addApply($post);
  63. util::complete();
  64. }
  65. //申请状态
  66. public function actionApplyStatus()
  67. {
  68. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  69. $status = -1;
  70. util::success(['status' => $status]);
  71. }
  72. //地图相关信息 shish 2020.1.14
  73. public function actionRegionRelate()
  74. {
  75. $regionTree = RegionService::tree();
  76. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  77. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  78. util::success($out);
  79. }
  80. //获取申请的验证码 shish 2020.2.23
  81. public function actionGetValidateCode()
  82. {
  83. $mobile = Yii::$app->request->get('mobile');
  84. util::success(['code' => rand(1111, 9999)]);
  85. }
  86. }