瀏覽代碼

Merge branch 'develop' of http://192.168.3.17/gitlab/zhanghongbo/qfw into develop

zhanghongbo 9 年之前
父節點
當前提交
db57f6bf50

+ 17 - 0
common/src/qfw/util/credit/credit.go

@@ -8,6 +8,7 @@ import (
 	"qfw/util"
 	mogo "qfw/util/mongodb"
 	"qfw/util/rpc"
+	"time"
 )
 
 var Rc rpc.RpcCall
@@ -215,3 +216,19 @@ func UpuserCreditSession(userId, code, dtype string, param map[string]interface{
 	})
 	return b
 }
+
+//其他更新积分接口--如 翻牌
+func OtherUpuserCredit(userId string, value int, clog map[string]interface{}, xb *xweb.Action) bool {
+	b := mogo.Update("user", `{"_id":"`+userId+`"}`, &map[string]interface{}{"$set": &map[string]interface{}{"i_credit": value}}, false, false)
+	if b {
+		//更新session
+		xb.Session().UpdateByCustomField("id", userId, "i_credit", value)
+		//记录日志
+		clog["s_uid"] = userId
+		clog["i_scorenow"] = value
+		clog["l_date"] = time.Now().Unix()
+		clog["l_datenm"] = time.Now().UnixNano() / 1000000
+		mogo.Save("creditlog", clog)
+	}
+	return b
+}

+ 2 - 2
core/src/luckdraw.json

