|
@@ -230,6 +230,7 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
|
|
|
if activecode == "topcj" {
|
|
|
f := FindOne("user", "{'s_m_openid':'"+openid+"'}")
|
|
|
username := (*f)["s_bindweixin"]
|
|
|
+ //看user里是否有黑名单字段
|
|
|
if (*f)["s_black"] != nil {
|
|
|
a.SetSession("black", "T")
|
|
|
} else {
|
|
@@ -299,6 +300,7 @@ func (a *Activemanage) Getluckdraw() error {
|
|
|
black := a.GetSession("black")
|
|
|
var i int
|
|
|
if black == "T" {
|
|
|
+ //黑名单指针范围
|
|
|
i = int(rand.Float64()*30 + 50)
|
|
|
} else {
|
|
|
i = getLuckDraw()
|
|
@@ -384,17 +386,13 @@ func (a *Activemanage) Getluckdraw() error {
|
|
|
|
|
|
//
|
|
|
func getLuckDraw() int {
|
|
|
- flog := true
|
|
|
th := time.Now().Hour()
|
|
|
- thflog := (th < 23 || th > 7)
|
|
|
+ thflog := (th < 23 && th > 7) //限时 23到第二天7点 第二套方案
|
|
|
array := []map[string]interface{}{}
|
|
|
- if !CheckLimit() {
|
|
|
- flog = true
|
|
|
- }
|
|
|
- if flog == false || thflog == false {
|
|
|
- array = LuckDraw.GetAmounttwo
|
|
|
+ if CheckLimit() || !thflog {
|
|
|
+ array = LuckDraw.GetAmounttwo //第二套方案
|
|
|
} else {
|
|
|
- array = LuckDraw.GetAmount
|
|
|
+ array = LuckDraw.GetAmount //第一套方案
|
|
|
}
|
|
|
weightValue := getWeightRandom(array)
|
|
|
min := IntAll(array[weightValue]["min"])
|