MemberChangeController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\custom\classes\CustomClass;
  4. use bizHd\member\classes\MemberChangeClass;
  5. use common\components\dateUtil;
  6. use common\components\util;
  7. use Yii;
  8. class MemberChangeController extends BaseController
  9. {
  10. public $guestAccess = [];
  11. public function actionList()
  12. {
  13. $get = Yii::$app->request->get();
  14. $where = [];
  15. $where['mainId'] = $this->mainId;
  16. $searchTime = $get['searchTime'] ?? '';
  17. if (!empty($searchTime)) {
  18. $startTime = $get['startTime'] ?? '';
  19. $endTime = $get['endTime'] ?? '';
  20. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  21. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  22. }
  23. $customId = $get['customId'] ?? 0;
  24. if (!empty($customId)) {
  25. $custom = CustomClass::getById($customId, true);
  26. if (empty($custom)) {
  27. util::fail('找不到客户');
  28. }
  29. $shopId = $this->shopId;
  30. if ($custom->shopId != $shopId) {
  31. util::fail('不是你的客户');
  32. }
  33. $where['customId'] = $customId;
  34. }
  35. $respond = MemberChangeClass::getChangeList($where);
  36. util::success($respond);
  37. }
  38. }