|
|
@ -5,16 +5,16 @@ import ( |
|
|
|
"errors" |
|
|
|
) |
|
|
|
|
|
|
|
func GetCouponInfo(dbname,couponId string, url ...string) (string, error) { |
|
|
|
func GetCouponInfo(dbname,couponId string, url ...string) (map[string]string, error) { |
|
|
|
|
|
|
|
if dbname == "" { |
|
|
|
return "", errors.New("参数错误") |
|
|
|
return nil, errors.New("参数错误") |
|
|
|
} |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
@ -25,31 +25,31 @@ func GetCouponInfo(dbname,couponId string, url ...string) (string, error) { |
|
|
|
|
|
|
|
req, err := SetReqData(arg) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
res := &CouponResponse{} |
|
|
|
|
|
|
|
err = conn.GetCouponInfo(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data_de, err := GetResData(res) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
var bankCode string |
|
|
|
err = json.Unmarshal([]byte(res_data_de),&bankCode) |
|
|
|
var couponInfo map[string]string |
|
|
|
err = json.Unmarshal([]byte(res_data_de),&couponInfo) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
if res_data_de == "" { |
|
|
|
return "", nil |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
|
|
|
|
return bankCode, nil |
|
|
|
return couponInfo, nil |
|
|
|
} |