Przeglądaj źródła

绑定邮箱样式修改

wangshan 9 lat temu
rodzic
commit
bd22a9aa4e

+ 11 - 14
common/src/qfw/util/common.go

@@ -5,7 +5,9 @@ import (
 	cryptoRand "crypto/rand"
 	"encoding/hex"
 	"encoding/json"
+	"fmt"
 	"github.com/dchest/captcha"
+	"gopkg.in/mgo.v2/bson"
 	"io"
 	"log"
 	mathRand "math/rand"
@@ -37,20 +39,6 @@ func Sumstring(code string) (sum int) {
 	return
 }
 
-//捕获异常
-var Catch = func() {
-	if r := recover(); r != nil {
-		log.Println("[E]", r)
-		for skip := 1; ; skip++ {
-			_, file, line, ok := runtime.Caller(skip)
-			if !ok {
-				break
-			}
-			go log.Printf("====----", "%v,%v\n", file, line)
-		}
-	}
-}
-
 //获取随机数
 func GetRandom(n int) string {
 	var idChars = []byte("0123456789")
@@ -370,3 +358,12 @@ func InterfaceArrToint64Arr(arr []interface{}) []int64 {
 	}
 	return tmp
 }
+
+//根据bsonID转string
+func BsonIdToSId(uid interface{}) string {
+	if u, ok := uid.(string); ok {
+		return u
+	} else {
+		return fmt.Sprintf("%x", string(uid.(bson.ObjectId)))
+	}
+}

+ 6 - 4
common/src/qfw/util/credit/credit.go

@@ -30,8 +30,8 @@ const (
 	A_FXFWXQ = "a13" //分享服务
 	A_WCJY   = "a14" //完成交易
 	A_WCJYPJ = "a15" //完成交易评价
-	A_JYSCTS = "a63" //剑鱼首次推送
-	A_ALL    = "a64" //一次性积分任务完成
+	A_JYSCTS = "a61" //剑鱼首次推送
+	A_ALL    = "a62" //一次性积分任务完成
 
 	B_QD       = "b1" //签到
 	B_QD_T     = 7    //最高连续签到次数
@@ -59,7 +59,7 @@ func init() {
 	util.ReadConfig(&SysConfig)
 	CreditA = make(map[string]uint64)
 	//初始化一次性任务
-	for i := 1; i <= 64; i++ {
+	for i := 1; i <= 62; i++ {
 		CreditA["a"+fmt.Sprint(i)] = uint64(i)
 	}
 	Rc = rpc.RpcCall{Addr: SysConfig["creditRpc"].(string)}
@@ -121,7 +121,7 @@ func UpuserCreditA(code, userId string, credit_a int) (bool, int) {
 		ret = 1 << (tmp - 1)
 	}
 	n_credit_a := uint64(credit_a) + ret
-	b := mogo.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"credit_a":`+fmt.Sprint(int(n_credit_a))+`}}`, true, false)
+	b := mogo.Update("user", `{"_id":"`+userId+`"}`, &map[string]interface{}{"$set": &map[string]interface{}{"credit_a": int64(n_credit_a)}}, true, false)
 	return b, int(n_credit_a)
 }
 
@@ -131,10 +131,12 @@ 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
 }
 

+ 4 - 3
common/src/qfw/util/elastic/elasticutil_test.go

@@ -7,7 +7,6 @@ import (
 	"log"
 	"qfw/util/mongodb"
 	"testing"
-	"time"
 )
 
 func Test_Find1(t *testing.T) {
@@ -180,8 +179,10 @@ func Test_first(t *testing.T) {
 
 func Test_date(t *testing.T) {
 	//"1448267541"
-	s := time.Now().UnixNano()
-	log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
+	//s := time.Now().UnixNano()
+	//log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
+	var n uint64 = 1
+	log.Println(n<<62, int(n<<62))
 }
 
 func Test_Getpage(t *testing.T) {

+ 14 - 4
common/src/qfw/util/image/imageutil.go

@@ -6,7 +6,7 @@ import (
 	"image/png"
 	"log"
 	"os"
-	"qfw/util"
+	"runtime"
 	"strings"
 )
 
@@ -21,6 +21,18 @@ func LoadImg(filepath string) (img image.Image, err error) {
 }
 
 func MakeResize(path string, newX, newY, quality int, t int) (newName string, err error) {
+	defer func() {
+		if r := recover(); r != nil {
+			log.Println("[E]", r)
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	img, err := LoadImg(path)
 	if nil == err {
 		path := strings.Replace(strings.Replace(path, "\\\\", "\\", -1), "\\", "/", -1)
@@ -91,11 +103,9 @@ func MakeResize(path string, newX, newY, quality int, t int) (newName string, er
 			log.Println("生成缩略图出错", err)
 		}
 		return strings.Replace(s, "/", "", -1) + oname, err1
-	} else {
-		util.Catch()
 	}
-	return "", err
 
+	return "", err
 }
 
 //是否达到压缩条件

+ 12 - 22
common/src/qfw/util/mongodb/mongodbutil_test.go

@@ -17,16 +17,16 @@ func Test_orAnd(t *testing.T) {
 	}
 }
 func Test_FindByQuery(t *testing.T) {
-	InitMongodbPool(1, "192.168.56.101", "test")
+	InitMongodbPool(1, "192.168.3.18:27080", "spider")
 	//查找单个
 	//var ss = FindOne("test1", "{'_id':'553306bce30454598ff1bc14'}")
-	log.Println(FindOne("test1", M{"name": "32432423zzzz"}))
-	log.Println("count", Count("test1", M{"name": "zzzz"}))
+	//log.Println(FindOne("test1", M{"name": "32432423zzzz"}))
+	//log.Println("count", Count("test1", M{"name": "zzzz"}))
 	//obj := map[string]interface{}{"name": "ggg555g32423zzzz"}
 	//log.Println(Save("test1", &obj))
-	log.Println((*(FindById("test1", "55330b77e30454598ff1bd6d", "{'_id':0}"))))
+	//log.Println((*(FindById("test1", "55330b77e30454598ff1bd6d", "{'_id':0}"))))
 	//查询多个
-	log.Println(Find("test1", "{'_id':'55330b77e30454598ff1bd6d'}", nil, "{'_id':0,'name':'1'}", true, -1, -1))
+	//log.Println(Find("test1", "{'_id':'55330b77e30454598ff1bd6d'}", nil, "{'_id':0,'name':'1'}", true, -1, -1))
 	//log.Println(Find("test1", "{'name':{'$regex':'1ss$'}}", nil, "{'_id':0,'name':'1'}", false, 1, 2))
 	//统计
 	//log.Println(Count("test1", "{'name':{'$regex':'^1ss'}}"))
@@ -35,15 +35,10 @@ func Test_FindByQuery(t *testing.T) {
 	//删除
 	//log.Println(Del("test1", "{'name':'AAA'}"))
 	//更新
-	//log.Println(Update("test1", "{'name':'1ss'}", "{'$set':{'ss':'test','age':100}}", false, false))
-	b := make([]M, 2)
-	b[0] = M{
-		"name": "zzzz",
-	}
-	b[1] = M{
-		"name": "bbbb",
-	}
-	_ = b
+
+	b := Update("test1", "{'_id':'56a0917ee49c13d5314daa0f'}", &map[string]interface{}{"$set": &map[string]interface{}{"credit_a": int64(2305843009213693695)}}, true, false)
+	//b := Update("test1", "{'_id':'56a0917ee49c13d5314daa0f'}", &map[string]interface{}{"age": "1"}, true, false)
+	log.Println("ssssssss", b)
 	//批量插入
 	//log.Println(SaveBulk("test1", b...))
 }
@@ -75,14 +70,9 @@ func Test_findField(t *testing.T) {
 	InitMongodbPool(1, "192.168.3.18:27080", "qfw")
 	//log.Println(FindById("enterprise", "556d858ec2e875307286f863", `{"_id":1}`))
 	//log.Println(FindOne("identification", "{'o_identificationinfo.s_id':'12312312312312312x','i_identificationtype':2}"))
-	obj := FindOne("bidding_back", &map[string]interface{}{
-		"title": "2015新乡市卫河共产主义渠管理处西王村涵闸拆除回填工程结果公示",
-	})
-	if *obj != nil {
-		log.Println("11111")
-	} else {
-		log.Println("222")
-	}
+
+	log.Println((*FindById("user", "5668e447af537458a9000006", `{"credit_a":1}`))["credit_a"].(int64))
+
 }
 
 func Test_reg(t *testing.T) {

+ 2 - 0
core/src/qfw/member/credit/creditdetail.go

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

+ 7 - 10
core/src/qfw/member/membermanager.go

@@ -1080,18 +1080,15 @@ func returnFront(m *Member, key string) error {
 }
 
 //更新cookie sessoin
-func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, m map[string]interface{}) {
-	r := make(map[string]interface{})
-	if d, err := json.Marshal(m); err != nil || json.Unmarshal(d, &r) != nil {
-		return
-	}
+func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, r map[string]interface{}) {
+	log.Println(r)
 	freeze := IntAll(r["i_freeze"])
 	action.Session().Set("i_freeze", freeze)
 	if r["s_nickname"] == nil || r["s_nickname"].(string) == "" {
 		bindweixin := "qmx-" + fmt.Sprintf("%d%d", time.Now().Local().Unix(), rand.Intn(99))
 		action.SetSession("nickName", bindweixin)
 		go func() {
-			Update("user", `{"_id":"`+r["_id"].(string)+`"}`, `{"$set":{"s_nickname":"`+bindweixin+`"}}`, false, false)
+			Update("user", `{"_id":"`+BsonIdToSId(r["_id"])+`"}`, `{"$set":{"s_nickname":"`+bindweixin+`"}}`, false, false)
 		}()
 	} else {
 		action.SetSession("nickName", r["s_nickname"])
@@ -1103,14 +1100,14 @@ func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, m map
 	}
 	action.App.SessionManager.SetMaxAge(30 * time.Minute)
 	action.Session().SetMaxAge(30 * time.Minute)
-	action.Session().Set("id", r["_id"])
+	action.Session().Set("id", BsonIdToSId(r["_id"]))
 	action.Session().Set("identWay", IntAll(r["i_identificationway"]))
 	action.SetSession("loginName", r[loginType])
 	action.SetSession("loginType", loginType)
 	UpdateSession(action, r)
 	_, err := action.GetCookie("USER_INFO")
 	if flag || err == nil {
-		userInfo, _ := json.Marshal(map[string]interface{}{"loginId": r["_id"], "loginType": loginType})
+		userInfo, _ := json.Marshal(map[string]interface{}{"loginId": BsonIdToSId(r["_id"]), "loginType": loginType})
 		cookie_userName := &http.Cookie{Name: "USER_INFO", Value: base64.StdEncoding.EncodeToString(userInfo), Path: "/", Expires: time.Now().AddDate(0, 0, 7)}
 		action.SetCookie(cookie_userName)
 	}
@@ -1123,7 +1120,7 @@ func UpdateSession(action *xweb.Action, r map[string]interface{}) {
 		if r["s_nickname"] != nil && r["s_nickname"].(string) != "" {
 			setSessMap["nickName"] = r["s_nickname"]
 		}
-		setSessMap["userId"] = r["_id"]
+		setSessMap["userId"] = BsonIdToSId(r["_id"])
 		setSessMap["s_m_openid"] = r["s_m_openid"]
 		setSessMap["userType"] = IntAllDef(r["i_type"], 2)
 		setSessMap["userInfo"] = &r
@@ -1163,7 +1160,7 @@ func UpdateSession(action *xweb.Action, r map[string]interface{}) {
 		action.SetSession("identWay", IntAll(r["i_identificationway"]))   //认证状态
 		action.SetSession("opLocDistrict", r["opLocDistrict"])            //行政区划代码
 		**/
-		action.Session().UpdateByCustomField("id", r["_id"], "", &setSessMap)
+		action.Session().UpdateByCustomField("id", BsonIdToSId(r["_id"]), "", &setSessMap)
 	}, func(e interface{}) {
 		log.Println("登录报错", e)
 	})

+ 14 - 2
core/src/qfw/search/searchService.go

@@ -187,6 +187,18 @@ 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": {
@@ -324,7 +336,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 						      }
 						    }
 						  }
-						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","OpStateName","s_servicenames","s_action","OpLocDistrict"]
+						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict"]
 						,"from":0,
 						"size":` + fmt.Sprintf("%v", perPage) + `,
 						  "sort": [{"_score": "desc"},{"OpSint":"desc"},{"RegCap":"desc"}]
@@ -469,7 +481,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 			"s_synopsis":{"force_source": true},
 			"stock":{"force_source": true}
         }
-    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","OpStateName","s_servicenames","s_action","OpLocDistrict","s_submitid"]
+    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid"]
 	,"from":` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 	"size":` + fmt.Sprintf("%v", perPage) +
 			`,"sort":[` + sort + `] }`

+ 1 - 1
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -133,7 +133,7 @@ func (yp *Yellowpage) EnterpriseInfo(id string) error {
 			yp.T["res"] = info
 			contentuser, erruser := yp.Render4Cache("/yellowpage/enterpriseinfo.html", &yp.T)
 			if erruser == nil {
-				redis.PutBytes("enterprise", id, &contentuser, 7*ONEDAY)
+				redis.PutBytes("enterprise", "enterpriseInfo_"+id, &contentuser, 7*ONEDAY)
 			}
 			return yp.SetBody(contentuser)
 		} else {

+ 28 - 1
core/src/timetask.json

@@ -1 +1,28 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-21 16:48:10"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-21 16:48:10"}},"marketisstart":true,"marketrate":300}
+{
+    "comment": {
+        "c_rate": 720,
+        "commentrate": 900
+    },
+    "market": {
+        "demand": {
+            "attr": [
+                "i_hits",
+                "i_bids",
+                "i_status"
+            ],
+            "timepoint": "2016-01-21 14:42:23"
+        },
+        "service": {
+            "attr": [
+                "i_hits",
+                "i_sales",
+                "i_comments",
+                "i_score",
+                "i_appcounts"
+            ],
+            "timepoint": "2016-01-21 14:42:23"
+        }
+    },
+    "marketisstart": true,
+    "marketrate": 300
+}

+ 7 - 33
core/src/web/staticres/css/dev-qfw.css

@@ -2,7 +2,7 @@
 body {
 	padding-top: 0px;
 	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
-	color: #666;
+	color: #4e5051;
 }
 .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6{
 	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
@@ -1511,38 +1511,9 @@ a{
 	color: #D03102;
 	margin-right: 5px;
 }
-.d-bg-green{
-	background-image:url(/images/tbn8.png);
-}
-.d-bg-gray{
-	background-image:url(/images/tbn8.png);
-}
-.d-bg-blue{
-	background-image:url(/images/tbn7.png);
-}
-.a-bg-gray-new{
-	display:inline-block;
-	height:21px;
-	width:81px;
-	background:#FFF;
-	background-image:url(/images/tbn9.png);
-	position: relative;
-  	  top: -4px;
-}
-.d-bg-green, .d-bg-gray,.d-bg-blue{
-	width:81px;
-	height:21px;
-	color:#FFF;
-	padding-left:0px;;
-	position: static !important;
-	left: 0px;
-	right: 0px;
-	bottom: 0px;
-	text-overflow: none;
-	overflow: none;
-	white-space: nowrap;
-	line-height:21px !important;
-}
+
+style="color:#D03102;margin-right:5px;"
+
 .a-servicedetail #no_reg{ 
 	margin-bottom:100px; 
 	margin-top:50px;
@@ -2622,6 +2593,9 @@ a{
 	vertical-align: top;
 	padding: 10px 20px;
 }
+.b-disabled{
+	color: #A0A0A0;
+}
 /*认证完第一次登录 end*/
 /*分辨率小于1200的时候调整布局,算上滚动条1217*/
 @media (max-width: 1217px) {

+ 0 - 1
core/src/web/staticres/css/entcommunity.css

@@ -629,7 +629,6 @@ a:focus, a:hover{
 }
 .ent-layout-up .b-com-content{
 	padding-top: 30px;
-	padding-bottom: 30px;
 }
 .ent-layout-down .b-com-content{
 	padding: 30px 20px;

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

@@ -482,6 +482,7 @@ a.new_red:hover, a.new_red:active {
 	background-color: transparent;
 	border: 1px solid #FF5A5F;
 	color: #FF5A5F;
+	box-shadow: none;
 }
 .btn-sm, .btn-group-sm > .btn{
 	padding-top: 3px;

+ 3 - 1
core/src/web/staticres/js/entportrait.js

@@ -69,9 +69,9 @@ function b_afterLogin(flag){
 //加载关系网
 function initRelation(){
 	if(isLogined){
+		$("#entrelation-limit,#entrelation-nologin").addClass("hide");
 		$.post("/member/getRelation",{regNo:regNo,entName:entName},function(r){
 			if(r.flag == false){
-				$("#entrelation-nologin").addClass("hide");
 				$("#entrelation-limit,#entrelation-noauthe").removeClass("hide");
 				$("#entrelation-infovis").hide();
 			}else if(r.flag == true && (r == null || typeof(r) == "undefined" || typeof(r.relation.links) == "undefined" || r.relation.links.length == 0 || typeof(r.relation.nodes) == "undefined" || r.relation.nodes.length <= 1)){
@@ -101,6 +101,8 @@ function ServiceList(){
 		paging = new Paging("serviceListPaging","/front/findServiceByEntId",{entId:entId},6,function(r){
 			if(r.length == 0){
 				$("#serviceList").next(".ent-findnull").removeClass("hide");
+				$("#serviceList").remove();
+				return;
 			}
 			var html = '';
 			for(var i=0;i<r.length;i++){

+ 0 - 15
core/src/web/staticres/js/qfw.js

@@ -445,12 +445,6 @@ function isNullObj(obj){
 //根据id去后台查询评论个数、投标状态
 function advertAjaxRqe(position){
 	var data = "position="+position;
-	$("#hotService ul").each(function(){
-		var id = $(this).attr("data-id");
-		if(id != ""){
-			data += "&serviceId="+id;
-		}
-	});
 	$("#hotDemand>div").each(function(){
 		var id = $(this).attr("data-id");
 		if(id != ""){
@@ -459,15 +453,6 @@ function advertAjaxRqe(position){
 	});
 	if(data != ""){
 		$.post("/front/advertAjaxRqe",data,function(r){
-			if(r.service){
-				var service = r.service;
-				for(var i in service){
-					$('#hotService [data-id="'+service[i].id+'"]>.a-com-last').children("font").text(service[i].comments?service[i].comments:0);
-					if(service[i].online == "y"){
-						$('#hotService [data-id="'+service[i].id+'"]>.a-com-name>i').addClass("text-primary")
-					}
-				}
-			}
 			if(r.demand){
 				var demand = r.demand;
 				for(var i in demand){

+ 1 - 6
core/src/web/templates/common/hotservice.html

@@ -14,9 +14,4 @@
 		</li>
 	</ul>
 	{{end}}
-</div>
-<script type="text/javascript">
-$(function(){
-	advertAjaxRqe("hotService");
-});
-</script>
+</div>

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

@@ -363,7 +363,7 @@ $(function(){
 		checkContent("list_"+_v)
 	})
 	var AAll="{{.T.AAll}}"//一次性任务完成,位置切换
-	if (AAll==true){
+	if (AAll=="true"){
 		rcrw=$("#rcrw").html();
 		csrw=$("#csrw").html();
 		$("#rcrw").html(csrw);

+ 4 - 0
core/src/web/templates/member/editenterprise.html

@@ -239,6 +239,10 @@ function btnSaveForm(){
 		url: "/member/yellowpage/dosave/enterprise",
 		ajaxPost:true,
 		callback:function(data){
+		if(data == null || data == "" || typeof(data.info) == "undefined"){
+			window.location.href = "/";
+			return;
+		}
    		alert(data.info);		
 		window.location.href="/member/yellowpage/show/enterprise/"+ $entid;	
 		}

+ 29 - 13
core/src/web/templates/search/enterpriseList.html

@@ -60,12 +60,23 @@
 											{{index $v "EntName"}}
 										{{end}}
 									</b></a>
-									{{if index $v "OpStateName"}}
-									<span class="{{if eq (index $v "OpStateName") "注销" "吊销"}}ent-status-r{{else}}ent-status-g{{end}}">
+									{{if index $v "OpState"}}
+									<span class="{{if eq (index $v "OpState") "07" "08" "11"}}ent-status-r{{else}}ent-status-g{{end}}">
 									<script>
+										var OpState = {{index $v "OpState"}};
 										var OpStateName = {{index $v "OpStateName"}};
-										if(OpStateName.length > 2){
-											OpStateName = OpStateName.substring(0,2);
+										if(OpState == "07"){
+											OpStateName = "注销";
+										}else if(OpState == "08"){
+											OpStateName = "撤销";
+										}else if(OpState == "11"){
+											OpStateName = "吊销";
+										}else if(OpState == "06"){
+											OpStateName = "存续";
+										}else{
+											if(OpStateName.length > 2){
+												OpStateName = OpStateName.substring(0,2);
+											}
 										}
 										document.write(OpStateName);
 									</script>
@@ -73,7 +84,7 @@
 									{{end}}
 									{{ if index $v "s_action"}}
 										{{ if eq (index $v "s_action") "01"}}
-											<span class="glyphicon qyrz   margin-l-10 jhtb"></span><span class="lineb " ><small> 已认证企业 </small></span>
+											<span class="glyphicon qyrz   margin-l-10 jhtb"></span><span class="lineb " ><small>&nbsp;已认证企业&nbsp;</small></span>
 											{{ if $v.i_comauthenttype }}
 													{{ if eq $v.i_comauthenttype 2}}
 														<span class="glyphicon mprz   margin-r-10 jhtbtype"></span><span class="lineb " ><small style="margin-right:5px;">名片认证</small></span>					
@@ -92,22 +103,27 @@
 										{{end}}
 									{{end}}
 									<div class="margin-t-10">
-										<span>注册号:<small  class="lineb " >{{index $v "RegNo"}}</small></span>
+										<span><font class="b-disabled">注册号:</font><font  class="lineb " >{{index $v "RegNo"}}</font></span>
 										{{if index $v "EntType"}}
 											{{if eq $v.EntType "9600"}}
-												<span class="margin-l-15">经营者:<small  class="lineb " >{{index $v "LeRep"}}</small></span>
+												<span class="margin-l-15"><font class="b-disabled">经营者:</font><font  class="lineb " >{{index $v "LeRep"}}</font></span>
 											{{else if eq $v.EntType "5810"}}
-												<span class="margin-l-15">负责人:<small  class="lineb " >{{index $v "LeRep"}}</small></span>
+												<span class="margin-l-15"><font class="b-disabled">负责人:</font><font  class="lineb " >{{index $v "LeRep"}}</font></span>
 											{{else}}
-												<span class="margin-l-15">法定代表人:<small  class="lineb " >{{index $v "LeRep"}}</small></span>
+												<span class="margin-l-15"><font class="b-disabled">法定代表人:</font><font  class="lineb " >{{index $v "LeRep"}}</font></span>
+											{{end}}
+										{{end}}
+										{{if index $v "RegCap"}}
+											{{if and (ne $v.EntType "9600") (ne $v.EntType "5810")}}
+												<span class="margin-l-15"><font class="b-disabled">注册资本:</font><font  class="lineb " ><script>var d1={{$v.EntType}};d1=d1?d1:0; var lenD1=(d1+"").length ;if(lenD1>4&&(d1+"").indexOf(".")>-1&&(lenD1-(d1+"").indexOf("."))>4){document.write(d1.toFixed(4))}else{document.write(d1)}</script>万元</font></span>
 											{{end}}
 										{{end}}
 										<br>
-										<span>成立日期:<small  class="lineb " >{{index $v "EstDate"}}</small></span>
-										<span class="margin-l-15">所在地:<small  class="lineb " >{{index $v "OpLocDistrictName"}}</small></span>
+										<span><font class="b-disabled">成立日期:</font><font  class="lineb " >{{index $v "EstDate"}}</font></span>
+										<span class="margin-l-15"><font class="b-disabled">所在地:</font><font  class="lineb " >{{index $v "OpLocDistrictName"}}</font></span>
 									</div>
-									{{if $v.stock }}<div>股东:<small  class="lineb ">{{index $v "stock"}}</small></div>{{end}}
-									{{if $v.OpScope }}<div>经营范围:<small  class="lineb ">{{index $v "OpScope"}}</small></div>{{end}}
+									{{if $v.stock }}<div><font class="b-disabled">股东:</font><font  class="lineb ">{{index $v "stock"}}</font></div>{{end}}
+									{{if $v.OpScope }}<div><font class="b-disabled">经营范围:</font><font  class="lineb ">{{index $v "OpScope"}}</font></div>{{end}}
 								</div>
 							</div>
 						</div>

+ 0 - 1
core/src/web/templates/service/demand.html

@@ -23,7 +23,6 @@
 </style>
 <head>
 <body>
-	{{include "/common/login.html"}}
 	{{include "/common/indexhead.html"}}
 	<div class="container-fluid a-content">
 		<div class="g-demand-main">

+ 0 - 1
core/src/web/templates/service/detail.html

@@ -47,7 +47,6 @@
 <body>
 	<img src="{{.T.sinfo.s_shareimg}}" style="width:0px;height:0px;"/>
 	<!-- 审核头部 -->
-	{{include "/common/login.html"}}
 	{{include "/common/indexhead.html"}}
 	<div class="container-fluid a-content">
 		<div class="a-c-left a-servicedetail" >

+ 0 - 1
core/src/web/templates/service/list.html

@@ -58,7 +58,6 @@
 <link href="/css/index-new.css" rel="stylesheet">
 </head>
 <body >
-{{include "/common/login.html"}}
 {{include "/common/indexhead.html"}}
 
 								

+ 0 - 1
core/src/web/templates/service/viewsingledemand.html

@@ -22,7 +22,6 @@
   <body>
 <img src="{{.T.demandInfo.s_shareimg}}" style="width:0px;height:0px;"/>
 
-    {{include "/common/login.html"}}
 	{{include "/common/indexhead.html"}}
     <div class="container-fluid a-content">
 		

+ 24 - 9
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -290,11 +290,12 @@
 			</div>
 		</div>
 		<div class="hide">
+		{{if or .T.res.OpScope .T.res.s_synopsis}}
 			<div class="ent-layout-up">
 				<div class="b-com-title">
 					<span class="glyphicon jianzhu"></span>公司简介
 				</div>
-				<div class="b-com-content"></div>
+				<div class="b-com-content margin-0"></div>
 			</div>
 			<div class="ent-layout-down">
 				{{if .T.res.OpScope}}
@@ -310,14 +311,20 @@
 				<div class="b-com-content">{{.T.res.s_synopsis}}</div>
 				{{end}}
 			</div>
+			{{else}}
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+			{{end}}
 		</div>
 		<div class="ent-alterinfo hide">
+		{{if gt (len .T.res.alterInfo) 0}}
 			<div class="ent-layout-up">
 				<div class="b-com-title">
 					<span class="glyphicon jianzhu"></span>变更信息
 				</div>
 				<div class="b-com-content">
-				{{if gt (len .T.res.alterInfo) 0}}
 					<ul>
 					{{range $k,$v := .T.res.alterInfo}}
 						<li>
@@ -336,21 +343,29 @@
 						</li>
 					{{end}}
 						<li>
-							<div></div>
 							<div>
+								<div></div>
+								<div></div>
+								<div></div>
+								<a></a>
+							</div>
+							<div>
+								<div></div>
+								<div></div>
+								<div></div>
 								<a></a>
 							</div>
 						</li>
 						<div class="clearfix"></div>
 					</ul>
-				{{else}}
-					<div class="ent-findnull">
-						<img src="/images/findnull.png" class="b-findnull">
-						<h4>抱歉,未找到相关数据!</h4>
-					</div>
-				{{end}}
 				</div>
 			</div>
+			{{else}}
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+		{{end}}
 		</div>
 		<div class="hide">
 			<div class="ent-findnull">

+ 3 - 3
credit/src/config.json

@@ -24,7 +24,7 @@
         "a13": 50,
         "a14": 100,
         "a15": 80,
-        "a64": 1001,
+        "a62": 1001,
         "b1": 10,
         "b1_1": 10,
         "b1_n": 7,
@@ -67,8 +67,8 @@
         "txt_a13": "分享服务",
         "txt_a14": "完成交易",
         "txt_a15": "完成交易评价",
-		"txt_a63": "剑鱼首次推送",
-        "txt_a64": "完成一次性所有任务",
+		"txt_a61": "剑鱼首次推送",
+        "txt_a62": "完成一次性所有任务",
         "txt_b1": "签到",
         "txt_b2": "企业查询",
         "txt_b3": "发服务",

+ 112 - 2
credit/src/main.go

@@ -106,7 +106,7 @@ func quartz() {
 	//每天一次检查剑鱼积分
 	//有一张增值服务表,记录服务代码、服务起始日期、服务截止日期、服务类型按月、服务数量、是否自动扣费(扣费走rpc调用)、记录是否过期
 
-	TimerSwordFish()
+	TimerSwordFishFromUser()
 
 	//定时任务转赠积分24后无人接收即退回,本月不做了
 	/**
@@ -138,7 +138,115 @@ func quartz() {
 	**/
 }
 
+//剑鱼定时扣分逻辑
+/**
+** 根据user表来处理
+**/
+func TimerSwordFishFromUser() {
+	go func() {
+		for {
+			now := time.Now()
+			// 计算下一个零点
+			//next := now.Add(24 * time.Hour)
+			//next = time.Date(next.Year(), next.Month(), next.Day(), swordfish_subHour, 0, 0, 0, next.Location())
+			next := now.Add(30 * time.Second)
+			//next = time.Date(next.Year(), next.Month(), next.Day(), swordfish_subHour, 0, 0, 0, next.Location())
+			next64 := next.Unix()
+			t := time.NewTimer(next.Sub(now))
+			<-t.C
+			/*执行逻辑*/
+			log.Println("执行定时任务...")
+			util.Try(func() {
+				session := mongodb.GetMgoConn()
+				defer mongodb.DestoryMongoConn(session)
+				coll := session.DB("qfw").C("user")
+				for code, typeName := range map[string]string{
+					"A1": "tender",
+					"A2": "bid",
+				} {
+					query := coll.Find(&map[string]interface{}{
+						"o_msgset." + typeName + ".l_enddate": map[string]interface{}{
+							"$gte": next64 - 600,
+							"$lte": next64 + int64(swordfish_tipBeforeDays[0]*60),
+						},
+						"o_msgset." + typeName + ".i_status":       1,
+						"o_msgset." + typeName + ".i_switchstatus": 1,
+					}).Iter()
+
+					for tmp := make(map[string]interface{}); query.Next(tmp); {
+						log.Println(tmp)
+						util.Try(func() {
+							tmpCode := tmp["o_msgset"].(map[string]interface{})[typeName].(map[string]interface{})
+							endDate := tmpCode["l_enddate"].(int64)
+							sub64 := (endDate - next64) / (60)
+							if sub64 == 0 {
+								//自动扣费
+								doSubCreditByUser(util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string), typeName, code, &next, tmp)
+							} else {
+								//提示
+								for _, v := range swordfish_tipBeforeDays {
+									if int64(v) == sub64 {
+										creditrpc.SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string))
+									}
+								}
+							}
+						}, func(e interface{}) {})
+						tmp = make(map[string]interface{})
+					}
+				}
+			}, func(e interface{}) {
+				log.Println("定时任务,扣剑鱼积分时报错", e)
+			})
+			TimerSwordFishFromUser()
+			break
+		}
+	}()
+}
+
+//自动扣费
+func doSubCreditByUser(userId, umid, typeName, code string, next *time.Time, user map[string]interface{}) {
+	//是否生效和是否启用
+	util.Try(func() {
+		i_credit := util.IntAllDef(user["i_credit"], 0)
+		bsub := false
+		codeNum := creditrpc.Score[code]
+		restNum := i_credit + codeNum
+		if i_credit > 0 && restNum > -1 {
+			bsub = true
+		}
+		if bsub { //扣分操作
+			newDate := next.AddDate(0, 1, 0)
+			creditDoc := map[string]interface{}{
+				"s_uid":     userId,
+				"s_umid":    umid,
+				"s_code":    code,
+				"i_type":    0, //是扣
+				"l_date":    next.Unix(),
+				"l_enddate": newDate.Unix(),
+				"i_score":   codeNum,
+				"s_type":    typeName,
+			}
+			if creditlog.Save(creditDoc) {
+				//发送微信通知扣积分成功
+				creditrpc.SendMsgWebAndWx(swordfish_payTitle, fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, umid)
+			}
+		} else { //暂停操作
+			//更新操作
+			if mongodb.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"o_msgset.`+typeName+`.i_status":0}}`, false, false) {
+				//暂停通知,因积分不够
+				creditrpc.SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, umid)
+			}
+		}
+	}, func(e interface{}) {
+		log.Println("查询用户剑鱼状态出错,", e)
+	})
+}
+
 //剑鱼定时扣分逻辑,提前三天提示积分不够、扣积分发通知,下午18点执行
