ApplyController.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\saas\classes\ApplyExtendClass;
  4. use bizTy\sj\classes\MerchantClass;
  5. use bizGhs\shop\services\ShopAdminService;
  6. use biz\saas\services\ApplyService;
  7. use biz\wx\services\WxBaseService;
  8. use biz\wx\services\WxOpenService;
  9. use common\components\stringUtil;
  10. use Yii;
  11. use common\components\util;
  12. use biz\admin\services\AdminService;
  13. use biz\saas\classes\ApplyClass;
  14. use biz\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. //审核
  34. public function actionCheck()
  35. {
  36. $id = Yii::$app->request->post('id');
  37. $status = Yii::$app->request->post('status', 0);
  38. $remark = Yii::$app->request->post('remark', '');
  39. $apply = ApplyService::getById($id);
  40. if (empty($apply)) {
  41. util::fail('找不到申请记录');
  42. }
  43. if ($apply['status'] != 0) {
  44. util::fail('已经审过了');
  45. }
  46. if ($status == 1) {
  47. ApplyService::pass($id);
  48. }
  49. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  50. util::success('操作成功');
  51. }
  52. //申请试用,花店添加新客户 shish 2021.1.8
  53. public function actionRegister()
  54. {
  55. $post = Yii::$app->request->post();
  56. $post['adminId'] = $this->adminId;
  57. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  58. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  59. $post['from'] = ApplyClass::FROM_GHS;
  60. $post['certType'] = ApplyClass::CERT_TYPE_LICENSE;
  61. ApplyService::addNewApply($post);
  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. //地图相关信息 shish 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. //获取申请的验证码 shish 2020.2.23
  80. public function actionGetValidateCode()
  81. {
  82. $mobile = Yii::$app->request->get('mobile');
  83. util::success(['code' => rand(1111, 9999)]);
  84. }
  85. }