From 6db0b6fc47c29c5831038e706da01fdb84a17f32 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 20 Jun 2024 18:13:20 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=A7=AF=E5=88=86?=
 =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96?=
 =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=B5=81=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../StoreFinanceFlowLists.php                 | 16 +++++++++++++-
 app/common/logic/PayNotifyLogic.php           | 22 +++++++++++++++++++
 app/common/model/user_sign/UserSign.php       |  2 +-
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
index a78400e8d..3bf1fb6bc 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
@@ -11,6 +11,7 @@ use app\common\lists\ListsSearchInterface;
 use app\common\model\system_store\SystemStore;
 use app\common\model\system_store\SystemStoreStaff;
 use app\common\model\user\User;
+use app\common\model\user_sign\UserSign;
 use think\db\Query;
 
 /**
@@ -81,7 +82,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
             })->toArray();
 
         foreach ($data as $key => $item) {
-            $data[$key]['list'] = StoreFinanceFlow::where('order_id' ,$item['order_id'])->where('financial_type','>', 1)->field($field)->order('financial_pm','desc')->select()->each(function ($item) {
+             $list1= StoreFinanceFlow::where('order_id' ,$item['order_id'])->where('financial_type','>', 1)->field($field)->order('financial_pm','desc')->select()->each(function ($item) {
                 if ($item['user_id'] <= 0) {
                     $item['nickname'] = '游客';
                 } else {
@@ -102,6 +103,19 @@ 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']);
             });
+            $list2=UserSign::where('order_id',$item['order_sn'])->whereIn('user_ship',[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'];
+                $list2[$k]['financial_pm']=0;
+                $list2[$k]['nickname']=$v['uid']>0?User::where('id', $v['uid'])->value('nickname') . '|'.$v['uid']:'游客';
+                $list2[$k]['number']='+'.$v['number'];
+                $list2[$k]['financial_type_name']=$v['title'];
+                $list2[$k]['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']);
+
+            }
+            $data[$key]['list']=array_merge($list1->toArray(),$list2->toArray());
         }
         return $data;
     }
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 181ce6c1f..689234048 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -453,6 +453,8 @@ class PayNotifyLogic extends BaseLogic
                 'title' => '村长订单获得兑换券',
                 'store_id' => $order['store_id'],
                 'number' => $fees,
+                'financial_pm' => 1,
+                'user_ship' => 2,
             ];
             $sing[] = [
                 'uid' => $brigade_uid,
@@ -460,6 +462,26 @@ class PayNotifyLogic extends BaseLogic
                 'title' => '队长订单获得兑换券',
                 'store_id' => $order['store_id'],
                 'number' => $fees,
+                'financial_pm' => 1,
+                'user_ship' => 3,
+            ];
+            $sing[] = [
+                'uid' => $village_uid,
+                'order_id' => $order['order_id'],
+                'title' => '订单扣除兑换券',
+                'store_id' => $order['store_id'],
+                'number' => $fees,
+                'financial_pm' => 0,
+                'user_ship' => 2,
+            ];
+            $sing[] = [
+                'uid' => $brigade_uid,
+                'order_id' => $order['order_id'],
+                'title' => '订单扣除兑换券',
+                'store_id' => $order['store_id'],
+                'number' => $fees,
+                'financial_pm' => 0,
+                'user_ship' => 3,
             ];
             // if ($village_uid > 0) {
             // $financeLogic->other_arr['vip_uid'] = $village_uid;
diff --git a/app/common/model/user_sign/UserSign.php b/app/common/model/user_sign/UserSign.php
index db0ade179..70fcef24c 100644
--- a/app/common/model/user_sign/UserSign.php
+++ b/app/common/model/user_sign/UserSign.php
@@ -8,7 +8,7 @@ use think\model\concern\SoftDelete;
 
 
 /**
- * 计量单位
+ * 积分记录
  * Class UserSign
  * @package app\common\model\user_sign
  */