GameImproveRtpUsersGlobalModel.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class GameImproveRtpUsersGlobalModel extends Model
  5. {
  6. // 设置表名
  7. protected $name = 'improve_rtp_users_global_control';
  8. // 设置主键
  9. protected $pk = 'id';
  10. protected $connection = 'fortue_tiger';
  11. // 设置自动时间戳
  12. protected $autoWriteTimestamp = 'int';
  13. // 设置字段类型
  14. protected $type = [
  15. 'id' => 'int',
  16. 'app_id' => 'int', // 商户ID
  17. 'user_id' => 'int', // 用户ID
  18. 'bet_amount' => 'decimal', // 点控期间 下注总分数
  19. 'bet_count' => 'int', // 点控期间 下单总数量
  20. 'total_win_amount' => 'decimal', // 点控期间总输赢
  21. 'winning_score' => 'decimal',
  22. 'status' => 'int', // 状态 1 正常,0 取消
  23. 'round_status' => 'int', // 轮开始 1 开始, 2 已满足
  24. 'round_count' => 'int',
  25. 'open_status_time' => 'int', // 每轮开始的时间
  26. 'create_time' => 'int',
  27. 'update_time' => 'int',
  28. 'end_time' => 'int',
  29. ];
  30. public static function getUserInfo($app_id, $user_id)
  31. {
  32. $where = ['app_id' => $app_id, 'user_id' => $user_id];
  33. $info = self::where($where)->find();
  34. if (empty($info)) {
  35. self::create($where);
  36. $info = self::where($where)->find();
  37. }
  38. return $info;
  39. }
  40. }