Browse Source

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

wangshan 9 years ago
parent
commit
a57810def4

+ 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
+}

+ 1 - 0
core/src/qfw/active/activemanage.go

@@ -203,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判断值

+ 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)
+}

+ 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>