mir: remove reduce comment in mirc/web/v1 and go mod tidy

pull/196/head
Michael Li 3 years ago
parent 989d79080e
commit 3a1626efb4
No known key found for this signature in database

@ -132,5 +132,3 @@ require (
modernc.org/strutil v1.1.1 // indirect modernc.org/strutil v1.1.1 // indirect
modernc.org/token v1.0.0 // indirect modernc.org/token v1.0.0 // indirect
) )
replace github.com/alimy/mir/v3 => ../../alimy/mir

@ -147,6 +147,8 @@ github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:C
github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk=
github.com/alimy/cfg v0.3.0 h1:9xgA0QWVCPSq9fFNRcYahVCAX22IL9ts2wrTQPfAStY= github.com/alimy/cfg v0.3.0 h1:9xgA0QWVCPSq9fFNRcYahVCAX22IL9ts2wrTQPfAStY=
github.com/alimy/cfg v0.3.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= github.com/alimy/cfg v0.3.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c=
github.com/alimy/mir/v3 v3.0.0-beta.2 h1:qpg0l4FEUafkpzGXlBIJtJbFjQfzbK9lDP5FJjjgOrA=
github.com/alimy/mir/v3 v3.0.0-beta.2/go.mod h1:ybhT2ijOiDn0lLwWzIY6vXdv+uzZrctS7VFfczcXBWU=
github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible h1:9gWa46nstkJ9miBReJcN8Gq34cBFbzSpQZVVT9N09TM= github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible h1:9gWa46nstkJ9miBReJcN8Gq34cBFbzSpQZVVT9N09TM=
github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=

