ApplyController.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 $guestAccessAction = ['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. $admin = $this->admin;
  38. $post['adminId'] = $this->adminId;
  39. $post['adminName'] = $admin['adminName'] ?? '';
  40. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  41. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  42. $post['from'] = ApplyClass::FROM_GHS;
  43. $name = $get['name'] ?? '';
  44. if (empty($name)) {
  45. util::fail('名称不能为空');
  46. }
  47. $has = SjClass::getByCondition(['name' => $name]);
  48. if (!empty($has)) {
  49. util::fail('名称已经存在');
  50. }
  51. $connection = Yii::$app->db;
  52. $transaction = $connection->beginTransaction();
  53. try {
  54. //新申请
  55. ApplyService::replaceGhs($post);
  56. $transaction->commit();
  57. } catch (\Exception $exception) {
  58. $transaction->rollBack();
  59. Yii::info("申请报错:" . $exception->getMessage());
  60. util::fail('提交失败');
  61. }
  62. util::complete();
  63. }
  64. //申请状态
  65. public function actionApplyStatus()
  66. {
  67. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  68. $status = -1;
  69. util::success(['status' => $status]);
  70. }
  71. //地图相关信息 ssh 2020.1.14
  72. public function actionRegionRelate()
  73. {
  74. $regionTree = RegionService::tree();
  75. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  76. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  77. util::success($out);
  78. }
  79. //获取申请的验证码 ssh 2020.2.23
  80. public function actionGetValidateCode()
  81. {
  82. $mobile = Yii::$app->request->get('mobile');
  83. util::success(['code' => rand(1111, 9999)]);
  84. }
  85. }