QiFeng.ZWY.Bll/BllExt/OrderExtBll.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using QiFeng.LMSD.Dal.DalExt;
using QiFeng.LMSD.Model;
using QiFeng.LMSD.Model.ApiResultModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QiFeng.LMSD.Bll.BllExt
{
public class OrderExtBll : BaseBll<OrderExtBll>
{
public static object subIntegralOrderLocker = new object();
public SubOrder TransSubOrder(string commIds, string commNums, int consumerId, int consumerReceivingId)
{
var consumerModel = ConsumerBll.Instance.GetModel(consumerId);
if (consumerModel == null) throw new FormatException("该用户不存在");
var consumerMember = ConsumerMembersBll.Instance.GetModel(consumerModel.CosumerMemberId);
var orderId = OrderExtDal.Instance.SubOrder(consumerModel, commIds, commNums, consumerReceivingId, consumerMember);
return new SubOrder() { orderId = orderId };
}
/// <summary>
/// 提交积分兑换订单
/// </summary>
/// <param name="commId"></param>
/// <param name="commNum"></param>
/// <param name="consumerId"></param>
/// <param name="consumerReceivingId"></param>
/// <returns></returns>
public Int32 TransSubIntegralOrder(Int32 commId, Int32 commNum, Int32 consumerId, Int32 consumerReceivingId)
{
if (commId <= 0 || commNum <= 0 || consumerId <= 0 || consumerReceivingId <= 0)
throw new FormatException("请求数据不正确");
var consumerModel = ConsumerBll.Instance.GetModel(consumerId);
var consumerReceivingModel = ConsumerReceivingAddressBll.Instance.GetModel(consumerReceivingId);
var orderId = 0;
lock (subIntegralOrderLocker)
{
var commModel = CommodityBll.Instance.GetModel(commId);
if (!commModel.IsSupportIntegral)
throw new FormatException("该商品不支持积分兑换");
if (commModel.IntegralExchangeNum < commNum)
throw new FormatException("该商品一次最多兑换" + commModel.IntegralExchangeNum + "件");
if (commModel.Inventory < commNum)
throw new FormatException("库存不足");
var totalIntegralNum = commModel.IntegralNumber * commNum;
if (consumerModel.IntegralNumber < totalIntegralNum)
throw new FormatException("积分不足");
orderId = OrderExtDal.Instance.SubIntegralOrder(consumerModel, commModel, commNum, consumerReceivingModel.Id);
}
后面还有 25 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。