@ -10,9 +10,6 @@ func init() {
AddEntry(new(WebAdmin)) AddEntry(new(WebAdmin))
} }
// // 管理·禁言/解封用户
// adminApi.POST("/admin/user/status", api.ChangeUserStatus)
type WebAdmin struct { type WebAdmin struct {
Chain Chain `mir:"-"` Chain Chain `mir:"-"`
Group Group `mir:"v1"` Group Group `mir:"v1"`

@ -10,21 +10,6 @@ func init() {
AddEntries(new(WebAlipayPub), new(WebAlipayPriv)) AddEntries(new(WebAlipayPub), new(WebAlipayPriv))
} }
// // routeAlipay register Alipay feature releated route if needed
// func routeAlipay(public gin.IRoutes, authApi gin.IRoutes) {
// // 支付宝回调
// public.POST("/alipay/notify", api.AlipayNotify)
// // 用户充值
// authApi.POST("/user/recharge", api.GetUserRechargeLink)
// // 获取钱包余额
// authApi.GET("/user/recharge", api.GetUserRechargeResult)
// // 获取用户账单
// authApi.GET("/user/wallet/bills", api.GetUserWalletBills)
// }
type WebAlipayPub struct { type WebAlipayPub struct {
Group Group `mir:"v1"` Group Group `mir:"v1"`
@ -38,8 +23,10 @@ type WebAlipayPriv struct {
// UserRechargeLink 用户充值 // UserRechargeLink 用户充值
UserRechargeLink func(Post) `mir:"/user/recharge"` UserRechargeLink func(Post) `mir:"/user/recharge"`
// UserRechargeResult 获取钱包余额 // UserRechargeResult 获取钱包余额
UserRechargeResult func(Get) `mir:"/user/recharge"` UserRechargeResult func(Get) `mir:"/user/recharge"`
// UserWalletBills 获取用户账单 // UserWalletBills 获取用户账单
UserWalletBills func(Get, web.UserWalletBillsReq) web.UserWalletBillsResp `mir:"/user/wallet/bills"` UserWalletBills func(Get, web.UserWalletBillsReq) web.UserWalletBillsResp `mir:"/user/wallet/bills"`
} }

@ -10,88 +10,55 @@ func init() {
AddEntry(new(WebCore)) AddEntry(new(WebCore))
} }
// // 同步索引
// authApi.GET("/sync/index", api.SyncSearchIndex)
// // 获取当前用户信息
// authApi.GET("/user/info", api.GetUserInfo)
// // 获取当前用户未读消息数量
// authApi.GET("/user/msgcount/unread", api.GetUnreadMsgCount)
// // 获取消息列表
// authApi.GET("/user/messages", api.GetMessages)
// // 标记消息已读
// authApi.POST("/user/message/read", api.ReadMessage)
// // 发送用户私信
// authApi.POST("/user/whisper", api.SendUserWhisper)
// // 获取用户收藏列表
// authApi.GET("/user/collections", api.GetUserCollections)
// // 获取用户点赞列表
// authApi.GET("/user/stars", api.GetUserStars)
// // 绑定用户手机号
// authApi.POST("/user/phone", api.BindUserPhone)
// // 修改密码
// authApi.POST("/user/password", api.ChangeUserPassword)
// // 修改昵称
// authApi.POST("/user/nickname", api.ChangeNickname)
// // 修改头像
// authApi.POST("/user/avatar", api.ChangeAvatar)
// // 检索用户
// authApi.GET("/suggest/users", api.GetSuggestUsers)
// // 检索标签
// authApi.GET("/suggest/tags", api.GetSuggestTags)
// // 获取动态点赞状态
// authApi.GET("/post/star", api.GetPostStar)
// // 获取动态收藏状态
// authApi.GET("/post/collection", api.GetPostCollection)
type WebCore struct { type WebCore struct {
Chain Chain `mir:"-"` Chain Chain `mir:"-"`
Group Group `mir:"v1"` Group Group `mir:"v1"`
// SyncSearchIndex 同步索引 // SyncSearchIndex 同步索引
SyncSearchIndex func(Get) `mir:"/sync/index"` SyncSearchIndex func(Get) `mir:"/sync/index"`
// GetUserInfo 获取当前用户信息 // GetUserInfo 获取当前用户信息
GetUserInfo func(Get, web.UserInfoReq) web.UserInfoResp `mir:"/user/info"` GetUserInfo func(Get, web.UserInfoReq) web.UserInfoResp `mir:"/user/info"`
// GetUnreadMsgCount 获取当前用户未读消息数量 // GetUnreadMsgCount 获取当前用户未读消息数量
GetUnreadMsgCount func(Get) `mir:"/user/msgcount/unread"` GetUnreadMsgCount func(Get) `mir:"/user/msgcount/unread"`
// GetMessages 获取消息列表 // GetMessages 获取消息列表
GetMessages func(Get) `mir:"/user/messages"` GetMessages func(Get) `mir:"/user/messages"`
// ReadMessage 标记消息已读 // ReadMessage 标记消息已读
ReadMessage func(Post) `mir:"/user/message/read"` ReadMessage func(Post) `mir:"/user/message/read"`
// SendUserWhisper 发送用户私信 // SendUserWhisper 发送用户私信
SendUserWhisper func(Post) `mir:"/user/whisper"` SendUserWhisper func(Post) `mir:"/user/whisper"`
// GetCollections 获取用户收藏列表 // GetCollections 获取用户收藏列表
GetCollections func(Get) `mir:"/user/collections"` GetCollections func(Get) `mir:"/user/collections"`
// GetStars 获取用户点赞列表 // GetStars 获取用户点赞列表
GetStars func(Get) `mir:"/user/stars"` GetStars func(Get) `mir:"/user/stars"`
// UserPhoneBind 绑定用户手机号 // UserPhoneBind 绑定用户手机号
UserPhoneBind func(Post) `mir:"/user/phone"` UserPhoneBind func(Post) `mir:"/user/phone"`
// ChangePassword 修改密码 // ChangePassword 修改密码
ChangePassword func(Post) `mir:"/user/password"` ChangePassword func(Post) `mir:"/user/password"`
// ChangeNickname 修改昵称 // ChangeNickname 修改昵称
ChangeNickname func(Post) `mir:"/user/nickname"` ChangeNickname func(Post) `mir:"/user/nickname"`
// ChangeAvatar 修改头像 // ChangeAvatar 修改头像
ChangeAvatar func(Post, web.ChangeAvatarReq) `mir:"/user/avatar"` ChangeAvatar func(Post, web.ChangeAvatarReq) `mir:"/user/avatar"`
// SuggestUsers 检索用户 // SuggestUsers 检索用户
SuggestUsers func(Get) `mir:"/suggest/users"` SuggestUsers func(Get) `mir:"/suggest/users"`
// SuggestTags 检索标签 // SuggestTags 检索标签
SuggestTags func(Get) `mir:"/suggest/tags"` SuggestTags func(Get) `mir:"/suggest/tags"`
// TweetStarStatus 获取动态点赞状态 // TweetStarStatus 获取动态点赞状态
TweetStarStatus func(Get) `mir:"/post/star"` TweetStarStatus func(Get) `mir:"/post/star"`
// TweetCollectionStatus 获取动态收藏状态 // TweetCollectionStatus 获取动态收藏状态
TweetCollectionStatus func(Get) `mir:"/post/collection"` TweetCollectionStatus func(Get) `mir:"/post/collection"`
} }

@ -16,10 +16,13 @@ type WebFollowship struct {
// AddFollowing 添加关注 // AddFollowing 添加关注
AddFollowing func(Post) `mir:"/following/add"` AddFollowing func(Post) `mir:"/following/add"`
// DeleteFollowing 取消关注 // DeleteFollowing 取消关注
DeleteFollowing func(Post) `mir:"/following/delete"` DeleteFollowing func(Post) `mir:"/following/delete"`
// ListFollowings 获取用户的关注列表 // ListFollowings 获取用户的关注列表
ListFollowings func(Get) `mir:"/following/list"` ListFollowings func(Get) `mir:"/following/list"`
// ListFollowers 获取用户的追随者列表 // ListFollowers 获取用户的追随者列表
ListFollowers func(Get, web.ListFollowersReq) web.ListFollowersResp `mir:"/follower/list"` ListFollowers func(Get, web.ListFollowersReq) web.ListFollowersResp `mir:"/follower/list"`
} }

