BookCustomController.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\book\classes\BookCustomClass;
  4. use common\components\stringUtil;
  5. use common\components\util;
  6. use Yii;
  7. class BookCustomController extends BaseController
  8. {
  9. //预订客户列表 ssh 20240616
  10. public function actionList()
  11. {
  12. $get = Yii::$app->request->get();
  13. $where = [];
  14. $where['mainId'] = $this->mainId;
  15. $bookSn = $get['bookSn'] ?? '';
  16. if (empty($bookSn)) {
  17. $shop = $this->shop;
  18. $bookSn = $shop->bookSn ?? 0;
  19. if (empty($bookSn)) {
  20. util::success(['list' => [], 'hint' => 'no bookSn']);
  21. }
  22. }
  23. $search = $get['search']??'';
  24. $where['bookSn'] = $bookSn;
  25. if (!empty($search)) {
  26. if(is_numeric($search)){
  27. $where['seatSn'] = $search;
  28. }elseif (stringUtil::isLetter($search)) {
  29. $search = strtolower($search);
  30. $where['py'] = ['like', $search];
  31. } else {
  32. $where['name'] = ['like', $search];
  33. }
  34. }
  35. $list = BookCustomClass::getAllByCondition($where, '(bookNum-onNum) DESC', '*');
  36. util::success(['list' => $list]);
  37. }
  38. }