frendship: fixed route register error

pull/192/head
Michael Li 2 years ago
parent a269ad87a7
commit 09949295e8

@ -332,6 +332,9 @@ release/paopao-ce --no-default-features --features sqlite3,localoss,loggerfile,r
`LoggerFile` 使用文件写日志(目前状态: 稳定); `LoggerFile` 使用文件写日志(目前状态: 稳定);
`LoggerZinc` 使用[Zinc](https://github.com/zinclabs/zinc)写日志(目前状态: 稳定,推荐使用); `LoggerZinc` 使用[Zinc](https://github.com/zinclabs/zinc)写日志(目前状态: 稳定,推荐使用);
`LoggerMeili` 使用[Meilisearch](https://github.com/meilisearch/meilisearch)写日志(目前状态: 内测阶段); `LoggerMeili` 使用[Meilisearch](https://github.com/meilisearch/meilisearch)写日志(目前状态: 内测阶段);
* 用户关系模式: Friendship/Followship
`Friendship` 弱关系好友模式,类似微信朋友圈(目前状态: 开发阶段);
`Followship` 关注者模式类似Twitter的Follow模式(目前状态: WIP);
* 支付: Alipay * 支付: Alipay
`Alipay` 开启基于[支付宝开放平台](https://open.alipay.com/)的钱包功能; `Alipay` 开启基于[支付宝开放平台](https://open.alipay.com/)的钱包功能;
* 短信验证码: SmsJuhe(需要开启sms) * 短信验证码: SmsJuhe(需要开启sms)

@ -11,7 +11,7 @@ Server: # 服务设置
ReadTimeout: 60 ReadTimeout: 60
WriteTimeout: 60 WriteTimeout: 60
Features: Features:
Default: ["Base", "MySQL", "Option", "Zinc", "LocalOSS", "LoggerFile"] Default: ["Base", "MySQL", "Option", "Zinc", "LocalOSS", "LoggerFile", "Friendship"]
Develop: ["Base", "MySQL", "BigCacheIndex", "Meili", "Sms", "AliOSS", "LoggerMeili", "OSS:Retention"] Develop: ["Base", "MySQL", "BigCacheIndex", "Meili", "Sms", "AliOSS", "LoggerMeili", "OSS:Retention"]
Demo: ["Base", "MySQL", "Option", "Zinc", "Sms", "MinIO", "LoggerZinc", "Migration"] Demo: ["Base", "MySQL", "Option", "Zinc", "Sms", "MinIO", "LoggerZinc", "Migration"]
Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile", "OSS:TempDir"] Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile", "OSS:TempDir"]

@ -84,10 +84,10 @@ func NewRouter() *gin.Engine {
routeCore(authApi, privApi, adminApi) routeCore(authApi, privApi, adminApi)
// 支付宝路由注册 // 支付宝路由注册
routeFriendship(authApi) routeAlipay(r, authApi)
// Friendship路由注册 // Relationship相关路由注册
routeFriendship(authApi) routeRelationship(authApi)
// 默认404 // 默认404
e.NoRoute(func(c *gin.Context) { e.NoRoute(func(c *gin.Context) {
@ -237,12 +237,22 @@ func routeAlipay(public gin.IRoutes, authApi gin.IRoutes) {
authApi.GET("/user/wallet/bills", api.GetUserWalletBills) authApi.GET("/user/wallet/bills", api.GetUserWalletBills)
} }
// routeFriendship register Friendship feature releated route if needed // routeRelationship register Relationship releated routes
func routeFriendship(authApi gin.IRoutes) { func routeRelationship(authApi gin.IRoutes) {
if !conf.CfgIf("Friendship") { if conf.CfgIf("Friendship") {
return routeFriendship(authApi)
} else if conf.CfgIf("Followship") {
routeFollowship(authApi)
} else {
// 暂时默认使用好友模式
// TODO: 后期提供一种无关系模式(既不是好友模式也不是关注者模式)作为默认的关系模式
routeFriendship(authApi)
} }
}
// routeFriendship register Friendship feature releated routes
func routeFriendship(authApi gin.IRoutes) {
// 请求添加朋友 // 请求添加朋友
authApi.POST("/friend/requesting", api.RequestingFriend) authApi.POST("/friend/requesting", api.RequestingFriend)
@ -258,3 +268,8 @@ func routeFriendship(authApi gin.IRoutes) {
// 获取好友列表 // 获取好友列表
authApi.GET("/user/contacts", api.GetContacts) authApi.GET("/user/contacts", api.GetContacts)
} }
// routeFollowship register Followship feature releated routes
func routeFollowship(authApi gin.IRoutes) {
// TODO: register followship routes
}

Loading…
Cancel
Save