| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package client
- import (
- "encoding/json"
- _ "bet24.com/log"
- )
- func GetExchangeRateList() Response {
- msg := "GetExchangeRateList"
- return DoRequest(msg, "")
- }
- func GetShopList(userId, shopType int, productID string) Response {
- msg := "GetShopList"
- var req Shop_req
- req.UserId = userId
- req.ShopType = shopType
- req.ProductID = productID
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- func GetShopListByUserId(shopType int, userId int, partnerId int) Response {
- msg := "GetShopListByUserId"
- var req Shop_req
- req.ShopType = shopType
- req.UserId = userId
- req.PartnerId = partnerId
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- func GetProduct(userId, shopType int, productId string) Response {
- msg := "GetProduct"
- var req Shop_req
- req.UserId = userId
- req.ShopType = shopType
- req.ProductID = productId
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- func Recharge(userId int, productId string) Response {
- msg := "Recharge"
- var req Shop_req
- req.UserId = userId
- req.ProductID = productId
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- func Exchange(userId int, productId string) Response {
- msg := "Exchange"
- var req Shop_req
- req.UserId = userId
- req.ProductID = productId
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- func ExchangeInBulk(userId int, productIds []string) Response {
- msg := "ExchangeInBulk"
- var req Shop_req
- req.UserId = userId
- req.ProductIDs = productIds
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- func SendFirstChargeItem(userId int) Response {
- msg := "SendFirstChargeItem"
- var req Shop_req
- req.UserId = userId
- req.ProductID = "900003"
- d, _ := json.Marshal(req)
- return DoRequest(msg, string(d))
- }
- /*
- func ExchangeRateInfo(currency string) (string, string) {
- msg := "ExchangeRateInfo"
- var req Shop_req
- req.Currency = currency
- d, _ := json.Marshal(req)
- rsp := DoRequest(msg, string(d))
- return rsp.Action[0], rsp.Action[1]
- }
- func GetUserPrice(userId int, price float64) float64 {
- msg := "GetUserPrice"
- var req Shop_req
- req.Price = price
- req.UserId = userId
- d, _ := json.Marshal(req)
- rsp := DoRequest(msg, string(d))
- var respond Shop_resp
- err := json.Unmarshal([]byte(rsp.Data), &respond)
- if err != nil {
- log.Release("GetUserPrice [%d],[%f] failed", userId, price)
- return price
- }
- return respond.Price
- }
- */
|