|
@@ -62,19 +62,45 @@ class Cron
|
|
|
# 购买小刊
|
|
|
$where['product_id'] = 28;
|
|
|
$where['status'] = 2;
|
|
|
+ //$this->score = 20;
|
|
|
|
|
|
# 重建积分排行
|
|
|
foreach ($data as $k => $v) {
|
|
|
$where['uid'] = $v['uid'];
|
|
|
$order = Dever::db('journal/order')->state($where);
|
|
|
|
|
|
+ $score = 0;
|
|
|
if ($order) {
|
|
|
- $this->paiOrder($order);
|
|
|
+ foreach ($order as $k1 => $v1) {
|
|
|
+ $score += $this->paiOrder($v1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ print_r($score);die;
|
|
|
+ if ($score > 0) {
|
|
|
+ Dever::db('act/score')->update(array('where_id' => $v['id'], 'score' => $score));
|
|
|
+ } else {
|
|
|
+ Dever::db('act/score')->update(array('where_id' => $v['id'], 'score' => 'null'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ return 'ok';
|
|
|
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ private function paiOrder($order)
|
|
|
+ {
|
|
|
+ $score = 0;
|
|
|
+ if ($order['type'] <= 2) {
|
|
|
+ # 购买小刊、兑换小刊增加积分
|
|
|
+ if ($order['buy_id'] > 0) {
|
|
|
+ $buy = Dever::db('journal/buy_num')->one($order['buy_id']);
|
|
|
+ if ($buy) {
|
|
|
+ $num = $buy['num'];
|
|
|
+ $score = $num*20;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $score;
|
|
|
}
|
|
|
|
|
|
|