From c324d025d53b290155bdb9b52adfa3b33b3110d4 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Mon, 8 Jul 2024 10:36:26 +0800
Subject: [PATCH 01/37] =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8E=A8=E5=B8=88?=
 =?UTF-8?q?=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../StoreFinanceFlowLists.php                   | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
index 53384f8c5..70e936b6e 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
@@ -75,11 +75,24 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
                 if (!empty($this->request->adminInfo['store_id'])) {
                     $item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
                 }
+                //厨师判断 other_uid不为空 user_ship=1厨师
+                $cookCheck = 0;
+                if(!empty($item['other_uid']) && $item['other_uid'] >0){
+                    $cookCheck = User::where('id', $item['other_uid'])->value('user_ship')??0;
+                }
                 if ($item['financial_pm'] == 0) {
                     $item['number'] = '-' . $item['number'];
-                    $item['financial_type_name'] = '订单支出:' . OrderEnum::getFinancialType($item['financial_type']);
+                    $Identity =  OrderEnum::getFinancialType($item['financial_type']);
+                    if($cookCheck == 1 && $item['financial_type'] ==12){
+                        $Identity ="厨师";
+                    }
+                    $item['financial_type_name'] = '订单支出:' .$Identity;
                 } else {
-                    $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']) . '获得';
+                    $Identity =  OrderEnum::getFinancialType($item['financial_type']);
+                    if($cookCheck == 1  && $item['financial_type'] ==12){
+                        $Identity ="厨师";
+                    }
+                    $item['financial_type_name'] = $Identity . '获得';
                     $item['number'] = '+' . $item['number'];
                 }
                 $item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name');

From cbdf2c2431a9db42f26530eae52f39283aee2e1f Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Mon, 8 Jul 2024 10:45:40 +0800
Subject: [PATCH 02/37] =?UTF-8?q?=E6=A0=B8=E9=94=80=E4=BF=AE=E6=94=B9?=
 =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E5=95=86=E5=93=81=E7=BB=9F=E8=AE=A1?=
 =?UTF-8?q?=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/logic/order/OrderLogic.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 2423d9242..28015efda 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -21,6 +21,7 @@ use app\common\model\store_order\StoreOrder;
 use app\common\model\store_order_cart_info\StoreOrderCartInfo;
 use app\common\model\store_product\StoreProduct;
 use app\common\model\store_product_attr_value\StoreProductAttrValue;
+use app\common\model\store_product_log\StoreProductLog;
 use app\common\model\store_product_unit\StoreProductUnit;
 use app\common\model\system_store\SystemStore;
 use app\common\model\system_store\SystemStoreStaff;
@@ -529,6 +530,12 @@ class OrderLogic extends BaseLogic
                 'store_id' => $params['store_id'],
                 'staff_id' => $params['staff_id'] ?? 0,
             ], ['id' => $order['id']]);
+            //修改商品统计记录标识
+            (new StoreProductLog())->update(
+                [
+                    'store_id' => $params['store_id']
+                ], ['oid' => $order['id']]
+            );
             (new StoreOrderCartInfo())->update([
                 'verify_code' => $params['verify_code'] . '-1',
                 'writeoff_time' => time(),

From 4035333cd4052df5af90e751207dce93f810e951 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Mon, 8 Jul 2024 15:15:15 +0800
Subject: [PATCH 03/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0?=
 =?UTF-8?q?=E7=9A=84=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/admin/logic/user/UserLogic.php | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php
index e295d425e..50a6ef4ac 100644
--- a/app/admin/logic/user/UserLogic.php
+++ b/app/admin/logic/user/UserLogic.php
@@ -283,6 +283,15 @@ class UserLogic extends BaseLogic
                     ->page($params['page_no'],$params['page_size'])
                     ->order('id','desc')
                     ->select()->toArray();
+                foreach ($data as &$value){
+                    if($value['status'] == 0){
+                        $value['title'] = "购买商品".$value['all']."元获得".$value['number']."元返还金";
+                    }else{
+                        //退回到余额、微信、采购款
+                        $back = self::dealTitleCate($value['pay_type']);
+                        $value['title'] = "返还金解冻".$value['number']."元退回到".$back;
+                    }
+                }
                 break;
             default:
                 $data = [];
@@ -309,4 +318,29 @@ class UserLogic extends BaseLogic
         ];
 
     }
+
+    public static function dealTitleCate($pay_type)
+    {
+        switch ($pay_type){
+            case 18:
+                $title = "采购款";
+                break;
+            case 17:
+                $title = "现金";
+                break;
+            case 3:
+                $title ="余额";
+                break;
+            case 7:
+            case 9:
+                $title ="微信";
+                break;
+            case 13:
+                $title ="支付宝";
+                break;
+            default:
+                $title ="默认";
+        }
+        return $title;
+    }
 }

From 07ffabfa52b9f578e1df69ad0b3d9144d7e03213 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Mon, 8 Jul 2024 15:18:56 +0800
Subject: [PATCH 04/37] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4StoreFinanceFlo?=
 =?UTF-8?q?wLists=E4=B8=AD=E7=9A=84=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../StoreFinanceFlowLists.php                 | 52 -------------------
 1 file changed, 52 deletions(-)

diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
index 70e936b6e..a9e09c936 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
@@ -99,58 +99,6 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
                 $item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : '';
                 $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
             })->toArray();
-
-        // foreach ($data as $key => $item) {
-        //     $list1 = StoreFinanceFlow::where('order_id', $item['order_id'])->where('financial_type', '>', 1)->field($field)->select()->each(function ($item) {
-        //         if ($item['user_id'] <= 0) {
-        //             $item['nickname'] = '游客';
-        //         } else {
-        //             $id = $item['user_id'];
-        //             $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id";
-        //         }
-        //         if (!empty($this->request->adminInfo['store_id'])) {
-        //             $item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
-        //         }
-        //         if ($item['financial_pm'] == 0) {
-        //             $item['number'] = '-' . $item['number'];
-        //             $item['financial_type_name'] = '订单支出:' . OrderEnum::getFinancialType($item['financial_type']);
-        //         } else {
-        //             $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']) . '获得';
-        //             $item['number'] = '+' . $item['number'];
-        //         }
-        //         $item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name');
-        //         $item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : '';
-        //         $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
-        //     });
-        //     $list2 = UserSign::where('order_id', $item['order_sn'])->whereIn('user_ship', [0, 2, 3])->select();
-        //     foreach ($list2 as $k => $v) {
-        //         $list2[$k]['id'] = 'JF' . $v['id'];
-        //         $list2[$k]['order_sn'] = $item['order_sn'];
-        //         $list2[$k]['store_name'] = $item['store_name'];
-        //         if($v['user_ship']==0){
-        //             $list2[$k]['financial_pm'] = 1;
-        //             $list2[$k]['number'] = '+' . $v['number'];
-        //         }else{
-        //             if($v['financial_pm']==1){
-        //                 $list2[$k]['financial_pm'] = 1;
-        //                 $list2[$k]['number'] = '+' . $v['number'];
-        //             }else{
-        //                 $list2[$k]['financial_pm'] = 0;
-        //                 $list2[$k]['number'] = '-' . $v['number'];
-        //             }
-        //         }
-        //         $list2[$k]['nickname'] = $v['uid'] > 0 ? User::where('id', $v['uid'])->value('nickname') . '|' . $v['uid'] : '游客';
-        //         $list2[$k]['financial_type_name'] = $v['title'];
-        //         $list2[$k]['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
-        //     }
-        //     $list3 = array_merge($list1->toArray(), $list2->toArray());
-        //     // 提取 financial_pm 字段到单独的数组
-        //     $financial_pm = array_column($list3, 'financial_pm');
-
-        //     // 对 financial_pm 数组进行排序,这将影响原始数组
-        //     array_multisort($financial_pm, SORT_ASC, $list3);
-        //     $data[$key]['list']=$list3;
-        // }
         return $data;
     }
 

From 820869016cb85f11798d4bbd9d12f95594fbe3db Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Mon, 8 Jul 2024 15:47:07 +0800
Subject: [PATCH 05/37] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=86=BB=E7=BB=93?=
 =?UTF-8?q?=E5=88=B8=E8=AF=A6=E6=83=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/admin/controller/user/UserController.php     | 15 +++++++++++++++
 app/api/lists/user_sign_log/UserSignLogLists.php |  7 ++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/app/admin/controller/user/UserController.php b/app/admin/controller/user/UserController.php
index 3beea43fb..722f5501c 100644
--- a/app/admin/controller/user/UserController.php
+++ b/app/admin/controller/user/UserController.php
@@ -8,6 +8,8 @@ use app\admin\controller\BaseAdminController;
 use app\admin\lists\user\UserLists;
 use app\admin\logic\user\UserLogic;
 use app\admin\validate\user\UserValidate;
+use app\api\lists\user_sign\UserSignLists;
+use app\api\lists\user_sign_log\UserSignLogLists;
 
 class UserController extends BaseAdminController
 {
@@ -82,6 +84,19 @@ class UserController extends BaseAdminController
         
     }
 
