CustomController.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\sj\classes\SjClass;
  4. use bizHd\saas\classes\ApplyClass;
  5. use bizHd\saas\services\ApplyService;
  6. use bizGhs\custom\classes\CustomClass;
  7. use bizGhs\custom\services\CustomService;
  8. use common\components\stringUtil;
  9. use common\components\util;
  10. use Yii;
  11. class CustomController extends BaseController
  12. {
  13. //客户列表 ssh 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 = ['ownShopId' => $this->shopId];
  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['name'] = ['like', $name];
  32. }
  33. }
  34. $list = CustomService::getCustomList($where);
  35. util::success($list);
  36. }
  37. //客户详情 ssh 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->shopId);
  44. util::success($info);
  45. }
  46. //允许月结开关 ssh 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->shopId);
  54. CustomClass::debt($custom, $debt);
  55. util::complete();
  56. }
  57. //欠款客户 ssh 2021.2.4
  58. public function actionDebtList()
  59. {
  60. $get = Yii::$app->request->get();
  61. $where = ['ownShopId' => $this->shopId, 'isDebt' => 1];
  62. if (isset($get['name']) && !empty($get['name'])) {
  63. $where['name'] = ['like', $get['name']];
  64. }
  65. $list = CustomService::getDebtList($where);
  66. //共X个客户,合计欠款XXX元
  67. $shop = $this->shop;
  68. $list['customNum'] = $shop->mayGatheringNum ?? 0;
  69. $list['debtAmount'] = $shop->mayGathering ?? 0.00;
  70. util::success($list);
  71. }
  72. }