CustomController.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\saas\classes\ApplyClass;
  4. use bizGhs\custom\classes\CustomClass;
  5. use bizGhs\custom\services\CustomService;
  6. use common\components\stringUtil;
  7. use common\components\util;
  8. use Yii;
  9. use yii\web\Controller;
  10. class CustomController extends BaseController
  11. {
  12. //客户列表 shish 2021.7.8
  13. public function actionList()
  14. {
  15. $get = Yii::$app->request->get();
  16. $type = isset($get['type']) ? $get['type'] : -1;
  17. $name = isset($get['name']) ? $get['name'] : '';
  18. $where = ['ghsId' => $this->ghsId];
  19. switch ($type) {
  20. case 1:
  21. //已开店
  22. $where['isOpen'] = 1;
  23. break;
  24. default:
  25. }
  26. if (!empty($name)) {
  27. if (stringUtil::isMobile($name)) {
  28. $where['mobile'] = $name;
  29. } else {
  30. $where['shopName'] = ['like', $name];
  31. }
  32. }
  33. $list = CustomService::getCustomList($where);
  34. util::success($list);
  35. }
  36. //客户详情 shish 2021.1.8
  37. public function actionDetail()
  38. {
  39. $get = Yii::$app->request->get();
  40. $shopId = isset($get['shopId']) ? $get['shopId'] : -1;
  41. $ghsId = $this->ghsId;
  42. $info = CustomService::getFullInfo($ghsId, $shopId);
  43. CustomClass::valid($info, $this->ghsId);
  44. util::success($info);
  45. }
  46. //允许月结开关 shish 2021.1.8
  47. public function actionDebt()
  48. {
  49. $get = Yii::$app->request->get();
  50. $debt = isset($get['debt']) ? $get['debt'] : 0;
  51. $customId = isset($get['customId']) ? $get['customId'] : 0;
  52. $custom = CustomClass::getById($customId);
  53. CustomClass::valid($custom, $this->ghsId);
  54. CustomClass::debt($custom, $debt);
  55. util::complete();
  56. }
  57. //添加新客户 shish 2021.1.8
  58. public function actionAdd()
  59. {
  60. $get = Yii::$app->request->get();
  61. ApplyClass::addApply($get, 1);
  62. util::complete('已提交审核');
  63. }
  64. }