|
|
@ -408,3 +408,40 @@ func RegisterSelectCheckLogin(party router.Party, path string, method func(*mode |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, nil) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/****************************************************************************** |
|
|
|
* |
|
|
|
* @Function Name : RegisterSelectByUserName |
|
|
|
*----------------------------------------------------------------------------- |
|
|
|
* |
|
|
|
* @Description : 为一个查找单条Person的方法注册路由 |
|
|
|
* |
|
|
|
* @Function Parameters : 路由分组 |
|
|
|
* |
|
|
|
* @Function Parameters : 路径 |
|
|
|
* |
|
|
|
* @Function Parameters : 实际处理请求的方法 |
|
|
|
* |
|
|
|
* @Author : 代码生成器创建 |
|
|
|
* |
|
|
|
* @Date : 2021-04-25 14:20:56 |
|
|
|
* |
|
|
|
******************************************************************************/ |
|
|
|
func RegisterSelectByUserName(party router.Party, path string, method func(*models.Usertab, string) (*model.Person, error)) { |
|
|
|
|
|
|
|
party.Get(path, func(ctx iris.Context) { |
|
|
|
user, ok := jwts.ParseToken(ctx) |
|
|
|
if !ok { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
personId := ctx.URLParam("personId") |
|
|
|
data, err := method(user, personId) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) |
|
|
|
return |
|
|
|
} |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, data) |
|
|
|
}) |
|
|
|
} |