|
@@ -2,6 +2,7 @@ package sys_config
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "fohow.com/apps/helper"
|
|
|
"fohow.com/cache"
|
|
"fohow.com/cache"
|
|
|
"github.com/astaxie/beego"
|
|
"github.com/astaxie/beego"
|
|
|
"github.com/astaxie/beego/orm"
|
|
"github.com/astaxie/beego/orm"
|
|
@@ -21,6 +22,7 @@ const (
|
|
|
CODE_AGENT_SHOP_APPLY = "AGENT_SHOP_APPLY"
|
|
CODE_AGENT_SHOP_APPLY = "AGENT_SHOP_APPLY"
|
|
|
CODE_AGENT_APPLY_RET = "AGENT_APPLY_RET"
|
|
CODE_AGENT_APPLY_RET = "AGENT_APPLY_RET"
|
|
|
CODE_AGENT_APPLY_QUAN = "AGENT_APPLY_QUAN"
|
|
CODE_AGENT_APPLY_QUAN = "AGENT_APPLY_QUAN"
|
|
|
|
|
+ SPECIAL_PROMOTION = "SPECIAL_PROMOTION"
|
|
|
CODE_FOHOW_OUBIAO = "oubiao"
|
|
CODE_FOHOW_OUBIAO = "oubiao"
|
|
|
CODE_FOHOW = "fohow"
|
|
CODE_FOHOW = "fohow"
|
|
|
sys_configs_tablename = "sys_configs"
|
|
sys_configs_tablename = "sys_configs"
|
|
@@ -209,7 +211,6 @@ func GetAgentAward() int64 {
|
|
|
SysConfig := &SysConfig{}
|
|
SysConfig := &SysConfig{}
|
|
|
if err := orm.NewOrm().QueryTable(SysConfig).Filter("code", CODE_AGENT_APPLY_RET).Limit(1).One(SysConfig); err != nil {
|
|
if err := orm.NewOrm().QueryTable(SysConfig).Filter("code", CODE_AGENT_APPLY_RET).Limit(1).One(SysConfig); err != nil {
|
|
|
beego.BeeLogger.Error("get SysConfig by err=%s", err)
|
|
beego.BeeLogger.Error("get SysConfig by err=%s", err)
|
|
|
- SysConfig = nil
|
|
|
|
|
return int64(0)
|
|
return int64(0)
|
|
|
}
|
|
}
|
|
|
value, err := strconv.ParseInt(SysConfig.CodeValue, 10, 64)
|
|
value, err := strconv.ParseInt(SysConfig.CodeValue, 10, 64)
|
|
@@ -241,3 +242,22 @@ func GetPayConfigByDepart(depart int64, useCache bool) string {
|
|
|
}
|
|
}
|
|
|
return item.PayCode
|
|
return item.PayCode
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+//获取特殊促销时间段配置
|
|
|
|
|
+func GetSpetialPromotion() (bool, string) {
|
|
|
|
|
+ sysConfig := SysConfig{}
|
|
|
|
|
+ if err := orm.NewOrm().QueryTable(&sysConfig).Filter("code", SPECIAL_PROMOTION).Limit(1).One(&sysConfig); err != nil {
|
|
|
|
|
+ beego.BeeLogger.Error("get sysConfig by err=%s", err)
|
|
|
|
|
+ return false, ""
|
|
|
|
|
+ }
|
|
|
|
|
+ promotionArr := helper.NewStr(sysConfig.CodeValue).Explode("_")
|
|
|
|
|
+ if len(promotionArr) > 2 {
|
|
|
|
|
+ beginTime := helper.NewStr(promotionArr[0]).ToInt64()
|
|
|
|
|
+ endTime := helper.NewStr(promotionArr[1]).ToInt64()
|
|
|
|
|
+ nowTime := time.Now().Unix()
|
|
|
|
|
+ if nowTime >= beginTime && nowTime <= endTime {
|
|
|
|
|
+ return true, sysConfig.CodeValue
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false, ""
|
|
|
|
|
+}
|