+
+    /**
+     * 礼品券/冻结券
+     */
+    public function userSing()
+    {
+        return $this->dataLists(new UserSignLogLists());
+
+    }
+
+
+
+
     //用户领取列表
     public function userGiftList()
     {
diff --git a/app/api/lists/user_sign_log/UserSignLogLists.php b/app/api/lists/user_sign_log/UserSignLogLists.php
index 907c707a2..efcf95992 100644
--- a/app/api/lists/user_sign_log/UserSignLogLists.php
+++ b/app/api/lists/user_sign_log/UserSignLogLists.php
@@ -47,6 +47,7 @@ class UserSignLogLists extends BaseApiDataLists implements ListsSearchInterface
     {
         $type=$this->request->get('type',1);
         $mark=$this->request->get('mark','');
+        $uid=$this->request->get('uid','');
         if($type==1){
             $this->searchWhere[]=['type','in',[1,7,3]];
             $this->searchWhere[]=['status','=',1];
@@ -56,7 +57,11 @@ class UserSignLogLists extends BaseApiDataLists implements ListsSearchInterface
         }elseif($mark==2){
             $this->searchWhere[]=['financial_pm','=',0];
         }
-        $this->searchWhere[]=['uid','=',$this->userId];
+        if($uid){
+            $this->searchWhere[]=['uid','=',$uid];
+        }else{
+            $this->searchWhere[]=['uid','=',$this->userId];
+        }
         $list=UserSignLog::where($this->searchWhere)->order('id desc')
         ->limit($this->limitOffset, $this->limitLength)
         ->select()->each(function ($item){

From 74c0456f1a9d009c987c0e7bb744aa23581ae32d Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Mon, 8 Jul 2024 16:09:03 +0800
Subject: [PATCH 06/37] =?UTF-8?q?=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../lists/store_order_cart_info/StoreOrderCartInfoLists.php   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php b/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php
index 6acf0b010..959b68f01 100644
--- a/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php
+++ b/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php
@@ -47,13 +47,15 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
         return StoreOrderCartInfo::where($this->searchWhere)
             ->field('cart_info,product_id,store_id')->limit($this->limitOffset, $this->limitLength)
             ->select()->each(function ($item) {
-                $find=StoreBranchProduct::where('product_id',$item['product_id'])->where('store_id',$item['store_id'])->field('image,store_name')->find();
+                $find=StoreBranchProduct::where('product_id',$item['product_id'])->where('store_id',$item['store_id'])->field('image,store_name,store_info')->find();
                 if($find){
                     $item['image']=$find['image'];//商品图片
                     $item['store_name']=$find['store_name'];//商品名称
+                    $item['store_info']=$find['store_info'];//商品规格
                 }else{
                     $item['image']='';//商品图片
                     $item['store_name']='';//商品名称
+                    $item['store_info']='';//商品规格-(数据库叫商品简介)
                 }
                 return $item; //返回处理后的数据。
             })

From f6c8b7865e677aec8449539f63da89d7a62290d9 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Mon, 8 Jul 2024 17:24:50 +0800
Subject: [PATCH 07/37] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B4=AD?=
 =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=95=86=E5=93=81=E6=9F=A5=E8=AF=A2=E9=80=BB?=
 =?UTF-8?q?=E8=BE=91=E5=92=8C=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=EF=BC=8C?=
 =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=94=A8=E6=88=B7=E8=BA=AB=E4=BB=BD=E8=B0=83?=
 =?UTF-8?q?=E6=95=B4=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?=
 =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8?=
 =?UTF-8?q?=E5=85=B3=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/order/CartList.php       |  4 ++
 app/api/lists/product/ProductLists.php | 63 +++++++++----------
 app/api/logic/order/OrderLogic.php     | 87 ++++++++++++++------------
 app/common/logic/PayNotifyLogic.php    | 10 +--
 4 files changed, 84 insertions(+), 80 deletions(-)

diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index 74793c39e..0191ffcaf 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -64,6 +64,10 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
             ->toArray();
         $off_activity = Config::where('name', 'off_activity')->value('value');
         $this->off_activity=$off_activity;
+        $user_ship = User::where('id', $userId)->value('user_ship');
+        if (in_array($user_ship, [4, 5, 6, 7])) {
+            $off_activity=1;
+        }
         foreach ($list as $key => &$item) {
             $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
                 ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index a1e9531fd..a6eb84836 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -3,7 +3,7 @@
 namespace app\api\lists\product;
 
 
-use app\admin\lists\BaseAdminDataLists;
+use app\api\lists\BaseApiDataLists;
 use app\common\lists\ListsExtendInterface;
 use app\common\lists\ListsSortInterface;
 use app\common\model\dict\DictType;
@@ -12,6 +12,7 @@ use app\common\model\store_product\StoreProduct;
 use app\common\lists\ListsSearchInterface;
 use app\common\model\cate\Cate;
 use app\common\model\Config;
+use app\common\model\user\User;
 //use app\common\model\goods\GoodsLabel;
 use think\facade\Db;
 
@@ -20,7 +21,7 @@ use think\facade\Db;
  * Class goods
  * @package app\api\goods
  */
-class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface, ListsExtendInterface
+class ProductLists extends BaseApiDataLists implements ListsSearchInterface, ListsSortInterface, ListsExtendInterface
 {
 
 
@@ -33,10 +34,9 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
     public function setSearch(): array
     {
         return [
-            '=' => ['store_id', 'cate_id','top_cate_id','two_cate_id'],
+            '=' => ['store_id', 'cate_id', 'top_cate_id', 'two_cate_id'],
             '%pipe_like%' => ['store_name' => 'store_name|bar_code'],
         ];
-
     }
     /**
      * @notes 设置支持排序字段
@@ -71,28 +71,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
      */
     public function lists(): array
     {
-//        $class_all = $this->request->get('class_all');
-//        if ($class_all) {
-//            //查3级别的
-//            $arr = Cate::where('pid', $class_all)->column('id');
-//            if ($arr) {
-//                $arr2 = Cate::where('pid', 'in', $arr)->column('id');
-//                $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
-//            } else {
-//                $this->searchWhere[] = ['cate_id', '=', $class_all];
-//            }
-//        }
-        $order = $this->request->get('order','');
-        $field = $this->request->get('field','');
-        if(empty($order)||empty($field)){
+        $order = $this->request->get('order', '');
+        $field = $this->request->get('field', '');
+        if (empty($order) || empty($field)) {
             $order = $this->sortOrder;
-        }else{
+        } else {
             $order = [$field => $order];
         }
         $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock';
 
         $this->searchWhere[] = ['status', '=', 1];
-//        $this->searchWhere[] = ['stock', '>', 0];
+        //        $this->searchWhere[] = ['stock', '>', 0];
         return StoreBranchProduct::where($this->searchWhere)
             ->field($fields)
             ->with(['className', 'unitName'])
@@ -116,20 +105,26 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
     }
     public function extend()
     {
-//        $off_activity = Config::where('name', 'off_activity')->value('value');
-//        if($off_activity==1){
-//            $data=[
-//                'off_activity' => $off_activity,
-//                'price' => 'cost',
-//                'op_price' => 'price',
-//            ];
-//        }else{
-            $data=[
-                'off_activity' => 0,
-                'price' => 'price',
-                'op_price' => 'price',
-            ];
-//        }
+        $price = 'price';
+        $op_price = 'price';
+        $off_activity = 0;
+        if ($this->userId > 0) {
+            $user_ship = User::where('id', $this->userId)->value('user_ship');
+            if (in_array($user_ship, [4, 5, 6, 7])) {
+                $price = 'cost';
+                $op_price = 'price';
+            }
+        }
+        $off_activity = Config::where('name', 'off_activity')->value('value');
+        if ($off_activity == 1) {
+            $price = 'cost';
+            $op_price = 'price';
+        }
+        $data = [
+            'off_activity' => $off_activity,
+            'price' => $price,
+            'op_price' => $op_price,
+        ];
         return $data;
     }
 }
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 28015efda..73286c78f 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -55,7 +55,7 @@ class OrderLogic extends BaseLogic
     public static $store_price; //门店零售价
     public static $activity_price;
     public static $deduction_price;
-    public static $frozen_money;//返还金额
+    public static $frozen_money; //返还金额
 
     /**
      * @notes 获取购物车商品信息
@@ -77,8 +77,8 @@ class OrderLogic extends BaseLogic
             self::$profit = 0; //利润
             self::$activity_price = 0; //活动减少
             self::$store_price = 0; //商户价
-            self::$deduction_price =0;
-            self::$frozen_money =0;//返还金额
+            self::$deduction_price = 0;
+            self::$frozen_money = 0; //返还金额
             $deduction_price = 0; //抵扣金额
             /** 计算价格 */
             $off_activity = Config::where('name', 'off_activity')->value('value');
@@ -86,23 +86,27 @@ class OrderLogic extends BaseLogic
             foreach ($cart_select as $k => $v) {
                 $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find();
                 if (!$find) {
-//                    unset($cart_select[$k]);
-//                    continue;
+                    //                    unset($cart_select[$k]);
+                    //                    continue;
                     $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id';
                     $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->withTrashed()->find();
-                    $cart_select[$k]['status'] = 1;//缺货标识
+                    $cart_select[$k]['status'] = 1; //缺货标识
                 }
                 unset($cart_select[$k]['id']);
                 $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
-//                if ($off_activity == 1) {
-//                    $price = $find['cost'];
-//                } else {
-                    $price = $find['price'];
-//                }
+                if ($off_activity == 1) {
+                    $price = $find['cost'];
+                } else {
+                    if ($user && in_array($user['user_ship'], [4, 5, 6, 7])) {
+                        $price = 'cost';
+                    } else {
+                        $price = $find['price'];
+                    }
+                }
                 $cart_select[$k]['price'] = $price;
                 $cart_select[$k]['cost'] = $find['cost'];
                 $cart_select[$k]['vip'] = 0;
-                $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name')??''; //单位名称
+                $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name') ?? ''; //单位名称
 
                 //利润
                 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润
@@ -110,23 +114,23 @@ class OrderLogic extends BaseLogic
                 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额
                 $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //商户价
                 $cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2) ?? 0; //vip售价
-                if($cart_select[$k]['total_price']>$cart_select[$k]['pay_price']){
-                    $deduction_price=bcsub($cart_select[$k]['total_price'],$cart_select[$k]['pay_price'],2);
-                    $cart_select[$k]['deduction_price'] =$deduction_price;//抵扣金额
+                if ($cart_select[$k]['total_price'] > $cart_select[$k]['pay_price']) {
+                    $deduction_price = bcsub($cart_select[$k]['total_price'], $cart_select[$k]['pay_price'], 2);
+                    $cart_select[$k]['deduction_price'] = $deduction_price; //抵扣金额
                 }
                 $cart_select[$k]['product_id'] = $find['product_id'];
                 $cart_select[$k]['old_cart_id'] = $v['id'];
                 $cart_select[$k]['cart_num'] = $v['cart_num'];
                 $cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
-                $cart_select[$k]['vip_frozen_price']=0;
+                $cart_select[$k]['vip_frozen_price'] = 0;
                 //会员待返回金额
-                if ($user && $off_activity==0){
-                    if($user['user_ship']==4){
+                if ($user && $off_activity == 0) {
+                    if ($user['user_ship'] == 4) {
                         //商户
                         $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['store_price'], 2);
-                    }else{
+                    } else {
                         //其他会员
-                        $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'], 2);
+                        $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['vip_price'], 2);
                     }
                 }
                 //                d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
@@ -144,8 +148,8 @@ class OrderLogic extends BaseLogic
                 self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
                 self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
                 self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2); //商户价
-                self::$deduction_price=bcadd(self::$deduction_price,$deduction_price,2);//抵扣金额
-                self::$frozen_money = bcadd(self::$frozen_money, $cart_select[$k]['vip_frozen_price'], 2);//返还金额
+                self::$deduction_price = bcadd(self::$deduction_price, $deduction_price, 2); //抵扣金额
+                self::$frozen_money = bcadd(self::$frozen_money, $cart_select[$k]['vip_frozen_price'], 2); //返还金额
                 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
             }
             //加支付方式限制
@@ -153,7 +157,7 @@ class OrderLogic extends BaseLogic
             // if ($user && $user['user_ship'] == 1 && $pay_type != 17) {
             //     $pay_price = self::$pay_price;
             // } else {
-                $pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
+            $pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
             // }
             //成本价  收益
             $order = [
@@ -173,7 +177,7 @@ class OrderLogic extends BaseLogic
                 'activity_price' => self::$activity_price,
                 'activities' => self::$activity_price > 0 ? 1 : 0,
                 'deduction_price' => self::$deduction_price,
-                'frozen_money' => self::$frozen_money,//返还金额(活动关闭得时候有)
+                'frozen_money' => self::$frozen_money, //返还金额(活动关闭得时候有)
                 'source' => 0,
                 'is_storage' => $params['is_storage'] ?? 0,
             ];
@@ -186,18 +190,18 @@ class OrderLogic extends BaseLogic
             }
             //处理返回最近的店铺
             $store_check = 0;
-            if(empty($user)){
+            if (empty($user)) {
                 $store_id = getenv('STORE_ID') ?? 1;
-                $store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
-            }else{
-                $checkOrderStore = StoreOrder::where('uid',$user['id'])->field('id,store_id')
-                    ->order('id','desc')->find();
-                if($checkOrderStore){
-                    $store['near_store'] =SystemStore::where('id', $checkOrderStore['store_id'])->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
+                $store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? [];
+            } else {
+                $checkOrderStore = StoreOrder::where('uid', $user['id'])->field('id,store_id')
+                    ->order('id', 'desc')->find();
+                if ($checkOrderStore) {
+                    $store['near_store'] = SystemStore::where('id', $checkOrderStore['store_id'])->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? [];
                     $store_check = 1;
-                }else{
+                } else {
                     $store_id = getenv('STORE_ID') ?? 1;
-                    $store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
+                    $store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? [];
                 }
             }
             if (empty($store_check)) {
@@ -212,7 +216,7 @@ class OrderLogic extends BaseLogic
                             $nearestStore = $value;
                         }
                     }
-                    $store['near_store'] =[];
+                    $store['near_store'] = [];
                     if ($nearestStore) {
                         $store['near_store'] = $nearestStore;
                     }
@@ -281,10 +285,10 @@ class OrderLogic extends BaseLogic
                 $goods_list[$k]['uid'] = $uid;
                 $goods_list[$k]['cart_id'] = implode(',', $cartId);
                 $goods_list[$k]['delivery_id'] = $params['store_id']; //商家id
-//                $StoreBranchProduct = StoreBranchProduct::where('id', $v['branch_product_id'])->withTrashed()->find();
-//                if ($StoreBranchProduct['stock'] - $v['cart_num'] <= 0) {
-//                    Db::name('store_product_cate')->where(['cate_id' => $StoreBranchProduct['cate_id'], 'store_id' => $params['store_id']])->update(['count' => 0]);
-//                }
+                //                $StoreBranchProduct = StoreBranchProduct::where('id', $v['branch_product_id'])->withTrashed()->find();
+                //                if ($StoreBranchProduct['stock'] - $v['cart_num'] <= 0) {
+                //                    Db::name('store_product_cate')->where(['cate_id' => $StoreBranchProduct['cate_id'], 'store_id' => $params['store_id']])->update(['count' => 0]);
+                //                }
             }
             (new StoreOrderCartInfo())->saveAll($goods_list);
             $where = ['is_pay' => 0];
@@ -451,7 +455,7 @@ class OrderLogic extends BaseLogic
             $find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
                 ->field('product_id,cart_num nums,store_id')->select()->each(function ($item) use ($find) {
                     $find = StoreBranchProduct::where('product_id', $item['product_id'])->where('store_id', $find['store_id'])->find();
-                    if(empty($find)){
+                    if (empty($find)) {
                         $find = StoreProduct::where('id', $item['product_id'])->withTrashed()->find();
                     }
                     $item['store_name'] = $find['store_name'];
@@ -534,7 +538,8 @@ class OrderLogic extends BaseLogic
             (new StoreProductLog())->update(
                 [
                     'store_id' => $params['store_id']
-                ], ['oid' => $order['id']]
+                ],
+                ['oid' => $order['id']]
             );
             (new StoreOrderCartInfo())->update([
                 'verify_code' => $params['verify_code'] . '-1',
@@ -563,7 +568,7 @@ class OrderLogic extends BaseLogic
             $money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
             $financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);
             //积分结算
-            if($order['is_storage']==0&&$order['source']==0){
+            if ($order['is_storage'] == 0 && $order['source'] == 0) {
                 UserSignLogic::WriteOff($order);
             }
             Db::commit();
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 4315fcce5..8e204b1f6 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -588,7 +588,7 @@ class PayNotifyLogic extends BaseLogic
 
         }
         //积分写入
-        if(in_array($order['pay_type'],[3,7,9,13,17])&&$order['uid']>0){
+        if(isset($user) && $user['user_ship']==0){
             UserSignLogic::OrderWrite($order);
         }
         if ($off_activity == 1) {
@@ -644,10 +644,10 @@ class PayNotifyLogic extends BaseLogic
             }
             switch ($user_ship) {
                 case 1: // 厨师
-                case 4: // 商户
-                case 5: // 种养殖
-                case 6: // 酒店
-                case 7: // 食堂
+                //case 4: // 商户
+                //case 5: // 种养殖
+                // case 6: // 酒店
+                // case 7: // 食堂
                 case 8: // 一条龙
                     CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
                     break;

From 01915bbaaac68a3cf024382dab3f51095b70b006 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Mon, 8 Jul 2024 17:55:27 +0800
Subject: [PATCH 08/37] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9CommissionLogic?=
 =?UTF-8?q?=E7=B1=BB=E4=BB=A5=E4=BC=98=E5=8C=96=E8=B4=A2=E5=8A=A1=E9=80=BB?=
 =?UTF-8?q?=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/CommissionLogic.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
index f47f2b079..0048b7aaa 100644
--- a/app/common/logic/CommissionLogic.php
+++ b/app/common/logic/CommissionLogic.php
@@ -199,9 +199,9 @@ class CommissionLogic extends BaseLogic
         }
         $fees = bcmul($pay_price, $userRate, 2);
         if ($fees > 0) {
-            SystemStore::where('id', $order['store_id'])->inc('attrition', $fees)->update();
             $financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
             $financeLogic->out($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+            $financeLogic->save();
         }
         return $fees;
     }

From 654601013c8d18de48d194dd766376fce440686b Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 10:04:43 +0800
Subject: [PATCH 09/37] =?UTF-8?q?feat(CommissionLogic):=20=E6=9B=B4?=
 =?UTF-8?q?=E6=96=B0CommissionLogic=E7=B1=BB=E4=B8=AD=E7=94=A8=E6=88=B7?=
 =?UTF-8?q?=E7=AD=89=E7=BA=A7=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/CommissionLogic.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
index 0048b7aaa..d614dd2a5 100644
--- a/app/common/logic/CommissionLogic.php
+++ b/app/common/logic/CommissionLogic.php
@@ -30,9 +30,9 @@ class CommissionLogic extends BaseLogic
      */
     public static function setBrigade($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
     {
-        $user_1 = self::user($order, 0.05, $transaction_id, $brigade_uid, 14); //队长
+        $user_1 = self::user($order, 0.05, $transaction_id, $brigade_uid, 15); //队长
         $user_2 = self::user($order, 0.03, $transaction_id, 0, 12); ////会员、厨师
-        $user_3 = self::user($order, 0.01, $transaction_id, $village_uid, 15); //村长
+        $user_3 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
 
         $platform = self::platform($order, 0.02, $transaction_id); //平台
         $store = self::store($order, 0.05, $transaction_id, 0); //门店

From 150812e936a95ab694fc4c3507d333a35203677a Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 10:14:59 +0800
Subject: [PATCH 10/37] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=BB=98?=
 =?UTF-8?q?=E8=AE=A4=E5=9C=B0=E5=9D=80=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/PayNotifyLogic.php | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 8e204b1f6..91a87fc2a 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -627,6 +627,18 @@ class PayNotifyLogic extends BaseLogic
                             $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
                         }
                     }
+                }else{
+                    $address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
+                    if ($address) {
+                        $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
+                        if ($arr1) {
+                            $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
+                        }
+                        $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
+                        if ($arr2) {
+                            $brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
+                        }
+                    }
                 }
             } else {
                 //查询用户对应的村长和队长

From 02d488c2960ff1d99031bc0025f6354b3d23e73a Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 14:17:49 +0800
Subject: [PATCH 11/37] =?UTF-8?q?feat(ProductLists.php):=20=E6=B7=BB?=
 =?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7ID=E8=8E=B7=E5=8F=96=E6=96=B9?=
 =?UTF-8?q?=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/product/ProductLists.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index a6eb84836..b13a60509 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -108,8 +108,14 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
         $price = 'price';
         $op_price = 'price';
         $off_activity = 0;
-        if ($this->userId > 0) {
-            $user_ship = User::where('id', $this->userId)->value('user_ship');
+        $uid=0;
+        if($this->request->get('uid')){
+               $uid=$this->request->get('uid');
+        }elseif($this->userId>0){
+            $uid=$this->userId;
+        }
+        if ($uid > 0) {
+            $user_ship = User::where('id', $uid)->value('user_ship');
             if (in_array($user_ship, [4, 5, 6, 7])) {
                 $price = 'cost';
                 $op_price = 'price';

From 5835271186d087e8c9a7b004b9c5c3edd7fb0ebe Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 15:15:51 +0800
Subject: [PATCH 12/37] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=A0=B9?=
 =?UTF-8?q?=E6=8D=AE=E7=94=A8=E6=88=B7ID=E5=88=A4=E6=96=AD=E8=B4=AD?=
 =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=95=86=E5=93=81=E6=98=AF=E5=90=A6=E5=8F=82?=
 =?UTF-8?q?=E4=B8=8E=E6=B4=BB=E5=8A=A8=E7=9A=84=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/store/lists/cart/CartList.php | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php
index e84943654..094acfd06 100644
--- a/app/store/lists/cart/CartList.php
+++ b/app/store/lists/cart/CartList.php
@@ -42,7 +42,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
      */
     public function lists($where = []): array
     {
-        $userId = $this->request->get('uid');
         $where = [
             'staff_id' => $this->adminId,
             'is_pay' => 0
@@ -55,9 +54,19 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
                 return $item;
             })
             ->toArray();
-//        $off_activity = Config::where('name', 'off_activity')->value('value');
+        $off_activity = Config::where('name', 'off_activity')->value('value');
         $off_activity = 0;
         $this->off_activity = $off_activity;
+        $uid = 0;
+        if ($this->request->get('uid')) {
+            $uid = $this->request->get('uid');
+        }
+        if ($uid > 0) {
+            $user_ship = User::where('id', $uid)->value('user_ship');
+            if (in_array($user_ship, [4, 5, 6, 7])) {
+                $off_activity = 1;
+            }
+        }
         foreach ($list as $key => &$item) {
             $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
                 ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
@@ -65,10 +74,10 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
                 ->find();
 
             if ($find) {
-                if($off_activity==1){
-                    $this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2);
+                if ($off_activity == 1) {
+                    $this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
                     $item['price'] = $find['cost'];
-                }else{
+                } else {
                     $item['price'] = $find['price'];
                 }
                 $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);

From 06ff803ea56d4374ff92c5d7cc5ec0be066dd1ab Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 15:20:05 +0800
Subject: [PATCH 13/37] 1

---
 app/api/logic/order/OrderLogic.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 73286c78f..8b7193c4a 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -84,12 +84,12 @@ class OrderLogic extends BaseLogic
             $off_activity = Config::where('name', 'off_activity')->value('value');
             $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id';
             foreach ($cart_select as $k => $v) {
-                $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find();
+                $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
                 if (!$find) {
                     //                    unset($cart_select[$k]);
                     //                    continue;
                     $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id';
-                    $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->withTrashed()->find();
+                    $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
                     $cart_select[$k]['status'] = 1; //缺货标识
                 }
                 unset($cart_select[$k]['id']);

From a8214a952bfed99c54a10b7c6cb06302d5d8714d Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Tue, 9 Jul 2024 15:55:43 +0800
Subject: [PATCH 14/37] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/order/OrderList.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/api/lists/order/OrderList.php b/app/api/lists/order/OrderList.php
index 410e066f4..77d7d0ebe 100644
--- a/app/api/lists/order/OrderList.php
+++ b/app/api/lists/order/OrderList.php
@@ -28,7 +28,7 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
     public function setSearch(): array
     {
         return [
-            '=' => ['paid', 'status', 'is_writeoff'],
+            '=' => ['paid', 'status', 'is_writeoff','reservation'],
             'between_time' => 'create_time',
             '%like%' => ['order_id'],
         ];

From 6888c4d92960c84c1f0073cd415331348b13e5ac Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 16:09:46 +0800
Subject: [PATCH 15/37] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86Commis?=
 =?UTF-8?q?sionLogic=E7=B1=BB=E4=B8=AD=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C?=
 =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E6=8D=9F=E8=80=97=E8=AE=A1=E7=AE=97?=
 =?UTF-8?q?=E5=92=8C=E7=94=A8=E6=88=B7=E4=BD=99=E9=A2=9D=E6=94=B6=E5=85=A5?=
 =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84=E9=80=BB=E8=BE=91=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/CommissionLogic.php | 52 ++++++++++++++++++----------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
index d614dd2a5..98d4b3429 100644
--- a/app/common/logic/CommissionLogic.php
+++ b/app/common/logic/CommissionLogic.php
@@ -20,7 +20,7 @@ class CommissionLogic extends BaseLogic
 
         $platform = self::platform($order, 0.02, $transaction_id); //平台
         $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.02,$transaction_id,16); //损耗
+        $attrition = self::attrition($order, 0.02, $transaction_id, 16); //损耗
 
         $moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
         self::suppliter($order, $moeny, $transaction_id);
@@ -36,7 +36,7 @@ class CommissionLogic extends BaseLogic
 
         $platform = self::platform($order, 0.02, $transaction_id); //平台
         $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.02,$transaction_id,16); //损耗
+        $attrition = self::attrition($order, 0.02, $transaction_id, 16); //损耗
 
         $moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
         self::suppliter($order, $moeny, $transaction_id);
@@ -51,7 +51,7 @@ class CommissionLogic extends BaseLogic
         $user_3 = self::user($order, 0.01, $transaction_id, $brigade_uid, 15); //队长
         $platform = self::platform($order, 0.02, $transaction_id); //平台
         $store = self::store($order, 0.05, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.02,$transaction_id,16); //损耗
+        $attrition = self::attrition($order, 0.02, $transaction_id, 16); //损耗
         $moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
         self::suppliter($order, $moeny, $transaction_id);
     }
@@ -63,7 +63,7 @@ class CommissionLogic extends BaseLogic
     {
         $platform = self::platform($order, 0.05, $transaction_id); //平台
         $store = self::store($order, 0.02, $transaction_id, 0); //门店
-        $attrition = self::attrition($order, 0.01,$transaction_id,16); //损耗
+        $attrition = self::attrition($order, 0.01, $transaction_id, 16); //损耗
         $moeny = bcadd(bcadd($platform, $store, 2), $attrition, 2);
         self::suppliter($order, $moeny, $transaction_id);
     }
@@ -78,8 +78,8 @@ class CommissionLogic extends BaseLogic
         $financeLogic->order = $order;
         $financeLogic->user['uid'] = $order['uid'];
         $pay_price = $order['pay_price'];
-        if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
-            $pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
+        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
+            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
         }
         $fees = bcdiv(bcmul($pay_price, $platformRate, 2), 1, 2);
         if ($fees > 0) {
@@ -98,8 +98,8 @@ class CommissionLogic extends BaseLogic
         $financeLogic->order = $order;
         $financeLogic->user['uid'] = $order['uid'];
         $pay_price = $order['pay_price'];
-        if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
-            $pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
+        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
+            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
         }
         $fees = bcsub($pay_price, $platformRate, 2);
         if ($fees > 0) {
@@ -123,8 +123,8 @@ class CommissionLogic extends BaseLogic
         $money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
         $deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
         $pay_price = $order['pay_price'];
-        if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
-            $pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
+        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
+            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
         }
         $store_profit = bcmul($pay_price, $platformRate, 2);
         if ($deposit > 0) {
@@ -162,18 +162,34 @@ class CommissionLogic extends BaseLogic
     {
         $financeLogic = new StoreFinanceFlowLogic();
         $pay_price = $order['pay_price'];
-        if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
-            $pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
+        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
+            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
         }
         $fees = bcmul($pay_price, $userRate, 2);
         if ($fees > 0) {
             //记录用户余额收入
             if ($uid) {
-                $GiveUser = User::where('id', $order['uid'])->find();
-                if($GiveUser['user_ship'] != 5){//新限制 不为种养殖
-                    $capitalFlowDao = new CapitalFlowLogic($GiveUser);
-                    $capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
+                if(in_array($enum,[14,15])&&$userRate==0.05){
+                    $purchase_funds=User::where('id', $uid)->value('purchase_funds');
+                    if($purchase_funds>0){
+                        $fees_two = bcmul($purchase_funds, $userRate, 2);
+                        if($fees_two<$fees){
+                            $fees=$fees_two;
+                        }
+                    }
                 }
+                if($enum==12&&$userRate==0.07){
+                    $purchase_funds=User::where('id', $uid)->value('purchase_funds');
+                    if($purchase_funds>0){
+                        $fees_two = bcmul($purchase_funds, $userRate, 2);
+                        if($fees_two<$fees){
+                            $fees=$fees_two;
+                        }
+                    }
+                }
+                $GiveUser = User::where('id', $order['uid'])->find();
+                $capitalFlowDao = new CapitalFlowLogic($GiveUser);
+                $capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
             }
             $financeLogic->user['uid'] = $order['uid'];
             $financeLogic->other_arr['vip_uid'] = $uid;
@@ -194,8 +210,8 @@ class CommissionLogic extends BaseLogic
         $financeLogic->order = $order;
         $financeLogic->user['uid'] = $order['uid'];
         $pay_price = $order['pay_price'];
-        if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
-            $pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
+        if (isset($order['dealVipAmount']) && $order['dealVipAmount'] > 0) {
+            $pay_price = bcsub($order['pay_price'], $order['dealVipAmount'], 2);
         }
         $fees = bcmul($pay_price, $userRate, 2);
         if ($fees > 0) {

From 44e9478590e96c8aba4ae0fe0872638636d8cbb8 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Tue, 9 Jul 2024 16:17:01 +0800
Subject: [PATCH 16/37] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E9=A2=84?=
 =?UTF-8?q?=E7=BA=A6=E5=8D=95=E5=AD=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/store/lists/store_order/StoreOrderLists.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php
index da9681ce1..cdb7d1e1d 100644
--- a/app/store/lists/store_order/StoreOrderLists.php
+++ b/app/store/lists/store_order/StoreOrderLists.php
@@ -28,7 +28,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
     public function setSearch(): array
     {
         return [
-            '=' => ['pay_type', 'paid'],
+            '=' => ['pay_type', 'paid','reservation'],
             '%like%' => ['order_id'],
             'between_time' => 'create_time',
         ];
@@ -71,7 +71,8 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
         }
 
         return StoreOrder::where($this->searchWhere)->with(['user'])
-            ->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num'])
+            ->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type',
+                'status', 'paid', 'total_num','reservation','reservation_time'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()->each(function ($item){

From f2c48138096eed9912ef6ca98b9781b8ba361cc7 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 16:22:47 +0800
Subject: [PATCH 17/37] 1

---
 app/store/lists/cart/CartList.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php
index 094acfd06..3d872d49f 100644
--- a/app/store/lists/cart/CartList.php
+++ b/app/store/lists/cart/CartList.php
@@ -23,6 +23,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
     protected $total_price = 0;
     protected $activity_price = 0;
     protected $off_activity = 0;
+    protected $pay_price = 0;
     /**
      * @notes 设置搜索条件
      * @return \string[][]
@@ -72,7 +73,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
                 ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
                 ->withTrashed()
                 ->find();
-
             if ($find) {
                 if ($off_activity == 1) {
                     $this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
@@ -80,8 +80,10 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
                 } else {
                     $item['price'] = $find['price'];
                 }
-                $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
-                $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
+                $item['pay_price'] = bcmul($item['cart_num'], $item['price'], 2);
+                $item['total_price'] = bcmul($item['cart_num'], $find['price'], 2);
+                $this->total_price = bcadd($this->total_price, $item['total_price'], 2);
+                $this->pay_price = bcadd($this->pay_price, $item['pay_price'], 2);
                 $item['image'] = $find['image'];
                 $item['cost'] = $find['cost'];
                 $item['store_name'] = $find['store_name'];
@@ -114,7 +116,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
             'off_activity' => $this->off_activity,
             'total_price' => $this->total_price,
             'msg' => '',
-            'pay_price' => $this->total_price
+            'pay_price' => $this->pay_price
         ];
         if ($this->off_activity == 1) {
             $data['pay_price'] = $this->activity_price;

From a8fa7dd540a71a3d08ead578054d2087189c874f Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 16:25:38 +0800
Subject: [PATCH 18/37] =?UTF-8?q?feat(OrderLogic):=20=E6=A0=B9=E6=8D=AE?=
 =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AD=89=E7=BA=A7=E6=9B=B4=E6=96=B0=E8=AE=A2?=
 =?UTF-8?q?=E5=8D=95=E4=BB=B7=E6=A0=BC=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/logic/order/OrderLogic.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 8b7193c4a..90a54d109 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -98,7 +98,7 @@ class OrderLogic extends BaseLogic
                     $price = $find['cost'];
                 } else {
                     if ($user && in_array($user['user_ship'], [4, 5, 6, 7])) {
-                        $price = 'cost';
+                        $price = $find['cost'];
                     } else {
                         $price = $find['price'];
                     }

From 21b36295d9cf80085ef6417516623eca14ec44ce Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 17:04:53 +0800
Subject: [PATCH 19/37] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=94=A8?=
 =?UTF-8?q?=E6=88=B7=E8=BF=90=E8=B4=B9=E5=92=8C=E4=BC=98=E6=83=A0=E6=B4=BB?=
 =?UTF-8?q?=E5=8A=A8=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/order/CartList.php       | 17 +++++++++++++----
 app/api/lists/product/ProductLists.php | 25 ++++++-------------------
 app/api/logic/order/OrderLogic.php     |  8 ++------
 3 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index 0191ffcaf..273ea8af1 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -25,6 +25,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
     protected $total_price = 0;
     protected $activity_price = 0;
     protected $off_activity = 0;
+    protected $user_ship = 0;
 
 
     /**
@@ -63,11 +64,12 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
             })
             ->toArray();
         $off_activity = Config::where('name', 'off_activity')->value('value');
-        $this->off_activity=$off_activity;
         $user_ship = User::where('id', $userId)->value('user_ship');
         if (in_array($user_ship, [4, 5, 6, 7])) {
             $off_activity=1;
         }
+        $this->user_ship=$user_ship;
+        $this->off_activity=$off_activity;
         foreach ($list as $key => &$item) {
             $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
                 ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
@@ -112,17 +114,24 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
         $data= [
             'off_activity' => $this->off_activity,
             'total_price' => $this->total_price,
-            'msg' => '您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。',
+            'msg' => '',
             'pay_price' => $this->total_price
         ];
+        if($this->user_ship==0){
+            $data['msg']='您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
+        }
         if($this->off_activity==0){//1
             $this->activity_price =  $this->total_price;
             $data['pay_price']=$this->activity_price;
             if($this->activity_price<500){
-                $data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
+                if($this->user_ship==0){
+                    $data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
+                }
                 $data['pay_price']= $this->activity_price;
             }else{
-                $data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
+                if($this->user_ship==0){
+                    $data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
+                }
             }
         }
         return $data;
diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index b13a60509..1cb4ad67a 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -23,7 +23,8 @@ use think\facade\Db;
  */
 class ProductLists extends BaseApiDataLists implements ListsSearchInterface, ListsSortInterface, ListsExtendInterface
 {
-
+    protected $off_activity = 0;
+    protected $user_ship = 0;
 
     /**
      * @notes 设置搜索条件
@@ -79,7 +80,8 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
             $order = [$field => $order];
         }
         $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock';
-
+        $off_activity = Config::where('name', 'off_activity')->value('value');
+        $this->off_activity = $off_activity;
         $this->searchWhere[] = ['status', '=', 1];
         //        $this->searchWhere[] = ['stock', '>', 0];
         return StoreBranchProduct::where($this->searchWhere)
@@ -107,27 +109,12 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
     {
         $price = 'price';
         $op_price = 'price';
-        $off_activity = 0;
-        $uid=0;
-        if($this->request->get('uid')){
-               $uid=$this->request->get('uid');
-        }elseif($this->userId>0){
-            $uid=$this->userId;
-        }
-        if ($uid > 0) {
-            $user_ship = User::where('id', $uid)->value('user_ship');
-            if (in_array($user_ship, [4, 5, 6, 7])) {
-                $price = 'cost';
-                $op_price = 'price';
-            }
-        }
-        $off_activity = Config::where('name', 'off_activity')->value('value');
-        if ($off_activity == 1) {
+        if ($this->off_activity == 1) {
             $price = 'cost';
             $op_price = 'price';
         }
         $data = [
-            'off_activity' => $off_activity,
+            'off_activity' => $this->off_activity,
             'price' => $price,
             'op_price' => $op_price,
         ];
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 90a54d109..1d9557a51 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -94,14 +94,10 @@ class OrderLogic extends BaseLogic
                 }
                 unset($cart_select[$k]['id']);
                 $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
-                if ($off_activity == 1) {
+                if ($off_activity == 1 || in_array($user['user_ship'], [4, 5, 6, 7])) {
                     $price = $find['cost'];
                 } else {
-                    if ($user && in_array($user['user_ship'], [4, 5, 6, 7])) {
-                        $price = $find['cost'];
-                    } else {
-                        $price = $find['price'];
-                    }
+                    $price = $find['price'];
                 }
                 $cart_select[$k]['price'] = $price;
                 $cart_select[$k]['cost'] = $find['cost'];

From 426f9ed76c0753168fee69a5fe9f758cd2f04e78 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 17:09:58 +0800
Subject: [PATCH 20/37] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E5=B9=B3?=
 =?UTF-8?q?=E5=8F=B0=E5=92=8C=E9=97=A8=E5=BA=97=E7=9A=84=E6=8A=BD=E6=88=90?=
 =?UTF-8?q?=E6=AF=94=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/CommissionLogic.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
index 98d4b3429..03bd7a745 100644
--- a/app/common/logic/CommissionLogic.php
+++ b/app/common/logic/CommissionLogic.php
@@ -61,8 +61,8 @@ class CommissionLogic extends BaseLogic
      */
     public static function setStore($order, $transaction_id = 0)
     {
-        $platform = self::platform($order, 0.05, $transaction_id); //平台
-        $store = self::store($order, 0.02, $transaction_id, 0); //门店
+        $platform = self::platform($order, 0.02, $transaction_id); //平台
+        $store = self::store($order, 0.05, $transaction_id, 0); //门店
         $attrition = self::attrition($order, 0.01, $transaction_id, 16); //损耗
         $moeny = bcadd(bcadd($platform, $store, 2), $attrition, 2);
         self::suppliter($order, $moeny, $transaction_id);

From 04bf34d3634eee07ed9f3d4c6139ab1e7176dc3e Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 17:26:38 +0800
Subject: [PATCH 21/37] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BA=86?=
 =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=9D=E8=AF=81=E9=87=91=E5=A4=84=E7=90=86?=
 =?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/CommissionLogic.php | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
index 03bd7a745..a2f4687ce 100644
--- a/app/common/logic/CommissionLogic.php
+++ b/app/common/logic/CommissionLogic.php
@@ -130,24 +130,20 @@ class CommissionLogic extends BaseLogic
         if ($deposit > 0) {
             if ($deposit > $store_profit) {
                 if ($store_profit > 0) {
-                    SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $store_profit)->update();
                     $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
                     $financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
                 }
             } else {
                 $money = bcsub($store_profit, $deposit, 2);
                 if ($deposit > 0) {
-                    SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $deposit)->update();
                     $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
                 }
                 if ($money) {
-                    SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
                     $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
                 }
             }
         } else {
             if ($store_profit > 0) {
-                SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
                 $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);  //平台手续费
             }
         }

From 00593cdfcda884775e32e4ea482b8a05c4fc2996 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 9 Jul 2024 17:37:22 +0800
Subject: [PATCH 22/37] =?UTF-8?q?feat(OrderLogic):=20=E4=BF=AE=E6=94=B9?=
 =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=B5=81=E6=B0=B4=E6=9F=A5=E8=AF=A2=E6=9D=A1?=
 =?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/logic/order/OrderLogic.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 1d9557a51..e57deb270 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -560,7 +560,7 @@ class OrderLogic extends BaseLogic
                     $financeFlowLogic->updateStatusUser($spread_find['id'], $order['spread_uid'], $spread_find['number'], $order['id']);
                 }
             }
-            $deposit = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 11])->value('number') ?? 0;
+            $deposit = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 0, 'financial_type' => 11])->value('number') ?? 0;
             $money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
             $financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);
             //积分结算

From 9babb4f4306918c4f27883aafb70898b8aa51d74 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Wed, 10 Jul 2024 09:49:08 +0800
Subject: [PATCH 23/37] =?UTF-8?q?feat(ProductLists.php):=20=E6=B7=BB?=
 =?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7=E4=B8=93=E4=BA=AB=E4=BC=98=E6=83=A0?=
 =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/product/ProductLists.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index 1cb4ad67a..b80f656d6 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -81,6 +81,12 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
         }
         $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock';
         $off_activity = Config::where('name', 'off_activity')->value('value');
+        if ($this->userId > 0) {
+            $user_ship = User::where('id', $this->userId)->value('user_ship');
+            if (in_array($user_ship, [4, 5, 6, 7])) {
+                $off_activity = 1;
+            }
+        }
         $this->off_activity = $off_activity;
         $this->searchWhere[] = ['status', '=', 1];
         //        $this->searchWhere[] = ['stock', '>', 0];

From a269e4c0dd6ae93f30ea55f206a560c2e711da5e Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Wed, 10 Jul 2024 09:59:30 +0800
Subject: [PATCH 24/37] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=B0?=
 =?UTF-8?q?=E7=9A=84API=E5=8A=9F=E8=83=BD=EF=BC=9B=E4=BF=AE=E6=94=B9Produc?=
 =?UTF-8?q?tLists.php=E6=96=87=E4=BB=B6=EF=BC=8C=E5=9C=A8=E6=9F=A5?=
 =?UTF-8?q?=E8=AF=A2=E4=BA=A7=E5=93=81=E5=88=97=E8=A1=A8=E6=97=B6=E5=A2=9E?=
 =?UTF-8?q?=E5=8A=A0=E5=AF=B9=E6=AF=8F=E4=B8=AA=E4=BA=A7=E5=93=81=E6=B7=BB?=
 =?UTF-8?q?=E5=8A=A0=E6=A0=87=E7=AD=BE=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=8C?=
 =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=B8=A6=E6=9C=89=E6=A0=87=E7=AD=BE=E7=9A=84?=
 =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=88=97=E8=A1=A8=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/product/ProductLists.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index b80f656d6..277c2077f 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -96,7 +96,11 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
             ->limit($this->limitOffset, $this->limitLength)
             ->order($order)
             //            ->page($this->limitOffset +1,$this->limitLength)
-            ->select()->toArray();
+            ->select()->each(function ($item) {
+                $item['tag']=' 赠10%品牌礼品券 ';
+                return $item;
+            })
+            ->toArray();
     }
 
 

From 4c43c58f4e0c56f77ad104de3f0d6bf65d0ba9c7 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Wed, 10 Jul 2024 10:17:18 +0800
Subject: [PATCH 25/37] =?UTF-8?q?refactor(PayNotifyLogic):=20=E7=A7=BB?=
 =?UTF-8?q?=E9=99=A4=E4=BC=9A=E5=91=98=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97?=
 =?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/product/ProductLists.php | 10 ++++++++--
 app/common/logic/PayNotifyLogic.php    |  6 +++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index 277c2077f..13015627a 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -81,8 +81,14 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
         }
         $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock';
         $off_activity = Config::where('name', 'off_activity')->value('value');
-        if ($this->userId > 0) {
-            $user_ship = User::where('id', $this->userId)->value('user_ship');
+        $uid=0;
+        if($this->request->get('uid',0)>0){
+            $uid=$this->request->get('uid',0);
+        }elseif( $this->userId > 0){
+            $uid=$this->userId;
+        }
+        if ($uid>0) {
+            $user_ship = User::where('id', $uid)->value('user_ship');
             if (in_array($user_ship, [4, 5, 6, 7])) {
                 $off_activity = 1;
             }
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 91a87fc2a..0b9131fb0 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -603,9 +603,9 @@ class PayNotifyLogic extends BaseLogic
         }
 
         //如果是会员需要返回会员金额
-        if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
-            $order['dealVipAmount']= self::dealVipAmount($order,  $order['pay_type']);
-        }
+        // if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
+        //     $order['dealVipAmount']= self::dealVipAmount($order,  $order['pay_type']);
+        // }
         if ($order['spread_uid'] > 0 || $user_ship > 0) {
             if ($order['spread_uid'] > 0 && $user_ship == 0) {
                 $user_ship = User::where('id', $order['spread_uid'])->value('user_ship');

From fdd0f89543a2b9501109b6f512f6e7298c1589cf Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Wed, 10 Jul 2024 10:28:10 +0800
Subject: [PATCH 26/37] =?UTF-8?q?feat(CartList):=20=E6=A0=B9=E6=8D=AEoff?=
 =?UTF-8?q?=5Factivity=E8=B0=83=E6=95=B4=E8=B4=AD=E7=89=A9=E8=BD=A6?=
 =?UTF-8?q?=E6=94=AF=E4=BB=98=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97=E9=80=BB?=
 =?UTF-8?q?=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/order/CartList.php | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index 273ea8af1..def9aa0ce 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -120,14 +120,12 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
         if($this->user_ship==0){
             $data['msg']='您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
         }
-        if($this->off_activity==0){//1
-            $this->activity_price =  $this->total_price;
+        if($this->off_activity==1){//1
             $data['pay_price']=$this->activity_price;
             if($this->activity_price<500){
                 if($this->user_ship==0){
                     $data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
                 }
-                $data['pay_price']= $this->activity_price;
             }else{
                 if($this->user_ship==0){
                     $data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';

From 281e6d567f44ad622b8008cef87c80bf505a0ad2 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 10:59:37 +0800
Subject: [PATCH 27/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E7=BA=A6?=
 =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/lists/store/SystemStoreLists.php | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/app/api/lists/store/SystemStoreLists.php b/app/api/lists/store/SystemStoreLists.php
index 4462b893b..c730b1ae7 100644
--- a/app/api/lists/store/SystemStoreLists.php
+++ b/app/api/lists/store/SystemStoreLists.php
@@ -93,10 +93,17 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac
             }
 
         }else{
-            foreach ($data as &$value){
-                $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude);
+            if($latitude && $longitude){
+                foreach ($data as &$value){
+                    $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude);
 
+                }
+            }else{
+                foreach ($data as &$values){
+                    $values['distance'] = 0;
+                }
             }
+
         }
 
         usort($data, function ($a, $b) {

From 6196e08f81cb87f635958027497d89ad7665d1d4 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 11:17:46 +0800
Subject: [PATCH 28/37] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=A2=84?=
 =?UTF-8?q?=E7=BA=A6=E5=95=86=E5=93=81=E6=8F=90=E8=B4=A7=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../UserProductStorageLogLists.php            |  6 +++-
 .../UserProductStorageLogController.php       | 30 +++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 app/api/controller/user_product_storage_log/UserProductStorageLogController.php

diff --git a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
index 25b9c9d08..67f106758 100644
--- a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
+++ b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
@@ -28,6 +28,7 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
     public function setSearch(): array
     {
         return [
+            '=' => ['uid', 'oid', 'product_id','status'],
             'between_time' => ['create_time'],
         ];
     }
@@ -45,7 +46,7 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
     public function lists(): array
     {
         return UserProductStorageLog::where($this->searchWhere)
-            ->field(['id', 'oid', 'uid', 'product_id', 'store_id', 'financial_pm', 'nums'])
+            ->field(['id', 'oid', 'uid', 'product_id', 'store_id', 'financial_pm', 'nums','times','update_time'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()->each(function($item){
@@ -58,6 +59,9 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
                 }else{
                     $item['financial_pm']='减少';
                 }
+                if($item['times']){
+                    $item['times']=date('Y-m-d H:i:s',$item['times']);
+                }
                 return $item;
             })
             ->toArray();
diff --git a/app/api/controller/user_product_storage_log/UserProductStorageLogController.php b/app/api/controller/user_product_storage_log/UserProductStorageLogController.php
new file mode 100644
index 000000000..573abcbad
--- /dev/null
+++ b/app/api/controller/user_product_storage_log/UserProductStorageLogController.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace app\api\controller\user_product_storage_log;
+
+
+use app\admin\lists\user_product_storage_log\UserProductStorageLogLists;
+use app\api\controller\BaseApiController;
+
+
+/**
+ * 用户商品储存控制器
+ * Class UserProductStorageLogController
+ * @package app\admin\controller\user_product_storage_log
+ */
+class UserProductStorageLogController extends BaseApiController
+{
+
+
+    /**
+     * @notes 获取用户商品日志列表
+     * @return
+     * @author admin
+     * @date 2024/06/28 11:05
+     */
+    public function lists()
+    {
+        return $this->dataLists(new UserProductStorageLogLists());
+    }
+
+}
\ No newline at end of file

From daf05f331496a7b1ce5a13f3bae93ca3c1a9d8e1 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 11:20:29 +0800
Subject: [PATCH 29/37] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=A0=B8=E9=94=80?=
 =?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../user_product_storage_log/UserProductStorageLogLists.php     | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
index 67f106758..364385a66 100644
--- a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
+++ b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
@@ -4,6 +4,7 @@ namespace app\admin\lists\user_product_storage_log;
 
 
 use app\admin\lists\BaseAdminDataLists;
+use app\common\model\store_order\StoreOrder;
 use app\common\model\user_product_storage_log\UserProductStorageLog;
 use app\common\lists\ListsSearchInterface;
 use app\common\model\store_product\StoreProduct;
@@ -54,6 +55,7 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
                 $item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
                 $item['nickname']=$user['real_name']?$user['real_name'].'|'.$item['uid']:$user['nickname'].'|'.$item['uid'];
                 $item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
+                $item['verify_code'] = StoreOrder::where('id',$item['oid'])->withTrashed()->value('verify_code');
                 if($item['financial_pm']==1){
                     $item['financial_pm']='增加';
                 }else{

From 4de5aef5371c678be64fab8a59228ac1a0226a02 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 11:55:30 +0800
Subject: [PATCH 30/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=B6=E9=93=B6?=
 =?UTF-8?q?=E5=8F=B0=E9=A2=84=E7=BA=A6=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../UserProductStorageLogLists.php            | 15 +++++++---
 .../UserProductStorageLogController.php       | 29 +++++++++++++++++++
 2 files changed, 40 insertions(+), 4 deletions(-)
 create mode 100644 app/store/controller/user_product_storage_log/UserProductStorageLogController.php

diff --git a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
index 364385a66..398313058 100644
--- a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
+++ b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
@@ -29,7 +29,7 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
     public function setSearch(): array
     {
         return [
-            '=' => ['uid', 'oid', 'product_id','status'],
+            '=' => ['uid', 'oid', 'product_id','status','store_id'],
             'between_time' => ['create_time'],
         ];
     }
@@ -51,11 +51,18 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()->each(function($item){
-                $user=User::where('id',$item['uid'])->field('nickname,real_name')->find();
+                $user=User::where('id',$item['uid'])->field('nickname,real_name,mobile')->find();
                 $item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
                 $item['nickname']=$user['real_name']?$user['real_name'].'|'.$item['uid']:$user['nickname'].'|'.$item['uid'];
-                $item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
-                $item['verify_code'] = StoreOrder::where('id',$item['oid'])->withTrashed()->value('verify_code');
+                $item['mobile'] = $user['mobile']??'';
+                $goods = StoreProduct::where('id',$item['product_id'])->field('store_name,image,store_info,price')->withTrashed()->find();
+                $item['store_name']=$goods['store_name']??'';
+                $item['store_name_img']=$goods['image']??'';
+                $item['store_info']=$goods['store_info']??'';//规格
+                $item['price']=$goods['price']??'';
+                $order =  StoreOrder::where('id',$item['oid'])->withTrashed()->field('order_id,verify_code')->find();
+                $item['verify_code'] = $order['verify_code']??'';
+                $item['order_id'] = $order['order_id']??'';
                 if($item['financial_pm']==1){
                     $item['financial_pm']='增加';
                 }else{
diff --git a/app/store/controller/user_product_storage_log/UserProductStorageLogController.php b/app/store/controller/user_product_storage_log/UserProductStorageLogController.php
new file mode 100644
index 000000000..df8786d02
--- /dev/null
+++ b/app/store/controller/user_product_storage_log/UserProductStorageLogController.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace app\store\controller\user_product_storage_log;
+
+
+use app\admin\lists\user_product_storage_log\UserProductStorageLogLists;
+use app\store\controller\BaseAdminController;
+
+/**
+ * 用户商品储存控制器
+ * Class UserProductStorageLogController
+ * @package app\admin\controller\user_product_storage
+ */
+class UserProductStorageLogController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取用户商品储存列表
+     * @return
+     * @author admin
+     * @date 2024/06/28 11:05
+     */
+    public function lists()
+    {
+        return $this->dataLists(new UserProductStorageLogLists());
+    }
+
+}
\ No newline at end of file

From 511380c0e4e5f83a0b6957c714546642d683f171 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 14:42:46 +0800
Subject: [PATCH 31/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=99=90=E5=88=B6?=
 =?UTF-8?q?=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../UserProductStorageLogLists.php                  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
index 398313058..42e9b5e73 100644
--- a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
+++ b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
@@ -46,6 +46,15 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
      */
     public function lists(): array
     {
+        $store_id  = $this->request->get('store_id','');
+        $order_sn  = $this->request->get('order_sn','');
+        $order = StoreOrder::where('store_id',$store_id)
+                ->where('order_id','like','%'.$order_sn.'%')->column('id');
+        if($order){
+            $where[]=['oid','in',$order];
+            $this->searchWhere[]=$where;
+        }
+
         return UserProductStorageLog::where($this->searchWhere)
             ->field(['id', 'oid', 'uid', 'product_id', 'store_id', 'financial_pm', 'nums','times','update_time'])
             ->limit($this->limitOffset, $this->limitLength)
@@ -63,6 +72,10 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
                 $order =  StoreOrder::where('id',$item['oid'])->withTrashed()->field('order_id,verify_code')->find();
                 $item['verify_code'] = $order['verify_code']??'';
                 $item['order_id'] = $order['order_id']??'';
+                $item['verify_img'] = '';
+                if($order['verify_img']){
+                    $item['verify_img'] = 'https://'.$this->request->host(true).$order['verify_img'];
+                }
                 if($item['financial_pm']==1){
                     $item['financial_pm']='增加';
                 }else{

From 073042e3da1e2173d931aa630c774342c6c2c2a6 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 14:43:55 +0800
Subject: [PATCH 32/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../user_product_storage_log/UserProductStorageLogLists.php     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
index 42e9b5e73..dcb98080c 100644
--- a/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
+++ b/app/admin/lists/user_product_storage_log/UserProductStorageLogLists.php
@@ -69,7 +69,7 @@ class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSear
                 $item['store_name_img']=$goods['image']??'';
                 $item['store_info']=$goods['store_info']??'';//规格
                 $item['price']=$goods['price']??'';
-                $order =  StoreOrder::where('id',$item['oid'])->withTrashed()->field('order_id,verify_code')->find();
+                $order =  StoreOrder::where('id',$item['oid'])->withTrashed()->field('order_id,verify_code,verify_img')->find();
                 $item['verify_code'] = $order['verify_code']??'';
                 $item['order_id'] = $order['order_id']??'';
                 $item['verify_img'] = '';

From 125ffecb7e5ad3a60c643346d5976175395fc31a Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Wed, 10 Jul 2024 15:25:57 +0800
Subject: [PATCH 33/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../logic/user_product_storage/UserProductStorageLogic.php      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/common/logic/user_product_storage/UserProductStorageLogic.php b/app/common/logic/user_product_storage/UserProductStorageLogic.php
index fdea6c23f..f9e2af9fe 100644
--- a/app/common/logic/user_product_storage/UserProductStorageLogic.php
+++ b/app/common/logic/user_product_storage/UserProductStorageLogic.php
@@ -71,7 +71,7 @@ class UserProductStorageLogic extends BaseLogic
                             if($price){
                                 $price=bcmul($price,$v['nums'],2);
                                 $rate=bcdiv($price,100,2);
-                                $order_id= StoreOrder::where('id',$cart_info['oid'])->value('order_id');
+                                $order_id= StoreOrder::where('id',$find['oid'])->value('order_id');
                                 UserSignLogic::storage($order_id,$rate);
                             }
     

From de64ba837c715de080c99233675d2c18be148303 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 11 Jul 2024 11:41:37 +0800
Subject: [PATCH 34/37] =?UTF-8?q?feat(UserShipLists):=20=E7=A7=BB=E9=99=A4?=
 =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=B1=BB=E5=9E=8BID=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/lists/user/UserShipLists.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/common/lists/user/UserShipLists.php b/app/common/lists/user/UserShipLists.php
index 55672fc82..6c9c679a8 100644
--- a/app/common/lists/user/UserShipLists.php
+++ b/app/common/lists/user/UserShipLists.php
@@ -42,10 +42,10 @@ class UserShipLists extends BaseAdminDataLists
         if(!$this->request->__get('id')){
             $arr[]=['id'=>0,'title'=>'一般用户','limit'=>0];
         }
-        $type_id=$this->request->get('type_id',0);
-        if($type_id!=4){
-            $this->searchWhere[]=['id','<>',4];
-        }
+        // $type_id=$this->request->get('type_id',0);
+        // if($type_id!=4){
+        //     $this->searchWhere[]=['id','<>',4];
+        // }
         $lists = UserShip::where($this->searchWhere)
             ->limit($this->limitOffset, $this->limitLength)
             ->field($field)

From 359d386cfc74b856d5c354222a638f5e4f38e0fc Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 11 Jul 2024 14:15:19 +0800
Subject: [PATCH 35/37] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?=
 =?UTF-8?q?=E6=88=B7=E7=AD=BE=E5=88=B0=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/UserSignLogic.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/common/logic/UserSignLogic.php b/app/common/logic/UserSignLogic.php
index a2827222d..85955a9ef 100644
--- a/app/common/logic/UserSignLogic.php
+++ b/app/common/logic/UserSignLogic.php
@@ -45,7 +45,7 @@ class UserSignLogic extends BaseLogic
             return false;
         }
         $count = UserRecharge::where(['uid'=>$order->uid,'paid'=>YesNoEnum::YES])->count();
-        if ($count ==1 && in_array($user_ship, [1, 2, 3, 5, 6, 7, 8])) {
+        if ($count ==1 && $user_ship>0) {
             //首充
             $write = self::write($order, $total_vip, 0, 1, 9);
             self::write_log($write, $total_vip, 0, 7);

From 981a9f89ae36938ccaec2930fdaae2486ce41023 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 11 Jul 2024 14:27:32 +0800
Subject: [PATCH 36/37] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?=
 =?UTF-8?q?=E6=88=B7=E5=85=85=E5=80=BC=E6=8E=A7=E5=88=B6=E5=99=A8=E5=92=8C?=
 =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AD=BE=E5=88=B0=E9=80=BB=E8=BE=91=EF=BC=8C?=
 =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=87=91=E9=A2=9D=E6=95=B0=E5=80=BC=E7=B2=BE?=
 =?UTF-8?q?=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/controller/user/UserRechargeController.php | 2 +-
 app/common/logic/UserSignLogic.php                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/api/controller/user/UserRechargeController.php b/app/api/controller/user/UserRechargeController.php
index 3e3c9e46c..4e61c9951 100644
--- a/app/api/controller/user/UserRechargeController.php
+++ b/app/api/controller/user/UserRechargeController.php
@@ -27,7 +27,7 @@ use app\api\lists\user\UserRechargeLists;
             $send_bar = "品牌礼品券";
             $arr = [
                 [
-                    'money'=>1000,//采购包
+                    'money'=>0.01,//采购包
 //                    'money'=>1,//采购包
                     'send'=>249,//礼品券
                     'money_string'=>$buy_bar,
diff --git a/app/common/logic/UserSignLogic.php b/app/common/logic/UserSignLogic.php
index 85955a9ef..0fc96af73 100644
--- a/app/common/logic/UserSignLogic.php
+++ b/app/common/logic/UserSignLogic.php
@@ -25,7 +25,7 @@ class UserSignLogic extends BaseLogic
     {
        $price=(int)$order['price'];
         switch ($price) {
-            case 1000:
+            case 0.01:
                 $total_vip = 249;
                 break;
             case 2000:

From 9ea03279982344d95b5fa8d74a04013e168c63fa Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 11 Jul 2024 15:23:07 +0800
Subject: [PATCH 37/37] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?=
 =?UTF-8?q?=E6=88=B7=E5=85=85=E5=80=BC=E6=8E=A7=E5=88=B6=E5=99=A8=E5=92=8C?=
 =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AD=BE=E5=88=B0=E9=80=BB=E8=BE=91=EF=BC=8C?=
 =?UTF-8?q?=E5=B0=86=E9=87=87=E8=B4=AD=E5=8C=85=E9=87=91=E9=A2=9D=E4=BB=8E?=
 =?UTF-8?q?0.01=E5=85=83=E4=BF=AE=E6=94=B9=E4=B8=BA1000=E5=85=83=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/api/controller/user/UserRechargeController.php | 2 +-
 app/common/logic/UserSignLogic.php                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/api/controller/user/UserRechargeController.php b/app/api/controller/user/UserRechargeController.php
index 4e61c9951..3e3c9e46c 100644
--- a/app/api/controller/user/UserRechargeController.php
+++ b/app/api/controller/user/UserRechargeController.php
@@ -27,7 +27,7 @@ use app\api\lists\user\UserRechargeLists;
             $send_bar = "品牌礼品券";
             $arr = [
                 [
-                    'money'=>0.01,//采购包
+                    'money'=>1000,//采购包
 //                    'money'=>1,//采购包
                     'send'=>249,//礼品券
                     'money_string'=>$buy_bar,
diff --git a/app/common/logic/UserSignLogic.php b/app/common/logic/UserSignLogic.php
index 0fc96af73..85955a9ef 100644
--- a/app/common/logic/UserSignLogic.php
+++ b/app/common/logic/UserSignLogic.php
@@ -25,7 +25,7 @@ class UserSignLogic extends BaseLogic
     {
        $price=(int)$order['price'];
         switch ($price) {
-            case 0.01:
+            case 1000:
                 $total_vip = 249;
                 break;
             case 2000: