GameListLogic.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * GameListLogic.php UTF-8
  4. * 游戏列表逻辑
  5. *
  6. * @date : 2018/5/19 16:25
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\logic\game;
  13. use huo\model\common\CommonModel;
  14. use huo\model\game\GameModel;
  15. class GameListLogic extends CommonModel {
  16. /**
  17. * @param array $param
  18. *
  19. * @return array
  20. */
  21. protected function getWhere($param = []) {
  22. $_map = [];
  23. if (!empty($param['game_id'])) {
  24. $_map['app_id'] = $param['game_id'];
  25. }
  26. if (!empty($param['app_id'])) {
  27. $_map['app_id'] = $param['app_id'];
  28. }
  29. if (!empty($param['benefit_type'])) {
  30. $_map['benefit_type'] = $param['benefit_type'];
  31. }
  32. if (!empty($param['promote_switch'])) {
  33. $_map['promote_switch'] = $param['promote_switch'];
  34. }
  35. if (!empty($param['classify'])) {
  36. $_map['classify'] = $param['classify'];
  37. }
  38. return $_map;
  39. }
  40. public function getField() {
  41. return [];
  42. }
  43. /**
  44. * @param array $field
  45. * @param $where
  46. * @param string $page
  47. * @param string $order
  48. *
  49. * @return \think\Paginator
  50. * @throws \think\exception\DbException
  51. */
  52. public function getAdminTgList($field = [], $where, $order = '-create_time') {
  53. $_map = $where;
  54. $_model = new GameModel();
  55. $order = $this->orderFilter($order);
  56. return $_model->with('rate')->field($field)->where($_map)->order($order)->paginate();
  57. }
  58. }