一些框架优化
This commit is contained in:
@@ -33,6 +33,7 @@ type AdminApi struct {
|
||||
func init() {
|
||||
moduleName := "AdminApi"
|
||||
methodName := "Add"
|
||||
skipVerifyTokenPage := true
|
||||
methodDesc := "添加管理员用户"
|
||||
methodAuthor := "tangping"
|
||||
methodMendor := ""
|
||||
@@ -47,7 +48,7 @@ func init() {
|
||||
"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) {
|
||||
responseObj = webServer.GetInitResponseObj()
|
||||
@@ -86,6 +87,7 @@ func (a *AdminApi) Add(account string, name string, password string, sex int32,
|
||||
func init() {
|
||||
moduleName := "AdminApi"
|
||||
methodName := "Get"
|
||||
skipVerifyTokenPage := false
|
||||
methodDesc := "获取管理员用户"
|
||||
methodAuthor := "tangping"
|
||||
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()
|
||||
|
||||
//获取当前登录用户信息
|
||||
|
||||
//验证参数
|
||||
if adminId == 0 {
|
||||
responseObj.SetResultStatus(resultStatus.APIDataError)
|
||||
@@ -145,6 +149,7 @@ func (a *AdminApi) Get(adminId int64) (responseObj *webServer.ResponseObject) {
|
||||
func init() {
|
||||
moduleName := "AdminApi"
|
||||
methodName := "Login"
|
||||
skipVerifyTokenPage := true
|
||||
methodDesc := "管理员登录"
|
||||
methodAuthor := "tangping"
|
||||
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) {
|
||||
@@ -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
|
||||
resultMap := make(map[string]any)
|
||||
|
||||
@@ -35,6 +35,9 @@ func main() {
|
||||
// 目前函数的实现为空,需要根据实际的配置加载逻辑进行填充。
|
||||
func loadConfig() {
|
||||
|
||||
//设置数据类型
|
||||
connection.SetModelDB(connection.GetAdminDB())
|
||||
|
||||
//构建数据库
|
||||
connection.BuildDB()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user