浏览代码

为了goctls frontend vben能成功,暂时两个API的请求不使用同一套

liwei 4 天之前
父节点
当前提交
833ad68692

+ 6 - 1
desc/openapi/chat.api

@@ -1,4 +1,5 @@
 import "../base.api"
+import "../wechat/wxhook.api"
 
 type (
     
@@ -12,6 +13,10 @@ type (
 		CallbackURL string `json:"callback_url,optional"`
 	}
 
+	NullReq {
+
+	}
+
 	//以下是API请求类型
 	CompApiReq {
         CompCtlReq
@@ -203,7 +208,7 @@ type (
 service Wechat {
     
     @handler getAuth
-    get /chat/getauth () returns (BaseMsgResp)
+    get /chat/getauth (NullReq) returns (BaseMsgResp)
 }
 
 @server(

+ 13 - 2
desc/wechat/add_wechat_friend_log.api

@@ -1,7 +1,18 @@
 import "../base.api"
-import "../openapi/chat.api"
 
 
+type (
+    
+    //add_friend_by_phone api接口请求值
+    AddWechatFriendLogInfo {
+        Type int `json:"type,options=1|3,default=1"`
+		WeChatIds []string `json:"wechat_ids,optional,omitempty"`
+		Phones []string `json:"phones"`
+		Message string `json:"message"`
+		CallbackURL string `json:"callback_url,optional"`
+    }
+)
+
 @server(
     jwt: Auth
     group: add_friend
@@ -11,5 +22,5 @@ import "../openapi/chat.api"
 service Wechat {
     // 手机号加好友接口
     @handler AddFriendByPhone
-    post /add_friend/add_friend_by_phone (AddFriendByPhoneReq) returns (BaseMsgResp)
+    post /add_friend/add_friend_by_phone (AddWechatFriendLogInfo) returns (BaseMsgResp)
 } 

+ 1 - 1
internal/handler/add_friend/add_friend_by_phone_handler.go

@@ -27,7 +27,7 @@ import (
 
 func AddFriendByPhoneHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.AddFriendByPhoneReq
+		var req types.AddWechatFriendLogInfo
 		if err := httpx.Parse(r, &req, true); err != nil {
 			httpx.ErrorCtx(r.Context(), w, err)
 			return

+ 7 - 2
internal/logic/add_friend/add_friend_by_phone_logic.go

@@ -23,9 +23,14 @@ func NewAddFriendByPhoneLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 		svcCtx: svcCtx}
 }
 
-func (l *AddFriendByPhoneLogic) AddFriendByPhone(req *types.AddFriendByPhoneReq) (resp *types.BaseMsgResp, err error) {
+func (l *AddFriendByPhoneLogic) AddFriendByPhone(req *types.AddWechatFriendLogInfo) (resp *types.BaseMsgResp, err error) {
 	// todo: add your logic here and delete this line
 
 	chatLogic := chat.NewAddFriendByPhoneLogic(l.ctx, l.svcCtx)
-	return chatLogic.AddFriendByPhone(req)
+	nreq := &types.AddFriendByPhoneReq{Type: req.Type,
+		WeChatIds:   req.WeChatIds,
+		Phones:      req.Phones,
+		Message:     req.Message,
+		CallbackURL: req.CallbackURL}
+	return chatLogic.AddFriendByPhone(nreq)
 }

+ 14 - 0
internal/types/types.go

@@ -1993,6 +1993,10 @@ type AddFriendByPhoneReq struct {
 	CallbackURL string   `json:"callback_url,optional"`
 }
 
+// swagger:model NullReq
+type NullReq struct {
+}
+
 // 以下是API请求类型
 // swagger:model CompApiReq
 type CompApiReq struct {
@@ -4712,3 +4716,13 @@ type LoginResp struct {
 	// The log in information | 登陆返回的数据信息
 	Data LoginInfo `json:"data"`
 }
+
+// add_friend_by_phone api接口请求值
+// swagger:model AddWechatFriendLogInfo
+type AddWechatFriendLogInfo struct {
+	Type        int      `json:"type,options=1|3,default=1"`
+	WeChatIds   []string `json:"wechat_ids,optional,omitempty"`
+	Phones      []string `json:"phones"`
+	Message     string   `json:"message"`
+	CallbackURL string   `json:"callback_url,optional"`
+}