|
|
@ -374,3 +374,78 @@ func RegisterUpdatePrintBasicRuleInfo(party router.Party, path string, method fu |
|
|
|
|
|
|
|
RegisterMultiPrintBasicRuleInfo(party, "PUT", path, method) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************** |
|
|
|
* |
|
|
|
* @Function Name : RegisterSavePrintBasicRuleInfo |
|
|
|
*----------------------------------------------------------------------------- |
|
|
|
* |
|
|
|
* @Description : 为一个保存operation对应的PrintBasicRuleInfo的方法注册路由 |
|
|
|
* |
|
|
|
* @Function Parameters : 路由分组 |
|
|
|
* |
|
|
|
* @Function Parameters : HTTP方法 |
|
|
|
* |
|
|
|
* @Function Parameters : 路径 |
|
|
|
* |
|
|
|
* @Function Parameters : 实际处理请求的方法 |
|
|
|
* |
|
|
|
* @Author : zhangxin |
|
|
|
* |
|
|
|
* @Date : 2021-09-03 |
|
|
|
* |
|
|
|
******************************************************************************/ |
|
|
|
func RegisterSavePrintBasicRuleInfo(party router.Party, httpMethod string, path string, method func(*models.Usertab, *model.PrintBasicRuleInfoData) error) { |
|
|
|
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) { |
|
|
|
user, ok := jwts.ParseToken(ctx) |
|
|
|
if !ok { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var err error = nil |
|
|
|
|
|
|
|
entity := new(model.PrintBasicRuleInfoData) |
|
|
|
if ctx.GetContentLength() > 0 { |
|
|
|
err := ctx.ReadJSON(entity) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
entity = nil |
|
|
|
} |
|
|
|
|
|
|
|
err = method(user, entity) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) |
|
|
|
return |
|
|
|
} |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, nil) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/****************************************************************************** |
|
|
|
* |
|
|
|
* @Function Name : RegisterSavePrintBasicRuleInfoHandler |
|
|
|
*----------------------------------------------------------------------------- |
|
|
|
* |
|
|
|
* @Description : 为一个保存operation对应的PrintBasicRuleInfo的方法注册路由 |
|
|
|
* |
|
|
|
* @Function Parameters : 路由分组 |
|
|
|
* |
|
|
|
* @Function Parameters : 路径 |
|
|
|
* |
|
|
|
* @Function Parameters : 实际处理请求的方法 |
|
|
|
* |
|
|
|
* @Author : zhangxin |
|
|
|
* |
|
|
|
* @Date : 2021-09-03 |
|
|
|
* |
|
|
|
******************************************************************************/ |
|
|
|
func RegisterSavePrintBasicRuleInfoHandler(party router.Party, path string, method func(*models.Usertab, *model.PrintBasicRuleInfoData) error) { |
|
|
|
|
|
|
|
RegisterSavePrintBasicRuleInfo(party, "POST", path, method) |
|
|
|
} |