【优化】优化微信小程序及微信公众号同时登录同一账号下,同时支付异常的问题。

【优化】优化后台微信用户列表展示,增加区分微信小程序和微信公众号来源的划分。
This commit is contained in:
jianweie code
2023-05-05 23:08:37 +08:00
parent 76802af4a0
commit 8af46f90ed
4 changed files with 859 additions and 768 deletions

View File

@@ -29,6 +29,7 @@ using Newtonsoft.Json.Linq;
using QRCoder;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
using SqlSugar;
namespace CoreCms.Net.Services
{
@@ -80,7 +81,7 @@ namespace CoreCms.Net.Services
var payment = await billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.paymentId);
var checkBeforeAddOrder = await checkBeforeAddOrderServices.QueryByClauseAsync(p => p.orderId == payment.sourceId);
if (checkBeforeAddOrder != null && checkBeforeAddOrder.requireOrder == (int)GlobalEnumVars.RequireOrderType.)
if (checkBeforeAddOrder is { requireOrder: (int)GlobalEnumVars.RequireOrderType. })
{
var order = await transactionComponentOrderServices.QueryByClauseAsync(p => p.outOrderId == payment.sourceId);
@@ -158,26 +159,38 @@ namespace CoreCms.Net.Services
var openId = string.Empty;
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString() || tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString())
{
var userAccount = await _userServices.QueryByIdAsync(_user.ID);
if (userAccount == null)
{
jm.msg = "用户账户获取失败";
return jm;
}
//var userAccount = await _userServices.QueryByIdAsync(_user.ID);
//if (userAccount == null)
//{
// jm.msg = "用户账户获取失败";
// return jm;
//}
if (userAccount.userWx <= 0)
{
jm.msg = "账户关联微信用户信息获取失败";
return jm;
}
//if (userAccount.userWx <= 0)
//{
// jm.msg = "账户关联微信用户信息获取失败";
// return jm;
//}
var user = await _userWeChatInfoServices.QueryByClauseAsync(p => p.id == userAccount.userWx);
//var user = await _userWeChatInfoServices.QueryByClauseAsync(p => p.id == userAccount.userWx);
//if (user == null)
//{
// jm.msg = "微信用户信息获取失败";
// return jm;
//}
var type = tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString()
? (int)GlobalEnumVars.UserAccountTypes.
: (int)GlobalEnumVars.UserAccountTypes.;
var user = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == _user.ID && p.type == type, p => p.createTime, OrderByType.Desc);
if (user == null)
{
jm.msg = "微信用户信息获取失败";
return jm;
}
openId = user.openid;
}

File diff suppressed because it is too large Load Diff

View File

@@ -30,6 +30,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using NPOI.HSSF.UserModel;
using SqlSugar;
using static CoreCms.Net.Configuration.GlobalEnumVars;
namespace CoreCms.Net.Web.Admin.Controllers
{
@@ -255,6 +256,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var userAccountTypes = EnumHelper.EnumToList<GlobalEnumVars.UserAccountTypes>();
jm.data = new
{
userAccountTypes
};
return jm;
}
#endregion

View File

@@ -117,7 +117,19 @@
[
{ type: "checkbox", fixed: "left" },
{ field: 'id', title: '微信序列', width: 70, sort: false },
//{ field: 'type', title: '第三方登录类型', sort: false,width: 105 },
//{ field: 'type', title: '第三方登录类型', sort: false, width: 105 },
{
field: 'type', title: '登录类型', align: "center",
templet: function (data) {
var str = '';
for (i = 0; i < d.data.userAccountTypes.length; i++) {
if (data.type === d.data.userAccountTypes[i].value) { str = d.data.userAccountTypes[i].title }
}
//return str;
return "<img src='/static/images/common/userwx_" + data.type + ".jpg' style='width:28px;' title='" + str + "' />";
}, width: 90
},
{ field: 'userId', title: '用户序列', sort: false, width: 80 },
{ field: 'openid', title: 'openId', sort: false },
//{ field: 'sessionKey', title: '缓存key', sort: false,width: 105 },