ApplyController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\merchant\classes\MerchantClass;
  4. use bizGhs\shop\services\ShopAdminService;
  5. use biz\saas\services\ApplyService;
  6. use biz\wx\services\WxBaseService;
  7. use biz\wx\services\WxOpenService;
  8. use common\components\stringUtil;
  9. use Yii;
  10. use common\components\util;
  11. use biz\admin\services\AdminService;
  12. use biz\saas\classes\ApplyClass;
  13. use biz\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. $status = Yii::$app->request->get('status', 0);
  21. $where = [];
  22. $where['introSjId'] = $this->sjId;
  23. if ($status != -1) {
  24. $where['status'] = $status;
  25. }
  26. $data = ApplyService::getApplyList($where);
  27. util::success($data);
  28. }
  29. //审核
  30. public function actionCheck()
  31. {
  32. $id = Yii::$app->request->post('id');
  33. $status = Yii::$app->request->post('status', 0);
  34. $remark = Yii::$app->request->post('remark', '');
  35. $apply = ApplyService::getById($id);
  36. if (empty($apply)) {
  37. util::fail('找不到申请记录');
  38. }
  39. if ($apply['status'] != 0) {
  40. util::fail('已经审过了');
  41. }
  42. if ($status == 1) {
  43. ApplyService::pass($id);
  44. }
  45. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  46. util::success('操作成功');
  47. }
  48. //申请试用,花店添加新客户 shish 2021.1.8
  49. public function actionRegister()
  50. {
  51. $post = Yii::$app->request->post();
  52. $post['adminId'] = $this->adminId;
  53. $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
  54. $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
  55. $post['from'] = ApplyClass::FROM_GHS;
  56. ApplyService::addApply($post);
  57. util::complete();
  58. }
  59. //申请状态
  60. public function actionApplyStatus()
  61. {
  62. //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
  63. $status = -1;
  64. util::success(['status' => $status]);
  65. }
  66. //地图相关信息 shish 2020.1.14
  67. public function actionRegionRelate()
  68. {
  69. $regionTree = RegionService::tree();
  70. $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
  71. $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
  72. util::success($out);
  73. }
  74. //获取申请的验证码 shish 2020.2.23
  75. public function actionGetValidateCode()
  76. {
  77. $mobile = Yii::$app->request->get('mobile');
  78. util::success(['code' => rand(1111, 9999)]);
  79. }
  80. }