CustomController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\saas\classes\ApplyClass;
  4. use biz\saas\services\ApplyService;
  5. use bizGhs\custom\classes\CustomClass;
  6. use bizGhs\custom\services\CustomService;
  7. use common\components\stringUtil;
  8. use common\components\util;
  9. use Yii;
  10. use yii\web\Controller;
  11. class CustomController extends BaseController
  12. {
  13. //客户列表 shish 2021.7.8
  14. public function actionList()
  15. {
  16. $get = Yii::$app->request->get();
  17. $type = isset($get['type']) ? $get['type'] : 0;
  18. $name = isset($get['name']) ? $get['name'] : '';
  19. $where = ['ghsId' => $this->ghsId];
  20. switch ($type) {
  21. case 1:
  22. //已开店
  23. $where['isOpen'] = 1;
  24. break;
  25. default:
  26. }
  27. if (!empty($name)) {
  28. if (stringUtil::isMobile($name)) {
  29. $where['mobile'] = $name;
  30. } else {
  31. $where['shopName'] = ['like', $name];
  32. }
  33. }
  34. $list = CustomService::getCustomList($where);
  35. util::success($list);
  36. }
  37. //客户详情 shish 2021.1.8
  38. public function actionDetail()
  39. {
  40. $get = Yii::$app->request->get();
  41. $customId = $get['id'] ?? 0;
  42. $info = CustomService::getCustomInfo($customId);
  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. $post = Yii::$app->request->post();
  61. ApplyService::addCustom($post, $this->ghsId);
  62. util::complete('已提交审核');
  63. }
  64. }