ApplyController.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\sj\classes\SjClass;
  4. use bizHd\saas\classes\ApplyExtendClass;
  5. use biz\sj\classes\MerchantClass;
  6. use bizGhs\shop\services\ShopAdminService;
  7. use bizHd\saas\services\ApplyService;
  8. use bizHd\wx\services\WxBaseService;
  9. use bizHd\wx\services\WxOpenService;
  10. use common\components\stringUtil;
  11. use Yii;
  12. use common\components\util;
  13. use bizHd\admin\services\AdminService;
  14. use bizHd\saas\classes\ApplyClass;
  15. use bizHd\saas\services\RegionService;
  16. use yii\web\Controller;
  17. class ApplyController extends BaseController
  18. {
  19. public $guestAccess = ['register'];
  20. //邀请开店列表 ssh 2021.1.28
  21. public function actionList()
  22. {
  23. $get = Yii::$app->request->get();
  24. $where = [];
  25. $where['introSjId'] = $this->sjId;
  26. $status = $get['status'] ?? 0;
  27. if (!empty($status)) {
  28. $where['status'] = $status;
  29. }
  30. $data = ApplyService::getApplyList($where);
  31. util::success($data);
  32. }
  33. //申请试用,花店添加新客户 ssh 2021.1.8
  34. public function actionRegister()
  35. {
  36. $post = Yii::$app->request->post();
  37. $post['adminId'] = $this->adminId;
  38. $admin = $this->admin;
  39. if (isset($admin['currentShopId']) && !empty($admin['currentShopId'])) {
  40. util::fail('您已经是门店员工');
  41. }
  42. $post['adminName'] = $admin['name'] ?? '';
  43. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  44. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  45. $post['from'] = ApplyClass::FROM_GHS;
  46. $name = $post['name'] ?? '';
  47. if (empty($name)) {
  48. util::fail('名称不能为空');
  49. }
  50. $has = SjClass::getByCondition(['name' => $name]);
  51. if (!empty($has)) {
  52. util::fail('名称已经存在');
  53. }
  54. $connection = Yii::$app->db;
  55. $transaction = $connection->beginTransaction();
  56. try {
  57. //新申请
  58. ApplyService::replaceGhs($post);
  59. $transaction->commit();
  60. } catch (\Exception $exception) {
  61. $transaction->rollBack();
  62. Yii::info("申请报错:" . $exception->getMessage());
  63. util::fail('提交失败');
  64. }
  65. util::complete();
  66. }
  67. //申请状态
  68. public function actionApplyStatus()
  69. {
  70. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  71. $status = -1;
  72. util::success(['status' => $status]);
  73. }
  74. //地图相关信息 ssh 2020.1.14
  75. public function actionRegionRelate()
  76. {
  77. $regionTree = RegionService::tree();
  78. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  79. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  80. util::success($out);
  81. }
  82. //获取申请的验证码 ssh 2020.2.23
  83. public function actionGetValidateCode()
  84. {
  85. $mobile = Yii::$app->request->get('mobile');
  86. util::success(['code' => rand(1111, 9999)]);
  87. }
  88. }