PlayerControlModel.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class PlayerControlModel extends Model
  5. {
  6. // 设置表名
  7. protected $name = 'player_control';
  8. protected $connection = 'fortue_tiger';
  9. // 设置主键
  10. protected $pk = 'control_id';
  11. // 设置自动时间戳
  12. protected $autoWriteTimestamp = 'int';
  13. // 设置字段类型
  14. protected $type = [
  15. 'control_id' => 'int',
  16. 'app_id' => 'int', // 商户ID
  17. 'user_id' => 'int', // 用户ID
  18. 'player_id' => 'int', // 玩家ID
  19. 'game_id' => 'string', // 游戏ID
  20. 'old_rtp' => 'int', // 设置时当前RTP值,
  21. 'control_rpt' => 'int', // 设置的RTP值
  22. 'auto_cancel_rtp' => 'int', // 达到此RTP解除点控
  23. 'max_win_multi' => 'int', // 赢取倍数限制
  24. 'control_balance' => 'decimal', // 设置时点控那刻当前余额
  25. 'bet_amount' => 'int', // 点控期间 下注总分数
  26. 'bet_count' => 'int', // 点控期间 下单总数量
  27. 'total_win_amount' => 'int', // 点控期间总输赢
  28. 'status' => 'int', // 状态 1 正常,0 取消
  29. 'create_time' => 'int',
  30. 'update_time' => 'int',
  31. 'end_time' => 'int',
  32. ];
  33. /**
  34. * 获取点控详情
  35. * @param $merchantId
  36. * @param $uname
  37. * @param $game_id
  38. * @return mixed
  39. */
  40. public static function getPlayerControlInfo($wheres = [])
  41. {
  42. return self::where($wheres)->find();
  43. }
  44. /**
  45. * 根据商户ID获取玩家列表
  46. */
  47. public static function getPlayerControlList($merchantId, $page = 1, $limit = 10, $wheres = [])
  48. {
  49. $query = self::where($wheres);
  50. $order = $filters['order'] ?? 'create_time';
  51. $sort = $filters['sort'] ?? 'desc';
  52. $query->order($order, $sort);
  53. // 获取总数
  54. $total = $query->count();
  55. // 获取列表
  56. $list = $query->page($page, $limit)->select()->toArray();
  57. return [
  58. 'list' => $list,
  59. 'total' => $total,
  60. 'page' => $page,
  61. 'limit' => $limit
  62. ];
  63. }
  64. }