x
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m46s

This commit is contained in:
shanshanzhong 2026-03-08 22:37:58 -07:00
parent f792157d6e
commit dcfcd036de
5 changed files with 33 additions and 9 deletions

View File

@ -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;

View File

@ -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;

View File

@ -32,9 +32,9 @@ func NewGetPaymentMethodListLogic(ctx context.Context, svcCtx *svc.ServiceContex
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{
Search: req.Search,
Mark: req.Platform,
Enable: req.Enable,
Search: req.Search,
Platform: req.Platform,
Enable: req.Enable,
})
if err != nil {
l.Errorw("find payment method list error", logger.Field("error", err.Error()))

View File

@ -56,8 +56,8 @@ func (m *customPaymentModel) FindListByPage(ctx context.Context, page, size int,
if req.Enable != nil {
conn = conn.Where("`enable` = ?", *req.Enable)
}
if req.Mark != "" {
conn = conn.Where("`mark` = ?", req.Mark)
if req.Platform != "" {
conn = conn.Where("`platform` = ?", req.Platform)
}
if 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) {
var resp []*Payment
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
}

View File

@ -34,9 +34,9 @@ func (l *Payment) BeforeDelete(_ *gorm.DB) (err error) {
}
type Filter struct {
Mark string
Enable *bool
Search string
Platform string
Enable *bool
Search string
}
type StripeConfig struct {