From 2ed11613a11e7f2abb1756666d5ae329f8caeb1d Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 12 Jun 2023 17:35:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AEAuth?= =?UTF-8?q?=E7=9A=84=E7=9B=B8=E5=85=B3=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goctl_template/api/etc.tpl | 4 ++ server/home-user-auth/internal/types/types.go | 43 +------------------ 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/goctl_template/api/etc.tpl b/goctl_template/api/etc.tpl index cf7aee4b..d2c383f3 100644 --- a/goctl_template/api/etc.tpl +++ b/goctl_template/api/etc.tpl @@ -2,3 +2,7 @@ Name: {{.serviceName}} Host: {{.host}} Port: {{.port}} SourceMysql: "" +Auth: + AccessSecret: fusen2023 + AccessExpire: 604800 + RefreshAfter: 345600 \ No newline at end of file diff --git a/server/home-user-auth/internal/types/types.go b/server/home-user-auth/internal/types/types.go index c964fefc..1a2a01a2 100644 --- a/server/home-user-auth/internal/types/types.go +++ b/server/home-user-auth/internal/types/types.go @@ -2,7 +2,7 @@ package types import ( - "fusenapi/utils/basic" + ) type Request struct { @@ -125,43 +125,4 @@ type Auth struct { AccessExpire int64 `json:"accessExpire"` RefreshAfter int64 `json:"refreshAfter"` } - -// Set 设置Response的Code和Message值 -func (resp *Response) Set(Code int, Message string) *Response { - return &Response{ - Code: Code, - Message: Message, - } -} - -// Set 设置整个Response -func (resp *Response) SetWithData(Code int, Message string, Data interface{}) *Response { - return &Response{ - Code: Code, - Message: Message, - Data: Data, - } -} - -// SetStatus 设置默认StatusResponse(内部自定义) 默认msg, 可以带data, data只使用一个参数 -func (resp *Response) SetStatus(sr *basic.StatusResponse, data ...interface{}) *Response { - newResp := &Response{ - Code: sr.Code, - } - if len(data) == 1 { - newResp.Data = data[0] - } - return newResp -} - -// SetStatusWithMessage 设置默认StatusResponse(内部自定义) 非默认msg, 可以带data, data只使用一个参数 -func (resp *Response) SetStatusWithMessage(sr *basic.StatusResponse, msg string, data ...interface{}) *Response { - newResp := &Response{ - Code: sr.Code, - Message: msg, - } - if len(data) == 1 { - newResp.Data = data[0] - } - return newResp -} + \ No newline at end of file