修复模板

This commit is contained in:
eson 2023-07-20 16:32:41 +08:00
parent 810f4fbee7
commit 7c2762065c
5 changed files with 31 additions and 23 deletions

View File

@ -2,6 +2,7 @@ package {{.PkgName}}
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
@ -19,8 +20,12 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
// 创建一个业务逻辑层实例
{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
{{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, {{end}}userinfo)
basic.AfterLogic(w, r, resp)
basic.AfterLogic(w, r, resp, rl)
}
}

View File

@ -2,6 +2,7 @@ package {{.PkgName}}
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
@ -18,8 +19,12 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
// 创建一个业务逻辑层实例
{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
{{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, {{end}}userinfo)
basic.AfterLogic(w, r, resp)
basic.AfterLogic(w, r, resp, rl)
}
}

View File

@ -28,8 +28,6 @@ func UserGoogleLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
resp := l.UserGoogleLogin(&req, userinfo)
if !basic.AfterLogic(w, r, resp, rl) {
basic.NormalAfterLogic(w, r, resp)
}
basic.AfterLogic(w, r, resp, rl)
}
}

View File

@ -41,7 +41,7 @@ func (l *UserGoogleLoginLogic) BeforeLogic(w http.ResponseWriter, r *http.Reques
func (l *UserGoogleLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
log.Println(resp.Message)
http.Redirect(w, r, "http://localhost:9900/?token="+resp.Message, http.StatusMovedPermanently)
http.Redirect(w, r, "http://localhost:8080?token="+resp.Message, http.StatusMovedPermanently)
// log.Println(r, w)
}

View File

@ -10,57 +10,57 @@ info (
import "basic.api"
service home-user-auth {
// @handler UserRegisterHandler
// post /api/user/register(RequestUserRegister) returns (response);
@handler UserLoginHandler
post /api/user/login(RequestUserLogin) returns (response);
@handler AcceptCookieHandler
post /api/user/accept-cookie(request) returns (response);
@handler UserFontsHandler
get /api/user/fonts(request) returns (response);
@handler UserGetTypeHandler
get /api/user/get-type(request) returns (response);
@handler UserSaveBasicInfoHandler
post /api/user/basic-info(RequestBasicInfoForm) returns (response);
@handler UserStatusConfigHandler
get /api/user/status-config(request) returns (response);
@handler UserBasicInfoHandler
get /api/user/basic-info(request) returns (response);
@handler UserAddressListHandler
get /api/user/address-list(request) returns (response);
@handler UserAddAddressHandler
post /api/user/add-address(RequestAddAddress) returns (response);
@handler UserContactServiceHandler
post /api/user/contact-service (RequestContactService) returns (response);
// @handler UserOderListHandler
// get /api/user/order-list(RequestOrderId) returns (response);
@handler UserOderDeleteHandler
post /api/user/order-delete(RequestOrderId) returns (response);
@handler UserGoogleLoginHandler
get /api/user/oauth2/login/google(RequestGoogleLogin) returns (response);
//获取订单列表
@handler GetUserOrderListHandler
get /api/user/order-list (GetUserOrderListReq) returns (response);
//取消订单
@handler UserOrderCancelHandler
get /api/user/order-cancel (UserOrderCancelReq) returns (response);
}
//取消订单