Skip to content

Commit

Permalink
V2.0.3 SessionBag 添加 UnionId 属性 感谢 @e4ky JeffreySu#1252
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySu committed Jul 1, 2018
1 parent 3d370b1 commit 69c7d5d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public ActionResult OnLogin(string code)
{
//Session["WxOpenUser"] = jsonResult;//使用Session保存登陆信息(不推荐)
//使用SessionContainer管理登录信息(推荐)
var sessionBag = SessionContainer.UpdateSession(null, jsonResult.openid, jsonResult.session_key);
var sessionBag = SessionContainer.UpdateSession(null, jsonResult.openid, jsonResult.session_key, jsonResult.unionid);

//注意:生产环境下SessionKey属于敏感信息,不能进行传输!
return Json(new { success = true, msg = "OK", sessionId = sessionBag.Key, sessionKey = sessionBag.SessionKey });
Expand Down Expand Up @@ -289,7 +289,7 @@ public ActionResult GetPrepayid(string sessionId)

var body = "小程序微信支付Demo";
var price = 1;//单位:分
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(WxOpenAppId, Config.DefaultSenparcWeixinSetting.TenPayV3_MchId, body, sp_billno, price,
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(WxOpenAppId, Config.DefaultSenparcWeixinSetting.TenPayV3_MchId, body, sp_billno, price,
HttpContext.UserHostAddress().ToString(), Config.DefaultSenparcWeixinSetting.TenPayV3_TenpayNotify,
TenPayV3Type.JSAPI, openId, Config.DefaultSenparcWeixinSetting.TenPayV3_Key, nonceStr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
修改标识:Senparc - 20180614
修改描述:CO2NET v0.1.0 ContainerBag 取消属性变动通知机制,使用手动更新缓存
修改标识:Senparc - 20180701
修改描述:V2.0.3 SessionBag 添加 UnionId 属性
----------------------------------------------------------------*/

Expand Down Expand Up @@ -77,6 +80,8 @@ public class SessionBag : BaseContainerBag
//#endif
// }

public string UnionId { get; set; }

/// <summary>
/// SessionKey
/// </summary>
Expand All @@ -103,10 +108,10 @@ public class SessionBag : BaseContainerBag
//#endif
// }

private string _key;
private string _openId;
private string _sessionKey;
private DateTime _expireTime;
//private string _key;
//private string _openId;
//private string _sessionKey;
//private DateTime _expireTime;

/// <summary>
/// ComponentBag
Expand Down Expand Up @@ -167,8 +172,9 @@ public static SessionBag GetSession(string key)
/// <param name="key">如果留空,则新建一条记录</param>
/// <param name="openId">OpenId</param>
/// <param name="sessionKey">SessionKey</param>
/// <param name="uniondId">UnionId</param>
/// <returns></returns>
public static SessionBag UpdateSession(string key, string openId, string sessionKey)
public static SessionBag UpdateSession(string key, string openId, string sessionKey,string uniondId)
{
key = key ?? SessionHelper.GetNewThirdSessionName();

Expand All @@ -178,6 +184,7 @@ public static SessionBag UpdateSession(string key, string openId, string session
{
Key = key,
OpenId = openId,
UnionId = uniondId,
SessionKey = sessionKey,
ExpireTime = GetExpireTime()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net40;net45;netstandard2.0;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<Version>2.0.0-preview1</Version>
<Version>2.0.3-preview1</Version>
<AssemblyName>Senparc.Weixin.WxOpen</AssemblyName>
<RootNamespace>Senparc.Weixin.WxOpen</RootNamespace>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand Down Expand Up @@ -85,6 +85,7 @@
v1.10.5 发布支持 .net core 2.1 的正式版

v2.0.0 引入 Senparc.CO2NET,支持 Senparc.Weixin v5.0
V2.0.3 SessionBag 添加 UnionId 属性
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/JeffreySu/WeiXinMPSDK</RepositoryUrl>
</PropertyGroup>
Expand Down

0 comments on commit 69c7d5d

Please sign in to comment.