|
@@ -24,14 +24,27 @@ class Cron
|
|
|
*/
|
|
|
|
|
|
# 购买小刊
|
|
|
+ $where['product_id'] = Dever::input('journal_id', 28);
|
|
|
$where['type'] = 1;
|
|
|
+ $where['status'] = 2;
|
|
|
$data = Dever::db('journal/order')->state($where);
|
|
|
+ $score = 20;
|
|
|
if ($data) {
|
|
|
-
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ # 计算该订单能加的积分数
|
|
|
+ if ($v['buy_id'] && $v['buy_id'] > 0) {
|
|
|
+ $buy = Dever::db('journal/buy_num')->one($data['buy_id']);
|
|
|
+ if ($buy && $buy['num'] > 0) {
|
|
|
+ $update_score = $score*$buy['num'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
# 兑换小刊
|
|
|
+ $where['product_id'] = Dever::input('journal_id', 28);
|
|
|
$where['type'] = 2;
|
|
|
+ $where['status'] = 2;
|
|
|
$data = Dever::db('journal/order')->state($where);
|
|
|
}
|
|
|
|
|
@@ -64,7 +77,7 @@ class Cron
|
|
|
{
|
|
|
# 获取该订单所能拥有的兑换码数
|
|
|
$code_num = 1;
|
|
|
- $uid = $order['uid'];
|
|
|
+ $uid = $data['uid'];
|
|
|
if ($data['buy_id'] > 0) {
|
|
|
$buy = Dever::db('journal/buy_num')->one($data['buy_id']);
|
|
|
$code_num = $buy['code'];
|