Selaa lähdekoodia

用户下单后增加用户表的PV值

sunxiaobiao 1 vuosi sitten
vanhempi
commit
cce9ef64e8

+ 3 - 1
app/common/repositories/store/order/StoreOrderRepository.php

@@ -9306,7 +9306,9 @@ class StoreOrderRepository extends BaseRepository
9306 9306
         ];
9307 9307
         // 当状态为1时是实时结算
9308 9308
         if($status == 1) {
9309
-            Db::name('user')->where('uid', $uid)->inc('pv', (float)$pv)->update();
9309
+            // Db::name('user')->where('uid', $uid)->inc('pv', (float)$pv)->update();
9310
+            $con_data = Db::name('user')->where("uid", $uid)->find();
9311
+            Db::name('user')->where("uid", $uid)->update(['pv' => ($con_data['pv']?:0) + $pv]);
9310 9312
             $pv_data['settlement_time'] = date('Y-m-d H:i:s');
9311 9313
         }
9312 9314
         Db::name("user_pv_log")->insert($pv_data);//添加pv记录

+ 3 - 1
app/controller/api/Notify.php

@@ -1469,7 +1469,9 @@ class Notify
1469 1469
         ];
1470 1470
         // 当状态为1时是实时结算
1471 1471
         if($status == 1) {
1472
-            Db::name('user')->where('uid', $uid)->inc('pv', (float)$pv)->update();
1472
+            // Db::name('user')->where('uid', $uid)->inc('pv', (float)$pv)->update();
1473
+            $con_data = Db::name('user')->where("uid", $uid)->find();
1474
+            Db::name('user')->where("uid", $uid)->update(['pv' => ($con_data['pv']?:0) + $pv]);
1473 1475
             $pv_data['settlement_time'] = date('Y-m-d H:i:s');
1474 1476
         }
1475 1477
         Db::name("user_pv_log")->insert($pv_data);//添加pv记录