diff --git a/bin/mailserver/config/config.json b/bin/mailserver/config/config.json index 738e3fe8..bdadd066 100644 --- a/bin/mailserver/config/config.json +++ b/bin/mailserver/config/config.json @@ -1,4 +1,6 @@ { "secret_key": "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)", - "gameapi_url": "https://game2006api-test.kingsome.cn" + "gameapi_url": "https://game2006api-test.kingsome.cn", + "gm_open": 1, + "gm_secret_key": "Pu6bxRKiS^@pUQdAC!RHMTY^srV5V^4&fqgUs1HjM*LI1sABQDQemU^Mh!55" } diff --git a/server/mailserver/mail/mailmgr.go b/server/mailserver/mail/mailmgr.go index 69916152..a07758d8 100644 --- a/server/mailserver/mail/mailmgr.go +++ b/server/mailserver/mail/mailmgr.go @@ -5,6 +5,7 @@ import ( "f5" "jccommon" "main/common" + "mt" "main/constant" "sync" "fmt" @@ -218,6 +219,24 @@ func (this *mailMgr) CaDeleteMails(c *gin.Context) { } func (this *mailMgr) CaSendMail(c *gin.Context) { + rspObj := struct { + ErrCode int32 `json:"errcode"` + ErrMsg string `json:"errmsg"` + }{} + + key := c.DefaultQuery("key", "") + if mt.Table.Config.GetById(0).GetGmSecretKey() != key { + rspObj.ErrCode = 2 + rspObj.ErrMsg = "is not gm error" + c.JSON(200, rspObj) + return + } + if mt.Table.Config.GetById(0).GetGmOpen() == 0 { + rspObj.ErrCode = 3 + rspObj.ErrMsg = "is not gm open" + c.JSON(200, rspObj) + return + } reqJson := struct { UniKey string `json:"unikey"` Subject string `json:"subject"` @@ -234,10 +253,6 @@ func (this *mailMgr) CaSendMail(c *gin.Context) { }) return } - rspObj := struct { - ErrCode int32 `json:"errcode"` - ErrMsg string `json:"errmsg"` - }{} if reqJson.UniKey == "" { rspObj.ErrCode = 500 diff --git a/server/mailserver/mtb/mtb.auto_gen.go b/server/mailserver/mtb/mtb.auto_gen.go index 567bc5d4..eba10de0 100644 --- a/server/mailserver/mtb/mtb.auto_gen.go +++ b/server/mailserver/mtb/mtb.auto_gen.go @@ -29,6 +29,8 @@ type MailDb struct { type Config struct { gameapi_url string secret_key string + gm_open int32 + gm_secret_key string _flags1_ uint64 _flags2_ uint64 @@ -130,6 +132,22 @@ func (this *Config) HasSecretKey() bool { return (this._flags1_ & (uint64(1) << 2)) > 0 } +func (this *Config) GetGmOpen() int32 { + return this.gm_open +} + +func (this *Config) HasGmOpen() bool { + return (this._flags1_ & (uint64(1) << 3)) > 0 +} + +func (this *Config) GetGmSecretKey() string { + return this.gm_secret_key +} + +func (this *Config) HasGmSecretKey() bool { + return (this._flags1_ & (uint64(1) << 4)) > 0 +} + func (this *MailCluster) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv) @@ -150,4 +168,6 @@ func (this *MailDb) LoadFromKv(kv map[string]interface{}) { func (this *Config) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv) f5.ReadMetaTableField(&this.secret_key, "secret_key", &this._flags1_, 2, kv) + f5.ReadMetaTableField(&this.gm_open, "gm_open", &this._flags1_, 3, kv) + f5.ReadMetaTableField(&this.gm_secret_key, "gm_secret_key", &this._flags1_, 4, kv) } diff --git a/server/mailserver/proto/mt.proto b/server/mailserver/proto/mt.proto index 4ff7d200..50d54347 100644 --- a/server/mailserver/proto/mt.proto +++ b/server/mailserver/proto/mt.proto @@ -24,4 +24,6 @@ message Config { optional string gameapi_url = 1; optional string secret_key = 2; + optional int32 gm_open = 3; + optional string gm_secret_key = 4; }