Jelajahi Sumber

增加是否会员

ZxcZxc123 1 tahun lalu
induk
melakukan
85d31a7ff5
2 mengubah file dengan 23 tambahan dan 2 penghapusan
  1. 7 1
      app/models/store/StoreCart.php
  2. 16 1
      app/models/store/StoreOrder.php

+ 7 - 1
app/models/store/StoreCart.php

@@ -172,6 +172,7 @@ class StoreCart extends BaseModel
         if (!count($list)) return compact('valid', 'invalid');
         $now = time();
         $store_order = 0;
+        $user = 0;
         foreach ($list as $k => $cart) {
             if ($cart['seckill_id']) {
                 $product = StoreSeckill::field($seckillInfoField)
@@ -276,6 +277,11 @@ class StoreCart extends BaseModel
             if (($valid[$k]['productInfo']['is_best'] ?? 0) > 0) {
                 $store_order = 1;
             }
+            if (($valid[$k]['productInfo']['is_best'] ?? 0) > 0) {
+                $user = 1;
+            }
+
+
 
             unset($valid[$k]['uid'], $valid[$k]['is_del'], $valid[$k]['is_new'], $valid[$k]['is_pay'], $valid[$k]['add_time']);
             if (isset($valid[$k]['productInfo'])) {
@@ -289,7 +295,7 @@ class StoreCart extends BaseModel
             }
         }
 
-        return compact('valid', 'invalid', 'store_order');
+        return compact('valid', 'invalid', 'store_order','user');
     }
 
     /**

+ 16 - 1
app/models/store/StoreOrder.php

@@ -806,7 +806,16 @@ class StoreOrder extends BaseModel
     public static function set_parent($uid, $price)
     {
         $user = Users::getUserInfo($uid);
-        if ($user['parent']) return true;
+        if ($user['parent']) {
+
+            if (!$user['is_best']) {
+
+                return true;
+            }
+        } else {
+
+            return true;
+        }
         $spread = Users::getUserInfo($user['spread_uid']);
         $parent = 0;
         $parent_area = 'A';
@@ -853,6 +862,12 @@ class StoreOrder extends BaseModel
             }
         }
 //        return true;
+
+        if(!$parent){
+            return true;
+        }
+
+
         BaseModel::beginTrans();
         try {
             Users::where('uid', $uid)->update(['parent' => $parent, 'parent_area' => $parent_area]);