feat(subscribe): add ShowOriginalPrice field and related database changes

This commit is contained in:
Tension
2025-12-28 17:08:26 +08:00
parent 31e634ba66
commit d332e760f8
9 changed files with 213 additions and 201 deletions
@@ -35,28 +35,29 @@ func (l *CreateSubscribeLogic) CreateSubscribe(req *types.CreateSubscribeRequest
discount = string(val)
}
sub := &subscribe.Subscribe{
Id: 0,
Name: req.Name,
Language: req.Language,
Description: req.Description,
UnitPrice: req.UnitPrice,
UnitTime: req.UnitTime,
Discount: discount,
Replacement: req.Replacement,
Inventory: req.Inventory,
Traffic: req.Traffic,
SpeedLimit: req.SpeedLimit,
DeviceLimit: req.DeviceLimit,
Quota: req.Quota,
Nodes: tool.Int64SliceToString(req.Nodes),
NodeTags: tool.StringSliceToString(req.NodeTags),
Show: req.Show,
Sell: req.Sell,
Sort: 0,
DeductionRatio: req.DeductionRatio,
AllowDeduction: req.AllowDeduction,
ResetCycle: req.ResetCycle,
RenewalReset: req.RenewalReset,
Id: 0,
Name: req.Name,
Language: req.Language,
Description: req.Description,
UnitPrice: req.UnitPrice,
UnitTime: req.UnitTime,
Discount: discount,
Replacement: req.Replacement,
Inventory: req.Inventory,
Traffic: req.Traffic,
SpeedLimit: req.SpeedLimit,
DeviceLimit: req.DeviceLimit,
Quota: req.Quota,
Nodes: tool.Int64SliceToString(req.Nodes),
NodeTags: tool.StringSliceToString(req.NodeTags),
Show: req.Show,
Sell: req.Sell,
Sort: 0,
DeductionRatio: req.DeductionRatio,
AllowDeduction: req.AllowDeduction,
ResetCycle: req.ResetCycle,
RenewalReset: req.RenewalReset,
ShowOriginalPrice: req.ShowOriginalPrice,
}
err := l.svcCtx.SubscribeModel.Insert(l.ctx, sub)
if err != nil {
@@ -43,28 +43,29 @@ func (l *UpdateSubscribeLogic) UpdateSubscribe(req *types.UpdateSubscribeRequest
discount = string(val)
}
sub := &subscribe.Subscribe{
Id: req.Id,
Name: req.Name,
Language: req.Language,
Description: req.Description,
UnitPrice: req.UnitPrice,
UnitTime: req.UnitTime,
Discount: discount,
Replacement: req.Replacement,
Inventory: req.Inventory,
Traffic: req.Traffic,
SpeedLimit: req.SpeedLimit,
DeviceLimit: req.DeviceLimit,
Quota: req.Quota,
Nodes: tool.Int64SliceToString(req.Nodes),
NodeTags: tool.StringSliceToString(req.NodeTags),
Show: req.Show,
Sell: req.Sell,
Sort: req.Sort,
DeductionRatio: req.DeductionRatio,
AllowDeduction: req.AllowDeduction,
ResetCycle: req.ResetCycle,
RenewalReset: req.RenewalReset,
Id: req.Id,
Name: req.Name,
Language: req.Language,
Description: req.Description,
UnitPrice: req.UnitPrice,
UnitTime: req.UnitTime,
Discount: discount,
Replacement: req.Replacement,
Inventory: req.Inventory,
Traffic: req.Traffic,
SpeedLimit: req.SpeedLimit,
DeviceLimit: req.DeviceLimit,
Quota: req.Quota,
Nodes: tool.Int64SliceToString(req.Nodes),
NodeTags: tool.StringSliceToString(req.NodeTags),
Show: req.Show,
Sell: req.Sell,
Sort: req.Sort,
DeductionRatio: req.DeductionRatio,
AllowDeduction: req.AllowDeduction,
ResetCycle: req.ResetCycle,
RenewalReset: req.RenewalReset,
ShowOriginalPrice: req.ShowOriginalPrice,
}
err = l.svcCtx.SubscribeModel.Update(l.ctx, sub)
if err != nil {