From 29d5c9173677eff2106e37ed3f5ee4c353c813ef Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 21 Jun 2023 16:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9api=E7=9A=84request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/gmodel/fs_guest_logic.go | 6 +++++- .../internal/logic/useroderdeletelogic.go | 11 +++++------ server_api/about-us.api | 10 +--------- server_api/basic.api | 14 +++----------- server_api/canteen.api | 1 + server_api/cloud-storage.api | 10 +--------- server_api/contact-us.api | 10 +--------- server_api/designs.api | 10 +--------- server_api/faq.api | 16 ++++------------ server_api/home-user-auth.api | 3 +++ server_api/map-library.api | 1 + server_api/orders.api | 2 ++ server_api/product-templatev2.api | 2 ++ server_api/product.api | 2 ++ server_api/profile.api | 10 +--------- server_api/shopping-cart-confirmation.api | 2 ++ utils/basic/basic.go | 1 + 17 files changed, 36 insertions(+), 75 deletions(-) diff --git a/model/gmodel/fs_guest_logic.go b/model/gmodel/fs_guest_logic.go index 069e43c6..938a5cd8 100755 --- a/model/gmodel/fs_guest_logic.go +++ b/model/gmodel/fs_guest_logic.go @@ -27,7 +27,11 @@ func (m *FsGuestModel) GenerateGuestID(ctx context.Context, AccessSecret *string } record.AuthKey = &authKey record.CreatedAt = &now - tx.Updates(record) + err = tx.Updates(record).Error + if err != nil { + logx.Error(err) + return err + } return nil }) diff --git a/server/home-user-auth/internal/logic/useroderdeletelogic.go b/server/home-user-auth/internal/logic/useroderdeletelogic.go index c91b365f..105ce065 100644 --- a/server/home-user-auth/internal/logic/useroderdeletelogic.go +++ b/server/home-user-auth/internal/logic/useroderdeletelogic.go @@ -125,10 +125,10 @@ func (l *UserOderDeleteLogic) UserOderDelete(req *types.RequestOrderId, userinfo Uploads: stripe.GetBackendWithConfig(stripe.UploadsBackend, config), }) // ['order_number' => $order->sn, 'is_refund' => 0, 'pay_status' => 1] - pay := l.svcCtx.AllModels.FsPay + payM := l.svcCtx.AllModels.FsPay // 查询支付信息 - pays, err := pay.GetOrderPayList(l.ctx, *order.Sn, 1, 0) + pays, err := payM.GetOrderPayList(l.ctx, *order.Sn, 1, 0) for _, pay := range pays { sc.Refunds.New(&stripe.RefundParams{ PaymentIntent: pay.TradeNo, @@ -140,12 +140,11 @@ func (l *UserOderDeleteLogic) UserOderDelete(req *types.RequestOrderId, userinfo } } - // if err == nil && err == nil { - // return ResponseSuccess(200, "Cancel successfully", order) - // } + return resp.SetStatus(basic.CodePayCancelOk, uOrder) + // return ResponseError(500, "Cancellation failure") - return resp.SetStatus(basic.CodePayCancelNotOk) + // return resp.SetStatus(basic.CodePayCancelNotOk) } // func (l *OrderLogic) CancelOrder(req *types.RequestCancelOrder, userinfo *auth.UserInfo) (resp *basic.Response) { diff --git a/server_api/about-us.api b/server_api/about-us.api index 99683571..523d52ba 100644 --- a/server_api/about-us.api +++ b/server_api/about-us.api @@ -7,15 +7,7 @@ info ( email: "" ) -type request { - // TODO: add members here and delete this comment - Name string `path:"name,options=you|me"` // parameters are auto validated -} - -type response { - // TODO: add members here and delete this comment - Message string `json:"message"` -} +import "basic.api" service user-auth { @handler GreetHandler diff --git a/server_api/basic.api b/server_api/basic.api index f400f8fd..5c84f3c7 100644 --- a/server_api/basic.api +++ b/server_api/basic.api @@ -7,6 +7,9 @@ info ( email: "" ) +type request {} + + // response 统一返回码 type response { @@ -15,17 +18,6 @@ type response { Data interface{} `json:"data"` } - -// responseJwt 统一返回码 -type responseJwt { - Code int `json:"code"` - Message string `json:"msg"` - Data interface{} `json:"data"` - AccessSecret string `json:"accessSecret"` - AccessExpire int64 `json:"accessExpire"` -} - - // Auth 认证结构 type Auth { AccessSecret string `json:"accessSecret"` diff --git a/server_api/canteen.api b/server_api/canteen.api index c3f797a3..9f75f17f 100644 --- a/server_api/canteen.api +++ b/server_api/canteen.api @@ -7,6 +7,7 @@ info ( email: "" ) import "basic.api" + service canteen { //获取餐厅详情 @handler GetCanteenDetailHandler diff --git a/server_api/cloud-storage.api b/server_api/cloud-storage.api index 99683571..523d52ba 100644 --- a/server_api/cloud-storage.api +++ b/server_api/cloud-storage.api @@ -7,15 +7,7 @@ info ( email: "" ) -type request { - // TODO: add members here and delete this comment - Name string `path:"name,options=you|me"` // parameters are auto validated -} - -type response { - // TODO: add members here and delete this comment - Message string `json:"message"` -} +import "basic.api" service user-auth { @handler GreetHandler diff --git a/server_api/contact-us.api b/server_api/contact-us.api index 99683571..523d52ba 100644 --- a/server_api/contact-us.api +++ b/server_api/contact-us.api @@ -7,15 +7,7 @@ info ( email: "" ) -type request { - // TODO: add members here and delete this comment - Name string `path:"name,options=you|me"` // parameters are auto validated -} - -type response { - // TODO: add members here and delete this comment - Message string `json:"message"` -} +import "basic.api" service user-auth { @handler GreetHandler diff --git a/server_api/designs.api b/server_api/designs.api index 99683571..648fcb4b 100644 --- a/server_api/designs.api +++ b/server_api/designs.api @@ -7,15 +7,7 @@ info ( email: "" ) -type request { - // TODO: add members here and delete this comment - Name string `path:"name,options=you|me"` // parameters are auto validated -} - -type response { - // TODO: add members here and delete this comment - Message string `json:"message"` -} +import "basic.api" service user-auth { @handler GreetHandler diff --git a/server_api/faq.api b/server_api/faq.api index 99683571..3d3002d0 100644 --- a/server_api/faq.api +++ b/server_api/faq.api @@ -7,17 +7,9 @@ info ( email: "" ) -type request { - // TODO: add members here and delete this comment - Name string `path:"name,options=you|me"` // parameters are auto validated -} +import "basic.api" -type response { - // TODO: add members here and delete this comment - Message string `json:"message"` -} - -service user-auth { - @handler GreetHandler - get /greet/from/:name(request) returns (response); +service faq { + @handler WetSetSettingHandler + get /web-set/setting(request) returns (response); } \ No newline at end of file diff --git a/server_api/home-user-auth.api b/server_api/home-user-auth.api index 97b0246a..8dfd9d96 100644 --- a/server_api/home-user-auth.api +++ b/server_api/home-user-auth.api @@ -42,6 +42,9 @@ service home-user-auth { @handler UserAddAddressHandler post /user/add-address(RequestAddAddress) returns (response); + // @handler UserOderListHandler + // get /user/order-list(RequestOrderId) returns (response); + @handler UserOderDeleteHandler post /user/order-delete(RequestOrderId) returns (response); } diff --git a/server_api/map-library.api b/server_api/map-library.api index 7bd08ebf..b2c6c296 100644 --- a/server_api/map-library.api +++ b/server_api/map-library.api @@ -6,6 +6,7 @@ info ( author: "" email: "" ) + import "basic.api" service map-library { diff --git a/server_api/orders.api b/server_api/orders.api index 69ea42d5..3539afca 100644 --- a/server_api/orders.api +++ b/server_api/orders.api @@ -6,7 +6,9 @@ info ( author: "" email: "" ) + import "basic.api" + service orders { //获取订单发票 @handler GetOrderInvoiceHandler diff --git a/server_api/product-templatev2.api b/server_api/product-templatev2.api index a074bb9b..6943723d 100644 --- a/server_api/product-templatev2.api +++ b/server_api/product-templatev2.api @@ -6,7 +6,9 @@ info ( author: "" email: "" ) + import "basic.api" + service product-templatev2 { //获取产品模板详情 @handler GetTemplatevDetailHandler diff --git a/server_api/product.api b/server_api/product.api index 85648fd3..be17adc3 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -6,7 +6,9 @@ info ( author: "" email: "" ) + import "basic.api" + service product { //获取产品列表 @handler GetProductListHandler diff --git a/server_api/profile.api b/server_api/profile.api index 99683571..523d52ba 100644 --- a/server_api/profile.api +++ b/server_api/profile.api @@ -7,15 +7,7 @@ info ( email: "" ) -type request { - // TODO: add members here and delete this comment - Name string `path:"name,options=you|me"` // parameters are auto validated -} - -type response { - // TODO: add members here and delete this comment - Message string `json:"message"` -} +import "basic.api" service user-auth { @handler GreetHandler diff --git a/server_api/shopping-cart-confirmation.api b/server_api/shopping-cart-confirmation.api index b8c9a79d..d8de6a39 100644 --- a/server_api/shopping-cart-confirmation.api +++ b/server_api/shopping-cart-confirmation.api @@ -6,7 +6,9 @@ info ( author: "ldm" email: "" ) + import "basic.api" + service shopping-cart-confirmation { //添加入购物车 @handler CartAddHandler diff --git a/utils/basic/basic.go b/utils/basic/basic.go index f89f6759..15726e88 100644 --- a/utils/basic/basic.go +++ b/utils/basic/basic.go @@ -116,6 +116,7 @@ func (resp *Response) SetStatusAddMessage(sr *StatusResponse, msg string, data . Code: sr.Code, Message: sr.Message + ":" + msg, } + switch len(data) { case 0: // 0 直接返回