From 115bd9b51f5d8eade4658f844de37516486c60e7 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期六, 18 十一月 2023 17:25:25 +0800
Subject: [PATCH] crm获取aps项目模块信息

---
 api/v1/invoice.go |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/api/v1/invoice.go b/api/v1/invoice.go
index 68f5ecc..89edcd4 100644
--- a/api/v1/invoice.go
+++ b/api/v1/invoice.go
@@ -1,6 +1,7 @@
 package v1
 
 import (
+	"aps_crm/constvar"
 	"aps_crm/model"
 	"aps_crm/model/request"
 	"aps_crm/model/response"
@@ -8,6 +9,7 @@
 	"aps_crm/pkg/ecode"
 	"aps_crm/pkg/structx"
 	"aps_crm/service"
+	"aps_crm/utils"
 	"github.com/gin-gonic/gin"
 	"strconv"
 )
@@ -32,6 +34,15 @@
 
 	if err != nil {
 		ctx.Fail(ecode.ParamsErr)
+		return
+	}
+	count, err := model.NewInvoiceSearch().SetNumber(invoice.Number).Count()
+	if err != nil {
+		ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触")
+		return
+	}
+	if count > 0 {
+		ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜宸插瓨鍦�")
 		return
 	}
 
@@ -104,9 +115,9 @@
 // @Tags		閿�鍞彂绁�
 // @Summary	鑾峰彇閿�鍞彂绁ㄥ垪琛�
 // @Produce	application/json
-// @Param		object	query		request.GetInvoiceList	true	"鍙傛暟"
+// @Param		object	body		request.GetInvoiceList	true	"鍙傛暟"
 // @Success	200	{object}	response.ListResponse{data=[]model.Invoice}
-// @Router		/api/invoice/list [get]
+// @Router		/api/invoice/list [post]
 func (s *InvoiceApi) List(c *gin.Context) {
 	var params request.GetInvoiceList
 	ctx, ok := contextx.NewContext(c, &params)
@@ -114,7 +125,12 @@
 		return
 	}
 
-	invoice, total, errCode := service.NewInvoiceService().GetInvoiceList()
+	userInfo := utils.GetUserInfo(c)
+	if userInfo.UserType == constvar.UserTypeSub {
+		params.PrincipalIds = userInfo.SubUserIds
+	}
+
+	invoice, total, errCode := service.NewInvoiceService().GetInvoiceList(params)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return

--
Gitblit v1.8.0