/// <summary> /// 转化微信的授权token实体到通用实体 /// </summary> /// <param name="wxMo"></param> /// <returns></returns> public static Resp <OauthAccessTokenMo> ConvertToComMo(this WXGetOauthAccessTokenResp wxMo) { if (!wxMo.IsSuccess()) { return(new Resp <OauthAccessTokenMo>().WithResp(wxMo));// wxMo.ConvertToResult<OauthAccessTokenMo>(); } var nowTimestamp = DateTime.Now.ToUtcSeconds(); var comMo = new OauthAccessTokenMo { access_token = wxMo.access_token, expire_date = nowTimestamp + wxMo.expires_in, refresh_token = wxMo.refresh_token, app_user_id = wxMo.openid }; return(new Resp <OauthAccessTokenMo>(comMo)); }
/// <summary> /// 转化微信的授权token实体到通用实体 /// </summary> /// <param name="wxMo"></param> /// <returns></returns> public static ResultMo <OauthAccessTokenMo> ConvertToComMo(this WxGetOauthAccessTokenResp wxMo) { if (!wxMo.IsSuccess()) { return(wxMo.ConvertToResultOnly <OauthAccessTokenMo>()); } var nowTimestamp = DateTime.Now.ToUtcSeconds(); //var appInfo = MemberShiper.AppAuthorize; var comMo = new OauthAccessTokenMo { access_token = wxMo.access_token, expire_date = nowTimestamp + wxMo.expires_in, refresh_token = wxMo.refresh_token, create_time = nowTimestamp, app_user_id = wxMo.openid }; return(new ResultMo <OauthAccessTokenMo>(comMo)); }