jimmyyem 2 долоо хоног өмнө
parent
commit
48493dcf17

+ 1 - 2
desc/wechat/credit_usage.api

@@ -61,8 +61,7 @@ type (
 
 		OrganizationId  *uint64 `json:"organizationId,optional"`
 		Ntype  *int `json:"ntype,optional"`
-		StartDate *string `json:"startDate,optional"`
-		EndDate *string `json:"endDate,optional"`
+		SearchDate []string `json:"searchDate,optional"`
     }
 
     // CreditUsage information response | CreditUsage信息返回体

+ 4 - 5
internal/logic/credit_usage/get_credit_usage_list_logic.go

@@ -48,16 +48,15 @@ func (l *GetCreditUsageListLogic) GetCreditUsageList(req *types.CreditUsageListR
 	}
 
 	// 这里是为限制时间段
-	if req.StartDate != nil && *req.StartDate != "" {
-		startDate, err := time.Parse("2006-01-02 15:04:05", *req.StartDate)
+	if req.SearchDate != nil && len(req.SearchDate) == 2 {
+		startDate, err := time.Parse("2006-01-02 15:04:05", req.SearchDate[0])
 		if err != nil {
 			l.Logger.Errorf("时间字符串startDate转换错误: %v", err)
 		} else {
 			predicates = append(predicates, creditusage.CreatedAtGTE(startDate))
 		}
-	}
-	if req.EndDate != nil && *req.EndDate != "" {
-		endDate, err := time.Parse("2006-01-02 15:04:05", *req.EndDate)
+
+		endDate, err := time.Parse("2006-01-02 15:04:05", req.SearchDate[1])
 		if err != nil {
 			l.Logger.Errorf("时间字符串endDate转换错误: %v", err)
 		} else {

+ 3 - 4
internal/types/types.go

@@ -3713,10 +3713,9 @@ type CreditUsageListInfo struct {
 // swagger:model CreditUsageListReq
 type CreditUsageListReq struct {
 	PageInfo
-	OrganizationId *uint64 `json:"organizationId,optional"`
-	Ntype          *int    `json:"ntype,optional"`
-	StartDate      *string `json:"startDate,optional"`
-	EndDate        *string `json:"endDate,optional"`
+	OrganizationId *uint64  `json:"organizationId,optional"`
+	Ntype          *int     `json:"ntype,optional"`
+	SearchDate     []string `json:"searchDate,optional"`
 }
 
 // CreditUsage information response | CreditUsage信息返回体