Forráskód Böngészése

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

wangshan 9 éve
szülő
commit
5abef5dcc5
37 módosított fájl, 354 hozzáadás és 60 törlés
  1. 1 1
      core/src/qfw/active/active.go
  2. 2 0
      core/src/qfw/active/activemanage.go
  3. 6 4
      core/src/qfw/active/flop.go
  4. 2 2
      core/src/web/staticres/css/swordfish.css
  5. BIN
      core/src/web/staticres/images/flop/bg-1.png
  6. BIN
      core/src/web/staticres/images/flop/bg-2.png
  7. BIN
      core/src/web/staticres/images/flop/btn.png
  8. BIN
      core/src/web/staticres/images/flop/card-1.png
  9. BIN
      core/src/web/staticres/images/flop/card-2.png
  10. BIN
      core/src/web/staticres/images/flop/card-3.png
  11. BIN
      core/src/web/staticres/images/flop/card-4.png
  12. BIN
      core/src/web/staticres/images/flop/card-5.png
  13. BIN
      core/src/web/staticres/images/flop/card-6.png
  14. BIN
      core/src/web/staticres/images/flop/card.png
  15. BIN
      core/src/web/staticres/images/flop/min-blessing.png
  16. BIN
      core/src/web/staticres/images/swordfish/guide-1.png
  17. BIN
      core/src/web/staticres/images/swordfish/guide-2.png
  18. BIN
      core/src/web/staticres/images/swordfish/guide-3.png
  19. BIN
      core/src/web/staticres/images/swordfish/guide-4.png
  20. BIN
      core/src/web/staticres/images/swordfish/guide-5.png
  21. BIN
      core/src/web/staticres/wxswordfish/images/min-share-icon.png
  22. 2 2
      core/src/web/staticres/wxswordfish/share.js
  23. 52 27
      core/src/web/templates/active/flop.html
  24. 1 1
      core/src/web/templates/common/login.html
  25. 1 1
      core/src/web/templates/common/swordfishhead.html
  26. 51 0
      spider2/src/client/demo/Phone.go
  27. 29 0
      spider2/src/client/demo/downloadInfo.go
  28. 100 0
      spider2/src/client/demo/main.go
  29. 10 0
      spider2/src/common/spiderutil/httppagedownload.go
  30. 4 3
      weixin/src/config.json
  31. 35 1
      weixin/src/qfw/weixin/dao/userdao.go
  32. 5 4
      weixin/src/qfw/weixin/msgtxtchandler.go
  33. 31 11
      weixin/src/qfw/weixin/subscribehandler.go
  34. 1 1
      weixin/src/qfw/weixin/util/subscribefilter.go
  35. 19 1
      weixin/src/qfw/weixin/weixin.go
  36. 1 1
      weixin/src/qfw/weixin/wxadmin.go
  37. 1 0
      weixin/src/qfw/weixinconfig/weixinconfig.go

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

@@ -10,7 +10,7 @@ var se util.SimpleEncrypt = util.SimpleEncrypt{Key: "topnet2015topnet2015"}
 
 type Active struct {
 	*xweb.Action
-	flop     xweb.Mapper `xweb:"/active/flop/(.*)/(.*)"`
+	flop     xweb.Mapper `xweb:"/active/flop/(\\w+)/([^.]*)"`
 	flopAjax xweb.Mapper `xweb:"/active/flopAjax"`
 }
 

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

@@ -264,6 +264,8 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 				Tm := time.Now().AddDate(0, 0, 1)
 				if ret := redis.Get("other", "cj_"+openid+"_"+Tm.Format("2006_01_02")); ret == nil {
 					a.T["msg"] = "  小主,分享给好友参加明天的抽奖吧!千万不要再忘记了,大奖可能就在明天~"
+				} else {
+					a.T["msg"] = "  小主已获得明天的抽奖资格!明天记得要来啊~"
 				}
 			} else {
 				a.T["msg"] = "  小主已获得明天的抽奖资格!明天记得要来啊~"

+ 6 - 4
core/src/qfw/active/flop.go

@@ -20,10 +20,12 @@ 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 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), "的积分修改失败!")
+		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

