Browse Source

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

李广朋 9 years ago
parent
commit
6219955877

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

@@ -3,8 +3,11 @@ package active
 
 import (
 	"github.com/go-xweb/xweb"
+	"qfw/util"
 )
 
+var se util.SimpleEncrypt = util.SimpleEncrypt{Key: "topnet2015topnet2015"}
+
 //抽奖活动
 func init() {
 	//添加模块解析

+ 3 - 3
core/src/qfw/active/activemanage.go

@@ -27,12 +27,12 @@ type Activemanage struct {
 //进入抽奖页面
 func (a *Activemanage) Luckdraw(activecode, id string) error {
 	//userInfo := a.GetSession("userInfo").(*map[string]interface{})
-	openid := id //(*userInfo)["s_m_openid"].(string)
+	//se := SimpleEncrypt{Key: "topnet2015topnet2015"}
+	openid := se.DecodeString(id)
 	a.T["shareid"] = coreutil.FindMyShareId(activecode, openid)
 	//
 	if activecode == "topcj" {
-		se := SimpleEncrypt{Key: "topnet2015topnet2015"}
-		openid := se.DecodeString(id)
+
 		f := FindOne("user", "{'s_m_openid':'"+openid+"'}")
 		username := (*f)["s_bindweixin"]
 		userid := (*f)["_id"]

+ 1 - 1
core/src/qfw/manage/auditing.go

@@ -790,7 +790,7 @@ func (s *SystemManage) Updateaudit() error {
 			msg = "审核失败!"
 		}
 		//认证送积分
-		if flag == "true" {
+		if flag == "true" && _status == 1 {
 			b, credit_a, score, _ := credit.InCreditA(s_submitid, credit.A_RZ, util.IntAll((*f)["credit_a"]))
 			if b {
 				s.Session().UpdateByCustomField("id", s_submitid, "i_credit", util.IntAll((*f)["i_credit"])+score)

+ 2 - 0
core/src/qfw/mobile/wxmenu.go

@@ -77,6 +77,8 @@ func (m *Mobile) Wxrssset() error {
 				}
 			}
 			m.T["msgset"] = (*userInfo)["o_msgset"]
+			//取Shareid
+			m.T["shareid"] = cutil.FindMyShareId("topcj", m.Session().Get("s_m_openid").(string))
 		}
 
 		return m.Render("/swordfish/wxrssset.html", &m.T)

+ 16 - 6
core/src/qfw/swordfish/swordfishmanage.go

@@ -1,7 +1,9 @@
 package swordfish
 
 import (
+	_ "encoding/json"
 	"gopkg.in/mgo.v2/bson"
+	"qfw/util"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
 	"time"
@@ -34,8 +36,7 @@ func (s *SwordFish) RssSet() error {
 			if set["tender"] != nil {
 				tender, _ := set["tender"].(map[string]interface{})
 				if tender["l_enddate"] != nil {
-					t := tender["l_enddate"].(int64) - time.Now().Unix()
-					tender["day"] = t / (60 * 60 * 24)
+					tender["day"] = util.GetSubDay(tender["l_enddate"].(int64))
 				}
 			}
 		}
@@ -43,15 +44,24 @@ func (s *SwordFish) RssSet() error {
 			if set["bid"] != nil {
 				bid, _ := set["bid"].(map[string]interface{})
 				if bid["l_enddate"] != nil {
-					t := bid["l_enddate"].(int64) - time.Now().Unix()
-					bid["day"] = t / (60 * 60 * 24)
+					bid["day"] = util.GetSubDay(bid["l_enddate"].(int64))
 				}
 			}
 		}
 	}
-	list := mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
+	//list := mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
+	if ret := redis.Get("other", "swordfish_rsset"); ret != nil {
+		s.T["list"] = ret.([]interface{})
+	} else {
+		now := time.Now()
+		unix := time.Date(now.Year(), now.Month(), now.Day(), now.Hour()-2, now.Minute(), now.Second(), now.Nanosecond(), time.Local).Unix()
+		r := mongodb.Find("bidding", bson.M{"comeintime": bson.M{"$lte": unix}}, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 5)
+		if r != nil {
+			s.T["list"] = *r
+		}
+		redis.Put("other", "swordfish_rsset", *r, 1000) //缓存半个小时
+	}
 	s.T["msgset"] = msgset
-	s.T["list"] = *list
 	return s.Render("/swordfish/rssset.html", &s.T)
 }
 

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 17:02:43"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 17:02:43"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 20:24:52"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 20:24:52"}},"marketisstart":true,"marketrate":300}

+ 0 - 1
core/src/web/staticres/css/dev-qfw.css

@@ -1497,7 +1497,6 @@ a{
 
 .a-servicedetail .d_tck_fw span {
 	font-size: 13px;
-	margin-left: 20px;
 }
 
 .a-servicedetail .d_tck_fat {

+ 9 - 6
core/src/web/staticres/js/entportrait.js

@@ -17,12 +17,7 @@ $(function(){
 			//设置地图上显示的位置
 			$("#location").attr("value",as1);
 			$("#cityname").attr("value",pt.trim()+ct.trim()+at.trim());		
-			//获取地图的经纬度
-			loadJS("http://api.map.baidu.com/getscript?v=2&ak=AFd8b176f363f23e6a23d516f4cfb742&services=&t=20150522093217",function(){
-				loadJS("/js/geocoder.js",function(){
-					doOptions();
-				});
-			});
+			initMap();
 			$("#city_china").text(pt+ct+at+as1);
 		});
 	}
@@ -47,6 +42,14 @@ $(function(){
 	});
 	pcShare();
 });
