ApplyController.php 2.7 KB

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