Game.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. * @author : niuteam
  10. */
  11. namespace app\api\controller;
  12. use app\model\games\Games;
  13. use app\model\games\Record;
  14. /**
  15. * 小游戏
  16. * @author Administrator
  17. *
  18. */
  19. class Game extends BaseApi
  20. {
  21. /**
  22. * 会员中奖纪录分页列表信息
  23. */
  24. public function recordPage()
  25. {
  26. $token = $this->checkToken();
  27. if ($token[ 'code' ] < 0) return $this->response($token);
  28. $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1;
  29. $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS;
  30. $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : 0;
  31. $condition = [
  32. [ 'game_id', '=', $id ],
  33. [ 'is_winning', '=', 1 ],
  34. [ 'member_id', '=', $this->member_id ]
  35. ];
  36. $field = 'member_nick_name,points,is_winning,award_name,award_type,relate_id,relate_name,point,balance,create_time';
  37. $record = new Record();
  38. $list = $record->getGamesDrawRecordPageList($condition, $page, $page_size, 'create_time desc', $field);
  39. return $this->response($list);
  40. }
  41. /**
  42. * 最新一条正在进行的活动
  43. * @return false|string
  44. */
  45. public function newestGame()
  46. {
  47. $res = ( new Games() )->getFirstInfo([ [ 'site_id', '=', $this->site_id ], [ 'status', '=', 1 ] ], 'game_id,game_type', 'game_id desc');
  48. return $this->response($res);
  49. }
  50. }