一波更新

This commit is contained in:
tangping
2025-01-23 16:12:49 +08:00
parent 22ac6c1fed
commit 5f3a40a50e
90 changed files with 2392 additions and 1791 deletions

View File

@@ -42,6 +42,12 @@ var (
// RabbitMQName mq队列名称
RabbitMQName string
// SqlUseMQ 是否使用mq执行sql
SqlUseMQ bool
//微信登录相关配置
Wxconfig WxConfig
)
// initBaseConfig
@@ -80,6 +86,11 @@ func initBaseConfig() {
Rabbitmq = root.RabbitMQAddress
RabbitMQName = root.RabbitMQName
SqlUseMQ = root.SqlUseMQ
Wxconfig = root.Wxconfig
}
// GetDebug
@@ -98,6 +109,10 @@ func GetWebServerAddress() string {
return WebServerAddress
}
func GetWxconfig() WxConfig {
return Wxconfig
}
// GetEsUrls 返回配置文件中 Elasticsearch 的 URL 地址。
//
// 该函数通过访问全局变量 ConfigYaml获取其 Root 字段下的 EsUrls 属性,
@@ -114,3 +129,7 @@ func GetRabbitMQAddress() string {
func GetRabbitMQName() string {
return RabbitMQName
}
func GetSqlUseMQ() bool {
return SqlUseMQ
}

View File

@@ -21,6 +21,9 @@ type Root struct {
// logmgr 配置
LogMgr LogMgr `yaml:"log_mgr"`
// 微信登录配置
Wxconfig WxConfig `yaml:"wx_config"`
// Web 服务监听地址和端口
WebServerAddress string `yaml:"web_server_address"`
@@ -49,6 +52,9 @@ type Root struct {
// mq队列名称
RabbitMQName string `yaml:"mq_queue_name"`
// 是否使用mq执行sql
SqlUseMQ bool `yaml:"sql_use_mq"`
// 数据库配置
DbConfig DBConfig `yaml:"db_config"`
@@ -59,6 +65,14 @@ type Root struct {
FunctionConfig FunctionConf `yaml:"function_config"`
}
type WxConfig struct {
//微信移动应用appId
AppId string `yaml:"appId"`
//微信移动应用appSecret
AppSecret string `yaml:"appSecret"`
}
// ManagerCenterConf 是 ManagerCenter 的配置结构体
type ManagerCenterConf struct {
// ManagerCenter API 的 URL
@@ -86,6 +100,9 @@ type LogMgr struct {
// DBConfig 包含数据库和 Redis 的配置
type DBConfig struct {
// 实时更新数据库数量{玩家库/用户库}
DBNum []int `yaml:"db_num"`
//管理员数据库配置
AdminDB DatabaseConfig `yaml:"admin_db"`

View File

@@ -12,6 +12,9 @@ import (
// @description: mysql配置对象
type DbConfig struct {
// 实时更新数据库数量{玩家库/用户库}
dbNum []int
// 管理员数据库链接字符串
adminConfig *mysqlUtil.DBConfig
@@ -144,11 +147,12 @@ func (config *DbConfig) GetRedisConfig() *redisUtil.RedisConfig {
// return:
//
// @*DbConfig:
func newMysqlConfig(_adminConfig *mysqlUtil.DBConfig, _userConfig *mysqlUtil.DBConfig, _payConfig *mysqlUtil.DBConfig, _gameModelConfig *mysqlUtil.DBConfig,
func newMysqlConfig(_dbNum []int, _adminConfig *mysqlUtil.DBConfig, _userConfig *mysqlUtil.DBConfig, _payConfig *mysqlUtil.DBConfig, _gameModelConfig *mysqlUtil.DBConfig,
_gameConfig *mysqlUtil.DBConfig,
_playerConfig *mysqlUtil.DBConfig,
_redisConfig *redisUtil.RedisConfig) *DbConfig {
return &DbConfig{
dbNum: _dbNum,
adminConfig: _adminConfig,
userConfig: _userConfig,
payConfig: _payConfig,
@@ -183,7 +187,7 @@ func initDbConfig() error {
//}
// 初始化mysql配置对象
dbConfigObj = newMysqlConfig(
dbConfigObj = newMysqlConfig(dbConfig.DBNum,
mysqlUtil.NewDBConfig(dbConfig.AdminDB.ConnectionString, dbConfig.AdminDB.MaxOpenConns, dbConfig.AdminDB.MaxIdleConns),
mysqlUtil.NewDBConfig(dbConfig.UserDB.ConnectionString, dbConfig.UserDB.MaxOpenConns, dbConfig.UserDB.MaxIdleConns),
mysqlUtil.NewDBConfig(dbConfig.PayDB.ConnectionString, dbConfig.PayDB.MaxOpenConns, dbConfig.PayDB.MaxIdleConns),
@@ -205,3 +209,7 @@ func initDbConfig() error {
func GetDbConfig() *DbConfig {
return dbConfigObj
}
func GetDBNum() []int {
return dbConfigObj.dbNum
}

View File

@@ -4,11 +4,12 @@ import (
"context"
"fmt"
"framework/sqlAsyncMgr"
"goutil/logUtilPlus"
"time"
goredis "github.com/go-redis/redis/v8"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"goutil/logUtilPlus"
"time"
// _ "github.com/go-sql-driver/mysql"
config "common/configsYaml"

View File

@@ -1,6 +1,7 @@
package connection
import (
"fmt"
"testing"
"time"
)
@@ -29,3 +30,7 @@ func TestExecute(t *testing.T) {
_ = result.Error // 返回 error
_ = result.RowsAffected // 返回插入记录的条数
}
func TestGetDBName(t *testing.T) {
fmt.Print(time.Now().Format("200601"))
}

View File

@@ -1,6 +1,13 @@
package connection
import "gorm.io/gorm"
import (
config "common/configsYaml"
"common/rabbitmq"
"gorm.io/gorm"
"goutil/logUtilPlus"
"strconv"
"time"
)
var (
// 存放实体结构
@@ -32,10 +39,137 @@ func BuildDB() {
for _, dbModel := range dbModelMap {
// 检查数据库中是否存在与dbModel对应的表
tableExists := modelDB.Migrator().HasTable(dbModel)
if !tableExists {
// 如果表不存在,则进行自动迁移
modelDB.AutoMigrate(dbModel)
}
CheckTableExists(modelDB, dbModel)
}
}
// CheckTableExists 检查表是否存在,不存在则添加
func CheckTableExists(db *gorm.DB, value interface{}) bool {
// 检查数据库中是否存在与dbModel对应的表
tableExists := db.Migrator().HasTable(value)
if !tableExists {
// 如果表不存在,则进行自动迁移
err := db.AutoMigrate(value)
if err != nil {
logUtilPlus.ErrorLog("CheckTableExists is err: %v", err.Error())
return false
}
}
return true
}
// GetMonth 获取当前月份
func GetMonth() int32 {
month, err := strconv.Atoi(time.Now().Format("200601"))
if err != nil {
logUtilPlus.ErrorLog("GetMonth is err: %v", err.Error())
return 0
}
return int32(month)
}
// GetToMonthAdd 获取当前月份 加上指定个月
func GetToMonthAdd(monthCount int32) int32 {
month, err := strconv.Atoi(time.Now().AddDate(0, int(monthCount), 0).Format("200601"))
if err != nil {
logUtilPlus.ErrorLog("GetToMonthAdd is err: %v", err.Error())
return 0
}
return int32(month)
}
// Create 添加数据
// @param db 数据库连接
// @param value 值
// @param dbIndex mq队列索引
func Create(db *gorm.DB, value interface{}, dbIndex int32) *gorm.DB {
result := &gorm.DB{Error: nil}
//检查表是否存在
CheckTableExists(db, value)
//转换sql mq远程执行
if config.GetSqlUseMQ() {
sql := db.ToSQL(func(tx *gorm.DB) *gorm.DB {
return tx.Model(value).Create(value)
})
//推送数据到mq
rabbitmq.SendMqData(dbIndex, sql)
//直接返回
return result
}
result = db.Create(value)
if result.Error != nil {
logUtilPlus.ErrorLog("数据创建失败:", result.Error.Error())
}
return result
}
// Save 保存数据
func Save(db *gorm.DB, value interface{}, dbIndex int32) *gorm.DB {
result := &gorm.DB{Error: nil}
//转换sql mq远程执行
if config.GetSqlUseMQ() {
sql := db.ToSQL(func(tx *gorm.DB) *gorm.DB {
return tx.Model(value).Save(value)
})
//推送数据到mq
rabbitmq.SendMqData(dbIndex, sql)
return result
}
result = db.Save(value)
if result.Error != nil {
logUtilPlus.ErrorLog("数据保存失败:", result.Error.Error())
}
return result
}
// AsyncCreate 异步创建数据
func AsyncCreate(db *gorm.DB, value interface{}) {
go func() {
//检查表是否存在
CheckTableExists(db, value)
result := db.Create(value)
if result.Error != nil {
logUtilPlus.ErrorLog("AsyncCreate is err: %v", result.Error)
}
}()
}
// AsyncSave 异步保存数据
func AsyncSave(db *gorm.DB, value interface{}) {
go func() {
result := db.Save(value)
if result.Error != nil {
logUtilPlus.ErrorLog("AsyncSave is err : %v", result.Error)
}
}()
}
// AsyncDelete 异步删除数据
func AsyncDelete(db *gorm.DB, value interface{}) {
go func() {
result := db.Delete(value)
if result.Error != nil {
logUtilPlus.ErrorLog("AsyncDelete is err : %v", result.Error)
}
}()
}

View File

@@ -3,11 +3,11 @@ package httpServer
import (
"encoding/json"
"fmt"
"goutil/logUtilPlus"
"goutil/typeUtil"
"goutil/zlibUtil"
"io/ioutil"
"net/http"
"goutil/logUtilPlus"
"goutil/typeUtil"
"goutil/zlibUtil"
)
// ApiContext
@@ -184,6 +184,7 @@ func NewApiContext(_request *http.Request, _responseWriter http.ResponseWriter,
// 读取数据
_, errMsg := context.readContent(isZlib)
if errMsg != nil {
return nil, errMsg
}

View File

@@ -1,10 +1,10 @@
package httpServer
import (
"common/webServer"
"net/http"
"common/resultStatus"
"common/webServer"
)
// 处理函数
@@ -59,7 +59,7 @@ func (this *ApiHandler) FuncParamNames() []string {
// @receiver this: this
// @r:
// return:
// @resultStatus.ResultStatus: 状态码数据
// @resultstatus.ResultStatus: 状态码数据
func (this *ApiHandler) CheckParam(r *http.Request) resultStatus.ResultStatus {
for _, name := range this.funcParamNames {
if r.Form[name] == nil || len(r.Form[name]) == 0 {

View File

@@ -7,6 +7,7 @@ import (
"goutil/logUtil"
"goutil/logUtilPlus"
// "log"
"net/http/pprof"

View File

@@ -0,0 +1,29 @@
package mytime
import (
"goutil/logUtilPlus"
"time"
)
/*func GetZeroTime(t int64, timezone int) int64 {
return t - (t+int64(timezone))%86400
}
func IsDiffDay(second, first int64, timezone int) int {
secondZeroTime := GetZeroTime(second, timezone)
firstZeroTime := GetZeroTime(first, timezone)
return int(secondZeroTime/86400 - firstZeroTime/86400)
}*/
func DiffDays(new, old int64) int64 {
newZeroTime := ZeroTime(new, 0)
oldZeroTime := ZeroTime(old, 0)
logUtilPlus.ErrorLog("newZeroTime=%d,oldZeroTime=%d", newZeroTime, oldZeroTime)
return newZeroTime/86400 - oldZeroTime/86400
}
func ZeroTime(sec, nsec int64) int64 {
dateStr := time.Unix(sec, nsec).Format("2006-01-02")
t, _ := time.ParseInLocation("2006-01-02", dateStr, time.Local)
return t.Unix()
}

View File

@@ -0,0 +1,59 @@
package rabbitmq
import (
configYaml "common/configsYaml"
"goutil/logUtil"
"strconv"
"github.com/streadway/amqp"
)
var RabbitMQConn *amqp.Connection
var RabbitMQChannel *amqp.Channel
// 初始化rabbitMQ
func init() {
rabbitMQAddress := configYaml.GetRabbitMQAddress()
//是否有mq配置
if rabbitMQAddress == "" {
return
}
// 连接到 RabbitMQ 服务器
var err error
RabbitMQConn, err = amqp.Dial(rabbitMQAddress)
if err != nil {
//抛出一个异常
logUtil.FatalLog("Failed to connect to RabbitMQ: %serr:%s", rabbitMQAddress, err.Error())
}
// 打开一个通道
RabbitMQChannel, err = RabbitMQConn.Channel()
if err != nil {
//抛出一个异常
logUtil.FatalLog("Failed to open a channelerr:%s", err.Error())
}
//循环数据库数量
for _, index := range configYaml.GetDBNum() {
//队列名称
queueName := configYaml.GetRabbitMQName() + ":" + strconv.Itoa(index)
// 声明一个队列
_, err = RabbitMQChannel.QueueDeclare(
queueName, // 队列名称
true, // 是否持久化
false, // 是否在使用后删除
false, // 是否排他
false, // 是否阻塞
nil, // 其他参数
)
if err != nil {
logUtil.FatalLog("Failed to declare a queuequeueName:%s,err:%s", queueName, err.Error())
}
}
}

View File

@@ -0,0 +1,55 @@
package rabbitmq
import (
configYaml "common/configsYaml"
"goutil/logUtilPlus"
"strconv"
)
// ConsumeData 消费mq数据
func ConsumeData(handler func(data string) error) {
// 确保通道启用了 Publisher Confirms
if err := RabbitMQChannel.Confirm(false); err != nil {
logUtilPlus.ErrorLog("channel could not be put into confirm mode: %w", err)
}
//循环数据库数量
for _, index := range configYaml.GetDBNum() {
rabbitMQName := configYaml.GetRabbitMQName() + ":" + strconv.Itoa(index)
// 注册一个消费者
msgs, err := RabbitMQChannel.Consume(
rabbitMQName, // 队列名称
"", // 消费者名称
false, // 是否自动确认
false, // 是否排他
false, // 是否本地
false, // 是否阻塞
nil, // 其他参数
)
if err != nil {
logUtilPlus.ErrorLog("Failed to register a consumererr:%s", err.Error())
}
// 启动一个 goroutine 来处理消息
go func() {
for d := range msgs {
// 消息处理
if err = handler(string(d.Body)); err != nil {
// 消息处理失败,记录错误日志
logUtilPlus.ErrorLog("Failed to handle message, err:%s", err.Error())
}
// 消息处理完成后手动确认
if err := d.Ack(false); err != nil {
logUtilPlus.ErrorLog("Failed to acknowledge message, err:%s", err.Error())
}
}
}()
}
}

View File

@@ -0,0 +1,34 @@
package rabbitmq
import (
configYaml "common/configsYaml"
"goutil/logUtilPlus"
"strconv"
"github.com/streadway/amqp"
)
// SendMqData 发送单挑mq消息
func SendMqData(dbIndex int32, data string) {
rabbitMQName := configYaml.GetRabbitMQName() + ":" + strconv.Itoa(int(dbIndex))
// 确保通道启用了 Publisher Confirms
if err := RabbitMQChannel.Confirm(false); err != nil {
logUtilPlus.ErrorLog("channel could not be put into confirm mode: %w", err)
}
// 发布消息到队列
err := RabbitMQChannel.Publish(
"", // 交换机名称
rabbitMQName, // 路由键
false, // 是否强制
false, // 是否立即
amqp.Publishing{
ContentType: "text/plain",
Body: []byte(data),
})
if err != nil {
logUtilPlus.ErrorLog("Failed to publish a messageerr:%s", err.Error())
}
}

View File

@@ -1,910 +0,0 @@
package resultStatus
// 系统错误码
var (
// 成功
Success = NewResultStatus(0, "Success")
// 数据库错误
DBError = NewResultStatus(-2, "DBError")
// 方法未定义
MethodNotDefined = NewResultStatus(-3, "MethodNotDefined")
// 参数无效
ParamInValid = NewResultStatus(-4, "ParamInValid")
// 参数不匹配
ParamNotMatch = NewResultStatus(-5, "ParamNotMatch")
// 功能未开启
ModuleNotOpen = NewResultStatus(-6, "ModuleNotOpen")
// 只支持Post
OnlySupportPOST = NewResultStatus(-7, "OnlySupportPOST")
// API未定义
APINotDefined = NewResultStatus(-8, "APINotDefined")
// API数据错误
APIDataError = NewResultStatus(-9, "APIDataError")
// API参数错误
APIParamError = NewResultStatus(-10, "APIParamError")
// IP被禁用
IPForbid = NewResultStatus(-11, "IPForbid")
// 没有有效的服务器
NoAvailableServer = NewResultStatus(-12, "NoAvailableServer")
// 服务器组不存在
ServerGroupNotExists = NewResultStatus(-13, "ServerGroupNotExists")
// 测试接口只能debug下调用
DebugInterface = NewResultStatus(-14, "DebugInterface")
// 模块不存在
ModuleNotExists = NewResultStatus(-15, "ModuleNotExists")
// 未能找到指定方法
NotSpecificMethod = NewResultStatus(-16, "NotSpecificMethod")
// 非指定区域
NotMatchRegion = NewResultStatus(-17, "NotMatchRegion")
// 发送空数据
SendNullData = NewResultStatus(-18, "SendNullData")
// 序列化失败
MarshalDataError = NewResultStatus(-19, "MarshalDataError")
//未登录
NotLogin = NewResultStatus(-20, "NotLogin")
// 数据错误
DataError = NewResultStatus(-31, "DataError")
// 战区合并维护中,敬请期待
MergeDataRunning = NewResultStatus(-67, "MergeDataRunning")
// 下载器内容未配置
QcDownloadConfigNotExists = NewResultStatus(-68, "QcDownloadConfigNotExists")
// 下载器奖励已领取
QcDownloadHasReward = NewResultStatus(-69, "QcDownloadHasReward")
// 下载器奖励没有奖励可领取
QcDownloadNotReward = NewResultStatus(-70, "QcDownloadNotReward")
// 下载器奖励积分不足
QcDownloadNotScore = NewResultStatus(-71, "QcDownloadNotScore")
)
// 玩家
var (
// 玩家不存在
PlayerNotExist = NewResultStatus(-1110, "PlayerNotExist")
// 没有合适的玩家
NotSuitablePlayer = NewResultStatus(-1155, "NotSuitablePlayer")
// 玩家阵容不存在
PlayerSlotFormationNotExist = NewResultStatus(-1156, "PlayerSlotFormationNotExist")
)
// 仙盟和GS保持同步
var (
// 玩家不在仙盟中
GuildNotIn = NewResultStatus(-9401, "玩家不在仙盟中")
// 仙盟不存在
GuildNotExist = NewResultStatus(-9402, "仙盟不存在")
// 玩家已在仙盟中
GuildHasIn = NewResultStatus(-9403, "玩家已在仙盟中")
// 玩家操作目标和所在仙盟不一致
TargetGuildNotMatch = NewResultStatus(-9404, "玩家操作目标和所在仙盟不一致")
// 仙盟不存在成员
GuildMemberNotExist = NewResultStatus(-9405, "仙盟不存在成员")
// vip等级不足
GuildNeedVip = NewResultStatus(-9406, "vip等级不足")
// 仙盟权限不足
GuildNeedAuth = NewResultStatus(-9407, "仙盟权限不足")
// boss节点今日未开放
GuildBossTodayNotOpen = NewResultStatus(-9411, "boss节点今日未开放")
// 职位人数已满
GuildPostEnough = NewResultStatus(-9415, "职位人数已满")
// boss开启错误
GuildBossOpenError = NewResultStatus(-9416, "boss开启错误")
// boss开启条件不足
GuildBossOpenEnough = NewResultStatus(-9417, "boss开启条件不足")
// 仙盟名称已存在
GuildNameHasExist = NewResultStatus(-9419, "仙盟名称已存在")
// 该职位人数达上限
GuildPostLimit = NewResultStatus(-9420, "该职位人数达上限")
// 世界喊话CD中
GuildShareCd = NewResultStatus(-9423, "世界喊话CD中")
// 弹劾条件不足
GuildImpeachNotEnough = NewResultStatus(-9424, "弹劾条件不足")
// 不是成员或者长老
GuildIsNotMember = NewResultStatus(-9428, "不是成员或者长老")
// boss已开启
GuildBossHasOpen = NewResultStatus(-9429, "boss已开启")
// 盟主不允许退盟
GuildLeaderNotAllowedExit = NewResultStatus(-9430, "盟主不允许退盟")
// 盟主公告锁定
GuildNoticeIsLock = NewResultStatus(-9431, "盟主公告锁定")
// 仙盟次数不足
GuildMiniGameNumNotAllow = NewResultStatus(-9439, "仙盟次数不足")
// 仙盟名称已被占用
GuildNameIsNotValid = NewResultStatus(-9445, "仙盟名称已存在")
// 不是盟主
GuildPlayerNotLeader = NewResultStatus(-9454, "不是盟主")
// 模式切换未到冷却时间
GuildSwitchModeNotCool = NewResultStatus(-9455, "模式切换未到冷却时间")
// 该玩家职位变更还在冷却中
GuildChangePostNotCool = NewResultStatus(-9460, "该玩家职位变更还在冷却中")
// 当前仙盟管理模式不可任命
GuildModeCanNotAppoint = NewResultStatus(-9461, "当前仙盟管理模式不可任命")
// 当前仙盟管理模式不可挑战
GuildModeCanNotFight = NewResultStatus(-9463, "当前仙盟管理模式不可挑战")
// 玩家等级不满足仙盟等级要求
GuildPlayerLvLessThanNeedLv = NewResultStatus(-9465, "玩家等级不满足仙盟等级要求")
// 玩家未申请
GuildPlayerNotApply = NewResultStatus(-9466, "玩家未申请")
// 仙盟信息未变更
GuildInfoNotChange = NewResultStatus(-9483, "仙盟信息未变更")
// 战略编辑次数不足,明日再来
GuildStrategyEditNum = NewResultStatus(-9486, "战略编辑次数不足,明日再来")
// 建筑不存在
GuildBuildNotExist = NewResultStatus(-9489, "建筑不存在")
// 礼包已采购
GuildWelfarePurchased = NewResultStatus(-9490, "该礼包已采购")
// 礼包已采购
GuildWelfareCaptailNotEnough = NewResultStatus(-9491, "采购礼包所需资金不足")
// 礼包已采购
GuildWelfareLvNotEnough = NewResultStatus(-9492, "仙盟等级不足,无法采购")
// 建筑经验超过最大值
GuildBuildExpOverMax = NewResultStatus(-9496, "建筑经验超过最大值")
// 未能设置该类型职位信息
GuildSetPostTypeNot = NewResultStatus(-9497, "未能设置该类型职位信息")
// 仙盟成员已达上限
GuildNumMax = NewResultStatus(-9499, "仙盟成员已达上限")
// 建筑尚未开启
GuildBuildIsLock = NewResultStatus(-109013, "建筑尚未开启")
// 建筑配置未获取
GuildBuildConfigNotExist = NewResultStatus(-109014, "未获取到建筑配置")
// 等级不匹配
GuildWelfareLvNotMatch = NewResultStatus(-109015, "等级不匹配")
// 建筑等级已达到满级
GuildBuildHasMaxLv = NewResultStatus(-109017, "建筑等级已达到满级")
// 采购礼包ID不存在
GuildGiftIdNotExist = NewResultStatus(-109018, "采购礼包ID不存在")
// 盟主令次数不足
GuildLeaderOrderCount = NewResultStatus(-109019, "盟主令次数不足")
// 仙盟每日可踢出人数已达上限
GuildTodayKickOutCountIsMax = NewResultStatus(-109020, "仙盟每日可踢出人数已达上限")
// 已申请该仙盟,请耐心等待审核
GuildHasApply = NewResultStatus(-109499, "已申请该仙盟,请耐心等待审核")
)
// 仙盟试炼
var (
GuildTrainBoxRewardDrawed = NewResultStatus(-109001, "仙盟试炼宝箱已领取")
// 仙盟boss战报不存在
GuildTimeBossReportNotExists = NewResultStatus(-109002, "仙盟boss战报不存在")
// 仙盟试炼节点不存在
GuildTrainNodeNotExists = NewResultStatus(-109003, "仙盟试炼节点不存在")
// 仙盟试炼奖励槽位不存在
GuildTrainBoxSlotNotExists = NewResultStatus(-109004, "仙盟试炼奖励槽位不存在")
// 仙盟试炼目标位置奖励信息已变化
GuildTrainBoxSlotHasRefresh = NewResultStatus(-109005, "仙盟试炼目标位置奖励信息已变化")
// 仙盟限时boss开启积分不足
GuildTimedOpenNotEnougth = NewResultStatus(-109006, "仙盟限时boss开启积分不足")
// 仙盟限时boss开启积分不足
GuildTrainNotKill = NewResultStatus(-109007, "BOSS未镇压无法领奖")
// 试炼章节暂未开启
GuildTrainNodeNotOpen = NewResultStatus(-109010, "试炼章节暂未开启")
// 试炼已经镇压
GuildTrainIsKilled = NewResultStatus(-109011, "BOSS已镇压不可挑战")
)
// 仙盟红包
var (
// 仙盟红包不存在
GuildRedPacketNotExist = NewResultStatus(-9950, "仙盟红包不存在")
// 仙盟玩家红包不存在
GuildPlayerRedPacketNotExist = NewResultStatus(-9959, "仙盟玩家红包不存在")
// 仙盟红包已过期
GuildRedPacketIsExpire = NewResultStatus(-9953, "仙盟红包已过期")
// 仙盟红包没有奖励可以领取
GuildRedPacketNotReward = NewResultStatus(-9960, "仙盟红包没有奖励可以领取")
// 仙盟红包奖励已领取
GuildRedPacketHasRewarded = NewResultStatus(-9954, "仙盟红包奖励已领取")
)
// 组队副本
var (
// 房间不存在
TeamCopyRoomNotExists = NewResultStatus(-9612, "TeamCopyRoomNotExists")
// 成员不存在
TeamCopyMemberNotExists = NewResultStatus(-9613, "TeamCopyMemberNotExists")
// 不是房主
TeamCopyNotIsLeader = NewResultStatus(-9614, "TeamCopyNotIsLeader")
// 战斗失败
TeamCopyFigthFail = NewResultStatus(-9615, "TeamCopyFigthFail")
// 房间玩家未准备
TeamCopyNotAllReady = NewResultStatus(-9616, "TeamCopyNotAllReady")
// 玩家人数不足
TeamCopyNotEnough = NewResultStatus(-9617, "TeamCopyNotEnough")
// 玩家战力不足
TeamCopyFapNotEnough = NewResultStatus(-9618, "TeamCopyFapNotEnough")
// 仍有奖励未领取
TeamCopyHasReward = NewResultStatus(-9619, "TeamCopyHasReward")
// 未被邀请
TeamCopyNotShare = NewResultStatus(-9620, "TeamCopyNotShare")
// 目标节点尚未开启
TeamCopyNodeNotOpen = NewResultStatus(-9622, "TeamCopyNodeNotOpen")
// 人数已满
TeamCopyIsMax = NewResultStatus(-9624, "TeamCopyIsMax")
// 没有权限进入房间
TeamCopyNotAuth = NewResultStatus(-9625, "TeamCopyNotAuth")
// 组队战斗已开始
TeamCopyIsFighting = NewResultStatus(-9626, "TeamCopyIsFighting")
// 邀请已存在
TeamCopyIsExistShare = NewResultStatus(-9627, "TeamCopyIsExistShare")
// 队伍不能为全部助战状态
TeamCopyIsAllHelp = NewResultStatus(-9633, "TeamCopyIsAllHelp")
// 您已被踢出
TeamCopyKickOut = NewResultStatus(-9638, "TeamCopyKickOut")
// 房间已经解散
TeamCopyRoomRemove = NewResultStatus(-9639, "房间已经解散")
// 玩家不在房间中
TeamCopyRoomMemberNotIn = NewResultStatus(-9644, "玩家不在房间中")
// 玩家战力不足
TeamCopyPlayerFapLimit = NewResultStatus(-9647, "玩家战力不足")
// 布阵阵容错误
TeamCopyFormationError = NewResultStatus(-212603, "布阵阵容错误")
// 单人模式不允许加入
TeamCopySingleNotJoin = NewResultStatus(-212604, "单人模式不允许加入")
// 队员未准备
PlayerNotReady = NewResultStatus(-212605, "队员未准备")
)
// 矿战
var (
// 矿战玩家信息不存在
KuangzhanPlayerNotExist = NewResultStatus(-36131, "KuangzhanPlayerNotExist")
// 占领节点错误
KuangzhanOccupyNode = NewResultStatus(-36113, "KuangzhanOccupyNode")
// 矿战节点不存在
NodeConfigNotExist = NewResultStatus(-36132, "NodeConfigNotExist")
// 此洞府正在被攻击
TheOtherPlayerFighting = NewResultStatus(-36114, "TheOtherPlayerFighting")
// 该节点已经被占领
KuangzhanoverOccupyNode = NewResultStatus(-36113, "KuangzhanoverOccupyNode")
// 占领节点玩家无阵容
KuangzhanPlayerNoFormation = NewResultStatus(-36133, "KuangzhanPlayerNoFormation")
// 获取阵容失败
KuangzhanPlayerGetFormationFail = NewResultStatus(-36134, "KuangzhanPlayerGetFormationFail")
// 已占领洞府节点
KuangzhanOverLoad = NewResultStatus(-36115, "KuangzhanOverLoad")
// 今日抢夺次数已经用完
KuangzhanDailyLootOver = NewResultStatus(-36117, "KuangzhanDailyLootOver")
// 此洞府今日已无法被抢夺
KuangzhanDailyRobbedOver = NewResultStatus(-36118, "KuangzhanDailyRobbedOver")
// 洞天抢夺暂未开启
KuangzhanRobbedTimeNotOpen = NewResultStatus(-36119, "KuangzhanRobbedTimeNotOpen")
// 剩余洞天宝石不可抢夺
KuangzhanGemIsOver = NewResultStatus(-36120, "KuangzhanGemIsOver")
// 玩家不匹配
KuangzhanPlayerNotMatching = NewResultStatus(-36122, "KuangzhanPlayerNotMatching")
// 不是被邀请的玩家
KuangzhanInviteFailed = NewResultStatus(-36123, "邀请好友失败")
// 不是被邀请的玩家
KuangzhanNotInvited = NewResultStatus(-36124, "不是被邀请的玩家")
// 协助信息已失效
KuangzhanInviteExpired = NewResultStatus(-36125, "协助信息已失效")
// 已经帮助过该玩家
KuangzhanAlreadyHelped = NewResultStatus(-36135, "已经帮助过该玩家")
// 对方任务已经完成
KuangzhanTaskFinished = NewResultStatus(-36136, "对方任务已经完成")
)
// 蜀山论剑
var (
// 战斗校验出现异常
FightException = NewResultStatus(-1354, "FightException")
// 比武大会玩家信息不存在
HegeMonyPlayerInfoNotExist = NewResultStatus(-9701, "HegeMonyPlayerInfoNotExist")
// 比武大会玩家已有匹配
HegeMonyHasMatch = NewResultStatus(-9702, "HegeMonyHasMatch")
// 比武大会玩家未找到匹配
HegeMonyNotMatch = NewResultStatus(-9703, "HegeMonyNotMatch")
// 比武大会玩家未找到阵容
HegeMonyFormationNotExist = NewResultStatus(-9704, "HegeMonyFormationNotExist")
// 比武大会对手玩家信息不存在
HegeMonyTargetPlayerInfoNotExist = NewResultStatus(-9705, "HegeMonyTargetPlayerInfoNotExist")
// 比武大会玩家未匹配
HegeMonyPlayerNotMatch = NewResultStatus(-9706, "HegeMonyPlayerNotMatch")
// 比武大会赛季不匹配
SeasonNotMatch = NewResultStatus(-9707, "SeasonNotMatch")
// 比武大会战报信息不存在
HegeMonyReportNotExist = NewResultStatus(-9730, "HegeMonyReportNotExist")
// 比武大会战斗未能找到匹配对手
HegeMonyFightNotMatch = NewResultStatus(-9731, "HegeMonyFightNotMatch")
// 比武大会荣耀玩家不存在
HegeMonyHonorPlayerNotExist = NewResultStatus(-9732, "HegeMonyHonorPlayerNotExist")
)
// 战报
var (
// 战报信息不存在
FightReportNotExist = NewResultStatus(-9707, "FightReportNotExist")
// 数据解析错误
JsonDecodeDataError = NewResultStatus(-9708, "JsonDecodeDataError")
)
// 喜信
var (
// 信息Id错误
HappyNewsIdError = NewResultStatus(-40103, "HappyNewsIdError")
// 信息序号错误
HappyNewsOrderIdError = NewResultStatus(-40104, "HappyNewsOrderIdError")
// 喜信获取好友失败
HappyNewsGetFriendsError = NewResultStatus(-40105, "HappyNewsGetFriendsError")
// 没有好友
NoFriend = NewResultStatus(-8565, "NoFriend")
)
// 仙盟远征
var (
// 仙盟远征错误
GuildExpeditionError = NewResultStatus(-29900, "GuildExpeditionError")
// 仙盟远征活动未开启
GuildExpeditionActivityNotOpen = NewResultStatus(-29906, "GuildExpeditionActivityNotOpen")
// 仙盟远征公会未匹配
GuildExpeditionGuildNotMatch = NewResultStatus(-29908, "GuildExpeditionGuildNotMatch")
// 仙盟远征阵容无法解析
GuildExpeditionFormationUnknow = NewResultStatus(-29909, "GuildExpeditionFormationUnknow")
// 仙盟远征房间信息不存在
GuildExpeditionRoomInfoError = NewResultStatus(-29912, "GuildExpeditionRoomInfoError")
// 仙盟远征阶段一挑战次数不足
GuildExpeditionFirstStepTimesIsNotEnough = NewResultStatus(-29913, "GuildExpeditionfirstStepTimesIsNotEnough")
// 仙盟远征阶段一挑战次数不足
GuildExpeditionSecondStepTimesIsNotEnough = NewResultStatus(-29914, "GuildExpeditionSecondStepTimesIsNotEnough")
// 仙盟远征房间已锁定
GuildExpeditionRoomIsLock = NewResultStatus(-29915, "GuildExpeditionRoomIsLock")
// 不是参与远征的仙盟成员
GuildExpeditionIsNotJoinMember = NewResultStatus(-29916, "GuildExpeditionIsNotJoinMember")
// 目标没有防御阵容
GuildExpeditionTargetNoDefenceFormation = NewResultStatus(-29917, "GuildExpeditionTargetNoDefenceFormation")
// 仙盟远征战斗验证失败
GuildExpeditionFightValidFail = NewResultStatus(-29918, "GuildExpeditionFightValidFail")
)
// 义结金兰
var (
// 玩家未结交标记g_yjjl对象
YjjlPlayerNotExist = NewResultStatus(-33501, "YjjlPlayerNotExist")
// 玩家未结义标记g_yjjl_player对象
YjjlPlayerNotExistForPlayer = NewResultStatus(-33588, "YjjlPlayerNotExistForPlayer")
// 玩家未结义,标记玩家对象属于第三者
YjjlPlayerNotMatch = NewResultStatus(-33589, "YjjlPlayerNotMatch")
// 玩家已结交
YjjlPlayerHasExist = NewResultStatus(-33502, "YjjlPlayerHasExist")
// 玩家已设置本特效
QingyiLvSpecialeffectsIsExists = NewResultStatus(-33515, "QingyiLvSpecialeffectsIsExists")
// 亲密付已达月上限
HelpPayIsLimit = NewResultStatus(-33571, "HelpPayIsLimit")
// 玩家当前未培养花卉
FlowerNotExist = NewResultStatus(-33523, "FlowerNotExist")
// 玩家当前花卉经验值已满
FlowerExpIsMax = NewResultStatus(-33524, "FlowerExpIsMax")
// 玩家当前花卉经验值未满
FlowerExpNotEnough = NewResultStatus(-33525, "FlowerExpNotEnough")
// 玩家已培养花卉
FlowerIsExists = NewResultStatus(-33530, "FlowerIsExists")
// 培养的花卉不匹配
FlowerNotMatch = NewResultStatus(-33531, "FlowerNotMatch")
// 花卉可收获,不能重置
FlowerCanGet = NewResultStatus(-33532, "FlowerCanGet")
// 同心榜CP组唯一标识错误
RankGroupIdError = NewResultStatus(-33541, "RankGroupIdError")
// 暂无留言
RankTipNotExists = NewResultStatus(-33542, "RankTipNotExists")
// 结交好友匹配错误
RankCpMatchError = NewResultStatus(-33544, "RankCpMatchError")
// 留言点赞和玩家结义数据不匹配
RankCpMessageZanNotMatch = NewResultStatus(-33545, "RankCpMessageZanNotMatch")
// 该玩家今日已点赞!
PlayerGood = NewResultStatus(-212301, "PlayerGood")
// 义结金兰没有任务数据
YjjlTaskNoData = NewResultStatus(-33547, "YjjlTaskNoData")
// 金兰契奖励节点错误
YjjlRewardNodeError = NewResultStatus(-33568, "YjjlRewardNodeError")
// 亲密等级不足
IntimacyLvNotEnough = NewResultStatus(-33569, "IntimacyLvNotEnough")
// 活动期间获取的亲密度不足
AddIntimacyNotEnough = NewResultStatus(-33583, "活动期间获取的亲密度不足")
// 亲密度奖励已经领取
HasAddIntimacyReward = NewResultStatus(-33584, "亲密度奖励已经领取")
// 亲密等级不足,未解锁
YjjlShowIsLock = NewResultStatus(-33586, "亲密等级不足,未解锁")
// 活动还没结束
TimedActivityNotClose = NewResultStatus(-2006, "活动还没结束")
)
// 蜀山之巅(跨服Pvp冠军赛)
var (
// 赛季未开启
WeekChampionSeasonNotOpen = NewResultStatus(-4000, "WeekChampionSeasonNotOpen")
// 赛季分组数据不存在
WeekChampionNoExistGroupMatch = NewResultStatus(-4007, "WeekChampionNoExistGroupMatch")
// 跨服蜀山之巅竞猜玩家错误
WeekChampionBetPlayerError = NewResultStatus(-4008, "WeekChampionBetPlayerError")
// 战报信息不存在
WeekChampionFightReportNotExist = NewResultStatus(-4009, "WeekChampionFightReportNotExist")
// 战报信息解析错误
WeekChampionFightReportJsonDecodeDataError = NewResultStatus(-4010, "WeekChampionFightReportJsonDecodeDataError")
)
var (
// SocialSquareGiftNotExist 礼物不存在
SocialSquareGiftNotExist = NewResultStatus(-40400, "SocialSquareGiftNotExist")
// SocialSquarePlayerNotExist 社交广场玩家不存在
SocialSquarePlayerNotExist = NewResultStatus(-40401, "SocialSquarePlayerNotExist")
// SocialSquarePhotoNotExist 社交广场玩家不存在
SocialSquarePhotoNotExist = NewResultStatus(-40402, "SocialSquarePhotoNotExist")
)
var (
// 模块错误
VideoModuleError = NewResultStatus(-38183, "VideoModuleError")
// 未检测到该战报
VideoIdError = NewResultStatus(-38184, "VideoIdError")
)
var (
// 金兰宴玩家对象不是举办方
YjjlFeastIsNotHost = NewResultStatus(-44108, "YjjlFeastIsNotHost")
// 宴会还在准备中
YjjlFeastIsPreraring = NewResultStatus(-44111, "YjjlFeastIsPreraring")
// 金兰宴宴会已开始
YjjlFeastRandomIsStart = NewResultStatus(-44112, "YjjlFeastRandomIsStart")
// 金兰宴房间类型错误
YjjlFeastRoomTypeError = NewResultStatus(-44116, "YjjlFeastRoomTypeError")
// 金兰宴房间不存在
YjjlFeastRoomNotExist = NewResultStatus(-44118, "YjjlFeastRoomNotExist")
// 金兰宴玩家不能加入该房间
YjjlFeastPlayerCantEnterThisRoom = NewResultStatus(-44119, "YjjlFeastPlayerCantEnterThisRoom")
// 金兰宴玩家不能同时主办两场及以上的宴会
YjjlFeastHostBuySamePlayer = NewResultStatus(-44120, "YjjlFeastHostBuySamePlayer")
// 金兰宴宾客人数达到上限
YjjlFeastRoomGuestMax = NewResultStatus(-44121, "YjjlFeastRoomGuestMax")
// 金兰宴玩家不在房间
YjjlFeastIsNotInScene = NewResultStatus(-44122, "YjjlFeastIsNotInScene")
// 金兰宴不是来宾
YjjlFeastIsHost = NewResultStatus(-44123, "YjjlFeastIsHost")
// 金兰宴红包不存在
YjjlFeastRedPacketNotExist = NewResultStatus(-44124, "YjjlFeastRedPacketNotExist")
// 金兰宴红包已领取或已领完
YjjlFeastRedPacketHadDraw = NewResultStatus(-44125, "YjjlFeastRedPacketHadDraw")
)
var (
// 全服红包id错误
RedPacketIdError = NewResultStatus(-40501, "RedPacketIdError")
// 全服红包已经领取完
RedPacketHaveOver = NewResultStatus(-40502, "RedPacketHaveOver")
// 全服红包不可领取
RedPacketCanNotDraw = NewResultStatus(-40503, "RedPacketCanNotDraw")
// 已经领取该红包
RedPacketHaveDraw = NewResultStatus(-40504, "RedPacketHaveDraw")
// 红包领取失败
RedPacketDrawError = NewResultStatus(-40505, "RedPacketDrawError")
)
// 跨服昆仑神虚
var (
// 昆仑之墟尚未开启
GlobalCitywarMapNotOpen = NewResultStatus(-45003, "昆仑之墟尚未开启")
// 仙盟未参与
CitywarCsGuildNotParticipate = NewResultStatus(-50000, "CitywarCsGuildNotParticipate")
// 跨服昆仑神虚地图不存在
CitywarCsMapNotExist = NewResultStatus(-50001, "CitywarCsMapNotExist")
// 跨服昆仑神虚城池不存在
CitywarCsLandNotExist = NewResultStatus(-50002, "CitywarCsLandNotExist")
// 跨服昆仑神虚城池未占领
CitywarCsLandNotOccupy = NewResultStatus(-50003, "CitywarCsLandNotOccupy")
// 跨服昆仑神虚城池正在战斗中
CitywarCsLandIsFighting = NewResultStatus(-50004, "CitywarCsLandIsFighting")
// 昆仑之墟节点坐标不匹配
CitywarCsAxisNotRight = NewResultStatus(-50011, "CitywarCsAxisNotRight")
// 昆仑之墟玩家队伍不存在
CitywarCsPlayerTeamNotExist = NewResultStatus(-50012, "CitywarCsPlayerTeamNotExist")
// 昆仑之墟玩家队伍复活中
CitywarCsPlayerTeamReviving = NewResultStatus(-50013, "CitywarCsPlayerTeamReviving")
// 昆仑之墟玩家已派遣
CitywarCsPlayerTeamIsMoving = NewResultStatus(-50014, "CitywarCsPlayerTeamIsMoving")
// 昆仑之墟玩家未派遣
CitywarCsPlayerTeamNoMoving = NewResultStatus(-50015, "CitywarCsPlayerTeamNoMoving")
// 昆仑之墟玩家玩家队伍已经死亡
CitywarCsTeamIdDead = NewResultStatus(-50016, "CitywarCsTeamIdDead")
// 没有奖励可以领取
CitywarCsNotDrawReward = NewResultStatus(-50017, "CitywarCsNotDrawReward")
// 昆仑之墟休战中
CitywarCsNotFightTime = NewResultStatus(-50018, "CitywarCsNotFightTime")
// 昆仑之墟已经结束
CitywarCsIsEnd = NewResultStatus(-50019, "CitywarCsIsEnd")
// 玩家昆仑之墟出征次数不足
CitywarCsFightNumNotEnough = NewResultStatus(-50020, "CitywarCsFightNumNotEnough")
// 昆仑之墟出生地无法操作
CitywarCsLandIsBirth = NewResultStatus(-50021, "CitywarCsLandIsBirth")
// 昆仑之墟队伍已放入仙盟大营中
CitywarCsPlayerTeamInGuildTeam = NewResultStatus(-50022, "CitywarCsPlayerTeamInGuildTeam")
// 昆仑之墟队伍不在仙盟大营中
CitywarCsPlayerTeamNotInGuildTeam = NewResultStatus(-50023, "CitywarCsPlayerTeamNotInGuildTeam")
// 昆仑神墟未选择仙盟大营中队伍
CitywarCsGuildTeamNotExist = NewResultStatus(-50024, "CitywarCsGuildTeamNotExist")
// 昆仑神墟地块正在燃烧
CitywarCsLandIsFire = NewResultStatus(-50025, "CitywarCsLandIsFire")
// 非相邻地不允许攻击
CitywarCsLandNotAdjoinNotAtk = NewResultStatus(-50027, "CitywarCsLandNotAdjoinNotAtk")
)
var (
// 巅峰对决信息不存在
PeakInfoNotExist = NewResultStatus(-40804, "PeakInfoNotExist")
// 该位置不是空位置
PeakRankNotEmpty = NewResultStatus(-40805, "PeakRankNotEmpty")
// 不能挑战低于自己的对手
PeakCantFight = NewResultStatus(-40806, "PeakCantFight")
// 排位已经变化
PeakNeedRefresh = NewResultStatus(-40808, "PeakNeedRefresh")
// 当前排名不可挑战,挑战列表已刷新
PeakNeedRefreshTwo = NewResultStatus(-40814, "PeakNeedRefreshTwo")
// 不可挑战前三
PeakCantFightTopThree = NewResultStatus(-40815, "PeakCantFightTopThree")
)
// 蜀山论剑PvpTournament
var (
// 玩家信息不存在
PvpTournamentInfoNotExist = NewResultStatus(-40901, "PvpTournamentInfoNotExist")
// 玩家未找到阵容
PvpTournamentFormationNotExist = NewResultStatus(-40902, "PvpTournamentFormationNotExist")
// 排位已经变化
PvpTournamentNeedRefresh = NewResultStatus(-40903, "PvpTournamentNeedRefresh")
// 不能挑战太靠前的玩家
PvpTournamentCantFight = NewResultStatus(-40907, "PvpTournamentCantFight")
)
// 幸运彩卡luckyCard
var (
// 幸运彩卡奖励配置不存在
LuckyCardRewardConfigNotExist = NewResultStatus(-42610, "LuckyCardRewardConfigNotExist")
// 幸运彩卡奖励不足
LuckyCardRewardNotEnough = NewResultStatus(-42611, "LuckyCardRewardNotEnough")
// 幸运彩卡青钻奖励不足
LuckyCardRewardQingzuanNotEnough = NewResultStatus(-42612, "LuckyCardRewardQingzuanNotEnough")
// 用户青钻额度不足
LuckyCardQingzuanNotEnough = NewResultStatus(-42613, "LuckyCardQingzuanNotEnough")
// 交换信息不存在
LuckyCardExchangeMessageNotExist = NewResultStatus(-42615, "LuckyCardExchangeMessageNotExist")
)
// 新版金兰宴
var (
// NewFeastHaveAppointment 已经预约过
NewFeastHaveAppointment = NewResultStatus(-41101, "NewFeastHaveAppointment")
// NewFeastAppointmentTimeOut 时间已过
NewFeastAppointmentTimeOut = NewResultStatus(-41102, "NewFeastAppointmentTimeOut")
// NotAppointment 没有预约
NewFeastNotAppointment = NewResultStatus(-41103, "NewFeastNotAppointment")
// NewFeastHaveInvite 已经邀请
NewFeastHaveInvite = NewResultStatus(-41104, "NewFeastHaveInvite")
// NewFeastAppointmentOverdue 宴会已过期
NewFeastAppointmentOverdue = NewResultStatus(-41105, "NewFeastAppointmentOverdue")
// 金兰宴房间不存在
NewFeastRoomNotExist = NewResultStatus(-41106, "NewFeastRoomNotExist")
// 金兰宴玩家不存在
NewFeastPlayerNotInRoom = NewResultStatus(-41107, "NewFeastPlayerNotInRoom")
// 金兰宴对方玩家不存在
NewFeastTargetPlayerPlayerNotInRoom = NewResultStatus(-41108, "NewFeastTargetPlayerPlayerNotInRoom")
// 道具已被抢
NewFeastPropBeRobbed = NewResultStatus(-41109, "NewFeastPropBeRobbed")
// 变身球数量不足
NewFeastBallNotEnough = NewResultStatus(-41110, "NewFeastBallNotEnough")
// 已拥有烟花
NewFeastHaveFirework = NewResultStatus(-41111, "NewFeastHaveFirework")
// 宴会已结束
NewFeastEnd = NewResultStatus(-41112, "NewFeastEnd")
// 已经品菜过了
NewFeastHaveEatFood = NewResultStatus(-41113, "NewFeastHaveEatFood")
// 不在品菜时间内
NewFeastNotEatFoodTime = NewResultStatus(-41114, "NewFeastNotEatFoodTime")
// 房间人气不足
NewFeastRoomPopularNotEnough = NewResultStatus(-41115, "NewFeastRoomPopularNotEnough")
// 密码不正确
NewFeastBoxPasswordError = NewResultStatus(-41116, "NewFeastBoxPasswordError")
// 不是房主
NewFeastNotHsot = NewResultStatus(-41117, "NewFeastNotHsot")
// 已经领取
NewFeastBoxHaveDraw = NewResultStatus(-41118, "NewFeastBoxHaveDraw")
// 房间人数已满
NewFeastRoomPlayerMax = NewResultStatus(-41119, "NewFeastRoomPlayerMax")
// 不能邀请
NewFeastCantInvite = NewResultStatus(-41120, "NewFeastCantInvite")
// 被其他人预约
NewFeastAppointmentByOthers = NewResultStatus(-41121, "NewFeastAppointmentByOthers")
)
// NoWorldBossDamageData 世界boss1.0
var (
NoWorldBossDamageData = NewResultStatus(-41200, "NoWorldBossDamageData")
)
var (
// 拍卖行商品不存在
AuctionGoodsNotExist = NewResultStatus(-41301, "AuctionGoodsNotExist")
// 拍卖行加价失败
AuctionAddPriceErr = NewResultStatus(-41302, "AuctionAddPriceErr")
// 仙盟拍卖暂无商品
AuctionGuildNoGoods = NewResultStatus(-41303, "AuctionGuildNoGoods")
// 仙盟拍卖未结束
AuctionGuildNotEnd = NewResultStatus(-41304, "AuctionGuildNotEnd")
// 分红已经领取
AuctionBonusHaveDraw = NewResultStatus(-41305, "AuctionBonusHaveDraw")
// 暂无分红
AuctionNoBonus = NewResultStatus(-41306, "AuctionNoBonus")
// 不能取消关注
AuctionCantCancelFollow = NewResultStatus(-41307, "AuctionCantCancelFollow")
// 拍卖未开始
AuctionNotStart = NewResultStatus(-41308, "AuctionNotStart")
// 该商品已经售出
AuctionGoodsHaveAuction = NewResultStatus(-41309, "AuctionGoodsHaveAuction")
// 该商品已经流拍
AuctionGoodsHaveNoPrice = NewResultStatus(-41310, "AuctionGoodsHaveNoPrice")
// 玩家金龙不足
AuctionPlayerGoldNotEnough = NewResultStatus(-41311, "AuctionPlayerGoldNotEnough")
//该商品拍卖时间已结束
AuctionGoodsEnd = NewResultStatus(-41312, "AuctionGoodsEnd")
//未参与决战神虚,不可分红
AuctionCantBonus = NewResultStatus(-41313, "AuctionCantBonus")
)
var (
// 交易行商品不存在
TradeProductNotExistInfoNotExist = NewResultStatus(-41500, "TradeProductNotExistInfoNotExist")
// 交易行审核类型不存在
TradeAuditTypeNotExist = NewResultStatus(-41501, "TradeAuditTypeNotExist")
)

View File

@@ -7,7 +7,8 @@ import (
type StatusCode int
// ResultStatus
// @description: 状态码数据
//
// @description: 状态码数据
type ResultStatus struct {
// 状态码
code StatusCode
@@ -17,31 +18,46 @@ type ResultStatus struct {
}
// Code
// @description: 状态码
//
// @description: 状态码
//
// parameter:
//
// @receiver this: this
//
// return:
//
// @StatusCode: 状态码
func (this *ResultStatus) Code() StatusCode {
return this.code
}
// Message
// @description: 错误信息
//
// @description: 错误信息
//
// parameter:
//
// @receiver this: this
//
// return:
//
// @string:
func (this *ResultStatus) Message() string {
return this.message
}
// NewResultStatus
// @description: 创建新的状态码对象
//
// @description: 创建新的状态码对象
//
// parameter:
//
// @_code: 错误码
// @_message: 提示消息
//
// return:
//
// @ResultStatus: 状态码对象
func NewResultStatus(_code StatusCode, _message string) ResultStatus {
return ResultStatus{
@@ -51,20 +67,30 @@ func NewResultStatus(_code StatusCode, _message string) ResultStatus {
}
// IsSuccess
// @description: 是否是成功
//
// @description: 是否是成功
//
// parameter:
//
// @receiver this: this
//
// return:
//
// @bool: true:成功 false:失败
func (this *ResultStatus) IsSuccess() bool {
return this.code == Success.Code()
}
// String
// @description: 打印状态码信息
//
// @description: 打印状态码信息
//
// parameter:
//
// @receiver this: this
//
// return:
//
// @string: 状态码信息
func (this *ResultStatus) String() string {
return fmt.Sprintf("Code:%d,Message:%s", this.code, this.message)

View File

@@ -0,0 +1,105 @@
package resultStatus
// 系统错误码
var (
// 成功
Success = NewResultStatus(0, "Success")
// 数据库错误
DBError = NewResultStatus(-2, "DBError")
// 方法未定义
MethodNotDefined = NewResultStatus(-3, "MethodNotDefined")
// 参数无效
ParamInValid = NewResultStatus(-4, "ParamInValid")
// 参数不匹配
ParamNotMatch = NewResultStatus(-5, "ParamNotMatch")
// 功能未开启
ModuleNotOpen = NewResultStatus(-6, "ModuleNotOpen")
// 只支持Post
OnlySupportPOST = NewResultStatus(-7, "OnlySupportPOST")
// API未定义
APINotDefined = NewResultStatus(-8, "APINotDefined")
// API数据错误
APIDataError = NewResultStatus(-9, "APIDataError")
// API参数错误
APIParamError = NewResultStatus(-10, "APIParamError")
// IP被禁用
IPForbid = NewResultStatus(-11, "IPForbid")
// 没有有效的服务器
NoAvailableServer = NewResultStatus(-12, "NoAvailableServer")
// 服务器组不存在
ServerGroupNotExists = NewResultStatus(-13, "ServerGroupNotExists")
// 测试接口只能debug下调用
DebugInterface = NewResultStatus(-14, "DebugInterface")
// 模块不存在
ModuleNotExists = NewResultStatus(-15, "ModuleNotExists")
// 未能找到指定方法
NotSpecificMethod = NewResultStatus(-16, "NotSpecificMethod")
// 非指定区域
NotMatchRegion = NewResultStatus(-17, "NotMatchRegion")
// 发送空数据
SendNullData = NewResultStatus(-18, "SendNullData")
// 序列化失败
MarshalDataError = NewResultStatus(-19, "MarshalDataError")
//未登录
NotLogin = NewResultStatus(-20, "NotLogin")
// 数据错误
DataError = NewResultStatus(-31, "DataError")
// 战区合并维护中,敬请期待
MergeDataRunning = NewResultStatus(-67, "MergeDataRunning")
// 下载器内容未配置
QcDownloadConfigNotExists = NewResultStatus(-68, "QcDownloadConfigNotExists")
// 下载器奖励已领取
QcDownloadHasReward = NewResultStatus(-69, "QcDownloadHasReward")
// 下载器奖励没有奖励可领取
QcDownloadNotReward = NewResultStatus(-70, "QcDownloadNotReward")
// 下载器奖励积分不足
QcDownloadNotScore = NewResultStatus(-71, "QcDownloadNotScore")
)
// 微信登录
var (
RequestError = NewResultStatus(-60001, "WrongRequeststatus")
EmptyResp = NewResultStatus(-60002, "The result is empty")
UnmarshalError = NewResultStatus(-60003, "Unmarshal is error")
)
// 玩家
var (
// 玩家不存在
PlayerNotExist = NewResultStatus(-1110, "PlayerNotExist")
// 没有合适的玩家
NotSuitablePlayer = NewResultStatus(-1155, "NotSuitablePlayer")
// 玩家阵容不存在
PlayerSlotFormationNotExist = NewResultStatus(-1156, "PlayerSlotFormationNotExist")
//玩家已经下线
PlayerIsLoginOut = NewResultStatus(-1157, "PlayerIsLoginOut")
)

View File

@@ -7,7 +7,7 @@ import (
"goutil/logUtilPlus"
"goutil/typeUtil"
"goutil/zlibUtil"
"io/ioutil"
"io"
"net/http"
)
@@ -72,7 +72,7 @@ func (this *ApiContext) readContent(isZlib bool) (content []byte, err error) {
var buffer []byte
defer this.request.Body.Close()
if buffer, err = ioutil.ReadAll(this.request.Body); err != nil {
if buffer, err = io.ReadAll(this.request.Body); err != nil {
logUtilPlus.ErrorLog(fmt.Sprintf("url:%s,读取数据出错,错误信息为:%s", this.request.RequestURI, err))
return
}
@@ -80,7 +80,7 @@ func (this *ApiContext) readContent(isZlib bool) (content []byte, err error) {
// 不压缩,则直接返回
if isZlib == false {
this.requestBytes = buffer
logUtilPlus.ErrorLog(fmt.Sprintf("buffer=%v", buffer))
return buffer, err
}

View File

@@ -79,7 +79,7 @@ func (this *ApiHandler) FuncParamNames() []string {
//
// return:
//
// @resultStatus.ResultStatus: 状态码数据
// @resultstatus.ResultStatus: 状态码数据
func (this *ApiHandler) CheckParam(r *http.Request) resultStatus.ResultStatus {
for _, name := range this.funcParamNames {
if r.Form[name] == nil || len(r.Form[name]) == 0 {

View File

@@ -15,20 +15,28 @@ var (
)
// RegisterRemarkFunc
// @description: 注册文档api方法
//
// @description: 注册文档api方法
//
// parameter:
//
// @_remarkFunc: _remarkFunc
//
// return:
func RegisterRemarkFunc(_remarkFunc func(w http.ResponseWriter, r *http.Request)) {
remarkFunc = _remarkFunc
}
// RegisterHandleFunc
// @description: 注册处理方法
//
// @description: 注册处理方法
//
// parameter:
//
// @apiName: API名称
// @callback: 回调方法
// @paramNames: 参数名称集合
//
// return:
func RegisterHandleFunc(apiName string, callback HandleFunc, paramNames ...string) {
apiFullName := fmt.Sprintf("/API/%s", apiName)
@@ -41,10 +49,15 @@ func RegisterHandleFunc(apiName string, callback HandleFunc, paramNames ...strin
}
// GetHandleFunc
// @description: 获取请求方法
//
// @description: 获取请求方法
//
// parameter:
//
// @apiFullName: 方法名称
//
// return:
//
// @*ApiHandler: 请求方法
// @bool: 是否存在
func GetHandleFunc(apiFullName string) (*ApiHandler, bool) {

View File

@@ -5,7 +5,8 @@ import (
)
// methodAndInOutTypes
// @description: 反射的方法和输入、输出参数类型组合类型
//
// @description: 反射的方法和输入、输出参数类型组合类型
type methodAndInOutTypes struct {
// 反射出来的对应方法对象
Method reflect.Value
@@ -18,12 +19,17 @@ type methodAndInOutTypes struct {
}
// newmethodAndInOutTypes
// @description: newmethodAndInOutTypes
//
// @description: newmethodAndInOutTypes
//
// parameter:
//
// @_method: _method
// @_inTypes: _inTypes
// @_outTypes: _outTypes
//
// return:
//
// @*methodAndInOutTypes: methodAndInOutTypes
func newmethodAndInOutTypes(_method reflect.Value, _inTypes []reflect.Type, _outTypes []reflect.Type) *methodAndInOutTypes {
return &methodAndInOutTypes{

View File

@@ -1,7 +1,8 @@
package webServer
// RequestObject
// @description: 请求对象
//
// @description: 请求对象
type RequestObject struct {
// 以下属性是由客户端直接传入的,可以直接反序列化直接得到的
// 请求的模块名称
@@ -15,12 +16,17 @@ type RequestObject struct {
}
// NewRequestObject
// @description: NewRequestObject
//
// @description: NewRequestObject
//
// parameter:
//
// @_ModuleName: _ModuleName
// @_MethodName: _MethodName
// @_Parameters: _Parameters
//
// return:
//
// @*RequestObject: RequestObject
func NewRequestObject(_ModuleName string, _MethodName string, _Parameters []interface{}) *RequestObject {
return &RequestObject{

View File

@@ -115,6 +115,13 @@ func (mux *selfDefineMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
params = append([]interface{}{tokenData.UserInfo}, params...)
}
//是否需要请求信息
if IsNeedGetRequestInfo(strs[0], strs[1]) {
//添加请求信息到最后一个参数
params = append(params, r)
}
resquestData := NewRequestObject(strs[0], strs[1], params)
resp := CallFunction(resquestData)
if isJson {

View File

@@ -14,6 +14,9 @@ var (
//跳过验证token的页面
skipVerifyTokenPage = make(map[string]bool)
//需要获取请求信息
needGetRequestInfo = make(map[string]bool)
)
type TokenInfo struct {
@@ -97,10 +100,12 @@ func CheckToken(token int64) (bool, *TokenInfo) {
return true, tokenInfo
}
// AddSkipVerifyTokenPage 添加跳过验证token的页面
func AddSkipVerifyTokenPage(moduleName, methodName string) {
skipVerifyTokenPage[moduleName+"_"+methodName] = true
}
// IsSkipVerifyTokenPage 判断是否跳过验证token的页面
func IsSkipVerifyTokenPage(moduleName, methodName string) bool {
exist, ok := skipVerifyTokenPage[moduleName+"_"+methodName]
if !exist {
@@ -108,3 +113,17 @@ func IsSkipVerifyTokenPage(moduleName, methodName string) bool {
}
return ok
}
// AddNeedGetRequestInfo 添加需要获取请求信息的页面
func AddNeedGetRequestInfo(moduleName, methodName string) {
needGetRequestInfo[moduleName+"_"+methodName] = true
}
// IsNeedGetRequestInfo 判断是否需要获取请求信息的页面
func IsNeedGetRequestInfo(moduleName, methodName string) bool {
exist, ok := needGetRequestInfo[moduleName+"_"+methodName]
if !exist {
return false
}
return ok
}