【优化】移除后台登录默认记录账号密码功能。

【修复】修复前端提交数据可能存在风险的校验。
This commit is contained in:
jianweie code
2023-08-12 16:52:39 +08:00
parent 2f66261c0e
commit e3115be3f6
4 changed files with 27 additions and 22 deletions

View File

@@ -481,6 +481,13 @@ namespace CoreCms.Net.Services
}
var billPayments = result.data as CoreCmsBillPayments;
if (billPayments.money < 0)
{
jm.msg = "支付金额异常!";
return jm;
}
//根据支付方式返回支付配置
//微信支付
if (paymentCode == GlobalEnumVars.PaymentsTypes.wechatpay.ToString())

View File

@@ -108,7 +108,11 @@ namespace CoreCms.Net.Services
public async Task<WebApiCallBack> SetCartNum(int id, int nums, int userId, int numType, int type = 1)
{
var jm = new WebApiCallBack();
if (nums <= 0)
{
jm.msg = "商品数量必须为正整数";
return jm;
}
if (userId == 0)
{
jm.msg = "用户信息获取失败";
@@ -187,12 +191,12 @@ namespace CoreCms.Net.Services
var goodsServices = container.ServiceProvider.GetService<ICoreCmsGoodsServices>();
//获取数据
if (nums == 0)
if (nums <= 0)
{
jm.msg = "请选择货品数量";
return jm;
}
if (productId == 0)
if (productId <= 0)
{
jm.msg = "请选择货品";
return jm;
@@ -260,7 +264,7 @@ namespace CoreCms.Net.Services
{
if (checkOrder.TotalUserOrders + nums > promotionsModel.maxNums)
{
jm.data = 15611;;
jm.data = 15611; ;
jm.msg = GlobalErrorCodeVars.Code15611;
return jm;
}
@@ -428,6 +432,9 @@ namespace CoreCms.Net.Services
{
var jm = new WebApiCallBack() { methodDescription = "获取购物车原始列表(未核算)" };
//强制过滤一遍,防止出现可以造假数据
await _dal.DeleteAsync(p => p.userId == userId && p.nums <= 0);
using var container = _serviceProvider.CreateScope();
var productsService = container.ServiceProvider.GetService<ICoreCmsProductsServices>();
var goodsServices = container.ServiceProvider.GetService<ICoreCmsGoodsServices>();
@@ -460,6 +467,13 @@ namespace CoreCms.Net.Services
await _dal.DeleteAsync(item);
continue;
}
//商品金额设置为0就从购物车里面删除
if (productInfo.price <= 0)
{
await _dal.DeleteAsync(item);
continue;
}
//获取重量
var goodsWeight = await goodsServices.GetWeight(item.productId);
@@ -799,7 +813,7 @@ namespace CoreCms.Net.Services
public async Task<WebApiCallBack> CartPoint(CartDto cartDto, int userId, int point)
{
var jm = new WebApiCallBack() { status = true };
if (point != 0)
if (point > 0)
{
var user = await _userServices.QueryByClauseAsync(p => p.id == userId);
if (user.point < point)