|
@@ -55,7 +55,7 @@ class Cron
|
|
|
}
|
|
|
|
|
|
# 重新计算排行榜
|
|
|
- public function pai2_api()
|
|
|
+ public function pai3_api()
|
|
|
{
|
|
|
$id = Dever::input('product_id', 28);
|
|
|
$data = Dever::db('act/score')->state(array('type' => 4, 'data_id' => $id));
|
|
@@ -65,13 +65,10 @@ class Cron
|
|
|
$where['status'] = 2;
|
|
|
//$this->score = 20;
|
|
|
|
|
|
- print_r($data);
|
|
|
-
|
|
|
# 重建积分排行
|
|
|
foreach ($data as $k => $v) {
|
|
|
$where['uid'] = $v['uid'];
|
|
|
$order = Dever::db('journal/order')->state($where);
|
|
|
- print_r($order);
|
|
|
|
|
|
$score = 0;
|
|
|
if ($order) {
|
|
@@ -93,13 +90,18 @@ class Cron
|
|
|
$score = 0;
|
|
|
if ($order['type'] <= 2) {
|
|
|
# 购买小刊、兑换小刊增加积分
|
|
|
- if ($order['buy_id'] > 0) {
|
|
|
+ if ($order['type'] == 1 && $order['buy_id'] > 0) {
|
|
|
$buy = Dever::db('journal/buy_num')->one($order['buy_id']);
|
|
|
- print_r($buy);
|
|
|
if ($buy) {
|
|
|
$num = $buy['num'];
|
|
|
$score = $num*20;
|
|
|
}
|
|
|
+ } elseif ($order['type'] == 2 && $order['code']) {
|
|
|
+ $code = Dever::db('code/info')->one(array('code' => $order['code']));
|
|
|
+ if ($code) {
|
|
|
+ $num = $code['product_num'];
|
|
|
+ $score = $num*20;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return $score;
|