ApplyController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace saas\controllers;
  3. use biz\merchant\classes\MerchantClass;
  4. use biz\saas\services\ApplyService;
  5. use common\components\util;
  6. use Yii;
  7. use yii\web\Controller;
  8. class ApplyController extends BaseController
  9. {
  10. //申请列表
  11. public function actionList()
  12. {
  13. $get = Yii::$app->request->get();
  14. $style = $get['style'] ?? MerchantClass::STYLE_RETAIL;
  15. $status = $get['status'] ?? 0;
  16. $where = [];
  17. if (!empty($status)) {
  18. $where['status'] = $status;
  19. }
  20. $where['style'] = $style;
  21. $list = ApplyService::getApplyList($where);
  22. util::success($list);
  23. }
  24. //审核
  25. public function actionCheck()
  26. {
  27. $id = Yii::$app->request->post('id');
  28. $status = Yii::$app->request->post('status', 0);
  29. $remark = Yii::$app->request->post('remark', '');
  30. $apply = ApplyService::getById($id);
  31. if (empty($apply)) {
  32. util::fail('找不到申请记录');
  33. }
  34. if ($apply['status'] != 0) {
  35. util::fail('已经审过了');
  36. }
  37. ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
  38. if ($status == 1) {
  39. ApplyService::pass($id);
  40. }
  41. util::success('操作成功');
  42. }
  43. //申请试用登记 shish 2020.1.11
  44. public function actionRegister()
  45. {
  46. $post = Yii::$app->request->post();
  47. $rand = rand(0, 1);
  48. $data = ['focus' => 1, 'qrCode' => ''];
  49. if ($rand == 0) {
  50. $data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
  51. }
  52. util::success($data);
  53. }
  54. //申请状态
  55. public function actionApplyStatus()
  56. {
  57. $status = rand(0, 4);
  58. util::success(['status' => $status]);
  59. }
  60. }