haiwai-common-sdk-go/services/msdk/update_adjustid.go
2023-03-16 20:15:17 +08:00

53 lines
1.5 KiB
Go

package msdk
import (
"crypto/md5"
"fmt"
"golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
"time"
)
type UpdateAdjustIdRequest struct {
*requests.RpcRequest
LongId string `position:"Body" field:"long_id" default:""`
GameId int `position:"Body" field:"game_id" default:"0"`
Username string `position:"Body" field:"username" default:""`
GameSign string `position:"Body" field:"game_sign" default:""`
RegTime int64 `position:"Body" field:"reg_time" default:"0"`
Os string `position:"Body" field:"os" default:""`
AdjustId string `position:"Body" field:"adjust_id" default:""`
ts int64 `position:"Body" field:"ts" default:"0"`
sign string `position:"Body" field:"sign" default:""`
}
func (u *UpdateAdjustIdRequest) MakeSign() {
u.ts = time.Now().Unix()
rawStr := fmt.Sprintf("%d%s%s%d%s", u.GameId, u.LongId, u.Username, u.ts, KEY)
sign := md5.Sum([]byte(rawStr))
u.sign = fmt.Sprintf("%x", sign)
}
type UpdateAdjustIdResponse struct {
*responses.BaseResponse
Ret int `json:"ret"`
Msg string `json:"msg"`
}
func CreateUpdateAdjustIdRequest() (req *UpdateAdjustIdRequest) {
req = &UpdateAdjustIdRequest{
RpcRequest: &requests.RpcRequest{},
}
req.ts = time.Now().Unix()
req.InitWithApiInfo(Host, VERSION, "/updateAdjustId.php")
req.Method = requests.POST
return
}
func CreateUpdateAdjustIdResponse() (resp *UpdateAdjustIdResponse) {
resp = &UpdateAdjustIdResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}