Commit b5595dac3a23741a467d59ebdc38b9198dc2aa99
1 parent
9cb5482f
Exists in
master
and in
4 other branches
提交修改数据的测试接口
Showing
1 changed file
with
25 additions
and
3 deletions
Show diff stats
src/HttpServer/logic/httpserver.go
| ... | ... | @@ -107,8 +107,10 @@ func Querysigndata(w http.ResponseWriter, r *http.Request) { |
| 107 | 107 | func Testapi(w http.ResponseWriter, r *http.Request) { |
| 108 | 108 | |
| 109 | 109 | type TesaApiData struct { |
| 110 | - Type int `json:"type"` //1金币 2经验 3存钱罐次数 | |
| 111 | - Value int `json:"value"` | |
| 110 | + Type int `json:"type"` //1金币 2经验 3存钱罐次数 | |
| 111 | + Value int `json:"value"` | |
| 112 | + Gameid string `json:"gameid"` | |
| 113 | + Channel string `json:"channel"` | |
| 112 | 114 | } |
| 113 | 115 | Uuid := 0 |
| 114 | 116 | if len(r.Header) > 0 { |
| ... | ... | @@ -126,7 +128,7 @@ func Testapi(w http.ResponseWriter, r *http.Request) { |
| 126 | 128 | s := string(result) |
| 127 | 129 | logger.Info("Querysigndata , body:%v,uuid=%v", s, Uuid) |
| 128 | 130 | |
| 129 | - var rdata GettaskrewardReq | |
| 131 | + var rdata TesaApiData | |
| 130 | 132 | err := json.Unmarshal([]byte(s), &rdata) |
| 131 | 133 | |
| 132 | 134 | if err != nil { |
| ... | ... | @@ -142,6 +144,26 @@ func Testapi(w http.ResponseWriter, r *http.Request) { |
| 142 | 144 | return |
| 143 | 145 | } |
| 144 | 146 | |
| 147 | + if rdata.Type == 1 { | |
| 148 | + //金币 | |
| 149 | + uinfo.RealGold += rdata.Value | |
| 150 | + //调用sdk | |
| 151 | + //AddCoinToSdk() | |
| 152 | + } | |
| 153 | + if rdata.Type == 2 { | |
| 154 | + uinfo.Exp += rdata.Value | |
| 155 | + } | |
| 156 | + if rdata.Type == 3 { | |
| 157 | + uinfo.GetFromGuanCnt += rdata.Value | |
| 158 | + } | |
| 159 | + if rdata.Type == 4 { | |
| 160 | + uinfo.Lv += rdata.Value | |
| 161 | + } | |
| 162 | + err = SaveUserInfo(uinfo) | |
| 163 | + if err != nil { | |
| 164 | + logger.Error("SaveUserInfo err=%v", err) | |
| 165 | + } | |
| 166 | + fmt.Fprint(w, "success") | |
| 145 | 167 | } |
| 146 | 168 | |
| 147 | 169 | func Getnewlevelreward(w http.ResponseWriter, r *http.Request) { | ... | ... |