一些框架优化
This commit is contained in:
parent
d562558a3e
commit
b107b88800
@ -6,6 +6,14 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="2037df1b-9ccc-4caa-9145-2d6722712612" name="更改" comment="">
|
<list default="true" id="2037df1b-9ccc-4caa-9145-2d6722712612" name="更改" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/admincenter/internal/admin/api.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/admincenter/internal/admin/api.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/admincenter/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/admincenter/main.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/common/remark/remarkMgr.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/common/remark/remarkMgr.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/common/webServer/reflect.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/common/webServer/reflect.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/common/webServer/serverMux.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/common/webServer/serverMux.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/common/webServer/tokenHandler.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/common/webServer/tokenHandler.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/usercenter/internal/game/api.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/usercenter/internal/game/api.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/center/usercenter/internal/user/api.go" beforeDir="false" afterPath="$PROJECT_DIR$/center/usercenter/internal/user/api.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -26,6 +34,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="HighlightingSettingsPerFile">
|
<component name="HighlightingSettingsPerFile">
|
||||||
<setting file="file://$USER_HOME$/go/pkg/mod/github.com/wechatpay-apiv3/wechatpay-go@v0.2.20/services/payments/jsapi/api_jsapi_request_payment.go" root0="SKIP_INSPECTION" />
|
<setting file="file://$USER_HOME$/go/pkg/mod/github.com/wechatpay-apiv3/wechatpay-go@v0.2.20/services/payments/jsapi/api_jsapi_request_payment.go" root0="SKIP_INSPECTION" />
|
||||||
|
<setting file="file://$USER_HOME$/go/pkg/mod/github.com/wechatpay-apiv3/wechatpay-go@v0.2.20/services/payments/native/models.go" root0="SKIP_INSPECTION" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
"associatedIndex": 3
|
"associatedIndex": 3
|
||||||
@ -53,7 +62,7 @@
|
|||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "go.sdk"
|
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||||
}
|
}
|
||||||
}</component>
|
}</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
@ -63,7 +72,7 @@
|
|||||||
<recent name="D:\workspace\e2023\goProject\trunk\center" />
|
<recent name="D:\workspace\e2023\goProject\trunk\center" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Go 构建.go build logincenter">
|
<component name="RunManager" selected="Go 构建.go build admincenter">
|
||||||
<configuration name="go build admincenter" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
<configuration name="go build admincenter" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
||||||
<module name="trunk" />
|
<module name="trunk" />
|
||||||
<working_directory value="$PROJECT_DIR$/center/admincenter" />
|
<working_directory value="$PROJECT_DIR$/center/admincenter" />
|
||||||
@ -119,8 +128,8 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="Go 构建.go build logincenter" />
|
|
||||||
<item itemvalue="Go 构建.go build admincenter" />
|
<item itemvalue="Go 构建.go build admincenter" />
|
||||||
|
<item itemvalue="Go 构建.go build logincenter" />
|
||||||
<item itemvalue="Docker.admincenter.redis: Compose 部署" />
|
<item itemvalue="Docker.admincenter.redis: Compose 部署" />
|
||||||
<item itemvalue="Docker.center/admincenter/Dockerfile builder" />
|
<item itemvalue="Docker.center/admincenter/Dockerfile builder" />
|
||||||
</list>
|
</list>
|
||||||
|
|||||||
@ -33,6 +33,7 @@ type AdminApi struct {
|
|||||||
func init() {
|
func init() {
|
||||||
moduleName := "AdminApi"
|
moduleName := "AdminApi"
|
||||||
methodName := "Add"
|
methodName := "Add"
|
||||||
|
skipVerifyTokenPage := true
|
||||||
methodDesc := "添加管理员用户"
|
methodDesc := "添加管理员用户"
|
||||||
methodAuthor := "tangping"
|
methodAuthor := "tangping"
|
||||||
methodMendor := ""
|
methodMendor := ""
|
||||||
@ -47,7 +48,7 @@ func init() {
|
|||||||
"id '类型:int'": "管理员id",
|
"id '类型:int'": "管理员id",
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam)
|
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam, skipVerifyTokenPage)
|
||||||
}
|
}
|
||||||
func (a *AdminApi) Add(account string, name string, password string, sex int32, birthday string, phone int64, email string, wechatGroup string, describe string) (responseObj *webServer.ResponseObject) {
|
func (a *AdminApi) Add(account string, name string, password string, sex int32, birthday string, phone int64, email string, wechatGroup string, describe string) (responseObj *webServer.ResponseObject) {
|
||||||
responseObj = webServer.GetInitResponseObj()
|
responseObj = webServer.GetInitResponseObj()
|
||||||
@ -86,6 +87,7 @@ func (a *AdminApi) Add(account string, name string, password string, sex int32,
|
|||||||
func init() {
|
func init() {
|
||||||
moduleName := "AdminApi"
|
moduleName := "AdminApi"
|
||||||
methodName := "Get"
|
methodName := "Get"
|
||||||
|
skipVerifyTokenPage := false
|
||||||
methodDesc := "获取管理员用户"
|
methodDesc := "获取管理员用户"
|
||||||
methodAuthor := "tangping"
|
methodAuthor := "tangping"
|
||||||
methodMendor := ""
|
methodMendor := ""
|
||||||
@ -108,12 +110,14 @@ func init() {
|
|||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam)
|
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam, skipVerifyTokenPage)
|
||||||
}
|
}
|
||||||
func (a *AdminApi) Get(adminId int64) (responseObj *webServer.ResponseObject) {
|
func (a *AdminApi) Get(useAdmin *Admin, adminId int64) (responseObj *webServer.ResponseObject) {
|
||||||
|
|
||||||
responseObj = webServer.GetInitResponseObj()
|
responseObj = webServer.GetInitResponseObj()
|
||||||
|
|
||||||
|
//获取当前登录用户信息
|
||||||
|
|
||||||
//验证参数
|
//验证参数
|
||||||
if adminId == 0 {
|
if adminId == 0 {
|
||||||
responseObj.SetResultStatus(resultStatus.APIDataError)
|
responseObj.SetResultStatus(resultStatus.APIDataError)
|
||||||
@ -145,6 +149,7 @@ func (a *AdminApi) Get(adminId int64) (responseObj *webServer.ResponseObject) {
|
|||||||
func init() {
|
func init() {
|
||||||
moduleName := "AdminApi"
|
moduleName := "AdminApi"
|
||||||
methodName := "Login"
|
methodName := "Login"
|
||||||
|
skipVerifyTokenPage := true
|
||||||
methodDesc := "管理员登录"
|
methodDesc := "管理员登录"
|
||||||
methodAuthor := "tangping"
|
methodAuthor := "tangping"
|
||||||
methodMendor := ""
|
methodMendor := ""
|
||||||
@ -160,7 +165,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam)
|
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam, skipVerifyTokenPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AdminApi) Login(account string, password string) (responseObj *webServer.ResponseObject) {
|
func (a *AdminApi) Login(account string, password string) (responseObj *webServer.ResponseObject) {
|
||||||
@ -187,7 +192,7 @@ func (a *AdminApi) Login(account string, password string) (responseObj *webServe
|
|||||||
}
|
}
|
||||||
|
|
||||||
//添加登录用户
|
//添加登录用户
|
||||||
webServer.AddLoginUserToken(token, &webServer.TokenInfo{Id: adminData.ID, Account: account})
|
webServer.AddLoginUserToken(token, &webServer.TokenInfo{Id: adminData.ID, Account: account, UserInfo: adminData})
|
||||||
|
|
||||||
//adminData映射成map
|
//adminData映射成map
|
||||||
resultMap := make(map[string]any)
|
resultMap := make(map[string]any)
|
||||||
|
|||||||
@ -35,6 +35,9 @@ func main() {
|
|||||||
// 目前函数的实现为空,需要根据实际的配置加载逻辑进行填充。
|
// 目前函数的实现为空,需要根据实际的配置加载逻辑进行填充。
|
||||||
func loadConfig() {
|
func loadConfig() {
|
||||||
|
|
||||||
|
//设置数据类型
|
||||||
|
connection.SetModelDB(connection.GetAdminDB())
|
||||||
|
|
||||||
//构建数据库
|
//构建数据库
|
||||||
connection.BuildDB()
|
connection.BuildDB()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package remark
|
package remark
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"common/webServer"
|
||||||
"goutil/logUtilPlus"
|
"goutil/logUtilPlus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ func RegisterModuleRemark(name, desc, author, mendor, date string) {
|
|||||||
// @outParam: 输出参数
|
// @outParam: 输出参数
|
||||||
//
|
//
|
||||||
// return:
|
// return:
|
||||||
func RegisterMethodRemark(moduleName, name, desc, author, mendor, date string, inParam []string, outParam string) {
|
func RegisterMethodRemark(moduleName, name, desc, author, mendor, date string, inParam []string, outParam string, skipVerifyTokenPage bool) {
|
||||||
var moduleRemark *ModuleRemark
|
var moduleRemark *ModuleRemark
|
||||||
var exists bool
|
var exists bool
|
||||||
for _, item := range remarksSlice {
|
for _, item := range remarksSlice {
|
||||||
@ -57,4 +58,9 @@ func RegisterMethodRemark(moduleName, name, desc, author, mendor, date string, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleRemark.MethodRemarkSlice = append(moduleRemark.MethodRemarkSlice, newMethodRemark(moduleName, name, desc, author, mendor, date, inParam, outParam))
|
moduleRemark.MethodRemarkSlice = append(moduleRemark.MethodRemarkSlice, newMethodRemark(moduleName, name, desc, author, mendor, date, inParam, outParam))
|
||||||
|
|
||||||
|
//跳过登录验证
|
||||||
|
if skipVerifyTokenPage {
|
||||||
|
webServer.AddSkipVerifyTokenPage(moduleName, name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -387,6 +387,11 @@ func CallFunction(requestObj *RequestObject) (responseObj *ResponseObject) {
|
|||||||
in[i] = reflect.ValueOf(param_uint8)
|
in[i] = reflect.ValueOf(param_uint8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case reflect.Pointer:
|
||||||
|
//if paramStruct, ok := paramItem.(struct{}); ok {
|
||||||
|
// in[i] = reflect.ValueOf(paramStruct)
|
||||||
|
//}
|
||||||
|
in[i] = reflect.ValueOf(paramItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,24 +91,28 @@ func (mux *selfDefineMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
params, err = context.RequestDataBySlice2ByJson()
|
||||||
|
if err != nil {
|
||||||
|
responseResult(w, responseObj.SetResultStatus(resultStatus.APIDataError))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//验证是否登录
|
//验证是否登录
|
||||||
if strs[0] != "AdminApi" || strs[1] != "Login" {
|
if !IsSkipVerifyTokenPage(strs[0], strs[1]) {
|
||||||
tokenStr := context.header.Get("token")
|
tokenStr := context.header.Get("token")
|
||||||
|
|
||||||
// token 转型成 int64
|
// token 转型成 int64
|
||||||
token := stringUtil.StringToInt64(tokenStr)
|
token := stringUtil.StringToInt64(tokenStr)
|
||||||
|
|
||||||
//是否存在
|
//是否存在
|
||||||
if !CheckToken(token) {
|
exist, tokenData := CheckToken(token)
|
||||||
|
if !exist {
|
||||||
responseResult(w, responseObj.SetResultStatus(resultStatus.NotLogin))
|
responseResult(w, responseObj.SetResultStatus(resultStatus.NotLogin))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
params, err = context.RequestDataBySlice2ByJson()
|
//添加登录用户到参数里的第一个
|
||||||
if err != nil {
|
params = append([]interface{}{tokenData.UserInfo}, params...)
|
||||||
responseResult(w, responseObj.SetResultStatus(resultStatus.APIDataError))
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resquestData := NewRequestObject(strs[0], strs[1], params)
|
resquestData := NewRequestObject(strs[0], strs[1], params)
|
||||||
|
|||||||
@ -11,6 +11,9 @@ var (
|
|||||||
|
|
||||||
//锁
|
//锁
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
|
|
||||||
|
//跳过验证token的页面
|
||||||
|
skipVerifyTokenPage = make(map[string]bool)
|
||||||
)
|
)
|
||||||
|
|
||||||
type TokenInfo struct {
|
type TokenInfo struct {
|
||||||
@ -20,6 +23,9 @@ type TokenInfo struct {
|
|||||||
//管理员账号
|
//管理员账号
|
||||||
Account string
|
Account string
|
||||||
|
|
||||||
|
//登录用户缓存
|
||||||
|
UserInfo any
|
||||||
|
|
||||||
//过期时间
|
//过期时间
|
||||||
ExpireTime time.Time
|
ExpireTime time.Time
|
||||||
}
|
}
|
||||||
@ -57,7 +63,7 @@ func AddLoginUserToken(token int64, tokenInfo *TokenInfo) {
|
|||||||
// 返回值:
|
// 返回值:
|
||||||
//
|
//
|
||||||
// bool: 表示令牌是否有效的布尔值,true表示有效,false表示无效
|
// bool: 表示令牌是否有效的布尔值,true表示有效,false表示无效
|
||||||
func CheckToken(token int64) bool {
|
func CheckToken(token int64) (bool, *TokenInfo) {
|
||||||
|
|
||||||
//添加锁防止并发
|
//添加锁防止并发
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
@ -70,7 +76,7 @@ func CheckToken(token int64) bool {
|
|||||||
tokenInfo, ok := loginUserMap[token]
|
tokenInfo, ok := loginUserMap[token]
|
||||||
if !ok {
|
if !ok {
|
||||||
// 如果没有找到对应的用户信息,则令牌无效
|
// 如果没有找到对应的用户信息,则令牌无效
|
||||||
return false
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取令牌过期时间
|
// 获取令牌过期时间
|
||||||
@ -82,11 +88,23 @@ func CheckToken(token int64) bool {
|
|||||||
//移除令牌
|
//移除令牌
|
||||||
delete(loginUserMap, token)
|
delete(loginUserMap, token)
|
||||||
|
|
||||||
return false
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果生效的话,则更新过期时间
|
//如果生效的话,则更新过期时间
|
||||||
tokenInfo.ExpireTime = now.Add(time.Hour * 24)
|
tokenInfo.ExpireTime = now.Add(time.Hour * 24)
|
||||||
|
|
||||||
return true
|
return true, tokenInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func AddSkipVerifyTokenPage(moduleName, methodName string) {
|
||||||
|
skipVerifyTokenPage[moduleName+"_"+methodName] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsSkipVerifyTokenPage(moduleName, methodName string) bool {
|
||||||
|
exist, ok := skipVerifyTokenPage[moduleName+"_"+methodName]
|
||||||
|
if !exist {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return ok
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,9 @@ package game
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"common/remark"
|
"common/remark"
|
||||||
|
"common/resultStatus"
|
||||||
"common/webServer"
|
"common/webServer"
|
||||||
|
"logincenter/internal/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -12,7 +14,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
moduleName := "UserApi"
|
moduleName := "GameApi"
|
||||||
desc := "用户接口"
|
desc := "用户接口"
|
||||||
author := "tangping"
|
author := "tangping"
|
||||||
mendor := ""
|
mendor := ""
|
||||||
@ -23,3 +25,45 @@ func init() {
|
|||||||
// GameApi 游戏接口
|
// GameApi 游戏接口
|
||||||
type GameApi struct {
|
type GameApi struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
moduleName := "GameApi"
|
||||||
|
methodName := "Add"
|
||||||
|
skipVerifyTokenPage := false
|
||||||
|
methodDesc := "添加游戏"
|
||||||
|
methodAuthor := "tangping"
|
||||||
|
methodMendor := ""
|
||||||
|
methodDate := "2024-12-25 15:55:00"
|
||||||
|
methodInParam := []string{"string 账号,int 游戏id"}
|
||||||
|
methodOutParam := `
|
||||||
|
{
|
||||||
|
"Code '类型:int'": "响应结果的状态值",
|
||||||
|
"Message '类型:string'": "响应结果的状态值所对应的描述信息",
|
||||||
|
"Data '类型:interface{}'": "响应结果的数据"
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}`
|
||||||
|
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam, skipVerifyTokenPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *GameApi) Add(userData *user.User, account string, gameId int64) (responseObj *webServer.ResponseObject) {
|
||||||
|
responseObj = webServer.GetInitResponseObj()
|
||||||
|
|
||||||
|
//用户登录用户数据
|
||||||
|
|
||||||
|
//参数验证
|
||||||
|
|
||||||
|
//添加游戏
|
||||||
|
game := &Game{
|
||||||
|
Account: account,
|
||||||
|
GameID: int64(gameId),
|
||||||
|
}
|
||||||
|
|
||||||
|
gameId, err := AddGame(userData, game)
|
||||||
|
if err != nil {
|
||||||
|
return responseObj.SetResultStatus(resultStatus.DataError)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ type UserApi struct {
|
|||||||
func init() {
|
func init() {
|
||||||
moduleName := "UserApi"
|
moduleName := "UserApi"
|
||||||
methodName := "Register"
|
methodName := "Register"
|
||||||
|
skipVerifyTokenPage := true
|
||||||
methodDesc := "注册用户"
|
methodDesc := "注册用户"
|
||||||
methodAuthor := "tangping"
|
methodAuthor := "tangping"
|
||||||
methodMendor := ""
|
methodMendor := ""
|
||||||
@ -47,7 +48,7 @@ func init() {
|
|||||||
"id '类型:int'": "用户id",
|
"id '类型:int'": "用户id",
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam)
|
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam, skipVerifyTokenPage)
|
||||||
}
|
}
|
||||||
func (a *UserApi) Register(account string, name string, password string, sex int32, birthday string, phone int64, email string, wechatGroup string, describe string) (responseObj *webServer.ResponseObject) {
|
func (a *UserApi) Register(account string, name string, password string, sex int32, birthday string, phone int64, email string, wechatGroup string, describe string) (responseObj *webServer.ResponseObject) {
|
||||||
responseObj = webServer.GetInitResponseObj()
|
responseObj = webServer.GetInitResponseObj()
|
||||||
@ -86,6 +87,7 @@ func (a *UserApi) Register(account string, name string, password string, sex int
|
|||||||
func init() {
|
func init() {
|
||||||
moduleName := "UserApi"
|
moduleName := "UserApi"
|
||||||
methodName := "Login"
|
methodName := "Login"
|
||||||
|
skipVerifyTokenPage := true
|
||||||
methodDesc := "用户登录"
|
methodDesc := "用户登录"
|
||||||
methodAuthor := "tangping"
|
methodAuthor := "tangping"
|
||||||
methodMendor := ""
|
methodMendor := ""
|
||||||
@ -101,7 +103,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam)
|
remark.RegisterMethodRemark(moduleName, methodName, methodDesc, methodAuthor, methodMendor, methodDate, methodInParam, methodOutParam, skipVerifyTokenPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *UserApi) Login(account string, password string) (responseObj *webServer.ResponseObject) {
|
func (a *UserApi) Login(account string, password string) (responseObj *webServer.ResponseObject) {
|
||||||
@ -128,7 +130,7 @@ func (a *UserApi) Login(account string, password string) (responseObj *webServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
//添加登录用户
|
//添加登录用户
|
||||||
webServer.AddLoginUserToken(token, &webServer.TokenInfo{Id: userData.ID, Account: account})
|
webServer.AddLoginUserToken(token, &webServer.TokenInfo{Id: userData.ID, Account: account, UserInfo: userData})
|
||||||
|
|
||||||
//UserData映射成map
|
//UserData映射成map
|
||||||
resultMap := make(map[string]any)
|
resultMap := make(map[string]any)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user