修复权益领取优惠券时从优惠券表获取正确的金额和标题
This commit is contained in:
parent
432ee4f992
commit
5695b1c483
|
|
@ -65,7 +65,7 @@
|
|||
"D:/CodeManage/HaniBlindBox/server/scripts/mssql-mcp-server/index.js"
|
||||
],
|
||||
"env": {
|
||||
"MSSQL_SERVER": "192.168.195.15",
|
||||
"MSSQL_SERVER": "1.13.21.84",
|
||||
"MSSQL_PORT": "1433",
|
||||
"MSSQL_USER": "sa",
|
||||
"MSSQL_PASSWORD": "Dbt@com@123",
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
"D:/CodeManage/HaniBlindBox/server/scripts/mssql-mcp-server/index.js"
|
||||
],
|
||||
"env": {
|
||||
"MSSQL_SERVER": "192.168.195.15",
|
||||
"MSSQL_SERVER": "1.13.21.84",
|
||||
"MSSQL_PORT": "1433",
|
||||
"MSSQL_USER": "sa",
|
||||
"MSSQL_PASSWORD": "Dbt@com@123",
|
||||
|
|
|
|||
|
|
@ -180,29 +180,33 @@ public class QuanYiService : IQuanYiService
|
|||
{
|
||||
var endTime = DateTime.UtcNow.AddDays(reward.EffectiveDay ?? 7);
|
||||
|
||||
// 获取关联的优惠券信息
|
||||
Coupon? coupon = null;
|
||||
if (reward.CouponId.HasValue)
|
||||
{
|
||||
coupon = await _dbContext.Coupons
|
||||
.FirstOrDefaultAsync(c => c.Id == reward.CouponId.Value);
|
||||
}
|
||||
|
||||
// 优先使用优惠券表的数据,如果没有则使用奖品表的数据
|
||||
var jianPrice = coupon?.Price ?? reward.JianPrice ?? 0;
|
||||
var manPrice = coupon?.ManPrice ?? reward.ManPrice ?? 0;
|
||||
var couponTitle = coupon?.Title ?? reward.Title ?? "优惠券";
|
||||
var ttype = coupon?.Ttype ?? 0;
|
||||
|
||||
// Add to response
|
||||
rewards.Add(new QuanYiLingRewardDto
|
||||
{
|
||||
Id = reward.Id,
|
||||
Title = reward.Title,
|
||||
Title = couponTitle,
|
||||
Type = 1,
|
||||
JianPrice = reward.JianPrice,
|
||||
ManPrice = reward.ManPrice,
|
||||
JianPrice = jianPrice,
|
||||
ManPrice = manPrice,
|
||||
EffectiveDay = reward.EffectiveDay,
|
||||
EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
ZNum = reward.ZNum
|
||||
});
|
||||
|
||||
// Get coupon ttype
|
||||
byte? ttype = null;
|
||||
if (reward.CouponId.HasValue)
|
||||
{
|
||||
ttype = await _dbContext.Coupons
|
||||
.Where(c => c.Id == reward.CouponId.Value)
|
||||
.Select(c => c.Ttype)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
// Create coupon receives for the user
|
||||
var zNum = reward.ZNum ?? 1;
|
||||
for (int i = 0; i < zNum; i++)
|
||||
|
|
@ -210,15 +214,15 @@ public class QuanYiService : IQuanYiService
|
|||
var couponReceive = new CouponReceife
|
||||
{
|
||||
UserId = userId,
|
||||
Title = reward.Title,
|
||||
Price = reward.JianPrice ?? 0,
|
||||
ManPrice = reward.ManPrice ?? 0,
|
||||
Title = couponTitle,
|
||||
Price = jianPrice,
|
||||
ManPrice = manPrice,
|
||||
EndTime = endTime,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CouponId = reward.Id,
|
||||
CouponId = reward.CouponId ?? reward.Id,
|
||||
State = 0, // State字段未使用
|
||||
Status = 0, // 0=未使用/可用, 1=已使用, 2=已过期
|
||||
Ttype = ttype ?? 0
|
||||
Ttype = ttype
|
||||
};
|
||||
_dbContext.CouponReceives.Add(couponReceive);
|
||||
}
|
||||
|
|
@ -231,9 +235,9 @@ public class QuanYiService : IQuanYiService
|
|||
EquityLevel = equityLevel.Level,
|
||||
CouponId = reward.CouponId,
|
||||
Type = 1,
|
||||
Title = reward.Title,
|
||||
JianPrice = reward.JianPrice,
|
||||
ManPrice = reward.ManPrice,
|
||||
Title = couponTitle,
|
||||
JianPrice = jianPrice,
|
||||
ManPrice = manPrice,
|
||||
EffectiveDay = reward.EffectiveDay,
|
||||
EndTime = endTime,
|
||||
ZNum = reward.ZNum,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user