+ 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/btn.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/min-blessing.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


BIN
core/src/web/staticres/wxswordfish/images/min-share-icon.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 () { 

+ 52 - 27
core/src/web/templates/active/flop.html

@@ -9,7 +9,7 @@
 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/blessing.png";
+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端时才会打印。
@@ -91,30 +91,29 @@ img{
 	display: none;
 }
 .cards>img{
-	width: 212.5px;
-	height: 240px;
+	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;
-	width: 280px;
-	line-height: 22px;
-	left: 50%;
-	margin-left: -145px;
+	left: 20px;
+	right: 20px;
+	max-width: 600px;
+	line-height: 20px;
 	display: none;
 	font-size:0.875em;
 	font-weight: bold;
 	text-align: center;
 	padding: 5px;
-	margin-bottom: 10px;
 	display: none;
 }
-.flop-tip>span{
+.flop-tip span{
 	margin-right: 3px;
 }
-.flop-tip>font{
+.flop-tip font{
 	font-size: 0.75em;
 	font-weight: normal;
 }
@@ -134,13 +133,14 @@ img{
 	background-size: 100% 100%;
 	position: absolute;
 	top: 30px;
-	width: 280px;
-	left: 50%;
-	margin-left: -140px;
+	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;
@@ -150,6 +150,10 @@ img{
 	text-overflow: ellipsis;
 	vertical-align: top;
 }
+.flop-notice>div{
+	display: inline-block;
+	vertical-align: top;
+}
 .flop-share{
 	position: absolute;
 	left: 0px;
@@ -190,17 +194,21 @@ ul{
 }
 .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 eq .T.flag 1}} style="display: none;"{{end}}>
+<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>,您的猴年福牌是:
+		<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}}
@@ -217,8 +225,9 @@ ul{
 		</div>
 	</div>
 	{{end}}
+	{{if eq .T.flag 1 2}}
 	<div class="flop-tip">
-		恭喜!你的企明星积分翻
+		恭喜!您的企明星积分翻了
 		<span class="multiple">
 		{{if eq .T.flag 1}}
 		<ul class="random">
@@ -234,9 +243,12 @@ ul{
 		{{.T.multiple}}
 		{{end}}
 		</span>倍!<br>
-		您的积分已从{{.T.oldCredit}}分涨到{{.T.newCredit}}分。<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}}){
@@ -245,20 +257,32 @@ if({{.T.IsOver}}){
 $(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 = 212.5;
-	var height = 240;
+	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(windowWidth > defaultWidth && windowHeight > defaultHeight){
-		width = width / defaultWidth * windowWidth;
-		if(width > 350){//最大宽度350
-			width = 350
+	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});
@@ -267,9 +291,9 @@ $(function(){
 	$(".flop-notice").css({top: noticeTop});
 	var flopTipTop = windowHeight - $(".cards").height()  - cardTop - $(".flop-tip").height();
 	if(flopTipTop > 30 && flopTipTop < 40){
-		$(".flop-tip").css({"line-height": "30px",top: $(".cards").height() + cardTop - 20});
+		$(".flop-tip").css({"line-height": "25px",top: $(".cards").height() + cardTop - 20});
 	}else if(flopTipTop > 40){
-		$(".flop-tip").css({"line-height": "30px",top: $(".cards").height() + cardTop - 10});
+		$(".flop-tip").css({"line-height": "25px",top: $(".cards").height() + cardTop});
 	}else{
 		$(".flop-tip").css({top: $(".cards").height()+cardTop-20});
 	}
@@ -293,10 +317,11 @@ $(function(){
 			setTimeout(function(){
 				clearInterval(randomInterval);
 				$(".multiple").html({{.T.multiple}});
-			},1000);
+				$("#credit").show();
+			},3000);
 			setTimeout(function(){
 				$(".bubble").fadeIn();
-			},3000);
+			},6000);
 			$('.cards').children('img:first').stop().animate({'width':0},500,function(){
 				$(this).hide().next().show();
 				$(this).next().animate({'width':width+'px'},200);

+ 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');

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

+ 51 - 0
spider2/src/client/demo/Phone.go

@@ -0,0 +1,51 @@
+package main
+
+import (
+	"fmt"
+	"math/rand"
+	"strconv"
+	"time"
+)
+
+var modals []string
+
+func init() {
+	modals = make([]string, 0)
+	modals = append(modals, "XiaoMi;MI1", "XiaoMi;MI2", "XiaoMi;MI3", "XiaoMi;MI4", "XiaoMi;Red", "XiaoMi;MiPad")
+	modals = append(modals, "MEIZU;M8", "MEIZU;M9", "MEIZU;MX", "MEIZU;MX1", "MEIZU;MX2", "MEIZU;Mx3", "MEIZU;MX4", "MEIZU;MX5", "MEIZU;MX4pro", "MEIZU;BLUE", "MEIZU;MX5pro")
+	modals = append(modals, "SAMSUNG;GALAXY S1", "SAMSUNG;GALAXY S2", "SAMSUNG;GALAXY S3", "SAMSUNG;GALAXY S4", "SAMSUNG;GALAXY S5", "SAMSUNG;GALAXY S6", "SAMSUNG;GALAXY S7", "SAMSUNG;GALAXY A5", "SAMSUNG;GALAXY A6", "SAMSUNG;GALAXY A9", "SAMSUNG;GALAXY Edge6", "SAMSUNG;GALAXY Edge 6plus", "SAMSUNG;GALAXY Note7", "SAMSUNG;GALAXY Note6", "SAMSUNG;GALAXY Note5", "SAMSUNG;GALAXY Note4", "SAMSUNG;GALAXY Note3", "SAMSUNG;GALAXY Note2", "SAMSUNG;GALAXY NotePad", "SAMSUNG;GALAXY NotePad2", "SAMSUNG;GALAXY NotePad3")
+	modals = append(modals, "HUAWEI;MATE7", "HUAWEI;MATE8", "HUAWEI;MATE6", "HUAWEI;MATE7Pro", "HUAWEI;NotePad", "HUAWEI;MATES", "HUAWEI;P8", "HUAWEI;P9", "HUAWEI;ATH-TL00H", "HUAWEI;ATH-T80H", "HUAWEI;ATH-780H", "HUAWEI;ATH-B89")
+	modals = append(modals, "MOTO;ABN-JIK-TLS5", "MOTO;ABN-TB3", "MOTO;DFX5-A", "MOTO;X5-S", "MOTO;Defy pro", "MOTO;Defy 525 pro", "MOTO;Defy-MI", "MOTO;Stone-BM-4")
+	modals = append(modals, "NUBIA;X5", "NUBIA;X3", "NUBIA;X6", "NUBIA;Z9", "NUBIA;Z7", "NUBIA;BLAG", "NUBIA;BLAGS", "NUBIA;Z9X")
+	modals = append(modals, "OPPO;FIND7", "OPPO;FIND5", "OPPO;FIND6", "OPPO;FIND3", "OPPO;R7S", "OPPO;A52", "OPPO;R3", "OPPO;R9S", "OPPO;N1S", "OPPO;N1", "OPPO;r2017S")
+	modals = append(modals, "VIVO;X6", "VIVO;X6 pro", "VIVO;X5", "VIVO;X5 pro", "VIVO;Y51", "VIVO;Y52", "VIVO;Y53", "VIVO;54", "VIVO;Y29", "VIVO;Xshot", "VIVO;Xshot X", "VIVO;Xshot 507")
+	modals = append(modals, "ZTE;Axon B15", "ZTE;Axon B1", "ZTE;Axon PRO", "ZTE;Axon Blade", "ZTE;V5 MAX", "ZTE;Grand S II", "ZTE;Grand S RPO", "ZTE;Grand A", "ZTE;AXON MINI", "ZTE;AXON MINI1", "ZTE;AXON MINI2")
+}
+
+func IMEI() string {
+	r := rand.New(rand.NewSource(time.Now().UnixNano()))
+	ImeiStr := fmt.Sprintf("%d", r.Intn(100000000000000))
+	result := 0
+	for i := 0; i < len(ImeiStr); i++ {
+		intChar, _ := strconv.Atoi(string(ImeiStr[i]))
+		i++
+		tmp, _ := strconv.Atoi(string(ImeiStr[i]))
+		tmp = tmp * 2
+		if tmp < 10 {
+			tmp = tmp - 9
+		}
+		result = intChar + tmp
+	}
+	result = result % 10
+	if result != 0 {
+		result = 10 - result
+	}
+	IMEI := ImeiStr + fmt.Sprintf("%d", result)
+	return IMEI
+}
+
+func Modal() string {
+	r := rand.New(rand.NewSource(time.Now().UnixNano()))
+	index := r.Intn(len(modals))
+	return modals[index]
+}

+ 29 - 0
spider2/src/client/demo/downloadInfo.go

@@ -0,0 +1,29 @@
+// DownloadInfo
+package main
+
+import (
+	. "common/spiderutil"
+	"log"
+)
+
+var hd *HttpDownload
+
+func DownloadInfo() {
+
+	bs, _, _ := hd.Download(&RequestConfig{
+		Urlstr: "https://120.52.121.75:8443/QueryGSInfo/entPublicitySC/entPublicityDC/getJyycmlxx.action",
+		Method: "get",
+		Param: map[string]string{
+			"AreaCode": "410000",
+			"EntId":    "141000010452582520",
+			"EntNo":    "410104000038631",
+			"Info":     "All HTTP/1.1",
+		},
+		Head: map[string]string{
+			"Host":       "120.52.121.75:8443",
+			"Connection": "keep-alive",
+			"User-Agent": "Mozilla/5.0 (Android;4.4.4;iToolsAVM;iToolsAVM)",
+		},
+	})
+	log.Println(string(bs))
+}

+ 100 - 0
spider2/src/client/demo/main.go

@@ -0,0 +1,100 @@
+package main
+
+import (
+	"crypto/tls"
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"log"
+	"net/http"
+)
+
+var client *http.Client
+var urlPrefix string
+
+func main() {
+	tr := &http.Transport{
+		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+	}
+	client = &http.Client{Transport: tr}
+
+	//查询企业
+	urlPrefix = "https://120.52.121.75:8443"
+	headMap := make(map[string]string)
+	headMap["AreaCode"] = "410000"
+	headMap["Url"] = urlPrefix + "/QuerySummary?AreaCode=" + headMap["AreaCode"] + "&Page=1&Limit=50&Q=郑州赛驰计算机"
+	headMap["Cookie"] = "352284048787547"
+	headMap["User-Agent"] = "Mozilla/5.0 (Android;4.0.1;MANUFACTURER;Pro5);Version/ErrorVersion;ISN_GSXT"
+	body := SetHeader(headMap)
+
+	result1 := make(map[string]interface{})
+	json.Unmarshal(body, &result1)
+	//fmt.Println(result1["RESULT"])
+	infolist := result1["RESULT"].([]interface{})
+	var ID, REGNO string
+	for _, v := range infolist {
+		ID = fmt.Sprint((v.(map[string]interface{}))["ID"])
+		REGNO = fmt.Sprint((v.(map[string]interface{}))["REGNO"])
+	}
+
+	//下载工商公示信息
+	headMap["Url"] = urlPrefix + "/QueryGSInfo?AreaCode=" + headMap["AreaCode"] + "&EntId=" + ID + "&EntNo=" + REGNO + "&Info=All"
+	body = SetHeader(headMap)
+
+	fmt.Println("工商公示", string(body))
+	tmp1 := make(map[string]interface{})
+	json.Unmarshal(body, &tmp1)
+	baseInfo := tmp1["RESULT"].(map[string]interface{})
+	REGINFO := baseInfo["REGINFO"].(map[string]interface{})
+	LEGINFO := REGINFO["LEGINFO"].([]interface{})
+	fmt.Println("股东列表", LEGINFO)
+	//股东详情
+	for k, v := range LEGINFO {
+		gd := v.(map[string]interface{})
+		headMap["Url"] = urlPrefix + "/QueryGSDetail?Id=" + fmt.Sprint(gd["ID"]) + "&AreaCode=" + headMap["AreaCode"] + "&EntId=" + ID + "&EntNo=" + REGNO + "&Item=LegDetail"
+		body = SetHeader(headMap)
+		fmt.Println(k, string(body))
+	}
+
+	//下载企业公示信息
+	headMap["Url"] = urlPrefix + "/QueryQY?AreaCode=" + headMap["AreaCode"] + "&EntId=" + ID + "&EntNo=" + REGNO + "&Info=All"
+	body = SetHeader(headMap)
+
+	//企业年报信息
+	result2 := make(map[string]interface{})
+	json.Unmarshal(body, &result2)
+	tmp2 := result2["RESULT"].(map[string]interface{})
+	nblist := tmp2["REPORTINFO"].([]interface{})
+	nb := make(map[string]interface{})
+	for _, v := range nblist {
+		nb = v.(map[string]interface{})
+		if nb != nil {
+			break
+		}
+	}
+	//fmt.Println(nb)
+	nbId := fmt.Sprint(nb["ID"])
+	headMap["Url"] = urlPrefix + "/QueryQYReport?Id=" + nbId + "&AreaCode=" + headMap["AreaCode"] + "&EntId=" + ID + "&EntNo=" + REGNO + "&Info=All"
+	body = SetHeader(headMap)
+	fmt.Println("年报", string(body))
+}
+func SetHeader(headMap map[string]string) []byte {
+	req, _ := http.NewRequest("GET", headMap["Url"], nil)
+	//req, _ := http.NewRequest("GET", "https://120.52.121.75:8443/QueryAutoName?AreaCode=410000&Q=计算机&Size=5", nil)
+	req.Header.Add("User-Agent", headMap["User-Agent"])
+	req.Header.Add("Cookie", headMap["Cookie"])
+	req.Header.Add("Host", "120.52.121.75:8443")
+	req.Header.Add("Connection", "Keep-Alive")
+	resp, err := client.Do(req)
+	if err != nil {
+		log.Println(err.Error())
+		return nil
+	}
+	defer resp.Body.Close()
+	body, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		log.Println(err.Error())
+		return nil
+	}
+	return body
+}

+ 10 - 0
spider2/src/common/spiderutil/httppagedownload.go

@@ -144,6 +144,16 @@ func (hd *HttpDownload) SelectProxy() []string {
 	return addrs
 }
 
+//使用当前代理
+func (hd *HttpDownload) UseProxy(addr string) {
+	hd.ProxyAddr = addr
+	log.Println("当前使用代理", hd.ProxyAddr)
+	url_i := url.URL{}
+	url_proxy, _ := url_i.Parse(hd.ProxyAddr)
+	keepalivetransport.Proxy = http.ProxyURL(url_proxy)
+	diskeepalivetransport.Proxy = http.ProxyURL(url_proxy)
+}
+
 //下载页面
 func (hd *HttpDownload) Download(rc *RequestConfig) (
 	ret []byte, retcookies []*http.Cookie, err error) {

+ 4 - 3
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":{
@@ -33,8 +33,9 @@
 		"activitycode":"topcj",
 		"title":"企明星新年抽奖活动进行中",
 		"picurl":"http://www.qimingxing.info/images/choujiang2.png",
-		"tuenCards":"小主,来抢新年福牌了!\n剑鱼君派送神秘福牌!\n<a href='%s'>小主快快点这里翻福牌!</a>",
+		"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,

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

+ 5 - 4
weixin/src/qfw/weixin/msgtxtchandler.go

@@ -44,7 +44,7 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 		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 == "抽奖" { //进入抽奖环节
+	} else if cj_reg.MatchString(r.Content) { //进入抽奖环节
 		if time.Now().Unix() > 1455552000 { //活动过期 ,过期后,这段代码要删除
 			//TODO
 			w.ReplyText("抱歉,活动已结束!敬请期待下一次抽奖活动,注意看预告哟……")
@@ -52,9 +52,8 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 			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 r.Content == "翻牌" { //进入抽奖环节
+	} 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.ReplyNews([]Article{Article{Title: wf.SysConfig.Activity["tuenCards"], Url: targeturl,Description:}})
 		w.ReplyText(fmt.Sprintf(wf.SysConfig.Activity["tuenCards"], targeturl))
 	} else if strings.HasPrefix(r.Content, "内部报名") { //绑定拓普员工姓名
 		tmp := strings.Fields(r.Content)
@@ -78,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 {

+ 31 - 11
weixin/src/qfw/weixin/subscribehandler.go

@@ -21,10 +21,10 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 	l1 := time.Now().Unix()
 	wxutil.SubscribeInc()
 	openid := r.FromUserName
-	log.Println("user data", w.GetUserData())
-	ret,_ := w.GetUserData().(map[string]interface{})
+	//log.Println("user data", w.GetUserData())
+	ret, err := w.GetUserBaseInfo(openid) //w.GetUserData().(map[string]interface{})
 	var unionid, bindweixin, userphoto string
-	if ret != nil {
+	if err != nil {
 		unionid = ""
 		bindweixin = "qmx-" + fmt.Sprintf("%d%d", time.Now().Local().Unix(), rand.Intn(99))
 	} else {
@@ -146,15 +146,18 @@ func SubscribeHandlerBak(w ResponseWriter, r *Request) {
 
 //取消关注事件处理
 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)
 	}
@@ -168,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)
 
 }
@@ -185,11 +205,11 @@ func DoLogin(key string, openid string) {
 //下载微信用户头像
 func downloadUserFace(url string) string {
 	var filename string
-	
-		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() {
+
+	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)
@@ -199,7 +219,7 @@ func downloadUserFace(url string) string {
 			} else {
 				log.Println("download userface err:", err.Error())
 			}
-			}, func(e interface{}) {})
-		}()
+		}, func(e interface{}) {})
+	}()
 	return filename
 }

+ 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

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

@@ -5,6 +5,7 @@ import (
 	"qfw/weixin/util"
 	wf "qfw/weixinconfig"
 	"regexp"
+	"time"
 )
 
 var Mux *Weixin
@@ -15,11 +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+")
@@ -27,7 +32,8 @@ 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
@@ -70,4 +76,16 @@ func InitWeixinSdk() {
 	//执行其他一些初始化的动作
 	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)
+	}
 }

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

@@ -51,7 +51,7 @@ func processWxAdmin(openid, content string, w ResponseWriter, r *Request) {
 						if res != nil && len(res) > 0 {
 							sum := 0
 							for _, v := range res {
-								resStr += "\n" + v["_id"].(string) + ":" + fmt.Sprintf("%x", v["count"])
+								resStr += "\n" + v["_id"].(string) + ":" + fmt.Sprintf("%d", v["count"].(int))
 								sum += v["count"].(int)
 							}
 							resStr += "\n" + "总数:" + fmt.Sprintf("%d", sum)

+ 1 - 0
weixin/src/qfw/weixinconfig/weixinconfig.go

@@ -30,6 +30,7 @@ type wxconfig struct {
 	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"`