public async Task <ResponseViewModel <WeChatResponse> > AcquireWeCharPaySign([FromBody] RequestViewModel obj) { ResponseViewModel <WeChatResponse> response = null; WeChatResponse result = null; obj = JsonHelper.DeserializeJsonToObject <RequestViewModel>(Content(User.Identity.Name).Content); var sysCode = SysCode.Ok; bool isLog = _token.VerifyToken(obj.HendInfo.UserOpenId, obj.HendInfo.SessionToken); if (isLog) { string json = RedisHelper.StringGet($"{CacheKey.Token}{obj.HendInfo.UserOpenId}", RedisFolderEnum.token, RedisEnum.Three); var userLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(json); int itemId = StringExtension.ToInt((string)obj.Data.itemId); //; //商品Id RechargeCommodityDto rechargeCommodity = await _recharge.GetRechargeCommodityByIdAsync(itemId); if (rechargeCommodity == null) { sysCode = SysCode.RechargeCommodityIsNULL; //充值商品不存在, } if (sysCode == SysCode.Ok) { string strUrl = _lqhnweChatPay.Url; WeCharRequest weChar = new WeCharRequest(); weChar.userOpenId = obj.HendInfo.UserOpenId; weChar.itemId = (string)obj.Data.itemId; weChar.sessionToken = obj.HendInfo.SessionToken; WeCharRequestList requestList = new WeCharRequestList(); requestList.data = weChar; string strJson = JsonHelper.SerializeObject(requestList); result = JsonHelper.DeserializeJsonToObject <WeChatResponse>(_sys.PostJsonData(strUrl, strJson, Encoding.UTF8)); } } else { /*短令牌失效*/ sysCode = SysCode.SessionTokenLose; } response = new ResponseViewModel <WeChatResponse>(sysCode, sysCode == SysCode.Ok ? result : null, obj.Encrypt, _sys, obj.Secret); return(response); }
/// <summary> /// 返回关注事件处理结果 /// </summary> /// <param name="request">微信请求</param> /// <returns></returns> public virtual WeChatResponse OnEvent关注(WeChatRequest request) => WeChatResponse.ResponseText(request, $"欢迎关注:{request.Config.AccountName}");