同步
This commit is contained in:
@@ -106,7 +106,7 @@ func buildMiniprogramConfig() gin.H {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 好友优惠(用于 read 页展示优惠价)
|
||||
// 好友优惠与分润(用于 read 页展示优惠价、分享提示分润比例)
|
||||
var refRow model.SystemConfig
|
||||
if err := db.Where("config_key = ?", "referral_config").First(&refRow).Error; err == nil {
|
||||
var refVal map[string]interface{}
|
||||
@@ -114,6 +114,10 @@ func buildMiniprogramConfig() gin.H {
|
||||
if v, ok := refVal["userDiscount"].(float64); ok {
|
||||
out["userDiscount"] = v
|
||||
}
|
||||
// 内容订单分润比例(0-100),供小程序 read/referral 页展示
|
||||
if v, ok := refVal["distributorShare"].(float64); ok {
|
||||
out["shareRate"] = int(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, has := out["userDiscount"]; !has {
|
||||
@@ -218,6 +222,7 @@ func GetCoreConfig(c *gin.Context) {
|
||||
"prices": full["prices"],
|
||||
"features": full["features"],
|
||||
"userDiscount": full["userDiscount"],
|
||||
"shareRate": full["shareRate"],
|
||||
"mpConfig": full["mpConfig"],
|
||||
}
|
||||
if out["prices"] == nil {
|
||||
@@ -229,6 +234,9 @@ func GetCoreConfig(c *gin.Context) {
|
||||
if out["userDiscount"] == nil {
|
||||
out["userDiscount"] = float64(5)
|
||||
}
|
||||
if out["shareRate"] == nil {
|
||||
out["shareRate"] = 90
|
||||
}
|
||||
if out["mpConfig"] == nil {
|
||||
out["mpConfig"] = gin.H{}
|
||||
}
|
||||
@@ -305,6 +313,7 @@ func WarmConfigCache() {
|
||||
"prices": out["prices"],
|
||||
"features": out["features"],
|
||||
"userDiscount": out["userDiscount"],
|
||||
"shareRate": out["shareRate"],
|
||||
"mpConfig": out["mpConfig"],
|
||||
}
|
||||
if core["prices"] == nil {
|
||||
@@ -316,6 +325,9 @@ func WarmConfigCache() {
|
||||
if core["userDiscount"] == nil {
|
||||
core["userDiscount"] = float64(5)
|
||||
}
|
||||
if core["shareRate"] == nil {
|
||||
core["shareRate"] = 90
|
||||
}
|
||||
if core["mpConfig"] == nil {
|
||||
core["mpConfig"] = gin.H{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user