From c92534229c83436ffe9e6752209200dd70b77808 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期四, 17 八月 2023 19:19:44 +0800
Subject: [PATCH] add
---
api/v1/contract.go | 65 +++++++++++++++++---------------
1 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/api/v1/contract.go b/api/v1/contract.go
index 9d8cc67..4b94771 100644
--- a/api/v1/contract.go
+++ b/api/v1/contract.go
@@ -87,6 +87,8 @@
return
}
+ contract.Id = params.Id
+
errCode = contractService.UpdateContract(&contract)
if errCode != ecode.OK {
ctx.Fail(errCode)
@@ -96,38 +98,14 @@
ctx.Ok()
}
-// List
-//
-// @Tags Contract
-// @Summary 鑾峰彇鍚堝悓鍒楄〃
-// @Produce application/json
-// @Success 200 {object} contextx.Response{data=response.ContractResponse}
-// @Router /api/contract/list [get]
-func (s *ContractApi) List(c *gin.Context) {
- ctx, ok := contextx.NewContext(c, nil)
- if !ok {
- return
- }
-
- contractList, errCode := contractService.GetContractList()
- if errCode != ecode.OK {
- ctx.Fail(errCode)
- return
- }
-
- ctx.OkWithDetailed(response.ContractResponse{
- List: contractList,
- })
-}
-
func checkContractParams(contract request.Contract) (errCode int, contractModel model.Contract) {
- if contract.Number == "" {
- return ecode.InvalidParams, contractModel
- }
+ //if contract.Number == "" {
+ // return ecode.InvalidParams, contractModel
+ //}
- if contract.MemberId == 0 {
- return ecode.InvalidParams, contractModel
- }
+ //if contract.MemberId == 0 {
+ // return ecode.InvalidParams, contractModel
+ //}
contractModel = model.Contract{
ClientId: contract.ClientId,
@@ -140,3 +118,30 @@
return ecode.OK, contractModel
}
+
+// List
+//
+// @Tags Contract
+// @Summary 閿�鍞悎鍚屽垪琛�
+// @Produce application/json
+// @Param object body request.GetContractList true "鍙傛暟"
+// @Success 200 {object} contextx.Response{data=response.ContractResponse}
+// @Router /api/contract/list [post]
+func (con *ContractApi) List(c *gin.Context) {
+ var params request.GetContractList
+ ctx, ok := contextx.NewContext(c, ¶ms)
+ if !ok {
+ return
+ }
+
+ contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap)
+ if errCode != ecode.OK {
+ ctx.Fail(errCode)
+ return
+ }
+
+ ctx.OkWithDetailed(response.ContractResponse{
+ List: contracts,
+ Count: int(total),
+ })
+}
--
Gitblit v1.8.0