@ -10,24 +10,6 @@ func init() {
AddEntry(new(WebFriendship)) AddEntry(new(WebFriendship))
} }
// // routeFriendship register Friendship feature releated routes
// func routeFriendship(authApi gin.IRoutes) {
// // 请求添加朋友
// authApi.POST("/friend/requesting", api.RequestingFriend)
// // 同意添加好友
// authApi.POST("/friend/add", api.AddFriend)
// // 拒绝添加好友
// authApi.POST("/friend/reject", api.RejectFriend)
// // 删除好友
// authApi.POST("/friend/delete", api.DeleteFriend)
// // 获取好友列表
// authApi.GET("/user/contacts", api.GetContacts)
// }
type WebFriendship struct { type WebFriendship struct {
Chain Chain `mir:"-"` Chain Chain `mir:"-"`
Group Group `mir:"v1"` Group Group `mir:"v1"`

@ -10,27 +10,16 @@ func init() {
AddEntry(new(WebLoose)) AddEntry(new(WebLoose))
} }
// // 宽松鉴权路由组
// looseApi := r.Group("/").Use(chain.JwtLoose())
// {
// // 获取广场流
// looseApi.GET("/posts", api.GetPostList)
// // 获取用户动态列表
// looseApi.GET("/user/posts", api.GetUserPosts)
// // 获取用户基本信息
// looseApi.GET("/user/profile", api.GetUserProfile)
// }
type WebLoose struct { type WebLoose struct {
Chain Chain `mir:"-"` Chain Chain `mir:"-"`
Group Group `mir:"v1"` Group Group `mir:"v1"`
// Timeline 获取广场流 // Timeline 获取广场流
Timeline func(Get, web.TimelineReq) web.TimelineResp `mir:"/Posts"` Timeline func(Get, web.TimelineReq) web.TimelineResp `mir:"/posts"`
// GetUserTweets 获取用户动态列表 // GetUserTweets 获取用户动态列表
GetUserTweets func(Get) `mir:"/user/posts"` GetUserTweets func(Get) `mir:"/user/posts"`
// GetUserProfile 获取用户基本信息 // GetUserProfile 获取用户基本信息
GetUserProfile func(Get) `mir:"/user/profile"` GetUserProfile func(Get) `mir:"/user/profile"`
} }

@ -10,78 +10,49 @@ func init() {
AddEntry(new(WebPriv)) AddEntry(new(WebPriv))
} }
// // 上传资源
// privApi.POST("/attachment", api.UploadAttachment)
// // 下载资源预检
// privApi.GET("/attachment/precheck", api.DownloadAttachmentPrecheck)
// // 下载资源
// privApi.GET("/attachment", api.DownloadAttachment)
// // 发布动态
// privApi.POST("/post", api.CreatePost)
// // 删除动态
// privApi.DELETE("/post", api.DeletePost)
// // 动态点赞操作
// privApi.POST("/post/star", api.PostStar)
// // 动态收藏操作
// privApi.POST("/post/collection", api.PostCollection)
// // 锁定动态
// privApi.POST("/post/lock", api.LockPost)
// // 置顶动态
// privApi.POST("/post/stick", api.StickPost)
// // 修改动态可见度
// privApi.POST("/post/visibility", api.VisiblePost)
// // 发布动态评论
// privApi.POST("/post/comment", api.CreatePostComment)
// // 删除动态评论
// privApi.DELETE("/post/comment", api.DeletePostComment)
// // 发布评论回复
// privApi.POST("/post/comment/reply", api.CreatePostCommentReply)
// // 删除评论回复
// privApi.DELETE("/post/comment/reply", api.DeletePostCommentReply)
type WebPriv struct { type WebPriv struct {
Chain Chain `mir:"-"` Chain Chain `mir:"-"`
Group Group `mir:"v1"` Group Group `mir:"v1"`
// UploadAttachment 上传资源 // UploadAttachment 上传资源
UploadAttachment func(Post) `mir:"/attachment"` UploadAttachment func(Post) `mir:"/attachment"`
// DownloadAttachmentPrecheck 下载资源预检 // DownloadAttachmentPrecheck 下载资源预检
DownloadAttachmentPrecheck func(Get) `mir:"/attachment/precheck"` DownloadAttachmentPrecheck func(Get) `mir:"/attachment/precheck"`
// DownloadAttachment 下载资源 // DownloadAttachment 下载资源
DownloadAttachment func(Get) `mir:"/attachment"` DownloadAttachment func(Get) `mir:"/attachment"`
// CreateTweet 发布动态 // CreateTweet 发布动态
CreateTweet func(Post, web.CreateTweetReq)web.CreateTweetResp `mir:"/post"` CreateTweet func(Post, web.CreateTweetReq) web.CreateTweetResp `mir:"/post"`
// DeleteTweet 删除动态 // DeleteTweet 删除动态
DeleteTweet func(Delete) `mir:"/post"` DeleteTweet func(Delete) `mir:"/post"`
// StarTweet 动态点赞操作 // StarTweet 动态点赞操作
StarTweet func(Post) `mir:"/post/start"` StarTweet func(Post) `mir:"/post/start"`
// CollectionTweet 动态收藏操作 // CollectionTweet 动态收藏操作
CollectionTweet func(Post) `mir:"/post/collection"` CollectionTweet func(Post) `mir:"/post/collection"`
// LockTweet 锁定动态 // LockTweet 锁定动态
LockTweet func(Post) `mir:"/post/lock"` LockTweet func(Post) `mir:"/post/lock"`
// StickTweet 置顶动态 // StickTweet 置顶动态
StickTweet func(Post) `mir:"/post/stick"` StickTweet func(Post) `mir:"/post/stick"`
// VisiblePost 修改动态可见度 // VisiblePost 修改动态可见度
VisiblePost func(Post) `mir:"/post/visibility"` VisiblePost func(Post) `mir:"/post/visibility"`
// CreateTweetComment 发布动态评论 // CreateTweetComment 发布动态评论
CreateComment func(Post) `mir:"/post/comment"` CreateComment func(Post) `mir:"/post/comment"`
// DeletePostComment 删除动态评论 // DeletePostComment 删除动态评论
DeleteComment func(Delete) `mir:"/post/comment"` DeleteComment func(Delete) `mir:"/post/comment"`
// CreateCommentReply 发布评论回复 // CreateCommentReply 发布评论回复
CreateCommentReply func(Post) `mir:"/post/comment/reply"` CreateCommentReply func(Post) `mir:"/post/comment/reply"`
// DeleteCommentReply 删除评论回复 // DeleteCommentReply 删除评论回复
DeleteCommentReply func(Delete) `mir:"/post/comment/reply"` DeleteCommentReply func(Delete) `mir:"/post/comment/reply"`
} }