+/**
+** 根据creditlog表来处理
+**/
+/**
 func TimerSwordFish() {
 	go func() {
 		for {
@@ -149,7 +257,7 @@ func TimerSwordFish() {
 			next64 := next.Unix()
 			t := time.NewTimer(next.Sub(now))
 			<-t.C
-			/*执行逻辑*/
+			//执行逻辑
 			util.Try(func() {
 				session := mongodb.GetMgoConn()
 				defer mongodb.DestoryMongoConn(session)
@@ -249,3 +357,5 @@ func doSubCredit(userId, umid, typeName, code string, next *time.Time) {
 
 	}
 }
+
+**/

+ 2 - 1
credit/src/qfw/creditrpc/creditrpc.go

@@ -263,7 +263,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 		var newDate time.Time
 		switch first {
 		case "A":
-			newDate = GetTimeByNow(now, Hour).AddDate(0, 1, 1)
+			newDate = GetTimeByNow(now, Hour).AddDate(0, 1, 0)
 			creditDoc["l_enddate"] = newDate.Unix()
 			creditDoc["i_valid"] = 1
 			if param.OtherParam != nil {
@@ -319,6 +319,7 @@ func SendManagerNotifyMsg(p *qrpc.NotifyMsg) {
 		}
 	}()
 	client, err := rpc.DialHTTP("tcp", Rpcserver)
+	defer client.Close()
 	if err != nil {
 		log.Println(err.Error())
 		return

+ 13 - 14
credit/src/qfw/creditrpc/creditrpc_test.go

@@ -2,22 +2,21 @@ package creditrpc
 
 import (
 	"log"
-	"net/rpc"
-	r "qfw/util/rpc"
+
 	"testing"
 )
 
-func Test_rpc(t *testing.T) {
-	log.Println("----------")
-	dd := r.CreditData{
-		Code: "ddddd",
+func Test(t *testing.T) {
+	tmp := uint64(1)
+	var ret uint64
+	for k := 2; k < 62; k++ {
+		if k == 9 {
+			continue
+		}
+		ret = 1 << (uint64(k) - 1)
+		tmp += ret
+		log.Println(k, int(tmp), int(ret))
 	}
-	var repl int
-	clent, _ := rpc.DialHTTP("tcp", "127.0.0.1:8765")
-	clent.Call("CreditRpc.InCreadit", &dd, &repl)
-
-	log.Println(repl)
-	clent.Close()
-	c := make(chan bool, 1)
-	<-c
+	log.Println(tmp)
+	log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
 }

+ 1 - 1
weixin/src/config.json

@@ -27,7 +27,7 @@
                 "identifytplid":"oGxkPyaV42z3KWykt58Tow9mBe_ImJvi8R3ajorVWOY",
                 "offLinemsgtplid":"ExIeyFfoDNVJXhRDq09JbsjH_zbEJCB6gw6rxcV7atw",
                 "msgnotifytplid":"b7iuAMiTCIolnPhTdueKBVYThEMf2D-Bh2M_9v3J-68",
-                "managernotifytplid":"dplgu5Q644vzPdqcPXY7RqgItS3eXACmU1XDl27CvTA"
+                "managernotifytplid":"DIwMrPQToOhGfa6ZAQCCrqquzbLKajiXsKY0K_lQtWQ"
         },"activity":{
                 "activitycode":"topcj",
                 "title":"企明星新年抽奖活动进行中",