Commit 94b1ac90d5f121a2dea3dc0ecb1edb9f1ce5111c
1 parent
49c764a2
Exists in
master
and in
4 other branches
提交
Showing
3 changed files
with
111 additions
and
10 deletions
Show diff stats
src/HttpServer/logic/datadef.go
@@ -121,6 +121,11 @@ type GetcashResp struct { | @@ -121,6 +121,11 @@ type GetcashResp struct { | ||
121 | Data GetcashData `json:"data"` | 121 | Data GetcashData `json:"data"` |
122 | } | 122 | } |
123 | 123 | ||
124 | +type GetcashrecordReq struct { | ||
125 | + Gameid string `json:"gameid"` | ||
126 | + Channel string `json:"channel"` | ||
127 | +} | ||
128 | + | ||
124 | type GetcashrecordResp struct { | 129 | type GetcashrecordResp struct { |
125 | Code int `json:"code"` | 130 | Code int `json:"code"` |
126 | Message string `json:"message"` | 131 | Message string `json:"message"` |
@@ -250,8 +255,13 @@ type WithDrawList struct { | @@ -250,8 +255,13 @@ type WithDrawList struct { | ||
250 | 255 | ||
251 | //提现记录结构 | 256 | //提现记录结构 |
252 | type WithDrawRecord struct { | 257 | type WithDrawRecord struct { |
253 | - Withdrawtime int `json:"wichdrawtime"` | ||
254 | - Withdrawmoney float32 `json:"withdrawmoney"` | 258 | + Coin int `json:"coin"` |
259 | + Create_time int `json:"create_time"` | ||
260 | + Money int `json:"money"` | ||
261 | + No string `json:"no"` | ||
262 | + Status int `json:"status"` | ||
263 | + Statusmsg string `json:"statusmsg"` | ||
264 | + Typ int `json:"typ"` | ||
255 | } | 265 | } |
256 | 266 | ||
257 | type WithDrawInfo struct { | 267 | type WithDrawInfo struct { |
@@ -337,3 +347,20 @@ type GetCashResp struct { | @@ -337,3 +347,20 @@ type GetCashResp struct { | ||
337 | Code string `json:"code"` | 347 | Code string `json:"code"` |
338 | Msg string `json:"msg"` | 348 | Msg string `json:"msg"` |
339 | } | 349 | } |
350 | + | ||
351 | +type GetCashListDesc struct { | ||
352 | + Sign string `json:"sign"` | ||
353 | + Sign_type string `json:"sign_type"` | ||
354 | + Time_stamp string `json:"time_stamp"` | ||
355 | + Gameid string `json:"gameid"` | ||
356 | + Channel string `json:"channel"` | ||
357 | + Uid int `json:"uid"` | ||
358 | + Start int `json:"start"` | ||
359 | + Number int `json:"number"` | ||
360 | +} | ||
361 | + | ||
362 | +type GetCashListResp struct { | ||
363 | + Code string `json:"code"` | ||
364 | + Msg string `json:"msg"` | ||
365 | + Data []WithDrawRecord `json:"data"` | ||
366 | +} |
src/HttpServer/logic/function.go
@@ -981,3 +981,64 @@ func GetCashFromSDK(uuid int, goldnum int, gameid, channel, openid, nickname, he | @@ -981,3 +981,64 @@ func GetCashFromSDK(uuid int, goldnum int, gameid, channel, openid, nickname, he | ||
981 | } | 981 | } |
982 | return newnum, nil | 982 | return newnum, nil |
983 | } | 983 | } |
984 | + | ||
985 | +func GetCashList(uuid int, gameid string, channel string, start int, number int) (*[]WithDrawRecord, error) { | ||
986 | + var paramlist []string | ||
987 | + var params GetCashListDesc | ||
988 | + params.Sign_type = "md5" | ||
989 | + params.Gameid = gameid | ||
990 | + params.Channel = channel | ||
991 | + params.Uid = uuid | ||
992 | + params.Time_stamp = strconv.Itoa(int(time.Now().Unix())) | ||
993 | + params.Start = start | ||
994 | + params.Number = number | ||
995 | + signtypestr := "md5=" + params.Sign_type | ||
996 | + timestampstr := "time_stamp=" + strconv.Itoa(int(time.Now().Unix())) | ||
997 | + paramgameid := "gameid=" + gameid | ||
998 | + pchannel := "channel=" + channel | ||
999 | + puid := "uid=" + strconv.Itoa(uuid) | ||
1000 | + pstart := "start=" + strconv.Itoa(start) | ||
1001 | + pnumber := "number=" + strconv.Itoa(number) | ||
1002 | + paramlist = append(paramlist, signtypestr) | ||
1003 | + paramlist = append(paramlist, timestampstr) | ||
1004 | + paramlist = append(paramlist, paramgameid) | ||
1005 | + paramlist = append(paramlist, pchannel) | ||
1006 | + paramlist = append(paramlist, puid) | ||
1007 | + paramlist = append(paramlist, pstart) | ||
1008 | + paramlist = append(paramlist, pnumber) | ||
1009 | + | ||
1010 | + sumparam := GettotalParam(paramlist) | ||
1011 | + //加serverkey | ||
1012 | + signsum := sumparam + XIAOXINGXING_SERVERKEYTEST | ||
1013 | + logger.Info("GetCashList sumparam=%v", signsum) | ||
1014 | + | ||
1015 | + //进行hash | ||
1016 | + sign := GetHashValue(signsum) | ||
1017 | + params.Sign = sign | ||
1018 | + | ||
1019 | + bys, err := json.Marshal(¶ms) | ||
1020 | + if err != nil { | ||
1021 | + logger.Error("GetCashList failed=%v", err) | ||
1022 | + return nil, err | ||
1023 | + } | ||
1024 | + res, err := DoHttpPost(bys) | ||
1025 | + if err != nil { | ||
1026 | + logger.Error("GetCashList failed=%v", err) | ||
1027 | + return nil, err | ||
1028 | + } | ||
1029 | + | ||
1030 | + logger.Info("GetCashList res=%v", res) | ||
1031 | + | ||
1032 | + var resp GetCashListResp | ||
1033 | + err = json.Unmarshal([]byte(res), &resp) | ||
1034 | + if err != nil { | ||
1035 | + logger.Error("GetCoinFromSdk failed=%v", err) | ||
1036 | + return nil, err | ||
1037 | + } | ||
1038 | + | ||
1039 | + if resp.Code != "0" { | ||
1040 | + logger.Error("GetCoinFromSdk failed=%v", resp.Msg) | ||
1041 | + return nil, err | ||
1042 | + } | ||
1043 | + return &resp.Data, nil | ||
1044 | +} |
src/HttpServer/logic/logic.go
@@ -9,7 +9,6 @@ import ( | @@ -9,7 +9,6 @@ import ( | ||
9 | "fmt" | 9 | "fmt" |
10 | "net/http" | 10 | "net/http" |
11 | "strconv" | 11 | "strconv" |
12 | - "time" | ||
13 | ) | 12 | ) |
14 | 13 | ||
15 | func HandlerQueryguaninfo(w http.ResponseWriter, data string, uuid int) { | 14 | func HandlerQueryguaninfo(w http.ResponseWriter, data string, uuid int) { |
@@ -167,7 +166,7 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { | @@ -167,7 +166,7 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { | ||
167 | } | 166 | } |
168 | 167 | ||
169 | //需要保存一下提现记录 | 168 | //需要保存一下提现记录 |
170 | - data := new(WithDrawRecord) | 169 | + /*data := new(WithDrawRecord) |
171 | data.Withdrawmoney = rdata.Money | 170 | data.Withdrawmoney = rdata.Money |
172 | data.Withdrawtime = int(time.Now().Unix()) | 171 | data.Withdrawtime = int(time.Now().Unix()) |
173 | err = AddWithDrawList(uuid, data) | 172 | err = AddWithDrawList(uuid, data) |
@@ -176,7 +175,7 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { | @@ -176,7 +175,7 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { | ||
176 | resp.Message = "网络错误" | 175 | resp.Message = "网络错误" |
177 | resp.Code = ERROR_SRV_ERROR | 176 | resp.Code = ERROR_SRV_ERROR |
178 | break | 177 | break |
179 | - } | 178 | + }*/ |
180 | 179 | ||
181 | if info.Isnew == 1 { | 180 | if info.Isnew == 1 { |
182 | uinfo.WithDraw.Cashdata[index].Isnew = 0 | 181 | uinfo.WithDraw.Cashdata[index].Isnew = 0 |
@@ -569,17 +568,31 @@ func HandlerGetcashrecord(w http.ResponseWriter, data string, uuid int) { | @@ -569,17 +568,31 @@ func HandlerGetcashrecord(w http.ResponseWriter, data string, uuid int) { | ||
569 | SetHeader(w) | 568 | SetHeader(w) |
570 | var resp GetcashrecordResp | 569 | var resp GetcashrecordResp |
571 | resp.Code = 0 | 570 | resp.Code = 0 |
571 | + var rdata GetcashrecordReq | ||
572 | + err := json.Unmarshal([]byte(data), &rdata) | ||
572 | for { | 573 | for { |
573 | - list, err := GetWithDrawList(uuid) | ||
574 | - if err != nil || list == nil { | 574 | + if err != nil { |
575 | + logger.Info("json decode HandlerGetcashrecord data failed:%v,for:%v", err, data) | ||
576 | + resp.Message = "json解析错误" | ||
577 | + resp.Code = ERROR_JSONUNMASH_ERROR | ||
578 | + break | ||
579 | + } | ||
580 | + // list, err := GetWithDrawList(uuid) | ||
581 | + /*if err != nil || list == nil { | ||
575 | /*logger.Error("HandlerGetcashrecord failed err=%v", err) | 582 | /*logger.Error("HandlerGetcashrecord failed err=%v", err) |
576 | resp.Message = "服务器错误" | 583 | resp.Message = "服务器错误" |
577 | resp.Code = ERROR_SRV_ERROR | 584 | resp.Code = ERROR_SRV_ERROR |
578 | - break*/ | 585 | + break |
586 | + }*/ | ||
587 | + list, err := GetCashList(uuid, rdata.Gameid, rdata.Channel, 0, 100) | ||
588 | + if err != nil { | ||
589 | + logger.Error("HandlerGetcashrecord failed err=%v", err) | ||
590 | + resp.Message = "服务器错误" | ||
591 | + resp.Code = ERROR_SRV_ERROR | ||
592 | + break | ||
579 | } | 593 | } |
580 | - | ||
581 | if list != nil { | 594 | if list != nil { |
582 | - resp.Data.Withdata = append(resp.Data.Withdata, list.Withdata...) | 595 | + resp.Data.Withdata = append(resp.Data.Withdata, *list...) |
583 | } | 596 | } |
584 | 597 | ||
585 | resp.Code = ERROR_OK | 598 | resp.Code = ERROR_OK |