소스 검색

首页cdn

wangshan 9 년 전
부모
커밋
22a20c98ba
70개의 변경된 파일1428개의 추가작업 그리고 300개의 파일을 삭제
  1. 17 0
      common/src/qfw/util/credit/credit.go
  2. 15 0
      common/src/qfw/util/mongodb/mongodbutil_test.go
  3. 47 0
      core/src/flop.json
  4. 1 0
      core/src/message.json
  5. 7 0
      core/src/qfw/active/active.go
  6. 62 17
      core/src/qfw/active/activemanage.go
  7. 145 0
      core/src/qfw/active/flop.go
  8. 18 0
      core/src/qfw/coreconfig/Flop.go
  9. 1 0
      core/src/qfw/coreconfig/coreconfig.go
  10. 1 2
      core/src/qfw/coreutil/Int64_test.go
  11. 4 0
      core/src/seo.json
  12. 6 1
      core/src/timetask.json
  13. 3 0
      core/src/web/staticres/css/index-new.css
  14. 2 2
      core/src/web/staticres/css/swordfish.css
  15. BIN
      core/src/web/staticres/images/flop/bg-1.png
  16. BIN
      core/src/web/staticres/images/flop/bg-2.png
  17. BIN
      core/src/web/staticres/images/flop/blessing.png
  18. BIN
      core/src/web/staticres/images/flop/btn.png
  19. BIN
      core/src/web/staticres/images/flop/bubble.png
  20. BIN
      core/src/web/staticres/images/flop/card-1.png
  21. BIN
      core/src/web/staticres/images/flop/card-2.png
  22. BIN
      core/src/web/staticres/images/flop/card-3.png
  23. BIN
      core/src/web/staticres/images/flop/card-4.png
  24. BIN
      core/src/web/staticres/images/flop/card-5.png
  25. BIN
      core/src/web/staticres/images/flop/card-6.png
  26. BIN
      core/src/web/staticres/images/flop/card.png
  27. BIN
      core/src/web/staticres/images/flop/flop-notice.png
  28. BIN
      core/src/web/staticres/images/flop/min-blessing.png
  29. BIN
      core/src/web/staticres/images/flop/tip-bg.png
  30. BIN
      core/src/web/staticres/images/swordfish/guide-1.png
  31. BIN
      core/src/web/staticres/images/swordfish/guide-2.png
  32. BIN
      core/src/web/staticres/images/swordfish/guide-3.png
  33. BIN
      core/src/web/staticres/images/swordfish/guide-4.png
  34. BIN
      core/src/web/staticres/images/swordfish/guide-5.png
  35. 1 1
      core/src/web/staticres/js/qfw.js
  36. BIN
      core/src/web/staticres/wxswordfish/images/guide-0.png
  37. BIN
      core/src/web/staticres/wxswordfish/images/min-share-icon.png
  38. BIN
      core/src/web/staticres/wxswordfish/images/share-cj.jpg
  39. BIN
      core/src/web/staticres/wxswordfish/images/share-cj.png
  40. 2 2
      core/src/web/staticres/wxswordfish/share.js
  41. 347 0
      core/src/web/templates/active/flop.html
  42. 18 14
      core/src/web/templates/active/luckdraw.html
  43. 1 1
      core/src/web/templates/common/login.html
  44. 8 0
      core/src/web/templates/common/memberleft.html
  45. 1 1
      core/src/web/templates/common/swordfishhead.html
  46. 4 4
      core/src/web/templates/common/top.html
  47. 9 2
      core/src/web/templates/index.html
  48. 8 0
      core/src/web/templates/member/credit/mcreditindex.html
  49. 2 2
      core/src/web/templates/swordfish/rssset.html
  50. 15 15
      core/src/web/templates/swordfish/wxindex.html
  51. 3 3
      core/src/web/templates/swordfish/wxpush.html
  52. 13 13
      core/src/web/templates/swordfish/wxrssset.html
  53. 14 14
      core/src/web/templates/swordfish/wxshare.html
  54. 4 4
      core/src/web/templates/swordfish/wxshare_copy.html
  55. 14 27
      core/src/web/templates/swordfish/wxshareguide.html
  56. 3 3
      core/src/web/templates/swordfish/wxtoolbar.html
  57. 8 4
      weixin/src/config.json
  58. 6 2
      weixin/src/qfw/weixin/dao/sharedao.go
  59. 35 1
      weixin/src/qfw/weixin/dao/userdao.go
  60. 1 1
      weixin/src/qfw/weixin/menu.go
  61. 32 0
      weixin/src/qfw/weixin/msgaction.go
  62. 26 91
      weixin/src/qfw/weixin/msgtxtchandler.go
  63. 113 17
      weixin/src/qfw/weixin/subscribehandler.go
  64. 4 1
      weixin/src/qfw/weixin/txt_test.go
  65. 1 1
      weixin/src/qfw/weixin/util/subscribefilter.go
  66. 2 20
      weixin/src/qfw/weixin/voicehandler.go
  67. 30 2
      weixin/src/qfw/weixin/weixin.go
  68. 331 0
      weixin/src/qfw/weixin/wxadmin.go
  69. 10 2
      weixin/src/qfw/weixinconfig/config_test.go
  70. 33 30
      weixin/src/qfw/weixinconfig/weixinconfig.go

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

+ 15 - 0
common/src/qfw/util/mongodb/mongodbutil_test.go

@@ -82,3 +82,18 @@ func Test_reg(t *testing.T) {
 	log.Println(con.ReplaceAllString(s, ""))
 
 }
+
+func Test_aggregate(t *testing.T) {
+	InitMongodbPool(1, "192.168.3.18:27080", "qfw")
+	sess := GetMgoConn()
+	defer DestoryMongoConn(sess)
+	var res []M
+	sess.DB("qfw").C("user").Pipe([]M{M{"$match": M{"l_registedate": M{"$gte": 1436326192}}},
+		M{"$group": M{"_id": "$black", "count": M{"$sum": 1}}}}).All(&res)
+	var sun int
+	for _, v := range res {
+		log.Println(v["_id"] == nil)
+	}
+	log.Println(res, sun)
+
+}

+ 47 - 0
core/src/flop.json

@@ -0,0 +1,47 @@
+{
+    "isOver": false,
+    "multiple": [
+        {
+            "multiple": 2,
+            "proportion": 0.9
+        },
+        {
+            "multiple": 3,
+            "proportion": 60
+        },
+        {
+            "multiple": 5,
+            "proportion": 30
+        },
+        {
+            "multiple": 6,
+            "proportion": 0.1
+        }
+    ],
+	"cards":[
+		{
+			"type":1,
+			"words":"薪水蹭蹭涨上天"
+		},
+		{
+			"type":2,
+			"words":"闪闪亮亮惹人爱"
+		},
+		{
+			"type":3,
+			"words":"驰骋职场棒棒哒"
+		},
+		{
+			"type":4,
+			"words":"身体强壮如金刚"
+		},
+		{
+			"type":5,
+			"words":"新年桃花朵朵开"
+		},
+		{
+			"type":6,
+			"words":"瘦出魔鬼好身材"
+		}
+	]
+}

+ 1 - 0
core/src/message.json

@@ -6,6 +6,7 @@
 	"lawsearchaction":"/law/qfw/index",
 	"msiteaction":"/ent/wsite/edit",
 	"wxpushlist":"/wxpush/bidinfo/%s",
