diff --git a/src/HttpServer/logic/httpserver.go b/src/HttpServer/logic/httpserver.go index 0586bbf..50509ae 100644 --- a/src/HttpServer/logic/httpserver.go +++ b/src/HttpServer/logic/httpserver.go @@ -107,8 +107,10 @@ func Querysigndata(w http.ResponseWriter, r *http.Request) { func Testapi(w http.ResponseWriter, r *http.Request) { type TesaApiData struct { - Type int `json:"type"` //1金币 2经验 3存钱罐次数 - Value int `json:"value"` + Type int `json:"type"` //1金币 2经验 3存钱罐次数 + Value int `json:"value"` + Gameid string `json:"gameid"` + Channel string `json:"channel"` } Uuid := 0 if len(r.Header) > 0 { @@ -126,7 +128,7 @@ func Testapi(w http.ResponseWriter, r *http.Request) { s := string(result) logger.Info("Querysigndata , body:%v,uuid=%v", s, Uuid) - var rdata GettaskrewardReq + var rdata TesaApiData err := json.Unmarshal([]byte(s), &rdata) if err != nil { @@ -142,6 +144,26 @@ func Testapi(w http.ResponseWriter, r *http.Request) { return } + if rdata.Type == 1 { + //金币 + uinfo.RealGold += rdata.Value + //调用sdk + //AddCoinToSdk() + } + if rdata.Type == 2 { + uinfo.Exp += rdata.Value + } + if rdata.Type == 3 { + uinfo.GetFromGuanCnt += rdata.Value + } + if rdata.Type == 4 { + uinfo.Lv += rdata.Value + } + err = SaveUserInfo(uinfo) + if err != nil { + logger.Error("SaveUserInfo err=%v", err) + } + fmt.Fprint(w, "success") } func Getnewlevelreward(w http.ResponseWriter, r *http.Request) { -- libgit2 0.21.0