PtCpController.php 945 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace pt\controllers;
  3. use biz\cp\classes\PtCpClass;
  4. use common\components\stringUtil;
  5. use common\components\util;
  6. use Yii;
  7. class PtCpController extends BaseController
  8. {
  9. public function actionList()
  10. {
  11. $get = Yii::$app->request->get();
  12. $classId = $get['classId'] ?? 0;
  13. $search = $get['search'] ?? '';
  14. $classStyle = $get['classStyle'] ?? -1;
  15. $where = [];
  16. if ($classStyle == 0) {
  17. $where['classId'] = 0;
  18. } else {
  19. if (!empty($classId) && is_numeric($classId)) {
  20. $where['classId'] = $classId;
  21. }
  22. }
  23. if (!empty($search)) {
  24. if (stringUtil::isLetter($search)) {
  25. $where['py'] = ['like', $search];
  26. } else {
  27. $where['name'] = ['like', $search];
  28. }
  29. }
  30. $respond = PtCpClass::getCpList($where);
  31. util::success($respond);
  32. }
  33. }