|
|
@ -59,10 +59,17 @@ type RedPackResult struct { |
|
|
|
|
|
|
|
// 发送红包
|
|
|
|
func SendRedPack(sendName, openId, wishing, ip, actName, remark string, totalAmount, totalNum, scene int) (*RedPackResult, error) { |
|
|
|
client, err := Client() |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
mchBillNo := utils.RandomStr(28) |
|
|
|
nonceStr := utils.RandomStr(32) |
|
|
|
|
|
|
|
body := make(map[string]string, 0) |
|
|
|
body["wxappid"] = client.AppId() |
|
|
|
body["mch_id"] = client.MchId() |
|
|
|
body["nonce_str"] = nonceStr |
|
|
|
body["mch_billno"] = mchBillNo |
|
|
|
body["send_name"] = sendName |
|
|
@ -74,10 +81,7 @@ func SendRedPack(sendName, openId, wishing, ip, actName, remark string, totalAmo |
|
|
|
body["act_name"] = actName |
|
|
|
body["remark"] = remark |
|
|
|
body["scene_id"] = fmt.Sprintf("PRODUCT_%d", scene) |
|
|
|
body["ppid"] = Appid |
|
|
|
body["mch_id"] = Mchid |
|
|
|
|
|
|
|
client, err := Client() |
|
|
|
m, err := mmpaymkttransfers.SendRedPack(client, body) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|