Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-user
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenweijian
hilo-user
Commits
31f49f15
Commit
31f49f15
authored
May 26, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:cp 空间
parent
3c6346df
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
304 additions
and
0 deletions
+304
-0
grade.go
_const/enum/cp_e/grade.go
+72
-0
space.go
cv/cp_cv/space.go
+126
-0
user.go
cv/user_cv/user.go
+29
-0
go.mod
go.mod
+1
-0
go.sum
go.sum
+2
-0
space.go
route/cp_r/space.go
+68
-0
router.go
route/router.go
+6
-0
No files found.
_const/enum/cp_e/grade.go
0 → 100644
View file @
31f49f15
package
cp_e
import
"git.hilo.cn/hilo-common/resource/mysql"
type
CpGrade
int
const
(
CpGrade0
CpGrade
=
0
// 无称号
CpGrade1
CpGrade
=
1
// 恋爱CP
CpGrade2
CpGrade
=
2
// 甜蜜CP
CpGrade3
CpGrade
=
3
// 忠诚CP
CpGrade4
CpGrade
=
4
// 炽热CP
CpGrade5
CpGrade
=
5
// 荣耀CP
CpGradeMax
=
CpGrade5
)
var
(
// cp等级
CpGradeExp
=
map
[
CpGrade
]
mysql
.
Num
{
CpGrade0
:
0
,
CpGrade1
:
200000
,
CpGrade2
:
800000
,
CpGrade3
:
1000000
,
CpGrade4
:
3000000
,
CpGrade5
:
10000000
,
}
// cp特权名称 // todo 翻译
CpPrivilegeNameMsgId
=
map
[
CpPrivilege
]
uint
{
CpPrivilegeSpace
:
0
,
CpPrivilegeBanner
:
0
,
CpPrivilegeMedal
:
0
,
CpPrivilegeCert
:
0
,
CpPrivilegeRoomEffect
:
0
,
CpPrivilegeHeadwear
:
0
,
CpPrivilegeActiveProfile
:
0
,
CpPrivilegeMicEffect
:
0
,
}
// cp等级icon // todo ui
CpGradeIcon
=
map
[
CpGrade
]
string
{
CpGrade0
:
"icon0.png"
,
CpGrade1
:
"icon1.png"
,
CpGrade2
:
"icon2.png"
,
CpGrade3
:
"icon3.png"
,
CpGrade4
:
"icon4.png"
,
CpGrade5
:
"icon5.png"
,
}
// cp特权icon // todo ui
CpPrivilegeIcon
=
map
[
CpPrivilege
]
string
{
CpPrivilegeSpace
:
"icon_p_1.png"
,
CpPrivilegeBanner
:
"icon_p_2.png"
,
CpPrivilegeMedal
:
"icon_p_3.png"
,
CpPrivilegeCert
:
"icon_p_4.png"
,
CpPrivilegeRoomEffect
:
"icon_p_5.png"
,
CpPrivilegeHeadwear
:
"icon_p_6.png"
,
CpPrivilegeActiveProfile
:
"icon_p_7.png"
,
CpPrivilegeMicEffect
:
"icon_p_8.png"
,
}
)
type
CpPrivilege
int
const
(
CpPrivilegeSpace
CpPrivilege
=
1
// 空间
CpPrivilegeBanner
CpPrivilege
=
2
// 横幅
CpPrivilegeMedal
CpPrivilege
=
3
// 等级勋章
CpPrivilegeCert
CpPrivilege
=
4
// 证书
CpPrivilegeRoomEffect
CpPrivilege
=
5
// 进场特效
CpPrivilegeHeadwear
CpPrivilege
=
6
// 头像头饰
CpPrivilegeActiveProfile
CpPrivilege
=
7
// 动态资料卡
CpPrivilegeMicEffect
CpPrivilege
=
8
// 麦位特效
)
cv/cp_cv/space.go
0 → 100644
View file @
31f49f15
package
cp_cv
import
(
"fmt"
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/bluele/gcache"
"hilo-user/_const/enum/cp_e"
"hilo-user/cv/user_cv"
"hilo-user/domain/model/res_m"
"time"
)
// cp信息
type
CvCpInfo
struct
{
UserInfo
user_cv
.
UserTiny
`json:"userInfo"`
// 用户信息
CpUserInfo
user_cv
.
UserTiny
`json:"cpUserInfo"`
// cp用户信息
CpDays
int
`json:"cpDays"`
// cp天数
VisitTimes
int
`json:"visitTimes"`
// 空间访问量
}
// cp等级
type
CvCpGrade
struct
{
Grade
cp_e
.
CpGrade
`json:"grade"`
// 等级 0:无称号 1:恋爱CP 2:甜蜜CP 3:忠诚CP 4:炽热CP 5:荣耀CP
Exp
uint32
`json:"exp"`
// 经验值
NextExp
uint32
`json:"nextExp,omitempty"`
// 下个等级所需经验值
RemainExp
uint32
`json:"remainExp,omitempty"`
// 还需要多少经验值到下一个级别
ExpireAt
string
`json:"expireAt,omitempty"`
// 有效期
}
// 资源等级
type
CvResGrade
struct
{
Grade
cp_e
.
CpGrade
`json:"grade"`
// 等级
Icon
string
`json:"icon"`
// 等级icon图
}
// 特权信息
type
CvPrivilege
struct
{
Type
cp_e
.
CpPrivilege
`json:"type"`
// 特权id 1:空间 2:横幅 3:等级勋章 4:证书 5:进场特效 6:头像头饰 7:动态资料卡 8:麦位特效
NameMsgId
uint
`json:"-"`
// 名称-翻译id
Name
string
`json:"name"`
// 名称
Icon
string
`json:"icon"`
// 图标
}
// cp空间页
type
CvSpace
struct
{
CpInfo
CvCpInfo
`json:"cpInfo"`
// cp信息
CpGrade
CvCpGrade
`json:"cpGrade"`
// cp等级
ResGradeList
[]
CvResGrade
`json:"resGradeList"`
// 资源等级列表,无称号/恋爱CP/甜蜜CP/忠诚CP/炽热CP/荣耀CP
PrivilegeList
[]
CvPrivilege
`json:"privilegeList"`
// 等级特权
}
var
CvResGradeList
=
[]
CvResGrade
{
{
cp_e
.
CpGrade0
,
cp_e
.
CpGradeIcon
[
cp_e
.
CpGrade0
]},
{
cp_e
.
CpGrade1
,
cp_e
.
CpGradeIcon
[
cp_e
.
CpGrade1
]},
{
cp_e
.
CpGrade2
,
cp_e
.
CpGradeIcon
[
cp_e
.
CpGrade2
]},
{
cp_e
.
CpGrade3
,
cp_e
.
CpGradeIcon
[
cp_e
.
CpGrade3
]},
{
cp_e
.
CpGrade4
,
cp_e
.
CpGradeIcon
[
cp_e
.
CpGrade4
]},
{
cp_e
.
CpGrade5
,
cp_e
.
CpGradeIcon
[
cp_e
.
CpGrade5
]},
}
var
CpGradePrivilegeList
=
map
[
cp_e
.
CpGrade
][]
CvPrivilege
{
cp_e
.
CpGrade0
:
{},
cp_e
.
CpGrade1
:
{
{
cp_e
.
CpPrivilegeSpace
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeSpace
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeSpace
]},
{
cp_e
.
CpPrivilegeBanner
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeBanner
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeBanner
]},
{
cp_e
.
CpPrivilegeMedal
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeMedal
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeMedal
]},
{
cp_e
.
CpPrivilegeCert
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeCert
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeCert
]},
},
cp_e
.
CpGrade2
:
{
{
cp_e
.
CpPrivilegeSpace
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeSpace
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeSpace
]},
{
cp_e
.
CpPrivilegeBanner
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeBanner
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeBanner
]},
{
cp_e
.
CpPrivilegeMedal
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeMedal
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeMedal
]},
{
cp_e
.
CpPrivilegeCert
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeCert
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeCert
]},
{
cp_e
.
CpPrivilegeRoomEffect
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeRoomEffect
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeRoomEffect
]},
},
cp_e
.
CpGrade3
:
{
{
cp_e
.
CpPrivilegeSpace
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeSpace
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeSpace
]},
{
cp_e
.
CpPrivilegeBanner
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeBanner
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeBanner
]},
{
cp_e
.
CpPrivilegeMedal
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeMedal
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeMedal
]},
{
cp_e
.
CpPrivilegeCert
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeCert
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeCert
]},
{
cp_e
.
CpPrivilegeRoomEffect
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeRoomEffect
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeRoomEffect
]},
{
cp_e
.
CpPrivilegeHeadwear
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeHeadwear
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeHeadwear
]},
},
cp_e
.
CpGrade4
:
{
{
cp_e
.
CpPrivilegeSpace
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeSpace
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeSpace
]},
{
cp_e
.
CpPrivilegeBanner
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeBanner
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeBanner
]},
{
cp_e
.
CpPrivilegeMedal
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeMedal
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeMedal
]},
{
cp_e
.
CpPrivilegeCert
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeCert
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeCert
]},
{
cp_e
.
CpPrivilegeRoomEffect
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeRoomEffect
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeRoomEffect
]},
{
cp_e
.
CpPrivilegeHeadwear
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeHeadwear
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeHeadwear
]},
{
cp_e
.
CpPrivilegeActiveProfile
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeActiveProfile
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeActiveProfile
]},
},
cp_e
.
CpGrade5
:
{
{
cp_e
.
CpPrivilegeSpace
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeSpace
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeSpace
]},
{
cp_e
.
CpPrivilegeBanner
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeBanner
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeBanner
]},
{
cp_e
.
CpPrivilegeMedal
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeMedal
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeMedal
]},
{
cp_e
.
CpPrivilegeCert
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeCert
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeCert
]},
{
cp_e
.
CpPrivilegeRoomEffect
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeRoomEffect
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeRoomEffect
]},
{
cp_e
.
CpPrivilegeHeadwear
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeHeadwear
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeHeadwear
]},
{
cp_e
.
CpPrivilegeActiveProfile
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeActiveProfile
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeActiveProfile
]},
{
cp_e
.
CpPrivilegeMicEffect
,
cp_e
.
CpPrivilegeNameMsgId
[
cp_e
.
CpPrivilegeMicEffect
],
""
,
cp_e
.
CpPrivilegeIcon
[
cp_e
.
CpPrivilegeMicEffect
]},
},
}
func
CopyCpGradePrivilegeList
(
grade
cp_e
.
CpGrade
,
lang
string
)
[]
CvPrivilege
{
privileges
:=
make
([]
CvPrivilege
,
len
(
CpGradePrivilegeList
[
grade
]))
copy
(
privileges
,
CpGradePrivilegeList
[
grade
])
for
i
,
v
:=
range
privileges
{
privileges
[
i
]
.
Name
=
GetTranslate
(
v
.
NameMsgId
,
lang
)
}
return
privileges
}
var
translateCache
=
gcache
.
New
(
1000
)
.
LRU
()
.
Build
()
func
GetTranslate
(
msgId
uint
,
lang
string
)
string
{
key
:=
fmt
.
Sprintf
(
"%v-%v"
,
msgId
,
lang
)
if
data
,
err
:=
translateCache
.
Get
(
key
);
err
==
nil
{
return
data
.
(
string
)
}
if
resMul
,
_
:=
res_m
.
GetResMultiTextBy
(
mysql
.
Db
,
msgId
,
lang
);
resMul
!=
nil
{
_
=
translateCache
.
SetWithExpire
(
key
,
resMul
.
Content
,
time
.
Hour
)
return
resMul
.
Content
}
return
"default"
}
cv/user_cv/user.go
0 → 100644
View file @
31f49f15
package
user_cv
import
"hilo-user/domain/model/user_m"
type
UserTiny
struct
{
Id
uint64
`json:"id,omitempty"`
ExternalId
string
`json:"externalId"`
Avatar
string
`json:"avatar"`
Nick
string
`json:"nick"`
Sex
uint8
`json:"sex"`
Code
string
`json:"code"`
Country
string
`json:"country"`
CountryIcon
string
`json:"countryIcon"`
IsPrettyCode
bool
`json:"isPrettyCode"`
// 是否靓号
}
func
UserToTiny
(
user
user_m
.
User
)
UserTiny
{
return
UserTiny
{
Id
:
user
.
ID
,
ExternalId
:
user
.
ExternalId
,
Avatar
:
user
.
Avatar
,
Nick
:
user
.
Nick
,
Sex
:
user
.
Sex
,
Code
:
user
.
Code
,
Country
:
user
.
Country
,
CountryIcon
:
user
.
CountryIcon
,
IsPrettyCode
:
user
.
IsPrettyCode
(),
}
}
go.mod
View file @
31f49f15
...
...
@@ -25,6 +25,7 @@ require (
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1274 // indirect
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/bluele/gcache v0.0.2 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fatih/color v1.9.0 // indirect
...
...
go.sum
View file @
31f49f15
...
...
@@ -16,6 +16,8 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw=
github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
...
...
route/cp_r/space.go
0 → 100644
View file @
31f49f15
package
cp_r
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/gin-gonic/gin"
"hilo-user/_const/enum/cp_e"
"hilo-user/cv/cp_cv"
"hilo-user/cv/user_cv"
"hilo-user/domain/model/user_m"
"hilo-user/myerr/bizerr"
"hilo-user/req"
"hilo-user/resp"
)
// @Tags CP v2
// @Summary cp空间
// @Param token header string true "token"
// @Param nonce header string true "随机数字"
// @Param externalId query string true "查看用户的externalId"
// @Success 200 {object} cp_cv.CvSpace
// @Router /v2/cp/space [get]
func
CpSpace
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
lang
,
err
:=
req
.
GetUserIdLang
(
c
,
myContext
)
if
err
!=
nil
{
return
myContext
,
err
}
externalId
:=
c
.
Query
(
"externalId"
)
if
len
(
externalId
)
<=
0
{
return
myContext
,
bizerr
.
InvalidParameter
}
var
model
=
domain
.
CreateModelContext
(
myContext
)
userInfo
,
err
:=
user_m
.
GetUser
(
model
,
userId
)
if
err
!=
nil
{
return
myContext
,
err
}
cpUserInfo
,
err
:=
user_m
.
GetUserByExtId
(
model
,
externalId
)
// todo get from cp2 db
if
err
!=
nil
{
return
myContext
,
err
}
expireAt
:=
""
// todo
cpGrade
:=
cp_e
.
CpGrade3
// todo get from db
nextExp
:=
cp_e
.
CpGradeExp
[
cp_e
.
CpGradeMax
]
remainExp
:=
mysql
.
Num
(
0
)
if
cpGrade
!=
cp_e
.
CpGradeMax
{
nextExp
=
cp_e
.
CpGradeExp
[
cpGrade
+
1
]
remainExp
=
nextExp
-
cp_e
.
CpGradeExp
[
cpGrade
]
// todo get from db
}
response
:=
cp_cv
.
CvSpace
{
CpInfo
:
cp_cv
.
CvCpInfo
{
UserInfo
:
user_cv
.
UserToTiny
(
*
userInfo
),
CpUserInfo
:
user_cv
.
UserToTiny
(
*
cpUserInfo
),
},
CpGrade
:
cp_cv
.
CvCpGrade
{
Grade
:
cpGrade
,
Exp
:
cp_e
.
CpGradeExp
[
cpGrade
],
// todo get from db
NextExp
:
nextExp
,
RemainExp
:
remainExp
,
ExpireAt
:
expireAt
,
},
ResGradeList
:
cp_cv
.
CvResGradeList
,
PrivilegeList
:
cp_cv
.
CopyCpGradePrivilegeList
(
cpGrade
,
lang
),
}
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}
route/router.go
View file @
31f49f15
...
...
@@ -11,6 +11,7 @@ import (
_
"hilo-user/docs"
"hilo-user/domain/model/msg_m"
"hilo-user/resp"
"hilo-user/route/cp_r"
"hilo-user/route/user_r"
)
...
...
@@ -22,11 +23,16 @@ func InitRouter() *gin.Engine {
needLogin
:=
r
.
Group
(
""
)
needLogin
.
Use
(
ExceptionHandle
,
LoggerHandle
,
JWTApiHandle
)
v1
:=
needLogin
.
Group
(
"/v1"
)
v2
:=
needLogin
.
Group
(
"/v2"
)
user
:=
v1
.
Group
(
"/user"
)
{
user
.
GET
(
"/nameplate"
,
wrapper
(
user_r
.
UserNameplate
))
user
.
GET
(
"/bag/:resType"
,
wrapper
(
user_r
.
UserBag
))
}
cp
:=
v2
.
Group
(
"/cp"
)
{
cp
.
GET
(
"/space"
,
wrapper
(
cp_r
.
CpSpace
))
}
inner
:=
r
.
Group
(
"/inner"
)
inner
.
Use
(
ExceptionHandle
,
LoggerHandle
)
innerUser
:=
inner
.
Group
(
"/user"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment