wangshan 9 жил өмнө
parent
commit
6ea9129ffa

+ 33 - 0
core/src/luckdraw.json

@@ -34,6 +34,39 @@
 		"max":350,
 		"proportion":15
 	}],
+	"getAmounttwo":[{
+		"min":0,
+		"max":35,
+		"proportion":0
+	},{
+		"min":50,
+		"max":80,
+		"proportion":24.71
+	},{
+		"min":95,
+		"max":120,
+		"proportion":0.5
+	},{
+		"min":140,
+		"max":175,
+		"proportion":50
+	},{
+		"min":190,
+		"max":220,
+		"proportion":0
+	},{
+		"min":235,
+		"max":270,
+		"proportion":24.71
+	},{
+		"min":280,
+		"max":310,
+		"proportion":0.08
+	},{
+		"min":325,
+		"max":350,
+		"proportion":0
+	}],
 	"promotioncode":"2001001501",
 	"weixin":{
 		"sendname":"企明星",

+ 24 - 5
core/src/qfw/active/activemanage.go

@@ -17,6 +17,7 @@ import (
 	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -53,7 +54,12 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 	if activecode == "topcj" {
 		f := FindOne("user", "{'s_m_openid':'"+openid+"'}")
 		username := (*f)["s_bindweixin"]
-		userid := (*f)["_id"]
+		if (*f)["s_black"] != nil {
+			a.SetSession("black", "T")
+		} else {
+			a.SetSession("black", "F")
+		}
+		userid := strings.Split(fmt.Sprintf("%s", (*f)["_id"]), `"`)[1]
 		if *f == nil {
 			a.T["flog"] = "B"
 			a.T["msg"] = "您的微信号无效!!"
@@ -113,8 +119,13 @@ func (a *Activemanage) Getluckdraw() error {
 	data := make(map[string]interface{})
 	data["s_openid"] = openid
 	data["s_actcode"] = s_actcode
-	i := getLuckDraw()
-
+	black := a.GetSession("black")
+	var i int
+	if black == "T" {
+		i = int(rand.Float64()*30 + 50)
+	} else {
+		i = getLuckDraw()
+	}
 	s_prize := getPrize(i)
 	data["s_prize"] = s_prize
 	data["i_degree"] = i
@@ -180,7 +191,7 @@ func (a *Activemanage) Getluckdraw() error {
 		msg = "  小主是真真的好运气," + s_prize + "落入您囊中。请将您的联系方式和邮寄地址留言给企明星。我们会在活动截止后尽快为您发出。<br/><br/>  分享至朋友圈或好友即可以获得明天抽奖资格呦!乖,快去分享吧!大奖可能就在明天~~"
 		//}
 	} else if i > 139 && i < 176 {
-		obid := BsonIdToSId(a.GetSession("userId"))
+		obid := a.GetSession("userId").(string)
 		b := credit.UpuserCreditSession(obid, "b6", "B", nil, a.Action)
 		if b == true {
 			msg = "  小主是真真的好运气,200积分落入您囊中。积分将由系统自动发放到您的企明星账户,请登录www.qmx.top查看。<br/><br/>  分享至朋友圈或好友即可以获得明天抽奖资格呦!乖,快去分享吧!大奖可能就在明天~~"
@@ -196,7 +207,15 @@ func (a *Activemanage) Getluckdraw() error {
 
 //
 func getLuckDraw() int {
-	array := LuckDraw.GetAmount
+	flog := true
+	th := time.Now().Hour()
+	thflog := (th < 23 || th > 7)
+	array := []map[string]interface{}{}
+	if flog == false || thflog == false {
+		array = LuckDraw.GetAmounttwo
+	} else {
+		array = LuckDraw.GetAmount
+	}
 	weightValue := getWeightRandom(array)
 	min := IntAll(array[weightValue]["min"])
 	max := IntAll(array[weightValue]["max"])

+ 1 - 0
core/src/qfw/coreconfig/LuckDraw.go

@@ -7,6 +7,7 @@ import (
 //系统配置
 type luckDraw struct {
 	GetAmount     []map[string]interface{} `json:"getAmount"`
+	GetAmounttwo  []map[string]interface{} `json:"getAmounttwo"`
 	StartDate     int64                    `json:"startDate"`
 	EndDate       int64                    `json:"endDate"`
 	Promotioncode string                   `json:"promotioncode"`

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-29 08:28:58"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-29 08:28:58"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-29 15:54:12"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-29 15:54:12"}},"marketisstart":true,"marketrate":300}