Browse Source

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

zhangjinkun@topnet.net.cn 9 năm trước cách đây
mục cha
commit
a55496eeda

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

+ 1 - 0
weixin/src/config.json

@@ -35,6 +35,7 @@
 		"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,

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

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

@@ -52,7 +52,7 @@ 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 fp_reg.MatchString(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.ReplyText(fmt.Sprintf(wf.SysConfig.Activity["tuenCards"], targeturl))
 	} else if strings.HasPrefix(r.Content, "内部报名") { //绑定拓普员工姓名
@@ -77,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 {

+ 23 - 5
weixin/src/qfw/weixin/subscribehandler.go

@@ -22,9 +22,9 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 	wxutil.SubscribeInc()
 	openid := r.FromUserName
 	//log.Println("user data", w.GetUserData())
-	ret, _ := w.GetUserData().(map[string]interface{})
+	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 {
@@ -150,13 +150,14 @@ func UnSubscribeHandler(w ResponseWriter, r *Request) {
 	w.ReplyOK()
 	openid := r.FromUserName
 	//取UnionID
-	//ret, err := w.GetUserBaseInfo(openid)
-	ret := w.GetUserData().(map[string]interface{})
+	ret, err := w.GetUserBaseInfo(openid)
+	//ret := w.GetUserData()
 	var unionid, bindweixin string
-	if ret == nil {
+	if err != nil {
 		unionid = ""
 		bindweixin = ""
 	} else {
+		//tmp := ret.(map[string]interface{})
 		unionid, _ = ret["unionid"].(string)
 		bindweixin = "" //ret["nickname"].(string)
 	}
@@ -170,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)
 
 }

+ 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

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