大量优化

This commit is contained in:
flswld
2023-01-05 01:29:00 +08:00
parent f991480192
commit 27f16d9063
226 changed files with 2651 additions and 2484 deletions

View File

@@ -1,8 +1,8 @@
package api
type ComboTokenReq struct {
AppID int `json:"app_id"`
ChannelID int `json:"channel_id"`
AppID any `json:"app_id"`
ChannelID any `json:"channel_id"`
Data string `json:"data"`
Device string `json:"device"`
Sign string `json:"sign"`

View File

@@ -1,6 +1,6 @@
package api
type ComboTokenRes struct {
type ComboTokenRsp struct {
Message string `json:"message"`
Retcode int `json:"retcode"`
Data LoginData `json:"data"`
@@ -16,8 +16,8 @@ type LoginData struct {
FatigueRemind any `json:"fatigue_remind"`
}
func NewComboTokenRes() (r *ComboTokenRes) {
r = &ComboTokenRes{
func NewComboTokenRsp() (r *ComboTokenRsp) {
r = &ComboTokenRsp{
Message: "",
Retcode: 0,
Data: LoginData{

View File

@@ -44,21 +44,25 @@ func (c *Controller) getClientVersionByName(versionName string) (int, string) {
}
versionSlice := reg.FindAllString(versionName, -1)
version := 0
for index := 0; index < len(versionSlice); index++ {
v, err := strconv.Atoi(versionSlice[index])
for index, value := range versionSlice {
v, err := strconv.Atoi(value)
if err != nil {
logger.Error("parse client version error: %v", err)
return 0, ""
}
for i := 0; i < len(versionSlice)-1-index; i++ {
if v >= 10 {
// 测试版本
if index != 2 {
logger.Error("invalid client version")
return 0, ""
}
v /= 10
}
for i := 0; i < 2-index; i++ {
v *= 10
}
version += v
}
if version >= 1000 {
// 测试版本
version /= 10
}
return version, strconv.Itoa(version)
}

View File

@@ -208,7 +208,7 @@ func (c *Controller) v2Login(context *gin.Context) {
logger.Error("ParseInt uid error: %v", err)
return
}
responseData := api.NewComboTokenRes()
responseData := api.NewComboTokenRsp()
account, err := c.dao.QueryAccountByField("accountID", uid)
if account == nil || account.Token != loginData.Token {
responseData.Retcode = -201