From 8bf1cad94113d5c604e95e370cf068efdea87d27 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 30 八月 2023 09:43:49 +0800
Subject: [PATCH] fix
---
api/v1/serviceType.go | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/api/v1/serviceType.go b/api/v1/serviceType.go
index 5e4ba9f..5888c23 100644
--- a/api/v1/serviceType.go
+++ b/api/v1/serviceType.go
@@ -1,7 +1,6 @@
package v1
import (
- "aps_crm/model"
"aps_crm/model/request"
"aps_crm/model/response"
"aps_crm/pkg/contextx"
@@ -14,8 +13,8 @@
type ServiceTypeApi struct{}
// Add
-// @Tags 鏈嶅姟绫诲瀷绠$悊
-// @Summary 娣诲姞鏈嶅姟绫诲瀷
+// @Tags 鏈嶅姟鏂瑰紡绠$悊
+// @Summary 娣诲姞鏈嶅姟鏂瑰紡
// @Produce application/json
// @Param object body request.AddServiceType true "鏌ヨ鍙傛暟"
// @Success 200 {object} contextx.Response{}
@@ -27,9 +26,7 @@
return
}
- serviceType := new(model.ServiceType)
-
- errCode := service.NewServiceTypeService().AddServiceType(serviceType)
+ errCode := service.NewServiceTypeService().AddServiceType(¶ms.ServiceType)
if errCode != ecode.OK {
ctx.Fail(errCode)
return
@@ -39,8 +36,8 @@
}
// Delete
-// @Tags 鏈嶅姟绫诲瀷绠$悊
-// @Summary 鍒犻櫎鏈嶅姟绫诲瀷
+// @Tags 鏈嶅姟鏂瑰紡绠$悊
+// @Summary 鍒犻櫎鏈嶅姟鏂瑰紡
// @Produce application/json
// @Param id path int true "鏌ヨ鍙傛暟"
// @Success 200 {object} contextx.Response{}
@@ -62,8 +59,8 @@
}
// Update
-// @Tags 鏈嶅姟绫诲瀷绠$悊
-// @Summary 鏇存柊鏈嶅姟绫诲瀷
+// @Tags 鏈嶅姟鏂瑰紡绠$悊
+// @Summary 鏇存柊鏈嶅姟鏂瑰紡
// @Produce application/json
// @Param object body request.UpdateServiceType true "鏌ヨ鍙傛暟"
// @Success 200 {object} contextx.Response{}
@@ -74,6 +71,10 @@
if !ok {
return
}
+ if params.Id == 0 {
+ ctx.Fail(ecode.ParamsErr)
+ }
+ params.ServiceType.Id = params.Id
errCode := service.NewServiceTypeService().UpdateServiceType(¶ms.ServiceType)
if errCode != ecode.OK {
@@ -85,8 +86,8 @@
}
// List
-// @Tags 鏈嶅姟绫诲瀷绠$悊
-// @Summary 鑾峰彇鏈嶅姟绫诲瀷鍒楄〃
+// @Tags 鏈嶅姟鏂瑰紡绠$悊
+// @Summary 鑾峰彇鏈嶅姟鏂瑰紡鍒楄〃
// @Produce application/json
// @Success 200 {object} response.ListResponse{data=[]model.ServiceType}
// @Router /api/serviceType/list [get]
--
Gitblit v1.8.0