ApplyController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace ghs\controllers;
  3. use bizHd\saas\classes\ApplyExtendClass;
  4. use biz\sj\classes\MerchantClass;
  5. use bizGhs\shop\services\ShopAdminService;
  6. use bizHd\saas\services\ApplyService;
  7. use bizHd\wx\services\WxBaseService;
  8. use bizHd\wx\services\WxOpenService;
  9. use common\components\stringUtil;
  10. use Yii;
  11. use common\components\util;
  12. use bizHd\admin\services\AdminService;
  13. use bizHd\saas\classes\ApplyClass;
  14. use bizHd\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. if (!empty($status)) {
  26. $where['status'] = $status;
  27. }
  28. $data = ApplyService::getApplyList($where);
  29. util::success($data);
  30. }
  31. //申请试用,花店添加新客户 shish 2021.1.8
  32. public function actionRegister()
  33. {
  34. $post = Yii::$app->request->post();
  35. $admin = $this->admin;
  36. $post['adminId'] = $this->adminId;
  37. $post['adminName'] = $admin['adminName'] ?? '';
  38. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  39. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  40. $post['from'] = ApplyClass::FROM_GHS;
  41. $connection = Yii::$app->db;
  42. $transaction = $connection->beginTransaction();
  43. try {
  44. //新申请
  45. ApplyService::replaceGhs($post);
  46. $transaction->commit();
  47. } catch (\Exception $exception) {
  48. $transaction->rollBack();
  49. Yii::info("申请报错:" . $exception->getMessage());
  50. util::fail('提交失败');
  51. }
  52. util::complete();
  53. }
  54. //申请状态
  55. public function actionApplyStatus()
  56. {
  57. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  58. $status = -1;
  59. util::success(['status' => $status]);
  60. }
  61. //地图相关信息 shish 2020.1.14
  62. public function actionRegionRelate()
  63. {
  64. $regionTree = RegionService::tree();
  65. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  66. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  67. util::success($out);
  68. }
  69. //获取申请的验证码 shish 2020.2.23
  70. public function actionGetValidateCode()
  71. {
  72. $mobile = Yii::$app->request->get('mobile');
  73. util::success(['code' => rand(1111, 9999)]);
  74. }
  75. }