|
|
@@ -214,26 +214,41 @@ func DealCallBack(openId, ticket string) error { |
|
|
|
} |
|
|
|
|
|
|
|
//4、发送微信红包 |
|
|
|
post, err := utils.CurlPost("http://pay.izhyin.com/wx/redPackage/index", map[string]string{ |
|
|
|
post, err := utils.CurlPost("http://pay.izhyin.com/wx/redPackage/index", utils.SerializeStr(map[string]string{ |
|
|
|
"openid": openId, |
|
|
|
"amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100), |
|
|
|
}, nil) |
|
|
|
}), nil) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
utils.FilePutContents("send_redPackage", utils.SerializeStr(map[string]interface{}{ |
|
|
|
"args": map[string]string{ |
|
|
|
"openid": openId, |
|
|
|
"amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100), |
|
|
|
}, |
|
|
|
"resp": post, |
|
|
|
"resp": string(post), |
|
|
|
})) |
|
|
|
|
|
|
|
var result struct { |
|
|
|
Code int `json:"code"` |
|
|
|
Msg string `json:"msg"` |
|
|
|
Data interface{} `json:"data"` |
|
|
|
} |
|
|
|
err = json.Unmarshal(post, &result) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
var data md.SendRedPackageResp |
|
|
|
err = json.Unmarshal(post, &data) |
|
|
|
err = json.Unmarshal(utils.Serialize(result.Data), &data) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
utils.FilePutContents("send_redPackage", utils.SerializeStr(map[string]interface{}{ |
|
|
|
"data": data, |
|
|
|
})) |
|
|
|
|
|
|
|
if data.ReturnCode != "SUCCESS" || data.ResultCode != "SUCCESS" { |
|
|
|
return errors.New(data.ReturnMsg) |
|
|
|
} |
|
|
|