This commit is contained in:
aozhiwei 2024-07-06 16:32:29 +08:00
parent 07391e4440
commit b9a8208c1e
4 changed files with 44 additions and 5 deletions

View File

@ -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"
}

View File

@ -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

View File

@ -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)
}

View File

@ -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;
}