@@ -34,7 +34,7 @@
 	},{
 		"min":280,
 		"max":310,
-		"proportion":0.08,
+		"proportion":0,
 		"txt":"书"
 	},{
 		"min":325,
@@ -75,7 +75,7 @@
 	},{
 		"min":280,
 		"max":310,
-		"proportion":0.08,
+		"proportion":0,
 		"txt":"书"
 	},{
 		"min":325,

+ 32 - 10
core/src/qfw/active/activemanage.go

@@ -121,6 +121,7 @@ func limitFun() {
 
 //解除限制的监测
 func unlimitFun() {
+
 	limitLock.Lock()
 	//非限制状态
 	if limitStatus {
@@ -202,6 +203,7 @@ type Activemanage struct {
 	luckdraw    xweb.Mapper `xweb:"/activity/(\\w+)/([^.]*)"`
 	getluckdraw xweb.Mapper `xweb:"/activity/luckdraw"`
 	addredis    xweb.Mapper `xweb:"/activity/addredis"`
+	flop        xweb.Mapper `xweb:"/activity/flop/(.*)"`
 }
 
 //分享成功后建立redis判断值
@@ -222,6 +224,13 @@ func (a *Activemanage) Addredis() error {
 
 //进入抽奖页面
 func (a *Activemanage) Luckdraw(activecode, id string) error {
+	nowdate := time.Now().Unix()
+	enddate := LuckDraw.EndDate
+	if nowdate > enddate {
+		a.T["flog"] = "G"
+		a.T["msg"] = "  抱歉,来晚了,活动已经结束了!敬请期待下一次活动吧,注意看预告呦……"
+		return a.Render("/active/luckdraw.html", &a.T)
+	}
 	//userInfo := a.GetSession("userInfo").(*map[string]interface{})
 	//se := SimpleEncrypt{Key: "topnet2015topnet2015"}
 	openid := se.DecodeString(id)
@@ -239,7 +248,7 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 		userid := strings.Split(fmt.Sprintf("%s", (*f)["_id"]), `"`)[1]
 		if *f == nil {
 			a.T["flog"] = "B"
-			a.T["msg"] = "您的微信号无效!!"
+			a.T["msg"] = "  您的微信号无效!!"
 			return a.Render("/active/luckdraw.html", &a.T)
 		}
 		a.SetSession("userName", username)
@@ -297,12 +306,13 @@ func (a *Activemanage) Getluckdraw() error {
 	data["s_openid"] = openid
 	data["s_actcode"] = s_actcode
 	black := a.GetSession("black")
+	plan := redis.GetStr("other", "s_luckydraw_mode")
 	var i int
-	if black == "T" {
+	if black == "T" || plan == "" || plan == "3" {
 		//黑名单指针范围
-		i = rand.Intn(30) + 50
+		i = rand.Intn(30) + 50 //手动第三套方案
 	} else {
-		i = getLuckDraw()
+		i = getLuckDraw(plan)
 	}
 	s_prize := getPrize(i)
 	data["s_prize"] = s_prize
@@ -312,6 +322,10 @@ func (a *Activemanage) Getluckdraw() error {
 	enddate := LuckDraw.EndDate
 	if nowdate < enddate {
 		id = Save("winningrecord", data)
+	} else {
+		flog = "G"
+		msg = "  抱歉,来晚了,活动已经结束了!敬请期待下一次活动吧,注意看预告呦……"
+		return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
 	}
 	if len(id) > 0 {
 		flog = "T"
@@ -366,7 +380,7 @@ func (a *Activemanage) Getluckdraw() error {
 		//
 		//	msg = "  小主是真真的好运气," + s_prize + "落入您囊中!<br/>  请在微信留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!<br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
 		//} else { //在工作时间
-		msg = "  小主是真真的好运气," + s_prize + "落入您囊中。请将您的联系方式和邮寄地址留言给企明星。我们会在活动截止后尽快为您发出。<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+		msg = "  小主是真真的好运气," + s_prize + "落入您囊中。请将您的姓名+联系方式+邮寄地址留言给企明星。我们会在活动截止后尽快为您发出。<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
 		//}
 	} else if i > 139 && i < 176 {
 		obid := a.GetSession("userId").(string)
@@ -384,14 +398,22 @@ func (a *Activemanage) Getluckdraw() error {
 }
 
 //
-func getLuckDraw() int {
+func getLuckDraw(plan string) int {
 	th := time.Now().Hour()
 	thflog := (th < 23 && th > 7) //限时 23到第二天7点 第二套方案
 	array := []map[string]interface{}{}
-	if CheckLimit() || !thflog {
-		array = LuckDraw.GetAmounttwo //第二套方案
-	} else {
-		array = LuckDraw.GetAmount //第一套方案
+	//手动
+	if plan == "1" {
+		array = LuckDraw.GetAmount //手动第一套方案
+	} else if plan == "2" {
+		array = LuckDraw.GetAmounttwo //手动第二套方案
+	} else if plan == "0" {
+		//自动
+		if CheckLimit() || !thflog {
+			array = LuckDraw.GetAmounttwo //第二套方案
+		} else {
+			array = LuckDraw.GetAmount //第一套方案
+		}
 	}
 	weightValue := getWeightRandom(array)
 	min := IntAll(array[weightValue]["min"])

+ 35 - 0
core/src/qfw/active/flop.go

@@ -0,0 +1,35 @@
+package active
+
+import (
+	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
+	"qfw/coreutil"
+	"qfw/util/credit"
+	"qfw/util/mongodb"
+)
+
+func (a *Activemanage) Flop(openid string) error {
+	var s_openid string
+	if a.GetSession("s_m_openid") == nil {
+		s_openid = openid
+		a.T["flag"] = false
+	} else {
+		s_openid = a.GetSession("s_m_openid").(string)
+		a.T["flag"] = true
+		a.T["shareid"] = coreutil.FindMyShareId("topjy", s_openid)
+	}
+	if data := mongodb.FindOne("flop", bson.M{"s_openid": openid}); data != nil && len(*data) > 0 {
+		a.T["data"] = *data
+	}
+	return a.Render("/active/flop.html", &a.T)
+}
+
+//翻福卡修改积分
+func updateCredit(id string, o_value1, n_value int, xb *xweb.Action) bool {
+	clog := make(map[string]interface{})
+	clog["s_code"] = "o_fp" //福卡翻牌
+	clog["i_score"] = n_value - o_value1
+	clog["s_operation"] = "福卡翻牌"
+	clog["i_type"] = 1
+	return credit.OtherUpuserCredit(id, n_value, clog, xb)
+}

+ 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-02-01 14:22:18"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-01 14:22:18"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-02 09:23:15"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-02 09:23:15"}},"marketisstart":true,"marketrate":300}

+ 1 - 1
core/src/web/staticres/js/qfw.js

@@ -1,4 +1,4 @@
-var hasNewActive = new Date() >= Date.parse(new Date("2015/12/14 00:00:00")) && new Date() < Date.parse(new Date("2016/2/1 00:00:00"));
+var hasNewActive = new Date() >= Date.parse(new Date("2015/12/14 00:00:00")) && new Date() < Date.parse(new Date("2016/2/15 00:00:00"));
 //网站初始化状态
 var webSiteInitFlag = true;
 //登录状态 false--未登录,true--已登录

+ 75 - 0
core/src/web/templates/active/flop.html

@@ -0,0 +1,75 @@
+<html>
+<head>
+<title>企明星-剑鱼</title>
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+<link href="/wxswordfish/style.css" rel="stylesheet">
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="/js/jquery.js"></script>
+<script src="/wxswordfish/share.js"></script>
+<script>
+	initShare({{.T.signature}},{{.T.shareid}});
+</script>
+<style type="text/css">
+body{
+	margin: 0px;
+	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
+	-webkit-tap-highlight-color: transparent;
+}
+ul{
+	list-style: none;
+	padding: 0px;
+	margin: 0px;
+}
+img{
+	vertical-align: sub;
+}
+.brand a{
+	display: block;
+	float: left;
+	margin: 20px;
+	width: 180px;
+	height: 240px;
+	text-align: center;
+	position: relative;
+}
+.brand img{
+	width: 180px;
+	height: 240px;
+}
+.brand .info{
+	display: none;
+	background-color: #f0f0f0;
+	color: #369242;
+	line-height:240px;
+}
+.vertical .info{
+	width: 0;
+	height: 240px;
+	margin: 0 auto;
+}
+</style>
+</head>
+<body>
+
+
+
+
+<script type="text/javascript">
+var turn = function(target,time,opts){
+	target.find('a').hover(function(){
+		$(this).find('img').stop().animate(opts[0],time,function(){
+			$(this).hide().next().show();
+			$(this).next().animate(opts[1],time);
+		});
+	},function(){
+		$(this).find('.info').animate(opts[0],time,function(){
+			$(this).hide().prev().show();
+			$(this).prev().animate(opts[1],time);
+		});
+	});
+}
+var verticalOpts = [{'width':0},{'width':'180px'}];
+turn($('#vertical'),100,verticalOpts);
+</script>
+</body>
+</html>

+ 6 - 2
core/src/web/templates/active/luckdraw.html

@@ -83,6 +83,10 @@ $(function(){
 		$(".modal-body").html("{{.T.msg}}")
 		$(".modstart").click();
 		$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
+	}else if (flog == "G"){
+		$(".modal-body").html("{{.T.msg}}")
+		$(".modstart").click();
+		$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 	}
      $("#btn_run").click(function(){
 		$("#btn_run").attr('disabled',true).css("cursor","default"); 
@@ -115,8 +119,8 @@ function lottery(){
 			}else if (obj.flog=="A"){
 				$(".modal-body").html(obj.msg)
 				$(".modstart").click();
-			}else if (obj.flog=="F"){
-				$(".modal-body").html("  小主来晚了,抽奖活动已过期!如果有疑问请联系企明星!")
+			}else if (obj.flog=="G"){
+				$(".modal-body").html(obj.msg)
 				$(".modstart").click();
 			}
         } 

+ 8 - 0
core/src/web/templates/common/memberleft.html

@@ -380,6 +380,14 @@ function bookinfo(isInCredit){
 				if(r[1]>7){
 					r[1]=1;
 				}
+				var yes=new Date();
+				yes.setDate(yes.getDate()-1);
+				yes.setHours(0);
+				yes.setMinutes(0);
+				yes.setSeconds(0);
+				if (r[0]*1000<yes.getTime()){
+					r[1]=0;
+				}
 				for(var i=0;i<r[1];i++){
 					var src=images.eq(i).attr("src");
 					if (src.indexOf("ff")==-1){

+ 4 - 2
core/src/web/templates/index.html

@@ -23,12 +23,14 @@
 		</div>
 		<div class="a-i-h-middle">
 			<div id="carousel-generic" class="carousel slide" data-ride="carousel">
-			    <ol class="carousel-indicators">
-					{{$s:=(Ad "index-center-01" 4)}}
+			    {{$s:=(Ad "index-center-01" 4)}}
+				{{if gt (len $s) 1}}
+				<ol class="carousel-indicators">
 					{{range $k,$v := $s}}
 					<li data-target="#carousel-generic" data-slide-to="{{$k}}"{{if eq $k 0}} class="active"{{end}}></li>
 					{{end}}
 			    </ol>
+				{{end}}
 			    <div class="carousel-inner" role="listbox">
 					{{$s:=(Ad "index-center-01" 4)}}
 					{{range $k,$v := $s}}

+ 8 - 0
core/src/web/templates/member/credit/mcreditindex.html

@@ -336,6 +336,14 @@
 						if(r[1]>7){
 							r[1]=1;
 						}
+						var yes=new Date();
+						yes.setDate(yes.getDate()-1);
+						yes.setHours(0);
+						yes.setMinutes(0);
+						yes.setSeconds(0);
+						if (r[0]*1000<yes.getTime()){
+							r[1]=0;
+						}
 						for(var i=0;i<r[1];i++){
 							var src=images.eq(i).attr("src");
 							if (src.indexOf("ff")==-1){