params['level'] ; $where = " ur.level = $level "; $field = 'ur.id as ur_id,ur.level,ur.create_time'; $field .= ',u.id,u.sn,u.mobile,u.total_income_invest,u.total_recharge,u.total_withdraw'; $lists = User::alias('u') ->join('user_relation ur', 'u.id = ur.user_id') ->field($field) ->append(['team_num','item_num']) ->where($where) ->where([ 'ur.parent_id' => $this->userId, ]) ->where(" level <= $distributeLevel ") ->limit($this->limitOffset, $this->limitLength) ->order(['ur.create_time' => 'desc','ur.id' => 'desc']) ->select() ->toArray(); //查询语言 $timeFormat = 'Y-m-d H:i:s'; $language = Language::where(['symbol' => $this->params['lang']])->findOrEmpty(); if (!$language->isEmpty()) { $timeFormat = $language['time_format']; } foreach ($lists as &$item) { if($level != 1){ $item['mobile'] = substr_replace($item['mobile'], str_repeat('*', 4), 2, 4); } $item['create_time'] = date($timeFormat, strtotime($item['create_time'])); } return $lists; } /** * @notes 获取抢单记录数量 * @return int * @author bd * @date 2024/01/31 14:07 */ public function count(): int { $distributeLevel = UtilsService::get_distribute_level(); $where = '1 = 1'; if( $this->params['level'] != 0){ $level = $this->params['level'] ; $where = " ur.level = $level "; } return User::alias('u') ->join('user_relation ur', 'u.id = ur.user_id') ->where($where) ->where([ 'ur.parent_id' => $this->userId, ]) ->count(); } }