一些框架优化
This commit is contained in:
@@ -2,7 +2,9 @@ package game
|
||||
|
||||
import (
|
||||
"common/remark"
|
||||
"common/resultStatus"
|
||||
"common/webServer"
|
||||
"logincenter/internal/user"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -12,7 +14,7 @@ func init() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
moduleName := "UserApi"
|
||||
moduleName := "GameApi"
|
||||
desc := "用户接口"
|
||||
author := "tangping"
|
||||
mendor := ""
|
||||
@@ -23,3 +25,45 @@ func init() {
|
||||
// GameApi 游戏接口
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user