+function initMap(){
+	//获取地图的经纬度
+	loadJS("http://api.map.baidu.com/getscript?v=2&ak=AFd8b176f363f23e6a23d516f4cfb742&services=&t=20150522093217",function(){
+		loadJS("/js/geocoder.js",function(){
+			doOptions();
+		});
+	});
+}
 //显示地图
 function showMap(){
 	document.getElementById('mapshowdiv').style.display = 'block';

+ 3 - 3
core/src/web/templates/member/credit/mycredit.html

@@ -134,7 +134,7 @@
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
 								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
-								<td width="30%" style="padding:110px">去 <button class="btn btn-primary" onclick="toUrl('/member/yellowpage/show/enterprise/{{.T.user.s_enterpriseid}}')" style="padding-top:3px;padding-bottom:3px;">完善资料</button></td>
+								<td width="30%" style="padding:110px">去 <button class="btn btn-primary" onclick="toUrl('{{if session "identWay"}}{{if eq (session "identWay") 1}}/member/yellowpage/show/enterprise/{{.T.user.s_enterpriseid}}{{else}}/member/accountset/index{{end}}{{else}}/member/accountset/index{{end}}')" style="padding-top:3px;padding-bottom:3px;">完善资料</button></td>
 								{{end}}
 							</tr>
 							<tr class="rowtwo">
@@ -154,7 +154,7 @@
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
 								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
-								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('/member/yellowpage/show/enterprise/{{.T.user.s_enterpriseid}}#service')">发服务</span></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('{{if session "identWay"}}{{if eq (session "identWay") 1}}/member/yellowpage/show/enterprise/{{.T.user.s_enterpriseid}}#service{{else}}/member/accountset/index{{end}}{{else}}/member/accountset/index{{end}}')">发服务</span></td>
 								{{end}}
 							</tr>
 							<tr class="rowtwo">
@@ -256,7 +256,7 @@
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
 								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">{{.T.B_FFW.B}}/{{.T.B_FFW.C}}</span></td>
-								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('/member/yellowpage/show/enterprise/{{.T.user.s_enterpriseid}}#service')">发服务</span></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('{{if session "identWay"}}{{if eq (session "identWay") 1}}/member/yellowpage/show/enterprise/{{.T.user.s_enterpriseid}}#service{{else}}/member/accountset/index{{end}}{{else}}/member/accountset/index{{end}}')">发服务</span></td>
 								{{end}}
 							</tr>
 							<tr class="rowtwo">

+ 1 - 1
core/src/web/templates/service/appointment.html

@@ -9,7 +9,7 @@
 			</div>
 			<div id="reg_b">
 		  	<div class="text-muted d_tck_n">发布人:{{.T.sinfo.s_enterprisename}}</div>
-			<div class="d_tck_fw"><div style="border-left:3px solid #FF5A5F;height:15px;float:left;margin-right:5px;"></div><div style="float:left;line-height: 15px;">{{.T.sinfo.s_name}}</div>
+			<div class="d_tck_fw"><div style="border-left:3px solid #FF5A5F;height:15px;float:left;margin-right:5px;margin-top: 3px;"></div><div style="float:left;line-height: 20px;font-weight: bold;width: 390px;">{{.T.sinfo.s_name}}</div>
 				<span class="dspan" style="float:right;margin-right:20px;" >已有<a href="#"  class="text-primary">{{.T.appcount}}</a> 人预约</span>
 			</div>
 	  		<div class="modal-body d_tck_fat">

+ 1 - 1
core/src/web/templates/service/bid.html

@@ -10,7 +10,7 @@
 				<div class="modal-body g-modal-body">
 					<p class="text-default u-font" style="color:#A0A0A0;font-size:13px;padding-left:8px; ">发布人:<span id="fbr"></span></p>
 					<p class="text-default">
-						<span id="bid-publishPerson" style="border-left: 3px solid #FF5A5F;    padding-left: 5px;">发布人:{{.T.demandInfo.s_name}}</span>
+						<span id="bid-publishPerson" style="border-left: 3px solid #FF5A5F;    padding-left: 5px;">{{.T.demandInfo.s_name}}</span>
 						<span class="pull-right">
 							已有
 							<span class="text-primary">{{if .T.demandInfo.i_bids}}{{.T.demandInfo.i_bids}}{{else}}0{{end}}</span>

+ 2 - 2
core/src/web/templates/service/detail.html

@@ -656,7 +656,7 @@ function comment(){
 					if (r[i]["s_pic"] && r[i]["s_pic"]!=""){
 						src=r[i]["s_pic"];
 					}
-					var tx="<div style='margin-right:50px;'><img height=34 class='radius' style='margin-bottom:10px;margin-right:-15px;'  src="+src+"  /></div>"
+					var tx="<div style='margin-right:50px;'><img width=34px height=34 class='radius' style='margin-bottom:10px;margin-right:-15px;'  src="+src+"  /></div>"
 					html+= '<tr class="fonttwo a-border-b"><td>'+tx+s_linkman+'</td><td>'+s_servicename+'</td><td>'+l_createdate+'</td></tr>'
 					
 				}
@@ -750,4 +750,4 @@ function comment(){
 		});
 </script>
 </body>
