CommonMerchantUserAndBalance.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\common;
  3. use think\facade\Db;
  4. class CommonMerchantUserAndBalance
  5. {
  6. const merchant_user_table = 'tp_merchants_user';
  7. const merchant_user_balance_table = 'tp_merchants_user_balance';
  8. const merchant_user_game_rtp_win_bet = "tp_game_rtp_win_bet";
  9. const table_name = 'fortue_tiger';
  10. public static function getFortueTigerTable()
  11. {
  12. return Db::connect(self::table_name);
  13. }
  14. /**
  15. * 获取指定用户的游戏 rtp win bet
  16. * @param $wheres
  17. * @param $field
  18. * @return mixed
  19. */
  20. public static function getMerchantUserGameRtpWinBetInfo($wheres, $field = [])
  21. {
  22. $query = self::getFortueTigerTable()->table(self::merchant_user_game_rtp_win_bet)->where($wheres);
  23. if(!empty($field)){
  24. $query = $query->field($field);
  25. }
  26. return $query->select()->toArray();
  27. }
  28. /**
  29. * 批量获取用户余额
  30. * @param $userIds
  31. * @return array
  32. * @throws \think\db\exception\DataNotFoundException
  33. * @throws \think\db\exception\DbException
  34. * @throws \think\db\exception\ModelNotFoundException
  35. */
  36. public static function getMerchantUserBalance($userIds, $field = ['user_id', 'balance']) {
  37. $query = self::getFortueTigerTable()->table(self::merchant_user_balance_table)->whereIn('user_id', $userIds);
  38. if(!empty($field)) {
  39. $query = $query->field($field);
  40. }
  41. return $query->select()->toArray();
  42. }
  43. /**
  44. * 批量获取用户信息
  45. * @param $userIds
  46. * @return array
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\DbException
  49. * @throws \think\db\exception\ModelNotFoundException
  50. */
  51. public static function getMerchantUser($userIds, $field = ['user_id', 'nickname'])
  52. {
  53. $query = self::getFortueTigerTable()->table(self::merchant_user_table)->whereIn('user_id', $userIds);
  54. if(!empty($field)){
  55. $query = $query->field($field);
  56. }
  57. return $query->select()->toArray();
  58. }
  59. }