This commit is contained in:
2025-12-02 19:57:10 +08:00
parent 3440744179
commit 08ff223ff8
188 changed files with 12337 additions and 7212 deletions

View File

@@ -58,7 +58,6 @@ type (
AgentProductConfig struct {
Id int64 `db:"id"` // 主键ID
ProductId int64 `db:"product_id"` // 产品ID
ProductName string `db:"product_name"` // 产品名称
BasePrice float64 `db:"base_price"` // 基础底价BasePrice
SystemMaxPrice float64 `db:"system_max_price"` // 系统价格上限SystemMaxPrice
PriceThreshold sql.NullFloat64 `db:"price_threshold"` // 提价标准阈值PriceThreshold
@@ -83,11 +82,11 @@ func (m *defaultAgentProductConfigModel) Insert(ctx context.Context, session sql
yccAgentProductConfigIdKey := fmt.Sprintf("%s%v", cacheYccAgentProductConfigIdPrefix, data.Id)
yccAgentProductConfigProductIdKey := fmt.Sprintf("%s%v", cacheYccAgentProductConfigProductIdPrefix, data.ProductId)
return m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, agentProductConfigRowsExpectAutoSet)
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?)", m.table, agentProductConfigRowsExpectAutoSet)
if session != nil {
return session.ExecCtx(ctx, query, data.ProductId, data.ProductName, data.BasePrice, data.SystemMaxPrice, data.PriceThreshold, data.PriceFeeRate, data.DeleteTime, data.DelState, data.Version)
return session.ExecCtx(ctx, query, data.ProductId, data.BasePrice, data.SystemMaxPrice, data.PriceThreshold, data.PriceFeeRate, data.DeleteTime, data.DelState, data.Version)
}
return conn.ExecCtx(ctx, query, data.ProductId, data.ProductName, data.BasePrice, data.SystemMaxPrice, data.PriceThreshold, data.PriceFeeRate, data.DeleteTime, data.DelState, data.Version)
return conn.ExecCtx(ctx, query, data.ProductId, data.BasePrice, data.SystemMaxPrice, data.PriceThreshold, data.PriceFeeRate, data.DeleteTime, data.DelState, data.Version)
}, yccAgentProductConfigIdKey, yccAgentProductConfigProductIdKey)
}
@@ -138,9 +137,9 @@ func (m *defaultAgentProductConfigModel) Update(ctx context.Context, session sql
return m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, agentProductConfigRowsWithPlaceHolder)
if session != nil {
return session.ExecCtx(ctx, query, newData.ProductId, newData.ProductName, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id)
return session.ExecCtx(ctx, query, newData.ProductId, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id)
}
return conn.ExecCtx(ctx, query, newData.ProductId, newData.ProductName, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id)
return conn.ExecCtx(ctx, query, newData.ProductId, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id)
}, yccAgentProductConfigIdKey, yccAgentProductConfigProductIdKey)
}
@@ -161,9 +160,9 @@ func (m *defaultAgentProductConfigModel) UpdateWithVersion(ctx context.Context,
sqlResult, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ? and version = ? ", m.table, agentProductConfigRowsWithPlaceHolder)
if session != nil {
return session.ExecCtx(ctx, query, newData.ProductId, newData.ProductName, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id, oldVersion)
return session.ExecCtx(ctx, query, newData.ProductId, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id, oldVersion)
}
return conn.ExecCtx(ctx, query, newData.ProductId, newData.ProductName, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id, oldVersion)
return conn.ExecCtx(ctx, query, newData.ProductId, newData.BasePrice, newData.SystemMaxPrice, newData.PriceThreshold, newData.PriceFeeRate, newData.DeleteTime, newData.DelState, newData.Version, newData.Id, oldVersion)
}, yccAgentProductConfigIdKey, yccAgentProductConfigProductIdKey)
if err != nil {
return err