ApplyController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\saas\classes\ApplyExtendClass;
  4. use bizTy\sj\classes\MerchantClass;
  5. use bizGhs\shop\services\ShopAdminService;
  6. use biz\saas\services\ApplyService;
  7. use biz\wx\services\WxBaseService;
  8. use biz\wx\services\WxOpenService;
  9. use common\components\stringUtil;
  10. use Yii;
  11. use common\components\util;
  12. use biz\admin\services\AdminService;
  13. use biz\saas\classes\ApplyClass;
  14. use biz\saas\services\RegionService;
  15. use yii\web\Controller;
  16. class ApplyController extends BaseController
  17. {
  18. //邀请开店列表 shish 2021.1.28
  19. public function actionList()
  20. {
  21. $get = Yii::$app->request->get();
  22. $where = [];
  23. $where['introSjId'] = $this->sjId;
  24. $status = $get['status'] ?? 0;
  25. $style = $get['style'] ?? MerchantClass::STYLE_SUPPLIER;
  26. if (!empty($status)) {
  27. $where['status'] = $status;
  28. }
  29. $where['style'] = $style;
  30. $data = ApplyService::getApplyList($where);
  31. util::success($data);
  32. }
  33. //审核
  34. public function actionCheck()
  35. {
  36. $id = Yii::$app->request->post('id');
  37. $status = Yii::$app->request->post('status', 0);
  38. $remark = Yii::$app->request->post('remark', '');
  39. $apply = ApplyService::getById($id);
  40. if (empty($apply)) {
  41. util::fail('找不到申请记录');
  42. }
  43. if ($apply['status'] != 0) {
  44. util::fail('已经审过了');
  45. }
  46. if ($status == 1) {
  47. ApplyService::pass($id);
  48. }
  49. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  50. util::success('操作成功');
  51. }
  52. //申请试用,花店添加新客户 shish 2021.1.8
  53. public function actionRegister()
  54. {
  55. $post = Yii::$app->request->post();
  56. $post['adminId'] = $this->adminId;
  57. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  58. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  59. $post['from'] = ApplyClass::FROM_GHS;
  60. $post['certType'] = ApplyClass::CERT_TYPE_LICENSE;
  61. //增加或更新申请
  62. ApplyService::addGhsApply($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. }