Kaynağa Gözat

完善微信回调

15954078560 2 yıl önce
ebeveyn
işleme
2bc00e4b4a
1 değiştirilmiş dosya ile 17 ekleme ve 2 silme
  1. 17 2
      application/api/controller/Notify.php

+ 17 - 2
application/api/controller/Notify.php

@@ -99,8 +99,15 @@ class Notify extends Api
                         'createtime' => time()
                     ];
                     $sys_rs = Db::name('sys_msg')->insertGetId($data);
+                    //增加成长值
+                    $paygrowth = (int)config('site.paygrowth'); //每消费1元赠送成长值数量, 1元=?成长值
+                    $balance = floor($paygrowth * $order_info['money']);
+                    $paygrowth_rs = 1;
+                    if ($balance > 0) {
+                        $paygrowth_rs = create_growth_log($balance, '微信支付活动订单', $order_info['user_id'], 3);
+                    }
 
-                    if ($active_order_rs && $active_people_rs && $invite_coupon_rs && $sys_rs) {
+                    if ($active_order_rs && $active_people_rs && $invite_coupon_rs && $sys_rs && $paygrowth_rs == 1) {
                         Db::commit();
                     } else {
                         Db::rollback();
@@ -144,7 +151,15 @@ class Notify extends Api
                             }
                         }
                     }
-                    if ($rs == 1 && $invite_coupon_rs) {
+                    //增加成长值
+                    $paygrowth = (int)config('site.paygrowth'); //每消费1元赠送成长值数量, 1元=?成长值
+                    $balance = floor($paygrowth * $order_info['money']);
+                    $paygrowth_rs = 1;
+                    if ($balance > 0) {
+                        $paygrowth_rs = create_growth_log($balance, '充值', $order_info['user_id'], 2);
+                    }
+
+                    if ($rs == 1 && $invite_coupon_rs && $paygrowth_rs == 1) {
                         Db::commit();
                     } else {
                         Db::rollback();