-</html>
+</html>

+ 5 - 0
core/src/web/templates/swordfish/index.html

@@ -4,6 +4,11 @@
 <meta name="Keywords" content="{{Msg "seo" "qfw.swordfish.key"}}"/>
 <meta name="Description" content="{{Msg "seo" "qfw.swordfish.description"}}"/>
 {{include "/common/inc.html"}}
+<style>
+#hm_t_91219{
+	opacity: 0;
+}
+</style>
 </head>
 <body>
 <!-- 头部 -->

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

@@ -419,7 +419,7 @@ $(function(){
 		if(oprarr.length>0){
 			var str1="您选择了<span style='color:red'>"+oprarr.length+"</span>个信息栏目(<span style='color:red'>"+typeinfo+"</span>),确认后系统将每月扣除<span style='color:red'>"+oprarr.length*1000+"</span>积分,您目前的积分余额<span style='color:red'>("+i_credit+")</span>不足,<a href='/member/credit/myCredit' style='color:#37C6DA'>去做任务赚积分</a>";
 			str2="<button class='btn btn-primary' onclick='swordfishpay(1)'>取消</button>";
-			if((i_credit-oprarr.length*1000)>0){				
+			if((i_credit-oprarr.length*1000)>=0){				
 				str1="您选择了<span style='color:red'>"+oprarr.length+"</span>个信息栏目(<span style='color:red'>"+typeinfo+"</span>),确认后系统将每月扣除<span style='color:red'>"+oprarr.length*1000+"</span>积分,您目前的积分余额是<span style='color:red'>"+i_credit+"</span>积分,扣除后将剩余<span style='color:red'>"+(i_credit-oprarr.length*1000)+"</span>积分。";
 				str2="<button class='btn btn-primary' onclick='swordfishpay(0)'>提交</button>"
 				+"&nbsp;<button class='btn btn-primary' onclick='swordfishpay(1)'>取消</button>";

+ 2 - 1
core/src/web/templates/swordfish/wxrssset.html

@@ -8,10 +8,11 @@
 <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>
 	var msgset= {{.T.msgset}};
+	var shareid="{{.T.shareid}}";
 </script>
-<script src="/wxswordfish/main.js"></script>
 </head>
 <body>
 <div class="credit-tip visible">

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

@@ -102,7 +102,7 @@ $(function(){
 		}
 	});
 	//
-	initShare({{.T.signature}});
+	initShare({{.T.signature}},typeof(shareid)=="undefined"?"":shareid);
 });
 //意见反馈
 function Feedback(){
@@ -134,7 +134,7 @@ function Feedback(){
 		var obj = {reqType:"feedback"};
 		$.ajax({
 			type: "POST",
-			url: "/swordfish/ajaxReq",
+			url: "/member/swordfish/ajaxReq",
 			data:{reqType:"feedback",value:value,title:"剑鱼-意见反馈"},
 			dataType: "json",
 			success: function(r){

+ 2 - 2
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -88,9 +88,7 @@
 					</span>
 					<input id="location" type="hidden" value="{{if .T.res.Dom}}{{.T.res.Dom}}{{end}}">
 					<input id="cityname" type="hidden" value="">
-					{{if or .T.res.s_address}}
 					<a href="javascript:void(0)" onclick="showMap()">查看详细地图</a>
-					{{end}}
 				{{end}}
 			</div>
 		</div>
@@ -412,6 +410,8 @@ var as1="{{.T.res.s_address}}";
 var address=false,$listent=false;
 {{if or .T.res.i_province .T.res.i_city .T.res.i_area .T.res.s_address}}
 	address = true;
+{{else if .T.res.Dom}}
+	initMap();
 {{end}}
 </script>
 </html>

+ 1 - 2
credit/src/config.json

@@ -94,6 +94,5 @@
     "saveLogDuration": 1,
     "checkGiveDuration": 30,
     "swordfish_tipBeforeDays": "3,1",
-    "swordfish_subHour": 16,
-	"timerHM":"40,s,21"
+    "swordfish_subHour": 18
 }

+ 15 - 11
push/src/qfw/push/dopush/dopush.go

@@ -130,20 +130,24 @@ func Send(k *push.MemberInterest, v *list.List, now time.Time, TITLEA, ShortTitl
 	lastInfoDate := int64(0)
 	firstTitle := ""
 	publishTimes := map[string]interface{}{}
+	publishTitle := map[string]bool{}
 	for ks := v.Front(); ks != nil; ks = ks.Next() {
 		k2 := *(ks.Value.(*map[string]interface{}))
-		i++
-		if i == 1 {
-			firstTitle = strings.Replace(k2["title"].(string), "\n", "", -1)
-			lastInfoDate = k2["publishtime"].(int64)
-		}
-		str += "<div class='tslist'><span class='xh'>" + fmt.Sprintf("%d", i) + ".</span><a class='bt' target='_blank' href='" + k2["href"].(string) + "'>" + strings.Replace(k2["title"].(string), "\n", "", -1) + "</a></div>"
-		publishTimes[strconv.Itoa(i)] = k2["publishtime"]
-		if i >= MaxPushSize {
-			//限制最大信息条数
-			break
+		title := strings.Replace(k2["title"].(string), "\n", "", -1)
+		if !publishTitle[title] {
+			publishTitle[title] = true
+			i++
+			if i == 1 {
+				firstTitle = title
+				lastInfoDate = k2["publishtime"].(int64)
+			}
+			str += "<div class='tslist'><span class='xh'>" + fmt.Sprintf("%d", i) + ".</span><a class='bt' target='_blank' href='" + k2["href"].(string) + "'>" + title + "</a></div>"
+			publishTimes[strconv.Itoa(i)] = k2["publishtime"]
+			if i >= MaxPushSize {
+				//限制最大信息条数
+				break
+			}
 		}
-
 	}
 	TITLE := TITLEA + fmt.Sprintf("%d条,关键词(%s)", i, strings.Join(k.Interest, ";"))
 	WXTitle := fmt.Sprintf("%s《%s》%s", func() string {

+ 38 - 0
weixin/src/qfw/weixin/dao/userdao.go

@@ -11,6 +11,7 @@ import (
 	credit "qfw/util/credit"
 	"qfw/util/elastic"
 	. "qfw/util/mongodb"
+	"qfw/util/redis"
 	"strconv"
 	"strings"
 	"time"
@@ -203,3 +204,40 @@ func SaveIndentification(openid, picpath, entname, regno, identifyType string) (
 		return errors.New("save identification error")
 	}
 }
+
+//拓普公司员工微信绑定
+func SaveTopEmployeeBind(openid, name string) bool {
+	ret := FindOne("top_employee", M{"s_name": name})
+	if *ret == nil {
+		return false
+	}
+	Update("top_employee", `{"s_name": "`+name+`"}`, `{"$set":{"s_openid":`+openid+`}}`, false, false)
+	return true
+}
+
+//查询我的邀请人数,仅拓普员工自查,排除内部员工微信
+func GetMyInvitePersons(openid string) (total int) {
+	var tpems map[string]interface{}
+	//取拓普员工列表
+	if ems := redis.Get("other", "tp_employees"); ems != nil {
+		tpems, _ = ems.(map[string]interface{})
+	} else {
+		//取拓普员工列表,写入库
+		tpems = make(map[string]interface{})
+		ret := Find("top_employee", nil, nil, `{"s_openid":1}`, false, -1, -1)
+		for _, v := range *ret {
+			tmp := v["s_openid"].(string)
+			tpems[tmp] = 1
+		}
+		redis.Put("other", "tp_employees", tpems, 60*10) //缓存10分钟
+	}
+	//查我的邀请成功记录
+	ret := Find("person_invitelink", `{"s_source_openid":"`+openid+`"}`, nil, `{"s_target_openid":1}`, false, -1, -1)
+	for _, v := range *ret {
+		tmp := v["s_target_openid"].(string)
+		if _, ok := tpems[tmp]; !ok {
+			total++
+		}
+	}
+	return
+}

+ 15 - 0
weixin/src/qfw/weixin/msgtxtchandler.go

@@ -11,6 +11,7 @@ import (
 	"qfw/weixin/dao"
 	wf "qfw/weixinconfig"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -79,6 +80,20 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 			log.Println("choujiang url:", targeturl)
 			w.ReplyNews([]Article{Article{PicUrl: wf.SysConfig.Activity["picurl"], Title: wf.SysConfig.Activity["title"], Url: targeturl}})
 		}
+	} else if strings.HasPrefix(r.Content, "内部报名") { //绑定拓普员工姓名
+		tmp := strings.Split(r.Content, " | |+")
+		if len(tmp) != 2 {
+			w.ReplyText("请按以下格式输入:内部报名 姓名")
+		} else {
+			if !dao.SaveTopEmployeeBind(r.FromUserName, tmp[1]) {
+				w.ReplyText("查无此姓名的拓普员工。")
+			} else {
+				w.ReplyText(tmp[1] + " 绑定成功!")
+			}
+		}
+	} else if r.Content == "自查" { //查询我的邀请人数
+		total := dao.GetMyInvitePersons(r.FromUserName)
+		w.ReplyText(fmt.Sprintf("感谢您,已经成功邀请%d个用户", total))
 	} else {
 		//属于在线咨询,暂时直接中转到微信客服系统
 		//w.Reply2CustomerService()

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

@@ -11,3 +11,7 @@ func TestWeek(t *testing.T) {
 	d = d.AddDate(0, 0, 2)
 	log.Println(d.Hour(), d.Weekday(), int(d.Weekday()), d.Weekday() == 5)
 }
+
+func TestWord(t *testing.T) {
+	log.Println(len("内部报名"))
+}

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

@@ -49,7 +49,7 @@ func MsgVoiceHandler(w ResponseWriter, r *Request) {
 			w.ReplyNews(arts)
 		}
 	} else {
-		w.ReplyText("您说的是:" + tmp + ",小星无法识别。\n查询企业请说:\n搜索XX\n查XX\n检索XX")
+		w.ReplyText("您说的是:" + tmp + ",小星无法识别。\n查询企业请说:\n搜索XX\n查XX\n检索XX")
 		return
 	}
 }