PlayerControlModel.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. ];
  32. /**
  33. * 获取点控详情
  34. * @param $merchantId
  35. * @param $uname
  36. * @param $game_id
  37. * @return mixed
  38. */
  39. public static function getPlayerControlInfo($merchantId, $player_id, $game_id)
  40. {
  41. return self::where(['app_id' => $merchantId, 'player_id' => $player_id, 'game_id' => $game_id])->find();
  42. }
  43. /**
  44. * 根据商户ID获取玩家列表
  45. */
  46. public static function getPlayerControlList($merchantId, $page = 1, $limit = 10, $wheres = [])
  47. {
  48. $query = self::where($wheres);
  49. $order = $filters['order'] ?? 'create_time';
  50. $sort = $filters['sort'] ?? 'desc';
  51. $query->order($order, $sort);
  52. // 获取总数
  53. $total = $query->count();
  54. // 获取列表
  55. $list = $query->page($page, $limit)->select()->toArray();
  56. return [
  57. 'list' => $list,
  58. 'total' => $total,
  59. 'page' => $page,
  60. 'limit' => $limit
  61. ];
  62. }
  63. /**
  64. * 创建角色
  65. * @param array $data 角色数据
  66. */
  67. public static function updatePlayerControl(array $data)
  68. {
  69. self:create($data);
  70. }
  71. }