This commit is contained in:
parent
f792157d6e
commit
dcfcd036de
@ -0,0 +1,12 @@
|
|||||||
|
-- Revert: remove new_user_only column from subscribe table
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'subscribe'
|
||||||
|
AND COLUMN_NAME = 'new_user_only');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `subscribe` DROP COLUMN `new_user_only`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
-- Add new_user_only column to subscribe table
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'subscribe'
|
||||||
|
AND COLUMN_NAME = 'new_user_only');
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `subscribe` ADD COLUMN `new_user_only` tinyint(1) DEFAULT 0 COMMENT ''New user only: allow purchase within 24h of registration, once per user'' AFTER `quota`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
@ -33,7 +33,7 @@ func NewGetPaymentMethodListLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
|||||||
func (l *GetPaymentMethodListLogic) GetPaymentMethodList(req *types.GetPaymentMethodListRequest) (resp *types.GetPaymentMethodListResponse, err error) {
|
func (l *GetPaymentMethodListLogic) GetPaymentMethodList(req *types.GetPaymentMethodListRequest) (resp *types.GetPaymentMethodListResponse, err error) {
|
||||||
total, list, err := l.svcCtx.PaymentModel.FindListByPage(l.ctx, req.Page, req.Size, &payment.Filter{
|
total, list, err := l.svcCtx.PaymentModel.FindListByPage(l.ctx, req.Page, req.Size, &payment.Filter{
|
||||||
Search: req.Search,
|
Search: req.Search,
|
||||||
Mark: req.Platform,
|
Platform: req.Platform,
|
||||||
Enable: req.Enable,
|
Enable: req.Enable,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -56,8 +56,8 @@ func (m *customPaymentModel) FindListByPage(ctx context.Context, page, size int,
|
|||||||
if req.Enable != nil {
|
if req.Enable != nil {
|
||||||
conn = conn.Where("`enable` = ?", *req.Enable)
|
conn = conn.Where("`enable` = ?", *req.Enable)
|
||||||
}
|
}
|
||||||
if req.Mark != "" {
|
if req.Platform != "" {
|
||||||
conn = conn.Where("`mark` = ?", req.Mark)
|
conn = conn.Where("`platform` = ?", req.Platform)
|
||||||
}
|
}
|
||||||
if req.Search != "" {
|
if req.Search != "" {
|
||||||
conn = conn.Where("`name` LIKE ?", "%"+req.Search+"%")
|
conn = conn.Where("`name` LIKE ?", "%"+req.Search+"%")
|
||||||
@ -72,7 +72,7 @@ func (m *customPaymentModel) FindListByPage(ctx context.Context, page, size int,
|
|||||||
func (m *customPaymentModel) FindListByPlatform(ctx context.Context, platform string) ([]*Payment, error) {
|
func (m *customPaymentModel) FindListByPlatform(ctx context.Context, platform string) ([]*Payment, error) {
|
||||||
var resp []*Payment
|
var resp []*Payment
|
||||||
err := m.QueryNoCacheCtx(ctx, &resp, func(conn *gorm.DB, v interface{}) error {
|
err := m.QueryNoCacheCtx(ctx, &resp, func(conn *gorm.DB, v interface{}) error {
|
||||||
return conn.Model(&Payment{}).Where("mark = ?", platform).Find(v).Error
|
return conn.Model(&Payment{}).Where("platform = ?", platform).Find(v).Error
|
||||||
})
|
})
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ func (l *Payment) BeforeDelete(_ *gorm.DB) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Filter struct {
|
type Filter struct {
|
||||||
Mark string
|
Platform string
|
||||||
Enable *bool
|
Enable *bool
|
||||||
Search string
|
Search string
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user