From 2030ec81f18f4ec9ea1800f13046acafff6d50f7 Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期四, 26 九月 2024 00:48:59 +0800
Subject: [PATCH] 添加grpc方法:客户信息维护

---
 api/v1/receipt.go |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/api/v1/receipt.go b/api/v1/receipt.go
index e507d08..44b0bb2 100644
--- a/api/v1/receipt.go
+++ b/api/v1/receipt.go
@@ -1,11 +1,13 @@
 package v1
 
 import (
+	"aps_crm/constvar"
 	"aps_crm/model/request"
 	"aps_crm/model/response"
 	"aps_crm/pkg/contextx"
 	"aps_crm/pkg/ecode"
 	"aps_crm/service"
+	"aps_crm/utils"
 	"github.com/gin-gonic/gin"
 	"strconv"
 )
@@ -71,10 +73,10 @@
 	if !ok {
 		return
 	}
-    if params.Id == 0 {
-        ctx.Fail(ecode.ParamsErr)
-    }
-    params.Receipt.Id = params.Id
+	if params.Id == 0 {
+		ctx.Fail(ecode.ParamsErr)
+	}
+	params.Receipt.Id = params.Id
 
 	errCode := service.NewReceiptService().UpdateReceipt(&params.Receipt)
 	if errCode != ecode.OK {
@@ -99,14 +101,19 @@
 		return
 	}
 
-	receipt, total, errCode := service.NewReceiptService().GetReceiptList()
+	userInfo := utils.GetUserInfo(c)
+	if userInfo.UserType == constvar.UserTypeSub {
+		params.PrincipleIds = userInfo.SubUserIds
+	}
+
+	receipt, total, errCode := service.NewReceiptService().GetReceiptList(params)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return
 	}
 
 	ctx.OkWithDetailed(response.ListResponse{
-		Data: receipt,
+		Data:  receipt,
 		Count: total,
 	})
 }

--
Gitblit v1.8.0