@ -10,54 +10,30 @@ func init() {
AddEntry(new(WebPub)) AddEntry(new(WebPub))
} }
// // v1 group api
// r := e.Group("/v1")
// // 获取version
// r.GET("/", api.Version)
// // 用户登录
// r.POST("/auth/login", api.Login)
// // 用户注册
// r.POST("/auth/register", api.Register)
// // 获取验证码
// r.GET("/captcha", api.GetCaptcha)
// // 发送验证码
// r.POST("/captcha", api.PostCaptcha)
// // 无鉴权路由组
// noAuthApi := r.Group("/")
// {
// // 获取动态详情
// noAuthApi.GET("/post", api.GetPost)
// // 获取动态评论
// noAuthApi.GET("/post/comments", api.GetPostComments)
// // 获取话题列表
// noAuthApi.GET("/tags", api.GetPostTags)
// }
type WebPub struct { type WebPub struct {
Group Group `mir:"v1"` Group Group `mir:"v1"`
// Version 获取后台版本信息 // Version 获取后台版本信息
Version func(Get) `mir:"/"` Version func(Get) `mir:"/"`
// Login 用户登录 // Login 用户登录
Login func(Post) `mir:"/auth/login"` Login func(Post) `mir:"/auth/login"`
// Register 用户注册 // Register 用户注册
Register func(Post) `mir:"/auth/register"` Register func(Post) `mir:"/auth/register"`
// GetCaptcha 获取验证码 // GetCaptcha 获取验证码
GetCaptcha func(Get) `mir:"/captcha"` GetCaptcha func(Get) `mir:"/captcha"`
// PostCaptcha 发送验证码 // PostCaptcha 发送验证码
SendCaptcha func(Post) `mir:"/captcha"` SendCaptcha func(Post) `mir:"/captcha"`
// TweetDetail 获取动态详情 // TweetDetail 获取动态详情
TweetDetail func(Get, web.TweetDetailReq) web.TweetDetailResp `mir:"/post"` TweetDetail func(Get, web.TweetDetailReq) web.TweetDetailResp `mir:"/post"`
// TweetComments 获取动态评论 // TweetComments 获取动态评论
TweetComments func(Get) `mir:"/post/comments"` TweetComments func(Get) `mir:"/post/comments"`
// TopicList 获取话题列表 // TopicList 获取话题列表
TopicList func(Get) `mir:"/tags"` TopicList func(Get) `mir:"/tags"`
} }

Loading…
Cancel
Save