| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace app\common;
- use think\facade\Db;
- class CommonMerchantUserAndBalance
- {
- const merchant_user_table = 'tp_merchants_user';
- const merchant_user_balance_table = 'tp_merchants_user_balance';
- const merchant_user_game_rtp_win_bet = "tp_game_rtp_win_bet";
- const table_name = 'fortue_tiger';
- public static function getFortueTigerTable()
- {
- return Db::connect(self::table_name);
- }
- /**
- * 获取指定用户的游戏 rtp win bet
- * @param $wheres
- * @param $field
- * @return mixed
- */
- public static function getMerchantUserGameRtpWinBetInfo($wheres, $field = [])
- {
- $query = self::getFortueTigerTable()->table(self::merchant_user_game_rtp_win_bet)->where($wheres);
- if(!empty($field)){
- $query = $query->field($field);
- }
- return $query->select()->toArray();
- }
- /**
- * 批量获取用户余额
- * @param $userIds
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public static function getMerchantUserBalance($userIds, $field = ['user_id', 'balance']) {
- $query = self::getFortueTigerTable()->table(self::merchant_user_balance_table)->whereIn('user_id', $userIds);
- if(!empty($field)) {
- $query = $query->field($field);
- }
- return $query->select()->toArray();
- }
- /**
- * 批量获取用户信息
- * @param $userIds
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public static function getMerchantUser($userIds, $field = ['user_id', 'nickname'])
- {
- $query = self::getFortueTigerTable()->table(self::merchant_user_table)->whereIn('user_id', $userIds);
- if(!empty($field)){
- $query = $query->field($field);
- }
- return $query->select()->toArray();
- }
- }
|