|
@@ -504,17 +504,18 @@ class GameLogic
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //得到本代理用户消费排行(现只做下单)
|
|
|
|
|
|
|
+ //得到本代理用户排行榜 {1投注排行 4赚钱排行 .... }
|
|
|
public function ConsumptionRanking()
|
|
public function ConsumptionRanking()
|
|
|
{
|
|
{
|
|
|
- //$type = isset($this->paras['type']) ? $this->paras['type'] : 1;
|
|
|
|
|
$wagetnname = $this->wagetnModel->agent_name;
|
|
$wagetnname = $this->wagetnModel->agent_name;
|
|
|
|
|
+ $type = isset($this->paras['type']) ? intval($this->paras['type']) : 4;
|
|
|
|
|
+
|
|
|
$prlen = strlen($this->wagetnModel->agent_pre);
|
|
$prlen = strlen($this->wagetnModel->agent_pre);
|
|
|
$dtime = date("Y-m-d H") . ":00:00";
|
|
$dtime = date("Y-m-d H") . ":00:00";
|
|
|
|
|
|
|
|
- $key = $wagetnname . '' . $dtime;
|
|
|
|
|
- $cache = cache($key);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $cacheObj = C()->get('cache');
|
|
|
|
|
+ $key = md5($wagetnname . '-' . $dtime . '-' . $type);
|
|
|
|
|
+ $cache = $cacheObj->get($key);
|
|
|
if ($cache && isset($cache['data'])) {
|
|
if ($cache && isset($cache['data'])) {
|
|
|
return $this->makeret(1, 'success', $cache['data']);
|
|
return $this->makeret(1, 'success', $cache['data']);
|
|
|
}
|
|
}
|
|
@@ -522,14 +523,14 @@ class GameLogic
|
|
|
$SQL = <<<LONGSQL
|
|
$SQL = <<<LONGSQL
|
|
|
select "user".*,"money".money from
|
|
select "user".*,"money".money from
|
|
|
(
|
|
(
|
|
|
- select "identity",account from account where "identity" in ( select account_identity from account_detailed where wagent_name=':name')
|
|
|
|
|
|
|
+ select "identity",account from account where "identity" in ( select account_identity from account_detailed where wagent_name=:wname)
|
|
|
) as "user"
|
|
) as "user"
|
|
|
inner join
|
|
inner join
|
|
|
(
|
|
(
|
|
|
select account_identity,sum(money) as money from money_details where account_identity in
|
|
select account_identity,sum(money) as money from money_details where account_identity in
|
|
|
- ( select account_identity from account_detailed where wagent_name=':name')
|
|
|
|
|
- and money_time>=':dtime'
|
|
|
|
|
- and trade_type=1
|
|
|
|
|
|
|
+ ( select account_identity from account_detailed where wagent_name=:wname)
|
|
|
|
|
+ and money_time>=:dtime
|
|
|
|
|
+ and trade_type=:ttype
|
|
|
group by account_identity
|
|
group by account_identity
|
|
|
order by money desc limit 20
|
|
order by money desc limit 20
|
|
|
) as money
|
|
) as money
|
|
@@ -538,7 +539,8 @@ class GameLogic
|
|
|
order by money desc
|
|
order by money desc
|
|
|
LONGSQL;
|
|
LONGSQL;
|
|
|
|
|
|
|
|
- $ret = DB::select($SQL, [':name' => $wagetnname, 'dtime' => $dtime]);
|
|
|
|
|
|
|
+ $ret = S("DB")->select($SQL, [':wname' => $wagetnname, ':ttype' => $type, ':dtime' => $dtime]);
|
|
|
|
|
+
|
|
|
if (!$ret) {
|
|
if (!$ret) {
|
|
|
$return = [];
|
|
$return = [];
|
|
|
} else {
|
|
} else {
|
|
@@ -551,7 +553,7 @@ LONGSQL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$cachedata = ['datetime' => $dtime, 'data' => $return];
|
|
$cachedata = ['datetime' => $dtime, 'data' => $return];
|
|
|
- cache($key, $cachedata, 1800);
|
|
|
|
|
|
|
+ $cacheObj->set($key, $cachedata, 1800);
|
|
|
|
|
|
|
|
return $this->makeret(1, 'success', $return);
|
|
return $this->makeret(1, 'success', $return);
|
|
|
}
|
|
}
|