From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 01 十一月 2023 19:20:21 +0800
Subject: [PATCH] 公海member_id使用0

---
 service/salesRefund.go |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/service/salesRefund.go b/service/salesRefund.go
index 2632314..52a4a88 100644
--- a/service/salesRefund.go
+++ b/service/salesRefund.go
@@ -12,7 +12,7 @@
 type SalesRefundService struct{}
 
 func (SalesRefundService) AddSalesRefund(salesRefund *model.SalesRefund) int {
-	salesReturnRecord, err := model.NewSalesReturnSearch().SetId(salesRefund.SourceId).SetPreload(true).First()
+	salesReturnRecord, err := model.NewSalesReturnSearch().SetId(salesRefund.SalesReturnId).SetPreload(true).First()
 	if err != nil {
 		return ecode.SalesReturnNotExist
 	}
@@ -37,7 +37,7 @@
 			return errors.New("閫�璐т骇鍝佸搴旀�讳环瓒呭嚭搴旈��鎬讳环")
 		}
 		salesReturnRecord.AmountShouldRefund = salesReturnRecord.AmountTotal.Sub(salesReturnRecord.AmountHasRefund).Round(2)
-		err = model.NewSalesReturnSearch().SetId(salesRefund.SourceId).Update(salesReturnRecord)
+		err = model.NewSalesReturnSearch().SetId(salesRefund.SalesReturnId).Update(salesReturnRecord)
 		if err != nil {
 			code = ecode.DBErr
 			return err
@@ -73,7 +73,7 @@
 	if err != nil {
 		return ecode.SalesRefundNotExist
 	}
-	salesReturnRecord, err := model.NewSalesReturnSearch().SetId(refund.SourceId).SetPreload(true).First()
+	salesReturnRecord, err := model.NewSalesReturnSearch().SetId(refund.SalesReturnId).SetPreload(true).First()
 	if err != nil {
 		return ecode.SalesReturnNotExist
 	}
@@ -90,7 +90,7 @@
 		}
 		salesReturnRecord.AmountHasRefund = salesReturnRecord.AmountHasRefund.Sub(amount).Round(2)
 		salesReturnRecord.AmountShouldRefund = salesReturnRecord.AmountTotal.Sub(salesReturnRecord.AmountHasRefund).Round(2)
-		err = model.NewSalesReturnSearch().SetId(refund.SourceId).Update(salesReturnRecord)
+		err = model.NewSalesReturnSearch().SetId(refund.SalesReturnId).Update(salesReturnRecord)
 		if err != nil {
 			return err
 		}
@@ -120,7 +120,7 @@
 		return ecode.SalesRefundNotExist
 	}
 
-	salesReturnRecord, err := model.NewSalesReturnSearch().SetId(salesRefund.SourceId).SetPreload(true).First()
+	salesReturnRecord, err := model.NewSalesReturnSearch().SetId(salesRefund.SalesReturnId).SetPreload(true).First()
 	if err != nil {
 		return ecode.SalesReturnNotExist
 	}
@@ -153,7 +153,7 @@
 			return errors.New("閫�璐т骇鍝佸搴旀�讳环瓒呭嚭搴旈��鎬讳环")
 		}
 
-		err = model.NewSalesReturnSearch().SetId(salesRefund.SourceId).Update(salesReturnRecord)
+		err = model.NewSalesReturnSearch().SetId(salesRefund.SalesReturnId).Update(salesReturnRecord)
 		if err != nil {
 			code = ecode.DBErr
 			return err
@@ -168,13 +168,14 @@
 	return ecode.OK
 }
 
-func (SalesRefundService) GetSalesRefundList(page, pageSize int, keywordType constvar.SalesRefundKeywordType, keyword string, sourceId int) ([]*model.SalesRefund, int64, int) {
+func (SalesRefundService) GetSalesRefundList(page, pageSize int, keywordType constvar.SalesRefundKeywordType, keyword string, sourceId int, memberIds []int) ([]*model.SalesRefund, int64, int) {
 	// get contact list
 	contacts, total, err := model.NewSalesRefundSearch().
 		SetKeywordType(keywordType).
 		SetKeyword(keyword).
 		SetSourceId(sourceId).
 		SetPreload(true).
+		SetMemberIds(memberIds).
 		SetPage(page, pageSize).FindAll()
 	if err != nil {
 		return nil, 0, ecode.SalesRefundListErr

--
Gitblit v1.8.0