ApplyController.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\admin\services\ShopAdminService;
  4. use bizTy\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. //我的代理 shish 2019.12.26
  18. public function actionList()
  19. {
  20. $get = Yii::$app->request->get();
  21. $where = [];
  22. $where['introSjId'] = $this->sjId;
  23. $status = $get['status'] ?? 0;
  24. $style = $get['style'] ?? MerchantClass::STYLE_RETAIL;
  25. if (!empty($status)) {
  26. $where['status'] = $status;
  27. }
  28. $where['style'] = $style;
  29. $data = ApplyService::getApplyList($where);
  30. util::success($data);
  31. }
  32. //申请试用 shish 2020.1.11
  33. public function actionRegister()
  34. {
  35. $post = Yii::$app->request->post();
  36. $admin = $this->admin;
  37. $post['adminId'] = $this->adminId;
  38. $post['adminName'] = $admin['adminName'] ?? '';
  39. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  40. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  41. $post['from'] = ApplyClass::FROM_RETAIL;
  42. $post['style'] = MerchantClass::STYLE_RETAIL;
  43. $connection = Yii::$app->db;
  44. $transaction = $connection->beginTransaction();
  45. try {
  46. //增加或更新申请
  47. ApplyService::replaceRetail($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. }