ApplyController.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace ghs\controllers;
  3. use bizHd\saas\classes\ApplyExtendClass;
  4. use bizTy\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. $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. //申请试用,花店添加新客户 shish 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. $connection = Yii::$app->db;
  44. $transaction = $connection->beginTransaction();
  45. try {
  46. //新申请
  47. ApplyService::replaceGhs($post);
  48. $transaction->commit();
  49. } catch (\Exception $exception) {
  50. $transaction->rollBack();
  51. Yii::info("申请报错:" . $exception->getMessage());
  52. util::fail('提交失败');
  53. }
  54. util::complete();
  55. }
  56. //申请状态
  57. public function actionApplyStatus()
  58. {
  59. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  60. $status = -1;
  61. util::success(['status' => $status]);
  62. }
  63. //地图相关信息 shish 2020.1.14
  64. public function actionRegionRelate()
  65. {
  66. $regionTree = RegionService::tree();
  67. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  68. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  69. util::success($out);
  70. }
  71. //获取申请的验证码 shish 2020.2.23
  72. public function actionGetValidateCode()
  73. {
  74. $mobile = Yii::$app->request->get('mobile');
  75. util::success(['code' => rand(1111, 9999)]);
  76. }
  77. }