feat(subscribe): add ShowOriginalPrice field and related database changes
This commit is contained in:
parent
31e634ba66
commit
d332e760f8
@ -54,6 +54,7 @@ type (
|
||||
AllowDeduction *bool `json:"allow_deduction"`
|
||||
ResetCycle int64 `json:"reset_cycle"`
|
||||
RenewalReset *bool `json:"renewal_reset"`
|
||||
ShowOriginalPrice bool `json:"show_original_price"`
|
||||
}
|
||||
UpdateSubscribeRequest {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
@ -78,6 +79,7 @@ type (
|
||||
AllowDeduction *bool `json:"allow_deduction"`
|
||||
ResetCycle int64 `json:"reset_cycle"`
|
||||
RenewalReset *bool `json:"renewal_reset"`
|
||||
ShowOriginalPrice bool `json:"show_original_price"`
|
||||
}
|
||||
SubscribeSortRequest {
|
||||
Sort []SortItem `json:"sort"`
|
||||
|
||||
@ -66,7 +66,6 @@ type (
|
||||
UnbindOAuthRequest {
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
||||
GetLoginLogRequest {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
|
||||
@ -230,6 +230,7 @@ type (
|
||||
AllowDeduction bool `json:"allow_deduction"`
|
||||
ResetCycle int64 `json:"reset_cycle"`
|
||||
RenewalReset bool `json:"renewal_reset"`
|
||||
ShowOriginalPrice bool `json:"show_original_price"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
ALTER TABLE `subscribe`
|
||||
DROP COLUMN `show_original_price`;
|
||||
@ -0,0 +1,2 @@
|
||||
ALTER TABLE `subscribe`
|
||||
ADD COLUMN `show_original_price` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'display the original price: 0 not display, 1 display' AFTER `created_at`;
|
||||
@ -57,6 +57,7 @@ func (l *CreateSubscribeLogic) CreateSubscribe(req *types.CreateSubscribeRequest
|
||||
AllowDeduction: req.AllowDeduction,
|
||||
ResetCycle: req.ResetCycle,
|
||||
RenewalReset: req.RenewalReset,
|
||||
ShowOriginalPrice: req.ShowOriginalPrice,
|
||||
}
|
||||
err := l.svcCtx.SubscribeModel.Insert(l.ctx, sub)
|
||||
if err != nil {
|
||||
|
||||
@ -65,6 +65,7 @@ func (l *UpdateSubscribeLogic) UpdateSubscribe(req *types.UpdateSubscribeRequest
|
||||
AllowDeduction: req.AllowDeduction,
|
||||
ResetCycle: req.ResetCycle,
|
||||
RenewalReset: req.RenewalReset,
|
||||
ShowOriginalPrice: req.ShowOriginalPrice,
|
||||
}
|
||||
err = l.svcCtx.SubscribeModel.Update(l.ctx, sub)
|
||||
if err != nil {
|
||||
|
||||
@ -29,6 +29,7 @@ type Subscribe struct {
|
||||
AllowDeduction *bool `gorm:"type:tinyint(1);default:1;comment:Allow deduction"`
|
||||
ResetCycle int64 `gorm:"type:int;default:0;comment:Reset Cycle: 0: No Reset, 1: 1st, 2: Monthly, 3: Yearly"`
|
||||
RenewalReset *bool `gorm:"type:tinyint(1);default:0;comment:Renew Reset"`
|
||||
ShowOriginalPrice bool `gorm:"type:tinyint(1);not null;default:1;comment:Show Original Price"`
|
||||
CreatedAt time.Time `gorm:"<-:create;comment:Create Time"`
|
||||
UpdatedAt time.Time `gorm:"comment:Update Time"`
|
||||
}
|
||||
|
||||
@ -408,6 +408,7 @@ type CreateSubscribeRequest struct {
|
||||
AllowDeduction *bool `json:"allow_deduction"`
|
||||
ResetCycle int64 `json:"reset_cycle"`
|
||||
RenewalReset *bool `json:"renewal_reset"`
|
||||
ShowOriginalPrice bool `json:"show_original_price"`
|
||||
}
|
||||
|
||||
type CreateTicketFollowRequest struct {
|
||||
@ -2076,6 +2077,7 @@ type Subscribe struct {
|
||||
AllowDeduction bool `json:"allow_deduction"`
|
||||
ResetCycle int64 `json:"reset_cycle"`
|
||||
RenewalReset bool `json:"renewal_reset"`
|
||||
ShowOriginalPrice bool `json:"show_original_price"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
@ -2455,6 +2457,7 @@ type UpdateSubscribeRequest struct {
|
||||
AllowDeduction *bool `json:"allow_deduction"`
|
||||
ResetCycle int64 `json:"reset_cycle"`
|
||||
RenewalReset *bool `json:"renewal_reset"`
|
||||
ShowOriginalPrice bool `json:"show_original_price"`
|
||||
}
|
||||
|
||||
type UpdateTicketStatusRequest struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user