LiveRoomGoods.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\model\LiveRoomGoodsModel;
  4. use app\common\model\UserModel;
  5. use App\Utils\AppResult;
  6. use think\Request;
  7. /**
  8. * Admin 模块父级
  9. * Module 接管 CURD 公共操作
  10. * Class ModuleController
  11. * @package App\Http\Controllers\Framework
  12. */
  13. class LiveRoomGoods extends VueModule
  14. {
  15. public function callAction($method, $parameters = [])
  16. {
  17. // 获取请求参数 用于二次处理
  18. $params = $this->params;
  19. $this->model = new LiveRoomGoodsModel();
  20. // 根据不同方法处理一些业务
  21. switch ($method) {
  22. case 'index':
  23. // 请求类型是否为POST
  24. if ($this->isPost) {
  25. // 条件语句
  26. if (!empty($params['keyword'])) {
  27. $this->model->where('nickname|mobile', 'like', "%{$params['keyword']}%");
  28. }
  29. if (!empty($params['gender'])) $this->model->where('gender', $params['gender']);
  30. $this->model->with(['room','goods']);
  31. $this->model->order('is_top','desc');
  32. $this->model->order('goods_no','asc');
  33. }
  34. break;
  35. // case 'insert':
  36. // break;
  37. // case 'update':
  38. // break;
  39. default:
  40. break;
  41. }
  42. return parent::callAction($method, $parameters); // TODO: Change the autogenerated stub
  43. }
  44. public function __construct(Request $request = null)
  45. {
  46. parent::__construct($request);
  47. }
  48. }