0 group by oid order by value desc, u.uid asc limit 10 */ public function getDailyWinMoney(int $max=30) { $start = ts_of_day(); $prefix = Env::get('database.prefix', 'eb_'); $tuser = $prefix . 'user'; $tcart_info = $prefix . 'store_order_cart_info'; $torder = $prefix . 'store_order'; $sql = sprintf(" select distinct u.uid, u.avatar, u.nickname, u.level, sum(reparation) as value from %s tsoci inner join %s tso on tsoci.oid=tso.id inner join %s u on tso.uid = u.uid where activity is not null and tso.pay_time > %d and reparation > 0 group by oid order by value desc, u.uid asc limit %d ", $tcart_info, $torder, $tuser, $start, $max); return Db::query($sql); } }