| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\model;
- use think\Model;
- class MerchantUserAndBalanceModel extends Model
- {
- /**
- * 批量获取用户余额
- * @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::table('tp_merchants_user_balance')->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::table('tp_merchants_user')->whereIn('user_id', $userIds);
- if(!empty($field)){
- $query = $query->field($field);
- }
- return $query->select()->toArray();
- }
- }
|