+	"turncards":"/active/flop/in/in",
 	"indentify":{
 		"success":{
 			"result":"企业认证",

+ 7 - 0
core/src/qfw/active/active.go

@@ -8,8 +8,15 @@ import (
 
 var se util.SimpleEncrypt = util.SimpleEncrypt{Key: "topnet2015topnet2015"}
 
+type Active struct {
+	*xweb.Action
+	flop     xweb.Mapper `xweb:"/active/flop/(\\w+)/([^.]*)"`
+	flopAjax xweb.Mapper `xweb:"/active/flopAjax"`
+}
+
 //抽奖活动
 func init() {
 	//添加模块解析
+	xweb.AddAction(&Active{})
 	xweb.AddAction(&Activemanage{})
 }

+ 62 - 17
core/src/qfw/active/activemanage.go

@@ -121,6 +121,7 @@ func limitFun() {
 
 //解除限制的监测
 func unlimitFun() {
+
 	limitLock.Lock()
 	//非限制状态
 	if limitStatus {
@@ -222,6 +223,13 @@ func (a *Activemanage) Addredis() error {
 
 //进入抽奖页面
 func (a *Activemanage) Luckdraw(activecode, id string) error {
+	nowdate := time.Now()
+	enddate := LuckDraw.EndDate
+	if nowdate.Unix() > 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 +247,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)
@@ -259,8 +267,13 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 				} else {
 					a.T["msg"] = "  小主已获得明天的抽奖资格!明天记得要来啊~"
 				}
-				return a.Render("/active/luckdraw.html", &a.T)
+			} else {
+				a.T["msg"] = "  小主已获得明天的抽奖资格!明天记得要来啊~"
+			}
+			if nowdate.Day() == 15 {
+				a.T["msg"] = "  小主,明天抽奖活动就结束了,请期待企明星的下一次活动吧!"
 			}
+			return a.Render("/active/luckdraw.html", &a.T)
 		}
 
 		return a.Render("/active/luckdraw.html", &a.T)
@@ -287,7 +300,11 @@ func (a *Activemanage) Getluckdraw() error {
 			if ret := redis.Get("other", "cj_"+openid+"_"+time.Now().Format("2006_01_02")); ret == nil {
 				//a.T = *u
 				a.T["flog"] = "A"
-				a.T["msg"] = "  小主,分享给好友参加明天的抽奖吧!千万不要再忘记了,大奖可能就在明天~"
+				if today.Day() == 15 {
+					a.T["msg"] = "  小主,明天抽奖活动就结束了,请期待企明星的下一次活动吧!"
+				} else {
+					a.T["msg"] = "  小主,分享给好友参加明天的抽奖吧!千万不要再忘记了,大奖可能就在明天~"
+				}
 				return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
 			}
 			redis.Del("other", "cj_"+openid+"_"+time.Now().Format("2006_01_02"))
@@ -297,12 +314,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 +330,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"
@@ -355,9 +377,12 @@ func (a *Activemanage) Getluckdraw() error {
 			redpackage_fail["i_amount"] = amount
 			redpackage_fail["l_createdate"] = today.Unix()
 			Save("redpackage_fail", redpackage_fail)
-
 		}
-		msg = "  小主是真真的好运气," + s_prize + "落入您囊中。红包将由系统自动发放到您的微信,请注意查收。<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+		if today.Day() == 15 {
+			msg = "  小主是真真的好运气," + s_prize + "落入您囊中。红包将由系统自动发放到您的微信,请注意查收。<br/><br/>  明天抽奖活动就结束了,请期待企明星的下一次活动吧!"
+		} else {
+			msg = "  小主是真真的好运气," + s_prize + "落入您囊中。红包将由系统自动发放到您的微信,请注意查收。<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+		}
 	} else if (i > 279 && i < 311) || (i > 94 && i < 121) {
 		//时间判断,提醒不同
 		//now := time.Now()
@@ -366,7 +391,12 @@ func (a *Activemanage) Getluckdraw() error {
 		//
 		//	msg = "  小主是真真的好运气," + s_prize + "落入您囊中!<br/>  请在微信留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!<br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
 		//} else { //在工作时间
-		msg = "  小主是真真的好运气," + s_prize + "落入您囊中。请将您的联系方式和邮寄地址留言给企明星。我们会在活动截止后尽快为您发出。<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+
+		if today.Day() == 15 {
+			msg = "  小主是真真的好运气," + s_prize + "落入您囊中。红包将由系统自动发放到您的微信,请注意查收。<br/><br/>  明天抽奖活动就结束了,请期待企明星的下一次活动吧!"
+		} else {
+			msg = "  小主是真真的好运气," + s_prize + "落入您囊中。请将您的姓名+联系方式+邮寄地址留言给企明星。我们会在活动截止后尽快为您发出。<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+		}
 		//}
 	} else if i > 139 && i < 176 {
 		obid := a.GetSession("userId").(string)
@@ -376,22 +406,37 @@ func (a *Activemanage) Getluckdraw() error {
 		} else {
 			msg = "  抽奖出错!小主不要桑心,联系企明星管理员,200积分还是您的!"
 		}
+		if today.Day() == 15 {
+			msg = "  小主是真真的好运气,200积分落入您囊中。积分将由系统自动发放到您的企明星账户,请登录www.qmx.top查看。<br/><br/>  明天抽奖活动就结束了,请期待企明星的下一次活动吧!"
+		}
 	} else { //不中奖
-		msg = "  小主不要桑心,这次没有中奖哦,明天记得要来拼运气啊!<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+		if today.Day() == 15 {
+			msg = "  小主不要桑心,这次没有中奖哦,明天抽奖活动就结束了,请期待企明星的下一次活动吧!"
+		} else {
+			msg = "  小主不要桑心,这次没有中奖哦,明天记得要来拼运气啊!<br/><br/>  分享给好友参加明天抽奖呦!乖,快去分享吧!大奖可能就在明天~~"
+		}
 	}
 	return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `","rotate":` + strconv.Itoa(int(i)) + `}`)
 
 }
 
 //
-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"])
@@ -417,12 +462,12 @@ func getLuckDraw() int {
 			}
 		} else if amount > 189 && amount < 221 {
 			count := Count("winningrecord", "{'s_prize':'五元现金红包'}")
-			if count > 200 {
+			if count > 250 {
 				amount = 65
 			}
 		} else if amount > 324 && amount < 356 {
 			count := Count("winningrecord", "{'s_prize':'一元现金红包'}")
-			if count > 2500 {
+			if count > 3100 {
 				amount = 75
 			}
 		}

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

@@ -0,0 +1,145 @@
+package active
+
+import (
+	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
+	"log"
+	"math/rand"
+	"qfw/coreconfig"
+	"qfw/coreutil"
+	"qfw/mobile"
+	"qfw/util"
+	"qfw/util/credit"
+	"qfw/util/mongodb"
+	"time"
+)
+
+var flopEncrypt util.SimpleEncrypt = util.SimpleEncrypt{Key: "flopActive"}
+
+//翻牌
+func (a *Active) FlopAjax() error {
+	if a.GetSession("flopData") != nil {
+		data := a.GetSession("flopData").(bson.M)
+		if mongodb.Count("flop", bson.M{"s_openid": data["s_openid"].(string)}) == 0 {
+			if updateCredit(data["s_userid"].(string), util.IntAll(data["i_oldcredit"]), util.IntAll(data["i_newcredit"]), a.Action) {
+				mongodb.Save("flop", data)
+			} else {
+				log.Println("翻牌的时候", data["s_openid"].(string), "的积分修改失败!")
+			}
+		}
+	}
+	return nil
+}
+
+//进入翻牌
+func (a *Active) Flop(reqType string, encryptOpenid string) error {
+	if reqType == "in" && a.GetSession("s_m_openid") != nil {
+		return a.Redirect("/active/flop/flop/" + flopEncrypt.EncodeString(a.GetSession("s_m_openid").(string)))
+	}
+	var flag int = 3             //标识
+	var cardType int = 1         //翻牌的类型
+	var multiple int = 2         //倍数
+	var nickName, words string   //昵称、牌上的文字
+	var oldCredit, newCredit int //新、老积分
+	openid := flopEncrypt.DecodeString(encryptOpenid)
+	var getFlopData = func() {
+		if data := mongodb.FindOne("flop", bson.M{"s_openid": openid}); data != nil && len(*data) > 0 {
+			nickName = (*data)["s_nickname"].(string)
+			oldCredit = util.IntAll((*data)["i_oldcredit"])
+			newCredit = util.IntAll((*data)["i_newcredit"])
+			cardType = util.IntAll((*data)["i_type"])
+			words = (*data)["s_words"].(string)
+			nickName = (*data)["s_nickname"].(string)
+			multiple = util.IntAll((*data)["i_multiple"])
+		}
+	}
+	//分享出去
+	if reqType == "share" || a.GetSession("userId") == nil || a.GetSession("s_m_openid") == nil || a.GetSession("i_credit") == nil {
+		getFlopData()
+		a.T["shareid"] = coreutil.FindMyShareId("topflop", openid)
+	} else { //可以翻牌
+		s_openid := a.GetSession("s_m_openid").(string)
+		encryptOpenid = flopEncrypt.EncodeString(s_openid)
+		if a.GetSession("nickName") != nil {
+			nickName = a.GetSession("nickName").(string)
+		}
+		data := mongodb.FindOne("flop", bson.M{"s_openid": s_openid})
+		if data == nil || len(*data) == 0 {
+			oldCredit = a.GetSession("i_credit").(int)
+			multiple = getMultiple()
+			newCredit = oldCredit * multiple
+			//翻牌类型
+			card := coreconfig.Flop.Cards[rand.New(rand.NewSource(time.Now().UnixNano())).Intn(6)]
+			cardType = util.IntAll(card["type"])
+			words = card["words"].(string)
+			//判断活动是否结束
+			if coreconfig.Flop.IsOver {
+				a.T["IsOver"] = true
+			} else {
+				a.T["IsOver"] = false
+				a.SetSession("flopData", bson.M{
+					"s_userid":     a.GetSession("userId").(string),
+					"s_openid":     s_openid,
+					"i_oldcredit":  oldCredit,
+					"i_newcredit":  newCredit,
+					"l_createdate": time.Now().Unix(),
+					"i_type":       cardType,
+					"s_words":      words,
+					"s_nickname":   nickName,
+					"i_multiple":   multiple,
+				})
+			}
+			flag = 1
+		} else {
+			getFlopData()
+			flag = 2
+		}
+	}
+	a.T["signature"] = mobile.GetSignature(a.Url())
+	a.T["openid"] = encryptOpenid
+	a.T["cardType"] = cardType
+	a.T["oldCredit"] = oldCredit
+	a.T["newCredit"] = newCredit
+	a.T["words"] = words
+	a.T["nickName"] = nickName
+	a.T["flag"] = flag
+	a.T["multiple"] = multiple
+	return a.Render("/active/flop.html", &a.T)
+}
+
+//获取倍数
+func getMultiple() int {
+	array := coreconfig.Flop.Multiple
+	weightValue := getRandomIndex(array)
+	multiple := util.IntAll(array[weightValue]["multiple"])
+	if multiple == 0 {
+		return 2
+	}
+	return multiple
+}
+
+//根据权重随机获取数组的索引
+func getRandomIndex(array []map[string]interface{}) int {
+	var weightSum, stepWeightSum float64
+	for _, v := range array {
+		weightSum += v["proportion"].(float64)
+	}
+	randVal := rand.New(rand.NewSource(time.Now().UnixNano())).Float64()
+	for i := 0; i < len(array); i++ {
+		stepWeightSum += array[i]["proportion"].(float64)
+		if randVal <= stepWeightSum/weightSum {
+			return i
+		}
+	}
+	return 0
+}
+
+//翻福卡修改积分
+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)
+}

+ 18 - 0
core/src/qfw/coreconfig/Flop.go

@@ -0,0 +1,18 @@
+package coreconfig
+
+import (
+	"qfw/util"
+)
+
+//系统配置
+type flop struct {
+	Multiple []map[string]interface{} `json:"multiple"`
+	Cards    []map[string]interface{} `json:"cards"`
+	IsOver   bool                     `json:"isOver"`
+}
+
+var Flop flop
+
+func readflop() {
+	util.ReadConfig("./flop.json", &Flop)
+}

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

@@ -12,4 +12,5 @@ func init() {
 	readServiceClassify()
 	readredPackage()
 	readluckDraw()
+	readflop()
 }

+ 1 - 2
core/src/qfw/coreutil/Int64_test.go

@@ -27,6 +27,5 @@ func TestBase64(t *testing.T) {
 }
 
 func Test_spit(t *testing.T) {
-	s := "41"
-	log.Println(s[:2])
+
 }

+ 4 - 0
core/src/seo.json

@@ -1,4 +1,8 @@
+<<<<<<< HEAD
 {	"cdn":"//cdn.qmx.top:9000",
+=======
+{   "cdn":"//cdn.qmx.top:9000",
+>>>>>>> c5f3e54ed147936d13ef9e733fff8e006b11d01f
     "qfw": {
         "enterprise": {
             "description": "提供企业信息查询,企业产品服务查询,企业关系网展示",

+ 6 - 1
core/src/timetask.json

@@ -1 +1,6 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-29 17:31:40"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-29 17:31:40"}},"marketisstart":true,"marketrate":300}
+<<<<<<< HEAD
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-29 17:31:40"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-29 17:31:40"}},"marketisstart":true,"marketrate":300}
+=======
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-01 14:14:58"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-01 14:14:58"}},"marketisstart":true,"marketrate":300}
+
+>>>>>>> c5f3e54ed147936d13ef9e733fff8e006b11d01f

+ 3 - 0
core/src/web/staticres/css/index-new.css

@@ -620,3 +620,6 @@ a:focus, a:hover{
 .index-new-tg-tb .bmrzqy img{
 	margin-bottom:0px;
 }
+#iWant div a{
+	margin-right:2px;
+}

+ 2 - 2
core/src/web/staticres/css/swordfish.css

@@ -265,14 +265,14 @@ a:focus, a:hover{
 	display: inline-block;
 	height: inherit;
 	vertical-align: top;
-	height: 604px;
+	height: 552px;
 }
 .swordfish-guide{
 	padding-left: 20px;
 	padding-right: 20px;
 }
 .swordfish-guide .carousel-inner{
-	width: 813px;
+	width: 825px;
 	left: 50%;
 	margin-left: -406.4px;
 }

BIN
core/src/web/staticres/images/flop/bg-1.png


BIN
core/src/web/staticres/images/flop/bg-2.png


BIN
core/src/web/staticres/images/flop/blessing.png


BIN
core/src/web/staticres/images/flop/btn.png


BIN
core/src/web/staticres/images/flop/bubble.png


BIN
core/src/web/staticres/images/flop/card-1.png


BIN
core/src/web/staticres/images/flop/card-2.png


BIN
core/src/web/staticres/images/flop/card-3.png


BIN
core/src/web/staticres/images/flop/card-4.png


BIN
core/src/web/staticres/images/flop/card-5.png


BIN
core/src/web/staticres/images/flop/card-6.png


BIN
core/src/web/staticres/images/flop/card.png


BIN
core/src/web/staticres/images/flop/flop-notice.png


BIN
core/src/web/staticres/images/flop/min-blessing.png


BIN
core/src/web/staticres/images/flop/tip-bg.png


BIN
core/src/web/staticres/images/swordfish/guide-1.png


BIN
core/src/web/staticres/images/swordfish/guide-2.png


BIN
core/src/web/staticres/images/swordfish/guide-3.png


BIN
core/src/web/staticres/images/swordfish/guide-4.png


BIN
core/src/web/staticres/images/swordfish/guide-5.png


+ 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--已登录

BIN
core/src/web/staticres/wxswordfish/images/guide-0.png


BIN
core/src/web/staticres/wxswordfish/images/min-share-icon.png


BIN
core/src/web/staticres/wxswordfish/images/share-cj.jpg


BIN
core/src/web/staticres/wxswordfish/images/share-cj.png


+ 2 - 2
core/src/web/staticres/wxswordfish/share.js

