Browse Source

修改credit

renzheng 9 years ago
parent
commit
112602c29a

+ 1 - 2
common/src/qfw/util/credit/credit.go

@@ -131,12 +131,10 @@ func AIsHasDo(code string, num int) bool {
 	var ret uint64
 	if tmp, ok := CreditA[code]; ok {
 		ret = 1 << (tmp - 1)
-		log.Println(tmp, ret)
 	}
 	if uint64(num)&ret > 0 {
 		b = true
 	}
-	log.Println(code, num, ret, b)
 	return b
 }
 
@@ -183,6 +181,7 @@ func OutCreditB(userId, code, umid string, score int, param map[string]interface
 
 //更新积分和session
 func UpuserCreditSession(userId, code, dtype string, param map[string]interface{}, xb *xweb.Action) bool {
+	log.Println("更新积分和session", userId, code, dtype, param)
 	b := false
 	score := 0
 	util.Try(func() {

+ 4 - 3
core/src/message.json

@@ -8,7 +8,8 @@
 	"indentify":{
 		"success":{
 			"result":"企业认证",
-			"detail":"您的企业已经成功通过实名认证!",
+			"detail":"您已经成功通过企业实名认证!您可以使用发布服务信息,查询企业信息,使用剑鱼招标订阅等多种功能!",
+			"wxdetail":"您已经通过了实名认证!",
 			"remark":"建议您在电脑端时用微信登录!"
 		},
 		"false":{
@@ -19,7 +20,7 @@
 	"pindentify":{
 		"success":{
 			"result":"个人认证",
-			"detail":"您已经成功通过实名认证,可以发布服务,等待接单",
+			"detail":"您已经成功通过个人实名认证!您可以使用发布服务信息,查询企业信息,使用剑鱼招标订阅等多种功能!",
 			"remark":"建议您在电脑端时用微信登录!"
 		},
 		"false":{
@@ -30,7 +31,7 @@
 	"oindentify":{
 		"success":{
 			"result":"机构认证",
-			"detail":"您的机构已经成功通过实名认证!",
+			"detail":"您已经成功通过机构实名认证!您可以使用发布服务信息,查询企业信息,使用剑鱼招标订阅等多种功能!",
 			"remark":"建议您在电脑端时用微信登录!"
 		},
 		"false":{

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

@@ -755,6 +755,7 @@ func (s *SystemManage) Updateaudit() error {
 						}
 						coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: s_result, Detail: util.GetPropertie("freeze.manager", coreconfig.MessageConfig).(string), Remark: s_remark})
 					} else { //认证通知
+						s_detail = util.GetPropertie("ptcindentify.success.wxdetail", coreconfig.MessageConfig).(string)
 						coreutil.SendIdentifyTplMsg(&qrpc.NotifyMsg{Openid: openid, Remark: s_remark, Detail: s_detail, Result: s_result})
 					}
 				}()

+ 10 - 0
core/src/qfw/member/bidmanage.go

@@ -207,12 +207,22 @@ func (d *BidManage) ChangeStatus() error {
 				param := make(map[string]interface{})
 				param["objid"] = wtb["s_userid"].(string)
 				credit_a := util.IntAll(d.GetSession("credit_a"))
+				//log.Println("选标", credit.AIsHasDo(credit.A_WCJY, credit_a), userId, param["objid"])
 				if credit.AIsHasDo(credit.A_WCJY, credit_a) {
 					credit.UpuserCreditSession(userId, credit.C_JY, "B", param, d.Action)
 				} else {
 					credit.UpuserCreditSession(userId, credit.A_WCJY, "A", nil, d.Action)
 					credit.UpuserCreditSession(userId, credit.C_JY, "B", param, d.Action)
 				}
+				//判断对方是否完成一次性任务
+				rr := *FindById("user", param["objid"].(string), nil)
+				if !credit.AIsHasDo(credit.A_WCJY, util.IntAll(rr["credit_a"])) {
+					b, credit_a, score, _ := credit.InCreditA(param["objid"].(string), credit.A_WCJY, util.IntAll(rr["credit_a"]))
+					if b {
+						d.Session().UpdateByCustomField("id", param["objid"].(string), "credit_a", credit_a)
+						d.Session().UpdateByCustomField("id", param["objid"].(string), "i_credit", util.IntAll(rr["i_credit"])+score)
+					}
+				}
 			}
 		}
 	}

+ 1 - 3
core/src/qfw/member/credit/creditdetail.go

@@ -7,7 +7,6 @@ import (
 	"github.com/dchest/captcha"
 	"github.com/go-xweb/xweb"
 	. "gopkg.in/mgo.v2/bson"
-	"log"
 	cu "qfw/coreutil"
 	"qfw/util"
 	cd "qfw/util/credit"
@@ -36,7 +35,6 @@ func (c *credit) MyCredit() error {
 		c.T["user"] = user
 		credit_a := util.IntAll(user["credit_a"])
 		b := cd.AAllIsHasDo(credit_a)
-		log.Println(b, credit_a)
 		u := c.Header("User-Agent")
 		if strings.Index(u, "Mobile") > -1 {
 			return c.Render("/member/credit/mcreditindex.html", &c.T)
@@ -173,7 +171,7 @@ func (c *credit) CreditList() error {
 		if currentPage == 1 {
 			count = mongodb.Count("creditlog", query)
 		}
-		r = *mongodb.Find("creditlog", query, `{"l_date":-1}`, nil, false, start, limit)
+		r = *mongodb.Find("creditlog", query, `{"l_datenm":-1}`, nil, false, start, limit)
 		for i := 0; i < len(r); i++ {
 			r[i]["index"] = (i + 1) + (currentPage-1)*limit
 			d := r[i]["l_date"]

+ 10 - 0
core/src/qfw/member/ordermanage.go

@@ -78,12 +78,22 @@ func (o *OrderManage) ChangeStatus() error {
 			param["objid"] = (*r)["s_editorid"]
 			credit_a := util.IntAll(o.GetSession("credit_a"))
 			userId := util.ObjToString(o.GetSession("userId"))
+			//log.Println("预约", credit.AIsHasDo(credit.A_WCJY, credit_a), userId, param["objid"])
 			if credit.AIsHasDo(credit.A_WCJY, credit_a) {
 				credit.UpuserCreditSession(userId, credit.C_JY, "B", param, o.Action)
 			} else {
 				credit.UpuserCreditSession(userId, credit.A_WCJY, "A", nil, o.Action)
 				credit.UpuserCreditSession(userId, credit.C_JY, "B", param, o.Action)
 			}
+			//判断对方是否完成一次性任务
+			rr := *FindById("user", param["objid"].(string), nil)
+			if !credit.AIsHasDo(credit.A_WCJY, util.IntAll(rr["credit_a"])) {
+				b, credit_a, score, _ := credit.InCreditA(param["objid"].(string), credit.A_WCJY, util.IntAll(rr["credit_a"]))
+				if b {
+					o.Session().UpdateByCustomField("id", param["objid"].(string), "credit_a", credit_a)
+					o.Session().UpdateByCustomField("id", param["objid"].(string), "i_credit", util.IntAll(rr["i_credit"])+score)
+				}
+			}
 		}
 
 	}

+ 1 - 13
core/src/qfw/search/searchService.go

@@ -100,7 +100,7 @@ func (search *Search) FindServiceByEntId() error {
 		    }
 		  }}`
 		//需要查到的字段信息
-		fields = `"_id","s_name","s_introduction","s_images","s_enterpriseid","s_isshow","i_status","s_pricemy","i_comments","f_price"`
+		fields = `"_id","s_name","s_introduction","s_images","s_enterpriseid","s_isshow","i_status","s_pricemy","i_comments","f_price","i_sales"`
 		if currentPage == 1 {
 			count = elastic.Count("service", collection, query)
 		}
@@ -187,18 +187,6 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
 //即时搜索
 func (n *Search) Sim() error {
 	keyword := n.GetString("words")
-	//查询送积分
-	userId := ObjToString(n.GetSession("userId"))
-	if len(userId) > 0 && len(keyword) > 0 {
-		credit_a := IntAll(n.GetSession("credit_a"))
-		if credit.AIsHasDo(credit.A_QYCX, credit_a) {
-			credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
-		} else {
-			credit.UpuserCreditSession(userId, credit.A_QYCX, "A", nil, n.Action)
-			credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
-		}
-	}
-
 	str := `{
 	          "match": {
 	            "enterprise.EntName": {

+ 8 - 2
core/src/qfw/swordfish/swordfishmanage.go

@@ -19,14 +19,15 @@ func (s *SwordFish) Swordfish() error {
 			s.T["data"] = r
 		}
 		content, _ := s.Render4Cache("/swordfish/index.html", &s.T)
-		redis.Put("other", "swordfish", string(content), 30*60*1000) //缓存半个小时
+		redis.Put("other", "swordfish", string(content), 1000) //缓存半个小时
 		return s.SetBody(content)
 	}
 }
 
 //跳转到订阅设置页面
 func (s *SwordFish) RssSet() error {
-	u := mongodb.FindById("user", s.GetSession("userId").(string), `{"o_msgset":1}`)
+	userId := s.GetSession("userId").(string)
+	u := mongodb.FindById("user", userId, `{"o_msgset":1}`)
 	msgset := (*u)["o_msgset"]
 	if msgset != nil {
 		if set, _ := msgset.(map[string]interface{}); set != nil {
@@ -48,7 +49,12 @@ func (s *SwordFish) RssSet() error {
 			}
 		}
 	}
+	_, list := getSwordFish(time.Now().Unix(), userId, nil, 10)
+	if len(*list) < 1 {
+		list = mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
+	}
 	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 13:30:43"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 13:30:43"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 13:30:43"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 13:30:43"}},"marketisstart":true,"marketrate":300}

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

@@ -301,6 +301,9 @@ a{
 .padding-t-10 {
 	padding-top: 10px !important;
 }
+.padding-r-10 {
+	padding-right: 10px !important;
+}
 .padding-15 {
 	padding: 15px !important;
 }

+ 3 - 4
core/src/web/staticres/css/entcommunity.css

@@ -112,12 +112,9 @@ a:focus, a:hover{
 .entinfo-page .b-com-head .b-com-first{
 	line-height: 25px;
 }
-.entinfo-page .b-com-head .b-com-first>.b-microwebsite,.entinfo-page .b-com-head .b-com-first a{
+.entinfo-page .b-com-head .b-com-first a{
 	color: #16a086;
 }
-.entinfo-page .b-com-head .b-com-first>.b-microwebsite{
-	margin-left: 10px;
-}
 .entinfo-page .b-com-head .b-com-title{
 	font-size: 18px;
 	font-weight: bold;
@@ -654,6 +651,7 @@ a:focus, a:hover{
 .ent-table td{
 	padding: 15px 0px !important;
 	border-top: none !important;
+	white-space:nowrap;
 }
 .ent-table tr:first-child{
 	border-top: none !important;
@@ -666,4 +664,5 @@ a:focus, a:hover{
 	font-weight: bold;
 	word-wrap: break-word;
 	word-break: normal;
+	white-space: normal;
 }

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

@@ -62,6 +62,32 @@ a:focus, a:hover{
 	color: #37C6DA;
 	font-weight: normal;
 }
+.b-right>div{
+	padding-left: 10px;
+}
+.swordfish-right-title{
+	background-color: #F7F8FA;
+	font-size: 18px;
+	font-weight: bold;
+	padding: 10px;
+}
+ .tslist{
+	padding: 10px;
+	border-left: 1px solid #F7F8FA;
+}
+ .tslist a{
+	margin-left: 5px;
+	display: block;
+}
+.tslist .time{
+	margin-bottom: 5px;
+	color: #A0A0A0;
+}
+.tslist .time>img{
+	width: 10px;
+	height: 10px;
+	margin: 0px 10px 5px -15px;
+}
 /*剑鱼设置页面*/
 .swordfish-rssset .btn{
 	background-color: #37C6DA;
@@ -235,32 +261,6 @@ a:focus, a:hover{
 	margin-bottom: 20px;
 }
 /*******剑鱼首页*******/
-.swordfish-index .b-right>div{
-	padding-left: 10px;
-}
-.swordfish-index .swordfish-right-title{
-	background-color: #F7F8FA;
-	font-size: 18px;
-	font-weight: bold;
-	padding: 10px;
-}
-.swordfish-index .tslist{
-	padding: 10px;
-	border-left: 1px solid #F7F8FA;
-}
-.swordfish-index .tslist a{
-	margin-left: 5px;
-	display: block;
-}
-.swordfish-index .tslist .time{
-	margin-bottom: 5px;
-	color: #A0A0A0;
-}
-.swordfish-index .tslist .time>img{
-	width: 10px;
-	height: 10px;
-	margin: 0px 10px 5px -15px;
-}
 .swordfish-guide>div{
 	display: inline-block;
 	height: inherit;

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

@@ -106,14 +106,39 @@ function ServiceList(){
 			}
 			var html = '';
 			for(var i=0;i<r.length;i++){
+				var f_price = r[i].f_price;
+				if(typeof(f_price) == "undefined" || f_price == null || f_price == ""){
+					f_price = 0;
+				}
+				var i_sales = r[i].i_sales;
+				if(typeof(i_sales) == "undefined" || i_sales == null || i_sales == ""){
+					i_sales = 0;
+				}
+				var i_comments = r[i].i_comments;
+				if(typeof(i_comments) == "undefined" || i_comments == null || i_comments == ""){
+					i_comments = 0;
+				}
+				var flag = typeof(r[i].s_isshow) != "undefined" && r[i].s_isshow != null && r[i].s_isshow.indexOf("3")>-1;
 				html += '<tr>'
 						+'<td rowspan="2" width="120"><img src="'+(r[i].s_images==""?"null":r[i].s_images)+'" onerror="this.src=\'/images/services/default.png\'"></td>'
-						+'<td class="b-com-name"><a href="/market/detail/'+r[i]._id+'.html">'+r[i].s_name+'</a></td>'
-						+'<td width="100" class="text-center">报价:<font class="text-primary">'+(r[i].s_pricemy==0?"面议":r[i].f_price+"元")+'</font></td>'
-						+'<td width="100" class="text-center">评价:<font class="text-primary">'+r[i].i_comments+'</font></td>'
-						+'</tr><tr>'
-						+'<td>'+r[i].s_introduction+'</td>'
-						+'</tr>';
+						+'<td class="b-com-name">';
+				if(flag){
+					html += '<a href="/market/detail/'+r[i]._id+'.html">';
+				}
+				html += r[i].s_name;
+				if(flag){
+					html += '</a>';
+				}
+				html += '</td>';
+				if(flag){
+					html += '<td width="150" class="text-center"><font class="b-disabled">报价:</font><font class="text-primary">'+(r[i].s_pricemy==1?"面议":f_price+"元")+'</font></td>'
+						+'<td width="250" class="text-center"><font class="b-disabled">成交:</font><font class="text-primary">'+i_sales+'</font><font class="margin-lr-5 b-disabled">|</font><font class="b-disabled">评价:</font><font class="text-primary">'+i_comments+'</font></td>';
+				}else{
+					html += '<td>&nbsp;</td><td>&nbsp;</td>';
+				}
+				html += '</tr><tr>'
+					+'<td>'+r[i].s_introduction+'</td>'
+					+'</tr>';
 			}
 			$("#serviceListPaging").parent().prevAll().remove();
 			$("#serviceListPaging").parent().before(html);

+ 2 - 6
core/src/web/templates/common/memberleft.html

@@ -99,7 +99,7 @@
 	</a>
 	<a class="list-group-item" style="padding:10px 2px">
 	<div style="width:198px;height:40px;text-align:center;">
-		<div style="float:left;width:90px;border-right:1px">
+		<div onclick="creditModel(1)" style="float:left;width:90px;border-right:1px">
 			<div>积分</div>
 			<div><i class="glyphicon jinbi" style="width:25px;color:red;font-size:18px"></i><span style="font-weight:normal;">{{session "i_credit"}}</span></div>
 		</div>
@@ -258,7 +258,7 @@ var MemberLeftMenu = {
 	},
 	//积分规则
 	creditRule: function(){
-		return '<a onclick="creditModel(2)" class="menu-childnode2 list-group-item"><i class="glyphicon"></i>积分规则</a>';
+		return '<a href="/member/credit/creditRule" class="menu-childnode2 list-group-item"><i class="glyphicon"></i>积分规则</a>';
 	}
  };
 $(function (){
@@ -292,16 +292,12 @@ function creditModel(type){
 	if (num>2){
 		if(type=="1"){
 			window.location.href="/member/credit/myCredit";
-		}else{
-			window.location.href="/member/credit/creditRule";
 		}
 	}else{
 		$("#vipcreditModal").modal("show");
 		$('#vipcreditModal').on('hidden.bs.modal', function () {
 			if(type=="1"){
 				window.location.href="/member/credit/myCredit";
-			}else{
-				window.location.href="/member/credit/creditRule";
 			}
 		})	
 	}

+ 1 - 1
core/src/web/templates/index.html

@@ -115,7 +115,7 @@
 	</div>
 	
 	<div class="a-panel a-rmxq">
-		<div class="a-com-title index-new-rmxq-title" style="margin-bottom:0px;border-top:0px;"><font><a id="indexHotDemand">热门需求</a></font><span class="hidden-xs">成为服务商,马上参与投标</span><span style="float:right;margin-top:10px;"><a href="/market/demand/add.html" class="index-new-fbfw-a">发布需求</a>|<a  href="/market/0/list.html" class="index-new-fbfw-a">更多>></a></span></div>
+		<div class="a-com-title index-new-rmxq-title" style="margin-bottom:0px;border-top:0px;"><font><a id="indexHotDemand">热门需求</a></font><span class="hidden-xs">成为服务商,马上参与投标</span><span style="float:right;margin-top:10px;"><a href="/market/demand/add.html" class="index-new-fbfw-a">发布需求</a>|<a  href="/market/0/list_eyJjX2ZidGltZSI6IiIsImNfZnd0eXBlIjoiMCIsImNfcnp0eXBlIjoiIiwiY19zZWFyY2h0eXBlIjoiZGVtYW5kIiwiY19zb3J0dHlwZSI6IiIsImNfeHF0eXBlIjoiIiwiY2l0eSI6IiIsImNpdHlObyI6IiIsImN1cnJlbnRQYWdlIjoiMSIsInBlclBhZ2UiOiIiLCJxdWVyeSI6IiJ9.html" class="index-new-fbfw-a">更多>></a></span></div>
 		<div class="row index-new-rmxq-list" id="hotDemand">
 			{{$s:=(Ad "index-center-05" 4)}}
 			{{range $k,$v := $s}}

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

@@ -240,7 +240,7 @@
 								{{end}}
 							</tr>
 							<tr class="rowtwo">
-								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积</td>
+								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积</td>
 								{{if .T.B_QYCX.A }}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">{{.T.B_QYCX.B}}/{{.T.B_QYCX.C}}</span></td>
 								<td width="30%" style="padding:110px"></td>

+ 42 - 23
core/src/web/templates/swordfish/rssset.html

@@ -1,6 +1,8 @@
 <html>
 <head>
 <title>订阅设置</title>
+<meta name="Keywords" content="{{Msg "seo" "qfw.swordfish.key"}}"/>
+<meta name="Description" content="{{Msg "seo" "qfw.swordfish.description"}}"/>
 {{include "/common/inc.html"}}
 </head>
 <body>
@@ -100,9 +102,12 @@
 			<div class="swordfish-panel-c">开发中,敬请期待!</div>
 		</div>
 	</div>
-	<div class="b-right swordfish-qrcode text-center">
-		<img src="/images/swordfish/qrcode.png">
-		<br>关注微信公众号:企明星
+	 
+	<div class="b-right">
+		<div class="swordfish-right-title">
+			剑鱼最新消息
+		</div>
+		<div id="list"></div>
 	</div>
 </div>
 
@@ -117,16 +122,6 @@
 					<li>
 						<button class="btn">全国</button>
 					</li>
-					<li>
-						<div>华东地区</div>
-						<button class="btn">上海</button>
-						<button class="btn">江苏</button>
-						<button class="btn">浙江</button>
-						<button class="btn">安徽</button>
-						<button class="btn">江西</button>
-						<button class="btn">山东</button>
-						<button class="btn">福建</button>
-					</li>
 					<li>
 						<div>华北地区</div>
 						<button class="btn">北京</button>
@@ -136,10 +131,20 @@
 						<button class="btn">内蒙古</button>
 					</li>
 					<li>
-						<div>华中地区</div>
-						<button class="btn">河南</button>
-						<button class="btn">湖北</button>
-						<button class="btn">湖南</button>
+						<div>东北地区</div>
+						<button class="btn">黑龙江</button>
+						<button class="btn">吉林</button>
+						<button class="btn">辽宁</button>
+					</li>
+					<li>
+						<div>华东地区</div>
+						<button class="btn">上海</button>
+						<button class="btn">江苏</button>
+						<button class="btn">浙江</button>
+						<button class="btn">安徽</button>
+						<button class="btn">江西</button>
+						<button class="btn">山东</button>
+						<button class="btn">福建</button>
 					</li>
 					<li>
 						<div>华南地区</div>
@@ -150,6 +155,12 @@
 						<button class="btn">澳门</button>
 						<button class="btn">台湾</button>
 					</li>
+					<li>
+						<div>华中地区</div>
+						<button class="btn">河南</button>
+						<button class="btn">湖北</button>
+						<button class="btn">湖南</button>
+					</li>
 					<li>
 						<div>西南地区</div>
 						<button class="btn">重庆</button>
@@ -166,12 +177,6 @@
 						<button class="btn">宁夏</button>
 						<button class="btn">新疆</button>
 					</li>
-					<li>
-						<div>东北地区</div>
-						<button class="btn">黑龙江</button>
-						<button class="btn">吉林</button>
-						<button class="btn">辽宁</button>
-					</li>
 				</ul>
 				<div class="clearfix"></div>
 	      	</div>
@@ -636,6 +641,20 @@ function swordfishpay(oprtype){
 $('#tishiModal').on('hidden.bs.modal', function () {
   swordfishpay(1);
 })
+
+$(function(){
+	var data = {{.T.list}};
+	if(data && data != "" && data.length > 0){
+		var html = '';
+		for(var i=0;i<data.length;i++){
+			html += '<div class="tslist"><div class="time"><img src="/images/swordfish/circle.png">'
+					+new Date(Number(data[i].publishtime+"000")).Format("yyyy-MM-dd hh:mm:ss")
+					+'</div><a class="bt" onclick="open_window(\''+data[i].href+'\')">'
+					+data[i].title+'</a></div>';
+		}
+		$("#list").html(html);
+	}
+});
 </script>
 </body>
 </html>

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

@@ -28,7 +28,6 @@
 				</script>
 				</span>
 				{{end}}
-				{{if .T.res.s_microwebsite}}<span class="b-microwebsite"><i class="glyphicon weiguanwang"></i><a href="/ent/wsite/preview/{{.T.res.entid}}">微官网</a></span>{{end}}
 			</div>
 			<div class="b-com-second">
 				{{if .T.res.EntName }}
@@ -231,7 +230,7 @@
 							<img src="/images/entcommunity/shijian.png">
 							<div>
 								<span{{if and (not .T.res.OpFrom) (not .T.res.OpTo)}} class="entinfo-disabled"{{end}}>营业期限</span>
-								<span>{{if .T.res.OpFrom}}{{.T.res.OpFrom}}{{end}}{{if .T.res.OpTo}}至{{.T.res.OpTo}}{{end}}</span>
+								<span>{{if .T.res.OpFrom}}{{.T.res.OpFrom}}{{end}}{{if .T.res.OpTo}}至{{.T.res.OpTo}}{{else}}至长期{{end}}</span>
 							</div>
 						</div>
 						<a class="entinfo-operperiod-round"></a>

+ 7 - 7
credit/src/config.json

@@ -9,7 +9,7 @@
     "rpcPort": "8765",
     "weixinrpc": "127.0.0.1:82",
     "num": {
-        "a1": 50,
+        "a1": 2000,
         "a2": 100,
         "a3": 50,
         "a4": 50,
@@ -60,13 +60,13 @@
         "txt_a6": "收藏名片",
         "txt_a7": "收藏服务",
         "txt_a8": "使用剑鱼",
-        "txt_a9": "使用企业查询",
-        "txt_a10": "发服务",
-        "txt_a11": "发需求",
+        "txt_a9": "首次使用企业查询",
+        "txt_a10": "首次发服务",
+        "txt_a11": "首次发需求",
         "txt_a12": "查看关系网",
-        "txt_a13": "分享服务",
-        "txt_a14": "完成交易",
-        "txt_a15": "完成交易评价",
+        "txt_a13": "首次分享服务",
+        "txt_a14": "完成首次交易",
+        "txt_a15": "完成首次交易评价",
 		"txt_a61": "剑鱼首次推送",
         "txt_a62": "完成一次性所有任务",
         "txt_b1": "签到",

+ 3 - 0
credit/src/qfw/creditrpc/creditrpc.go

@@ -75,6 +75,7 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 			"s_operation": Message["txt_"+param.Code],
 			"i_type":      1,
 			"l_date":      time.Now().Unix(),
+			"l_datenm":    time.Now().UnixNano() / 1000000,
 		}
 		i_scorenow := getCreditById(param.Uid)
 		switch first {
@@ -186,6 +187,7 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 							"i_type":      1,
 							"s_sourceid":  param.Uid,
 							"l_date":      time.Now().Unix(),
+							"l_datenm":    time.Now().UnixNano() / 1000000,
 							"i_score":     Score[param.Code],
 							"i_scorenow":  i_scorenow + Score[param.Code],
 						}
@@ -262,6 +264,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 			"s_operation": Message["txt_"+param.Code],
 			"i_type":      0,
 			"l_date":      now.Unix(),
+			"l_datenm":    time.Now().UnixNano() / 1000000,
 		}
 		if param.OtherParam != nil && param.OtherParam["i_way"] != nil {
 			creditDoc["i_way"] = param.OtherParam["i_way"]

+ 3 - 5
credit/src/qfw/creditrpc/creditrpc_test.go

@@ -9,14 +9,12 @@ import (
 func Test(t *testing.T) {
 	tmp := uint64(1)
 	var ret uint64
-	for k := 2; k < 62; k++ {
-		if k == 9 {
-			continue
-		}
+	for k := 2; k < 13; k++ {
+
 		ret = 1 << (uint64(k) - 1)
 		tmp += ret
 		log.Println(k, int(tmp), int(ret))
 	}
 	log.Println(tmp)
-	log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
+	//log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
 }

+ 1 - 1
weixin/src/config.json

@@ -33,5 +33,5 @@
                 "title":"企明星新年抽奖活动进行中",
                 "picurl":"http://www.qimingxing.info/images/choujiang.png"
         },"weixinautorpl":"小主的吩咐我们已经收到了,请留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!",
-		"creditRpc":"http://127.0.0.1:8765"
+		"creditRpc":"127.0.0.1:8765"
 }

+ 2 - 0
weixin/src/main.go

@@ -1,6 +1,7 @@
 package main
 
 import (
+	//"endless"
 	"log"
 	"net/http"
 	"qfw/util"
@@ -37,4 +38,5 @@ func main() {
 	rpc.StartWeixinRpc(weixin.Mux)
 	//启动web服务
 	http.ListenAndServe(":"+wf.SysConfig.Port, nil) // 启动接收微信数据服务器
+	//endless.ListenAndServe(":"+wf.SysConfig.Port, nil)
 }

+ 11 - 0
weixin/src/qfw/weixin/dao/coupon.go

@@ -0,0 +1,11 @@
+package dao
+
+import (
+	"qfw/util/redis"
+)
+
+//抽奖
+//读取我的今日抽奖次数(Redis中该变量的有效期,一定控制在当天)
+func GetMyTodayDrawTimes(openid string) int {
+	return redis.GetInt("other", "coupon_"+openid)
+}

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

@@ -6,19 +6,20 @@ import (
 	. "gopkg.in/mgo.v2/bson"
 	"qfw/util/credit"
 	. "qfw/util/mongodb"
+	"sync"
 	"time"
 )
 
-//
-var sharelock chan bool = make(chan bool, 10)
+//
+var sharelock *sync.Mutex
 
 //保存用户邀请关系,走线程池
 func SaveInviteLink(shareid string, myopenid string) {
 	//先找邀请人信息
-	sharelock <- true
+	sharelock.Lock()
 	ret := FindOne("person_share", M{"i_shareid": shareid})
 	if *ret == nil {
-		<-sharelock
+		sharelock.Unlock()
 		return
 	}
 	source_opendid := (*ret)["s_openid"]
@@ -33,11 +34,47 @@ func SaveInviteLink(shareid string, myopenid string) {
 	//取用户ID
 	ret = FindOne("user", M{"s_m_openid": source_opendid})
 	if *ret == nil {
-		<-sharelock
+		sharelock.Unlock()
 		return
 	}
 	smid := fmt.Sprintf("%x", string(((*ret)["_id"]).(ObjectId)))
 	//积分处理,RPC
 	credit.InCreditB(smid, credit.C_TG, nil)
-	<-sharelock
+	sharelock.Unlock()
+}
+
+//保存新用户赠送的卡劵,只记录当前量,不记历史
+func SaveMyNewUserCoupon(openid string) {
+	myCoupon := map[string]interface{}{
+		"s_openid": openid,
+		"s_type":   "cj", //抽奖卡
+		"i_amount": 1,    //总量
+	}
+	Save("mycoupon", myCoupon)
+}
+
+//赠送邀请人卡劵,仅修改其拥有量,不做记录
+func UpdateInviteUserCoupon(shareid string) {
+	sharelock.Lock()
+	//找邀请人
+	ret := FindOne("person_share", M{"i_shareid": shareid})
+	if *ret == nil {
+		sharelock.Unlock()
+		return
+	}
+	openid := (*ret)["s_openid"].(string)
+	//邀请,有一人成功注册,邀请人获得一张抽奖卷
+	Update("mycoupon", M{"s_openid": openid, "s_type": "cj"}, `{"$inc":{"i_amount":1}}`, true, false)
+	sharelock.Unlock()
+}
+
+//查看我的抽奖卷数量
+func GetMyCouponAmount(openid string) int64 {
+	ret := FindOne("mycoupon", M{"s_openid": openid, "s_type": "cj"})
+	if *ret == nil {
+		return 0
+	} else {
+		tmp := (*ret)["i_amount"].(int64)
+		return tmp
+	}
 }

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

@@ -41,7 +41,15 @@ func AddUser(openid, unionid, bindweixin, userphoto string) (err error, flag int
 		data["i_identificationway"] = 0
 		data["s_m_openid"] = openid //微信手机端openid
 		if id := Save("user", data); len(id) > 0 {
-			go credit.InCreditA(id, credit.A_ZC, 0)
+			//赠送个人,新用户注册积分
+			go util.Try(func() {
+				credit.InCreditA(id, credit.A_ZC, 0)
+			}, func(e interface{}) {
+				log.Println(e)
+			})
+			//赠送个人用户游戏卡1张,可以用来抽奖
+			//go SaveMyNewUserCoupon(openid)
+			//卡劵赠送完成,暂不存来源记录
 			return nil, 1
 		} else {
 			return errors.New("保存用户失败"), 0

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

@@ -63,9 +63,26 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 		w.ReplyText("嗨,小星来陪你解闷。有什么开心的,不开心的说说来,大伙乐呵乐呵。\n输入q或Q离开。")
 		return
 	} else if r.Content == "抽奖" { //进入抽奖环节
+		/*
+			//TODO 改为查我的抽奖卷
+			if dao.GetMyCouponAmount(r.FromUserName) <= 0 {
+				w.ReplyText("对不起,你的奖劵不足。您可以查看<a href='http://www.qimingxing.info/p/'>企明星的最新活动</a>赚取积分。")
+			} else if dao.GetMyTodayDrawTimes() > 0 { //检查今日抽奖次数
+				w.ReplyText("对不起,你今天的抽奖次数已经用完,请您明天再来。")
+			}
+		*/
 		//查改用户是否已经抽过奖
 		if dao.FindWinningRecord(r.FromUserName, wf.SysConfig.Activity["activitycode"]) {
 			w.ReplyText("小主莫贪心,每人只有一次抽奖机会呦")
+<<<<<<< HEAD
+=======
+		}*/
+		//TODO 改为查我的抽奖卷
+		if dao.GetMyCouponAmount(r.FromUserName) <= 0 {
+			w.ReplyText("对不起,你的奖劵不足。您可以查看<a href='http://www.qimingxing.info/p/'>企明星的最新活动</a>赚取积分。")
+		} else if dao.GetMyTodayDrawTimes(openid) > 0 { //检查今日抽奖次数
+			w.ReplyText("对不起,你今天的抽奖次数已经用完,请您明天再来。")
+>>>>>>> 456c5e620092155af63ebe9691a745396ed266d2
 		} else {
 			targeturl := fmt.Sprintf("http://%s/activity/%s/%s", wf.SysConfig.Domain, wf.SysConfig.Activity["activitycode"], se.EncodeString(r.FromUserName))
 			log.Println("choujiang url:", targeturl)

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

@@ -57,8 +57,8 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 			redis.Put("sso", "new_"+source, openid, 900)
 			//TODO 处理分享(邀请)类的二维码,记录邀请关系
 			if strings.HasPrefix(source, "32") {
-				//shareid, _ := strconv.Atoi(source)
 				go dao.SaveInviteLink(source, r.FromUserName)
+				//go dao.UpdateInviteUserCoupon(source)
 			}
 		} else {
 			w.ReplyText(OWELCOME_MSG) // 有旧人关注,返回欢迎消息