Initial commit
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
package web_appcategory
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"stat/common/stdLog"
|
||||
"stat/models/appcategory"
|
||||
"stat/service/srv_appcategory"
|
||||
)
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 添加分类
|
||||
// @Description 添加分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body appcategory.AppCategory true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/add [POST]
|
||||
func AddAppCategory(ctx *gin.Context) {
|
||||
params := &appcategory.AppCategory{}
|
||||
err := ctx.ShouldBind(params)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
serr := srv_appcategory.AddAppCategory(ctx, params)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
|
||||
}
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 删除分类
|
||||
// @Description 删除分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_appcategory.AppCategoryDelReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/del [POST]
|
||||
func DelAppCategory(ctx *gin.Context) {
|
||||
param := &srv_appcategory.AppCategoryDelReq{}
|
||||
err := ctx.ShouldBind(param)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := srv_appcategory.DelAppCategory(ctx, param.Id)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 更新分类
|
||||
// @Description 更新分类
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_appcategory.AppCategoryUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/update [POST]
|
||||
func UpdateAppCategory(ctx *gin.Context) {
|
||||
params := &srv_appcategory.AppCategoryUpdateReq{}
|
||||
err := ctx.ShouldBind(params)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := srv_appcategory.UpdateAppCategory(ctx, params.Id, ¶ms.Param)
|
||||
if serr != nil {
|
||||
stdLog.ServerJSON(ctx, serr.Code, serr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, nil)
|
||||
}
|
||||
|
||||
// @Tags 应用分类
|
||||
// @Summary 查询分类列表
|
||||
// @Description 查询分类列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_appcategory.AppCategorySearch true "参数列表"
|
||||
// @Success 200 {object} srv_appcategory.AppCategorySearchResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Router /api/stat/web/appcategory/list [POST]
|
||||
func GetAppCategories(ctx *gin.Context) {
|
||||
param := &srv_appcategory.AppCategorySearch{}
|
||||
err := ctx.ShouldBind(¶m)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, nil)
|
||||
return
|
||||
}
|
||||
result, sErr := srv_appcategory.GetAppCategory(ctx, param)
|
||||
if sErr != nil {
|
||||
stdLog.ServerJSON(ctx, sErr.Code, sErr.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, result)
|
||||
}
|
||||
Reference in New Issue
Block a user