Преглед изворни кода

Revert "update 完善日志输出格式"

This reverts commit 11f8cf7462e8b1f4a47e9a5cc51fdeb871918b8f.
Alvin пре 8 месеци
родитељ
комит
0528902636

+ 18 - 18
game/game_cluster/nodes/webadmin/service/admin.go

@@ -57,7 +57,7 @@ func HashPassword(password string) (string, error) {
 func (a *Admin) Login(ctx *gin.Context, username string, password string) (*entity.AdminResp, *code.Result) {
 	user, err := a.QueryUserByUsername(ctx, username)
 	if err != nil {
-		mhayaLogger.Warnf("Login QueryUserByUsername error:%v", err)
+		mhayaLogger.Warnf("Login QueryUserByUsername error:", err)
 		if errors.Is(err, mongo.ErrNoDocuments) {
 			return nil, common.NewResult(code.AccountNotExistError)
 		}
@@ -77,7 +77,7 @@ func (a *Admin) Login(ctx *gin.Context, username string, password string) (*enti
 
 	token, err := mdb.RDB.Get(ctx, user.Username).Result()
 	if err != nil && err != redis.Nil {
-		mhayaLogger.Warnf("Login Get error:%v", err)
+		mhayaLogger.Warnf("Login Get error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -85,20 +85,20 @@ func (a *Admin) Login(ctx *gin.Context, username string, password string) (*enti
 		// 创建token
 		generateToken, err := user.GenerateToken()
 		if err != nil {
-			mhayaLogger.Warnf("Login GenerateToken error:%v", err)
+			mhayaLogger.Warnf("Login GenerateToken error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 
 		// 保存token 到 redis 中 过期时间为1天
 		err = mdb.RDB.Set(ctx, user.Username, generateToken, 24*time.Hour).Err()
 		if err != nil {
-			mhayaLogger.Warnf("Login Set error:%v", err)
+			mhayaLogger.Warnf("Login Set error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 
 		err = a.loginAuthSetRoleRedis(user.RoleId, generateToken)
 		if err != nil {
-			mhayaLogger.Warnf("Login loginAuthSetRoleRedis error:%v", err)
+			mhayaLogger.Warnf("Login loginAuthSetRoleRedis error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 
@@ -108,7 +108,7 @@ func (a *Admin) Login(ctx *gin.Context, username string, password string) (*enti
 	// 更新用户登录时间
 	_, err = mdb.MDB.Collection(a.GetDBName()).UpdateOne(ctx, bson.M{"username": username}, bson.M{"$set": bson.M{"last_login_time": time.Now().Unix()}})
 	if err != nil {
-		mhayaLogger.Warnf("Login UpdateOne last_login_time error:%v", err)
+		mhayaLogger.Warnf("Login UpdateOne last_login_time error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -116,7 +116,7 @@ func (a *Admin) Login(ctx *gin.Context, username string, password string) (*enti
 	ip := ctx.ClientIP()
 	_, err = mdb.MDB.Collection(a.GetDBName()).UpdateOne(ctx, bson.M{"username": username}, bson.M{"$set": bson.M{"last_login_ip": ip}})
 	if err != nil {
-		mhayaLogger.Warnf("Login UpdateOne ip error:%v", err)
+		mhayaLogger.Warnf("Login UpdateOne ip error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -238,7 +238,7 @@ func (a *Admin) ChangePassword(ctx context.Context, username string, password st
 	password, _ = HashPassword(password)
 	_, err := mdb.MDB.Collection(a.GetDBName()).UpdateOne(ctx, bson.M{"username": username}, bson.M{"$set": bson.M{"password": password}})
 	if err != nil {
-		mhayaLogger.Warnf("ChangePassword UpdateOne error:%v", err)
+		mhayaLogger.Warnf("ChangePassword UpdateOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -263,7 +263,7 @@ func (a *Admin) Add(ctx context.Context, username string, password string, realN
 			"updated_at": time.Now().Unix(),
 		})
 		if err != nil {
-			mhayaLogger.Warnf("Add InsertOne error:%v", err)
+			mhayaLogger.Warnf("Add InsertOne error:", err)
 			return common.NewResult(code.InternalError)
 		}
 
@@ -277,7 +277,7 @@ func (a *Admin) Add(ctx context.Context, username string, password string, realN
 func (a *Admin) Delete(ctx context.Context, username string) *code.Result {
 	_, err := mdb.MDB.Collection(a.GetDBName()).DeleteOne(ctx, bson.M{"username": username})
 	if err != nil {
-		mhayaLogger.Warnf("Delete DeleteOne error:%v", err)
+		mhayaLogger.Warnf("Delete DeleteOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -288,7 +288,7 @@ func (a *Admin) Delete(ctx context.Context, username string) *code.Result {
 func (a *Admin) UpdateStatus(ctx context.Context, username string, status int) *code.Result {
 	_, err := mdb.MDB.Collection(a.GetDBName()).UpdateOne(ctx, bson.M{"username": username}, bson.M{"$set": bson.M{"status": status}})
 	if err != nil {
-		mhayaLogger.Warnf("Delete UpdateOne error:%v", err)
+		mhayaLogger.Warnf("Delete UpdateOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -318,7 +318,7 @@ func (a *Admin) FindAll(ctx context.Context, req entity.AdminFindAllReq) (*entit
 	// 查询总数
 	count, err := mdb.MDB.Collection("admin").CountDocuments(ctx, filter)
 	if err != nil {
-		mhayaLogger.Warnf("FindAll CountDocuments error:%v", err)
+		mhayaLogger.Warnf("FindAll CountDocuments error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -330,7 +330,7 @@ func (a *Admin) FindAll(ctx context.Context, req entity.AdminFindAllReq) (*entit
 	// 执行查询
 	cursor, err := mdb.MDB.Collection("admin").Find(ctx, filter, findOptions)
 	if err != nil {
-		mhayaLogger.Warnf("FindAll Find error:%v", err)
+		mhayaLogger.Warnf("FindAll Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	defer func() {
@@ -345,14 +345,14 @@ func (a *Admin) FindAll(ctx context.Context, req entity.AdminFindAllReq) (*entit
 		var admin model.Admin
 		err := cursor.Decode(&admin)
 		if err != nil {
-			mhayaLogger.Warnf("FindAll Decode error:%v", err)
+			mhayaLogger.Warnf("FindAll Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		admins = append(admins, &admin)
 	}
 
 	if err := cursor.Err(); err != nil {
-		mhayaLogger.Warnf("FindAll cursor error:%v", err)
+		mhayaLogger.Warnf("FindAll cursor error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -396,7 +396,7 @@ func (a *Admin) GetServerStatus(ctx context.Context) ([]*models.PlayerServerLoad
 	// 执行查询
 	cursor, err := mdb.MDB.Collection(constant.CNameServerLoadStat).Find(ctx, bson.M{})
 	if err != nil {
-		mhayaLogger.Warnf("GetServerStatus Find error:%v", err)
+		mhayaLogger.Warnf("GetServerStatus Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -412,14 +412,14 @@ func (a *Admin) GetServerStatus(ctx context.Context) ([]*models.PlayerServerLoad
 		var admin models.PlayerServerLoadStat
 		err := cursor.Decode(&admin)
 		if err != nil {
-			mhayaLogger.Warnf("GetServerStatus Decode error:%v", err)
+			mhayaLogger.Warnf("GetServerStatus Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		admins = append(admins, &admin)
 	}
 
 	if err := cursor.Err(); err != nil {
-		mhayaLogger.Warnf("GetServerStatus cursor error:%v", err)
+		mhayaLogger.Warnf("GetServerStatus cursor error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 

+ 36 - 36
game/game_cluster/nodes/webadmin/service/role.go

@@ -49,20 +49,20 @@ func (r *Role) List(ctx context.Context, req entity.RoleListReq) (*entity.RoleRe
 	findOptions := options.Find().SetSkip(int64((req.Page - 1) * req.Size)).SetLimit(int64(req.Size))
 	countDocuments, err := rolesCollection.CountDocuments(ctx, filter)
 	if err != nil {
-		mhayaLogger.Warnf("List CountDocuments error:%v", err)
+		mhayaLogger.Warnf("List CountDocuments error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
 	// 防御性编程
 	tableName := roles.TableName()
 	if tableName == "" {
-		mhayaLogger.Warnf("List tableName is nil, tableName:%v", tableName)
+		mhayaLogger.Warnf("List tableName is nil, tableName:", tableName)
 		return nil, common.NewResult(code.InternalError)
 	}
 
 	cursor, err := rolesCollection.Find(ctx, filter, findOptions)
 	if err != nil {
-		mhayaLogger.Warnf("List Find error:%v", err)
+		mhayaLogger.Warnf("List Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	defer func() {
@@ -75,14 +75,14 @@ func (r *Role) List(ctx context.Context, req entity.RoleListReq) (*entity.RoleRe
 	for cursor.Next(ctx) {
 		var role *entity.RoleDetail
 		if err := cursor.Decode(&role); err != nil {
-			mhayaLogger.Warnf("List Decode error:%v", err)
+			mhayaLogger.Warnf("List Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		details = append(details, role)
 	}
 
 	if err := cursor.Err(); err != nil {
-		mhayaLogger.Warnf("List cursor error:%v", err)
+		mhayaLogger.Warnf("List cursor error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -101,7 +101,7 @@ func (r *Role) Add(ctx context.Context, req entity.RoleAddReq) *code.Result {
 
 	// 检查上下文是否有效
 	if ctx.Err() != nil {
-		mhayaLogger.Warnf("Add ctx error:%v", ctx.Err())
+		mhayaLogger.Warnf("Add ctx error:", ctx.Err())
 		return common.NewResult(code.InternalError)
 	}
 
@@ -116,7 +116,7 @@ func (r *Role) Add(ctx context.Context, req entity.RoleAddReq) *code.Result {
 	collection := mdb.MDB.Collection(roles.TableName())
 	_, insertErr := collection.InsertOne(ctx, req)
 	if insertErr != nil {
-		mhayaLogger.Warnf("Add InsertOne error:%v", insertErr)
+		mhayaLogger.Warnf("Add InsertOne error:", insertErr)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -128,7 +128,7 @@ func (r *Role) Update(ctx context.Context, req entity.RoleUpdateReq) *code.Resul
 	// 更新条件
 	objID, err := primitive.ObjectIDFromHex(req.Id)
 	if err != nil {
-		mhayaLogger.Warnf("Update req.Id error:%v", req.Id)
+		mhayaLogger.Warnf("Update req.Id error:", req.Id)
 		return common.NewResult(code.ParamError)
 	}
 
@@ -148,7 +148,7 @@ func (r *Role) Update(ctx context.Context, req entity.RoleUpdateReq) *code.Resul
 	// 执行更新操作
 	_, err = collection.UpdateOne(context.TODO(), updateCondition, updateContent, updateOptions)
 	if err != nil {
-		mhayaLogger.Warnf("Update UpdateOne error:%v", err)
+		mhayaLogger.Warnf("Update UpdateOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -187,7 +187,7 @@ func (r *Role) Del(ctx context.Context, req entity.RoleDelReq) *code.Result {
 	id, _ := primitive.ObjectIDFromHex(req.Id)
 	_, err := collection.DeleteOne(ctx, bson.M{"_id": id})
 	if err != nil {
-		mhayaLogger.Warnf("Del DeleteOne error:%v", err)
+		mhayaLogger.Warnf("Del DeleteOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -198,7 +198,7 @@ func (r *Role) Del(ctx context.Context, req entity.RoleDelReq) *code.Result {
 func (r *Role) AddRoleAccess(ctx context.Context, req entity.RoleAccessAddReq) *code.Result {
 	// 检查上下文是否有效
 	if ctx.Err() != nil {
-		mhayaLogger.Warnf("AddRoleAccess ctx error:%v", ctx.Err())
+		mhayaLogger.Warnf("AddRoleAccess ctx error:", ctx.Err())
 		return common.NewResult(code.InternalError)
 	}
 
@@ -231,7 +231,7 @@ func (r *Role) AddRoleAccess(ctx context.Context, req entity.RoleAccessAddReq) *
 	collection = mdb.MDB.Collection(roleAccess.TableName())
 	_, insertErr := collection.UpdateOne(ctx, bson.M{"role_id": req.RoleId}, bson.M{"$addToSet": bson.M{"access_id": bson.M{"$each": req.AccessId}}}, options.Update().SetUpsert(true))
 	if insertErr != nil {
-		mhayaLogger.Warnf("AddRoleAccess UpdateOne error:%v", insertErr)
+		mhayaLogger.Warnf("AddRoleAccess UpdateOne error:", insertErr)
 		return common.NewResult(code.InternalError)
 	}
 	return nil
@@ -242,14 +242,14 @@ func (r *Role) UpdateRoleAccess(ctx context.Context, req entity.RoleAccessUpdate
 	// 验证请求数据的有效性
 	err := validateConcurrently(ctx, req)
 	if err != nil {
-		mhayaLogger.Warnf("UpdateRoleAccess validateConcurrently error:%v", err)
+		mhayaLogger.Warnf("UpdateRoleAccess validateConcurrently error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
 	// 更新角色权限
 	err = r.updateAccessInDatabase(ctx, req)
 	if err != nil {
-		mhayaLogger.Warnf("UpdateRoleAccess updateAccessInDatabase error:%v", err)
+		mhayaLogger.Warnf("UpdateRoleAccess updateAccessInDatabase error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -264,7 +264,7 @@ func (r *Role) DelRoleAccess(ctx context.Context, req entity.RoleAccessDelReq) *
 	filter := bson.M{"role_id": req.RoleId}
 	_, err := collection.DeleteOne(ctx, filter)
 	if err != nil {
-		mhayaLogger.Warnf("DelRoleAccess DeleteOne error:%v", err)
+		mhayaLogger.Warnf("DelRoleAccess DeleteOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -280,7 +280,7 @@ func (r *Role) GetRoleAccessList(ctx context.Context, req entity.RoleAccessListR
 	cursor, err := collection.Find(ctx, filter)
 	defer cursor.Close(ctx)
 	if err != nil {
-		mhayaLogger.Warnf("GetRoleAccessList Find error:%v", err)
+		mhayaLogger.Warnf("GetRoleAccessList Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -288,7 +288,7 @@ func (r *Role) GetRoleAccessList(ctx context.Context, req entity.RoleAccessListR
 	for cursor.Next(ctx) {
 		var roleAccess models.RoleAccess
 		if err := cursor.Decode(&roleAccess); err != nil {
-			mhayaLogger.Warnf("GetRoleAccessList Decode error:%v", err)
+			mhayaLogger.Warnf("GetRoleAccessList Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 
@@ -311,14 +311,14 @@ func (r *Role) GetRoleAccessList(ctx context.Context, req entity.RoleAccessListR
 	cursor, err = collection.Find(ctx, accessFilter)
 	defer cursor.Close(ctx)
 	if err != nil {
-		mhayaLogger.Warnf("GetRoleAccessList sub Find error:%v", err)
+		mhayaLogger.Warnf("GetRoleAccessList sub Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	var accessList []*entity.AccessDetail
 	for cursor.Next(ctx) {
 		var accesss *models.Access
 		if err := cursor.Decode(&accesss); err != nil {
-			mhayaLogger.Warnf("GetRoleAccessList sub Decode error:%v", err)
+			mhayaLogger.Warnf("GetRoleAccessList sub Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		accessList = append(accessList, &entity.AccessDetail{
@@ -367,7 +367,7 @@ func formatAccessData(accessData []*entity.AccessDetail) []*entity.AccessDetail
 func (r *Role) AddAccess(ctx context.Context, req entity.AccessAddReq) *code.Result {
 	// 检查上下文是否有效
 	if ctx.Err() != nil {
-		mhayaLogger.Warnf("AddAccess ctx error:%v", ctx.Err())
+		mhayaLogger.Warnf("AddAccess ctx error:", ctx.Err())
 		return common.NewResult(code.InternalError)
 	}
 
@@ -382,7 +382,7 @@ func (r *Role) AddAccess(ctx context.Context, req entity.AccessAddReq) *code.Res
 	// 插入新角色权限记录
 	_, err := collection.InsertOne(ctx, req)
 	if err != nil {
-		mhayaLogger.Warnf("AddAccess InsertOne error:%v", err)
+		mhayaLogger.Warnf("AddAccess InsertOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -405,7 +405,7 @@ func (r *Role) DelAccess(ctx context.Context, req entity.AccessDelReq) *code.Res
 	objID, _ = primitive.ObjectIDFromHex(req.Id)
 	_, err := mdb.MDB.Collection(access.TableName()).DeleteOne(ctx, bson.M{"_id": objID})
 	if err != nil {
-		mhayaLogger.Warnf("DelAccess DeleteOne error:%v", err)
+		mhayaLogger.Warnf("DelAccess DeleteOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -441,7 +441,7 @@ func (r *Role) UpdateAccess(ctx context.Context, req entity.AccessUpdateReq) *co
 
 	_, err = collection.UpdateByID(ctx, objID, bson.M{"$set": updateFields})
 	if err != nil {
-		mhayaLogger.Warnf("UpdateAccess UpdateByID error:%v", err)
+		mhayaLogger.Warnf("UpdateAccess UpdateByID error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -482,14 +482,14 @@ func (r *Role) ListAccess(ctx context.Context, req entity.AccessListReq) (*entit
 	findOptions.SetSort(bson.M{"add_time": -1})
 	countDocuments, err := collection.CountDocuments(ctx, filter)
 	if err != nil {
-		mhayaLogger.Warnf("ListAccess CountDocuments error:%v", err)
+		mhayaLogger.Warnf("ListAccess CountDocuments error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
 	cursor, err := collection.Find(ctx, filter, findOptions)
 	defer cursor.Close(ctx)
 	if err != nil {
-		mhayaLogger.Warnf("ListAccess Find error:%v", err)
+		mhayaLogger.Warnf("ListAccess Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -497,7 +497,7 @@ func (r *Role) ListAccess(ctx context.Context, req entity.AccessListReq) (*entit
 	for cursor.Next(ctx) {
 		var accesss *models.Access
 		if err := cursor.Decode(&accesss); err != nil {
-			mhayaLogger.Warnf("ListAccess Decode error:%v", err)
+			mhayaLogger.Warnf("ListAccess Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 
@@ -546,7 +546,7 @@ func (r *Role) AdminBindRole(ctx context.Context, req entity.AdminBindRoleReq) *
 	filter := bson.M{"_id": roleId, "status": 1}
 	// 判断你是否存在
 	if err := collection.FindOne(ctx, filter).Err(); err != nil {
-		mhayaLogger.Warnf("AdminBindRole Find error:%v", err)
+		mhayaLogger.Warnf("AdminBindRole Find error:", err)
 		return common.NewResult(code.RoleNotExistOrDisabledUserError)
 	}
 
@@ -578,7 +578,7 @@ func (r *Role) AdminBindRole(ctx context.Context, req entity.AdminBindRoleReq) *
 	// 更新管理员数据
 	_, err = collection.UpdateByID(ctx, objID, bson.M{"$set": bson.M{"role_id": req.RoleId}})
 	if err != nil {
-		mhayaLogger.Warnf("AdminBindRole UpdateByID error:%v", err)
+		mhayaLogger.Warnf("AdminBindRole UpdateByID error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -610,7 +610,7 @@ func (r *Role) AdminUnBindRole(ctx context.Context, req entity.AdminBindRoleReq)
 	// 更新管理员数据
 	_, err = collection.UpdateByID(ctx, objID, bson.M{"$set": bson.M{"role_id": ""}})
 	if err != nil {
-		mhayaLogger.Warnf("AdminUnBindRole UpdateByID error:%v", err)
+		mhayaLogger.Warnf("AdminUnBindRole UpdateByID error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -678,7 +678,7 @@ func (r *Role) GetAdminRole(ctx context.Context, req entity.AdminBindRoleReq) (*
 		cursor, err := collection.Find(ctx, filter)
 		defer cursor.Close(ctx)
 		if err != nil {
-			mhayaLogger.Warnf("GetAdminRole Find error:%v", err)
+			mhayaLogger.Warnf("GetAdminRole Find error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 
@@ -687,7 +687,7 @@ func (r *Role) GetAdminRole(ctx context.Context, req entity.AdminBindRoleReq) (*
 			var accesss *models.Access
 			err := cursor.Decode(&accesss)
 			if err != nil {
-				mhayaLogger.Warnf("GetAdminRole Decode error:%v", err)
+				mhayaLogger.Warnf("GetAdminRole Decode error:", err)
 				return nil, common.NewResult(code.InternalError)
 			}
 			accessList = append(accessList, &entity.AccessDetail{
@@ -715,13 +715,13 @@ func (r *Role) GetAdminRole(ctx context.Context, req entity.AdminBindRoleReq) (*
 
 	role, err := getRole(ctx, req.RoleId)
 	if err != nil {
-		mhayaLogger.Warnf("GetAdminRole getRole error:%v", err)
+		mhayaLogger.Warnf("GetAdminRole getRole error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
 	roleAccess, err := getRoleAccess(ctx, req.RoleId)
 	if err != nil {
-		mhayaLogger.Warnf("GetAdminRole getRoleAccess error:%v", err)
+		mhayaLogger.Warnf("GetAdminRole getRoleAccess error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -738,7 +738,7 @@ func (r *Role) GetAdminRole(ctx context.Context, req entity.AdminBindRoleReq) (*
 
 	if len(AccessIds) == 0 {
 		if len(invalidAccessIds) > 0 {
-			mhayaLogger.Warnf("GetAdminRole 无效的权限ID:%v", strings.Join(invalidAccessIds, ", "))
+			mhayaLogger.Warnf("GetAdminRole 无效的权限ID:", strings.Join(invalidAccessIds, ", "))
 			return nil, common.NewResult(code.InternalError)
 		}
 
@@ -752,7 +752,7 @@ func (r *Role) GetAdminRole(ctx context.Context, req entity.AdminBindRoleReq) (*
 	cursor, err := collection.Find(ctx, filter)
 	defer cursor.Close(ctx)
 	if err != nil {
-		mhayaLogger.Warnf("GetAdminRole Find error:%v", err)
+		mhayaLogger.Warnf("GetAdminRole Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -760,7 +760,7 @@ func (r *Role) GetAdminRole(ctx context.Context, req entity.AdminBindRoleReq) (*
 	for cursor.Next(ctx) {
 		var accesss *models.Access
 		if err := cursor.Decode(&accesss); err != nil {
-			mhayaLogger.Warnf("GetAdminRole Decode error:%v", err)
+			mhayaLogger.Warnf("GetAdminRole Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		accessList = append(accessList, &entity.AccessDetail{

+ 15 - 15
game/game_cluster/nodes/webadmin/service/synthesis.go

@@ -60,7 +60,7 @@ func (s *Synthesis) FindMDBUserLogDaily(req entity.UserLogDailyReq) (*entity.Use
 	// 计算总数
 	count, err := collection.CountDocuments(ctx, filter)
 	if err != nil {
-		mhayaLogger.Warnf("FindMDBUserLogDaily CountDocuments error:%v", err)
+		mhayaLogger.Warnf("FindMDBUserLogDaily CountDocuments error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -72,7 +72,7 @@ func (s *Synthesis) FindMDBUserLogDaily(req entity.UserLogDailyReq) (*entity.Use
 
 	cursor, err := collection.Find(ctx, filter, opts)
 	if err != nil {
-		mhayaLogger.Warnf("FindMDBUserLogDaily Find error:%v", err)
+		mhayaLogger.Warnf("FindMDBUserLogDaily Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	defer cursor.Close(ctx)
@@ -84,7 +84,7 @@ func (s *Synthesis) FindMDBUserLogDaily(req entity.UserLogDailyReq) (*entity.Use
 		var result *entity.UserLogDailyDetail
 		err := cursor.Decode(&result)
 		if err != nil {
-			mhayaLogger.Warnf("FindMDBUserLogDaily Decode error:%v", err)
+			mhayaLogger.Warnf("FindMDBUserLogDaily Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		results = append(results, result)
@@ -159,7 +159,7 @@ func (s *Synthesis) FindWithdrawal(req entity.UserWithdrawalReq) (*entity.UserWi
 	// 获取总数total
 	count, err := collection.CountDocuments(ctx, filter)
 	if err != nil {
-		mhayaLogger.Warnf("FindWithdrawal CountDocuments error:%v", err)
+		mhayaLogger.Warnf("FindWithdrawal CountDocuments error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -167,7 +167,7 @@ func (s *Synthesis) FindWithdrawal(req entity.UserWithdrawalReq) (*entity.UserWi
 	var results []*entity.UserWithdrawalDetail
 	cursor, err := collection.Find(ctx, filter, findOptions)
 	if err != nil {
-		mhayaLogger.Warnf("FindWithdrawal Find error:%v", err)
+		mhayaLogger.Warnf("FindWithdrawal Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -176,14 +176,14 @@ func (s *Synthesis) FindWithdrawal(req entity.UserWithdrawalReq) (*entity.UserWi
 	for cursor.Next(ctx) {
 		var result entity.UserWithdrawalDetail
 		if err := cursor.Decode(&result); err != nil {
-			mhayaLogger.Warnf("FindWithdrawal Decode error:%v", err)
+			mhayaLogger.Warnf("FindWithdrawal Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		results = append(results, &result)
 	}
 
 	if err := cursor.Err(); err != nil {
-		mhayaLogger.Warnf("FindWithdrawal cursor error:%v", err)
+		mhayaLogger.Warnf("FindWithdrawal cursor error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -208,7 +208,7 @@ func (s *Synthesis) WithdrawalStatus(req entity.UserWithdrawalStatus) *code.Resu
 	// 执行更新操作
 	_, err := collection.UpdateOne(context.TODO(), updateCondition, updateContent, updateOptions)
 	if err != nil {
-		mhayaLogger.Warnf("WithdrawalStatus UpdateOne error:%v", err)
+		mhayaLogger.Warnf("WithdrawalStatus UpdateOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -230,7 +230,7 @@ func (s *Synthesis) WithdrawalStatusBatch(req entity.UserWithdrawalStatusBatch)
 		withdrawal := models.CashOutRecord{}
 		err := collection.FindOne(context.TODO(), updateCondition).Decode(&withdrawal)
 		if err != nil {
-			mhayaLogger.Warnf("WithdrawalStatusBatch FindOne error:%v", err)
+			mhayaLogger.Warnf("WithdrawalStatusBatch FindOne error:", err)
 			continue
 		}
 
@@ -252,7 +252,7 @@ func (s *Synthesis) WithdrawalStatusBatch(req entity.UserWithdrawalStatusBatch)
 		updateOptions := options.Update().SetUpsert(true)
 		_, err = collection.UpdateOne(context.TODO(), updateCondition, updateContent, updateOptions)
 		if err != nil {
-			mhayaLogger.Warnf("WithdrawalStatusBatch UpdateOne error:%v", err)
+			mhayaLogger.Warnf("WithdrawalStatusBatch UpdateOne error:", err)
 			continue
 		}
 	}
@@ -297,7 +297,7 @@ func (s *Synthesis) FindUserCountryCount() (*entity.UserCountryResp, *code.Resul
 	// 执行聚合查询
 	cursor, err := collection.Aggregate(context.TODO(), pipeline)
 	if err != nil {
-		mhayaLogger.Warnf("FindUserCountryCount Aggregate error:%v", err)
+		mhayaLogger.Warnf("FindUserCountryCount Aggregate error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	defer cursor.Close(context.TODO())
@@ -305,7 +305,7 @@ func (s *Synthesis) FindUserCountryCount() (*entity.UserCountryResp, *code.Resul
 	// 遍历查询结果
 	var results []bson.M
 	if err := cursor.All(context.TODO(), &results); err != nil {
-		mhayaLogger.Warnf("FindUserCountryCount All error:%v", err)
+		mhayaLogger.Warnf("FindUserCountryCount All error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -419,7 +419,7 @@ func (s *Synthesis) FindUserLevel() (*entity.UserLevelCountResp, *code.Result) {
 	// 查询所有文档
 	cursor, err := collection.Find(ctx, bson.M{})
 	if err != nil {
-		mhayaLogger.Warnf("FindUserLevel Find error:%v", err)
+		mhayaLogger.Warnf("FindUserLevel Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	defer cursor.Close(ctx)
@@ -429,13 +429,13 @@ func (s *Synthesis) FindUserLevel() (*entity.UserLevelCountResp, *code.Result) {
 	for cursor.Next(ctx) {
 		var result models.PlayerLevelStat
 		if err := cursor.Decode(&result); err != nil {
-			mhayaLogger.Warnf("FindUserLevel Decode error:%v", err)
+			mhayaLogger.Warnf("FindUserLevel Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		reData = append(reData, &result)
 	}
 	if err := cursor.Err(); err != nil {
-		mhayaLogger.Warnf("FindUserLevel cursor error:%v", err)
+		mhayaLogger.Warnf("FindUserLevel cursor error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 

+ 7 - 7
game/game_cluster/nodes/webadmin/service/whitelist.go

@@ -49,7 +49,7 @@ func (w *Whitelist) Add(req entity.WhitelistAddReq) *code.Result {
 			return nil
 		}
 
-		mhayaLogger.Warnf("Add InsertOne error:%v", err)
+		mhayaLogger.Warnf("Add InsertOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -64,7 +64,7 @@ func (w *Whitelist) Remove(req entity.WhitelistRemoveReq) *code.Result {
 	defer cancel()
 	_, err := collection.DeleteOne(ctx, bson.M{"ip": req.IP})
 	if err != nil {
-		mhayaLogger.Warnf("Remove DeleteOne error:%v", err)
+		mhayaLogger.Warnf("Remove DeleteOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -80,7 +80,7 @@ func (w *Whitelist) Check(ip string) *code.Result {
 	// 判断是否已经存在
 	err := collection.FindOne(ctx, bson.M{"ip": ip}).Decode(&whitelistModel)
 	if err == nil {
-		mhayaLogger.Warnf("Check FindOne error:%v", err)
+		mhayaLogger.Warnf("Check FindOne error:", err)
 		return common.NewResult(code.InternalError)
 	}
 
@@ -112,7 +112,7 @@ func (w *Whitelist) GetAll(req entity.WhitelistListReq) (*entity.WhitelistListRe
 	findOptions := options.Find().SetSkip(int64(skip)).SetLimit(int64(pageSize))
 	count, err := collection.CountDocuments(ctx, bson.D{})
 	if err != nil {
-		mhayaLogger.Warnf("GetAll CountDocuments error:%v", err)
+		mhayaLogger.Warnf("GetAll CountDocuments error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
@@ -120,7 +120,7 @@ func (w *Whitelist) GetAll(req entity.WhitelistListReq) (*entity.WhitelistListRe
 	var results []models.Whitelist
 	cursor, err := collection.Find(ctx, bson.D{}, findOptions)
 	if err != nil {
-		mhayaLogger.Warnf("GetAll Find error:%v", err)
+		mhayaLogger.Warnf("GetAll Find error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 	defer cursor.Close(ctx)
@@ -129,14 +129,14 @@ func (w *Whitelist) GetAll(req entity.WhitelistListReq) (*entity.WhitelistListRe
 	for cursor.Next(ctx) {
 		var whitelist models.Whitelist
 		if err := cursor.Decode(&whitelist); err != nil {
-			mhayaLogger.Warnf("GetAll Decode error:%v", err)
+			mhayaLogger.Warnf("GetAll Decode error:", err)
 			return nil, common.NewResult(code.InternalError)
 		}
 		results = append(results, whitelist)
 	}
 
 	if err := cursor.Err(); err != nil {
-		mhayaLogger.Warnf("GetAll cursor error:%v", err)
+		mhayaLogger.Warnf("GetAll cursor error:", err)
 		return nil, common.NewResult(code.InternalError)
 	}