| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace app\model;
- use think\Model;
- class PlayerControlModel extends Model
- {
- // 设置表名
- protected $name = 'player_control';
- protected $connection = 'fortue_tiger';
- // 设置主键
- protected $pk = 'control_id';
- // 设置自动时间戳
- protected $autoWriteTimestamp = 'int';
- // 设置字段类型
- protected $type = [
- 'control_id' => 'int',
- 'app_id' => 'int', // 商户ID
- 'user_id' => 'int', // 用户ID
- 'player_id' => 'int', // 玩家ID
- 'game_id' => 'string', // 游戏ID
- 'old_rtp' => 'int', // 设置时当前RTP值,
- 'control_rpt' => 'int', // 设置的RTP值
- 'auto_cancel_rtp' => 'int', // 达到此RTP解除点控
- 'max_win_multi' => 'int', // 赢取倍数限制
- 'control_balance' => 'decimal', // 设置时点控那刻当前余额
- 'bet_amount' => 'decimal', // 点控期间 下注总分数
- 'bet_count' => 'int', // 点控期间 下单总数量
- 'total_win_amount' => 'decimal', // 点控期间总输赢
- 'status' => 'int', // 状态 1 正常,0 取消
- 'create_time' => 'int',
- 'update_time' => 'int',
- 'end_time' => 'int',
- ];
- /**
- * 获取点控详情
- * @param $merchantId
- * @param $uname
- * @param $game_id
- * @return mixed
- */
- public static function getPlayerControlInfo($wheres = [])
- {
- return self::where($wheres)->find();
- }
- /**
- * 根据商户ID获取玩家列表
- */
- public static function getPlayerControlList($merchantId, $page = 1, $limit = 10, $wheres = [])
- {
- $query = self::where($wheres);
- $order = $filters['order'] ?? 'create_time';
- $sort = $filters['sort'] ?? 'desc';
- $query->order($order, $sort);
- // 获取总数
- $total = $query->count();
- // 获取列表
- $list = $query->page($page, $limit)->select()->toArray();
- return [
- 'list' => $list,
- 'total' => $total,
- 'page' => $page,
- 'limit' => $limit
- ];
- }
- }
|