|
@@ -0,0 +1,44 @@
|
|
|
+package add_friend
|
|
|
+
|
|
|
+import (
|
|
|
+ "net/http"
|
|
|
+
|
|
|
+ "github.com/zeromicro/go-zero/rest/httpx"
|
|
|
+
|
|
|
+ "wechat-api/internal/logic/add_friend"
|
|
|
+ "wechat-api/internal/svc"
|
|
|
+ "wechat-api/internal/types"
|
|
|
+)
|
|
|
+
|
|
|
+// swagger:route post /add_friend/add_friend_by_phone add_friend AddFriendByPhone
|
|
|
+//
|
|
|
+// 手机号加好友接口
|
|
|
+//
|
|
|
+// 手机号加好友接口
|
|
|
+//
|
|
|
+// Parameters:
|
|
|
+// + name: body
|
|
|
+// require: true
|
|
|
+// in: body
|
|
|
+// type: AddWechatFriendLogInfo
|
|
|
+//
|
|
|
+// Responses:
|
|
|
+// 200: BaseMsgResp
|
|
|
+
|
|
|
+func AddFriendByPhoneHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
|
+ return func(w http.ResponseWriter, r *http.Request) {
|
|
|
+ var req types.AddWechatFriendLogInfo
|
|
|
+ if err := httpx.Parse(r, &req, true); err != nil {
|
|
|
+ httpx.ErrorCtx(r.Context(), w, err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ l := add_friend.NewAddFriendByPhoneLogic(r.Context(), svcCtx)
|
|
|
+ resp, err := l.AddFriendByPhone(&req)
|
|
|
+ if err != nil {
|
|
|
+ httpx.ErrorCtx(r.Context(), w, err)
|
|
|
+ } else {
|
|
|
+ httpx.OkJsonCtx(r.Context(), w, resp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|