This commit is contained in:
laodaming 2023-10-09 17:56:28 +08:00
parent 32cda95788
commit 0ce7cf8f17
5 changed files with 139 additions and 0 deletions

View File

@ -27,6 +27,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/collection/get_collect_product_list",
Handler: GetCollectProductListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/collection/test_ai",
Handler: TestAiHandler(serverCtx),
},
},
)
}

View File

@ -0,0 +1,35 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/collection/internal/logic"
"fusenapi/server/collection/internal/svc"
"fusenapi/server/collection/internal/types"
)
func TestAiHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TestAiReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewTestAiLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.TestAi(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -40,6 +40,10 @@ type GetCollectProductListRspItem struct {
IsDeleted int64 `json:"is_deleted"`
}
type TestAiReq struct {
Num int `form:"num"`
}
type Request struct {
}

View File

@ -18,6 +18,9 @@ service collection {
//获取收藏列表
@handler GetCollectProductListHandler
get /api/collection/get_collect_product_list(GetCollectProductListReq) returns (response);
//测试
@handler TestAiHandler
get /api/collection/test_ai(TestAiReq) returns (response);
}
//收藏产品
@ -52,4 +55,8 @@ type GetCollectProductListRspItem {
MinPrice string `json:"min_price"`
IsShelf int64 `json:"is_shelf"`
IsDeleted int64 `json:"is_deleted"`
}
//测试
type TestAiReq {
Num int `form:"num"`
}