ApplyController.php 2.7 KB

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