|
|
@@ -29,6 +29,10 @@ namespace CallCenterAPI.WechatSDK
|
|
29
|
29
|
public static string WechatKey;
|
|
30
|
30
|
public static string WechatPath;
|
|
31
|
31
|
public static string WechatClientIp;
|
|
|
32
|
+ public static string WechatSendName;
|
|
|
33
|
+ public static string WechatWishing;
|
|
|
34
|
+ public static string WechatActName;
|
|
|
35
|
+ public static string WechatRemark;
|
|
32
|
36
|
|
|
33
|
37
|
public static string CommonToken;//Common的Token
|
|
34
|
38
|
public static DateTime GetCommonTokenDate;//获取CommonToken的时间
|
|
|
@@ -42,6 +46,10 @@ namespace CallCenterAPI.WechatSDK
|
|
42
|
46
|
WechatKey = Configs.GetValue("WechatKey");
|
|
43
|
47
|
WechatPath = Configs.GetValue("WechatPath");
|
|
44
|
48
|
WechatClientIp = Configs.GetValue("WechatClientIp");
|
|
|
49
|
+ WechatSendName = Configs.GetValue("WechatSendName");
|
|
|
50
|
+ WechatWishing = Configs.GetValue("WechatWishing");
|
|
|
51
|
+ WechatActName = Configs.GetValue("WechatActName");
|
|
|
52
|
+ WechatRemark = Configs.GetValue("WechatRemark");
|
|
45
|
53
|
}
|
|
46
|
54
|
|
|
47
|
55
|
/// <summary>
|
|
|
@@ -275,24 +283,22 @@ namespace CallCenterAPI.WechatSDK
|
|
275
|
283
|
|
|
276
|
284
|
packageReqHandler.SetParameter("mch_id", WechatMchid); //微信支付分配的商户号
|
|
277
|
285
|
packageReqHandler.SetParameter("wxappid", AppId);//微信分配的公众账号ID(企业号corpid即为此appId)。接口传入的所有appid应该为公众号的appid(在mp.weixin.qq.com申请的),不能为APP的appid(在open.weixin.qq.com申请的)。
|
|
278
|
|
- packageReqHandler.SetParameter("send_name", "叶县政法委");//商户名称
|
|
|
286
|
+ packageReqHandler.SetParameter("send_name", WechatSendName);//商户名称
|
|
279
|
287
|
packageReqHandler.SetParameter("re_openid", openid); //用户openid 接受红包的用户用户在wxappid下的openid
|
|
280
|
288
|
packageReqHandler.SetParameter("total_amount", Convert.ToInt32(amount * 100M).ToString(CultureInfo.InvariantCulture));//红包类型
|
|
281
|
289
|
packageReqHandler.SetParameter("total_num", "1");//红包发放总人数
|
|
282
|
290
|
|
|
283
|
|
- packageReqHandler.SetParameter("wishing", "测试红包"); //红包祝福语
|
|
|
291
|
+ packageReqHandler.SetParameter("wishing", WechatWishing); //红包祝福语
|
|
284
|
292
|
packageReqHandler.SetParameter("client_ip", WechatClientIp);//Ip地址
|
|
285
|
|
- packageReqHandler.SetParameter("act_name", "测试红包"); //活动名称
|
|
286
|
|
- packageReqHandler.SetParameter("remark", "测试红包"); //备注
|
|
|
293
|
+ packageReqHandler.SetParameter("act_name", WechatActName); //活动名称
|
|
|
294
|
+ packageReqHandler.SetParameter("remark", WechatRemark); //备注
|
|
287
|
295
|
|
|
288
|
296
|
string sign = packageReqHandler.CreateMd5Sign("key", WechatKey);
|
|
289
|
297
|
packageReqHandler.SetParameter("sign", sign); //签名:生成签名方式查看签名算法
|
|
290
|
298
|
|
|
291
|
299
|
data = packageReqHandler.ParseXML();
|
|
292
|
300
|
certPath = WechatPath;
|
|
293
|
|
- msg += "发送前:" + HttpContext.Current.Request.PhysicalApplicationPath + certPath;
|
|
294
|
301
|
xmlResult = Sendredpack(data, WechatMchid, certPath);
|
|
295
|
|
- msg += "发送后:";
|
|
296
|
302
|
var res = XDocument.Parse(xmlResult);
|
|
297
|
303
|
reeee = res.ToString();
|
|
298
|
304
|
string return_code = res.Element("xml").Element("return_code").Value;
|
|
|
@@ -305,17 +311,17 @@ namespace CallCenterAPI.WechatSDK
|
|
305
|
311
|
}
|
|
306
|
312
|
else
|
|
307
|
313
|
{
|
|
308
|
|
- msg += "result_code:" + res.Element("xml").Element("err_code").Value + res.Element("xml").Element("err_code_des").Value;
|
|
|
314
|
+ msg += res.Element("xml").Element("err_code").Value + res.Element("xml").Element("err_code_des").Value;
|
|
309
|
315
|
}
|
|
310
|
316
|
}
|
|
311
|
317
|
else
|
|
312
|
318
|
{
|
|
313
|
|
- msg += "return_code:" + res.Element("xml").Element("err_code").Value + res.Element("xml").Element("err_code_des").Value;
|
|
|
319
|
+ msg += res.Element("xml").Element("err_code").Value + res.Element("xml").Element("err_code_des").Value;
|
|
314
|
320
|
}
|
|
315
|
321
|
}
|
|
316
|
322
|
catch (Exception exception)
|
|
317
|
323
|
{
|
|
318
|
|
- msg += "exception:" + exception.Message+"****"+ reeee;
|
|
|
324
|
+ msg += exception.Message;
|
|
319
|
325
|
}
|
|
320
|
326
|
#endregion
|
|
321
|
327
|
return fals.ToString() + "|" + msg;
|