@@ -15,7 +15,7 @@ function initShare(signature,shareid){
 	        wx.onMenuShareTimeline({
 			    title: '剑鱼招标订阅免费用,关注即可抽取iPad mini。', // 分享标题
 			    link: 'http://www.qimingxing.info/swordfish/share/'+shareid, // 分享链接
-			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/share-icon.png', // 分享图标
+			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/min-share-icon.png', // 分享图标
 			    success: function () { 
 			       //alert('分享成功');
 							$.ajax({    
@@ -37,7 +37,7 @@ function initShare(signature,shareid){
 			    title: '剑鱼招标订阅免费用,关注即可抽取iPad mini。', // 分享标题
 			    desc: '关注微信并设置剑鱼关键词,全国招标信息统统推送给您!', // 分享描述
 			    link: 'http://www.qimingxing.info/swordfish/share/'+shareid, // 分享链接
-			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/share-icon.png', // 分享图标
+			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/min-share-icon.png', // 分享图标
 			    type: 'link', // 分享类型,music、video或link,不填默认为link'
 			    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
 			    success: function () { 

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

@@ -0,0 +1,347 @@
+<html>
+<head>
+<title>猴年翻福牌,翻来好运气</title>
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+<meta content="telephone=no" name="format-detection" />
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script>
+var signature = {{.T.signature}};
+var shareTitle = "{{.T.nickName}}在2016年{{.T.words}}";
+var shareLink = "http://www.qimingxing.info/active/flop/share/{{.T.openid}}";
+var shareIcon = "http://www.qimingxing.info/images/flop/min-blessing.png";
+if(typeof(signature) != "undefined" && signature != null && signature.length == 4){
+	wx.config({
+	    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+	    appId: signature[0], // 必填,公众号的唯一标识
+	    timestamp:signature[1], // 必填,生成签名的时间戳
+	    nonceStr: signature[2], // 必填,生成签名的随机串
+	    signature: signature[3],// 必填,签名,见附录1
+	    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
+	});
+	wx.ready(function () {
+        wx.onMenuShareTimeline({
+		    title: shareTitle, // 分享标题
+		    link: shareLink, // 分享链接
+		    imgUrl: shareIcon, // 分享图标
+		    success: function () { 
+		       //alert('分享成功');
+		    },
+		    cancel: function () { 
+		       //alert('分享失败,或用户取消了');
+		    }
+		});
+		
+		wx.onMenuShareAppMessage({
+		    title: shareTitle, // 分享标题
+		    desc: '企明星给您拜年!猴年翻福牌,翻来好运气!关注企明星,回复“福牌”得好运。', // 分享描述
+		    link:  shareLink,// 分享链接
+		    imgUrl: shareIcon, // 分享图标
+		    type: 'link', // 分享类型,music、video或link,不填默认为link'
+		    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+		    success: function () { 
+		        //alert('分享成功');
+		    },
+		    cancel: function () { 
+				//alert('分享失败,或用户取消了');
+		    }
+		});
+    });
+}	
+</script>
+<style type="text/css">
+body{
+	margin: 0px;
+	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
+	-webkit-tap-highlight-color: transparent;
+	background-color: #B63845;
+	font-size: 100%;
+}
+.page{
+	margin: 0px auto;
+	max-width: 750px;
+	position: relative;
+	background-size: 100% 100%;
+	height: 100%;
+}
+img{
+	vertical-align: sub;
+}
+.btn{
+	width: 180px;
+	height: 43px;
+	position: absolute;
+	left: 50%;
+	margin-left: -90px;
+	display: none;
+}
+.bubble{
+	position: absolute;
+	right: 20px;
+	top: 0px;
+	width: 97.5px;
+	height: 53px;
+	z-index: 1;
+}
+.cards{
+	position: absolute;
+	left: 0px;
+	right: 0px;
+	text-align: center;
+	display: none;
+}
+.cards>img{
+	width: 250px;
+	height: 282.4;
+}
+.flop-tip{
+	color: #a52f2e;
+	background-image: url("{{Msg "seo" "cdn"}}/images/flop/tip-bg.png");
+	background-size: 100% 100%;
+	position: absolute;
+	left: 20px;
+	right: 20px;
+	max-width: 600px;
+	line-height: 20px;
+	display: none;
+	font-size:0.875em;
+	font-weight: bold;
+	text-align: center;
+	padding: 5px;
+	display: none;
+}
+.flop-tip span{
+	margin-right: 3px;
+}
+.flop-tip font{
+	font-size: 0.75em;
+	font-weight: normal;
+}
+.multiple{
+	font-size: 1.75em;
+	text-align: center;
+	position: relative;
+	width: 20px;
+	display: inline-block;
+	vertical-align: top;
+	overflow: hidden;
+	height: 25px;
+}
+.flop-notice{
+	color: #ffa461;
+	background-image: url("{{Msg "seo" "cdn"}}/images/flop/flop-notice.png");
+	background-size: 100% 100%;
+	position: absolute;
+	top: 30px;
+	left: 20px;
+	right: 20px;
+	max-width: 600px;
+	text-align: center;
+	padding-top: 7px;
+	padding-bottom: 7px;
+	display: none;
+	font-size: 0.875em;
+}
+.flop-notice>span{
+	display: inline-block;
+	max-width: 140px;
+	overflow: hidden;
+	white-space: nowrap;
+	text-overflow: ellipsis;
+	vertical-align: top;
+}
+.flop-notice>div{
+	display: inline-block;
+	vertical-align: top;
+}
+.flop-share{
+	position: absolute;
+	left: 0px;
+	right: 0px;
+	bottom: 0px;
+	height: 90px;
+	background-color: #ffffff;
+}
+.flop-share>img{
+	display: inline-block;
+	width: 70px;
+	height: 70px;
+	margin-left: 10px;
+	vertical-align: top;
+	margin-top: 10px;
+}
+.flop-share>div{
+	display: inline-block;
+	width: 150px;
+	line-height: 25px;
+	font-size: 0.875em;
+	position: relative;
+	top: 50%;
+	margin-top: -25px;
+}
+ul{
+	list-style: none;
+	padding: 0px;
+	margin: 0px;
+}
+.random{
+	position: absolute;
+	left: 2px;
+	height: 155px;
+}
+.random li{
+	height: 25px;
+}
+.page-before{
+	background-image: url("{{Msg "seo" "cdn"}}/images/flop/bg-1.png");
+	background-repeat: no-repeat;
+	background-position-x: center;
+}
+.page-after{
+	background-image: url("{{Msg "seo" "cdn"}}/images/flop/bg-2.png");
+	background-repeat: no-repeat;
+	background-position-x: center;
+}
+</style>
+</head>
+<body>
+<img src="{{Msg "seo" "cdn"}}/images/flop/bubble.png" class="bubble"{{if ne .T.flag 2}} style="display: none;"{{end}}>
+<div class="page{{if eq .T.flag 1}} page-before{{else}} page-after{{end}}">
+	<div class="flop-notice">
+		<span>{{.T.nickName}}</span><div>,您的猴年福牌是:</div>
+	</div>
+	<div class="cards">
+		{{if eq .T.flag 1}}<img src="{{Msg "seo" "cdn"}}/images/flop/card.png">{{end}}
+		<img src="{{Msg "seo" "cdn"}}/images/flop/card-{{.T.cardType}}.png"{{if eq .T.flag 1}} style="display: none;"{{end}}>
+	</div>
+	{{if eq .T.flag 1}}
+	<img src="{{Msg "seo" "cdn"}}/images/flop/btn.png" class="btn">
+	{{else if eq .T.flag 3}}
+	<div class="flop-share">
+		<img src="/front/weixinshare/{{.T.shareid}}">
+		<div>
+			长按图片识别二维码<br>
+			您也可以测福牌
+		</div>
+	</div>
+	{{end}}
+	{{if eq .T.flag 1 2}}
+	<div class="flop-tip">
+		恭喜!您的企明星积分翻了
+		<span class="multiple">
+		{{if eq .T.flag 1}}
+		<ul class="random">
+			<li>7</li>
+			<li>3</li>
+			<li>6</li>
+			<li>8</li>
+			<li>5</li>
+			<li>9</li>
+			<li>2</li>
+		</ul>
+		{{else if eq .T.flag 2}}
+		{{.T.multiple}}
+		{{end}}
+		</span>倍!<br>
+		<div id="credit"{{if eq .T.flag 1}} style="display: none;"{{end}}>
+			您的积分已从{{.T.oldCredit}}分涨到{{.T.newCredit}}分。
+		</div>
+		<font>积分明细请到企明星(www.qmx.top)查询!</font>
+	</div>
+	{{end}}
+</div>
+<script type="text/javascript">
+if({{.T.IsOver}}){
+	alert("活动已经结束!");
+}
+$(function(){
+	var windowWidth = $(window).width();
+	var windowHeight = $(window).height();
+	var rate=((5/3)/(windowHeight/windowWidth))*100
+	if(rate>120){
+		rate=120
+		$(".page").css({"background-position-y":"-"+(rate/100*12)+"px"})
+	}else if(rate<100){
+		rate=100
+	}
+	$(".page").css({"background-size":"100% "+rate+"%"})
+	var defaultWidth = 320;
+	var defaultHeight = 416;
+	var width = 250; // 625 706
+	var height = 282.4;
+	var cardTop = 110;
+	var noticeTop = 70;
+	if(windowHeight > defaultHeight){
+		cardTop = cardTop / defaultHeight * windowHeight;
+		noticeTop = noticeTop / defaultHeight * windowHeight;
+	}
+	if(windowHeight <= 460){
+		height = 240;
+		width = height / 706 * 625;
+		$(".cards>img").css({width: width,height: height});
+	}else if(windowHeight > defaultHeight){
+		width = windowWidth * 3 / 4;
+		if(width > 300){//最大宽度350
+			width = 300
+		}
+		height = width / 625 * 706;
+		$(".cards>img").css({width: width,height: height});
+	}
+	$(".cards").css({top: cardTop}).show();
+	$(".flop-notice").css({top: noticeTop});
+	var flopTipTop = windowHeight - $(".cards").height()  - cardTop - $(".flop-tip").height();
+	if(flopTipTop > 30 && flopTipTop < 40){
+		$(".flop-tip").css({"line-height": "25px",top: $(".cards").height() + cardTop - 20});
+	}else if(flopTipTop > 40){
+		$(".flop-tip").css({"line-height": "25px",top: $(".cards").height() + cardTop});
+	}else{
+		$(".flop-tip").css({top: $(".cards").height()+cardTop-20});
+	}
+	//
+	{{if eq .T.flag 1}}
+		$(".btn").css({top: $(".cards").height()+cardTop}).show();
+		$(".btn").one("click",function(){
+			if({{.T.IsOver}}){
+				alert("活动已经结束!");
+				return;
+			}
+			//
+			$.post("/active/flopAjax",null,null);
+			$(".page").addClass("page-after").removeClass("page-before");
+			$(".btn").hide();
+			$(".flop-tip,.flop-notice").show();
+			var randomInterval = setInterval(function(){
+				$(".random").css({top : "-24px"});
+				$(".random").append($(".random li:first"));
+			},20);
+			setTimeout(function(){
+				clearInterval(randomInterval);
+				$(".multiple").html({{.T.multiple}});
+				$("#credit").show();
+			},3000);
+			setTimeout(function(){
+				$(".bubble").fadeIn();
+			},6000);
+			$('.cards').children('img:first').stop().animate({'width':0},500,function(){
+				$(this).hide().next().show();
+				$(this).next().animate({'width':width+'px'},200);
+			});
+		});
+	{{else}}
+		$(".flop-notice").show();
+	{{end}}
+	{{if eq .T.flag 2}}
+		$(".flop-tip").show();
+	{{end}}
+	{{if eq .T.flag 3}}
+		var shareHeight = windowHeight - cardTop - height + 30;
+		if(shareHeight > 110){
+			shareHeight = 110;
+		}
+		$(".flop-share").css({height: shareHeight});
+		$(".flop-share>img").css({width: shareHeight-20,height: shareHeight-20});
+	{{end}}
+});
+</script>
+</body>
+</html>

+ 18 - 14
core/src/web/templates/active/luckdraw.html

@@ -7,21 +7,21 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
 <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0" user-scalable="no" />
 <meta name="renderer" content="webkit">
-<link href="/css/bootstrap.min.css" rel="stylesheet">
-<script src="/js/jquery.js"></script>
-<script src="/js/active/Rotate.js"></script>
+<link href="{{Msg "seo" "cdn"}}/css/bootstrap.min.css" rel="stylesheet">
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/active/Rotate.js"></script>
 <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
-<script src="/wxswordfish/share.js"></script>
-<script src="/js/bootstrap.min.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/bootstrap.min.js"></script>
 <script>
 	initShare({{.T.signature}},{{.T.shareid}});
 </script>
 <style>
 *{padding:0; margin:0;}
 .lotteryMain{ width:100%;}
-.lotteryBg{ width:100%; height:608px; margin:0 auto; background:url(/images/activeimages/lotteryBg.png) no-repeat top center; position:relative; overflow:hidden;background-size: 375px 508px;}
+.lotteryBg{ width:100%; height:608px; margin:0 auto; background:url({{Msg "seo" "cdn"}}/images/activeimages/lotteryBg.png) no-repeat top center; position:relative; overflow:hidden;background-size: 375px 508px;}
 #run{ width:145px; height:145px; position:absolute; left:50%; top:50%;  margin-left:-73px; margin-top:-53px; z-index:1; transform:rotate(0deg); -ms-transform:rotate(0deg); }
-#btn_run{ width:80px; height:80px; background:url(/images/activeimages/btn_start.png) no-repeat; border:none; outline:none; position:absolute; left:50%; top:50%; margin-left:-40px; margin-top:-22px; z-index:2;cursor:pointer;background-position:0px 0px;background-size: 100% 100%;}
+#btn_run{ width:80px; height:80px; background:url({{Msg "seo" "cdn"}}/images/activeimages/btn_start.png) no-repeat; border:none; outline:none; position:absolute; left:50%; top:50%; margin-left:-40px; margin-top:-22px; z-index:2;cursor:pointer;background-position:0px 0px;background-size: 100% 100%;}
 .col-xs-12 p{
 	margin:0px 0px 5px;
 }
@@ -58,7 +58,7 @@
 </div>
 <section class="lotteryMain">
 	<div class="lotteryBg">
-    	<img id="run" src="/images/activeimages/start.png" />
+    	<img id="run" src="{{Msg "seo" "cdn"}}/images/activeimages/start.png" />
         <input id="btn_run" type="button" value="" />
     </div>
 </section> 
@@ -78,11 +78,15 @@ $(function(){
 	if (flog == "A"){
 		$(".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").attr('disabled',true).css("cursor","pointer").css("background","url({{Msg "seo" "cdn"}}/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 	}else if (flog == "B"){
 		$(".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").attr('disabled',true).css("cursor","pointer").css("background","url({{Msg "seo" "cdn"}}/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({{Msg "seo" "cdn"}}/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 	}
      $("#btn_run").click(function(){
 		$("#btn_run").attr('disabled',true).css("cursor","default"); 
@@ -106,17 +110,17 @@ function lottery(){
 					easing: $.easing.easeOutSine, 
 					callback: function(){ 
 						//alert(obj.results); 
-						$("#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").attr('disabled',true).css("cursor","pointer").css("background","url({{Msg "seo" "cdn"}}/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%"); 
 							$(".modal-body").html(obj.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").attr('disabled',true).css("cursor","pointer").css("background","url({{Msg "seo" "cdn"}}/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 					} 
 				});
 			}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();
 			}
         } 

+ 1 - 1
core/src/web/templates/common/login.html

@@ -68,7 +68,7 @@ function loginModalShow(lbt){
 	$("#wxPic").attr("src","");
 	$.post("/front/wxlogin/getNum",function(data){
 		if(data&&data.num){		
-			$("#wxPic").attr("src","/weixin/sso/"+data.num);
+			$("#wxPic").attr("src","http://wxs.qimingxing.info/weixin/sso/"+data.num);
 			setTimes(data.num,35)		
 		}
 	},'json');

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

+ 1 - 1
core/src/web/templates/common/swordfishhead.html

@@ -45,7 +45,7 @@ function b_afterLogin(flag,result){
 }
 function swordfishLayoutInit(){
 	if(document.body.scrollHeight <= document.body.clientHeight){
-		$(".b-left").height(document.body.clientHeight-$(".swordfish-head").height() - $("#qfw-bottom").height());
+		$(".b-left").height(document.body.clientHeight - $(".b-head").height() - $("#qfw-bottom").height() - 60);
 		webSiteInit();
 	}
 }

+ 4 - 4
core/src/web/templates/common/top.html

@@ -67,7 +67,7 @@ function b_loadTop(){
 				if(hasMsgCount){
 					html += '<a class="b-round-dot"></a>';
 				}
-				html += '</span>'+result.nickName;
+				html += '</span><span>'+result.nickName+'</span>';
 				html += '<div id="head-hideMenu" class="head-hideMenu"><ul>'
 					    	+'<li onclick="window.location.href=\'/member/msgcenter\'"><i class="glyphicon youjian"></i><span>消息中心';
 				if(hasMsgCount){
@@ -78,9 +78,6 @@ function b_loadTop(){
 						+'<li onclick="window.location.href=\'/front/logout\'" class="border-b-0"><i class="glyphicon tuichu"></i>退出</li>';
 						+'</ul></div>';
 				$("#b-loginStatus").addClass("b-logined").html(html)
-				.click(function(){
-					window.location.href = "/member/show/memberindex";
-				})
 				.mouseover(function(){
 					$("#head-hideMenu").show();
 				}).mouseleave(function(){
@@ -91,6 +88,9 @@ function b_loadTop(){
 				}).mouseleave(function(){
 					$(this).hide();
 				});
+				$("#b-loginStatus>span").click(function(){
+					window.location.href = "/member/show/memberindex";
+				});
 				//处理公用底部扫码登录按钮
 				$("#bottom-bar>li:first").addClass("invisible");
 				//处理认证完之后第一次登录弹出提示框

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

@@ -5,9 +5,14 @@
 {{include "/common/inc.html"}}
 <meta name="Keywords" content="{{Msg "seo" "qfw.homepage.key"}}"/>
 <meta name="Description" content="{{Msg "seo" "qfw.homepage.description"}}"/>
+<<<<<<< HEAD
 <link href="{{Msg "seo" "cdn"}}/css/index-new.css" rel="stylesheet">
 <script src="{{Msg "seo" "cdn"}}/js/jquery.lazyload.min.js"></script>
 
+=======
+<link href="/css/index-new.css" rel="stylesheet">
+<script src="/js/jquery.lazyload.min.js"></script>
+>>>>>>> c5f3e54ed147936d13ef9e733fff8e006b11d01f
 </head>
 <body>
 {{include "/common/indexhead.html"}}
@@ -23,12 +28,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){

+ 2 - 2
core/src/web/templates/swordfish/rssset.html

@@ -36,7 +36,7 @@
 				{{if .T.msgset}}
 					{{if .T.msgset.tender}}
 						{{if .T.msgset.tender.day}}
-							{{if gt 6 .T.msgset.tender.day}}
+							{{if and (gt 6 .T.msgset.tender.day) (gt .T.msgset.tender.day 0)}}
 							本栏目推送服务期还剩<span style="color:red"> {{.T.msgset.tender.day}} </span>天。想要服务不间断,请确保积分充足。 <a href="/member/credit/myCredit">去做任务赚积分</a>
 							{{end}}
 						{{end}}
@@ -72,7 +72,7 @@
 				{{if .T.msgset}}
 					{{if .T.msgset.bid}}
 						{{if .T.msgset.bid.day}}
-							{{if gt 6 .T.msgset.bid.day}}
+							{{if and (gt 6 .T.msgset.bid.day) (gt .T.msgset.bid.day 0)}}
 							本栏目推送服务期还剩<span style="color:red"> {{.T.msgset.bid.day}} </span>天。想要服务不间断,请确保积分充足。 <a href="/member/credit/myCredit">去做任务赚积分</a>
 							{{end}}
 						{{end}}

+ 15 - 15
core/src/web/templates/swordfish/wxindex.html

@@ -2,12 +2,12 @@
 <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">
-<link href="/swiper/swiper.min.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/swiper/swiper.min.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 src="/swiper/swiper.min.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/swiper/swiper.min.js"></script>
 <script>
 	initShare({{.T.signature}},{{.T.shareid}});
 </script>
@@ -16,31 +16,31 @@
 <div class="swiper-container">
     <div class="swiper-wrapper">
         <div class="swiper-slide">
-			<img id="guide-firstImg" src="/wxswordfish/images/guide-1.png">
+			<img id="guide-firstImg" src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-1.png">
 		</div>
        	<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-2.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-2.png">
 		</div>
        	<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-3.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-3.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-4.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-4.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-5.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-5.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-1.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-1.png">
 		</div>
     </div>
     <!-- 如果需要分页器 -->
    	<div class="swiper-pagination"></div>
 	<div class="guide-bottom">
-		<img class="arrow-up" src="/wxswordfish/images/up.png">
+		<img class="arrow-up" src="{{Msg "seo" "cdn"}}/wxswordfish/images/up.png">
 		<button class="btn experience" onclick="pageJump();">立即体验</button>
-		<img src="/wxswordfish/images/jump.png" class="jumpGuide" onclick="pageJump();">
-		<img class="goToShare" id="goToShare" src="/wxswordfish/images/guide-share.png">
+		<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/jump.png" class="jumpGuide" onclick="pageJump();">
+		<img class="goToShare" id="goToShare" src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-share.png">
 	</div>
 </div>
 {{include "/swordfish/wxtoolbar.html"}}
@@ -55,7 +55,7 @@ $(function(){
 		touchMoveStopPropagation: false,
 		virtualTranslate: true,
 		onInit: function(swiper){
-			$(swiper.slides[5]).children("img").attr("src","/wxswordfish/images/guide-6.png");
+			$(swiper.slides[5]).children("img").attr("src","{{Msg "seo" "cdn"}}/wxswordfish/images/guide-6.png");
 		},
 		onSlideChangeStart: function(swiper){
 			var prevSlide = $(swiper.slides[swiper.previousIndex]);

+ 3 - 3
core/src/web/templates/swordfish/wxpush.html

@@ -2,10 +2,10 @@
 <head>
 <meta name="viewport" content="width=device-width,initial-scale=1.0">
 <title>企明星-剑鱼-信息推送</title>
-<link href="/wxswordfish/style.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/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 src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
 <script>
 initShare({{.T.signature}},{{.T.shareid}});
 $(function(){

+ 13 - 13
core/src/web/templates/swordfish/wxrssset.html

@@ -4,11 +4,11 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta name="renderer" content="webkit">
-<link href="/wxswordfish/style.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/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 src="/wxswordfish/main.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/main.js"></script>
 <script>
 	var msgset= {{.T.msgset}};
 	initShare({{.T.signature}},{{.T.shareid}});
@@ -27,7 +27,7 @@
 </div>
 	<ul class="operation">
 		<li class="parent-node" id="tender">
-			<img src="/wxswordfish/images/zhaobiao.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/zhaobiao.png">
 			招标公告
 			<day class="show-days"></day>
 			<span class="on-off" id="tender-on-off" v="tender"></span>
@@ -35,15 +35,15 @@
 		<li class="child-node">
 			<ul id="tender-content">
 				<li>
-					<div>订阅关键词<img src="/wxswordfish/images/right.png"></div>
+					<div>订阅关键词<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png"></div>
 				</li>
 				<li>
-					<div>信息范围<img src="/wxswordfish/images/right.png"></div>
+					<div>信息范围<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png"></div>
 				</li>
 			</ul>
 		</li>
 		<li class="parent-node" id="bid">
-			<img src="/wxswordfish/images/zhongbiao.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/zhongbiao.png">
 			中标公告
 			<day class="show-days"></day>
 			<span class="on-off" id="bid-on-off" v="bid"></span>
@@ -51,22 +51,22 @@
 		<li class="child-node">
 			<ul id="bid-content">
 				<li>
-					<div>订阅关键词<img src="/wxswordfish/images/right.png"></div>
+					<div>订阅关键词<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png"></div>
 				</li>
 				<li>
-					<div>信息范围<img src="/wxswordfish/images/right.png"></div>
+					<div>信息范围<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png"></div>
 				</li>
 			</ul>
 		</li>
 		<li class="parent-node">
-			<img src="/wxswordfish/images/qingbao.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/qingbao.png">
 			企业情报
 			<span class="on-off" id="intelligence-on-off"></span>
 		</li>
 		<li class="parent-node">
-			<img src="/wxswordfish/images/feerule.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/feerule.png">
 			收费规则
-			<span style="right:0" class="rule"><img src="/wxswordfish/images/right.png" style="width: 10px;height: 17px;float: right;"></span>
+			<span style="right:0" class="rule"><img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png" style="width: 10px;height: 17px;float: right;"></span>
 		</li>
 	</ul>
 	<!--剑鱼服务协议-->

+ 14 - 14
core/src/web/templates/swordfish/wxshare.html

@@ -2,12 +2,12 @@
 <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">
-<link href="/swiper/swiper.min.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/swiper/swiper.min.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 src="/swiper/swiper.min.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/swiper/swiper.min.js"></script>
 <script>
 	initShare({{.T.signature}},{{.T.shareid}});
 </script>
@@ -16,30 +16,30 @@
 <div class="swiper-container">
     <div class="swiper-wrapper">
         <div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-0.png" alt="Cinque Terre">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-0.png" alt="Cinque Terre">
 			<img id="QRcode" style="position:absolute;z-index: 2;" src="/front/weixinshare/{{.T.shareid}}" >
 		</div>
        	<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-2.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-2.png">
 		</div>
        	<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-3.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-3.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-4.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-4.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-5.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-5.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-0.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-0.png">
 		</div>
     </div>
     <!-- 如果需要分页器 -->
    	<div class="swiper-pagination"></div>
 	<div class="guide-bottom">
-		<img class="arrow-up" src="/wxswordfish/images/up.png">
-		<img src="/wxswordfish/images/index.png" class="jumpGuide" onclick="backToIndex()">
+		<img class="arrow-up" src="{{Msg "seo" "cdn"}}/wxswordfish/images/up.png">
+		<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/index.png" class="jumpGuide" onclick="backToIndex()">
 	</div>
 </div>
 <script type="text/javascript">
@@ -70,7 +70,7 @@ $(function(){
 		touchMoveStopPropagation: false,
 		virtualTranslate: true,
 		onInit: function(swiper){
-			$("[data-swiper-slide-index='5']>img").attr("src","/wxswordfish/images/guide-6.png");
+			$("[data-swiper-slide-index='5']>img").attr("src","{{Msg "seo" "cdn"}}/wxswordfish/images/guide-6.png");
 		},
 		onSlideChangeStart: function(swiper){
 			if(flag){

+ 4 - 4
core/src/web/templates/swordfish/wxshare_copy.html

@@ -5,11 +5,11 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
 <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0" user-scalable="no" />
 <meta name="renderer" content="webkit">
-<link href="/css/bootstrap.min.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/css/bootstrap.min.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="/js/bootstrap.min.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/bootstrap.min.js"></script>
 
 <script src="/wxswordfish/share.js"></script>
 <script>
@@ -17,7 +17,7 @@
 </script>
 </head>
 <body style="margin:0px; background-color:#C5F7FE;">
-<img src="/wxswordfish/images/share-cj.jpg" class="img-responsive" alt="Cinque Terre">
+<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/share-cj.jpg" class="img-responsive" alt="Cinque Terre">
 <img id="img2" style="position:absolute;" class="img-responsive" src="/front/weixinshare/{{.T.shareid}}" >
 </body>
 <script>

+ 14 - 27
core/src/web/templates/swordfish/wxshareguide.html

@@ -2,12 +2,12 @@
 <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">
-<link href="/swiper/swiper.min.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/swiper/swiper.min.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 src="/swiper/swiper.min.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/swiper/swiper.min.js"></script>
 <script>
 	initShare({{.T.signature}},{{.T.shareid}});
 </script>
@@ -16,37 +16,36 @@
 <div class="swiper-container">
     <div class="swiper-wrapper">
         <div class="swiper-slide">
-			<img src="/wxswordfish/images/share-cj.jpg" alt="Cinque Terre">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/share-cj.jpg" alt="Cinque Terre">
 			<img id="QRcode" style="position:absolute;z-index: 2;" src="/front/weixinshare/{{.T.shareid}}" >
 		</div>
        	<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-2.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-2.png">
 		</div>
        	<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-3.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-3.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-4.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-4.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/guide-5.png">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/guide-5.png">
 		</div>
 		<div class="swiper-slide">
-			<img src="/wxswordfish/images/share-cj.jpg">
+			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/share-cj.jpg">
 		</div>
     </div>
     <!-- 如果需要分页器 -->
    	<div class="swiper-pagination"></div>
 	<div class="guide-bottom">
-		<img class="arrow-up" src="/wxswordfish/images/up.png">
-		<img src="/wxswordfish/images/index.png" class="jumpGuide" onclick="backToIndex()">
+		<img class="arrow-up" src="{{Msg "seo" "cdn"}}/wxswordfish/images/up.png">
+		<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/index.png" class="jumpGuide" onclick="backToIndex()">
 	</div>
 </div>
 <script type="text/javascript">
 var mySwiper = null;
 var currentIndex = 0;
 $(function(){
-	initShare({{.T.signature}},{{.T.shareid}});
 	var width = $(window).width();
 	var height = $(window).height();
 	var defaultHeight = 416;
@@ -60,7 +59,6 @@ $(function(){
 		top = top / defaultHeight * height;
 	}
 	$("#QRcode").css({"width":width,"height":width,"top": top-width,"left":"50%","margin-left": -(width/2)});
-	$(".bottom-toolbar,.feedback-dialog").remove();
 	var flag = true;
 	mySwiper = new Swiper('.swiper-container', {
 		loop: true,
@@ -70,7 +68,7 @@ $(function(){
 		touchMoveStopPropagation: false,
 		virtualTranslate: true,
 		onInit: function(swiper){
-			$("[data-swiper-slide-index='5']>img").attr("src","/wxswordfish/images/guide-6.png");
+			$("[data-swiper-slide-index='5']>img").attr("src","{{Msg "seo" "cdn"}}/wxswordfish/images/guide-6.png");
 		},
 		onSlideChangeStart: function(swiper){
 			if(flag){
@@ -104,17 +102,6 @@ $(function(){
 			});
 		}
     });
-	/*
-	var imgHeight = 1159;
-	var imgWidth = 750;
-	var width = document.body.clientWidth;
-	var height = document.body.clientHeight;
-	if(imgWidth > width){
-		var h = width / imgWidth * imgHeight;
-		$(".swiper-slide img").css({width: width,height: h,marginTop: -(h / 2)});
-	}else if(imgHeight > height){
-		$(".swiper-slide img").css({width: height / imgHeight * imgWidth,height: height,marginTop: -(height / 2)});
-	}*/
 });
 function backToIndex(){
 	if(mySwiper == null || mySwiper.activeIndex == 1){

+ 3 - 3
core/src/web/templates/swordfish/wxtoolbar.html

@@ -1,14 +1,14 @@
 <ul class="bottom-toolbar">
 	<li class="parent-node" id="goToGuide">
-		<img src="/wxswordfish/images/demo.png">
+		<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/demo.png">
 		查看演示
 	</li>
 	<li class="parent-node" id="feedback">
-		<img src="/wxswordfish/images/fankui.png">
+		<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/fankui.png">
 		意见反馈
 	</li>
 	<li class="parent-node" id="goToShare">
-		<img src="/wxswordfish/images/share.png">
+		<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/share.png">
 		分享
 	</li>
 </ul>

+ 8 - 4
weixin/src/config.json

@@ -19,8 +19,8 @@
 	"entAuthTip":",请按向导进行操作。第1步(共2步):请输入完整的企业名称。\n(认证过程只涉及您所在企业的公开信息。除非事先获得您的授权,企明星不会将您的个人隐私信息公开或透露给第三方机构。输入q或Q,退出认证操作。)",
 	"perAuthTip":",请按向导进行操作。第1步(共2步):请输入商家名称。\n(除非事先获得您的授权,企明星不会将您的个人隐私信息公开或透露给第三方机构。输入q或Q,退出认证操作。)",
 	"othAuthTip":",请按向导进行操作。第1步(共2步):请输入完整的组织机构名称。\n(认证过程只涉及您所在机构的公开信息。除非事先获得您的授权,企明星不会将您的个人隐私信息公开或透露给第三方机构。输入q或Q,退出认证操作。)",
-	"welcomeTip":"您已成功注册企明星!企明星是一个为全国企业提供专业化服务的互联网平台。企明星提供企业服务交易、剑鱼招标订阅、免费企业查询等多项服务。\n新春到,剑鱼送祝福,企明星幸运抽奖活动火热举行中,回复抽奖,即可参与活动。",
-	"oWelcomeTip":"您已成功注册企明星!企明星是一个为全国企业提供专业化服务的互联网平台。企明星提供企业服务交易、剑鱼招标订阅、免费企业查询等多项服务。\n新春到,剑鱼送祝福,企明星幸运抽奖活动火热举行中,回复抽奖,即可参与活动。",
+	"welcomeTip":"您已注册企明星!企明星是一个为全国企业提供专业化服务的互联网平台。企明星提供企业服务交易、剑鱼招标订阅、全国企业信息查询等多项服务。\n新春到,企明星多种活动火爆举行中。回复抽奖,即可参加“剑鱼抽奖”;回复福牌,即可参加“猴年翻福牌活动”。",
+	"oWelcomeTip":"您已注册企明星!企明星是一个为全国企业提供专业化服务的互联网平台。企明星提供企业服务交易、剑鱼招标订阅、全国企业信息查询等多项服务。\n新春到,企明星多种活动火爆举行中。回复抽奖,即可参加“剑鱼抽奖”;回复福牌,即可参加“猴年翻福牌活动”。",
 	"loginTip":"您已经成功登录企明星。",
 	"freezeTip":"您的帐号已经冻结,请联系管理员。",
 	"messagetpl":{
@@ -32,10 +32,14 @@
 	"activity":{
 		"activitycode":"topcj",
 		"title":"企明星新年抽奖活动进行中",
-		"picurl":"http://www.qimingxing.info/images/choujiang2.png"
+		"picurl":"http://www.qimingxing.info/images/choujiang2.png",
+		"tuenCards":"小主,来抢新年福牌了~~\n/:handclap/:handclap/:handclap\n剑鱼君派送神秘福牌!\n/:gift<a href='%s'>小主快快点这里翻福牌!</a>/:gift"
 	},"weixinautorpl":"小主的吩咐我们已经收到了,请留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!",
+	"weixinautorpl2":"小主的吩咐我们已经收到了,请留下您的联系方式(手机号或qq号),企明星客服会在春节后2月15日给小主回复哦!",
 	"creditRpc":"127.0.0.1:8765",
 	"subscribemonitorcyc":3,
-	"subscribemonitortimes":12
+	"subscribemonitortimes":12,
+	"mids":["oJULtwzXo6EFV1Ah-XeyRBimXGM8"],
+	"dir":"/opt/mntdisk/qfw-v1.1"
 
 }

+ 6 - 2
weixin/src/qfw/weixin/dao/sharedao.go

@@ -8,6 +8,7 @@ import (
 	"qfw/util/credit"
 	. "qfw/util/mongodb"
 	"sync"
+	"qfw/util"
 	"time"
 )
 
@@ -58,8 +59,11 @@ func SaveInviteLink(shareid string, myopenid string,isolduser bool) {
 	}
 	smid := fmt.Sprintf("%x", string(((*ret)["_id"]).(ObjectId)))
 	//积分处理,RPC
-	log.Println("smid:::", smid)
-	credit.InCreditB(smid, credit.C_TG, nil)
+	 util.Try(func() {
+				credit.InCreditB(smid, credit.C_TG, nil)
+			}, func(e interface{}) {
+				log.Println(e)
+			})
 	sharelock.Unlock()
 }
 

+ 35 - 1
weixin/src/qfw/weixin/dao/userdao.go

@@ -18,10 +18,44 @@ import (
 )
 
 //用户操作
+func IsExistsUser(openid string) bool {
+	ret := FindOne("user", M{"s_m_openid": openid})
+	return !(ret == nil || len(*ret) == 0)
+}
+
+//添加用户,不记关系,不算积分
+func AddUser4Lose(openid, unionid, bindweixin, userphoto string) (err error) {
+	data := make(M)
+	data["s_name"] = unionid //
+	data["i_type"] = 3       //微信openid类型
+	data["l_registedate"] = time.Now().Unix()
+	data["s_unionid"] = unionid
+	data["s_avatar"] = userphoto
+	//判断绑定微信字段的信息
+	if len(bindweixin) == 0 {
+		nickname := "qmx-" + strconv.Itoa(10000+rand.Intn(90000))
+		data["s_nickname"] = nickname
+		data["s_bindweixin"] = nickname
+	} else {
+		data["s_nickname"] = bindweixin
+		data["s_bindweixin"] = bindweixin
+	}
+	data["i_identificationway"] = 0
+	data["s_m_openid"] = openid //微信手机端openid
+	if id := Save("user", data); len(id) > 0 {
+		//赠送个人,新用户注册积分
+		go util.Try(func() {
+			credit.InCreditA(id, credit.A_ZC, 0)
+		}, func(e interface{}) {
+			log.Println(e)
+		})
+	}
+	return nil
+}
 
 //根据微信openid,创建一个用户
 func AddUser(openid, unionid, bindweixin, userphoto string) (err error, flag int) {
-	ret := FindOne("user", M{"s_unionid": unionid})
+	ret := FindOne("user", M{"s_m_openid": openid})
 	if ret == nil || len(*ret) == 0 {
 		data := make(M)
 		data["s_name"] = unionid //

+ 1 - 1
weixin/src/qfw/weixin/menu.go

@@ -46,7 +46,7 @@ func CreateMenu(rw http.ResponseWriter, r *http.Request) {
 	menu.Buttons[2].SubButtons[2].Name = "法规查询"
 	menu.Buttons[2].SubButtons[2].Type = MenuButtonTypeUrl
 	menu.Buttons[2].SubButtons[2].Url = fmt.Sprintf(urlstr, "lawsearchaction")
-	menu.Buttons[2].SubButtons[3].Name = "签到"
+	menu.Buttons[2].SubButtons[3].Name = "我的积分/签到"
 	menu.Buttons[2].SubButtons[3].Type = MenuButtonTypeUrl
 	menu.Buttons[2].SubButtons[3].Url = fmt.Sprintf(urlstr, "signature")
 

+ 32 - 0
weixin/src/qfw/weixin/msgaction.go

@@ -0,0 +1,32 @@
+package weixin
+
+import (
+	"fmt"
+	"log"
+	"net/http"
+)
+
+const (
+	PREVIEW_URL = "https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token="
+)
+
+//发红包(传统红包)
+func SendMsgAct(w http.ResponseWriter, r *http.Request) {
+	openid := r.FormValue("openid")
+	var msg struct {
+		ToUser string `json:"touser"`
+		Text   struct {
+			Content string `json:"content"`
+		} `json:"text"`
+		Msgtype string `json:"msgtype"`
+	}
+	msg.ToUser = openid
+	msg.Text.Content = fmt.Sprintf("<a href=\"%s\"><font color=red>%s</font></a>", "http://118.85.207.82/wx/czwap/person.do?phone=jfcpeeccfjgfokhfpmodakliicpeleek&toUserName=gh_aa76902ce7c6&openId=okAaojvZL77PDmx51yGZeGQbG8m8", "电信")
+	msg.Msgtype = "text"
+	bs, err := Mux.PostJsonCustom(PREVIEW_URL, msg)
+	if err != nil {
+		log.Println("preview msg::", err.Error())
+	} else {
+		log.Println("preview msg::", string(bs))
+	}
+}

+ 26 - 91
weixin/src/qfw/weixin/msgtxtchandler.go

@@ -1,13 +1,10 @@
 package weixin
 
 import (
-	"encoding/json"
 	"fmt"
-	"io/ioutil"
 	_ "log"
 	"math/rand"
-	"net"
-	"net/http"
+
 	"qfw/weixin/dao"
 	wf "qfw/weixinconfig"
 	"strconv"
@@ -15,28 +12,6 @@ import (
 	"time"
 )
 
-const (
-	APIKEY = "893b61852a7de8e3194194a0fe11917c"
-	APIURL = "http://www.tuling123.com/openapi/api"
-)
-
-var robotclient *http.Client
-
-//初始化图灵123 HttpClient加上超时
-func InitRobotHttpClient() {
-	robotclient = &http.Client{Transport: &http.Transport{
-		Dial: func(netw, addr string) (net.Conn, error) {
-			deadline := time.Now().Add(2 * time.Second)
-			c, err := net.DialTimeout(netw, addr, 2*time.Second)
-			if err != nil {
-				return nil, err
-			}
-			c.SetDeadline(deadline)
-			return c, nil
-		},
-	}}
-}
-
 //文本消息处理
 func MsgTxtHandler(w ResponseWriter, r *Request) {
 	openid := r.FromUserName
@@ -47,7 +22,12 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 			if us.Type == "robot" {
 				w.ReplyText("再见了小主人,记得想我呦。")
 			} else {
-				w.ReplyText("您已经退出企明星会员认证程序。")
+				if us.Type == "wxadmin" {
+					w.ReplyText("您已经退出微信管理。")
+
+				} else {
+					w.ReplyText("您已经退出企明星会员认证程序。")
+				}
 			}
 			delete(UserSession, r.FromUserName)
 		}
@@ -57,17 +37,24 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 			processPIdentifyMsgTxt(us, w, r)
 		} else if us.Type == "oidentify" {
 			processOIdentifyMsgTxt(us, w, r)
-		} else if us.Type == "robot" { //聊天机器人
-			processRobotMsg(r.FromUserName, r.Content, w, r)
+		} else if us.Type == "wxadmin" {
+			processWxAdmin(openid, r.Content, w, r)
 		}
-	} else if r.Content == "小星" {
-		UserSession[r.FromUserName] = NewUserSession("robot")
-		w.ReplyText("嗨,小星来陪你解闷。有什么开心的,不开心的说说来,大伙乐呵乐呵。\n输入q或Q离开。")
+	} else if r.Content == "微信管理" && mids[openid] {
+		UserSession[r.FromUserName] = NewUserSession("wxadmin")
+		w.ReplyText("您已进入微信管理,请输入指令操作:\n1.查看抽奖模式(指令:f0)\n2.切换抽奖模式(指令:c*,*为数字。如c0(自动模式),c1(手动模式1),c2(手动模式2),c3(手动模式3))\n3.统计抽奖结果(tjr*,tjr120(最近两分钟),tjr120-1200(最近两分钟至最近20分钟之间的))\n4.统计新用户数(tju*)\n5.服务器情况监测(ser0)\n6服务管理(man*,man1重启主程序(man11关闭),man3重启积分(man33关闭),man4重启微信认证(man44关闭))。\n输入q或Q离开。")
 		return
-	} else if r.Content == "抽奖" { //进入抽奖环节
-		//w.ReplyText("非常抱歉!系统维护中,请稍后再试。")
-		targeturl := fmt.Sprintf("http://%s/activity/%s/%s", wf.SysConfig.Domain, wf.SysConfig.Activity["activitycode"], se.EncodeString(r.FromUserName))
-		w.ReplyNews([]Article{Article{PicUrl: wf.SysConfig.Activity["picurl"], Title: wf.SysConfig.Activity["title"], Url: targeturl}})
+	} else if cj_reg.MatchString(r.Content) { //进入抽奖环节
+		if time.Now().Unix() > 1455552000 { //活动过期 ,过期后,这段代码要删除
+			//TODO
+			w.ReplyText("抱歉,活动已结束!敬请期待下一次抽奖活动,注意看预告哟……")
+		} else {
+			targeturl := fmt.Sprintf("http://%s/activity/%s/%s", wf.SysConfig.Domain, wf.SysConfig.Activity["activitycode"], se.EncodeString(r.FromUserName))
+			w.ReplyNews([]Article{Article{PicUrl: wf.SysConfig.Activity["picurl"], Title: wf.SysConfig.Activity["title"], Url: targeturl}})
+		}
+	} else if fp_reg.MatchString(r.Content) { //进入抽奖环节
+		targeturl := fmt.Sprintf("https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=http://%s/weixinoauth/action/%s&response_type=code&scope=snsapi_base&state=1#wechat_redirect", wf.SysConfig.Appid, wf.SysConfig.Domain, "turncards")
+		w.ReplyText(fmt.Sprintf(wf.SysConfig.Activity["tuenCards"], targeturl))
 	} else if strings.HasPrefix(r.Content, "内部报名") { //绑定拓普员工姓名
 		tmp := strings.Fields(r.Content)
 		//log.Println(tmp, len(tmp))
@@ -90,7 +77,9 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 		//w.Reply2CustomerService()
 		//"小主的吩咐我们已经收到了,请耐心等待或留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!"
 		now := time.Now()
-		if now.Weekday() == 6 || now.Weekday() == 0 || (now.Hour() > 17 || now.Hour() < 9) {
+		if now.Unix() > 1454601600 && now.Unix() < 1455465600 {//春节期间
+			w.ReplyText(wf.SysConfig.WeixinAutoRpl2)
+		} else if now.Weekday() == 6 || now.Weekday() == 0 || (now.Hour() > 17 || now.Hour() < 9) {
 			dao.SaveWeixinOfflineMessage(r.FromUserName, r.Content, now.Unix())
 			w.ReplyText(wf.SysConfig.WeixinAutoRpl)
 		} else {
@@ -170,57 +159,3 @@ func processPIdentifyMsgTxt(us *usersession, w ResponseWriter, r *Request) {
 		w.ReplyOK()
 	}
 }
-
-//处理聊天机器人消息
-func processRobotMsg(userid string, content string, w ResponseWriter, r *Request) {
-	rurl := fmt.Sprintf("%s?key=%s&info=%s&userid=%s", APIURL, APIKEY, content, userid)
-	//log.Println("robot::", rurl)
-	resp, err1 := robotclient.Get(rurl)
-	if err1 != nil {
-		w.ReplyText("我386的大脑,实在理解不了你说的话啊。")
-		return
-	}
-	defer resp.Body.Close()
-	bs, err2 := ioutil.ReadAll(resp.Body)
-	if err2 != nil {
-		w.ReplyText("对不起,我理解不了你说的话。")
-		return
-	}
-	//log.Println("robot::", string(bs))
-	var tmp map[string]interface{}
-	err3 := json.Unmarshal(bs, &tmp)
-	if err3 != nil {
-		w.ReplyText("对不起,我理解不了你说的话。")
-		return
-	}
-	code, _ := tmp["code"].(float64)
-	if code == 100000 {
-		repl, _ := tmp["text"].(string)
-		w.ReplyText(repl)
-	} else if code == 308000 { //菜谱
-		l, _ := tmp["list"].([]interface{})
-		arts := []Article{}
-		for index, item := range l {
-			if index > 5 {
-				break
-			}
-			m := item.(map[string]interface{})
-			arts = append(arts, Article{Title: m["info"].(string), PicUrl: m["icon"].(string), Url: m["detailurl"].(string)})
-		}
-		w.ReplyNews(arts)
-	} else if code == 302000 { //新闻
-		l, _ := tmp["list"].([]interface{})
-		arts := []Article{}
-		for index, item := range l {
-			if index > 5 {
-				break
-			}
-			m := item.(map[string]interface{})
-			arts = append(arts, Article{Title: m["article"].(string), Url: m["detailurl"].(string)})
-		}
-		w.ReplyNews(arts)
-	} else {
-		w.ReplyText("对不起,我理解不了你说的话。")
-		return
-	}
-}

+ 113 - 17
weixin/src/qfw/weixin/subscribehandler.go

@@ -8,21 +8,87 @@ import (
 	"net/http"
 	"os"
 	"qfw/util"
-	wxutil "qfw/weixin/util"
 	"qfw/util/redis"
 	"qfw/weixin/dao"
+	wxutil "qfw/weixin/util"
 	"qfw/weixinconfig"
 	"strings"
 	"time"
 )
 
+//关注事件处理
+func SubscribeHandler(w ResponseWriter, r *Request) {
+	l1 := time.Now().Unix()
+	wxutil.SubscribeInc()
+	openid := r.FromUserName
+	//log.Println("user data", w.GetUserData())
+	ret, err := w.GetUserBaseInfo(openid) //w.GetUserData().(map[string]interface{})
+	var unionid, bindweixin, userphoto string
+	if err != nil {
+		unionid = ""
+		bindweixin = "qmx-" + fmt.Sprintf("%d%d", time.Now().Local().Unix(), rand.Intn(99))
+	} else {
+		unionid, _ = ret["unionid"].(string)
+		bindweixin, _ = ret["nickname"].(string)
+		//取得用户头像
+		headimgurl, _ := ret["headimgurl"].(string)
+		log.Println("download userface :", headimgurl)
+		userphoto = downloadUserFace(headimgurl)
+	}
+	l2 := time.Now().Unix()
+	_, flag := dao.AddUser(openid, unionid, bindweixin, userphoto)
+	l2 = time.Now().Unix()
+	log.Println(",Add user", l2-l1)
+	l1 = l2
+	//保存关注日志
+	var source string
+	if len(r.EventKey) > 8 {
+		source = r.EventKey[8:]
+	} else {
+		source = ""
+	}
+	if digitreg.MatchString(source) {
+		dao.SaveSubscribeLogs(openid, unionid, bindweixin, "wangzhan", "subscribe")
+		if flag == 1 {
+			w.ReplyText(WELCOME_MSG) // 有新人关注,返回欢迎消息
+			redis.Put("sso", "new_"+source, openid, 900)
+			//TODO 处理分享(邀请)类的二维码,记录邀请关系
+			if strings.HasPrefix(source, "32") {
+				go dao.SaveInviteLink(source, r.FromUserName, false)
+				//go dao.UpdateInviteUserCoupon(source)
+			}
+		} else {
+			w.ReplyText(OWELCOME_MSG) // 有旧人关注,返回欢迎消息
+			if strings.HasPrefix(source, "32") {
+				go dao.SaveInviteLink(source, r.FromUserName, true)
+			}
+		}
+		DoLogin(source, openid)
+	} else {
+		if flag == 1 {
+			w.ReplyText(WELCOME_MSG) // 有新人关注,返回欢迎消息
+		} else {
+			w.ReplyText(OWELCOME_MSG) // 有旧人关注,返回欢迎消息
+		}
+		dao.SaveSubscribeLogs(openid, unionid, bindweixin, source, "subscribe")
+	}
 
+	l2 = time.Now().Unix()
+	log.Println(",Do save userinfo", l2-l1)
+	l1 = l2
+}
 
 //关注事件处理
-func SubscribeHandler(w ResponseWriter, r *Request) {
+func SubscribeHandlerBak(w ResponseWriter, r *Request) {
+	l1 := time.Now().Unix()
 	wxutil.SubscribeInc()
 	openid := r.FromUserName
+	log.Println("user data", w.GetUserData())
 	ret, err := w.GetUserBaseInfo(openid)
+	//ret:=w.GetUserData()
+	l2 := time.Now().Unix()
+	log.Println(",Get user baseinfo", l2-l1, " s")
+	l1 = l2
 	var unionid, bindweixin, userphoto string
 	if err != nil {
 		unionid = ""
@@ -36,6 +102,9 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 		userphoto = downloadUserFace(headimgurl)
 	}
 	_, flag := dao.AddUser(openid, unionid, bindweixin, userphoto)
+	l2 = time.Now().Unix()
+	log.Println(",Add user", l2-l1)
+	l1 = l2
 	//保存关注日志
 	var source string
 	if len(r.EventKey) > 8 {
@@ -43,7 +112,7 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 	} else {
 		source = ""
 	}
-	log.Println("source::", source, "flag:::", flag)
+	//log.Println("source::", source, "flag:::", flag)
 	if digitreg.MatchString(source) {
 		dao.SaveSubscribeLogs(openid, unionid, bindweixin, "wangzhan", "subscribe")
 		if flag == 1 {
@@ -69,19 +138,26 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 		}
 		dao.SaveSubscribeLogs(openid, unionid, bindweixin, source, "subscribe")
 	}
+
+	l2 = time.Now().Unix()
+	log.Println(",Do save userinfo", l2-l1)
+	l1 = l2
 }
 
 //取消关注事件处理
 func UnSubscribeHandler(w ResponseWriter, r *Request) {
-	w.ReplyText(WELCOME_MSG) // 有新人关注,返回欢迎消息
+	//w.ReplyText(WELCOME_MSG) // 有新人关注,返回欢迎消息
+	w.ReplyOK()
 	openid := r.FromUserName
 	//取UnionID
 	ret, err := w.GetUserBaseInfo(openid)
+	//ret := w.GetUserData()
 	var unionid, bindweixin string
 	if err != nil {
 		unionid = ""
 		bindweixin = ""
 	} else {
+		//tmp := ret.(map[string]interface{})
 		unionid, _ = ret["unionid"].(string)
 		bindweixin = "" //ret["nickname"].(string)
 	}
@@ -95,6 +171,23 @@ func ScanHandler(w ResponseWriter, r *Request) {
 	log.Println("扫码事件::", r.EventKey, r.Event)
 	log.Println("user-key:", r.EventKey)
 	w.ReplyText(weixinconfig.SysConfig.LoginTip)
+	//TODO
+	var openid, unionid, bindweixin, userphoto string
+	openid = r.FromUserName
+	if !dao.IsExistsUser(openid) {
+		ret, err := w.GetUserBaseInfo(openid)
+		if err != nil {
+			unionid = ""
+			bindweixin = "qmx-" + fmt.Sprintf("%d%d", time.Now().Local().Unix(), rand.Intn(99))
+		} else {
+			unionid, _ = ret["unionid"].(string)
+			bindweixin, _ = ret["nickname"].(string)
+			//取得用户头像
+			headimgurl, _ := ret["headimgurl"].(string)
+			userphoto = downloadUserFace(headimgurl)
+		}
+		dao.AddUser4Lose(openid, unionid, bindweixin, userphoto)
+	}
 	DoLogin(r.EventKey, r.FromUserName)
 
 }
@@ -112,18 +205,21 @@ func DoLogin(key string, openid string) {
 //下载微信用户头像
 func downloadUserFace(url string) string {
 	var filename string
-	util.Try(func() {
-		tn := time.Now()
-		filename = fmt.Sprintf("/upload/%s/%s/%s/%s%d.jpg", tn.Format("2006"), tn.Format("01"), tn.Format("02"), tn.Format("20060102150405"), rand.Intn(9999)+1000)
-		fi, _ := os.OpenFile(weixinconfig.SysConfig.Imgpath+filename, os.O_CREATE|os.O_TRUNC|os.O_SYNC|os.O_RDWR, 0x666)
-		defer fi.Close()
-		resp, err := http.Get(url)
-		defer resp.Body.Close()
-		if err == nil {
-			io.Copy(fi, resp.Body)
-		} else {
-			log.Println("download userface err:", err.Error())
-		}
-	}, func(e interface{}) {})
+
+	tn := time.Now()
+	filename = fmt.Sprintf("/upload/%s/%s/%s/%s%d.jpg", tn.Format("2006"), tn.Format("01"), tn.Format("02"), tn.Format("20060102150405"), rand.Intn(9999)+1000)
+	go func() {
+		util.Try(func() {
+			fi, _ := os.OpenFile(weixinconfig.SysConfig.Imgpath+filename, os.O_CREATE|os.O_TRUNC|os.O_SYNC|os.O_RDWR, 0x666)
+			defer fi.Close()
+			resp, err := http.Get(url)
+			defer resp.Body.Close()
+			if err == nil {
+				io.Copy(fi, resp.Body)
+			} else {
+				log.Println("download userface err:", err.Error())
+			}
+		}, func(e interface{}) {})
+	}()
 	return filename
 }

+ 4 - 1
weixin/src/qfw/weixin/txt_test.go

@@ -2,6 +2,7 @@ package weixin
 
 import (
 	"log"
+	"regexp"
 	"testing"
 	"time"
 )
@@ -13,5 +14,7 @@ func TestWeek(t *testing.T) {
 }
 
 func TestWord(t *testing.T) {
-	log.Println(len("内部报名"))
+	reg := regexp.MustCompile("^([a-z]+)(\\d.*)$")
+	s := reg.FindSubmatch([]byte("esddfdsf23s-15s"))
+	log.Println(len(s))
 }

+ 1 - 1
weixin/src/qfw/weixin/util/subscribefilter.go

@@ -28,7 +28,7 @@ func subscribeStats() {
 		//刷数据
 		mongodb.Update("user", fmt.Sprintf(`{"l_registedate":{"$gte":%d,"$lte":%d}}`, starttime, endtime), `{"$set":{"black":1}}`, false, true)
 	} else {
-		log.Printf("subscribe filter %d Minutes,create %d users \n", dutrat.Minutes(), total)
+		log.Printf("subscribe filter %f Minutes,create %d users \n", dutrat.Minutes(), total)
 	}
 	starttime = time.Now().Unix()
 	endtime = starttime

+ 2 - 20
weixin/src/qfw/weixin/voicehandler.go

@@ -17,22 +17,7 @@ func MsgVoiceHandler(w ResponseWriter, r *Request) {
 		return
 	}
 	tmp := clear_voice_reg.ReplaceAllString(r.Recognition, "")
-	if v, ok := UserSession[r.FromUserName]; ok {
-		if v.Type == "robot" { //正在聊天
-			if len(chat_bye.FindStringIndex(tmp)) > 0 { //离开
-				delete(UserSession, r.FromUserName)
-				w.ReplyText("再见了小主人,记得想我呦。")
-				return
-			} else { //正常聊天
-				processRobotMsg(r.FromUserName, tmp, w, r)
-				return
-			}
-		}
-	} else if len(notify_xiaoxing.FindStringIndex(tmp)) > 0 {
-		UserSession[r.FromUserName] = NewUserSession("robot")
-		w.ReplyText("嗨,小星来陪你解闷。有什么开心的,不开心的说说来,大伙乐呵乐呵。\n输入q或Q离开。")
-		return
-	} else if k_index := keyword_voice_reg.FindStringIndex(tmp); len(k_index) == 2 {
+	if k_index := keyword_voice_reg.FindStringIndex(tmp); len(k_index) == 2 {
 		//不再会话中,也没有唤醒小星,并且在查企业
 		search := tmp[k_index[1]:]
 		ret, err := findEntprise(search)
@@ -48,10 +33,7 @@ func MsgVoiceHandler(w ResponseWriter, r *Request) {
 			}
 			w.ReplyNews(arts)
 		}
-	} else {
-		w.ReplyText("您说的是:" + tmp + ",小星无法识别。\n查询企业请说:\n搜索XX\n查询XX\n检索XX")
-		return
-	}
+	}  
 }
 
 //查询企业

+ 30 - 2
weixin/src/qfw/weixin/weixin.go

@@ -5,6 +5,7 @@ import (
 	"qfw/weixin/util"
 	wf "qfw/weixinconfig"
 	"regexp"
+	"time"
 )
 
 var Mux *Weixin
@@ -15,6 +16,15 @@ var WELCOME_MSG string
 var OWELCOME_MSG string
 var digitreg *regexp.Regexp = regexp.MustCompile("^\\d+$")
 
+//weixin admin
+var mids = map[string]bool{}
+var reg = regexp.MustCompile("^([a-z]+)(\\d.*)$")
+var subreg = regexp.MustCompile("^(\\d+)([smhd]{0,1})$")
+var DIR = ""
+
+//活动指令
+var cj_reg, fp_reg *regexp.Regexp
+
 func InitWeixinSdk() {
 	keyword_voice_reg, _ = regexp.Compile("查询|搜索|检索|看|找|查|搜")
 	clear_voice_reg, _ = regexp.Compile("!|!|\\s+")
@@ -22,6 +32,13 @@ func InitWeixinSdk() {
 	chat_bye, _ = regexp.Compile("再见|拜拜|不说了|不聊了")
 	WELCOME_MSG = wf.SysConfig.WelcomeTip
 	OWELCOME_MSG = wf.SysConfig.OWelcomeTip
+	cj_reg, _ = regexp.Compile("抽奖")
+	fp_reg, _ = regexp.Compile("福牌|翻牌")
+	//
+	for _, v := range wf.SysConfig.Mids {
+		mids[v] = true
+	}
+	DIR = wf.SysConfig.Dir
 
 	// my-token 验证微信公众平台的Token
 	// app-id, app-secret用于高级API调用。
@@ -52,12 +69,23 @@ func InitWeixinSdk() {
 	http.HandleFunc("/"+wf.SysConfig.Appcontext+"/recharge", RechargeAct)
 	http.HandleFunc("/"+wf.SysConfig.Appcontext+"/paycallback", PayCallback)
 	//监控
-
+	http.HandleFunc("/"+wf.SysConfig.Appcontext+"/sendmsg", SendMsgAct)
 	//生成推广二维码
 	http.HandleFunc("/"+wf.SysConfig.Appcontext+"/adv/", AdvHandle)
 
 	//执行其他一些初始化的动作
-	InitRobotHttpClient()
 	InitSSLClient()
 	util.StartSubscribeFilter(wf.SysConfig.SubscribeMonitorCyc, wf.SysConfig.SubscribeMonitorTimes)
+
+	go changeMsg()
+}
+
+func changeMsg() {
+	now := time.Now().Unix()
+	if now > 1455552000 {
+		WELCOME_MSG = "您已注册企明星!企明星是一个为全国企业提供专业化服务的互联网平台。企明星提供企业服务交易、剑鱼招标订阅、全国企业信息查询等多项服务。"
+		OWELCOME_MSG = WELCOME_MSG
+	} else {
+		time.AfterFunc(5*time.Minute, changeMsg)
+	}
 }

+ 331 - 0
weixin/src/qfw/weixin/wxadmin.go

@@ -0,0 +1,331 @@
+package weixin
+
+import (
+	"fmt"
+	. "gopkg.in/mgo.v2/bson"
+	"io/ioutil"
+	"log"
+	"os/exec"
+	"qfw/util"
+	"qfw/util/mongodb"
+	"qfw/util/redis"
+	"strconv"
+	"strings"
+	"time"
+)
+
+func processWxAdmin(openid, content string, w ResponseWriter, r *Request) {
+	util.Try(func() {
+		if openid != "" {
+			b, cmd, qleng, unit, var1, var2 := checkContent(content)
+			if b {
+				resStr := "结果:"
+				switch cmd {
+				case "f":
+					//查看抽奖模式
+					resStr = getMode()
+				case "c":
+					//切换抽奖模式
+					if var1 >= 0 && var1 <= 3 {
+						br := redis.Put("other", "s_luckydraw_mode", fmt.Sprintf("%d", var1), 0)
+						if br {
+							resStr = "模式已切换:" + getMode()
+						}
+					}
+				case "tjr":
+					//数据库抽奖查看
+					var1, var2 = getTimes(qleng, unit, var1, var2)
+					qu1 := M{"$gte": var1}
+					if qleng == 2 { //取区间
+						qu1 = M{"$gte": var2, "$lte": var1}
+					} else if qleng != 1 {
+						w.ReplyText("指令异常,请重新输入。")
+						return
+					}
+					util.Try(func() {
+						sess := mongodb.GetMgoConn()
+						defer mongodb.DestoryMongoConn(sess)
+						var res []M
+						sess.DB("qfw").C("winningrecord").Pipe([]M{M{"$match": M{"l_timestamp": qu1}},
+							M{"$group": M{"_id": "$s_prize", "count": M{"$sum": 1}}}}).All(&res)
+						if res != nil && len(res) > 0 {
+							sum := 0
+							for _, v := range res {
+								resStr += "\n" + v["_id"].(string) + ":" + fmt.Sprintf("%d", v["count"].(int))
+								sum += v["count"].(int)
+							}
+							resStr += "\n" + "总数:" + fmt.Sprintf("%d", sum)
+						}
+					}, func(e interface{}) {})
+				case "tju":
+					//新用户查看
+					var1, var2 = getTimes(qleng, unit, var1, var2)
+					qu1 := M{"$gte": var1}
+					if qleng == 2 { //取区间
+						qu1 = M{"$gte": var2, "$lte": var1}
+					} else if qleng != 1 {
+						w.ReplyText("指令异常,请重新输入。")
+						return
+					}
+					util.Try(func() {
+						sess := mongodb.GetMgoConn()
+						defer mongodb.DestoryMongoConn(sess)
+						var res []M
+						sess.DB("qfw").C("user").Pipe([]M{M{"$match": M{"l_registedate": qu1}},
+							M{"$group": M{"_id": "$black", "count": M{"$sum": 1}}}}).All(&res)
+						if res != nil && len(res) > 0 {
+							sum := 0
+							for _, v := range res {
+								resStr += "\n" + util.If(v["_id"] == nil, "正常用户", "黑名单用户").(string) + ":" + fmt.Sprintf("%d", v["count"].(int))
+								sum += v["count"].(int)
+							}
+							resStr += "\n" + "总数:" + fmt.Sprintf("%d", sum)
+						}
+					}, func(e interface{}) {})
+				case "ser":
+					//服务器实时统计情况
+					//各端口,及连接数
+					//总连接数
+					resStr = getServer()
+				case "man":
+					switch var1 {
+					case 1:
+						//重启core
+						cmdstr := getNewCmd(DIR, "core2016")
+						if len(cmdstr) > 0 {
+							execCmd(DIR, "core2016", cmdstr, true)
+						}
+						resStr = "重启主程序完成"
+					case 11:
+						//关闭core
+						cmdstr := getNewCmd(DIR, "core2016")
+						if len(cmdstr) > 0 {
+							execCmd(DIR, "core2016", cmdstr, false)
+						}
+						resStr = "关闭主程序完成"
+					case 2:
+						//重启weixin
+						/**
+						cmdstr := getNewCmd(DIR+"/weixin", "weixin")
+						if len(cmdstr) > 0 {
+							execCmd(DIR+"/weixin", "weixin", cmdstr, true)
+						}
+						**/
+						resStr = "不支持重启微信"
+					case 22:
+						//不能关闭微信
+						break
+					case 3:
+						//重启积分
+						cmdstr := getNewCmd(DIR+"/credit", "credit")
+						if len(cmdstr) > 0 {
+							execCmd(DIR+"/credit", "credit", cmdstr, true)
+						}
+						resStr = "重启积分程序完成"
+					case 33:
+						cmdstr := getNewCmd(DIR+"/credit", "credit")
+						if len(cmdstr) > 0 {
+							execCmd(DIR+"/credit", "credit", cmdstr, false)
+						}
+						resStr = "关闭积分程序完成"
+					//关闭积分
+					case 4:
+						//重启oauth
+						cmdstr := getNewCmd(DIR+"/proxy", "oauth")
+						if len(cmdstr) > 0 {
+							execCmd(DIR+"/proxy", "oauth", cmdstr, true)
+						}
+						resStr = "重启微信程认证序完成"
+					case 44:
+						//关闭oauth
+						cmdstr := getNewCmd(DIR+"/proxy", "oauth")
+						if len(cmdstr) > 0 {
+							execCmd(DIR+"/proxy", "oauth", cmdstr, false)
+						}
+						resStr = "关闭微信程认证序完成"
+					}
+				}
+				log.Println("res str", resStr)
+				w.ReplyText(resStr)
+			} else {
+				w.ReplyText("指令不存在,请重新输入。")
+			}
+		} else {
+			w.ReplyText("用户信息不存在,请重新进入。")
+			delete(UserSession, openid)
+		}
+	}, func(e interface{}) {})
+}
+
+func getNewCmd(dir, substr string) string {
+	return getServerCmd(fmt.Sprintf(`ls -lt %s | grep %s |awk '{print $9}' |head -1`, dir, substr))
+}
+
+func execCmd(dir, subcmdstr, cmdstr string, bstart bool) bool {
+	exec.Command("/bin/sh", "-c", fmt.Sprintf(`ps -ef | grep %s | grep -v "grep" | awk '{print $2}' |xargs kill -9`, subcmdstr)).Run()
+	if bstart {
+		cmd := exec.Command("/bin/sh", "-c", fmt.Sprintf(`cd %s&& nohup ./%s &`, dir, cmdstr))
+		err := cmd.Run()
+		if err != nil {
+			return false
+		} else {
+			return true
+		}
+	} else {
+		return true
+	}
+}
+
+//获取服务器状态
+func getServer() (str string) {
+	util.Try(func() {
+		tmpStr := getServerCmd(`lsof -i|awk '{print $1}' | uniq -c | sort -nr`)
+		str = tmpStr
+		strs := strings.Split(tmpStr, "\n")
+		n := 0
+		for _, v := range strs {
+			tmps := strings.Split(strings.TrimSpace(v), " ")
+			if len(tmps) == 2 {
+				v, _ := strconv.Atoi(tmps[0])
+				n += v
+			}
+		}
+		str += "\n总连接数:" + fmt.Sprintf("%d", n)
+	}, func(e interface{}) {})
+	return
+}
+
+func getServerCmd(c string) (str string) {
+	cmd := exec.Command("/bin/bash", "-c", c)
+	stdout, err := cmd.StdoutPipe()
+	if err != nil {
+		str = "StdoutPipe: " + err.Error()
+		return
+	}
+	stderr, err := cmd.StderrPipe()
+	if err != nil {
+		str = "StderrPipe: " + err.Error()
+		return
+	}
+	if err := cmd.Start(); err != nil {
+		str = "Start: " + err.Error()
+		return
+	}
+	bytesErr, err := ioutil.ReadAll(stderr)
+	if err != nil {
+		str = "ReadAll stderr: " + err.Error()
+		return
+	}
+	if len(bytesErr) != 0 {
+		str = fmt.Sprintf("stderr is not nil: %s", bytesErr)
+		return
+	}
+	bytes, err := ioutil.ReadAll(stdout)
+	if err != nil {
+		str = "ReadAll stdout: " + err.Error()
+		return
+	}
+	if err := cmd.Wait(); err != nil {
+		str = "Wait: " + err.Error()
+		return
+	}
+	tmpStr := string(bytes)
+	str = strings.Trim(tmpStr, "\n")
+	return
+}
+
+//根据区间算时间0没取
+func getTimes(qlen int, unit string, var1, var2 int64) (v1, v2 int64) {
+	now := time.Now().Unix()
+	switch unit {
+	case "m":
+		var1 = var1 * 60
+		var2 = var2 * 60
+	case "h":
+		var1 = var1 * 3600
+		var2 = var2 * 3600
+	case "d":
+		var1 = var1 * 86400
+		var2 = var2 * 86400
+	}
+	v1 = now - var1
+	v2 = now - var2
+	return
+
+}
+
+//取抽奖模式
+func getMode() (resStr string) {
+	mode := redis.GetStr("other", "s_luckydraw_mode")
+	if mode == "0" {
+		resStr = "自动模式"
+	} else {
+		if mode == "" {
+			mode = "3"
+		}
+		resStr = "手动模式-" + mode
+	}
+	return
+}
+
+//解析内容
+func checkContent(con string) (b bool, cmd string, qleng int, unit string, var1, var2 int64) {
+	conOne := reg.FindSubmatch([]byte(con))
+	if len(conOne) == 3 {
+		str2 := strings.Split(string(conOne[2]), "-")
+		cmd = string(conOne[1])
+		if len(str2) == 1 {
+			qleng = 1
+			conTwo := subreg.FindSubmatch([]byte(str2[0]))
+			if len(conTwo) == 2 {
+				unit = "s"
+			} else if len(conTwo) == 3 {
+				if len(conTwo[2]) > 0 {
+					unit = string(conTwo[2])
+				} else if unit == "" {
+					unit = "s"
+				}
+			} else {
+				return
+			}
+			b = true
+			vartemp, _ := strconv.Atoi(string(conTwo[1]))
+			var1 = int64(vartemp)
+		} else if len(str2) == 2 {
+			qleng = 2
+			conTwo := subreg.FindSubmatch([]byte(str2[0]))
+			if len(conTwo) == 2 {
+				unit = "s"
+			} else if len(conTwo) == 3 {
+				if len(conTwo[2]) > 0 {
+					unit = string(conTwo[2])
+				} else if unit == "" {
+					unit = "s"
+				}
+			} else {
+				return
+			}
+			vartemp, _ := strconv.Atoi(string(conTwo[1]))
+			var1 = int64(vartemp)
+
+			conTwo2 := subreg.FindSubmatch([]byte(str2[1]))
+			if len(conTwo2) == 2 && unit == "" {
+				unit = "s"
+			} else if len(conTwo2) == 3 {
+				if len(conTwo2[2]) > 0 {
+					unit = string(conTwo2[2])
+				} else if unit == "" {
+					unit = "s"
+				}
+			} else {
+				return
+			}
+			vartemp2, _ := strconv.Atoi(string(conTwo2[1]))
+			var2 = int64(vartemp2)
+			b = true
+		} else {
+			return
+		}
+	}
+	return
+}

+ 10 - 2
weixin/src/qfw/weixinconfig/config_test.go

@@ -1,8 +1,16 @@
 package weixinconfig
 
-import ()
+import (
+	"log"
+	"regexp"
+	"testing"
+)
 
 //初始化
 func TestReadConfig(t *testing.T) {
-
+	r := regexp.MustCompile("^([a-z]+)(\\d.*)$")
+	s := r.FindSubmatch([]byte("esddfdsf23s-15s"))
+	for _, v := range s {
+		log.Println(string(v))
+	}
 }

+ 33 - 30
weixin/src/qfw/weixinconfig/weixinconfig.go

@@ -2,36 +2,39 @@ package weixinconfig
 
 //微信配置文件
 type wxconfig struct {
-	Domain          string            `json:"domain"`
-	Port            string            `json:"port"`
-	Imgpath         string            `json:"imgpath"`
-	Redisservers    string            `json:"redisServers"`   //redis缓存服务器列表
-	Mongodbservers  string            `json:"mongodbServers"` //mongodb节点
-	MongodbPoolSize int               `json:"mongodbPoolSize"`
-	MongodbName     string            `json:"mongodbName"`
-	Elasticsearch   string            `json:"elasticsearch"`
-	Rpcport         string            `json:"rpcport"`
-	ServiceTip      string            `json:"serviceTip"`
-	Appcontext      string            `json:"appcontext"`
-	Appid           string            `json:"appid"`
-	Token           string            `json:"token"`
-	Appsecret       string            `json:"appsecret"`
-	Aboutmeurl      string            `json:"aboutmeurl"`
-	Conactusurl     string            `json:"conactusurl"`
-	ElasticPoolSize int               `json:"elasticPoolSize"`
-	Wsqurl          string            `json:"wsqurl"`
-	EntAuthTip      string            `json:"entAuthTip"`
-	PerAuthTip      string            `json:"perAuthTip"`
-	OthAuthTip      string            `json:"othAuthTip"`
-	MessageTpl      map[string]string `json:"messagetpl"` //消息模板配置
-	WelcomeTip      string            `json:"welcomeTip"`
-	OWelcomeTip     string            `json:"oWelcomeTip"`
-	LoginTip        string            `json:"loginTip"`
-	FreezeTip       string            `json:"freezeTip"`
-	Activity        map[string]string `json:"activity"` //活动配置
-	WeixinAutoRpl   string            `json:"weixinautorpl"`
-	SubscribeMonitorCyc int `json:"subscribemonitorcyc"`
-	SubscribeMonitorTimes int `json:"subscribemonitortimes"`
+	Domain                string            `json:"domain"`
+	Port                  string            `json:"port"`
+	Imgpath               string            `json:"imgpath"`
+	Redisservers          string            `json:"redisServers"`   //redis缓存服务器列表
+	Mongodbservers        string            `json:"mongodbServers"` //mongodb节点
+	MongodbPoolSize       int               `json:"mongodbPoolSize"`
+	MongodbName           string            `json:"mongodbName"`
+	Elasticsearch         string            `json:"elasticsearch"`
+	Rpcport               string            `json:"rpcport"`
+	ServiceTip            string            `json:"serviceTip"`
+	Appcontext            string            `json:"appcontext"`
+	Appid                 string            `json:"appid"`
+	Token                 string            `json:"token"`
+	Appsecret             string            `json:"appsecret"`
+	Aboutmeurl            string            `json:"aboutmeurl"`
+	Conactusurl           string            `json:"conactusurl"`
+	ElasticPoolSize       int               `json:"elasticPoolSize"`
+	Wsqurl                string            `json:"wsqurl"`
+	EntAuthTip            string            `json:"entAuthTip"`
+	PerAuthTip            string            `json:"perAuthTip"`
+	OthAuthTip            string            `json:"othAuthTip"`
+	MessageTpl            map[string]string `json:"messagetpl"` //消息模板配置
+	WelcomeTip            string            `json:"welcomeTip"`
+	OWelcomeTip           string            `json:"oWelcomeTip"`
+	LoginTip              string            `json:"loginTip"`
+	FreezeTip             string            `json:"freezeTip"`
+	Activity              map[string]string `json:"activity"` //活动配置
+	WeixinAutoRpl         string            `json:"weixinautorpl"`
+	WeixinAutoRpl2 string `json:"weixinautorpl2"`
+	SubscribeMonitorCyc   int               `json:"subscribemonitorcyc"`
+	SubscribeMonitorTimes int               `json:"subscribemonitortimes"`
+	Mids                  []string          `json:"mids"`
+	Dir                   string            `json:"dir"`
 }
 
 //系统配置