From 5fa1de02759b9646e8987312736699755990e960 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期五, 13 十月 2023 15:30:22 +0800 Subject: [PATCH] bug修改 --- api/v1/masterOrder.go | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/api/v1/masterOrder.go b/api/v1/masterOrder.go index 1e77b66..1e7b005 100644 --- a/api/v1/masterOrder.go +++ b/api/v1/masterOrder.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type MasterOrderApi struct{} @@ -39,6 +38,14 @@ return } + if params.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(masterOrder.Id, ¶ms.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewMasterOrderSearch().SetId(masterOrder.Id).UpdateByMap(m) + } + ctx.Ok() } @@ -47,17 +54,17 @@ // @Tags MasterOrder // @Summary 鍒犻櫎涓昏鍗� // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteMasterOrder true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/masterOrder/delete/{id} [delete] +// @Router /api/masterOrder/delete [delete] func (s *MasterOrderApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteMasterOrder + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := masterOrderService.DeleteMasterOrder(id) + errCode := masterOrderService.DeleteMasterOrder(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -98,7 +105,6 @@ ctx.Ok() } - // checkMasterOrderParams // 妫�鏌ヤ富璁㈠崟鍙傛暟 func checkMasterOrderParams(masterOrder request.MasterOrder) (errCode int, masterOrderModel model.MasterOrder) { @@ -126,6 +132,7 @@ masterOrderModel.MemberId = masterOrder.MemberId masterOrderModel.ClientId = masterOrder.ClientId masterOrderModel.Money = masterOrder.Money + masterOrderModel.CodeStandID = masterOrder.CodeStandID return ecode.OK, masterOrderModel } @@ -145,14 +152,14 @@ return } - masterOrders, total, errCode := masterOrderService.GetMasterOrderList(params.Page, params.PageSize, params.Keyword) + masterOrders, total, errCode := masterOrderService.GetMasterOrderList(params.Page, params.PageSize, params.SearchMap) if errCode != ecode.OK { ctx.Fail(errCode) return } ctx.OkWithDetailed(response.MasterOrderResponse{ - List: masterOrders, + List: masterOrders, Count: int(total), }) -} \ No newline at end of file +} -- Gitblit v1.8.0