|
@@ -23,6 +23,50 @@ class Content extends Core
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+ # 跑积分
|
|
|
|
+ public function score_actact()
|
|
|
|
+ {
|
|
|
|
+ $where['status'] = 2;
|
|
|
|
+ $where['product_id'] = 15;
|
|
|
|
+ $where['type'] = Dever::input('type', 1);
|
|
|
|
+ $where['buy_id'] = Dever::input('buy_id', 48);
|
|
|
|
+ $id = array
|
|
|
|
+ (
|
|
|
|
+ 48 => 10,
|
|
|
|
+ 49 => 100,
|
|
|
|
+ 50 => 300,
|
|
|
|
+ 51 => 600
|
|
|
|
+ );
|
|
|
|
+ $info = Dever::db('journal/info')->one($where['product_id']);
|
|
|
|
+ $data = Dever::db('journal/order')->state($where);
|
|
|
|
+ $time = Dever::maketime('2019-01-29 14:44:30');
|
|
|
|
+ if ($data) {
|
|
|
|
+ print_r($data);die;
|
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
|
+ if ($v['cdate'] < $time && $v['type'] < 3 && isset($id[$v['buy_id']]) && $id[$v['buy_id']]) {
|
|
|
|
+ $num = $id[$v['buy_id']] - 1;
|
|
|
|
+ $score = $num * $info['score'];
|
|
|
|
+
|
|
|
|
+ $user = Dever::db('score/user')->one($v['uid']);
|
|
|
|
+ if ($user) {
|
|
|
|
+ $update['where_id'] = $user['id'];
|
|
|
|
+ $update['score'] = $user['score'] + $score;
|
|
|
|
+
|
|
|
|
+ print_r($update);die;
|
|
|
|
+ if ($v['type'] == 1) {
|
|
|
|
+ Dever::score($v['uid'], 'buy_journal', '购买小刊', 'act/lib/score.submit?method=pay&type=4&id=' . $v['product_id'], $score, false);
|
|
|
|
+ } elseif ($v['type'] == 2) {
|
|
|
|
+ Dever::score($v['uid'], 'dh_journal', '兑换小刊', 'act/lib/score.submit?method=code&type=4&id=' . $v['product_id'], $score, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 'ok';
|
|
|
|
+ }
|
|
|
|
+
|
|
public function test()
|
|
public function test()
|
|
{
|
|
{
|
|
$journal = Dever::db('journal/info')->one(8);
|
|
$journal = Dever::db('journal/info')->one(8);
|