瀏覽代碼

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

李广朋 9 年之前
父節點
當前提交
aad3d95646
共有 100 個文件被更改,包括 2835 次插入2087 次删除
  1. 54 23
      common/src/qfw/util/credit/credit.go
  2. 2 0
      common/src/qfw/util/elastic/elasticutil.go
  3. 6 0
      common/src/qfw/util/elastic/elasticutil_test.go
  4. 1 1
      common/src/qfw/util/encrypt_test.go
  5. 28 0
      common/src/qfw/util/redis/redisutil.go
  6. 5 0
      common/src/qfw/util/redis/redisutil_test.go
  7. 6 0
      common/src/qfw/util/rpc/push.go
  8. 1 0
      core/src/config.json
  9. 70 4
      core/src/qfw/active/activemanage.go
  10. 1 0
      core/src/qfw/coreconfig/SysConfig.go
  11. 7 0
      core/src/qfw/coreutil/coreutil.go
  12. 22 0
      core/src/qfw/coreutil/counterutil.go
  13. 13 0
      core/src/qfw/coreutil/counterutil_test.go
  14. 22 0
      core/src/qfw/coreutil/share.go
  15. 17 0
      core/src/qfw/coreutil/weixinrpc.go
  16. 37 2
      core/src/qfw/front/index.go
  17. 25 0
      core/src/qfw/front/webcentent.go
  18. 2 1
      core/src/qfw/manage/auditing.go
  19. 14 0
      core/src/qfw/manage/feedback.go
  20. 1 1
      core/src/qfw/mobile/mobile.go
  21. 46 11
      core/src/qfw/mobile/wxmenu.go
  22. 4 3
      core/src/qfw/search/search.go
  23. 51 0
      core/src/qfw/search/searchService.go
  24. 6 7
      core/src/qfw/swordfish/swordfish.go
  25. 21 36
      core/src/qfw/swordfish/swordfishmanage.go
  26. 2 0
      core/src/qfw/yellowpage/yellowpage.go
  27. 38 10
      core/src/qfw/yellowpage/yellowpagemanager.go
  28. 1 1
      core/src/timetask.json
  29. 43 13
      core/src/web/staticres/css/dev-qfw.css
  30. 176 75
      core/src/web/staticres/css/entcommunity.css
  31. 92 5
      core/src/web/staticres/css/index-new.css
  32. 9 4
      core/src/web/staticres/css/qfw.css
  33. 32 1
      core/src/web/staticres/css/swordfish.css
  34. 二進制
      core/src/web/staticres/fonts.zip
  35. 二進制
      core/src/web/staticres/fonts/qimingxing.eot
  36. 二進制
      core/src/web/staticres/fonts/qimingxing.svg
  37. 二進制
      core/src/web/staticres/fonts/qimingxing.ttf
  38. 二進制
      core/src/web/staticres/fonts/qimingxing.woff
  39. 二進制
      core/src/web/staticres/images/activeimages/btn_end.png
  40. 二進制
      core/src/web/staticres/images/bottom_bg.jpg
  41. 二進制
      core/src/web/staticres/images/bottom_bg.png
  42. 二進制
      core/src/web/staticres/images/bottom_bg_bak.jpg
  43. 二進制
      core/src/web/staticres/images/bottom_bg_bak.png
  44. 二進制
      core/src/web/staticres/images/bottom_bg_new.jpg
  45. 二進制
      core/src/web/staticres/images/bottom_logo.png
  46. 二進制
      core/src/web/staticres/images/bottom_logo_bak.png
  47. 二進制
      core/src/web/staticres/images/entcommunity/qq.png
  48. 二進制
      core/src/web/staticres/images/entcommunity/relation.png
  49. 二進制
      core/src/web/staticres/images/entcommunity/triangle.png
  50. 二進制
      core/src/web/staticres/images/u0115.png
  51. 二進制
      core/src/web/staticres/images/u0116.png
  52. 二進制
      core/src/web/staticres/images/u0117.png
  53. 二進制
      core/src/web/staticres/images/u0118.png
  54. 二進制
      core/src/web/staticres/images/u0119.png
  55. 二進制
      core/src/web/staticres/images/u0120.png
  56. 二進制
      core/src/web/staticres/images/u2181.png
  57. 82 1123
      core/src/web/staticres/js/entportrait.js
  58. 33 33
      core/src/web/staticres/js/qfw.js
  59. 722 0
      core/src/web/staticres/js/relation.js
  60. 0 0
      core/src/web/staticres/wxswordfish/images/feerule.png
  61. 2 1
      core/src/web/staticres/wxswordfish/main.js
  62. 6 6
      core/src/web/staticres/wxswordfish/share.js
  63. 9 5
      core/src/web/staticres/wxswordfish/style.css
  64. 10 12
      core/src/web/templates/_err.html
  65. 23 17
      core/src/web/templates/active/luckdraw.html
  66. 9 0
      core/src/web/templates/common/errorhead.html
  67. 0 4
      core/src/web/templates/common/login.html
  68. 39 19
      core/src/web/templates/common/memberleft.html
  69. 2 2
      core/src/web/templates/common/swordfishhead.html
  70. 3 3
      core/src/web/templates/common/top.html
  71. 123 2
      core/src/web/templates/index.html
  72. 16 0
      core/src/web/templates/manage/web_weixinshare.html
  73. 220 25
      core/src/web/templates/swordfish/rssset.html
  74. 2 2
      core/src/web/templates/swordfish/wxrssset.html
  75. 1 1
      core/src/web/templates/swordfish/wxtoolbar.html
  76. 166 78
      core/src/web/templates/yellowpage/enterpriseinfo.html
  77. 9 11
      core/src/web/templates/yellowpage/error.html
  78. 1 0
      credit/src/config.json
  79. 1 1
      credit/src/qfw/creditrpc/creditrpc.go
  80. 1 61
      push/src/config.json
  81. 13 0
      push/src/main.go
  82. 25 0
      push/src/qfw/push/bid/bid_test.go
  83. 9 208
      push/src/qfw/push/bid/bidpushjob.go
  84. 25 35
      push/src/qfw/push/cache.go
  85. 16 0
      push/src/qfw/push/dfa/interestanalysis_test.go
  86. 221 0
      push/src/qfw/push/dopush/dopush.go
  87. 36 0
      push/src/qfw/push/rpcpush/rpcpush.go
  88. 9 212
      push/src/qfw/push/tender/tenderpushjob.go
  89. 4 1
      push/src/qfw/push/weixincall.go
  90. 4 6
      weixin/src/config.json
  91. 10 0
      weixin/src/qfw/weixin/dao/logsdao.go
  92. 43 0
      weixin/src/qfw/weixin/dao/sharedao.go
  93. 2 7
      weixin/src/qfw/weixin/dao/userdao.go
  94. 9 1
      weixin/src/qfw/weixin/msgtxtchandler.go
  95. 46 0
      weixin/src/qfw/weixin/rpc/share.go
  96. 11 4
      weixin/src/qfw/weixin/subscribehandler.go
  97. 13 0
      weixin/src/qfw/weixin/txt_test.go
  98. 2 0
      weixin/src/qfw/weixin/weixinsdk.go
  99. 1 9
      weixin/src/qfw/weixinconfig/config_test.go
  100. 1 0
      weixin/src/qfw/weixinconfig/weixinconfig.go

+ 54 - 23
common/src/qfw/util/credit/credit.go

@@ -30,6 +30,8 @@ const (
 	A_FXFWXQ = "a13" //分享服务
 	A_WCJY   = "a14" //完成交易
 	A_WCJYPJ = "a15" //完成交易评价
+	A_JYSCTS = "a63" //剑鱼首次推送
+	A_ALL    = "a64" //一次性积分任务完成
 
 	B_QD       = "b1" //签到
 	B_QD_T     = 7    //最高连续签到次数
@@ -57,7 +59,7 @@ func init() {
 	util.ReadConfig(&SysConfig)
 	CreditA = make(map[string]uint64)
 	//初始化一次性任务
-	for i := 1; i < 16; i++ {
+	for i := 1; i <= 64; i++ {
 		CreditA["a"+fmt.Sprint(i)] = uint64(i)
 	}
 	Rc = rpc.RpcCall{Addr: SysConfig["creditRpc"].(string)}
@@ -75,12 +77,26 @@ func InCreditA(userId, code string, credit_a int) (bool, int, int, error) {
 		err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, &Replay)
 		if err == nil && Replay > 0 {
 			result, credit_a = UpuserCreditA(code, userId, credit_a)
+		} else {
+			log.Println("调用rpc出错", err)
 		}
 		return result, credit_a, Replay, err
 	}
 	return result, credit_a, 0, nil
 }
 
+//剑鱼一次性任务
+func CheckSword(userId, code string, credit_a int, xb *xweb.Action) bool {
+	result := false
+	if !AIsHasDo(code, credit_a) {
+		result, credit_a = UpuserCreditA(code, userId, credit_a)
+		if result {
+			xb.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
+		}
+	}
+	return result
+}
+
 //日常任务积分
 func InCreditB(userId, code string, param map[string]interface{}) (bool, int, error) {
 	b := false
@@ -89,8 +105,10 @@ func InCreditB(userId, code string, param map[string]interface{}) (bool, int, er
 	}
 	var Replay int
 	err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, &Replay)
-	if err == nil && Replay > 0 {
+	if err == nil && Replay != 0 {
 		b = true
+	} else {
+		log.Println("调用rpc出错", err)
 	}
 	return b, Replay, err
 }
@@ -129,6 +147,9 @@ func AAllIsHasDo(num int) bool {
 			b = true
 			continue
 		}
+		if v > uint64(15) { //目前超出15状态是非任务状态
+			continue
+		}
 		if uint64(num)&ret > 0 {
 			b = true
 		} else {
@@ -140,16 +161,20 @@ func AAllIsHasDo(num int) bool {
 }
 
 //扣积分
-func OutCreditB(userId, code, umid string, score int, param map[string]interface{}) (bool, int) {
+func OutCreditB(userId, code, umid string, score int, param map[string]interface{},
+	xb *xweb.Action) (bool, int) {
 	b := false
 	var Replay int
 	if len(userId) < 5 {
 		return b, Replay
 	}
 	err := Rc.OutCreadit(&rpc.CreditData{Code: code, Uid: userId, Umid: umid, Num: score, OtherParam: param}, &Replay)
-	if err == nil && Replay > 0 {
+	if err == nil && Replay != 0 {
 		b = true
 	}
+	if b {
+		xb.Session().UpdateByCustomField("id", userId, "i_credit", util.IntAll(xb.GetSession("i_credit"))+Replay)
+	}
 	return b, Replay
 }
 
@@ -157,28 +182,34 @@ func OutCreditB(userId, code, umid string, score int, param map[string]interface
 func UpuserCreditSession(userId, code, dtype string, param map[string]interface{}, xb *xweb.Action) bool {
 	b := false
 	score := 0
-	if dtype == "A" {
-		credit_a := util.IntAll(xb.GetSession("credit_a"))
-		b, credit_a, score, _ = InCreditA(userId, code, credit_a)
-		if b {
-			xb.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
-			xb.Session().UpdateByCustomField("id", userId, "i_credit", util.IntAll(xb.GetSession("i_credit"))+score)
-		} else {
-			log.Println(userId, code, "一次性任务送积分失败")
-		}
-		if AAllIsHasDo(credit_a) {
-			b, _, _, _ := InCreditA(userId, "a64", credit_a)
+	util.Try(func() {
+		if dtype == "A" {
+			credit_a := util.IntAll(xb.GetSession("credit_a"))
+			b, credit_a, score, _ = InCreditA(userId, code, credit_a)
 			if b {
-				log.Println(userId, "完成所有一次性任务")
+				xb.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
+				xb.Session().UpdateByCustomField("id", userId, "i_credit", util.IntAll(xb.GetSession("i_credit"))+score)
+			} else {
+				log.Println(userId, code, "一次性任务送积分失败")
+			}
+			if AAllIsHasDo(credit_a) {
+				b, _, _, err := InCreditA(userId, A_ALL, credit_a)
+				if b {
+					log.Println(userId, "完成所有一次性任务,送分成功")
+				} else {
+					log.Println(userId, "完成所有一次性任务,送分失败", err)
+				}
 			}
-		}
-	} else {
-		b, score, _ = InCreditB(userId, code, param)
-		if b {
-			xb.Session().UpdateByCustomField("id", userId, "i_credit", util.IntAll(xb.GetSession("i_credit"))+score)
 		} else {
-			log.Println(userId, code, param, "任务送积分失败")
+			b, score, _ = InCreditB(userId, code, param)
+			if b {
+				xb.Session().UpdateByCustomField("id", userId, "i_credit", util.IntAll(xb.GetSession("i_credit"))+score)
+			} else {
+				log.Println(userId, code, param, "任务送积分失败")
+			}
 		}
-	}
+	}, func(e interface{}) {
+		log.Println("更新积分和session出错", e)
+	})
 	return b
 }

+ 2 - 0
common/src/qfw/util/elastic/elasticutil.go

@@ -580,6 +580,8 @@ func ConverData(ent *map[string]interface{}) map[string]interface{} {
 	tmp2["OpScope"] = tmp["OpScope"]
 	tmp2["OpState"] = tmp["OpState"]
 	tmp2["s_submitid"] = tmp["s_submitid"]
+	tmp2["l_submittime"] = tmp["l_submittime"]
+	tmp2["s_submitname"] = tmp["s_submitname"]
 	//增加营业状态排序
 	if tmp2["OpState"] == "06" {
 		tmp2["OpSint"] = true

+ 6 - 0
common/src/qfw/util/elastic/elasticutil_test.go

@@ -183,3 +183,9 @@ func Test_date(t *testing.T) {
 	s := time.Now().UnixNano()
 	log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
 }
+
+func Test_Getpage(t *testing.T) {
+	InitElasticSize("http://192.168.3.18:9800", 1)
+	data := *GetPage("enterprise", "enterprise", `{"s_action":"01"}`, `{"l_submittime":-1}`, `"EntName","l_submittime","_id"`, 0, 8)
+	log.Println("data:", data)
+}

+ 1 - 1
common/src/qfw/util/encrypt_test.go

@@ -12,7 +12,7 @@ import (
 func TestEncrypt(t *testing.T) {
 	se := &SimpleEncrypt{Key: "topnet"}
 
-	log.Println(se.EncodeString("oJULtwzXo6EFV1Ah-XeyRBimXGM8,ff,ff,swordfishaction"))
+	log.Println(se.EncodeString("obEpLuH03fTYZ2e0xhJL3k7H6q48,ff,ff,swordfishaction"))
 }
 
 func Test_sim(t *testing.T) {

+ 28 - 0
common/src/qfw/util/redis/redisutil.go

@@ -386,3 +386,31 @@ func DelByPattern(key string) {
 
 }
 **/
+//自增计数器
+func Incr(code, key string) int64 {
+	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)
+			}
+		}
+	}()
+	conn := RedisPool[code].Get()
+	defer conn.Close()
+	ret, err := conn.Do("INCR", key)
+	if nil != err {
+		log.Println("redisutil-GetError", err)
+	} else {
+		if res, ok := ret.(int64); ok {
+			return res
+		} else {
+			return 0
+		}
+	}
+	return 0
+}

+ 5 - 0
common/src/qfw/util/redis/redisutil_test.go

@@ -56,3 +56,8 @@ func Test_other(t *testing.T) {
 	}
 	<-pools
 }
+
+func TestIncr(t *testing.T) {
+	InitRedis("sso=192.168.3.14:1379")
+	log.Println(GetBytes("sso", "p_share_3200000006"))
+}

+ 6 - 0
common/src/qfw/util/rpc/push.go

@@ -0,0 +1,6 @@
+package rpc
+
+type PushData struct {
+	Mopenid  string
+	PushType map[string]string
+}

+ 1 - 0
core/src/config.json

@@ -29,6 +29,7 @@
     "chatServer": "127.0.0.1:83",
     "chatRpc": "127.0.0.1:88",
 	"creditRpc":"127.0.0.1:8765",
+	"pushRpc":"127.0.0.1:8766",
 	"domainName":"http://www.qimingxing.info"
 
 }

+ 70 - 4
core/src/qfw/active/activemanage.go

@@ -6,11 +6,14 @@ package active
 import (
 	"fmt"
 	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
 	"math/rand"
 	. "qfw/coreconfig"
+	"qfw/coreutil"
 	mob "qfw/mobile"
 	. "qfw/util"
 	. "qfw/util/mongodb"
+	qrpc "qfw/util/rpc"
 	"strconv"
 	"time"
 )
@@ -23,16 +26,31 @@ type Activemanage struct {
 
 //进入抽奖页面
 func (a *Activemanage) Luckdraw(activecode, id string) error {
+	userInfo := a.GetSession("userInfo").(*map[string]interface{})
+	openid := (*userInfo)["s_m_openid"].(string)
+	a.T["shareid"] = coreutil.FindMyShareId(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"]
+		if *f == nil {
+			a.T["flog"] = "B"
+			a.T["msg"] = "您的微信号无效!!"
+			return a.Render("/active/luckdraw.html", &a.T)
+		}
 		a.T["signature"] = mob.GetSignature(a.Url())
 		u := FindOne("winningrecord", "{'s_openid':'"+openid+"'}")
 		if *u != nil {
 			//a.T = *u
 			a.T["flog"] = "A"
+			a.T["msg"] = "小主莫贪心,每人只有一次抽奖机会呦!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
 			return a.Render("/active/luckdraw.html", &a.T)
 		}
+		a.SetSession("username", username)
+		a.SetSession("userid", userid)
 		a.SetSession("openid", openid)
 		a.SetSession("s_actcode", activecode)
 		return a.Render("/active/luckdraw.html", &a.T)
@@ -44,22 +62,28 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 //
 func (a *Activemanage) Getluckdraw() error {
 	flog := "F"
+	//提示语
+	msg := ""
 	id := ""
+	today := time.Now()
 	openid := a.GetSession("openid").(string)
 	s_actcode := a.GetSession("s_actcode").(string)
 	if openid == "" {
-		return a.Write(`{"flog":"` + flog + `"}`)
+		msg = "  小主你太长时间没点击开始抽奖了,重新进来吧!"
+		return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
 	} else {
 		u := FindOne("winningrecord", "{'s_openid':'"+openid+"'}")
 		if *u != nil {
 			flog = "A"
-			return a.Write(`{"flog":"` + flog + `"}`)
+			msg = "  小主莫贪心,每人只有一次抽奖机会呦!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+			return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
 		}
 	}
 	data := make(map[string]interface{})
 	data["s_openid"] = openid
 	data["s_actcode"] = s_actcode
 	i := getLuckDraw()
+
 	s_prize := getPrize(i)
 	data["s_prize"] = s_prize
 	data["l_timestamp"] = time.Now().Unix()
@@ -67,12 +91,54 @@ func (a *Activemanage) Getluckdraw() error {
 	enddate := LuckDraw.EndDate
 	if nowdate < enddate {
 		id = Save("winningrecord", data)
-		fmt.Println("nowdate:", nowdate, "enddate:", enddate, len(id))
 	}
 	if len(id) > 0 {
 		flog = "T"
 	}
-	return a.Write(`{"flog":"` + flog + `","prize":"` + s_prize + `","rotate":` + strconv.Itoa(int(i)) + `}`)
+	if i > 185 && i < 220 {
+		amount := 500 //红包金额以“元”为单位,微信红包以“分”为单位
+		bm := qrpc.BonusMsg{Mchbillno: fmt.Sprint(today.Unix()),
+			Sendname:    LuckDraw.Weixin["sendname"].(string),
+			Reopenid:    openid,
+			Totalamount: amount,
+			Totalnum:    1,
+			Wishing:     "企明星新年大抽奖",
+			Actname:     "企明星新年大抽奖",
+			Remark:      "欢迎参加企明星新年大抽奖活动!",
+		}
+		if coreutil.PayBonus(&bm) {
+			redpackage := make(bson.M)
+			redpackage["s_userid"] = a.GetSession("userid")
+			redpackage["s_username"] = a.GetSession("username")
+			redpackage["s_openid"] = openid
+			redpackage["i_amount"] = amount
+			redpackage["s_billno"] = bm.Mchbillno
+			redpackage["s_name"] = bm.Actname
+			redpackage["l_createdate"] = today.Unix()
+			redpackage["i_year"] = today.Year()
+			redpackage["i_month"] = today.Month()
+			redpackage["i_day"] = today.Day()
+			redpackage["s_actcode"] = s_actcode
+			Save("redpackage", redpackage)
+		}
+	}
+	if i > 185 && i < 220 {
+		msg = "  小主是真真的好运气,五元现金红包落入您囊中!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+	} else if (i > 275 && i < 310) || (i > 95 && i < 130) {
+		//时间判断,提醒不同
+		now := time.Now()
+		//不在工作时间
+		if now.Weekday() == 6 || now.Weekday() == 0 || (now.Hour() > 18 || now.Hour() < 9) {
+			//
+			msg = "  小主是真真的好运气," + s_prize + "落入您囊中!<br/>  请在微信留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!<br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+		} else { //在工作时间
+			msg = "  小主是真真的好运气," + s_prize + "落入您囊中,请速速微信联系企明星确认领奖事宜!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+		}
+
+	} else { //不中奖
+		msg = "  小主不要桑心,这次没有中奖不代表什么,猴年依然会好运气爆棚滴~~<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+	}
+	return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `","rotate":` + strconv.Itoa(int(i)) + `}`)
 
 }
 

+ 1 - 0
core/src/qfw/coreconfig/SysConfig.go

@@ -22,6 +22,7 @@ type config struct {
 	MailFailureTime int         `json:"mailFailureTime"`
 	ChatServer      string      `json:"chatServer"`
 	ChatRpc         string      `json:"chatRpc"`
+	PushRpc         string      `json:"pushRpc"`
 	ElasticPoolSize int         `json:"elasticPoolSize"`
 	DomainName      string      `json:"domainName"`
 }

+ 7 - 0
core/src/qfw/coreutil/coreutil.go

@@ -0,0 +1,7 @@
+package coreutil
+
+import (
+	"qfw/util"
+)
+
+var se *util.SimpleEncrypt = &util.SimpleEncrypt{Key: "topnet2015topnet2015"}

+ 22 - 0
core/src/qfw/coreutil/counterutil.go

@@ -0,0 +1,22 @@
+package coreutil
+
+import (
+	"qfw/util/redis"
+)
+
+//计数器
+const (
+	TYPE_INVITE = iota //邀请
+	TYPE_GIVE          //赠送积分
+)
+
+//基于Redis的计数器实现
+func GetShareId(businesstype int) uint32 {
+	var tmp int64
+	if businesstype == TYPE_INVITE {
+		tmp = redis.Incr("other", "invite_counter") + 3200000000
+	} else if businesstype == TYPE_GIVE {
+		tmp = redis.Incr("other", "give_counter") + 3200000000
+	}
+	return uint32(tmp)
+}

+ 13 - 0
core/src/qfw/coreutil/counterutil_test.go

@@ -0,0 +1,13 @@
+package coreutil
+
+import (
+	"log"
+	"qfw/util/redis"
+	"testing"
+)
+
+func TestCounter(t *testing.T) {
+	redis.InitRedis("other=192.168.3.14:1379")
+	log.Println("初始化缓存")
+	log.Println("id::", GetShareId(TYPE_INVITE))
+}

+ 22 - 0
core/src/qfw/coreutil/share.go

@@ -0,0 +1,22 @@
+package coreutil
+
+import (
+	"fmt"
+	"qfw/util/mongodb"
+)
+
+//取到分享者的shareid
+func FindMyShareId(openid string) string {
+	//userInfo := a.GetSession("userInfo").(*map[string]interface{})
+	//openid := (*userInfo)["s_m_openid"].(string)
+	ret := mongodb.FindOne("person_share", "{'s_openid':'"+openid+"'}")
+	var shareid string
+	if (*ret)["i_shareid"] == nil {
+		id := GetShareId(TYPE_INVITE)
+		GetShareQR(id)
+		shareid = fmt.Sprintf("%d", id)
+	} else {
+		shareid = (*ret)["i_shareid"].(string)
+	}
+	return se.EncodeString(shareid)
+}

+ 17 - 0
core/src/qfw/coreutil/weixinrpc.go

@@ -1,6 +1,7 @@
 package coreutil
 
 import (
+	"fmt"
 	"log"
 	"net/rpc"
 	"qfw/coreconfig"
@@ -77,3 +78,19 @@ func GetJSInterfaceParam(url string) []string {
 	}
 	return ret
 }
+
+//
+func GetShareQR(url uint32) string {
+	var ret string
+	client, err := rpc.DialHTTP("tcp", rpcserver)
+	if err != nil {
+		log.Println(err.Error())
+		return ret
+	}
+	err = client.Call("WeiXinRpc.GetShareQR", url, &ret)
+	if err != nil {
+		log.Println(err.Error())
+	}
+	fmt.Println("ret:::::::::::", ret)
+	return ret
+}

+ 37 - 2
core/src/qfw/front/index.go

@@ -56,14 +56,49 @@ func (i *Index) LoadIndex() error {
 		return i.SetBody([]byte(ret.(string)))
 	} else {
 		i.T["serviceClassify"] = coreconfig.ServiceClassify
+		//企业快报
 		querymap := map[string]string{
 			"perPage":     i.GetString("perPage"),
 			"currentPage": i.GetString("currentPage"),
 			"contentType": "qykb",
 			"query":       i.GetString("query")}
 		data, pagination := searhWebContent(querymap)
-		content, _ := i.Render4Cache("/index.html", &xweb.T{"data": data, "pagination": pagination})
-		redis.Put("other", "/", string(content), 0) //设置首页缓存
+		//知识库
+		zkquerymap := map[string]string{
+			"perPage":     "8",
+			"currentPage": i.GetString("currentPage"),
+			"contentType": "zhsk",
+			"query":       i.GetString("query")}
+		zkdata, _ := searhWebContent(zkquerymap)
+		if zkdata != nil {
+			for _, v := range *zkdata {
+				release := v["releasetime"].(string)
+				v["releasetime"] = release[:4] + "." + release[5:7] + "." + release[8:10]
+			}
+		}
+		//认证企业
+		entquery := `{"i_identificationstatus":1,"i_freeze":{"$ne":2}}`
+		entdata := *Find("identification", entquery, []string{"-l_auditdate"}, `{"s_enterprisename":1,"l_auditdate":1,"s_enterpriseid":1}`, false, 0, 8)
+		if entdata != nil {
+			for _, v := range entdata {
+				auditdate := v["l_auditdate"].(int64)
+				v["l_auditdate"] = time.Unix(auditdate, 0).Format("2006.01.02")
+			}
+		}
+		//剑鱼最新消息
+		now := time.Now()
+		unix := time.Date(now.Year(), now.Month(), now.Day(), now.Hour()-2, now.Minute(), now.Second(), now.Nanosecond(), time.Local).Unix()
+		sfdata := *Find("bidding", M{"comeintime": M{"$lte": unix}}, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 8)
+		if sfdata != nil {
+			for _, v := range sfdata {
+				publishtime := v["publishtime"].(int64)
+				//:= util.FormatDateWithObj(&data_2, util.Date_Short_Layout)
+				v["publishtime"] = time.Unix(publishtime, 0).Format("2006.01.02")
+			}
+		}
+		//
+		content, _ := i.Render4Cache("/index.html", &xweb.T{"data": data, "pagination": pagination, "zkdata": zkdata, "entdata": entdata, "sfdata": sfdata})
+		redis.Put("other", "/", string(content), 60*60*2) //设置首页缓存
 		return i.SetBody(content)
 	}
 }

+ 25 - 0
core/src/qfw/front/webcentent.go

@@ -11,6 +11,7 @@ import (
 	"github.com/go-xweb/xweb"
 	"html/template"
 	"log"
+	"qfw/coreutil"
 	"qfw/util"
 	"qfw/util/elastic"
 	. "qfw/util/mongodb"
@@ -42,6 +43,30 @@ type Newscont struct {
 	getJsonList xweb.Mapper `xweb:"POST /front/(\\w+)list/list"`
 	//微信端使用通用信息展示页
 	weixincontent xweb.Mapper `xweb:"GET /front/weixincontent/(\\w+)"`
+	//取微信分享图片
+	weixinshare xweb.Mapper `xweb:"GET /front/weixinshare/([^.]*)"`
+}
+
+//取微信分享图片
+
+func (e *Newscont) Weixinshare(pid string) error {
+	var pngdata = []byte{}
+	if ret, _ := redis.GetBytes("sso", fmt.Sprintf("p_share_%s", pid)); ret != nil {
+		pngdata = *ret
+	} else {
+		id := coreutil.GetShareId(coreutil.TYPE_INVITE)
+		coreutil.GetShareQR(id)
+		tmp, _ := redis.GetBytes("sso", fmt.Sprintf("p_share_%d", id))
+		pngdata = *tmp
+	}
+	w := e.ResponseWriter
+	w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+	w.Header().Set("Pragma", "no-cache")
+	w.Header().Set("Expires", "0")
+	w.Header().Set("Content-Type", "image/png")
+	w.Write(pngdata)
+	return nil
+
 }
 
 //文章点赞

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

@@ -548,7 +548,7 @@ func (s *SystemManage) Updateaudit() error {
 				tm := fmt.Sprintf("%d", time.Now().Unix())
 				Update("enterprise", &map[string]interface{}{
 					"_id": ObjectIdHex(s_enterpriseid),
-				}, `{'$set':{'s_action':'`+s_action+`','s_avatar':'`+s_avatar+`','EntName':'`+s_enterprisename+`','RegNo':'`+s_id+`','s_submitid':'`+s_submitid+`','s_submitname':'`+s_submitname+`','l_timestamp':`+tm+`}}`, false, false)
+				}, `{'$set':{'s_action':'`+s_action+`','s_avatar':'`+s_avatar+`','EntName':'`+s_enterprisename+`','RegNo':'`+s_id+`','s_submitid':'`+s_submitid+`','s_submitname':'`+s_submitname+`','l_submittime':`+tm+`}}`, false, false)
 				elastic.UpdateEntDoc(s_enterpriseid)
 				if i_identificationtype == "5" {
 					per := FindOne("enterprise", M{"RegNo": s_id_new})
@@ -738,6 +738,7 @@ func (s *SystemManage) Updateaudit() error {
 				}
 				m.SaveMsg()
 			}
+			redis.Del("other", "/")
 			flag = "true"
 			msg = "审核成功!"
 			if (*f)["s_m_openid"] != nil {

+ 14 - 0
core/src/qfw/manage/feedback.go

@@ -7,9 +7,11 @@ package manage
 import (
 	"fmt"
 	. "gopkg.in/mgo.v2/bson"
+	"qfw/coreutil"
 	"qfw/util"
 	. "qfw/util/mongodb"
 	. "qfw/util/msg"
+	qrpc "qfw/util/rpc"
 	"strings"
 )
 
@@ -139,6 +141,18 @@ func (s *SystemManage) Updateback() error {
 		if Update("interaction", "{'_id':'"+_id+"'}", &data2, false, false) {
 			flag = "true"
 			msg = "修改成功!"
+			//
+			f := FindOne("user", "{'_id':'"+s_submitid+"'}")
+			if (*f)["s_m_openid"] != nil {
+				openid := (*f)["s_m_openid"].(string)
+				s_result := "意见反馈处理结果"
+				s_detail := s.GetString("s_opinion")
+				s_remark := s.GetString("s_record")
+				go func() {
+					coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: s_result, Detail: s_detail, Remark: s_remark})
+				}()
+			}
+
 		} else {
 			flag = "false"
 			msg = "修改失败!"

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

@@ -16,7 +16,7 @@ type Mobile struct {
 	getMyCredit   xweb.Mapper `xweb:"/member/credit/getcredit"`
 	swordfishPay  xweb.Mapper `xweb:"/member/credit/swordfishpay"`
 	msgSet        xweb.Mapper `xweb:"/swordfish/msgpushsetting/msgset"`
-	ajaxReq       xweb.Mapper `xweb:"/swordfish/ajaxReq"`
+	ajaxReq       xweb.Mapper `xweb:"/member/swordfish/ajaxReq"`
 	advise        xweb.Mapper `xweb:"/mobile/advise"`
 	adviseSave    xweb.Mapper `xweb:"/mobile/advisesave"`
 	wxpushList    xweb.Mapper `xweb:"/wxpush/bid/(.*)/(.*)/(.*)"` //推送列表

+ 46 - 11
core/src/qfw/mobile/wxmenu.go

@@ -5,12 +5,14 @@ import (
 	"fmt"
 	"log"
 	"math/rand"
+	"net/rpc"
 	"qfw/coreconfig"
 	"qfw/coreutil"
 	"qfw/util"
 	"qfw/util/credit"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
+	qrpc "qfw/util/rpc"
 	"runtime"
 	"time"
 )
@@ -134,29 +136,35 @@ func (m *Mobile) SwordfishPay() error {
 					i_credit := util.IntAll(user["i_credit"])
 					if i_credit > 0 {
 						isPay := map[string]interface{}{}
+						mapPush := map[string]string{}
 						for _, v := range types {
 							util.Try(func() {
-								obj_typei := user["o_msgset"].(map[string]interface{})[v]
 								b_newopen := false
-								if obj_typei == nil {
+								if user["o_msgset"] == nil {
 									b_newopen = true
 								} else {
-									obj_type := obj_typei.(map[string]interface{})
-									st := obj_type["i_status"]
-									objt := obj_type["l_enddate"]
-									if st == nil || objt == nil {
+									obj_typei := user["o_msgset"].(map[string]interface{})[v]
+									if obj_typei == nil {
 										b_newopen = true
 									} else {
-										//判断是否开启
-										i_st := st.(int)
-										l_objt := objt.(int64)
-										if !(i_st == 1 && l_objt > util.GetDayStartSecond(0)) {
+										obj_type := obj_typei.(map[string]interface{})
+										st := obj_type["i_status"]
+										objt := obj_type["l_enddate"]
+										if st == nil || objt == nil {
 											b_newopen = true
+										} else {
+											//判断是否开启
+											i_st := st.(int)
+											l_objt := objt.(int64)
+											if !(i_st == 1 && l_objt > util.GetDayStartSecond(0)) {
+												b_newopen = true
+											}
 										}
 									}
 								}
 								if b_newopen { //进行扣费操作
 									isPay[v] = v
+									mapPush[v] = util.If(v == "bid", "中标", "招标").(string)
 								}
 							}, func(e interface{}) {
 								log.Println(e)
@@ -164,10 +172,37 @@ func (m *Mobile) SwordfishPay() error {
 						}
 						//i_credit -= len(isPay) * 1000
 						if i_credit >= 0 {
-							if b, _ := credit.OutCreditB(userId.(string), credit.V_JY, util.ObjToString(m.GetSession("s_m_openid")), 0, isPay); b {
+							credit_a := util.IntAll(m.GetSession("credit_a"))
+							b := false
+							if b, _ = credit.OutCreditB(userId.(string), credit.V_JY, util.ObjToString(m.GetSession("s_m_openid")), 0, isPay, m.Action); b {
 								//先扣分,然后更新,然后返回结果
 								res["credit"] = i_credit
 								res["oprstatus"] = true
+								//初次提交积分时
+								//加上剑鱼是否推送过的逻辑判断
+								if !credit.AIsHasDo(credit.A_JYSCTS, credit_a) {
+									util.Try(func() {
+										//对用户进行推送
+										var repl int
+										clent, errs := rpc.DialHTTP("tcp", coreconfig.SysConfig.PushRpc)
+										defer clent.Close()
+										rpcData := qrpc.PushData{
+											Mopenid:  m.GetSession("s_m_openid").(string),
+											PushType: mapPush,
+										}
+										clent.Call("PushInfo.PushMsg", &rpcData, &repl)
+										if errs == nil {
+											//修改剑鱼占位值
+											credit.CheckSword(userId.(string), credit.A_JYSCTS, credit_a, m.Action)
+										}
+									}, func(e interface{}) {
+										log.Println("给用户摄推送出错", e)
+									})
+								}
+							}
+							//首次使用剑鱼送积分
+							if b && !credit.AIsHasDo(credit.A_SYJY, credit_a) {
+								credit.UpuserCreditSession(userId.(string), credit.A_SYJY, "A", nil, m.Action)
 							}
 						} else {
 							res["credit"] = i_credit

+ 4 - 3
core/src/qfw/search/search.go

@@ -9,9 +9,10 @@ import (
 
 type Search struct {
 	*xweb.Action
-	getEnterpriseList xweb.Mapper `xweb:"/search/enterprise/([^.]*)ent([^.]*).html"` //查询企业列表
-	sim               xweb.Mapper `xweb:"POST /search/sim"`                          //即时搜索
-	searchEntSer      xweb.Mapper `xweb:"/searchEntSer/(.*)"`                        //获取企业的服务列表
+	getEnterpriseList  xweb.Mapper `xweb:"/search/enterprise/([^.]*)ent([^.]*).html"` //查询企业列表
+	sim                xweb.Mapper `xweb:"POST /search/sim"`                          //即时搜索
+	searchEntSer       xweb.Mapper `xweb:"/searchEntSer/(.*)"`                        //获取企业的服务列表
+	findServiceByEntId xweb.Mapper `xweb:"/front/findServiceByEntId"`                 //获取企业的服务列表
 }
 
 func init() {

+ 51 - 0
core/src/qfw/search/searchService.go

@@ -78,6 +78,57 @@ func (search *Search) SearchEntSer(id string) error {
 	return nil
 }
 
+func (search *Search) FindServiceByEntId() error {
+	if search.Method() == "POST" {
+		id := search.GetString("entId")
+		limit, _ := search.GetInteger("pageSize")
+		currentPage, _ := search.GetInteger("currentPage")
+		start := (currentPage - 1) * limit
+		var count int64
+		//分页
+		mustnot := `{"term" : {"i_status" : 1 }}`
+		var fields, collection, query, tempstrquery string
+		collection = "service"
+		tempstrquery = `{"query_string":{"default_field": "s_enterpriseid","query":"` + id + `"}}`
+		servicequery := ""
+		if search.GetSession("entid") == nil || search.GetSession("entid").(string) != id {
+			servicequery = `,"must_not" : [` + mustnot + `]`
+		}
+		query = `{"query": {
+		    "bool": {
+			  "must":[` + tempstrquery + `]` + servicequery + `
+		    }
+		  }}`
+		//需要查到的字段信息
+		fields = `"_id","s_name","s_introduction","s_images","s_enterpriseid","s_isshow","i_status","s_pricemy","i_comments","f_price"`
+		if currentPage == 1 {
+			count = elastic.Count("service", collection, query)
+		}
+		//查询服务列表数据
+		result := elastic.Get("service", collection, `{"query":{"bool": {"must":[`+tempstrquery+`]`+servicequery+`}},
+		_source:[`+fields+`],
+		sort:{"l_createdate":"desc"},
+		from:`+fmt.Sprintf("%v", start)+`,
+		size:`+fmt.Sprintf("%v", limit)+`
+		}`)
+		for _, v := range *result {
+			b, _ := CheckAuth(v)
+			if b {
+				v["s_isEdit"] = "1"
+			} else {
+				v["s_isEdit"] = "0"
+			}
+			if IntAll(v["i_status"]) == 1 {
+				v["s_remove"] = 1
+			} else {
+				v["s_remove"] = 0
+			}
+		}
+		search.ServeJson(&map[string]interface{}{"list": result, "count": count})
+	}
+	return nil
+}
+
 //企业列表
 func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
 	//必须是登录之后的已认证用户才可以进入企业社区

+ 6 - 7
core/src/qfw/swordfish/swordfish.go

@@ -9,13 +9,12 @@ import (
 
 type SwordFish struct {
 	*xweb.Action
-	swordfish     xweb.Mapper `xweb:"/front/swordfish"`                 //剑鱼
-	rsssetAjaxReq xweb.Mapper `xweb:"/member/swordfish/rssset/ajaxReq"` //订阅消息设置ajax请求
-	rssSet        xweb.Mapper `xweb:"/member/swordfish/rssset"`         //订阅消息设置
-	infolist      xweb.Mapper `xweb:"/member/swordfish/infolist"`       //剑鱼
-	swordfishlist xweb.Mapper `xweb:"/member/swordfish/swordfishlist"`  //剑鱼列表
-	setVisited    xweb.Mapper `xweb:"/member/swordfish/setVisited"`     //已经访问过的列表
-	visitRedirect xweb.Mapper `xweb:"/visit/redirect"`                  //剑鱼跳转访问请求,后续统计
+	swordfish     xweb.Mapper `xweb:"/front/swordfish"`                //剑鱼
+	rssSet        xweb.Mapper `xweb:"/member/swordfish/rssset"`        //订阅消息设置
+	infolist      xweb.Mapper `xweb:"/member/swordfish/infolist"`      //剑鱼
+	swordfishlist xweb.Mapper `xweb:"/member/swordfish/swordfishlist"` //剑鱼列表
+	setVisited    xweb.Mapper `xweb:"/member/swordfish/setVisited"`    //已经访问过的列表
+	visitRedirect xweb.Mapper `xweb:"/visit/redirect"`                 //剑鱼跳转访问请求,后续统计
 }
 
 func init() {

+ 21 - 36
core/src/qfw/swordfish/swordfishmanage.go

@@ -2,8 +2,6 @@ package swordfish
 
 import (
 	"gopkg.in/mgo.v2/bson"
-	"qfw/util"
-	credit "qfw/util/credit"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
 	"time"
@@ -29,42 +27,29 @@ func (s *SwordFish) Swordfish() error {
 //跳转到订阅设置页面
 func (s *SwordFish) RssSet() error {
 	u := mongodb.FindById("user", s.GetSession("userId").(string), `{"o_msgset":1}`)
-	s.T["msgset"] = (*u)["o_msgset"]
-	return s.Render("/swordfish/rssset.html", &s.T)
-}
-func (s *SwordFish) RsssetAjaxReq() error {
-	userId := s.GetSession("userId").(string)
-	var flag = "n"
-	msgset := make(map[string]interface{})
-	//投标公告
-	if tender_flag, _ := s.GetBool("tender_flag"); tender_flag {
-		tender := make(map[string]interface{})
-		tender["a_key"] = s.GetSlice("tender_keys")
-		tender["s_scope"] = s.GetString("tender_scope")
-		msgset["tender"] = tender
-	}
-	//中标公告
-	if bid_flag, _ := s.GetBool("bid_flag"); bid_flag {
-		bid := make(map[string]interface{})
-		bid["a_key"] = s.GetSlice("bid_keys")
-		bid["s_scope"] = s.GetString("bid_scope")
-		msgset["bid"] = bid
-	}
-	//更新数据库
-	msgset["l_modifydate"] = time.Now().Unix()
-	if mongodb.Update("user", `{"_id":"`+userId+`"}`, &map[string]interface{}{"$set": map[string]interface{}{"o_msgset": msgset}}, false, false) {
-		flag = "y"
-	}
-	//首次使用剑鱼送积分
-	if flag == "y" {
-		if credit.AIsHasDo(credit.A_SYJY, util.IntAll(s.GetSession("credit_a"))) {
-			credit.UpuserCreditSession(userId, credit.A_SYJY, "A", nil, s.Action)
+	msgset := (*u)["o_msgset"]
+	if msgset != nil {
+		if set, _ := msgset.(map[string]interface{}); set != nil {
+			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)
+				}
+			}
+		}
+		if set, _ := msgset.(map[string]interface{}); set != nil {
+			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)
+				}
+			}
 		}
 	}
-	s.ServeJson(map[string]interface{}{
-		"flag": flag,
-	})
-	return nil
+	s.T["msgset"] = msgset
+	return s.Render("/swordfish/rssset.html", &s.T)
 }
 
 //跳转到用户中心剑鱼信息列表

+ 2 - 0
core/src/qfw/yellowpage/yellowpage.go

@@ -15,6 +15,8 @@ type Yellowpage struct {
 	enterpriseInfo xweb.Mapper `xweb:"/enterprise/(\\w+).html"`
 	//根据企业注册号进入企业黄页
 	enterpriseInfoByRegNO xweb.Mapper `xweb:"/enterpriseInfoByRegNO/(\\w+).html"`
+	//获取关系网数据
+	getRelation xweb.Mapper `xweb:"/member/getRelation"`
 }
 
 func (yp *Yellowpage) EnterpriseInfoByRegNO(regNO string) error {

+ 38 - 10
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -3,6 +3,7 @@ package yellowpage
 //企业黄页的操作类
 import (
 	"container/list"
+	"encoding/json"
 	"fmt"
 	_ "github.com/go-xweb/xweb"
 	mgo "gopkg.in/mgo.v2"
@@ -40,7 +41,7 @@ func FormatDate(src *interface{}) string {
 }
 
 func GetEntInfo(id string) interface{} {
-	res := FindById("enterprise", id, `{"RegNo":1, "EntName":1, "EntType":1, "EntTypeName":1, "OpLocDistrict":1, "LeRep":1, "LegCerNO":1, "Tel":1, "Dom":1, "OpScope":1, "OpFrom":1, "OpTo":1, "RegCap":1, "EstDate":1, "CompForm":1, "CompFormName":1, "OpState":1, "OpStateName":1, "RegOrgName":1, "IssBLicDate":1, "Timestamp":1, "s_synopsis":1, "SourceType":1, "NB_email":1,"IndustryPhyName":1,"investor":1, "s_enturl, "i_province":1, "i_city":1, "i_area":1,"s_action":1,"s_persion":1,"s_mobile":1,"s_address":1,"s_avatar":1,"s_microwebsite":1,"s_qq":1,"s_submitid":1,"s_email":1}`)
+	res := FindById("enterprise", id, `{"RegNo":1, "EntName":1, "EntType":1, "EntTypeName":1, "OpLocDistrict":1, "LeRep":1, "LegCerNO":1, "Tel":1, "Dom":1, "OpScope":1, "OpFrom":1, "OpTo":1, "RegCap":1, "EstDate":1, "CompForm":1, "CompFormName":1, "OpState":1, "OpStateName":1, "RegOrgName":1, "IssBLicDate":1, "Timestamp":1, "s_synopsis":1, "SourceType":1, "NB_email":1,"IndustryPhyName":1,"investor":1,"alterInfo":1, "s_enturl, "i_province":1, "i_city":1, "i_area":1,"s_action":1,"s_persion":1,"s_mobile":1,"s_address":1,"s_avatar":1,"s_microwebsite":1,"s_qq":1,"s_submitid":1,"s_email":1}`)
 	if res != nil {
 		id := (*res)["s_submitid"]
 		if id != nil {
@@ -81,10 +82,6 @@ func GetEntInfo(id string) interface{} {
 		if OpFrom != nil {
 			(*res)["EstDate"] = FormatDate(&EstDate)
 		}
-		//查询企业关系
-		//relation := Find("entrelation", &map[string]interface{}{
-		//	"aid": ObjectIdHex(id),
-		//}, nil, nil, false, -1, -1)
 		EntType, _ := (*res)["EntType"].(string)
 		//处理分公司
 		if EntType != "" {
@@ -102,8 +99,27 @@ func GetEntInfo(id string) interface{} {
 		}
 		//
 		(*res)["EntTypeLabel"] = (mobile.GetDiffName(EntType))[0]
-
 		(*res)["entid"] = id
+		//企业变更排序
+		var alterInfo []map[string]interface{}
+		if d, err := json.Marshal((*res)["alterInfo"]); err == nil {
+			json.Unmarshal(d, &alterInfo)
+		}
+		for x, _ := range alterInfo {
+			for y := 0; y < len(alterInfo)-x-1; y++ {
+				dt1, xok := alterInfo[y]["AltDate"].(float64)
+				dt2, yok := alterInfo[y+1]["AltDate"].(float64)
+				if xok && yok && dt1 < dt2 {
+					temp := alterInfo[y]
+					alterInfo[y] = alterInfo[y+1]
+					alterInfo[y+1] = temp
+				}
+			}
+		}
+		for _, v := range alterInfo {
+			log.Println(v["AltAf"])
+		}
+		(*res)["alterInfo"] = alterInfo
 		return *res
 	}
 	return nil
@@ -118,7 +134,7 @@ func (yp *Yellowpage) EnterpriseInfo(id string) error {
 		yp.T["res"] = GetEntInfo(id)
 		contentuser, erruser := yp.Render4Cache("/yellowpage/enterpriseinfo.html", &yp.T)
 		if erruser == nil {
-			redis.PutBytes("enterprise", id, &contentuser, ONEDAY)
+			redis.PutBytes("enterprise", id, &contentuser, 7*ONEDAY)
 		}
 		return yp.SetBody(contentuser)
 	}
@@ -244,9 +260,20 @@ func isContainInQueryCache(querykey string, cache *list.List) bool {
 }
 
 func (yp *Yellowpage) GetRelation() error {
-	relation := makeRelation(yp.GetString("regNo"), yp.GetString("entName"))
-	if relation != nil {
-		yp.ServeJson(M{"relation": relation})
+	if util.IntAll(yp.GetSession("identWay")) == 1 {
+		regNo := yp.GetString("regNo")
+		entName := yp.GetString("entName")
+		if regNo == "" || entName == "" {
+			return nil
+		}
+		relation := redis.Get("other", "relation-"+regNo)
+		if relation == nil {
+			relation = makeRelation(regNo, entName)
+			redis.Put("other", "relation-"+regNo, relation, 7*ONEDAY)
+		}
+		yp.ServeJson(M{"flag": true, "relation": relation})
+	} else {
+		yp.ServeJson(M{"flag": false})
 	}
 	return nil
 }
@@ -283,6 +310,7 @@ func makeRelation(mnregno, mnname string) interface{} {
 
 	for el := ls.Front(); el != nil; el = el.Next() {
 		v, _ := el.Value.([]string)
+		log.Println(v)
 		//加投资人
 		if _, ok := node[v[1]]; !ok {
 			node[v[1]] = map[string]string{

+ 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-16 15:02:30"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-16 15:02:30"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-20 08:18:24"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-20 08:18:24"}},"marketisstart":true,"marketrate":300}

+ 43 - 13
core/src/web/staticres/css/dev-qfw.css

@@ -4,6 +4,9 @@ body {
 	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
 	color: #666;
 }
+.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6{
+	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
+}
 table{
 	font-size: 14px;
 }
@@ -1000,7 +1003,6 @@ a{
 
 .a-com-ul-block {
 	width: 250px;
-	height:230px;
 }
 .a-com-ul-blocknew {
 	margin-left:1px;
@@ -2256,9 +2258,10 @@ style="color:#D03102;margin-right:5px;"
 .b-nav-logo{
 	padding-right: 40px;
 }
-.b-nav-link{
+.b-nav-main{
 	width: 120px;
 	text-align: center;
+	margin-right: 16px;
 }
 .b-nav-main a{
 	font-size: 18px;
@@ -2270,12 +2273,28 @@ style="color:#D03102;margin-right:5px;"
 	height: 20px;
 	margin-top: 25px;
 	border-left: 1px solid #e5e6e9;
-	border-right: 1px solid #ffffff;
-	float: right;
+	position: absolute;
+	right: 0px;
+	top: 50%;
+	margin-top: -10px;
+}
+.b-nav-other{
+	padding-left: 21px;
+	padding-right: 21px;
+	position: relative;
+}
+.b-nav-other a{
+	color: #4e5051;
 }
 .b-nav-other>a:hover,.b-nav-active>a{
 	font-weight: bold;
 }
+.b-head .b-loginbtn{
+	width: 40px;
+	height: 40px;
+	margin-top: 13px;
+	margin-right: 30px;
+}
 .b-head .headimg{
 	width: 40px;
 	height: 40px;
@@ -2285,7 +2304,7 @@ style="color:#D03102;margin-right:5px;"
 	padding: 0px 15px;
 	position: relative;
 }
-.b-head .b-loginStatus:hover{
+.b-head .b-logined:hover{
 	background-color: #F7F9FB;
 }
 .b-head .b-loginStatus:hover>a{
@@ -2358,12 +2377,17 @@ style="color:#D03102;margin-right:5px;"
 }
 .b-head .b-h-search{
 	padding-top: 14px;
+	padding-left: 17px;
 }
 .b-head .b-h-search .input-group{
 	width: 300px;
 }
 .b-head .b-h-search .form-control{
 	border-radius: 50px !important;
+	color: #a0a0a0;
+	box-shadow: none;
+	border-color: #e5e6e9;
+	padding-left: 21px;
 }
 .b-head .b-h-search form>span i {
     position: absolute;
@@ -2376,15 +2400,15 @@ style="color:#D03102;margin-right:5px;"
 }
 .b-head .b-h-search form>span{
     position: absolute;
-    right: 10px;    
+	right: 10px;
 	border-radius: 50px;
-    top: 50%;
-    z-index: 20;
-    margin-top: -19px;
-	margin-right:-10px;
-    display: inline-block;
-	width:38px;
-	height:38px;
+	top: 50%;
+	z-index: 20;
+	margin-top: -17px;
+	margin-right: -11px;
+	display: inline-block;
+	width: 35px;
+	height: 35px;
 }
 .b-content{
 	padding: 15px 0px 15px 0px;
@@ -2412,6 +2436,12 @@ style="color:#D03102;margin-right:5px;"
 	padding: 10px 10px 10px 20px;
 	font-size: 16px;
 }
+.b-modal .modal-header-jy{
+	background-color: #37C6DA;
+	color: #FFFFFF;
+	padding: 10px 10px 10px 20px;
+	font-size: 16px;
+}
 .b-modal .modal-header .close{
 	opacity: 1;
 	text-shadow: none;

+ 176 - 75
core/src/web/staticres/css/entcommunity.css

@@ -34,9 +34,6 @@ a:focus, a:hover{
 .ttcon ul li:hover{
 	color: #16a086;
 }
-.text-primary{
-	color: #16a086 !important;
-}
 .entlist-page .nav-tabs{
 	background-color: #f7f8fa;
 	margin-top: 20px;
@@ -152,7 +149,6 @@ a:focus, a:hover{
 }
 .entinfo-page .b-com-head .b-com-last a{
 	color: blue;
-	margin-left: 10px;
 }
 .white_content {
 	display: none;
@@ -198,12 +194,12 @@ a:focus, a:hover{
 	width: 60px;
 	cursor: pointer;
 }
-.entinfo-tab{
+.ent-tab{
 	height: 50px;
 	background-color: #F6F8FA;
 	padding-left: 20px;
 }
-.entinfo-tab li{
+.ent-tab li{
 	padding: 0px 20px;
 	border-top-width: 3px;
 	height: 47px;
@@ -213,37 +209,22 @@ a:focus, a:hover{
 	border-right: 1px solid #FFFFFF;
 	font-weight: bold;
 }
-.entinfo-tab .entinfo-active{
+.ent-tab .ent-active{
 	border-top-color: #16a086;
 	background-color: #FFFFFF;
 	color: #16a086;
 	border-right-width: 0px
 }
-.entinfo-tab-content{
+.ent-tab-content{
 	margin-top: 10px;
 	background-color: #FFFFFF;
 	padding-top: 20px;
+	padding-bottom: 20px;
 }
 /********************企业画像**********************/
-.entinfo-basicinfo{
-	padding: 0px 20px;
-}
-.entinfo-basicinfo .b-com-title{
-	font-size: 18px;
-	padding-left: 5px;
-	border-bottom: 1px solid #DFE0E2;
-	padding-bottom: 10px;
-}
-.entinfo-basicinfo .b-com-title span{
-	color: #16a086;
-	margin-right: 5px;
-}
-.entinfo-basicinfo .b-com-title font{
-	font-size: 14px;
-	margin-left: 5px;
-}
 .entinfo-basicinfo .b-com-content{
-	padding: 90px 0px;
+	padding-top: 60px !important;
+	padding-bottom: 60px !important;
 }
 .entinfo-basicinfo .entinfo-round{
 	border: 1px solid #DFE0E2;
@@ -257,7 +238,7 @@ a:focus, a:hover{
 	position: absolute;
 }
 .entinfo-basicinfo .entinfo-round>div:first-child{
-	top: 130px;
+	top: 100px;
 	left: 15px;
 	width: 320px;
 	padding-left: 50px;
@@ -266,10 +247,14 @@ a:focus, a:hover{
 	position: relative;
 	display: block;
 	width: 320px;
-	margin-bottom: 10px;
 	margin-left: -50px;
 	text-align: center;
 }
+.entinfo-basicinfo .entinfo-round>div:first-child>span>img{
+	width: 15px;
+	height: 11px;
+	margin: 5px 0px;
+}
 .entinfo-basicinfo .entinfo-round>div:first-child>span>div:first-child{
 	font-size: 18px;
 	font-weight: bold;
@@ -334,8 +319,8 @@ a:focus, a:hover{
 	text-align: right;
 }
 .entinfo-basicinfo .entinfo-estdate>img{
-	width: 30px;
-	height: 67px;
+	width: 34px;
+	height: 76.5px;
 	margin-top: -20px;
 	right: -35px !important;
 }
@@ -350,8 +335,8 @@ a:focus, a:hover{
 	text-align: right;
 }
 .entinfo-basicinfo .entinfo-regcap>img{
-	width: 40px;
-	height: 40px;
+	width: 36px;
+	height: 36.5px;
 }
 .entinfo-basicinfo .entinfo-regcap-round{
 	top: 120px;
@@ -378,8 +363,8 @@ a:focus, a:hover{
 	text-align: right;
 }
 .entinfo-basicinfo .entinfo-lerep>img{
-	width: 40px;
-	height: 42.5px;
+	width: 48px;
+	height: 51px;
 }
 .entinfo-basicinfo .entinfo-lerep-round{
 	top: 315px;
@@ -391,8 +376,8 @@ a:focus, a:hover{
 	top: 330px;
 }
 .entinfo-basicinfo .entinfo-entscale>img{
-	width: 40px;
-	height: 33px;
+	width: 50.5px;
+	height: 43.5px;
 	left: -45px;
 }
 .entinfo-basicinfo .entinfo-entscale-round{
@@ -405,8 +390,8 @@ a:focus, a:hover{
 	top: 225px
 }
 .entinfo-basicinfo .entinfo-regorgname>img{
-	width: 40px;
-	height: 51px;
+	width: 37px;
+	height: 48px;
 	left: -45px;
 }
 .entinfo-basicinfo .entinfo-regorgname-round{
@@ -419,8 +404,8 @@ a:focus, a:hover{
 	left: 380px;
 }
 .entinfo-basicinfo .entinfo-dom>img{
-	width: 30px;
-	height: 40px;
+	width: 33px;
+	height: 45px;
 	left: -35px;
 }
 .entinfo-basicinfo .entinfo-dom-round{
@@ -433,8 +418,8 @@ a:focus, a:hover{
 	top: -28px;
 }
 .entinfo-basicinfo .entinfo-operperiod>img{
-	width: 40px;
-	height: 40px;
+	width: 49.5px;
+	height: 49.5px;
 	left: -45px;
 }
 .entinfo-basicinfo .entinfo-operperiod-round{
@@ -442,28 +427,6 @@ a:focus, a:hover{
 	right: 100px;
 }
 /*股东信息*/
-.entinfo-shareholderinfo>div{
-	margin-bottom: 30px;
-}
-.entinfo-shareholderinfo>div{
-	font-size: 16px;
-	color: #16a086;
-}
-.entinfo-shareholderinfo>div>span{
-	background-color: #AEE7D6;
-	font-size: 14px;
-	margin-right: 10px;
-	display: inline-block;
-	line-height: 25px;
-	text-align: center;
-	width: 25px;
-	height: 25px;
-	color: #FFFFFF;
-}
-.entinfo-shareholderinfo ul{
-	padding-left: 50px;
-	padding-bottom: 60px;
-}
 .entinfo-shareholderinfo li{
 	margin-right: 40px;
 	margin-bottom: 20px;
@@ -487,11 +450,12 @@ a:focus, a:hover{
 }
 /********************关系网**********************/
 .entrelation{
-	
+	position: relative;
+	padding: 0px 20px;
 }
-.entrelation-legend{
-	float:left;
-	height:500px;
+.entrelation svg{
+	position: relative;
+	z-index: 1;
 }
 .legend-text-bg>div{
     position: absolute;
@@ -502,35 +466,35 @@ a:focus, a:hover{
     line-height: 25px;
     text-align: center;
 	margin-top: -3px;
-	z-index: -1;
 }
 .legend-text-bg>span{
 	position: relative;
 }
 /*全屏代码*/
-.entrelation-infovis .entrelation-controlls{
+.entrelation .entrelation-controlls{
 	position: absolute;
 	margin-top: 10px;
+	z-index: 2;
 }
-.entrelation-infovis .entrelation-controlls .entrelation-item{
+.entrelation .entrelation-controlls .entrelation-item{
 	border-radius: 2px;
 	box-shadow: 0 1px 4px rgba(0,0,0,0.3);
 	cursor: pointer;
 	margin-bottom: 8px;
 	float:left;
 }
-.entrelation-infovis .entrelation-controlls .entrelation-box{
+.entrelation .entrelation-controlls .entrelation-box{
 	padding:10px;
 	float:left;
 }
-.entrelation-infovis .entrelation-controlls .entrelation-box div{
+.entrelation .entrelation-controlls .entrelation-box div{
 	background: url(/images/view_icons.png) no-repeat;
 	width: 16px;
 	height: 16px;
 	opacity: 0.6;
 }
-:-moz-full-screen .entrelation-infovis,:-webkit-full-screen .entrelation-infovis,:-o-full-screen .entrelation-infovis,
-:-ms-full-screen .entrelation-infovis,:fullscreen .entrelation-infovis,:-ms-fullscreen .entrelation-infovis,:full-screen .entrelation-infovis{
+:-moz-full-screen .entrelation,:-webkit-full-screen .entrelation,:-o-full-screen .entrelation,
+:-ms-full-screen .entrelation,:fullscreen .entrelation,:-ms-fullscreen .entrelation,:full-screen .entrelation{
   width: 100%;
   height: 100%;
   background-color:#fff;
@@ -556,3 +520,140 @@ a:focus, a:hover{
 :full-screen {
 	background: #fff; 
 }
+.ent-findnull{
+	text-align: center;
+	padding: 50px 0px;
+}
+.entrelation-limit>div{
+	border-bottom: 1px solid #e5e6e9;
+	padding-top: 50px;
+	padding-bottom: 85px;
+}
+.entrelation-limit>img{
+	margin-top: 10px;
+}
+.entrelation-limit .btn{
+	margin-top: 20px;
+	width: 200px;
+}
+/*************产品服务******************/
+.ent-service{
+	padding: 0px 20px;
+}
+.ent-service td img{
+	width: 110px;
+	height: 101px;
+}
+/**************变更信息**********************/
+.ent-alterinfo li{
+	width: 100%;
+	display: table;
+}
+.ent-alterinfo li>div{
+	position: relative;
+	display: table-cell;
+	width: 50%;
+	padding-bottom: 20px;
+}
+.ent-alterinfo li:last-of-type>div{
+	padding: 0px;
+}
+.ent-alterinfo ul li:nth-child(odd)>div:first-child{
+	visibility: hidden;
+}
+.ent-alterinfo ul li:nth-child(odd)>div:last-child{
+	border-left: 1px solid #16a086;
+	padding-left: 20px;
+	left: -1px;
+}
+.ent-alterinfo ul li:nth-child(odd) a{
+	left: -6px;
+}
+.ent-alterinfo ul li:nth-child(even) a{
+	right: -6px;
+}
+.ent-alterinfo ul li:nth-child(even)>div:first-child{
+	border-right: 1px solid #16a086;
+	text-align: right;
+	padding-right: 20px;
+}
+.ent-alterinfo ul li:nth-child(even)>div:last-child{
+	visibility: hidden;
+}
+.ent-alterinfo li a{
+	display: block;
+	width: 11px;
+	height: 11px;
+	border-radius: 50%;
+	background-color: #16a086;
+	position: absolute;
+	top: 0px;
+}
+.ent-alterinfo li>div>div{
+	margin-bottom: 10px;
+	margin-top: -5px;
+}
+.ent-alterinfo li>div>div:first-of-type{
+	font-size: 16px;
+	color: #16a086;
+	font-weight: bold;
+}
+.ent-alterinfo li>div>div:last-of-type{
+	color: #A0A0A0;
+}
+/************公用****************/
+.ent-layout-up{
+	padding: 0px 20px;
+}
+.ent-layout-up .b-com-title{
+	font-size: 18px;
+	padding-left: 5px;
+	border-bottom: 1px solid #DFE0E2;
+	padding-bottom: 10px;
+}
+.ent-layout-up .b-com-title span{
+	color: #16a086;
+	margin-right: 5px;
+}
+.ent-layout-up .b-com-title font{
+	font-size: 14px;
+	margin-left: 5px;
+}
+.ent-layout-up .b-com-content{
+	padding-top: 30px;
+	padding-bottom: 30px;
+}
+.ent-layout-down .b-com-content{
+	padding: 30px 20px;
+}
+.ent-layout-down .b-com-title{
+	font-size: 16px;
+	color: #16a086;
+}
+.ent-layout-down .b-com-title>span{
+	background-color: #AEE7D6;
+	font-size: 14px;
+	margin-right: 10px;
+	display: inline-block;
+	line-height: 25px;
+	text-align: center;
+	width: 25px;
+	height: 25px;
+	color: #FFFFFF;
+}
+.ent-table td{
+	padding: 15px 0px !important;
+	border-top: none !important;
+}
+.ent-table tr:first-child{
+	border-top: none !important;
+}
+.ent-table tr:nth-child(2n+1){
+	border-top: 1px solid #e5e6e9;
+	font-size: 16px;
+}
+.ent-table .b-com-name{
+	font-weight: bold;
+	word-wrap: break-word;
+	word-break: normal;
+}

+ 92 - 5
core/src/web/staticres/css/index-new.css

@@ -195,7 +195,7 @@ a:focus, a:hover{
 	margin-right:8px;
 }
 .a-index  .index-new-xwzx-con .index-new-xwzx-title{
-	width:210px;
+	width:200px;
     font-weight: 700;
     font-size: 16px;
 	white-space:nowrap;
@@ -210,7 +210,7 @@ a:focus, a:hover{
 }
 .a-index  .index-new-xwzx-con .index-new-xwzx-content{
 	height:40px;
-	width:210px;
+	width:200px;
     font-family: '宋体 Regular', '宋体';
     font-size: 12px;
     color: #A0A0A0;
@@ -388,7 +388,7 @@ a:focus, a:hover{
 .index-new-wgw-nameent{
 	position:absolute; 
 	z-index:4; 
-	top:184px; 
+	top:199px; 
 	left:10px;
 }
 .index-new-rmfw-nameent a {
@@ -401,7 +401,7 @@ a:focus, a:hover{
 	top:163px; 
 	left:-1px;
 }
-.index-new-rmfw-bg1 span,.index-new-wgw-bg1 span{
+.index-new-rmfw-bg1 span{
 	border-top:3px solid #FF5A5F;
 	display:inline-block;
 	width:250px; 
@@ -411,6 +411,21 @@ a:focus, a:hover{
 	background-position:-1px -2px;
 	background-size: 252px 67px;
 }
+.index-new-wgw-bg1 span{
+	border-top:3px solid #FF5A5F;
+	display:inline-block;
+	width:250px; 
+	height:45px;
+	background-image:url(/images/u46.png);
+	background-repeat:no-repeat;
+	background-position:-1px -2px;
+	background-size: 252px 45px;	
+}
+.index-new-wgw-bg1 {
+	position: absolute;
+	top: 185px;
+	left: -1px;
+}
 .index-new-rmfw-remarktitle{
     font-size: 16px;
     color: #FFFFFF;
@@ -530,6 +545,78 @@ a:focus, a:hover{
 .fw-new-content .fw-new-zh span,.fw-new-content .fw-new-yzm span{
 	float:right;margin:10px -5px 0px 0px;
 }
-.fw-new-content .afterSendIdentCode{
+.index-new-tg{
+	padding: 20px 30px;
+	margin-bottom:30px;
+}
+.index-new-tg .row{
+	border:1px solid #f0f0f0;
+}
+.index-new-tg-tb img{
+	width:36px;
+	height:39px;
+	margin-bottom:1px;
+}
+.index-new-tg-tb{
+	height:120px;
+	padding-right:0px;
+}
+.index-new-mingcheng div{
+	background-color:#FF5A5F;
+	color:#FFF;
+	padding:24px 6px;
+	height:120px;
+	width:36px; 
+	border:1px solid #FF5A5F;
+	font-size: 16px;
+}
+.index-new-mingcheng1 div{
+	height: 119px;
+	background-color:#00bcd4;
+	color:#FFF;
+	padding:24px 6px;
+	width:36px; 
+	border:1px solid #00bcd4;
+	font-size: 16px;
+	
+}
+.index-new-mingcheng2 div{
+	height: 119px;
+	background-color:#16a086;
+	color:#FFF;
+	padding:24px 6px;
+	width:36px; 
+	border:1px solid #16a086;
+	font-size: 16px;
 	
 }
+.index-new-tg-con ul li{
+	padding:5px;
+}    
+.index-new-tg-con>ul>li>span:nth-child(1){
+	display:inline-block;
+	margin-left: 45px;
+	margin-bottom: 8px;
+	width: 4px;
+	height: 4px;
+	border:1px solid #D1D1D1;
+	background-color:#D1D1D1;
+}
+.index-new-tg-con>ul>li>span:nth-child(2){
+	display:inline-block;
+	width:330px;
+	padding-left:10px;
+	padding-right: 10px;
+	color:#4E5051;
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+}
+.index-new-tg-con>ul>li>span:nth-child(3){
+	font-family: '宋体 Regular', '宋体';
+	color:#A0A0A0;
+	font-size:12px;
+}
+.index-new-tg-tb .bmrzqy img{
+	margin-bottom:0px;
+}

+ 9 - 4
core/src/web/staticres/css/qfw.css

@@ -155,9 +155,9 @@ a.new_red:hover, a.new_red:active {
 }
 /* 底部 */
 .qfw-bottom {
-	background: url("../images/bottom_bg.jpg");
+	background: url("../images/bottom_bg_new.jpg");
 	font-size: 12px;
-	height: 122px;
+	height: 120px;
 	padding: 0px;
 }
 
@@ -170,13 +170,14 @@ a.new_red:hover, a.new_red:active {
 
 .qfw-bottom>div {
 	display: inline-block;
+	font-size:14px;
 }
 
 .qfw-bottom img {
 	vertical-align: text-bottom;
 	margin-top: 26px;
-	width: 70px;
-	height: 70px;
+	width: 50px;
+	height: 52px;
 }
 
 .qfw-bottom-text span {
@@ -953,6 +954,10 @@ span.highlight {
 	content: "\5F";
 }
 
+.rili:before{
+	content: "\60";
+}
+
 .icon-small {
 	font-size: 12px;
 }

+ 32 - 1
core/src/web/staticres/css/swordfish.css

@@ -47,6 +47,21 @@ a:focus, a:hover{
 	padding-left: 3px;
 	padding-top: 1px;
 }
+.swordfish-page-title span{
+	margin-right: 5px;
+	width: 25px;
+	height: 25px;
+	font-size: 14px;
+	color: #CCCCCC;
+	text-align: center;
+	padding-left: 3px;
+	padding-top: 1px;
+	font-weight: normal;
+}
+.swordfish-page-title a{
+	color: #37C6DA;
+	font-weight: normal;
+}
 /*剑鱼设置页面*/
 .swordfish-rssset .btn{
 	background-color: #37C6DA;
@@ -73,6 +88,11 @@ a:focus, a:hover{
 	border: 1px solid #F5DC99;
 	text-indent: 2em;
 }
+.swordfish-explain2{
+	background-color: #FCF8E3;
+	padding: 10px 30px;
+	text-indent: 2em;
+}
 .swordfish-explain span{
 	color: #A0A0A0;
 }
@@ -95,6 +115,13 @@ a:focus, a:hover{
 	font-size: 14px;
 	font-weight: normal;
 	margin-left: 10px;
+	color: #666666;
+}
+.swordfish-panel-t a{
+	font-size: 14px;
+	font-weight: normal;
+	margin-left: 10px;
+	color: #37C6DC;
 }
 .swordfish-panel-t img{
 	width: 15px;
@@ -160,7 +187,7 @@ a:focus, a:hover{
 }
 .swordfish-keywords lable{
 	display: inline-block;
-	width: 70px;
+	width: 75px;
 }
 .swordfish-keywords img{
 	width: 20px;
@@ -307,6 +334,10 @@ a:focus, a:hover{
 	border-radius: 8px !important;
 	margin-right: 10px;
 }
+.btn-primary, .btn-primary:hover, .btn-primary:focus, .btn-primary:active {
+    background-color: #37C6DA;
+    border-color: #37C6DA;
+}
 @media (max-width: 1200px) {
 	.b-left{
 		width: 100%;

二進制
core/src/web/staticres/fonts.zip


二進制
core/src/web/staticres/fonts/qimingxing.eot


二進制
core/src/web/staticres/fonts/qimingxing.svg


二進制
core/src/web/staticres/fonts/qimingxing.ttf


二進制
core/src/web/staticres/fonts/qimingxing.woff


二進制
core/src/web/staticres/images/activeimages/btn_end.png


二進制
core/src/web/staticres/images/bottom_bg.jpg


二進制
core/src/web/staticres/images/bottom_bg.png


二進制
core/src/web/staticres/images/bottom_bg_bak.jpg


二進制
core/src/web/staticres/images/bottom_bg_bak.png


二進制
core/src/web/staticres/images/bottom_bg_new.jpg


二進制
core/src/web/staticres/images/bottom_logo.png


二進制
core/src/web/staticres/images/bottom_logo_bak.png


二進制
core/src/web/staticres/images/entcommunity/qq.png


二進制
core/src/web/staticres/images/entcommunity/relation.png


二進制
core/src/web/staticres/images/entcommunity/triangle.png


二進制
core/src/web/staticres/images/u0115.png


二進制
core/src/web/staticres/images/u0116.png


二進制
core/src/web/staticres/images/u0117.png


二進制
core/src/web/staticres/images/u0118.png


二進制
core/src/web/staticres/images/u0119.png


二進制
core/src/web/staticres/images/u0120.png


二進制
core/src/web/staticres/images/u2181.png


+ 82 - 1123
core/src/web/staticres/js/entportrait.js

@@ -1,25 +1,31 @@
 var entType = "企业";
+var relation = null;
+var serviceList = null;
 with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
 //解析服务列表
-$(function(){	
-	//重绘关系网
-	try{		
-	//	redraw();	
-	}catch(e){}
+$(function(){
 	//联系地址
-	if($chiancity){
-		setcxSelect();	
-		var pt=province?($("#provincesel option[value="+province+"]").text()):"";
-		var ct=city?($("#citysel option[value="+city+"]").text()):"";
-		var at=area?($("#areasel option[value="+area+"]").text()):"";
-		//设置地图上显示的位置
-		$("#location").attr("value",as1);
-		$("#cityname").attr("value",pt.trim()+ct.trim()+at.trim());		
-		//获取地图的经纬度
-		doOptions();
-		$("#city_china").text(pt+ct+at+as1);
-	}else{	
-		setcxSelect();
+	if(address){
+		loadJS("/js/jquery.cxselect.js",function(){
+			$('#city_china').cxSelect({
+				selects: ['province', 'city', 'area'],
+				required:0
+			});
+			$.cxSelect.setVal(province,city,area);
+			var pt=province?($("#provincesel option[value="+province+"]").text()):"";
+			var ct=city?($("#citysel option[value="+city+"]").text()):"";
+			var at=area?($("#areasel option[value="+area+"]").text()):"";
+			//设置地图上显示的位置
+			$("#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();
+				});
+			});
+			$("#city_china").text(pt+ct+at+as1);
+		});
 	}
 	//隐藏地图
 	$("#fade").click(closeMap);
@@ -28,14 +34,19 @@ $(function(){
 		$(".bdsharebuttonbox").show();
 	});
 	//切换
-	$(".entinfo-tab>li").click(function(){
-		$(".entinfo-tab>li").removeClass("entinfo-active");
-		$(this).addClass("entinfo-active");
-		$(".entinfo-tab-content>div").addClass("hide");
-		$(".entinfo-tab-content>div:eq("+$(this).index()+")").removeClass("hide");
+	$(".ent-tab>li").click(function(){
+		$(".ent-tab>li").removeClass("ent-active");
+		$(this).addClass("ent-active");
+		$(".ent-tab-content>div").addClass("hide");
+		$(".ent-tab-content>div:eq("+$(this).index()+")").removeClass("hide");
+		if($(this).index() == 1){
+			b_afterLogin();
+		}else if($(this).index() == 5 && serviceList == null){
+			//加载服务列表
+			serviceList = new ServiceList();
+		}
 	});
-	//加载服务列表
-	initServiceList();
+	new ServiceList();
 });
 //显示地图
 function showMap(){
@@ -51,1111 +62,59 @@ function closeMap(){
 	document.getElementById('fade').style.display = 'none';
 	$("html,body").removeClass("overflow-hidden");
 }
-//关系网初始化
-function Relation(data){
-	this.zoomlevel = 1;
-	//关系网的设置
-	$("#entrelation-fullscreen").bind("click",initFullScreen);
-	var w = parseInt($("#entrelation").css("width").replace("px","")) - 80;
-	$("#entrelation-infovis").css("width",w+"px");
-	var h = $("#entrelation-infovis").height();
-	if($(".entrelation-controlls").length>0){
-		$(".entrelation-controlls").css({left:$("#entrelation").width()-$(".entrelation-controlls").width()-30});
-	}
-	//查找逻辑
-	var index=-1;
-	var reg = new RegExp(/(有限公司|有限责任公司|股份有限公司|总公司|分公司|公司|事务所|合伙企业)$|\(.*\)|\(.*\)/g);
-	/*var provinces = [];
-	$.ajax({
-		url: "/js/provinceData.min.json",
-		dataType: "json",
-		cache: true,
-		async: false,
-		success: function(json){
-			provinces = json;
-		}
-	});*/
-	var filterEntName = function(text){
-		this.allProvinces = "河南省、青海省、山西省、黑龙江省、安徽省、广西壮族自治区、西藏自治区";
-		this.commonReplace = function(t){
-			if(t.length > 1 && text.startWith(t)){
-				var textCopy = text.replace(new RegExp("^"+t),"");
-				if(textCopy.length > 2){
-					text = textCopy;
-				}
-				return true;
-			}
-			return false;
-		};
-		this.replaceStart = function(t,f){
-			var flag = false;
-			var minus = null;
-			if(this.commonReplace(t)){//替换省、市、县、区
-				return true;
-			}
-			if(f){//不替换
-				flag = false;
-			}else if(t.endWith("维吾尔自治区")){
-				flag = true;
-				minus = 6;
-			}else if(t.endWith("回族自治区") || t.endWith("壮族自治区") || t.endWith("特别行政区")){
-				flag = true;
-				minus = 5;
-			}else if(t.endWith("自治州") || t.endWith("自治县") || t.endWith("自治区")){
-				flag = true;
-				minus = 3;
-			}else if(t.endWith("地区")){
-				flag = true;
-				minus = 2;
-			}else if(t.endWith("省") || t.endWith("市") || t.endWith("区")){
-				flag = true;
-				minus = 1;
-			}
-			if(flag){
-				return this.commonReplace(t.substring(0,t.length-minus));
-			}
-			return false;
-		};
-		this.replaceCity = function(citys){
-			if(citys){
-				for(var c in citys){//市
-					var c_name = citys[c].n;
-					if(this.replaceStart(c_name)){
-						this.replaceAreas(citys[c].s);
-						return true;
-					}else if(this.replaceAreas(citys[c].s)){
-						return true;
-					}
-				}
-			}
-		};
-		this.replaceAreas = function(areas){
-			if(areas){
-				for(var a in areas){//县、区
-					var a_name = areas[a].n;
-					if(this.replaceStart(a_name,true)){
-						return true;
-					}
-				}
-			}
-		};
-		for(var p in provinces){//省
-			var p_name = provinces[p].n;
-			if(this.allProvinces.indexOf(p_name) == -1){
-				continue;
-			}
-			if(this.replaceStart(p_name)){
-				this.replaceCity(provinces[p].s);
-				break;
-			}else if(this.replaceCity(provinces[p].s)){
-				break;
-			}
-		}
-		return text;
-	}
-	for(var i=0;i<data.nodes.length;i++){
-		var nodeObj = data.nodes[i];
-		nodeObj.text = $.trim(nodeObj.text);
-		nodeObj.shortText = nodeObj.text;
-		if(nodeObj.type == "e" || nodeObj.type == "ce"){
-			var text = nodeObj.shortText;
-			if(text.length > 2){//先替换结尾
-				text = text.replace(reg,"");
-			}
-			if(text.length > 2){//再替换开头
-				//text = filterEntName(text);
-			}
-			if(text.length > 2){//小于两个字符不生效
-				nodeObj.shortText = text;
-			}
-			if(nodeObj.name==regno){//先找本企业位置
-				index=i;
-				nodeObj["regcap"] = (typeof(d1) == "undefined")?0:d1;
-				nodeObj["legcerno"] = legcerno;
-			}
-		}
-	}
-	/*********************************连线处理***********************************/
-	var minLink=-1,maxLink=-1;
-	for(var i=0;i<data.links.length;i++){
-		var linkObj = data.links[i];
-		if(linkObj.target==index && data.nodes[linkObj.source].name==legcerno){
-			//data.nodes[linkObj.source].type="cp";
-			linkObj.type = "cp"
-			linkObj.isLegal = 1;
-		}
-		//
-		data.nodes[linkObj.target]["istarget"] = 1;
-		if(data.nodes[linkObj.source].name == data.nodes[linkObj.target].invlegcerno || data.nodes[linkObj.source].name ==	data.nodes[linkObj.target].legcerno){
-			linkObj.isLegal = 1;
-		}
-		if(typeof(linkObj.invacconam) == "undefined"){
-			continue;
-		}
-		var invacconam = new Number(linkObj.invacconam);
-		if(minLink == -1 && maxLink == -1){
-			minLink = invacconam;
-			maxLink = invacconam;
-		}else if(invacconam > maxLink){
-			maxLink = invacconam; 
-		}else if(invacconam < minLink){
-			minLink = invacconam;
-		}
-	}
-	var getLineSectionArray = function(){
-		var countSection = 6;
-		var section = (maxLink - minLink) / countSection;
-		var sectionArr = [];
-		for(var i=2;i<=countSection;i++){
-			var minVal = minLink;
-			if(sectionArr.length > 0){
-				minVal = sectionArr[sectionArr.length - 1].maxVal;
-			}
-			var maxVal = minLink+section*i;
-			if(i == countSection){
-				maxVal += section;
-			}
-			var sectionObj = {linkVal:i,minVal:minVal,maxVal:maxVal};
-			sectionArr.push(sectionObj);
-		}
-		return sectionArr;
-	}
-	/////////////
-	var linkSectionArray = getLineSectionArray();
-	for(var i=0;i<data.links.length;i++){
-		var linksObj = data.links[i];
-		linksObj["linkVal"] = 2;
-		if(typeof(linkObj.invacconam) == "undefined"){
-			continue;
-		}
-		var invacconam = new Number(linksObj.invacconam);
-		for(var s in linkSectionArray){
-			var sectionObj = linkSectionArray[s];
-			if(invacconam >= sectionObj.minVal && invacconam < sectionObj.maxVal){
-				linksObj["linkVal"] = sectionObj.linkVal;
-				continue;
-			}
-		}
-	}
-	/*********************************节点处理***********************************/
-	var minNode=-1,maxNode=-1;
-	for(var i=0;i<data.nodes.length;i++){
-		var nodeObj = data.nodes[i];
-		if(nodeObj.type == "e" || nodeObj.type == "ce"){
-			var regcap = nodeObj.regcap;
-			if(minNode == -1 && maxNode == -1){
-				minNode = regcap;
-				maxNode = regcap;
-			}else if(regcap > maxNode){
-				maxNode = regcap; 
-			}else if(regcap < minNode){
-				minNode = regcap;
-			}
-		}
-	}
-	var getNodeSectionArray = function(){
-		var countSection = 7;
-		var section = (maxNode - minNode) / countSection;
-		var sectionArr = [];
-		for(var i=1;i<=countSection;i++){
-			var minVal = minNode;
-			if(sectionArr.length > 0){
-				minVal = sectionArr[sectionArr.length - 1].maxVal;
-			}
-			var maxVal = minNode+section*i;
-			if(i == countSection){
-				maxVal += section;
-			}
-			var sectionObj = {nodeVal:6+i,minVal:minVal,maxVal:maxVal};
-			sectionArr.push(sectionObj);
-		}
-		return sectionArr;
+function b_afterLogin(flag){
+	if($(".ent-tab>li:eq(1)").hasClass("ent-active") && relation == null){
+		initRelation();
 	}
-	var nodeSectionArray = getNodeSectionArray();
-	for(var i=0;i<data.nodes.length;i++){
-		var nodeObj = data.nodes[i];
-		nodeObj["nodeVal"] = 7;
-		if(nodeObj.type == "e" || nodeObj.type == "ce"){
-			var invacconam = new Number(nodeObj.invacconam);
-			var regcap = new Number(nodeObj.regcap);
-			for(var s in nodeSectionArray){
-				var sectionObj = nodeSectionArray[s];
-				if(regcap >= sectionObj.minVal && regcap < sectionObj.maxVal){
-					nodeObj["nodeVal"] = sectionObj.nodeVal;
-					continue;
-				}
-			}
-		}
-	}
-	//屏蔽鼠标右点击事件
-	if(document.getElementById("entrelation-infovis")){
-		document.getElementById("entrelation-infovis").oncontextmenu=function(){return false;};
-	}
-	$("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));	
- 	//处理全屏
- 	function launchFullScreen(element) {
-	  	if(element){
-		  	if (element.requestFullscreen) {
-		      element.requestFullscreen();
-		    } else if (element.msRequestFullscreen) {
-		      element.msRequestFullscreen();
-		    } else if (element.mozRequestFullScreen) {
-		      element.mozRequestFullScreen();
-		    } else if (element.webkitRequestFullscreen) {
-				// 对 Chrome 特殊处理,
-		        // 参数 Element.ALLOW_KEYBOARD_INPUT 使全屏状态中可以键盘输入。
-		        if ( window.navigator.userAgent.toUpperCase().indexOf( 'CHROME' ) >= 0 ) {
-		              element.webkitRequestFullScreen( Element.ALLOW_KEYBOARD_INPUT );
-		        }else {
-					// Safari 浏览器中,如果方法内有参数,则 Fullscreen 功能不可用。
-		           element.webkitRequestFullScreen();
-		        }
-		    }
-	  	}
-	}
-	function cancelFullScreen() {
-		h = $("#entrelation-infovis").height();  
-		$("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));	
-		//force.linkDistance(120).charge(-200).size([w,h]).resume();
-		$("#entrelation-infovis").css({width:w,height:h});
-		//设置svg标签的宽度与高度
-		d3.select("svg").attr("width", w).attr("height", h);
-		$(".entrelation-controlls").css({left:$("#entrelation").width()-$(".entrelation-controlls").width()-30});
-	    if(document.exitFullscreen) {
-	      document.exitFullscreen();
-	    } else if (document.msExitFullscreen) {
-	      document.msExitFullscreen();
-	    } else if (document.mozCancelFullScreen) {
-	      document.mozCancelFullScreen();
-	    } else if (document.webkitExitFullscreen) {
-	      document.webkitExitFullscreen();
-	    }
-	}
-	$(document).on('webkitfullscreenchange mozfullscreenchange msfullscreenchange fullscreenchange', function(){
-	    if (!document.fullscreenElement &&    // alternative standard method
-	    !document.mozFullScreenElement && 
-	    !document.webkitFullscreenElement && 
-	    !document.msFullscreenElement ) {
-		//退出
-		cancelFullScreen();
-	});
-   	var infovisdiv = document.getElementById("entrelation-infovis");
-	document.onkeydown=function(event){
-        var e = event || window.event || arguments.callee.caller.arguments[0];
-        if(e && e.keyCode==122){
-			event.preventDefault?event.preventDefault():window.event.returnValue = false;
-			if(!!window.ActiveXObject || "ActiveXObject" in window){//ie下F11不能用,屏蔽掉
-				if($(".exit").length == 0){
-					return;
-				}
-			}
-			initFullScreen();
-        }else if(e && e.keyCode==27){
-			event.preventDefault?event.preventDefault():window.event.returnValue = false;
-			cancelFullScreen();
-		}
-    };  
-	function initFullScreen(){
-		var fullscreenElement =
-        document.fullscreenElement ||
-        document.mozFullScreenElement ||
-        document.webkitFullscreenElement ||
-		document.msFullscreenElement;
-	    $(".entrelation-fullscreen").toggleClass("exit");
-		if(!fullscreenElement || fullscreenElement==null){
-			redrawflag = true;
-			$("#entrelation-fullscreen").attr("title","退出全屏视图 (F11)");
-			launchFullScreen(infovisdiv);
-			var timeout = 100;
-			if(!!window.ActiveXObject || "ActiveXObject" in window){
-				timeout = 200;
-			}
-			setTimeout(function(){
-				if(force!=undefined){
-					//重绘
-					var w=document.body.clientWidth;
-					var h=document.body.clientHeight;
-					//if(w>1200){
-						//w= 1200
-					//}
-					$("#entrelation-infovis").css({width:w,height:h});
-					d3.select("svg").attr("width", w).attr("height", h);
-					$(".entrelation-controlls").css({left:w-$(".entrelation-controlls").width() - 70});
-					force.linkDistance(h).charge(-700).size([w,h]).resume();
-				}
-				
-			},timeout);
-		}else{
-			cancelFullScreen();
-		}
-	}
-	//计算点之间的距离
-	var chargeArray = [[0,10],[10,20],[20,30],[30,40],[40,50],[50,60],[60,70],[70,80],[80,90],[90,100],[100,110]];
-	var chargeVal = -1600;
-	var nodeCount = data.nodes.length;
-	for(var i in chargeArray){
-		if(nodeCount >= chargeArray[i][0] && nodeCount < chargeArray[i][1]){
-			chargeVal += i*100;
-			break;
-		}else if(i == chargeArray.length){
-			chargeVal += i*100;
-		}
-	}
-	var tick=function (e) {
-		lines.attr("d", function(d) {
-			var sy   = d.source.y,
-				x    = d.target.x,
-	            y    = d.target.y;
-			if(sy > y){
-				sy -= 12;
-			}else{
-				sy += 5;
-			}
-			var line = new geo.LineSegment(d.source.x, sy, x, y);
-			for (var e in d.target.edge) {
-	            var ix = line.intersect(d.target.edge[e].offset(x, y));
-	            if (ix.in1 && ix.in2) {
-	                x = ix.x;
-	                y = ix.y;
-	                break;
-	            }
-	        }
-	        var dx = x - d.source.x,
-		        dy = y - sy,
-		        dr = Math.sqrt(dx * dx + dy * dy),
-		        theta = Math.atan2(dy, dx) + Math.PI / 7.85,
-		        d90 = Math.PI / 2,
-		        dtxs = x - Math.cos(theta),
-		        dtys = y - Math.sin(theta);
-		    return "M" + d.source.x + "," + sy + "A" + dr + "," + dr + " 0 0 1," + x + "," + y + "A" + dr + "," + dr + " 0 0 0," + d.source.x + "," + sy + "M" + dtxs + "," + dtys +  "l" + (3.5 * Math.cos(d90 - theta) - 10 * Math.cos(theta)) + "," + (-3.5 * Math.sin(d90 - theta) - 10 * Math.sin(theta)) + "L" + (dtxs - 3.5 * Math.cos(d90 - theta) - 10 * Math.cos(theta)) + "," + (dtys + 3.5 * Math.sin(d90 - theta) - 10 * Math.sin(theta)) + "z";
-		});	
-		nodes.attr("transform", function(d) {
-			return "translate(" + d.x + "," + d.y + ")scale(" + zoomlevel+ ")";
-		});
-	}
-	var force = d3.layout.force()
-	    .nodes(data.nodes)
-	    .links(data.links)
-	    .size([w, h])
-	    .linkDistance(function(p){
-			return Math.floor(Math.random()*60)+90;
-		})
-		.chargeDistance(600)
-	    .charge(chargeVal)
-		.linkStrength(1)
-		.on('tick',tick);
-	var dragstatus = false,
-	mouseoverstatus = false;
-	var drag = force.drag()
-		.on("dragstart",function(d,i){
-			d.fixed = true;    //拖拽开始后设定被拖拽对象为固定
-			d3.event.sourceEvent.stopPropagation(); // Prevent panning
-		})
-		.on("drag",function(d,i){
-			dragstatus = true;
-			mouseoverstatus = true;
-		})
-		.on("dragend",function(d,i){
-			mouseoverstatus = false;
-			setTimeout(function(){
-				dragstatus = false;
-			},500)
-		});
-	function zoomed() {
-		svg.attr("transform", 
-			"translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
-	}
-	//处理缩放
-	var zoom = d3.behavior.zoom().scaleExtent([0.4, 10]).on("zoom", zoomed);
-	var svg = d3.select("#entrelation-infovis").append("svg:svg")
-	    .attr("width", w)
-	    .attr("height", h)
-		.call(zoom)
-		.append("g");
-		
-	var lines = svg.append("svg:g")
-	    .selectAll("path")
-	    .data(force.links())
-	    .enter().append("path")
-		.style("fill", function(p){
-	    	return (p.type=="cp" || p.isLegal)?"#cd93d7":"#cecece";
-	    })
-		.style("stroke", function(p){
-	    	return (p.type=="cp" || p.isLegal)?"#cd93d7":"#cecece";
-	    })
-		.attr("stroke-width",function (e,i){
-			return e.linkVal;
-		});
-		lines.each(function (d,i){
-			var invacconam = new Number(d.invacconam);
-			if(invacconam > 0){
-				var lenInvacconam = (invacconam + "").length;
-				if(lenInvacconam > 4 && (invacconam + "").indexOf(".") > -1 && (lenInvacconam - (invacconam + "").indexOf(".")) > 4){
-					invacconam = (new Number(invacconam)).toFixed(4);
-				}
-				d3.select(this).append("title").text("投资金额:"+invacconam+"万元");
-			}
-		});
-	var nodes = svg.append("svg:g")
-	    .selectAll(".node")
-	    .data(force.nodes())
-	  	.enter()
-		.append("g")
-		.call(force.drag)
-		.attr('class', 'node')
-		.on('mouseover', function(d) {
-	        highlightObject(this,true);
-	    })
-	    .on('mouseout', function(d) {
-			highlightObject(this,false);
-	    })
-		.on("mousedown",function (e,i){
-			d3.event.preventDefault();
-			removeNode(this);
-		});
-	nodes.append("rect")
-		.attr("rx", 5)
-	    .attr("ry", 5)
-		.attr('height', 20)
-		.attr("fill", function(p){
-			if(p.type == "e" && (p.opstate == "11" || p.opstate == "07")){
-				return "#cecece";
-			}
-	    	return p.type=="p"?"#2196f3":p.type=="ce"?"#ff9800":"#cddc39";
-	    })
-		.attr("stroke", function(p){
-			if(p.type == "e" && (p.opstate == "11" || p.opstate == "07")){
-				return "#cecece";
-			}
-	    	return p.type=="p"?"#2196f3":p.type=="ce"?"#ff9800":"#cddc39";
-	    }).style("opacity",function(p){
-			if(p.type=="e" && (p.opstate != "11" || p.opstate != "07")){
-				return "0.5";
-			}
-			return "1";
-		});
-	nodes.each(function (d,i){
-		if(d.type == "ce" || d.type == "e"){
-			var title = "";
-			if(d.text != d.shortText){
-				title = d.text;
-			}
-			var regcap = d.regcap;
-			if(regcap > 0){
-				var lenRegcap = (regcap + "").length;
-				if(lenRegcap > 4 && (regcap + "").indexOf(".") > -1 && (lenRegcap - (regcap + "").indexOf(".")) > 4){
-					regcap = (new Number(regcap)).toFixed(4);
-				}
-				if(title != ""){
-					title += "\n";
-				}
-				title += "注册资本:"+regcap+"万元";
-			}
-			if(title != ""){
-				d3.select(this).append("title").text(title);
-			}
-		}
-	});
-	nodes.append('text')
-    .text(function(d){
-		return d.shortText;
-	})
-	.style("cursor",function (d,i){
-		if(d.type == "e"){
-			return "pointer";
-		}else{
-			return "auto";
-		}
-	})
-	.on("click",function (d,i){
-		if(!dragstatus && d.type == "e"){
-			window.open("/enterpriseInfoByRegNO/"+d.name+".html");
-		}
-	});
-	setTimeout(function() {
-	    nodes.each(function(d) {
-	        var node   = d3.select(this),
-	            text   = node.selectAll('text'),
-	            bounds = {},
-	            first  = true;
-				
-			text.each(function() {
-	            var box = this.getBBox();
-	            if (first || box.x < bounds.x1) {
-	                bounds.x1 = box.x;
-	            }
-	            if (first || box.y < bounds.y1) {
-	                bounds.y1 = box.y;
-	            }
-	            if (first || box.x + box.width > bounds.x2) {
-	                bounds.x2 = box.x + box.width;
-	            }
-	            if (first || box.y + box.height > bounds.y2) {
-	                bounds.y2 = box.y + box.height;
-	            }
-	            first = false;
-	        }).attr('text-anchor', 'middle');
-				
-	        var padding  = {"left":3,"right":3,"top":2,"bottom":2},
-	            margin   = {"left":3,"right":3,"top":2,"bottom":2},
-	            oldWidth = bounds.x2 - bounds.x1;
-	
-	        bounds.x1 -= oldWidth / 2;
-	        bounds.x2 -= oldWidth / 2;
-	
-	        bounds.x1 -= padding.left;
-	        bounds.y1 -= padding.top;
-	        bounds.x2 += padding.left + padding.right;
-	        bounds.y2 += padding.top  + padding.bottom;
-			
-			var width = bounds.x2 - bounds.x1;
-			var height = bounds.y2 - bounds.y1;
-	        node.select('rect')
-	            .attr('x', bounds.x1)
-	            .attr('y', bounds.y1)
-				//.attr('height', height)
-	            .attr('width', width);
-	            
-	        d.edge = {
-	            left   : new geo.LineSegment(bounds.x1, bounds.y1, bounds.x1, bounds.y2),
-	            right  : new geo.LineSegment(bounds.x2, bounds.y1, bounds.x2, bounds.y2),
-	            top    : new geo.LineSegment(bounds.x1, bounds.y1, bounds.x2, bounds.y1),
-	            bottom : new geo.LineSegment(bounds.x1, bounds.y2, bounds.x2, bounds.y2)
-	        };
-	    });
-	    force.start();
-	},10);
-	function highlightObject(obj,flag){
-		if(mouseoverstatus){
-			return;
-		}
-		if(!flag){
-			d3.selectAll(".node").each(function (){
-				d3.select(this).style("opacity","1");
-			});
-			d3.selectAll("path").each(function (){
-				d3.select(this).style("opacity","1");
-			});
-			return;
-		}
-		var name = obj.__data__.name;
-		d3.selectAll(".node").each(function (){
-			if(name != this.__data__.name){
-				d3.select(this).style("opacity","0.2");
-			}
-		});
-		d3.selectAll("path").each(function (){
-			var targetName = this.__data__.target.name;
-			var sourceName = this.__data__.source.name;
-			if(name != targetName && name != sourceName){
-				d3.select(this).style("opacity","0.2");
+}
+//加载关系网
+function initRelation(){
+	if(isLogined){
+		$.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.links) == "undefined" || r.links.length == 0 || typeof(r.nodes) == "undefined" || r.nodes.length <= 1)){
+				relation = "";
+				$("#entrelation-infovis").hide();
+				$("#entrelation-findnull").removeClass("hide");
 			}else{
-				d3.selectAll(".node").each(function (){
-					if(targetName == this.__data__.name || sourceName == this.__data__.name){
-						d3.select(this).style("opacity","1");
-					}
+				loadJS("/js/d3.v3.min.js",function(){
+					loadJS("/js/geometry.js",function(){
+						loadJS("/js/relation.js",function(){
+							$("#entrelation-limit").addClass("hide");
+							$(".entrelation").height(500);
+							relation = new Relation(legcerNo,regNo,r.relation);
+							relation.init();
+						});
+					});
 				});
 			}
 		});
-	}
-	function removeNode(obj){
-		if(d3.event.which != 3){
-			return;
-		}
-		highlightObject(obj,false);
-		d3.select(obj).remove();
-		var name = obj.__data__.name;
-		var removeAloneNode = function(removeNodeName){
-			var isRemoveAloneNode = true;
-			d3.selectAll("path").each(function (i){
-				if(removeNodeName == this.__data__.source.name || removeNodeName == this.__data__.target.name){
-					isRemoveAloneNode = false;
-					return true;
-				}
-			});
-			if(isRemoveAloneNode){
-				d3.selectAll("rect").each(function (){
-					if(this.__data__.name == removeNodeName){
-						d3.select(this).remove();
-						return true;
-					}
-				});
-				d3.selectAll("text").each(function (){
-					if(this.__data__.name == removeNodeName){
-						d3.select(this).remove();
-						return true;
-					}
-				});
-			}
-		}
-		d3.selectAll("path").each(function (){
-			if(name == this.__data__.target.name){
-				var fromNodeName = this.__data__.source.name;
-				d3.select(this).remove();
-				removeAloneNode(fromNodeName);
-			}else if(name == this.__data__.source.name){
-				var toNodeName = this.__data__.target.name;
-				d3.select(this).remove();
-				removeAloneNode(toNodeName);
-			}
-		});
-		d3.selectAll("rect").each(function (){
-			if(name == this.__data__.name){
-				d3.select(this).remove();
-			}
-		});
-		d3.selectAll("text").each(function (){
-			if(name == this.__data__.name){
-				d3.select(this).remove();
-			}
-		});
-	}
-	var diagonal = d3.svg.diagonal().projection(function(d) { return [d.y, d.x]; });
-	/////////////重绘画布///////////////////
-	var redrawflag=false;
-	//重绘
-	function redraw(){
-		if(force!=undefined){
-			var w = parseInt($("#entrelation").css("width").replace("px","")) - 80;
-			var h = parseInt($("#entrelation").css("height").replace("px",""))-10;
-			d3.select("svg").attr("width", w).attr("height", h);
-			force.size([w,h]).resume();
-			$("#entrelation-infovis").css({width:w,height:h});
-			//
-			redrawflag=false;
-		}
-	}
-	$(window).resize(function(){
-		if(!redrawflag){
-		    //1秒后重绘
-			redrawflag=true;
-			setTimeout(redraw,1000);
-		}
-		firstresize=false;
-	});
-	///////////////////////关系网实例////////////////////////////
-	var htmls="<div style='position:absolute;' class='legend'>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ff9800;'></div><span style='margin-left: 20px;'>本企业</span></div>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #cddc39;opacity:0.5;'></div><span style='margin-left: 12px;'>其他企业</span></div>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #2196f3;'></div><span style='margin-left: 25px;'>个人</span></div>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;margin-bottom: 10px;'><div style='background-color: #cecece;'></div><span style='margin-left: 5px;'>注吊销企业</span></div>";
-	htmls= htmls+ "<div><span style='font-size: 20px;font-weight: bold;color: #cecece;'>→</span><span style=''>投资关系(股东→企业)</span></div>";
-	htmls= htmls+ "<div><span style='font-size: 20px;font-weight: bold;color: #cd93d7;'>→</span><span style=''>法定代表人</span></div>";
-	htmls= htmls+ "<div style='margin:10px 0px;' class='hidden-sm hidden-xs'><span class='text-muted'>提示:点击鼠标右键可以删除不想看的节点。</span></div>";
-	htmls= htmls+"</div>"
-	$("#entrelation-legend").html(htmls);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*
-function getCityN(code){
-	if(code){
-		var n=code.substring(0,2)
-		for(var i=0;i<citySim.length;i++){
-			if (citySim[i].k==n) {
-				return citySim[i].n;
-			}
-		}
-	}
-	return "";	
-}
-
-
-function reloadData(obj,name){
-	name=name||obj.attr("name")
-	var val=(obj.attr("value")||obj.val());
-	
-	if (val==0) val=""
-	if(name=="city"&&!val){
-		var pids=obj.attr("id")
-		if(pids=="c_area"){
-			var v=obj.prev("select").val()
-			if(!v){
-				v=obj.prev("select").prev("select").val()
-			}
-			if(v){
-				val=v
-			}
-			
-		}else if(pids=="c_city"){
-			var v=obj.prev("select").val()
-			if(v){
-				val=v
-			}
-		}
-		
-	}else if(name=="c_author"){
-		if(!obj.prop("checked")){
-			val="";
-		}
-	}
-	//调整value 值
-	if(val==10){
-		val = "10-100"
-	}else if(val ==100){
-		val = "100-1000"
-	}else if(val ==1000){
-		val = "1000-10000"
-	}
-	//搜索表单提交
-	$("#searchForm input[name="+name+"]").val(val);
-    document.forms['searchForm'].submit();
-}
-
-function setLocation(entsel,serviceloc){
-	//所在地处理
-	var le  =  entsel.length
-	var sel1 = "";
-	var sel2 = "";
-	var sel3 = "";
-	if (le == 2) {
-	 sel1 = entsel.substring(0,2);
-	 sel2 = 0;
-	 sel3 = 0;
-	}else if (le == 4){
-	 sel1 = entsel.substring(0,2);
-	 sel2 = entsel.substring(0,4);
-	 sel3 = 0;
-	}else{	
-	 sel1 = entsel.substring(0,2);
-	 sel2 = entsel.substring(0,4);
-	 sel3 = entsel.substring(0,6);
-	}
-	$.cxSelect.setVal(sel1,sel2,sel3);
-	if(serviceloc){	
-		//添加编辑服务中的省
-		$("#servicecity_china .province option").each(function(){
-			if(sel1 == $(this).val()){					
-				$(this).attr("selected","selected");
-			}
-		});
-		//添加编辑服务中的市
-		$("#servicecity_china .city option").each(function(){
-			if(sel2 == $(this).val()){					
-				$(this).attr("selected","selected");
-			}
-		});
-		//添加编辑服务中的县
-		$("#servicecity_china .area option").each(function(){
-			if(sel3 == $(this).val()){					
-				$(this).attr("selected","selected");
-			}
-		});
-	}
-}	
-cityMouse="";
-$(function(){
-	
-	////推荐企业
-	loadImg(1);
-	//行业类别  注册资本 加载
-	makeFl();
-	//所在地信息加载
-	if($chiancity){
-		$('#city_china').cxSelect({
-			selects: ['province', 'city', 'area'],
-			required:0,
-			somep:true,
-			someps:[41,45]
-		});
-		setLocation(entsel)
-	}
-	
-	
-	//处理点击重新加载
-	$("div[id^=c_] li,li[id^=c_],input[id^=c_]").click(function(){
-		
-		if(this.id=="c_words"){
-			reloadData($("#header-searchInputs"))	
-		}else{
-			reloadData($(this))	
-		}	
-	})
-	
-	$("select[id^=c_]").click(function(){
-		cityMouse=this.id
-	}).change(function(){
-		if(this.id==cityMouse){
-			reloadData($(this),"city")			
-		}
-	})	
-
-	//处理选择样式
-	$("div[id^=c_] li").click(function(){
-		$("li",$(this).closest("div")).removeClass("text-primary");
-		$(this).addClass("text-primary");
-	})
-	//搜索关键字
-	var words=""
-	
-	if(btempwords){
-		words=btempwords
-		$("#header-searchInput").val(words);
-	}
-	
-	
-})
-function makeFl(){
-	//行业类别
-	$(["c_hfl"]).each(function(i,ad){
-		var str="<ul>";
-		var tmp=eval(ad)
-		for(var i=0;i<tmp.length;i++){
-		    var val = chf1;
-			if (val !=""){
-			if (val == tmp[i][1]){
-			str+="<li name='"+ad+"' value='"+tmp[i][1]+"' class='text-primary'>"+tmp[i][0]+"</li>"
-			var j ="J"
-			if (val > j || val == "D" || val == "E" || val == "F" || val == "G"  ){
-			$("#c_hfl").next().find("small").text("收起<")
-			$("#c_hfl").removeClass("less")
-			
-			}
-			}else{
-			str+="<li name='"+ad+"' value='"+tmp[i][1]+"'>"+tmp[i][0]+"</li>"
-			}
-			}else{
-			str+="<li name='"+ad+"' value='"+tmp[i][1]+"' "+(i==0?"class='text-primary'":"")+">"+tmp[i][0]+"</li>"
-			}
-			
-		}
-		str+="</ul>"
-		$("#"+ad).html(str)
-	})
-	//注册资本
-	$(["c_zb"]).each(function(i,ad){
-		var str="<ul>";
-		var tmp=eval(ad)
-		for(var i=0;i<tmp.length;i++){
-		    var val = czb;
-			if (val !=""){
-			if (val == tmp[i][1]){
-			str+="<li name='"+ad+"' value='"+tmp[i][1]+"' class='text-primary'>"+tmp[i][0]+"</li>"
-			}else{
-			str+="<li name='"+ad+"' value='"+tmp[i][1]+"'>"+tmp[i][0]+"</li>"
-			}
-			}else{
-			str+="<li name='"+ad+"' value='"+tmp[i][1]+"' "+(i==0?"class='text-primary'":"")+">"+tmp[i][0]+"</li>"
-			}
-			
-		}
-		str+="</ul>"
-		$("#"+ad).html(str)
-	})
-}
-function less(obj){
-	pred=$(obj).prev()
-	obj=$(obj).find("small")
-	var text=obj.text()
-	if(text=="更多>"){
-		obj.text("收起<")
-		pred.removeClass("less")
-	}else{
-		obj.text("更多>")
-		pred.addClass("less")
-	}
-	
-}
-//推荐企业
-function loadImg(n){
-	var str=""
-	for(var i=0;i<n;i++){
-		str+="<img src='/images/right_ad.png'>"
-	}
-	$("#tjqy").html(str)
-}
-
-function GetDiffName(i)  {
-	ret=["法定代表人"]
-	//ret=["法定代表人","住所","成立日期"]
-	switch (i) {
-		case  "9600":
-		{
-			ret[0] = "经营者"
-			//ret[1] = "经营场所"
-			//ret[2] = "注册日期"
-			break;
-		}
-		case "4500":
-		case "6800":
-		case "6810":
-		case "6820":
-		case "7100":
-		case "7110":
-		case "7120":
-		case "7130":
-		case "7190":
-		case "9200":
-		case "6840":
-		case "2100":
-		case "2110":
-		case "2120":
-		case "2121":
-		case "2122":
-		case "2123":
-		case "2130":
-		case "2140":
-		case "2150":
-		case "2151":
-		case "2152":
-		case "2190":
-		case "2200":
-		case "2210":
-		case "2211":
-		case "2212":
-		case "2213":
-		case "2219":
-		case "2220":
-		case "2221":
-		case "2222":
-		case "2223":
-		case "2229":
-		case "4000":
-		case "4300":
-		case "4310":
-		case "4320":
-		case "4330":
-		case "4340":
-		case "4550":
-		case "4551":
-		case "4552":
-		case "4553":
-		case "4560":
-		case "5800":
-		case "5810":
-		case "5820":{
-			ret[0] = "负责人"
-			//ret[1] = "营业场所"
-			//ret[2] = "成立日期"
-			break;
-		}
-	}
-	return ret
-}
-//公式信息是否显示
-if(!$gs){
-	$("#ags").parent().hide();
-	$("#gs").hide();
-}
-*/
-
-
-var perPage=5,currentPage=1
-
-//点击服务标题展示服务信息
-function clickservicename(id,isshow){
-	if(isshow.indexOf("3")>-1){
-		window.location.href="/market/detail/"+id+".html"
 	}else{
-		window.location.href="/market/showservice/"+id+".html"
+		$("#entrelation-limit,#entrelation-nologin").removeClass("hide");
 	}
 }
-function initServiceList(){	
-	$("#service_list").datatable({
-	   perPage: perPage
-	  ,showPagination:false
-	  ,checkbox:"" 
-	  ,checkboxHeader:false
-	  ,showHeader:false
-	  ,idField:"_id"
-	  ,classname:"table-hover"
-	  ,url: '/searchEntSer/' + $entid
-	  ,rowCallback: analyList,
-	   ajaxSuccess:function(res,o){	
-		if(!res || res === undefined || !res.data || res.data.length == 0) {
-			o.continueBody=false;
-			$("#loadMore").hide();
-			$("#service").hide();
-		}else{
-			$("#service").show();
-		}
-		//判断加载更多是否显示
-		if(res.totalRows>5){
-			$("#loadMore").show();
-		}else{
-			$("#loadMore").hide();
-		}
-	   }
-	});
-}
-
-
-//显示二维码图片
-function viewBarCode(bcpath){
-	if(bcpath){
-		$('#myModal').modal({
-      		keyboard: true
-   		})
-		$("#viewImgs").html("<img style='width:300px;height:300px;' src='"+bcpath+"'/>")
-	}
-}
-
-
-function analyList(rowHtml, rowData) {
-	var t="";
-	if(rowData.i_status==1){
-		t=template_content.replace("<a class='text-primary' value='${_id}' data-id='${s_isEdit}' onclick='removeservice(this)'>下架</a>","");
-	}else{
-		t=template_content.replace("已下架","");
-	}
-	return t.replace(/\$\{(.*?)\}/g,
-	function(a, b, c) {
-		var res = rowData[b]||"";
-		//去掉后台服务列表中的图片
-		var data = res.replace(/<img.*>.*<\/img>/ig,"");   //过滤如<img></img>形式的图片元素
-		res = data.replace(/<img.*\/>/ig, "");   //过滤如<img />形式的元素
-		if (!res&&b=="s_images"){
-			res="/images/services/default.png"
-		}else{
-			res = res.replace(/\n/g,"");
-		}
-		return res;
-	});
-}
-//加载更多
-function loadMore(){
-	$.post('/searchEntSer/'+$entid ,{currentPage:currentPage+1,perPage:perPage},function(data){
-		if(data){
-			var res=data["data"]
-			if(!res || res === undefined || res.length == 0) {
-				$("#loadMore").hide();
-				return;
-			}else if(data.totalRows<=(perPage*data.currentPage)){
-				$("#loadMore").hide();
-			}else{
-				$("#loadMore").show();
-			}
-			currentPage=data["currentPage"];
-			var str="";
-			
-			for(var i=0;i<res.length;i++){
-				var temp=res[i];
-				str+=analyList("",temp)
-			}
-			$("#service_list table tbody").append(str);
-		}
-	})
-}
-
-//设置级联位置信息
-function setcxSelect(){
-	$('#city_china').cxSelect({
-		selects: ['province', 'city', 'area'],
-		required:0
+//服务列表
+function ServiceList(){
+	loadJS("/js/paging.js",function(){
+		paging = new Paging("serviceListPaging","/front/findServiceByEntId",{entId:entId},6,function(r){
+			if(r.length == 0){
+				$("#serviceList").next(".ent-findnull").removeClass("hide");
+			}
+			var html = '';
+			for(var i=0;i<r.length;i++){
+				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>'
+						+'<td>'+r[i].s_introduction+'</td>'
+						+'</tr>';
+			}
+			$("#serviceList").html(html);
+		});
 	});
-	$.cxSelect.setVal(province,city,area);	
 }

+ 33 - 33
core/src/web/staticres/js/qfw.js

@@ -44,6 +44,21 @@ var ValidDatatype = {
 		return true;
 	}
 }
+Date.prototype.Format = function (fmt) { //author: meizz 
+    var o = {
+        "M+": this.getMonth() + 1, //月份 
+        "d+": this.getDate(), //日 
+        "h+": this.getHours(), //小时 
+        "m+": this.getMinutes(), //分 
+        "s+": this.getSeconds(), //秒 
+        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
+        "S": this.getMilliseconds() //毫秒 
+    };
+    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
+    for (var k in o)
+    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+    return fmt;
+}
 //浏览器窗口大小变化重新加载
 window.onresize=webSiteInit;
 serializeObject = function(form) {
@@ -60,21 +75,6 @@ $(function(){
 	if(webSiteInitFlag){
 		webSiteInit();
 	}
-	Date.prototype.Format = function (fmt) { //author: meizz 
-	    var o = {
-	        "M+": this.getMonth() + 1, //月份 
-	        "d+": this.getDate(), //日 
-	        "h+": this.getHours(), //小时 
-	        "m+": this.getMinutes(), //分 
-	        "s+": this.getSeconds(), //秒 
-	        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
-	        "S": this.getMilliseconds() //毫秒 
-	    };
-	    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
-	    for (var k in o)
-	    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
-	    return fmt;
-	}
 });
 
 function makeData(d,_this,b){
@@ -413,24 +413,24 @@ function addCssByLink(url){
         doc.documentElement.appendChild(link);
 }
 //动态加载js
-function loadJS(url, success) {
-  var scripts=document.getElementsByTagName('script')
-  for(var i=0;i<scripts.length;i++){
-	if(scripts[i].src&&scripts[i].src.indexOf(url)>-1){
-		if(success) success();
-		return;
-	}
-  }
-  var domScript = document.createElement('script');
-  domScript.src = url;
-  success = success || function(){};
-  domScript.onload = domScript.onreadystatechange = function() {
-    if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
-      success();
-      this.onload = this.onreadystatechange = null;
-      //this.parentNode.removeChild(this);
-    }
-  }
+function loadJS(url, success){
+  	var scripts=document.getElementsByTagName('script')
+	for(var i=0;i<scripts.length;i++){
+		if(scripts[i].src&&scripts[i].src.indexOf(url)>-1){
+			if(success) success();
+			return;
+		}
+  	}
+  	var domScript = document.createElement('script');
+  	domScript.src = url;
+  	success = success || function(){};
+  	domScript.onload = domScript.onreadystatechange = function() {
+	    if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
+	      	success();
+	      	this.onload = this.onreadystatechange = null;
+	      	//this.parentNode.removeChild(this);
+	    }
+  	}
   document.getElementsByTagName('head')[0].appendChild(domScript);
 }
 //判断对象是否为空对象{}

+ 722 - 0
core/src/web/staticres/js/relation.js

@@ -0,0 +1,722 @@
+function Relation(legcerNo,regNo,data){
+	this.legcerNo = legcerNo;
+	this.regNo = regNo;
+	this.data = data;
+	this.zoomlevel = 1;
+	this.w = 0;
+	this.h = 0;
+	this.index = -1;
+	this.redrawflag = false;
+	this.infovisdiv = null;
+	this.svg = null;
+	this.force = null;
+	this.lines = null;
+	this.nodes = null;
+	this.mouseoverstatus = false;
+	this.chargeVal = -1600;
+}
+Relation.prototype.init = function(){
+	var thisClass = this;
+	$(function(){
+		$("#entrelation-fullscreen").bind("click",function(){
+			thisClass.initFullScreen();
+		});
+		thisClass.w = $("#entrelation").width();
+		thisClass.h = $("#entrelation").height();
+		$("#entrelation-infovis").width(thisClass.w).append(
+			'<div class="entrelation-controlls hidden-sm hidden-xs">'
+				+'<div class="entrelation-item">'
+					+'<div id="entrelation-fullscreen" class="entrelation-box" title_pos="left"><div class="entrelation-fullscreen"></div></div>'
+				+'</div>'
+			+'</div>'
+		);
+		if($(".entrelation-controlls").length>0){
+			$(".entrelation-controlls").css({left:$("#entrelation").width()-$(".entrelation-controlls").width()});
+		}
+	});
+	//处理全屏
+	$(document).on('webkitfullscreenchange mozfullscreenchange msfullscreenchange fullscreenchange', function(){
+	    if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement){
+			//退出
+			thisClass.cancelFullScreen();
+		}
+	});
+   	this.infovisdiv = document.getElementById("entrelation-infovis");
+	document.onkeydown=function(event){
+        var e = event || window.event || arguments.callee.caller.arguments[0];
+        if(e && e.keyCode==122){
+			event.preventDefault?event.preventDefault():window.event.returnValue = false;
+			if(!!window.ActiveXObject || "ActiveXObject" in window){//ie下F11不能用,屏蔽掉
+				if($(".exit").length == 0){
+					return;
+				}
+			}
+			thisClass.initFullScreen();
+        }else if(e && e.keyCode==27){
+			event.preventDefault?event.preventDefault():window.event.returnValue = false;
+			thisClass.cancelFullScreen();
+		}
+    };
+	$(window).resize(function(){
+		if(!thisClass.redrawflag){
+		    //1秒后重绘
+			thisClass.redrawflag=true;
+			setTimeout(thisClass.redraw,1000);
+		}
+		firstresize=false;
+	});
+	if(document.getElementById("entrelation-infovis")){
+		document.getElementById("entrelation-infovis").oncontextmenu=function(){return false;};
+	}
+	$("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));
+	///////////////////////关系网实例////////////////////////////
+	var htmls="<div style='position:absolute;top:0px;' class='legend'>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ff9800;'></div><span style='margin-left: 20px;'>本企业</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #cddc39;opacity:0.5;'></div><span style='margin-left: 12px;'>其他企业</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #2196f3;'></div><span style='margin-left: 25px;'>个人</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;margin-bottom: 10px;'><div style='background-color: #cecece;'></div><span style='margin-left: 5px;'>注吊销企业</span></div>";
+	htmls= htmls+ "<div><span style='font-size: 20px;font-weight: bold;color: #cecece;'>→</span><span style=''>投资关系(股东→企业)</span></div>";
+	htmls= htmls+ "<div><span style='font-size: 20px;font-weight: bold;color: #cd93d7;'>→</span><span style=''>法定代表人</span></div>";
+	htmls= htmls+ "<div style='margin:10px 0px;' class='hidden-sm hidden-xs'><span class='text-muted'>提示:点击鼠标右键可以删除不想看的节点。</span></div>";
+	htmls= htmls+"</div>"
+	$("#entrelation").append(htmls);
+	this.dataProcess();
+	this.makeRelation();
+	this.redraw();
+}
+Relation.prototype.dataProcess = function(){
+	var reg = new RegExp(/(有限公司|有限责任公司|股份有限公司|总公司|分公司|公司|事务所|合伙企业)$|\(.*\)|\(.*\)/g);
+	/*var provinces = [];
+	$.ajax({
+		url: "/js/provinceData.min.json",
+		dataType: "json",
+		cache: true,
+		async: false,
+		success: function(json){
+			provinces = json;
+		}
+	});*/
+	for(var i=0;i<this.data.nodes.length;i++){
+		var nodeObj = this.data.nodes[i];
+		nodeObj.text = $.trim(nodeObj.text);
+		nodeObj.shortText = nodeObj.text;
+		if(nodeObj.type == "e" || nodeObj.type == "ce"){
+			var text = nodeObj.shortText;
+			if(text.length > 2){//先替换结尾
+				text = text.replace(reg,"");
+			}
+			if(text.length > 2){//再替换开头
+				//text = this.filterEntName(text);
+			}
+			if(text.length > 2){//小于两个字符不生效
+				nodeObj.shortText = text;
+			}
+			if(nodeObj.name == this.regno){//先找本企业位置
+				this.index = i;
+				nodeObj["regcap"] = (typeof(d1) == "undefined")?0:d1;
+				nodeObj["legcerno"] = this.legcerNo;
+			}
+		}
+	}
+	/*********************************连线处理***********************************/
+	var minLink=-1,maxLink=-1;
+	for(var i=0;i<this.data.links.length;i++){
+		var linkObj = this.data.links[i];
+		if(linkObj.target==this.index && this.data.nodes[linkObj.source].name==this.legcerNo){
+			//this.data.nodes[linkObj.source].type="cp";
+			linkObj.type = "cp"
+			linkObj.isLegal = 1;
+		}
+		//
+		this.data.nodes[linkObj.target]["istarget"] = 1;
+		if(this.data.nodes[linkObj.source].name == this.data.nodes[linkObj.target].invlegcerno || this.data.nodes[linkObj.source].name == this.data.nodes[linkObj.target].legcerno){
+			linkObj.isLegal = 1;
+		}
+		if(typeof(linkObj.invacconam) == "undefined"){
+			continue;
+		}
+		var invacconam = new Number(linkObj.invacconam);
+		if(minLink == -1 && maxLink == -1){
+			minLink = invacconam;
+			maxLink = invacconam;
+		}else if(invacconam > maxLink){
+			maxLink = invacconam; 
+		}else if(invacconam < minLink){
+			minLink = invacconam;
+		}
+	}
+	/////////////
+	var linkSectionArray = this.getLineSectionArray(minLink,maxLink);
+	for(var i=0;i<this.data.links.length;i++){
+		var linksObj = this.data.links[i];
+		linksObj["linkVal"] = 2;
+		if(typeof(linkObj.invacconam) == "undefined"){
+			continue;
+		}
+		var invacconam = new Number(linksObj.invacconam);
+		for(var s in linkSectionArray){
+			var sectionObj = linkSectionArray[s];
+			if(invacconam >= sectionObj.minVal && invacconam < sectionObj.maxVal){
+				linksObj["linkVal"] = sectionObj.linkVal;
+				continue;
+			}
+		}
+	}
+	/*********************************节点处理***********************************/
+	var minNode=-1,maxNode=-1;
+	for(var i=0;i<this.data.nodes.length;i++){
+		var nodeObj = this.data.nodes[i];
+		if(nodeObj.type == "e" || nodeObj.type == "ce"){
+			var regcap = nodeObj.regcap;
+			if(minNode == -1 && maxNode == -1){
+				minNode = regcap;
+				maxNode = regcap;
+			}else if(regcap > maxNode){
+				maxNode = regcap; 
+			}else if(regcap < minNode){
+				minNode = regcap;
+			}
+		}
+	}
+	var nodeSectionArray = this.getNodeSectionArray(minNode,maxNode);
+	for(var i=0;i<this.data.nodes.length;i++){
+		var nodeObj = this.data.nodes[i];
+		nodeObj["nodeVal"] = 7;
+		if(nodeObj.type == "e" || nodeObj.type == "ce"){
+			var invacconam = new Number(nodeObj.invacconam);
+			var regcap = new Number(nodeObj.regcap);
+			for(var s in nodeSectionArray){
+				var sectionObj = nodeSectionArray[s];
+				if(regcap >= sectionObj.minVal && regcap < sectionObj.maxVal){
+					nodeObj["nodeVal"] = sectionObj.nodeVal;
+					continue;
+				}
+			}
+		}
+	}
+	//计算点之间的距离
+	var chargeArray = [[0,10],[10,20],[20,30],[30,40],[40,50],[50,60],[60,70],[70,80],[80,90],[90,100],[100,110]];
+	var nodeCount = this.data.nodes.length;
+	for(var i in chargeArray){
+		if(nodeCount >= chargeArray[i][0] && nodeCount < chargeArray[i][1]){
+			this.chargeVal += i*100;
+			break;
+		}else if(i == chargeArray.length){
+			this.chargeVal += i*100;
+		}
+	}
+}
+Relation.prototype.filterEntName = function(text){
+	this.allProvinces = "河南省、青海省、山西省、黑龙江省、安徽省、广西壮族自治区、西藏自治区";
+	this.commonReplace = function(t){
+		if(t.length > 1 && text.startWith(t)){
+			var textCopy = text.replace(new RegExp("^"+t),"");
+			if(textCopy.length > 2){
+				text = textCopy;
+			}
+			return true;
+		}
+		return false;
+	};
+	this.replaceStart = function(t,f){
+		var flag = false;
+		var minus = null;
+		if(this.commonReplace(t)){//替换省、市、县、区
+			return true;
+		}
+		if(f){//不替换
+			flag = false;
+		}else if(t.endWith("维吾尔自治区")){
+			flag = true;
+			minus = 6;
+		}else if(t.endWith("回族自治区") || t.endWith("壮族自治区") || t.endWith("特别行政区")){
+			flag = true;
+			minus = 5;
+		}else if(t.endWith("自治州") || t.endWith("自治县") || t.endWith("自治区")){
+			flag = true;
+			minus = 3;
+		}else if(t.endWith("地区")){
+			flag = true;
+			minus = 2;
+		}else if(t.endWith("省") || t.endWith("市") || t.endWith("区")){
+			flag = true;
+			minus = 1;
+		}
+		if(flag){
+			return this.commonReplace(t.substring(0,t.length-minus));
+		}
+		return false;
+	};
+	this.replaceCity = function(citys){
+		if(citys){
+			for(var c in citys){//市
+				var c_name = citys[c].n;
+				if(this.replaceStart(c_name)){
+					this.replaceAreas(citys[c].s);
+					return true;
+				}else if(this.replaceAreas(citys[c].s)){
+					return true;
+				}
+			}
+		}
+	};
+	this.replaceAreas = function(areas){
+		if(areas){
+			for(var a in areas){//县、区
+				var a_name = areas[a].n;
+				if(this.replaceStart(a_name,true)){
+					return true;
+				}
+			}
+		}
+	};
+	for(var p in provinces){//省
+		var p_name = provinces[p].n;
+		if(this.allProvinces.indexOf(p_name) == -1){
+			continue;
+		}
+		if(this.replaceStart(p_name)){
+			this.replaceCity(provinces[p].s);
+			break;
+		}else if(this.replaceCity(provinces[p].s)){
+			break;
+		}
+	}
+	return text;
+}
+Relation.prototype.getLineSectionArray = function(minLink,maxLink){
+	var countSection = 6;
+	var section = (maxLink - minLink) / countSection;
+	var sectionArr = [];
+	for(var i=2;i<=countSection;i++){
+		var minVal = minLink;
+		if(sectionArr.length > 0){
+			minVal = sectionArr[sectionArr.length - 1].maxVal;
+		}
+		var maxVal = minLink+section*i;
+		if(i == countSection){
+			maxVal += section;
+		}
+		var sectionObj = {linkVal:i,minVal:minVal,maxVal:maxVal};
+		sectionArr.push(sectionObj);
+	}
+	return sectionArr;
+}
+Relation.prototype.getNodeSectionArray = function(minNode,maxNode){
+	var countSection = 7;
+	var section = (maxNode - minNode) / countSection;
+	var sectionArr = [];
+	for(var i=1;i<=countSection;i++){
+		var minVal = minNode;
+		if(sectionArr.length > 0){
+			minVal = sectionArr[sectionArr.length - 1].maxVal;
+		}
+		var maxVal = minNode+section*i;
+		if(i == countSection){
+			maxVal += section;
+		}
+		var sectionObj = {nodeVal:6+i,minVal:minVal,maxVal:maxVal};
+		sectionArr.push(sectionObj);
+	}
+	return sectionArr;
+}
+Relation.prototype.launchFullScreen = function(element) {
+  	if(element){
+	  	if (element.requestFullscreen) {
+	      element.requestFullscreen();
+	    } else if (element.msRequestFullscreen) {
+	      element.msRequestFullscreen();
+	    } else if (element.mozRequestFullScreen) {
+	      element.mozRequestFullScreen();
+	    } else if (element.webkitRequestFullscreen) {
+			// 对 Chrome 特殊处理,
+	        // 参数 Element.ALLOW_KEYBOARD_INPUT 使全屏状态中可以键盘输入。
+	        if ( window.navigator.userAgent.toUpperCase().indexOf( 'CHROME' ) >= 0 ) {
+	              element.webkitRequestFullScreen( Element.ALLOW_KEYBOARD_INPUT );
+	        }else {
+				// Safari 浏览器中,如果方法内有参数,则 Fullscreen 功能不可用。
+	           element.webkitRequestFullScreen();
+	        }
+	    }
+  	}
+}
+Relation.prototype.cancelFullScreen = function(){
+	this.h = $("#entrelation-infovis").height();  
+	$("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));	
+	//force.linkDistance(120).charge(-200).size([w,h]).resume();
+	$("#entrelation-infovis").css({width:this.w,height:this.h});
+	//设置svg标签的宽度与高度
+	d3.select("svg").attr("width", this.w).attr("height", this.h);
+	$(".entrelation-controlls").css({left:$("#entrelation").width()-$(".entrelation-controlls").width()-30});
+    if(document.exitFullscreen) {
+      document.exitFullscreen();
+    } else if (document.msExitFullscreen) {
+      document.msExitFullscreen();
+    } else if (document.mozCancelFullScreen) {
+      document.mozCancelFullScreen();
+    } else if (document.webkitExitFullscreen) {
+      document.webkitExitFullscreen();
+    }
+}
+Relation.prototype.initFullScreen = function(){
+	var thisClass = this;
+	var fullscreenElement =
+       	document.fullscreenElement ||
+       	document.mozFullScreenElement ||
+       	document.webkitFullscreenElement ||
+		document.msFullscreenElement;
+    $(".entrelation-fullscreen").toggleClass("exit");
+	if(!fullscreenElement || fullscreenElement==null){
+		this.redrawflag = true;
+		$("#entrelation-fullscreen").attr("title","退出全屏视图 (F11)");
+		this.launchFullScreen(this.infovisdiv);
+		var timeout = 100;
+		if(!!window.ActiveXObject || "ActiveXObject" in window){
+			timeout = 200;
+		}
+		setTimeout(function(){
+			if(thisClass.force != null){
+				//重绘
+				var w=document.body.clientWidth;
+				var h=document.body.clientHeight;
+				//if(w>1200){
+					//w= 1200
+				//}
+				$("#entrelation-infovis").css({width:w,height:h});
+				d3.select("svg").attr("width", w).attr("height", h);
+				$(".entrelation-controlls").css({left:w-$(".entrelation-controlls").width() - 70});
+				thisClass.force.linkDistance(h).charge(-700).size([w,h]).resume();
+			}
+			
+		},timeout);
+	}else{
+		this.cancelFullScreen();
+	}
+}
+//重绘
+Relation.prototype.redraw = function(){
+	if(this.force != undefined){
+		d3.select("svg").attr("width",this.w).attr("height", this.h);
+		this.force.size([this.w,this.h]).resume();
+		$("#entrelation-infovis").css({width:this.w,height:this.h});
+		//
+		this.redrawflag = false;
+	}
+}
+Relation.prototype.removeNode = function(obj){
+	if(d3.event.which != 3){
+		return;
+	}
+	this.highlightObject(obj,false);
+	d3.select(obj).remove();
+	var name = obj.__data__.name;
+	var removeAloneNode = function(removeNodeName){
+		var isRemoveAloneNode = true;
+		d3.selectAll("path").each(function (i){
+			if(removeNodeName == this.__data__.source.name || removeNodeName == this.__data__.target.name){
+				isRemoveAloneNode = false;
+				return true;
+			}
+		});
+		if(isRemoveAloneNode){
+			d3.selectAll("rect").each(function (){
+				if(this.__data__.name == removeNodeName){
+					d3.select(this).remove();
+					return true;
+				}
+			});
+			d3.selectAll("text").each(function (){
+				if(this.__data__.name == removeNodeName){
+					d3.select(this).remove();
+					return true;
+				}
+			});
+		}
+	}
+	d3.selectAll("path").each(function (){
+		if(name == this.__data__.target.name){
+			var fromNodeName = this.__data__.source.name;
+			d3.select(this).remove();
+			removeAloneNode(fromNodeName);
+		}else if(name == this.__data__.source.name){
+			var toNodeName = this.__data__.target.name;
+			d3.select(this).remove();
+			removeAloneNode(toNodeName);
+		}
+	});
+	d3.selectAll("rect").each(function (){
+		if(name == this.__data__.name){
+			d3.select(this).remove();
+		}
+	});
+	d3.selectAll("text").each(function (){
+		if(name == this.__data__.name){
+			d3.select(this).remove();
+		}
+	});
+}
+Relation.prototype.tick = function(e){
+	var thisClass = this;
+	this.lines.attr("d", function(d){
+		var sy   = d.source.y,
+			x    = d.target.x,
+            y    = d.target.y;
+		if(sy > y){
+			sy -= 12;
+		}else{
+			sy += 5;
+		}
+		var line = new geo.LineSegment(d.source.x, sy, x, y);
+		for (var e in d.target.edge) {
+            var ix = line.intersect(d.target.edge[e].offset(x, y));
+            if (ix.in1 && ix.in2) {
+                x = ix.x;
+                y = ix.y;
+                break;
+            }
+        }
+        var dx = x - d.source.x,
+	        dy = y - sy,
+	        dr = Math.sqrt(dx * dx + dy * dy),
+	        theta = Math.atan2(dy, dx) + Math.PI / 7.85,
+	        d90 = Math.PI / 2,
+	        dtxs = x - Math.cos(theta),
+	        dtys = y - Math.sin(theta);
+	    return "M" + d.source.x + "," + sy + "A" + dr + "," + dr + " 0 0 1," + x + "," + y + "A" + dr + "," + dr + " 0 0 0," + d.source.x + "," + sy + "M" + dtxs + "," + dtys +  "l" + (3.5 * Math.cos(d90 - theta) - 10 * Math.cos(theta)) + "," + (-3.5 * Math.sin(d90 - theta) - 10 * Math.sin(theta)) + "L" + (dtxs - 3.5 * Math.cos(d90 - theta) - 10 * Math.cos(theta)) + "," + (dtys + 3.5 * Math.sin(d90 - theta) - 10 * Math.sin(theta)) + "z";
+	});	
+	this.nodes.attr("transform", function(d) {
+		return "translate(" + d.x + "," + d.y + ")scale(" + thisClass.zoomlevel+ ")";
+	});
+}
+Relation.prototype.zoomed = function() {
+	this.svg.attr("transform", 
+		"translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
+}
+Relation.prototype.highlightObject = function(obj,flag){
+	if(this.mouseoverstatus){
+		return;
+	}
+	if(!flag){
+		d3.selectAll(".node").each(function (){
+			d3.select(this).style("opacity","1");
+		});
+		d3.selectAll("path").each(function (){
+			d3.select(this).style("opacity","1");
+		});
+		return;
+	}
+	var name = obj.__data__.name;
+	d3.selectAll(".node").each(function (){
+		if(name != this.__data__.name){
+			d3.select(this).style("opacity","0.2");
+		}
+	});
+	d3.selectAll("path").each(function (){
+		var targetName = this.__data__.target.name;
+		var sourceName = this.__data__.source.name;
+		if(name != targetName && name != sourceName){
+			d3.select(this).style("opacity","0.2");
+		}else{
+			d3.selectAll(".node").each(function (){
+				if(targetName == this.__data__.name || sourceName == this.__data__.name){
+					d3.select(this).style("opacity","1");
+				}
+			});
+		}
+	});
+}
+Relation.prototype.makeRelation = function(){
+	var thisClass = this;
+	this.force = d3.layout.force()
+	    .nodes(this.data.nodes)
+	    .links(this.data.links)
+	    .size([this.w, this.h])
+	    .linkDistance(function(p){
+			return Math.floor(Math.random()*60)+90;
+		})
+		.chargeDistance(600)
+	    .charge(this.chargeVal)
+		.linkStrength(1)
+		.on('tick',function(){
+			thisClass.tick();
+		});
+	var dragstatus = false;
+	var drag = this.force.drag()
+		.on("dragstart",function(d,i){
+			d.fixed = true;    //拖拽开始后设定被拖拽对象为固定
+			d3.event.sourceEvent.stopPropagation(); // Prevent panning
+		})
+		.on("drag",function(d,i){
+			dragstatus = true;
+			thisClass.mouseoverstatus = true;
+		})
+		.on("dragend",function(d,i){
+			thisClass.mouseoverstatus = false;
+			setTimeout(function(){
+				dragstatus = false;
+			},500)
+		});
+	
+	//处理缩放
+	var zoom = d3.behavior.zoom().scaleExtent([0.4, 10]).on("zoom", function(){
+		thisClass.zoomed();
+	});
+	this.svg = d3.select("#entrelation-infovis").append("svg:svg")
+	    .attr("width", this.w)
+	    .attr("height", this.h)
+		.call(zoom)
+		.append("g");
+	this.lines = this.svg.append("svg:g")
+	    .selectAll("path")
+	    .data(this.force.links())
+	    .enter().append("path")
+		.style("fill", function(p){
+	    	return (p.type=="cp" || p.isLegal)?"#cd93d7":"#cecece";
+	    })
+		.style("stroke", function(p){
+	    	return (p.type=="cp" || p.isLegal)?"#cd93d7":"#cecece";
+	    })
+		.attr("stroke-width",function (e,i){
+			return e.linkVal;
+		});
+	this.lines.each(function (d,i){
+		var invacconam = new Number(d.invacconam);
+		if(invacconam > 0){
+			var lenInvacconam = (invacconam + "").length;
+			if(lenInvacconam > 4 && (invacconam + "").indexOf(".") > -1 && (lenInvacconam - (invacconam + "").indexOf(".")) > 4){
+				invacconam = (new Number(invacconam)).toFixed(4);
+			}
+			d3.select(this).append("title").text("投资金额:"+invacconam+"万元");
+		}
+	});
+	this.nodes = this.svg.append("svg:g")
+	    .selectAll(".node")
+	    .data(this.force.nodes())
+	  	.enter()
+		.append("g")
+		.call(this.force.drag)
+		.attr('class', 'node')
+		.on('mouseover', function(d) {
+	        thisClass.highlightObject(this,true);
+	    })
+	    .on('mouseout', function(d) {
+			thisClass.highlightObject(this,false);
+	    })
+		.on("mousedown",function (e,i){
+			d3.event.preventDefault();
+			thisClass.removeNode(this);
+		});
+	this.nodes.append("rect")
+		.attr("rx", 5)
+	    .attr("ry", 5)
+		.attr('height', 20)
+		.attr("fill", function(p){
+			if(p.type == "e" && (p.opstate == "11" || p.opstate == "07")){
+				return "#cecece";
+			}
+	    	return p.type=="p"?"#2196f3":p.type=="ce"?"#ff9800":"#cddc39";
+	    })
+		.attr("stroke", function(p){
+			if(p.type == "e" && (p.opstate == "11" || p.opstate == "07")){
+				return "#cecece";
+			}
+	    	return p.type=="p"?"#2196f3":p.type=="ce"?"#ff9800":"#cddc39";
+	    }).style("opacity",function(p){
+			if(p.type=="e" && (p.opstate != "11" || p.opstate != "07")){
+				return "0.5";
+			}
+			return "1";
+		});
+	this.nodes.each(function (d,i){
+		if(d.type == "ce" || d.type == "e"){
+			var title = "";
+			if(d.text != d.shortText){
+				title = d.text;
+			}
+			var regcap = d.regcap;
+			if(regcap > 0){
+				var lenRegcap = (regcap + "").length;
+				if(lenRegcap > 4 && (regcap + "").indexOf(".") > -1 && (lenRegcap - (regcap + "").indexOf(".")) > 4){
+					regcap = (new Number(regcap)).toFixed(4);
+				}
+				if(title != ""){
+					title += "\n";
+				}
+				title += "注册资本:"+regcap+"万元";
+			}
+			if(title != ""){
+				d3.select(this).append("title").text(title);
+			}
+		}
+	});
+	this.nodes.append('text')
+    .text(function(d){
+		return d.shortText;
+	})
+	.style("cursor",function (d,i){
+		if(d.type == "e"){
+			return "pointer";
+		}else{
+			return "auto";
+		}
+	})
+	.on("click",function (d,i){
+		if(!dragstatus && d.type == "e"){
+			window.open("/enterpriseInfoByRegNO/"+d.name+".html");
+		}
+	});
+	setTimeout(function() {
+	    thisClass.nodes.each(function(d) {
+	        var node   = d3.select(this),
+	            text   = node.selectAll('text'),
+	            bounds = {},
+	            first  = true;
+				
+			text.each(function() {
+	            var box = this.getBBox();
+	            if (first || box.x < bounds.x1) {
+	                bounds.x1 = box.x;
+	            }
+	            if (first || box.y < bounds.y1) {
+	                bounds.y1 = box.y;
+	            }
+	            if (first || box.x + box.width > bounds.x2) {
+	                bounds.x2 = box.x + box.width;
+	            }
+	            if (first || box.y + box.height > bounds.y2) {
+	                bounds.y2 = box.y + box.height;
+	            }
+	            first = false;
+	        }).attr('text-anchor', 'middle');
+				
+	        var padding  = {"left":3,"right":3,"top":2,"bottom":2},
+	            margin   = {"left":3,"right":3,"top":2,"bottom":2},
+	            oldWidth = bounds.x2 - bounds.x1;
+	
+	        bounds.x1 -= oldWidth / 2;
+	        bounds.x2 -= oldWidth / 2;
+	
+	        bounds.x1 -= padding.left;
+	        bounds.y1 -= padding.top;
+	        bounds.x2 += padding.left + padding.right;
+	        bounds.y2 += padding.top  + padding.bottom;
+			
+			var width = bounds.x2 - bounds.x1;
+			var height = bounds.y2 - bounds.y1;
+	        node.select('rect')
+	            .attr('x', bounds.x1)
+	            .attr('y', bounds.y1)
+				//.attr('height', height)
+	            .attr('width', width);
+	            
+	        d.edge = {
+	            left   : new geo.LineSegment(bounds.x1, bounds.y1, bounds.x1, bounds.y2),
+	            right  : new geo.LineSegment(bounds.x2, bounds.y1, bounds.x2, bounds.y2),
+	            top    : new geo.LineSegment(bounds.x1, bounds.y1, bounds.x2, bounds.y1),
+	            bottom : new geo.LineSegment(bounds.x1, bounds.y2, bounds.x2, bounds.y2)
+	        };
+	    });
+	   thisClass.force.start();
+	},10);
+	//var diagonal = d3.svg.diagonal().projection(function(d) { return [d.y, d.x]; });
+}

+ 0 - 0
core/src/web/staticres/wxswordfish/images/4 .png → core/src/web/staticres/wxswordfish/images/feerule.png


+ 2 - 1
core/src/web/staticres/wxswordfish/main.js

@@ -379,6 +379,7 @@ function commonAjaxReq(object,module){
 	}
 	dataObj[module+"_keys"] = this.setKeyWord(module);
 	dataObj[module+"_scope"] = this.setScope(module);
+
 	if(dataObj[module+"_keys"].length > 0 && dataObj[module+"_scope"] == ""){
 		dataObj[module+"_scope"] = "A";
 	}
@@ -387,7 +388,7 @@ function commonAjaxReq(object,module){
 	/*****************************************/
 	$.ajax({
 		type: "POST",
-		url: "/swordfish/ajaxReq",
+		url: "/member/swordfish/ajaxReq",
 		data: dataObj,
 		dataType: "json",
 		traditional: true,

+ 6 - 6
core/src/web/staticres/wxswordfish/share.js

@@ -1,4 +1,4 @@
-function initShare(signature){
+function initShare(signature,shareid){
 	if(typeof(signature) != "undefined" && signature != null && signature.length == 4){
 		wx.config({
 		    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
@@ -10,8 +10,8 @@ function initShare(signature){
 		});
 		wx.ready(function () {
 	        wx.onMenuShareTimeline({
-			    title: '剑鱼招标订阅免费用,关注即可抽取iPadmini。', // 分享标题
-			    link: 'http://www.qimingxing.info/swordfish/share', // 分享链接
+			    title: '剑鱼招标订阅免费用,关注即可抽取iPad mini。', // 分享标题
+			    link: 'http://www.qimingxing.info/front/weixinshare/'+shareid, // 分享链接
 			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/share-icon.png', // 分享图标
 			    success: function () { 
 			       //alert('分享成功');
@@ -22,11 +22,11 @@ function initShare(signature){
 			});
 			
 			wx.onMenuShareAppMessage({
-			    title: '剑鱼招标订阅免费用,关注即可抽取iPadmini。', // 分享标题
+			    title: '剑鱼招标订阅免费用,关注即可抽取iPad mini。', // 分享标题
 			    desc: '关注微信并设置剑鱼关键词,全国招标信息统统推送给您!', // 分享描述
-			    link: 'http://www.qimingxing.info/swordfish/share', // 分享链接
+			    link: 'http://www.qimingxing.info/front/weixinshare/'+shareid, // 分享链接
 			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/share-icon.png', // 分享图标
-			    type: 'link', // 分享类型,music、video或link,不填默认为link
+			    type: 'link', // 分享类型,music、video或link,不填默认为link'
 			    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
 			    success: function () { 
 			        //alert('分享成功');

+ 9 - 5
core/src/web/staticres/wxswordfish/style.css

@@ -529,18 +529,18 @@ img{
 }
 .tip-button{
 	float: right;
- 	margin-right: 50px;
+ 	margin-right: 20px;
 	margin-top:5px;
 }
 .tip-button span{
-	border-radius:5px;
+	border-radius:4px;
 	display:inline-block;
-	padding:3px 10px;
-	margin-right:5px;
+	padding:4px 20px;
+	margin-right:10px;
 	border:1px solid #689AFF;
 	cursor:pointer;
 }
-.tip-button span:nth-child(1){
+.tip-button span:nth-child(2){
 	background-color:#24C0D7;
 }
 .visible{
@@ -552,4 +552,8 @@ img{
 	margin-left:2px;
 	color:#999;
 }
+#txt_tip{
+	text-indent:2em;
+	padding:10px;
+}
 	

+ 10 - 12
core/src/web/templates/_err.html

@@ -3,20 +3,18 @@
 	<title>企明星----网页错误</title>
 	{{include "/common/inc.html"}}
 	<body>
-	<div class="container-fluid">
-	<div class="row page-header" style="height:100px;margin:20px 0;">
-	 <a href="/"><img  src="/images/logo.png" class="header_logo"/></a>
-	</div>
-	<div class="row" style="margin:50px 0;">
-		<div class="col-lg-6 col-md-6 col-sm-6 " style="text-align:right">
-		 <img src="/images/404.png" width="200" height="275"/>
-		</div>
-		<div class="col-lg-6 col-md-6 col-sm-6 " style="padding-top: 50px;padding-bottom: 50px;">
-			<div style="padding-left: 55px;"><h4><strong class="text-muted">网络错误,页面找不到</strong></h4></div>
-			<div id="alink" class="text-center" style="width:300px;margin-top:30px;"><h4 style="display:inline-block;"><a href="{{.T.refer}}"><img s1="reload.png" s2="u170.png" src="/images/reload.png" style="width:18px;margin-right:5px;">刷新页面</a> | </h4><h4 style="display:inline-block"><a href="/"><img s1="home1.png" s2="home2.png" src="/images/home1.png" style="width:18px;margin-right:5px;">返回首页</a></h4></div>
+	{{include "/common/errorhead.html"}}
+	<div class="container-fluid b-content">
+		<div class="row" style="margin:50px 0;">
+			<div class="col-lg-6 col-md-6 col-sm-6" style="text-align:right">
+			 <img src="/images/404.png" width="200" height="275"/>
+			</div>
+			<div class="col-lg-6 col-md-6 col-sm-6" style="padding-top: 100px;padding-bottom: 50px;">
+				<div style="padding-left: 55px;"><h4><strong class="text-muted">网络错误,页面找不到</strong></h4></div>
+				<div id="alink" class="text-center" style="width:300px;margin-top:30px;"><h4 style="display:inline-block;"><a href="{{.T.refer}}"><img s1="reload.png" s2="u170.png" src="/images/reload.png" style="width:18px;margin-right:5px;">刷新页面</a> | </h4><h4 style="display:inline-block"><a href="/"><img s1="home1.png" s2="home2.png" src="/images/home1.png" style="width:18px;margin-right:5px;">返回首页</a></h4></div>
+			</div>
 		</div>
 	</div>
-	</div>
 	<script>
 	$(function(){
 		$("#alink a").hover(function(){

+ 23 - 17
core/src/web/templates/active/luckdraw.html

@@ -14,7 +14,7 @@
 <script src="/wxswordfish/share.js"></script>
 <script src="/js/bootstrap.min.js"></script>
 <script>
-	initShare({{.T.signature}});
+	initShare({{.T.signature}},{{.T.shareid}});
 </script>
 <style>
 *{padding:0; margin:0;}
@@ -32,17 +32,23 @@
 </button>
 <!-- 模态框(Modal) -->
 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
-   aria-labelledby="myModalLabel" aria-hidden="true" style="margin-top: 25%;
-">
+   aria-labelledby="myModalLabel" aria-hidden="true" style="padding-top: 25%;">
    <div class="modal-dialog">
       <div class="modal-content">
+	
+         <div class="modal-header">
+            <button type="button" class="close" 
+               data-dismiss="modal" aria-hidden="true" style="width: 40px;height: 30px;">
+                  &times;
+            </button>
+            <h4 class="modal-title" id="myModalLabel">
+               企明星新年大抽奖
+            </h4>
+         </div>
          <div class="modal-body">
             
          </div>
          <div class="modal-footer">
-            <button type="button" class="btn btn-primary" 
-               data-dismiss="modal">关闭
-            </button>
          </div>
       </div><!-- /.modal-content -->
 </div><!-- /.modal -->
@@ -58,9 +64,13 @@
 $(function(){ 
     var flog = {{.T.flog}};
 	if (flog == "A"){
-		$(".modal-body").html("小主莫贪心,每人只有一次抽奖机会呦!<br/><br/>小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)")
+		$(".modal-body").html("{{.T.msg}}")
+		$(".modstart").click();
+		$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
+	}else if (flog == "B"){
+		$(".modal-body").html("{{.T.msg}}")
 		$(".modstart").click();
-		$("#btn_run").attr('disabled',true).css("cursor","pointer");
+		$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 	}
      $("#btn_run").click(function(){
 		$("#btn_run").attr('disabled',true).css("cursor","default"); 
@@ -84,21 +94,17 @@ function lottery(){
 					easing: $.easing.easeOutSine, 
 					callback: function(){ 
 						//alert(obj.results); 
-						$("#btn_run").attr('disabled',true).css("cursor","pointer"); 
-						if (obj.prize == "谢谢参与"){
-							$(".modal-body").html("小主不要桑心,这次没有中奖不代表什么,猴年依然会好运气爆棚滴~~<br/><br/>小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)")
-							$(".modstart").click();
-						}else{
-							$(".modal-body").html("小主是真真的好运气,"+obj.prize+"落入您囊中,请速速微信联系企明星确认领奖事宜!<br/><br/>小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)")
+						$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%"); 
+							$(".modal-body").html(obj.msg)
 							$(".modstart").click();
-						}
+							$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 					} 
 				});
 			}else if (obj.flog=="A"){
-				$(".modal-body").html("小主莫贪心,每人只有一次抽奖机会呦!<br/><br/>小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)")
+				$(".modal-body").html(obj.msg)
 				$(".modstart").click();
 			}else if (obj.flog=="F"){
-				$(".modal-body").html("小主来晚了,抽奖活动已过期!如果有疑问请联系企明星!")
+				$(".modal-body").html("  小主来晚了,抽奖活动已过期!如果有疑问请联系企明星!")
 				$(".modstart").click();
 			}
         } 

+ 9 - 0
core/src/web/templates/common/errorhead.html

@@ -0,0 +1,9 @@
+<div class="b-head">
+	{{include "/common/top.html"}}
+	<div class="b-nav">
+		<ul>
+			<li class="b-nav-logo"><a href="/"><img src="/images/logo.png" class="logo"></a></li>
+			<li class="pull-right b-loginStatus" id="b-loginStatus"></li>
+		</ul>
+	</div>
+</div>

+ 0 - 4
core/src/web/templates/common/login.html

@@ -57,7 +57,6 @@
 </style>
 <script src="/js/validform-min.js"></script>
 <script type="text/javascript">
-
 //打开登录窗口
 function loginModalShow(lbt){
 	$("#head-navbar").toggleClass("hidden-xs");
@@ -69,9 +68,6 @@ function loginModalShow(lbt){
 		}
 	}
 	if(lbt>7)loginBackType = lbt;
-
-
-
 	$("#wxPic").attr("src","");
 	$.post("/front/wxlogin/getNum",function(data){
 		if(data&&data.num){		

+ 39 - 19
core/src/web/templates/common/memberleft.html

@@ -60,7 +60,15 @@
 	height: 20px;
 	margin-right: 5px;
 }
-
+.txbootleft{
+	float:left;
+	padding-left:5px;
+	
+}
+.txbootright{
+	float:right;
+	padding-right:5px;
+}
 </style>
 {{$identWay := session "identWay"}}
 {{$s_role := printf "%v" (index (session "userInfo") "s_role")}}
@@ -79,7 +87,7 @@
 			<div>
 			{{if session "credit_qd"}}
 				{{if eq (session "credit_qd") "y"}}
-					<button style="width:100px" class="btn" disabled>签到</button>
+					<button style="width:100px" class="btn" disabled>签到</button>
 				{{else}}
 					<button id="credit_qd" style="width:100px" class="btn btn-primary" onclick="qd()">签到</button>
 				{{end}}	
@@ -87,28 +95,39 @@
 				<button id="credit_qd" style="width:100px" class="btn btn-primary" onclick="qd()">签到</button>
 			{{end}}	
 			</div>
+		</div>
+	</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>积分</div>
+			<div><i class="glyphicon jinbi" style="width:25px;color:red;font-size:18px"></i>{{session "i_credit"}}</div>
+		</div>
+		<div style="height:40px;float:left;width:1px;background-color:#DDDDDD"></div>
+		<div style="float:left;width:105px;">
+			<div>认证</div>
 			<div>
-				<i class="glyphicon jinbi" style="color:red"></i>{{session "i_credit"}}
-				{{if session "identType"}}
-					{{$identType := session "identType"}}
-					{{if eq 1 $identType}}
-						{{if eq 1 $identWay}}
-						<i class="glyphicon qyrz" style="color:#FF5A5F;top:4px;"></i>已认证企业
-						{{end}}
-					{{else if eq 2 $identType}}
-						{{if eq 1 $identWay}}
-						<i class="glyphicon grrz" style="color:#FF5A5F;top:4px;"></i>已认证个人
-						{{end}}
-					{{else if eq 3 $identType}}
-						{{if eq 1 $identWay}}
-						<i class="glyphicon jgrz" style="color:#FF5A5F;top:4px;"></i>已认证机构
-						{{end}}
+			{{if session "identType"}}
+				{{$identType := session "identType"}}
+				{{if eq 1 $identType}}
+					{{if eq 1 $identWay}}
+					<i class="glyphicon qyrz" style="width:25px;color:red;font-size:18px;margin-right:0px;"></i>已认证企业
+					{{end}}
+				{{else if eq 2 $identType}}
+					{{if eq 1 $identWay}}
+					<i class="glyphicon grrz" style="width:25px;color:red;font-size:18px;margin-right:0px;"></i>已认证个人
+					{{end}}
+				{{else if eq 3 $identType}}
+					{{if eq 1 $identWay}}
+					<i class="glyphicon jgrz" style="width:25px;color:red;font-size:18px;margin-right:0px;"></i>已认证机构
 					{{end}}
-				{{else}}
-					<i class="glyphicon grrz" style="top:4px;"></i>未认证
 				{{end}}
+			{{else}}
+				<i class="glyphicon grrz" style="width:25px;color:red;font-size:18px;margin-right:0px;"></i>未认证
+			{{end}}
 			</div>
 		</div>
+	</div>
 	</a>
 	<a class="list-group-item" onclick="window.location.href = '/member/accountset/index'"><i class="glyphicon zhanghao"></i>账户设置</a>
 	<a class="list-group-item" onclick="window.location.href = '/member/swordfish/rssset'"><i class="glyphicon iconfontcolor71"></i>剑鱼(信息订阅)</a>
@@ -247,6 +266,7 @@ $(function (){
 		if(r&&r.result=="y"){
 			$("#credit_qd").attr("disabled","disabled");
 			$("#credit_qd").removeClass("btn-primary");
+			$("#credit_qd").html("已签到")
 		}
 	});
 	

+ 2 - 2
core/src/web/templates/common/swordfishhead.html

@@ -18,8 +18,8 @@ function open_window(link){
 	}
 	window.open("/visit/redirect?url="+escape(link));
 }
-function b_loadTopCallBack(result){
-	if(isLogined){
+function b_afterLogin(flag,result){
+	if(flag){
 		//立即体验
 		$("#experience").click(function(){
 			window.location.href = "/member/swordfish/rssset";

+ 3 - 3
core/src/web/templates/common/top.html

@@ -77,7 +77,7 @@ function b_loadTop(){
 						+'<li onclick="window.location.href=\'/member/show/memberindex\'"><i class="glyphicon ren1"></i>用户中心</li>'
 						+'<li onclick="window.location.href=\'/front/logout\'" class="border-b-0"><i class="glyphicon tuichu"></i>退出</li>';
 						+'</ul></div>';
-				$("#b-loginStatus").html(html)
+				$("#b-loginStatus").addClass("b-logined").html(html)
 				.mouseover(function(){
 					$("#head-hideMenu").show();
 				}).mouseleave(function(){
@@ -96,14 +96,14 @@ function b_loadTop(){
 				}
 			}else{
 				isLogined = false;
-				var html = '<a onclick="loginModalShow();">登录/注册</a>';
+				var html = '<img class="b-loginbtn cursor-pointer" onclick="loginModalShow();" src="/images/swordfish/headimg.png">';
 				$("#b-loginStatus").html(html);
 				$("#bottom-bar>li").removeClass("invisible");
 				//登录
 				$("body").append('{{include "/common/login.html"}}');
 			}
 			try{
-				b_loadTopCallBack(result);
+				b_afterLogin(isLogined,result);
 			}catch(e){}
 		},
 		error: function(e){

+ 123 - 2
core/src/web/templates/index.html

@@ -190,7 +190,7 @@
 		<div class="a-cols row index-new-xwzx-con">
  			{{range $k,$v:=.T.data}}
  			{{ if lt $k 3}}
-			<ul class="a-wrap a-com-ul-block{{if ge $k 3}} a-com-last{{end}}{{if ge $k 2}} hidden-xs{{end}}" {{if lt $k 2}} style="border-right:1px solid #ccc;padding-bottom:0px;"{{end}}>
+			<ul class="a-wrap a-com-ul-block{{if ge $k 3}} a-com-last{{end}}{{if ge $k 2}} hidden-xs{{end}}" {{if lt $k 2}} style="border-right:1px solid #e5e6e9;padding-bottom:0px;"{{end}}>
 				<li class="index-new-first"><a target="_blank" href="/front/webcontent/{{index $v "_id"}}.html"><img  data-original="{{if $v.s_pic1}}{{if eq (index $v "s_pic1") ""}}{{index $v "s_pic"}}{{else}}{{index $v "s_pic1"}}{{end}}{{else}}{{index $v "s_pic"}}{{end}}" class="lazy"   onerror="this.src='/images/u166.png'"></a></li>
 				<li class="index-new-xwzx-title"><a class="data" target="_blank" title="{{index $v "s_title"}}" href="/front/webcontent/{{index $v "_id"}}.html">{{index $v "s_shorttitle"}}</a></li>
 				<li class="index-new-xwzx-content">{{index $v "s_shortdescription"}}</li>
@@ -199,10 +199,131 @@
 			{{end}}
  			{{end}}
 		</div>
+		
+		<div class="index-new-tg index-new-bmzhsk">
+		<div class="row">
+		<div class="col-sm-1 index-new-tg-tb">
+		<ul>
+		<li>
+		<div class="bmzhsk"><img src="/images/u0115.png"/></div>
+		<div class="bmjy"><img src="/images/u0117.png"/></div>
+		<div class="bmrzqy"><img src="/images/u0119.png"/></div>
+		</li>
+		<li class="index-new-mingcheng"><div class="text-center" style="height: 119px;">知识库</div></li>
+		</ul>
+		</div>
+		<div class="col-sm-5 index-new-tg-con">
+		<ul>
+		{{range $k,$v:=.T.zkdata}}
+		{{ if lt $k 8}}
+		<li><span></span><span><a target="_blank" href="/front/webcontent/{{index $v "_id"}}.html"/>{{index $v "s_title"}}</a></span><span style="float:right;">{{if eq (index $v "releasetime") ""}}{{index $v "l_createdate"}}{{else}}{{index $v "releasetime"}}{{end}}</span></li>
+		{{if ge $k 3}}
+		{{if lt $k 4}}
+		</ul>
+		</div>
+		<div class="col-sm-1"></div>
+		<div class="col-sm-5 index-new-tg-con">
+		<ul>
+		{{end}}
+		{{end}}
+			
+		{{end}}
+		{{end}}
+		</ul>
+		</div>
+		</div>
+		</div>
+		
+		
+		<div class="index-new-tg index-new-bmjy hidden">
+		<div class="row">
+		<div class="col-sm-1 index-new-tg-tb">
+		<ul>
+		<li>
+		<div class="bmzhsk"><img src="/images/u0116.png"/></div>
+		<div class="bmjy"><img src="/images/u0118.png"/></div>
+		<div class="bmrzqy"><img src="/images/u0119.png"/></div>
+		</li>
+		<li class="index-new-mingcheng1"><div class="text-center" style="padding-top:35px;">剑鱼</div></li>
+		</ul>
+		</div>
+		<div class="col-sm-5 index-new-tg-con">
+		<ul>
+		{{range $k,$v:=.T.sfdata}}
+		{{ if lt $k 8}}
+		<li><span></span><span><a target="_blank" href="{{index $v "href"}}"/>{{index $v "title"}}</a></span><span style="float:right;">{{if (index $v "publishtime")}}{{index $v "publishtime"}}{{else}}------{{end}}</span></li>
+		{{if ge $k 3}}
+		{{if lt $k 4}}
+		</ul>
+		</div>
+		<div class="col-sm-1"></div>
+		<div class="col-sm-5 index-new-tg-con">
+		<ul>
+		{{end}}
+		{{end}}
+			
+		{{end}}
+		{{end}}
+		</ul>
+		</div>
+		</div>
+		</div>
+		
+		
+		<div class="index-new-tg index-new-bmrzqy hidden">
+		<div class="row">
+		<div class="col-sm-1 index-new-tg-tb">
+		<ul>
+		<li>
+		<div class="bmzhsk"><img src="/images/u0116.png"/></div>
+		<div class="bmjy"><img src="/images/u0117.png"/></div>
+		<div class="bmrzqy"><img src="/images/u0120.png"/></div>
+		</li>
+		<li class="index-new-mingcheng2"><div class="text-center" style="padding-top:15px;">认证企业</div></li>
+		</ul>
+		</div>
+		<div class="col-sm-5 index-new-tg-con">
+		<ul>
+		{{range $k,$v:=.T.entdata}}
+		{{ if lt $k 8}}
+		<li><span></span><span><a target="_blank" href="/enterprise/{{index $v "s_enterpriseid"}}.html"/>{{index $v "s_enterprisename"}}</a></span><span style="float:right;">{{if (index $v "l_auditdate")}}{{index $v "l_auditdate"}}{{else}}------{{end}}</span></li>
+		{{if ge $k 3}}
+		{{if lt $k 4}}
+		</ul>
+		</div>
+		<div class="col-sm-1"></div>
+		<div class="col-sm-5 index-new-tg-con">
+		<ul>
+		{{end}}
+		{{end}}
+			
+		{{end}}
+		{{end}}
+		</ul>
+		</div>
+		</div>
+		</div>
+		
 	</div>
+	
 </div>
 {{include "/common/bottom.html"}}
 <script>
+$(".bmzhsk").mouseover(function(){
+	$(".index-new-bmrzqy").addClass("hidden");
+	$(".index-new-bmjy").addClass("hidden");
+	$(".index-new-bmzhsk").removeClass("hidden");
+});
+$(".bmjy").mouseover(function(){
+	$(".index-new-bmrzqy").addClass("hidden");
+	$(".index-new-bmzhsk").addClass("hidden");
+	$(".index-new-bmjy").removeClass("hidden");
+});
+$(".bmrzqy").mouseover(function(){
+	$(".index-new-bmzhsk").addClass("hidden");
+	$(".index-new-bmjy").addClass("hidden");
+	$(".index-new-bmrzqy").removeClass("hidden");
+});
 function gomarket(code){
 	$("#c_fwtype").val(code);
 	$("form#searchForm").submit();
@@ -263,7 +384,7 @@ $(function(){
 	}else{
 		//活动处理
 		if(hasNewActive){
-			$(".a-index-hd").append('<img src="/images/activeimages/chjhd.png" onclick="window.open(\'/front/webactivitycontent/5697403b7e1eac37d5000001.html\')" class="cursor-pointer">');
+			$(".a-index-hd").append('<img src="/images/activeimages/chjhd.png" onclick="window.open(\'/front/webactivitycontent/56986e31af53740ecf000001.html\')" class="cursor-pointer">');
 			/*扫码送红包活动
 			$(".a-index-hd").append('<img src="/images/smshb.png" onclick="window.open(\'/p\')" class="cursor-pointer"><div class="smshb"><ul id="hd-smshb" class="text-center"></ul></div>');
 			$.post("/front/showAmount",null,function(r){

+ 16 - 0
core/src/web/templates/manage/web_weixinshare.html

@@ -0,0 +1,16 @@
+<html>
+<head>
+<title>帮助中心-意见反馈</title>
+{{include "/common/inc.html"}}
+<link rel="stylesheet" href="/js/kindeditor/themes/default/default.css" />
+<script charset="utf-8" src="/js/kindeditor/kindeditor-all.js"></script>
+<script charset="utf-8" src="/js/kindeditor/kinditem.js"></script>
+<script src="/js/upload.js"></script>
+<script type="text/javascript" src="/js/zDrag.js"></script>
+<script type="text/javascript" src="/js/zDialog.js"></script>
+
+</head>
+<body>
+{{.T.pngdata}}
+</body>
+</html>

+ 220 - 25
core/src/web/templates/swordfish/rssset.html

@@ -11,13 +11,18 @@
 	<div class="b-left">
 		<div class="swordfish-page-title">
 			<i class="img-circle glyphicon jianyu"></i>订阅设置
+			<!--<span >继续使用表明你已经同意了<span><a onclick="$('#yhxyModal').modal('show')">剑鱼用户服务协议</a>-->
+			<span style="float:right;width:190px">
+			<a id="ckys">查看演示&nbsp;&nbsp;</a>
+			<a id="sfbz" onclick="$('#sfbzModal').modal('show')">收费标准</a>
+			<a id="yjfk">去提意见</a>
+			</span>
 		</div>
 		<div class="swordfish-explain">
 			“剑鱼”是企明星的特色产品,它借助内置的互联网搜索引擎、大数据平台和自然语言分析系统,
 			为企业从互联网上自动抓取、分析、筛选并推送富有价值的信息情报,
 			比如本企业或其他企业的失信行为信息、受到行政处罚的信息、招标公告、中标公告等等。
 			您在输入了想要订阅的信息主题以后,网上一旦发布这些主题的信息,剑鱼就会第一时间将信息推送给您。
-			<br><span class="pull-right">信息类型太少?没有找到想要的?<a id="yjfk">去提意见</a></span>
 			<div class="clearfix"></div>
 		</div>
 		<div class="swordfish-panel" id="tender">
@@ -25,11 +30,20 @@
 				<img class="swordfish-uncheck" src="/images/swordfish/checkbox.png">
 				<img class="swordfish-checked" src="/images/swordfish/checkbox-a.png">
 				招标公告
+				<span>
+				{{if .T.msgset}}
+					{{if .T.msgset.tender}}
+						{{if .T.msgset.tender.day}}
+						本栏目推送服务期还剩{{.T.msgset.tender.day}}天。想要服务不间断,请确保积分充足。 <a href="/member/credit/myCredit">去做任务赚积分</a>
+						{{end}}
+					{{end}}
+				{{end}}
+				</span>
 			</div>
 			<div class="swordfish-panel-c">
 				<div>
 					<div class="swordfish-panel-c-t">
-						<span></span><div>订阅关键词<span>最多订阅5组关键词</span></div>
+						<span></span><div>订阅关键词<span>最多订阅10组关键词</span></div>
 					</div>
 					<div class="swordfish-panel-c-c swordfish-keywords" id="tender-keywords">
 						<button class="btn" id="tender-addkeyword"><span>+</span>添加关键词</button>
@@ -50,11 +64,20 @@
 				<img class="swordfish-uncheck" src="/images/swordfish/checkbox.png">
 				<img class="swordfish-checked" src="/images/swordfish/checkbox-a.png">
 				中标公告
+				<span id="bid-panel-info">
+				{{if .T.msgset}}
+					{{if .T.msgset.bid}}
+						{{if .T.msgset.bid.day}}
+						本栏目推送服务期还剩{{.T.msgset.bid.day}}天。想要服务不间断,请确保积分充足。 <a href="/member/credit/myCredit">去做任务赚积分</a>
+						{{end}}
+					{{end}}
+				{{end}}
+				</span>
 			</div>
 			<div class="swordfish-panel-c">
 				<div>
 					<div class="swordfish-panel-c-t">
-						<span></span><div>订阅关键词<span>最多订阅5组关键词</span></div>
+						<span></span><div>订阅关键词<span>最多订阅10组关键词</span></div>
 					</div>
 					<div class="swordfish-panel-c-c swordfish-keywords" id="bid-keywords">
 						<button class="btn swordfish-addkeyword" id="bid-addkeyword"><span>+</span>添加关键词</button>
@@ -227,13 +250,79 @@
 	    </div>
   	</div>
 </div>
+
+<!-- tishiModal -->
+<div class="modal fade b-modal" id="tishiModal" tabindex="-1" role="dialog" aria-labelledby="tishiModalLabel">
+  	<div class="modal-dialog" role="document">
+		<div class="modal-content">
+		  	<div class="modal-header-jy">
+				<span data-dismiss="modal" aria-label="Close" class="close glyphicon guanbi1"></span>
+				<span class="modal-title" id="vipcreditModalLabel">提示信息</span>
+			</div>
+			<div class="swordfish-explain2">
+				<div id="swordfish-tishi"></div>
+				<div id="btn-tijiao" style="text-align:center;padding:10px 0;"></div>
+			</div>
+		</div>
+	</div>
+</div>
+
+<!-- 用户协议 -->
+<div class="modal fade b-modal" id="yhxyModal" tabindex="-1" role="dialog" aria-labelledby="yhxyModalLabel">
+  	<div class="modal-dialog" role="document">
+		<div class="modal-content">
+		  	<div class="modal-header-jy">
+				<span data-dismiss="modal" aria-label="Close" class="close glyphicon guanbi1"></span>
+				<span class="modal-title" id="yhxyModalLabel">用户协议</span>
+			</div>
+			<div style="background-color: #FCF8E3;padding:10px;line-height:25px">
+				<div>
+					<p style="margin-left:5px">剑鱼用户协议:</p>
+					<p style="margin-left:15px">
+					 
+					</p>
+				</div>
+				<div style="text-align:center;padding:10px 0;">
+					<button class='btn btn-primary' onclick="$('#yhxyModal').modal('hide')">确定</button>
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+
+<!-- 收费标准 -->
+<div class="modal fade b-modal" id="sfbzModal" tabindex="-1" role="dialog" aria-labelledby="sfbzModalLabel">
+  	<div class="modal-dialog" role="document">
+		<div class="modal-content">
+		  	<div class="modal-header-jy">
+				<span data-dismiss="modal" aria-label="Close" class="close glyphicon guanbi1"></span>
+				<span class="modal-title" id="sfbzModalLabel">用户协议</span>
+			</div>
+			<div style="background-color: #FCF8E3;padding:10px 20px;line-height:25px">
+				<div>
+					<p style="margin-left:5px">剑鱼收费标准:</p>
+					<p style="margin-left:35px">
+					每个栏目、每月1000积分。
+					积分按月扣除,到期后默认自动扣除下月积分,积分不足则停止服务。如果您不希望下月继续服务,可提前将服务关闭。
+					</p>
+				</div>
+				<div style="text-align:center;padding:10px 0;">
+					<button class='btn btn-primary' onclick="$('#sfbzModal').modal('hide')">确定</button>
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
 <!-- 底部 -->
 {{include "/common/bottom.html"}}
 <script type="text/javascript">
+//Array.prototype.indexOf = function (val) {for (var i = 0; i < this.length; i++) {if (this[i] == val) {return i;}} return -1;};  
+//Array.prototype.removevalue = function (val){var index=this.indexOf(val);if(index > -1){this.splice(index, 1);}}; 
+var oprarr = new Array();
 $(function(){
-	var selectKeyword = function(type,keyword){
+	var selectKeyword = function(type,keyword,i_switchstatus){
 		if(keyword == "" || typeof(keyword) == "undefined"){
-			autoChecked(type,false);
+			autoChecked(type,i_switchstatus==1?true:false,i_switchstatus);
 			return;
 		}
 		for(var i=0;i<keyword.length;i++){
@@ -265,14 +354,21 @@ $(function(){
 	if(msgset != ""){
 		if(typeof(msgset.tender) != "undefined"){
 			selectScope("tender",msgset.tender.s_scope);
-			selectKeyword("tender",msgset.tender.a_key);
+			var i_switchstatus=msgset.tender.i_switchstatus;
+			selectKeyword("tender",msgset.tender.a_key,i_switchstatus);
+			autoChecked("tender",i_switchstatus==1?true:false,i_switchstatus);
 		}
 		if(typeof(msgset.bid) != "undefined"){
 			selectScope("bid",msgset.bid.s_scope);
-			selectKeyword("bid",msgset.bid.a_key);
+			var i_switchstatus=msgset.bid.i_switchstatus
+			selectKeyword("bid",msgset.bid.a_key,i_switchstatus);
+			autoChecked("bid",i_switchstatus==1?true:false,i_switchstatus);
 		}
 	}
 	$(".b-nav>ul>li:eq(2)").addClass("b-nav-active");
+	$("#ckys").click(function(){
+		window.location.href="/front/swordfish";
+	});
 	$("#yjfk").click(function(){
 		$("body").append('<form id="feedbackForm" action="/front/web_feedbacklist.html" method="post" class="hide"><input type="hidden" name="url" value="'+window.location.href+'"></form>');
 		$("#feedbackForm").submit();
@@ -291,10 +387,44 @@ $(function(){
 	$("#bid-scope-dialog").find("li .btn").click(function(){
 		afterSelectScope("bid",$(this));
 	});
+	var tender_i_status=0;
+	var bid_i_status=0;
+	var i_credit={{session "i_credit"}}
+	if(typeof(msgset.tender) != "undefined"&&typeof(msgset.tender.i_status) != "undefined"&&msgset.tender.i_status==1){
+		tender_i_status=1;
+	}
+	if(typeof(msgset.bid) != "undefined"&&typeof(msgset.bid.i_status) != "undefined"&&msgset.bid.i_status==1){
+		bid_i_status=1;
+	}
 	$(".swordfish-uncheck").click(function(){
-		$(this).next().show();
+		var type=$(this).parent().parent().attr("id");
+		//如果新增功能扣积分
+		if(type=="tender"&&tender_i_status==0){
+			oprarr.push("types=tender");
+		}
+		if(type=="bid"&&bid_i_status==0){
+			oprarr.push("types=bid");
+		}
+		var typeinfo="";
+		if(type=="tender"){
+			typeinfo="招标公告";
+		}else{
+			typeinfo="中标公告 ";
+		}
+		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){				
+				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>";
+			}
+			$("#swordfish-tishi").html(str1);
+			$("#btn-tijiao").html(str2);
+			$("#tishiModal").modal("show");
+		}
 		$(this).hide();
-		autoChecked($(this).parents(".swordfish-panel").attr("id"),true);
+		autoChecked($(this).parents(".swordfish-panel").attr("id"),true,1);
 	});
 	$(".swordfish-checked").click(function(){
 		$(this).parents(".swordfish-panel").removeClass("swordfish-panel-a");
@@ -302,6 +432,17 @@ $(function(){
 		$(this).hide();
 		ajaxReq();
 	});
+	//针对页面异常关闭
+	if(typeof(msgset.tender) != "undefined"&&typeof(msgset.tender.i_switchstatus) != "undefined"&&msgset.tender.i_switchstatus==1){
+		if(tender_i_status==0){
+			$("#tender").children(".swordfish-panel-t").children(".swordfish-uncheck").click();
+		}
+	}
+	if(typeof(msgset.bid) != "undefined"&&typeof(msgset.bid.i_switchstatus) != "undefined"&&msgset.bid.i_switchstatus==1){
+		if(bid_i_status==0){
+			$("#bid").children(".swordfish-panel-t").children(".swordfish-uncheck").click();
+		}
+	}
 });
 function afterSelectScope(type,btn){
 	var text = btn.text();
@@ -326,10 +467,10 @@ function afterSelectScope(type,btn){
 			}
 		});
 	}
-	autoChecked(type,true);
+	autoChecked(type,true,1);
 	ajaxReq();
 }
-function autoChecked(type,flag){
+function autoChecked(type,flag,i_switchstatus){
 	var obj = $("#"+type);
 	if(obj.find(".swordfish-scope").children(".btn").length == 0){
 		obj.find(".swordfish-scope").html('<button class="btn swordfish-btn-a swordfish-country">全国</button>');
@@ -338,9 +479,12 @@ function autoChecked(type,flag){
 	if(obj.hasClass("swordfish-panel-a")){
 		return;
 	}
-	obj.addClass("swordfish-panel-a");
-	obj.find(".swordfish-uncheck").hide();
-	obj.find(".swordfish-checked").show();
+	if(i_switchstatus==1){
+		obj.addClass("swordfish-panel-a");
+		obj.find(".swordfish-uncheck").hide();
+		obj.find(".swordfish-checked").show();
+		obj.find(".swordfish-checked").next().css('display','');
+	}
 	if(obj.find(".swordfish-keywords").children(".swordfish-keyword").length == 0){
 		appendKeyWord(type,"",false);
 	}
@@ -350,18 +494,25 @@ function autoChecked(type,flag){
 }
 function appendKeyWord(type,value,isFocus){
 	this.getHtml = function(index,value){
-		return '<div class="swordfish-keyword">'
+		var html='<div class="swordfish-keyword">'
 					+'<lable>关键词<font>'+index+'</font>:</lable>'
 					+'<input type="text" class="form-control" value="'+(value?value:"")+'" placeholder="示例:综合布线 电话线 网线" maxlength="100">'
 					+'<img src="/images/swordfish/delete.png">'
 				+'</div>';
+		if (index==1){
+			html='<div class="swordfish-keyword">'
+					+'<lable>关键词<font>'+index+'</font>:</lable>'
+					+'<input type="text" class="form-control" value="'+(value?value:"")+'" placeholder="示例:综合布线 电话线 网线" maxlength="100">'
+				+'</div>';
+		}
+		return html;
 	}
 	var obj = $("#"+type+"-keywords");
 	var count = obj.children(".swordfish-keyword").length;
-	if(count >= 5){
+	if(count >= 10){
 		return;
 	}
-	if(count == 4){
+	if(count == 9){
 		$("#"+type+"-addkeyword").attr("disabled",true);
 	}
 	var node = $(getHtml(count+1,value));
@@ -372,24 +523,24 @@ function appendKeyWord(type,value,isFocus){
 		obj.find(".swordfish-keyword").each(function(i){
 			$(this).children("b").children("font").text(i+1);
 		});
-		autoChecked(type,false);
 		ajaxReq();
 	});
 	node.children("[type='text']").blur(function(){
-		autoChecked(type,false);
 		ajaxReq();
 	});
 	if(isFocus){
 		node.children("[type='text']").focus()
 	}
-	autoChecked(type,false);
 }
 function ajaxReq(){
 	var thisClass = this;
 	var dataObj = {
+		reqType: "other",
+		snopshot:false,
 		tender_flag: $("#tender").hasClass("swordfish-panel-a"),
 		bid_flag: $("#bid").hasClass("swordfish-panel-a")
 	};
+
 	//关键词
 	this.setKeyWord = function(type){
 		var tender_keys = [];
@@ -417,19 +568,26 @@ function ajaxReq(){
 		return tender_scope.join(",");
 	}
 	/*******************招标公告****************/
+	dataObj["tender_keys"] = this.setKeyWord("tender");
+	dataObj["tender_scope"] = this.setScope("tender");
 	if(dataObj.tender_flag){
-		dataObj["tender_keys"] = this.setKeyWord("tender");
-		dataObj["tender_scope"] = this.setScope("tender");
+		dataObj["tender_switchstatus"] = 1;
+	}else{
+		dataObj["tender_switchstatus"] = 0;
 	}
 	/*******************中标公告****************/
+	dataObj["bid_keys"] = this.setKeyWord("bid");
+	dataObj["bid_scope"] = this.setScope("bid");
 	if(dataObj.bid_flag){
-		dataObj["bid_keys"] = this.setKeyWord("bid");
-		dataObj["bid_scope"] = this.setScope("bid");
+		dataObj["bid_switchstatus"] = 1;	
+	}else{
+		dataObj["bid_switchstatus"] = 0;
 	}
 	/*****************************************/
 	$.ajax({
 		type: "POST",
-		url: "/member/swordfish/rssset/ajaxReq",
+		//url: "/member/swordfish/rssset/ajaxReq",
+		url: "/member/swordfish/ajaxReq",
 		data: dataObj,
 		dataType: "json",
 		traditional: true,
@@ -441,6 +599,43 @@ function ajaxReq(){
 		}
 	});
 }
+
+//扣积分
+function swordfishpay(oprtype){
+	$("#tishiModal").modal("hide");
+	$.ajax({
+		dataType:"json",
+		url:"/member/credit/swordfishpay",
+		data:oprarr.join("&")+"&no="+oprtype,
+		type:"POST",
+		async:false,
+		success:function(msg){
+			if(msg){
+				if(msg.flag){
+					//有session
+					if(msg.oprstatus){
+						//扣积分操作成功
+						$("#tishiModal").hide()
+					}else{
+						//扣积分操作无效
+						alert("操作无效,请重新进入页剑鱼页面后操作")
+					}				
+				}else{
+					//无session
+					alert("请重新进入页剑鱼页面后操作")
+				}
+			}			
+		},
+		error:function(x,st,err){
+			alert("请稍后再试"+st)
+		}
+	})
+	window.location.reload()
+}
+//弹窗关闭,取消
+$('#tishiModal').on('hidden.bs.modal', function () {
+  swordfishpay(1);
+})
 </script>
 </body>
 </html>

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

@@ -18,8 +18,8 @@
 	<div class="tip">
 		<div id="txt_tip"></div>
 		<div class="tip-button">
-		<span id="credit_yes">提交</span>
 		<span id="credit_no">取消</span>
+		<span id="credit_yes">提交</span>
 		</div>
 		<div style="clear:both"></div>
 	</div>
@@ -63,7 +63,7 @@
 			<span class="on-off" id="intelligence-on-off"></span>
 		</li>
 		<li class="parent-node">
-			<img src="/wxswordfish/images/qingbao.png">
+			<img src="/wxswordfish/images/feerule.png">
 			收费规则
 			<span class="rule" id="rule"></span>
 		</li>

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

@@ -34,7 +34,7 @@
 		<div class="dialog-content" style="height:115px;">
 			<div class="rule-content">
 				<div>剑鱼收费标准:</div>
-				<div>每个栏目、每月1000积分。</div>
+				<div>每个栏目、每月1000积分。</div>
 				<div>积分按月扣除,到期后默认自动扣除下月积分,积分不足则停止服务。如果您不希望下月继续服务,可提前将服务关闭。</div>
 			</div>
 		</div>

+ 166 - 78
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -6,9 +6,7 @@
 <meta name="Keywords" content="{{.T.res.EntName}},{{.T.res.EntName}}地址,{{.T.res.EntName}}怎么样"/>
 <meta name="Description" content="{{.T.res.OpScope}}"/>
 <link href="/css/entcommunity.css" rel="stylesheet">
-<script src="/js/geocoder.js"></script>
-<script type="text/javascript" src="http://api.map.baidu.com/getscript?v=2&ak=AFd8b176f363f23e6a23d516f4cfb742&services=&t=20150522093217"></script>  
-<script src="/js/jquery.cxselect.js"></script>
+<script src="/js/entportrait.js"></script>
 </head>
 <body class="entinfo-page">
 {{include "/common/enthead.html"}}
@@ -53,7 +51,23 @@
 			<div class="b-com-last">
 				{{if .T.res.s_persion}}<span class="glyphicon ren2"></span>{{.T.res.s_persion}}<span class="margin-r-15"></span>{{end}}
 				{{if .T.res.s_mobile}}<span class="glyphicon shouji"></span>{{.T.res.s_mobile}}<span class="margin-r-15"></span>{{end}}
-				{{if .T.res.s_qq}}<span class="glyphicon qq1"></span>{{.T.res.s_qq}}{{end}}
+				{{if .T.res.s_qq}}
+					<span class="glyphicon qq1"></span>
+					<script type="text/javascript">
+					    var online = new Array();
+					</script>
+					<script type= "text/javascript" src="http://webpresence.qq.com/getonline?Type=1&{{.T.res.s_qq}}:"></script>
+					<script type="text/javascript">
+						var imgSrc = "";
+				        if(online[0] == 1) {
+							imgSrc = "/images/entcommunity/qq_online.gif";
+				        }else{
+							imgSrc = "/images/qq_offline.gif";
+						}
+						imgSrc = "/images/entcommunity/qq.png";
+						document.write('<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={{.T.res.s_qq}}&site=qq&menu=yes"><img src="'+imgSrc+'" alt="点击这里给我发消息" title="点击这里给我发消息" border="0" width="82" height="23.5"/></a>');
+					</script>
+				{{end}}
 				<br>
 				{{if .T.res.s_email}}
 					<span class="glyphicon youjian2"></span>{{.T.res.s_email}}<span class="margin-r-15"></span>
@@ -63,14 +77,14 @@
 				{{if .T.res.s_enturl}}<span class="glyphicon wangzhi1"></span>{{.T.res.s_enturl}}{{end}}
 				<br>
 				{{if or .T.res.i_province .T.res.i_city .T.res.i_area .T.res.s_address}}
-					<span class="glyphicon dizhi"></span>
+					<span class="glyphicon dizhi margin-0"></span>
 					<span id="city_china">
-						<select class="province cxselect select" id="provincesel" name="province" data-first-title="全国"></select>								
-						<select class="city cxselect select" id="citysel" name="city" data-first-title="选择市"></select>
-						<select class="area cxselect select" id="areasel" name="area" data-first-title="选择县"></select>
-						<input id="location" type="hidden">
-						<input id="cityname" type="hidden">
+						<select class="province cxselect select hide" id="provincesel" name="province" data-first-title="全国"></select>								
+						<select class="city cxselect select hide" id="citysel" name="city" data-first-title="选择市"></select>
+						<select class="area cxselect select hide" id="areasel" name="area" data-first-title="选择县"></select>
 					</span>
+					<input id="location" type="hidden">
+					<input id="cityname" type="hidden">
 					{{if .T.res.s_address}}
 					<a href="javascript:void(0)" onclick="showMap()">查看详细地图</a>
 					{{end}}
@@ -83,8 +97,8 @@
 		</div>
 	</div>
 	<!--切换-->
-	<ul class="entinfo-tab">
-		<li class="entinfo-active">企业画像</li>
+	<ul class="ent-tab">
+		<li class="ent-active">企业画像</li>
 		<li>关系网</li>
 		<li>公司简介</li>
 		<li>变更信息</li>
@@ -92,10 +106,10 @@
 		<li>产品服务信息</li>
 		<li class="border-r-0">招聘</li>
 	</ul>
-	<div class="entinfo-tab-content hide">
+	<div class="ent-tab-content">
 		<div>
 			{{if .T.res.gs}}
-			<div class="entinfo-basicinfo">
+			<div class="entinfo-basicinfo ent-layout-up">
 				<div class="b-com-title">
 					<span class="glyphicon jianzhu"></span>基本信息
 					<font>(来源:<a href="http://gsxt.saic.gov.cn/" rel="nofollow" style="text-decoration: underline;color: #0099FF;">全国企业信用信息公示系统</a>)</font>
@@ -119,6 +133,7 @@
 									{{end}}
 									{{if .T.res.EntName}}{{.T.res.EntName}}{{end}}
 								</div>
+								<br><img src="/images/entcommunity/triangle.png">
 							</span>
 							<div><span>注册号</span><span>{{if .T.res.RegNo}}{{.T.res.RegNo}}{{end}}</span></div>
 							<div><span>行业</span><span>{{if .T.res.IndustryPhyName}}{{.T.res.IndustryPhyName}}{{end}}</span></div>
@@ -214,45 +229,145 @@
 					</div>
 				</div>
 			</div>
-			<div class="entinfo-shareholderinfo">
-				<div>
+			{{end}}
+			{{if .T.res.investor}}
+			<div class="entinfo-shareholderinfo ent-layout-down">
+				<div class="b-com-title">
 					<span><span class="bootstrap-glyphicon glyphicon-menu-right"></span></span>股东信息
 				</div>
-				{{if .T.res.investor}}
-				<ul>
-					{{range $k,$v := .T.res.investor}}
-					{{if $v.InvType}}
-					<li>
-						{{if eq $v.InvType "20" "21" "22"}}
-						<img src="/images/entcommunity/ziranren.png">
-						{{else}}
-						<img src="/images/entcommunity/faren.png">
+				<div class="b-com-content">
+					<ul>
+						{{range $k,$v := .T.res.investor}}
+						{{if $v.InvType}}
+						<li>
+							{{if eq $v.InvType "20" "21" "22"}}
+							<img src="/images/entcommunity/ziranren.png">
+							{{else}}
+							<img src="/images/entcommunity/faren.png">
+							{{end}}
+							<span><b>{{$v.InvTypeName}}</b></span>
+							<span>{{$v.Inv}}</span>
+						</li>
 						{{end}}
-						<span><b>{{$v.InvTypeName}}</b></span>
-						<span>{{$v.Inv}}</span>
-					</li>
-					{{end}}
-					{{end}}
-					<div class="clearfix"></div>
-				</ul>
-				{{end}}
+						{{end}}
+						<div class="clearfix"></div>
+					</ul>
+				</div>
 			</div>
 			{{end}}
+			{{if and (not .T.res.gs) (not .T.res.investor)}}
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+			{{end}}
+		</div>
+		<div class="entrelation hide" id="entrelation">
+			<div id="entrelation-infovis"></div>
+			<div id="entrelation-limit" class="hide entrelation-limit">
+				<div id="entrelation-nologin" class="hide text-center">
+					<img src="/images/findnull.png" class="b-findnull">
+					<h5>扫码登录认证后,即可查看企业股东信息,投资关系,公司关系脉络图等内容</h5>
+					<button class="btn btn-primary" onclick="loginModalShow();">扫码登录</button>
+				</div>
+				<div id="entrelation-noauthe" class="hide text-center">
+					<img src="/images/findnull.png" class="b-findnull">
+					<h5>认证后即可查看企业股东信息,投资关系,公司关系脉络图等内容</h5>
+					<a href="/member/accountset/index" class="btn btn-primary">认证</a>
+				</div>
+				<img src="/images/entcommunity/relation.png">
+			</div>
+			<div id="entrelation-findnull" class="ent-findnull hide">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+		</div>
+		<div class="hide">
+			<div class="ent-layout-up">
+				<div class="b-com-title">
+					<span class="glyphicon jianzhu"></span>公司简介
+				</div>
+				<div class="b-com-content"></div>
+			</div>
+			<div class="ent-layout-down">
+				{{if .T.res.OpScope}}
+				<div class="b-com-title">
+					<span><span class="bootstrap-glyphicon glyphicon-menu-right"></span></span>经营范围
+				</div>
+				<div class="b-com-content">{{.T.res.OpScope}}</div>
+				{{end}}
+				{{if .T.res.s_synopsis}}
+				<div class="b-com-title">
+					<span><span class="bootstrap-glyphicon glyphicon-menu-right"></span></span>公司介绍
+				</div>
+				<div class="b-com-content">{{.T.res.s_synopsis}}</div>
+				{{end}}
+			</div>
 		</div>
-		<div class="entrelation" id="entrelation">
-			<div id="entrelation-legend" class="entrelation-legend"></div>
-			<div class="entrelation-infovis">			
-				 <div class="entrelation-controlls hidden-sm hidden-xs">
-					<div class="entrelation-item">
-						<div id="entrelation-fullscreen" class="entrelation-box" title_pos="left"><div class="entrelation-fullscreen"></div></div>
+		<div class="ent-alterinfo hide">
+			<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>
+							<div>
+								<div><script>document.write(new Date(Number({{$v.AltDate}})).Format("yyyy-MM-dd hh:mm:ss"));</script></div>
+								<div>{{$v.AltItemName}}</div>
+								<div>变更前:{{$v.AltBe}}<br>变更后:{{$v.AltAf}}</div>
+								<a></a>
+							</div>
+							<div>
+								<div><script>document.write(new Date(Number({{$v.AltDate}})).Format("yyyy-MM-dd hh:mm:ss"));</script></div>
+								<div>{{$v.AltItemName}}</div>
+								<div>变更前:{{$v.AltBe}}<br>变更后:{{$v.AltAf}}</div>
+								<a></a>
+							</div>
+						</li>
+					{{end}}
+						<li>
+							<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>
 		</div>
-		<div class="hide"></div>
-		<div class="hide"></div>
-		<div class="hide"></div>
-		<div class="hide"></div>
+		<div class="hide">
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+		</div>
+		<div class="hide ent-service">
+			<table class="table ent-table" id="serviceList">
+				<tr>
+					<td colspan="4" class="text-center" id="serviceListPaging"></td>
+				</tr>
+			</table>
+			<div class="ent-findnull hide">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+		</div>
+		<div class="hide">
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+		</div>
 	</div>
 </div>
 <!--显示地图信息-->
@@ -262,47 +377,20 @@
 {{include "/common/bottom.html"}}
 </body>
 <script type="text/javascript">
-
-
-var entsel="",btempwords,chf1,czb;
-
-//企业信息ID
- var id = {{.T.res._id}}
-//公式信息的变量
-var $gs = {{.T.res.gs}};
-//关系网上的变量
-var  $relationlen = "";
-
-//服务模板
-var template_content = "<tr><td><div class='row service_row'> "
-+"<div class='col-sm-1'><div style='width:120px; height:120px; background-color:#eee;'><img class='hidden-xs' src='${s_images}' style='width:120px;height:120px'></div></div>"
-+" <div class='col-sm-9'>"
-+"<div class='linebser service_des'><div class='servicename text-primary'><a class='text-primary' target='_blank' onclick='clickservicename(\"${_id}\",\"${s_isshow}\")'>${s_name}</a></div><div class='text-muted'>${s_introduction}</div></div>"
-+"</div></td><tr>"
-//关系网数据
-data= "";
-//注册号
-var regno="{{.T.res.RegNo}}";
-
-var legcerno = "{{.T.res.LegCerNO}}";
-var lerep="{{.T.res.LeRep}}";
+var entId = {{.T.res._id}};
+var regNo = {{.T.res.RegNo}};
+var legcerNo = {{.T.res.LegCerNO}};
+var entName = {{.T.res.EntName}};
 //联系地址
+//定义默认的郑州经纬度
+var ptlat=113.69884285509,  ptlng=34.791342526551;
 var province = {{.T.res.i_province}};
 var city = {{.T.res.i_city}};
 var area = {{.T.res.i_area}};
 var as1="{{.T.res.s_address}}";
-var $chiancity= false,$listent=false;
+var address=false,$listent=false;
 {{if or .T.res.i_province .T.res.i_city .T.res.i_area .T.res.s_address}}
-	$chiancity= true;
+	address = true;
 {{end}}
-
-var $resdata = {{.T.res.data}};
-var $entid = {{.T.res._id}};
-//定义默认的郑州经纬度
-var ptlat=113.69884285509,  ptlng=34.791342526551;
-var $res = {{.T.res}};
 </script>
-<script src="/js/entportrait.js"></script>
-<script src="/js/qfwtable.js"></script>
-
 </html>

+ 9 - 11
core/src/web/templates/yellowpage/error.html

@@ -3,19 +3,17 @@
 	<title>企明星----未收录</title>
 	{{include "/common/inc.html"}}
 	<body>
-	<div class="container-fluid">
-	<div class="row page-header" style="height:100px;margin:20px 0;">
-	 <a href="/"><img  src="/images/logo.png" class="header_logo"/></a>
-	</div>
-	<div class="row" style="margin:50px 0;">
-		<div class="col-lg-6 col-md-6 col-sm-6 " style="text-align:right">
-		 <img src="/images/findnull.png" class="b-findnull"/>
-		</div>
-		<div class="col-lg-6 col-md-6 col-sm-6 " style="padding-top: 70px;">
-			<div style="text-indent:20px;"><h4><strong class="text-muted">抱歉!企明星网站暂未收录该企业信息。</strong></h4></div>
+	{{include "/common/errorhead.html"}}
+	<div class="container-fluid b-content">
+		<div class="row" style="margin:50px 0;">
+			<div class="col-lg-6 col-md-6 col-sm-6" style="text-align:right">
+			 <img src="/images/findnull.png" class="b-findnull"/>
+			</div>
+			<div class="col-lg-6 col-md-6 col-sm-6" style="padding-top: 70px;">
+				<div style="text-indent:20px;"><h4><strong class="text-muted">抱歉!企明星网站暂未收录该企业信息。</strong></h4></div>
+			</div>
 		</div>
 	</div>
-	</div>
 	{{include "/common/bottom.html"}}
 	</body>
 </html>

+ 1 - 0
credit/src/config.json

@@ -67,6 +67,7 @@
         "txt_a13": "分享服务",
         "txt_a14": "完成交易",
         "txt_a15": "完成交易评价",
+		"txt_a63": "剑鱼首次推送",
         "txt_a64": "完成一次性所有任务",
         "txt_b1": "签到",
         "txt_b2": "企业查询",

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

@@ -281,7 +281,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 			creditDoc["i_givestatus"] = 0
 		}
 		if creditlog.Save(creditDoc) {
-			*replay = 1
+			*replay = creditDoc["i_score"].(int)
 			//发送微信通知扣积分成功
 			if first == "A" {
 				go SendMsgWebAndWx(Message["swordfish_payTitle"], fmt.Sprintf(Message["swordfish_pay"], creditDoc["i_score"], creditDoc["i_scorenow"], util.FormatDate(&newDate, util.Date_Full_Layout)), param.Uid, param.Umid)

+ 1 - 61
push/src/config.json

@@ -1,61 +1 @@
-{
-    "bid": {
-        "interval": 60,
-        "lastpushtime": "2015-10-10 10:10:10"
-    },
-    "bidStartTime": "2015-12-17 14:10:11",
-    "bidTitle": "亲!剑鱼为您速报最新鲜的中标信息啦",
-    "bidViewDomain": "192.168.3.132",
-    "durationMinutes": 1,
-    "fixPush": "oJULtwzXo6EFV1Ah-XeyRBimXGM8",
-    "mail_bid": "\u003cdiv\u003e%s\u003c/div\u003e,想了解更多信息,请访问http://www.qimingxing.info。",
-    "maxPushSize": 50,
-    "mgoAddr": "192.168.3.18:27080",
-    "mgoSize": 10,
-    "province": {
-        "上海": 9,
-        "云南": 25,
-        "内蒙古": 5,
-        "北京": 1,
-        "台湾": 32,
-        "吉林": 7,
-        "四川": 13,
-        "天津": 2,
-        "宁夏": 30,
-        "安徽": 12,
-        "山东": 15,
-        "山西": 4,
-        "广东": 19,
-        "广西": 20,
-        "新疆": 31,
-        "江苏": 10,
-        "江西": 14,
-        "河北": 3,
-        "河南": 16,
-        "浙江": 11,
-        "海南": 21,
-        "湖北": 17,
-        "湖南": 18,
-        "澳门": 34,
-        "甘肃": 28,
-        "福建": 13,
-        "西藏": 26,
-        "贵州": 24,
-        "辽宁": 6,
-        "重庆": 22,
-        "陕西": 27,
-        "青海": 29,
-        "香港": 33,
-        "黑龙江": 8
-    },
-    "smtpAddr": "smtp.exmail.qq.com",
-    "smtpFromUser": "企明星",
-    "smtpPort": 465,
-    "smtpPwd": "qy123456",
-    "smtpUser": "qyfw@topnet.net.cn",
-    "tenderStartTime": "2015-12-17 14:10:11",
-    "tenderTitle": "亲!剑鱼为您速报最新鲜的招标信息啦",
-    "weixinRpcServer": "127.0.0.1:82",
-    "weixin_bid": "\u003cdiv\u003e%s最新招标信息\u003c/div\u003e\u003cdiv\u003e%s\u003c/div\u003e",
-    "wxRpcRemark": "请到网站个人中心查看详细."
-}
+{"bid":{"interval":60,"lastpushtime":"2015-10-10 10:10:10"},"bidStartTime":"2015-12-30 17:28:48","bidTitle":"亲!剑鱼为您速报最新鲜的中标信息啦","bidViewDomain":"192.168.3.132","durationMinutes":10,"fixPush":"oJULtwzXo6EFV1Ah-XeyRBimXGM8","mail_bid":"\u003cdiv\u003e%s\u003c/div\u003e,想了解更多信息,请访问http://www.qimingxing.info。","maxPushSize":50,"mgoAddr":"192.168.3.18:27080","mgoSize":10,"province":{"上海":9,"云南":25,"内蒙古":5,"北京":1,"台湾":32,"吉林":7,"四川":13,"天津":2,"宁夏":30,"安徽":12,"山东":15,"山西":4,"广东":19,"广西":20,"新疆":31,"江苏":10,"江西":14,"河北":3,"河南":16,"浙江":11,"海南":21,"湖北":17,"湖南":18,"澳门":34,"甘肃":28,"福建":13,"西藏":26,"贵州":24,"辽宁":6,"重庆":22,"陕西":27,"青海":29,"香港":33,"黑龙江":8},"pushInfoScopeDays":30,"rpcPort":"8766","smtpAddr":"smtp.exmail.qq.com","smtpFromUser":"企明星","smtpPort":465,"smtpPwd":"qy123456","smtpUser":"qyfw@topnet.net.cn","tenderStartTime":"2015-12-30 17:28:48","tenderTitle":"亲!剑鱼为您速报最新鲜的招标信息啦","weixinRpcServer":"127.0.0.1:82","weixin_bid":"\u003cdiv\u003e%s最新招标信息\u003c/div\u003e\u003cdiv\u003e%s\u003c/div\u003e","wxRpcRemark":"请到网站个人中心查看详细."}

+ 13 - 0
push/src/main.go

@@ -4,8 +4,13 @@
 package main
 
 import (
+	"log"
+	"net"
+	"net/http"
+	"net/rpc"
 	"qfw/push"
 	"qfw/push/bid"
+	"qfw/push/rpcpush"
 	"qfw/push/tender"
 	"qfw/util"
 	"qfw/util/mongodb"
@@ -21,6 +26,7 @@ func init() {
 		push.City[k] = uint(v.(float64))
 	}
 	bid.MaxPushSize = util.IntAll(push.PushConfig["maxPushSize"])
+	rpcpush.PushInfoScopeDays = util.IntAll(push.PushConfig["pushInfoScopeDays"])
 	tender.MaxPushSize = bid.MaxPushSize
 	mongodb.InitMongodbPool(util.IntAll(push.PushConfig["mgoSize"]), push.PushConfig["mgoAddr"].(string), "qfw")
 }
@@ -50,6 +56,13 @@ func runJob() {
 //主应用,定时任务
 func main() {
 	go runJob()
+	crpc := new(rpcpush.PushInfo)
+	rpc.Register(crpc)
+	rpc.HandleHTTP()
+	port, _ := push.PushConfig["rpcPort"].(string)
+	l, _ := net.Listen("tcp", ":"+port)
+	go http.Serve(l, nil)
+	log.Println("启动推送系统", port)
 	flag := make(chan bool)
 	<-flag
 }

+ 25 - 0
push/src/qfw/push/bid/bid_test.go

@@ -4,9 +4,11 @@ import (
 	"fmt"
 	"log"
 	"math/rand"
+	"net/rpc"
 	"qfw/push"
 	"qfw/util"
 	"qfw/util/mongodb"
+	qrpc "qfw/util/rpc"
 	"strings"
 	"testing"
 	"time"
@@ -57,3 +59,26 @@ func Test_1(t *testing.T) {
 	a2 := push.GetChoiceCode(strings.Split("北京,河南,广东,山西,新疆", ",")...)
 	log.Println(a1, a2, a1&a2)
 }
+
+func Test_rpc(t *testing.T) {
+	log.Println("----------")
+	for i := 0; i < 30; i++ {
+		dd := qrpc.PushData{
+			Mopenid: "oJULtwzXo6EFV1Ah-XeyRBimXGM8",
+			PushType: map[string]string{
+				"tender": "招标",
+				"bid":    "中标",
+			},
+		}
+		var repl int
+		clent, _ := rpc.DialHTTP("tcp", "127.0.0.1:8766")
+		clent.Call("PushInfo.PushMsg", &dd, &repl)
+
+		log.Println(repl)
+		clent.Close()
+		time.Sleep(10 * time.Millisecond)
+	}
+
+	c := make(chan bool, 1)
+	<-c
+}

+ 9 - 208
push/src/qfw/push/bid/bidpushjob.go

@@ -9,223 +9,24 @@
 package bid
 
 import (
-	"container/list"
-	"fmt"
-	"log"
-	"math/rand"
 	"qfw/push"
-	"qfw/push/dfa"
+	"qfw/push/dopush"
 	"qfw/util"
-	"qfw/util/mongodb"
-	qrpc "qfw/util/rpc"
-	"runtime"
-	"strconv"
-	"strings"
 	"time"
 )
 
 type BidPushJob struct {
-	dfa *dfa.DFA
 }
 
-//构造用户兴趣词库
-func (b *BidPushJob) createUserInterestWord() {
-	b.dfa = &dfa.DFA{}
-	words := make([]string, 0)
-	for k, _ := range push.Cache {
-		words = append(words, k)
-	}
-	b.dfa.AddWord(words...)
-}
-
-var TITLEA string = "[中标信息]" //tender
 var MaxPushSize int
 
-//遍历查到的
-func (b *BidPushJob) eachAllBidInfo() {
-	defer func() {
-		if r := recover(); r != nil {
-			fmt.Println("推送开始[E]", r)
-		}
-	}()
-	session := mongodb.GetMgoConn()
-	defer mongodb.DestoryMongoConn(session)
-	startTime := push.PushConfig["bidStartTime"].(string)
-	st, _ := time.ParseInLocation(util.Date_Full_Layout, startTime, time.Local)
-	q := `{"comeintime":{"$gt":` + fmt.Sprintf("%d", st.Unix()) + `},"type":"bid"}`
-	n, _ := session.DB("qfw").C("bidding").Find(mongodb.ObjToOth(q)).Count()
-	log.Println(q, "查询推送信息:", n, ",时间", startTime)
-	if n == 0 {
-		//没有查询到结果
-		return
-	}
-	query := session.DB("qfw").C("bidding").Find(mongodb.ObjToOth(q)).Sort("-publishtime").Iter()
-	userMap := &map[*push.MemberInterest]*list.List{}
-	for tmp := new(map[string]interface{}); query.Next(tmp); {
-		title := util.ObjToString((*tmp)["title"])
-		if title != "" {
-			//返回匹配到的词组
-			res := b.dfa.Analy(title)
-			if len(res) > 0 {
-				province := (*tmp)["area"].(string)
-				provinceVal := push.GetChoiceCode(province)
-				for _, v := range res {
-					//根据关键词返回用户指针
-					tw := push.Cache[v]
-					if tw != nil {
-						//遍历用户加入到此条信息上
-						for _, v2 := range *tw {
-							if v2.Province == "A" || v2.ProvinceVal&provinceVal > 0 {
-								s := (*userMap)[v2]
-								if s == nil {
-									//s = &map[*map[string]interface{}]bool{}
-									s = list.New()
-									(*userMap)[v2] = s
-								}
-								s.PushBack(tmp)
-							}
-						}
-					}
-				}
-			}
-		}
-		tmp = new(map[string]interface{})
-	}
-
-	now := time.Now()
-	nowtime := util.FormatDate(&now, util.Date_Full_Layout)
-	//更改开始时间
-	push.PushConfig["bidStartTime"] = nowtime
-	//date := util.FormatDate(&now, util.Date_Short_Layout)
-
-	for k, v := range *(userMap) {
-		kk := *k
-		vv := *v
-		time.Sleep(50 * time.Millisecond)
-		go send(&kk, &vv, now, nowtime)
-	}
-}
-
-func send(k *push.MemberInterest, v *list.List, now time.Time, nowtime string) {
-	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)
-			}
-		}
-	}()
-	//wxstr := ""
-	str := fmt.Sprintf("<div>根据您设置的关键词(%s),给您推送以下信息:</div>", strings.Join(k.Interest, ";"))
-
-	//发送内容组合
-	i := 0
-	lastInfoDate := int64(0)
-	firstTitle := ""
-	publishTimes := map[string]interface{}{}
-	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 := TITLEA + fmt.Sprintf("%d条,关键词(%s)", i, strings.Join(k.Interest, ";"))
-	WXTitle := fmt.Sprintf("%s《%s》%s", func() string {
-		minute := now.Unix() - lastInfoDate
-		if minute > -1 && minute < 61 {
-			return fmt.Sprintf("%d秒前发布的", minute)
-		} else {
-			minute = minute / 60
-			if minute > 121 {
-				return ""
-			} else {
-				if minute < 1 {
-					minute = 1
-				}
-				return fmt.Sprintf("%d分钟前发布的", minute)
-			}
-		}
-	}(), firstTitle, func() string {
-		if i == 1 {
-			return ""
-		} else {
-			return "等" + strconv.Itoa(i) + "条"
-		}
-	}())
-
-	//发送微信
-	if len(k.Openid) > 0 {
-		sendWeixin(k, TITLE, str, nowtime, "", now, "", WXTitle, publishTimes)
-	}
-
-}
-
-//推送微信
-func sendWeixin(k *push.MemberInterest, TITLE, str, nowtime, wxstr string, now time.Time, msgid, WXTitle string, publishTimes map[string]interface{}) {
-	defer func() {
-		if r := recover(); r != nil {
-			fmt.Println("发送微信[E]", r)
-		}
-	}()
-	time.Sleep(time.Millisecond * 100)
-	//详情存库
-	wxpush := map[string]interface{}{
-		"s_m_openid":    k.Openid,
-		"l_date":        now.Unix(),
-		"s_words":       k.Interest,
-		"s_email":       k.Email,
-		"s_uid":         k.Id,
-		"s_province":    k.Province,
-		"a_interest":    k.Interest,
-		"s_content":     str,
-		"s_type":        "bid",
-		"a_publishtime": publishTimes,
-		"i_size":        len(publishTimes),
-	}
-	wid := mongodb.Save("wxpush", &wxpush)
-	wxstr = "\n点击下方“详情”查看详细信息。\n以上中标信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“会员服务—剑鱼”进行修改。"
-
-	wxDate := ""
-	if k.InterestDate > 0 {
-		mt1 := interface{}(k.InterestDate)
-		wxDate = util.FormatDateWithObj(&mt1, util.Date_Full_Layout)
-	} else {
-		r := rand.New(rand.NewSource(time.Now().UnixNano()))
-		n1 := r.Int63n(9)
-		n2 := r.Int63n(7200)
-		wxDate = time.Now().Local().Add(time.Duration(-n2) * time.Second).Add(time.Duration(-n1*24) * time.Hour).Format(util.Date_Full_Layout)
-	}
-
-	push.SendWinXin(&qrpc.NotifyMsg{
-		Openid:  k.Openid,
-		Title:   push.PushConfig["bidTitle"].(string),
-		Remark:  wxstr,
-		Detail:  WXTitle,
-		Date:    wxDate,
-		Service: "剑鱼君",
-		Url:     push.PushConfig["bidViewDomain"].(string) + "/wxpush/bid/" + k.Openid + "/" + wid + "/a"})
-
-}
-
-//执行日常招标中标公告的消息推送
+//执行日常招标的消息推送
 func (b *BidPushJob) Execute() bool {
-	log.Println("开始执行中标任务:", push.PushConfig["bidStartTime"])
-	push.InitCache("bid")
-	b.createUserInterestWord()
-	b.eachAllBidInfo()
-	return false
+	pj := dopush.Pjob{
+		MaxPushSize: MaxPushSize,
+		Stype:       "bid",
+		StypeName:   "中标",
+	}
+	st, _ := time.ParseInLocation(util.Date_Full_Layout, push.PushConfig["bidStartTime"].(string), time.Local)
+	return pj.DoPush("", push.PushConfig["bidStartTime"].(string), 1, st.Unix())
 }

+ 25 - 35
push/src/qfw/push/cache.go

@@ -14,36 +14,32 @@ import (
 )
 
 type MemberInterest struct {
-	Id          string   //mongoid
-	Province    string   //省份
-	ProvinceVal uint64   //可选多个省份的处理
-	Interest    []string //用户兴趣
-	//Type     string   //兴趣类型
-	//SendMode     []string //发送方式
-	Unionid      string
+	Id           string   //mongoid
+	Province     string   //省份
+	ProvinceVal  uint64   //可选多个省份的处理
+	Interest     []string //用户兴趣
 	Openid       string
-	Email        string
 	InterestDate int64
 }
 
-var Cache map[string]*[]*MemberInterest //缓存
 //初始化缓存,在每次执行任务时调用,
-//加载用户数据到Cache中
-func InitCache(flag string) {
-	Cache = make(map[string]*[]*MemberInterest)
-	//TODO 查Mogo数据库
-	fixPush := util.ObjToString(PushConfig["fixPush"])
+func InitCache(flag, m_openid string) map[string]*[]*MemberInterest {
+	cache := make(map[string]*[]*MemberInterest)
 	q := map[string]interface{}{}
-	if len(fixPush) > 5 {
-		log.Println("推指定的人", fixPush)
-		q["s_m_openid"] = map[string]interface{}{
-			"$in": strings.Split(fixPush, ","),
-		}
+	if m_openid != "" {
+		q["s_m_openid"] = m_openid
 	} else {
-		q = map[string]interface{}{
-			"o_msgset." + flag: map[string]interface{}{
-				"$exists": true,
-			},
+		fixPush := util.ObjToString(PushConfig["fixPush"])
+		if len(fixPush) > 5 {
+			log.Println("推指定的人", fixPush)
+			q["s_m_openid"] = map[string]interface{}{
+				"$in": strings.Split(fixPush, ","),
+			}
+		} else {
+			q = map[string]interface{}{
+				"o_msgset." + flag + ".i_switchstatus": 1,
+				"o_msgset." + flag + ".i_status":       1,
+			}
 		}
 	}
 	session := mongodb.GetMgoConn()
@@ -52,9 +48,7 @@ func InitCache(flag string) {
 		"_id":                   1,
 		"o_msgset." + flag:      1,
 		"o_msgset.l_modifydate": 1,
-		"s_unionid":             1,
 		"s_m_openid":            1,
-		"s_email":               1,
 	}).Iter()
 	for tmp := make(map[string]interface{}); query.Next(tmp); {
 		util.Try(func() {
@@ -62,18 +56,14 @@ func InitCache(flag string) {
 			o_msgset := tmp["o_msgset"].(map[string]interface{})
 			flagModule := o_msgset[flag].(map[string]interface{})
 			a_key := util.ObjArrToStringArr(flagModule["a_key"].([]interface{}))
-			//a_mode := util.ObjArrToStringArr(flagModule["a_mode"].([]interface{}))
 			s_scope := util.ObjToString(flagModule["s_scope"])
 			if len(a_key) > 0 && len(s_scope) > 0 {
 				user := MemberInterest{
-					Id: _id,
-					//SendMode:    a_mode,
+					Id:          _id,
 					Province:    s_scope,
 					ProvinceVal: GetChoiceCode(strings.Split(s_scope, ",")...),
 					Interest:    a_key,
-					Unionid:     util.ObjToString(tmp["s_unionid"]),
 					Openid:      util.ObjToString(tmp["s_m_openid"]),
-					Email:       util.ObjToString(tmp["s_email"]),
 				}
 				date := o_msgset["l_modifydate"]
 				if date != nil {
@@ -83,12 +73,12 @@ func InitCache(flag string) {
 				}
 				for i := 0; i < len(a_key) && a_key[i] != ""; i++ {
 					var arr []*MemberInterest
-					if nil == Cache[a_key[i]] {
+					if nil == cache[a_key[i]] {
 						arr = make([]*MemberInterest, 0)
-						Cache[a_key[i]] = &arr
+						cache[a_key[i]] = &arr
 					} else {
-						arr = *Cache[a_key[i]]
-						Cache[a_key[i]] = &arr
+						arr = *cache[a_key[i]]
+						cache[a_key[i]] = &arr
 					}
 					arr = append(arr, &user)
 				}
@@ -97,8 +87,8 @@ func InitCache(flag string) {
 			log.Println(e)
 		})
 		tmp = make(map[string]interface{})
-		//log.Println(_id, o_msgset)
 	}
+	return cache
 }
 
 //各省份排序,最终会占某个2进制位

+ 16 - 0
push/src/qfw/push/dfa/interestanalysis_test.go

@@ -27,3 +27,19 @@ func TestAnaly(t *testing.T) {
 	//log.Println(d.Analy("这是胡锦涛写给江泽民的信啊。"))
 
 }
+
+func Test_Label(t *testing.T) {
+	log.Println("000----")
+
+	for _, v := range []int{1, 2, 3, 4, 5} {
+		log.Println(v)
+	L1:
+		for _, vv := range []string{"a", "b", "c", "d"} {
+			log.Println(vv)
+			if vv == "add" {
+				break L1
+			}
+		}
+	}
+	log.Println("111----")
+}

+ 221 - 0
push/src/qfw/push/dopush/dopush.go

@@ -0,0 +1,221 @@
+package dopush
+
+import (
+	"container/list"
+	"fmt"
+	"log"
+	"math/rand"
+	"qfw/push"
+	"qfw/push/dfa"
+	"qfw/util"
+	"qfw/util/mongodb"
+	qrpc "qfw/util/rpc"
+	"runtime"
+	"strconv"
+	"strings"
+	"time"
+)
+
+type Pjob struct {
+	Dfa         *dfa.DFA
+	Cache       *map[string]*[]*push.MemberInterest
+	MaxPushSize int
+	Stype       string
+	StypeName   string
+}
+
+//构造用户兴趣词库
+func (b *Pjob) CreateUserInterestWord() {
+	b.Dfa = &dfa.DFA{}
+	words := make([]string, 0)
+	for k, _ := range *b.Cache {
+		words = append(words, k)
+	}
+	b.Dfa.AddWord(words...)
+}
+
+func (p *Pjob) DoPush(mopenid, stime string, opr int, ltime int64) bool {
+	log.Println("开始执行任务:", p.StypeName, stime)
+	p.Cache = new(map[string]*[]*push.MemberInterest)
+	*p.Cache = push.InitCache(p.Stype, mopenid)
+	p.CreateUserInterestWord()
+	EachAllBidInfo(p.Stype, "["+p.StypeName+"信息]", p.StypeName, ltime, p.MaxPushSize, p.Dfa, p.Cache, opr)
+	return true
+}
+
+//遍历数据并执行推送操作
+func EachAllBidInfo(stype, TITLEA, ShortTitle string, lastTime int64, MaxPushSize int, dfas *dfa.DFA, cache *map[string]*[]*push.MemberInterest, pushType int) {
+	defer func() {
+		if r := recover(); r != nil {
+			fmt.Println("推送开始[E]", r)
+		}
+	}()
+	session := mongodb.GetMgoConn()
+	defer mongodb.DestoryMongoConn(session)
+	q := `{"comeintime":{"$gt":` + fmt.Sprintf("%d", lastTime) + `},"type":"` + stype + `"}`
+	n, _ := session.DB("qfw").C("bidding").Find(mongodb.ObjToOth(q)).Count()
+	if n == 0 {
+		log.Println("执行推送任务", stype, "没有数据。")
+		return
+	}
+	query := session.DB("qfw").C("bidding").Find(mongodb.ObjToOth(q)).Sort("-publishtime").Iter()
+	userMap := &map[*push.MemberInterest]*list.List{}
+	var returnLastTime interface{}
+L1:
+	for tmp := new(map[string]interface{}); query.Next(tmp); {
+		title := util.ObjToString((*tmp)["title"])
+		if title != "" {
+			//返回匹配到的词组
+			res := dfas.Analy(title)
+			if len(res) > 0 {
+				province := (*tmp)["area"].(string)
+				provinceVal := push.GetChoiceCode(province)
+				for _, v := range res {
+					//根据关键词返回用户指针
+					tw := (*cache)[v]
+					if tw != nil {
+						//遍历用户加入到此条信息上
+						for _, v2 := range *tw {
+							if v2.Province == "A" || v2.ProvinceVal&provinceVal > 0 {
+								s := (*userMap)[v2]
+								if s == nil {
+									s = list.New()
+									(*userMap)[v2] = s
+								}
+								s.PushBack(tmp)
+								if pushType == 2 && s.Len() > MaxPushSize {
+									break L1
+								}
+							}
+						}
+					}
+				}
+			}
+			if returnLastTime == nil {
+				returnLastTime = (*tmp)["comeintime"]
+			}
+		}
+		tmp = new(map[string]interface{})
+	}
+	now := time.Now()
+	if pushType == 1 && returnLastTime != nil {
+		push.PushConfig[stype+"StartTime"] = util.FormatDateWithObj(&returnLastTime, util.Date_Full_Layout)
+	}
+	for k, v := range *(userMap) {
+		kk := *k
+		vv := *v
+		time.Sleep(50 * time.Millisecond)
+		go Send(&kk, &vv, now, TITLEA, ShortTitle, stype, MaxPushSize)
+	}
+}
+
+//全局推送功能
+func Send(k *push.MemberInterest, v *list.List, now time.Time, TITLEA, ShortTitle, stype string, MaxPushSize int) {
+	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)
+			}
+		}
+	}()
+	str := fmt.Sprintf("<div>根据您设置的关键词(%s),给您推送以下信息:</div>", strings.Join(k.Interest, ";"))
+	//发送内容组合
+	i := 0
+	lastInfoDate := int64(0)
+	firstTitle := ""
+	publishTimes := map[string]interface{}{}
+	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 := TITLEA + fmt.Sprintf("%d条,关键词(%s)", i, strings.Join(k.Interest, ";"))
+	WXTitle := fmt.Sprintf("%s《%s》%s", func() string {
+		minute := now.Unix() - lastInfoDate
+		if minute > -1 && minute < 61 {
+			return fmt.Sprintf("%d秒前发布的", minute)
+		} else {
+			minute = minute / 60
+			if minute > 121 {
+				return ""
+			} else {
+				if minute < 1 {
+					minute = 1
+				}
+				return fmt.Sprintf("%d分钟前发布的", minute)
+			}
+		}
+	}(), firstTitle, func() string {
+		if i == 1 {
+			return ""
+		} else {
+			return "等" + strconv.Itoa(i) + "条"
+		}
+	}())
+
+	//3、发送微信
+	if len(k.Openid) > 0 {
+		SendWeixin(k, TITLE, ShortTitle, str, stype, now, WXTitle, publishTimes)
+	}
+
+}
+
+//推送微信
+func SendWeixin(k *push.MemberInterest, TITLE, ShortTitle, str, stype string, now time.Time, WXTitle string, publishTimes map[string]interface{}) {
+	defer func() {
+		if r := recover(); r != nil {
+			fmt.Println("发送微信[E]", r)
+		}
+	}()
+	time.Sleep(time.Millisecond * 100)
+	//详情存库
+	wxpush := map[string]interface{}{
+		"s_m_openid":    k.Openid,
+		"l_date":        now.Unix(),
+		"s_words":       k.Interest,
+		"s_uid":         k.Id,
+		"s_province":    k.Province,
+		"a_interest":    k.Interest,
+		"s_content":     str,
+		"s_type":        stype,
+		"a_publishtime": publishTimes,
+		"i_size":        len(publishTimes),
+	}
+	wid := mongodb.Save("wxpush", &wxpush)
+	wxDate := ""
+	if k.InterestDate > 0 {
+		mt1 := interface{}(k.InterestDate)
+		wxDate = util.FormatDateWithObj(&mt1, util.Date_Full_Layout)
+	} else {
+		r := rand.New(rand.NewSource(time.Now().UnixNano()))
+		n1 := r.Int63n(9)
+		n2 := r.Int63n(7200)
+		wxDate = time.Now().Local().Add(time.Duration(-n2) * time.Second).Add(time.Duration(-n1*24) * time.Hour).Format(util.Date_Full_Layout)
+	}
+
+	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“会员服务—剑鱼”进行修改。"
+	push.SendWinXin(&qrpc.NotifyMsg{
+		Openid:  k.Openid,
+		Title:   push.PushConfig[stype+"Title"].(string),
+		Remark:  wxstr,
+		Detail:  WXTitle,
+		Date:    wxDate,
+		Service: "剑鱼君",
+		Url:     push.PushConfig["bidViewDomain"].(string) + "/wxpush/bid/" + k.Openid + "/" + wid + "/aa"})
+
+}

+ 36 - 0
push/src/qfw/push/rpcpush/rpcpush.go

@@ -0,0 +1,36 @@
+package rpcpush
+
+import (
+	"fmt"
+	"log"
+	"qfw/push/bid"
+	"qfw/push/dopush"
+	qrpc "qfw/util/rpc"
+	"time"
+)
+
+type PushInfo struct {
+}
+
+var PushInfoScopeDays int
+
+func (p *PushInfo) PushMsg(data *qrpc.PushData, Reply *int) error {
+	log.Println("dddddddd", data)
+	for k, v := range data.PushType {
+		//昨天到今天的数据
+		pj := dopush.Pjob{
+			MaxPushSize: bid.MaxPushSize,
+			Stype:       k,
+			StypeName:   v,
+		}
+		now := time.Now()
+		tom := time.Date(now.Year(), now.Month(), now.Day()-PushInfoScopeDays, 0, 0, 0, 0, time.Local)
+		b := pj.DoPush(data.Mopenid, fmt.Sprintf("%d days", PushInfoScopeDays), 2, tom.Unix())
+		if b {
+			*Reply = 1
+		} else {
+			*Reply = 0
+		}
+	}
+	return nil
+}

+ 9 - 212
push/src/qfw/push/tender/tenderpushjob.go

@@ -1,227 +1,24 @@
-/**
- *招标,中标公告的推送消息,在兴趣词分析上,存在一定的难度
- *现在采用DFA算法分析,兴趣词会构造Map结构,前期应该不会出问题。
- *后期需要改进(用户量达到5千以上)
- *可行策略:每日产生的新数据有限,大概不超过5000条,可以把标题全加到内存
- *        用户兴趣词分批次加入,每次加入3000个左右的用户的兴趣词,过滤
- *        今日产生的招标、中标数据,并完成推送,第二批载入后3000个用户的数据
- */
 package tender
 
 import (
-	"container/list"
-	"fmt"
-	"log"
-	"math/rand"
 	"qfw/push"
-	"qfw/push/dfa"
+	"qfw/push/dopush"
 	"qfw/util"
-	"qfw/util/mongodb"
-	qrpc "qfw/util/rpc"
-	"runtime"
-	"strconv"
-	"strings"
 	"time"
 )
 
 type TenderPushJob struct {
-	dfa *dfa.DFA
 }
 
-//构造用户兴趣词库
-func (b *TenderPushJob) createUserInterestWord() {
-	b.dfa = &dfa.DFA{}
-	words := make([]string, 0)
-	for k, _ := range push.Cache {
-		words = append(words, k)
-	}
-	b.dfa.AddWord(words...)
-}
-
-var TITLEA string = "[招标信息]" //tender
 var MaxPushSize int
 
-//遍历查到的
-func (b *TenderPushJob) eachAllBidInfo() {
-	defer func() {
-		if r := recover(); r != nil {
-			fmt.Println("推送开始[E]", r)
-		}
-	}()
-	session := mongodb.GetMgoConn()
-	defer mongodb.DestoryMongoConn(session)
-	startTime := push.PushConfig["tenderStartTime"].(string)
-	st, _ := time.ParseInLocation(util.Date_Full_Layout, startTime, time.Local)
-	q := `{"comeintime":{"$gt":` + fmt.Sprintf("%d", st.Unix()) + `},"type":"tender"}`
-	n, _ := session.DB("qfw").C("bidding").Find(mongodb.ObjToOth(q)).Count()
-	log.Println(q, "查询推送信息:", n, ",时间", startTime)
-	if n == 0 {
-		//没有查询到结果
-		return
-	}
-	query := session.DB("qfw").C("bidding").Find(mongodb.ObjToOth(q)).Sort("-publishtime").Iter()
-	userMap := &map[*push.MemberInterest]*list.List{}
-	for tmp := new(map[string]interface{}); query.Next(tmp); {
-		title := util.ObjToString((*tmp)["title"])
-		if title != "" {
-			//返回匹配到的词组
-			res := b.dfa.Analy(title)
-			if len(res) > 0 {
-				province := (*tmp)["area"].(string)
-				provinceVal := push.GetChoiceCode(province)
-				for _, v := range res {
-					//根据关键词返回用户指针
-					tw := push.Cache[v]
-					if tw != nil {
-						//遍历用户加入到此条信息上
-						for _, v2 := range *tw {
-							if v2.Province == "A" || v2.ProvinceVal&provinceVal > 0 {
-								s := (*userMap)[v2]
-								if s == nil {
-									s = list.New()
-									(*userMap)[v2] = s
-								}
-								s.PushBack(tmp)
-							}
-						}
-					}
-				}
-			}
-		}
-		tmp = new(map[string]interface{})
-	}
-	now := time.Now()
-	nowtime := util.FormatDate(&now, util.Date_Full_Layout)
-	//更改开始时间
-	push.PushConfig["tenderStartTime"] = nowtime
-	//date := util.FormatDate(&now, util.Date_Short_Layout)
-	for k, v := range *(userMap) {
-		kk := *k
-		vv := *v
-
-		time.Sleep(50 * time.Millisecond)
-		go send(&kk, &vv, now, nowtime)
-	}
-}
-
-func send(k *push.MemberInterest, v *list.List, now time.Time, nowtime string) {
-	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)
-			}
-		}
-	}()
-
-	//wxstr := ""
-	str := fmt.Sprintf("<div>根据您设置的关键词(%s),给您推送以下信息:</div>", strings.Join(k.Interest, ";"))
-	//发送内容组合
-	i := 0
-	lastInfoDate := int64(0)
-	firstTitle := ""
-	publishTimes := map[string]interface{}{}
-	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 := TITLEA + fmt.Sprintf("%d条,关键词(%s)", i, strings.Join(k.Interest, ";"))
-	WXTitle := fmt.Sprintf("%s《%s》%s", func() string {
-		minute := now.Unix() - lastInfoDate
-		if minute > -1 && minute < 61 {
-			return fmt.Sprintf("%d秒前发布的", minute)
-		} else {
-			minute = minute / 60
-			if minute > 121 {
-				return ""
-			} else {
-				if minute < 1 {
-					minute = 1
-				}
-				return fmt.Sprintf("%d分钟前发布的", minute)
-			}
-		}
-	}(), firstTitle, func() string {
-		if i == 1 {
-			return ""
-		} else {
-			return "等" + strconv.Itoa(i) + "条"
-		}
-	}())
-
-	//3、发送微信
-	if len(k.Openid) > 0 {
-		sendWeixin(k, TITLE, str, nowtime, "", now, "", WXTitle, publishTimes)
-	}
-
-}
-
-//推送微信
-func sendWeixin(k *push.MemberInterest, TITLE, str, nowtime, wxstr string, now time.Time, msgid, WXTitle string, publishTimes map[string]interface{}) {
-	defer func() {
-		if r := recover(); r != nil {
-			fmt.Println("发送微信[E]", r)
-		}
-	}()
-	time.Sleep(time.Millisecond * 100)
-	//详情存库
-	wxpush := map[string]interface{}{
-		"s_m_openid":    k.Openid,
-		"l_date":        now.Unix(),
-		"s_words":       k.Interest,
-		"s_email":       k.Email,
-		"s_uid":         k.Id,
-		"s_province":    k.Province,
-		"a_interest":    k.Interest,
-		"s_content":     str,
-		"s_type":        "tender",
-		"a_publishtime": publishTimes,
-		"i_size":        len(publishTimes),
-	}
-	wid := mongodb.Save("wxpush", &wxpush)
-	wxDate := ""
-	if k.InterestDate > 0 {
-		mt1 := interface{}(k.InterestDate)
-		wxDate = util.FormatDateWithObj(&mt1, util.Date_Full_Layout)
-	} else {
-		r := rand.New(rand.NewSource(time.Now().UnixNano()))
-		n1 := r.Int63n(9)
-		n2 := r.Int63n(7200)
-		wxDate = time.Now().Local().Add(time.Duration(-n2) * time.Second).Add(time.Duration(-n1*24) * time.Hour).Format(util.Date_Full_Layout)
-	}
-
-	wxstr = "\n点击下方“详情”查看详细信息。\n以上招标信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“会员服务—剑鱼”进行修改。"
-	push.SendWinXin(&qrpc.NotifyMsg{
-		Openid:  k.Openid,
-		Title:   push.PushConfig["tenderTitle"].(string),
-		Remark:  wxstr,
-		Detail:  WXTitle,
-		Date:    wxDate,
-		Service: "剑鱼君",
-		Url:     push.PushConfig["bidViewDomain"].(string) + "/wxpush/bid/" + k.Openid + "/" + wid + "/aa"})
-
-}
-
-//执行日常招标中标公告的消息推送
+//执行日常招标的消息推送
 func (b *TenderPushJob) Execute() bool {
-	log.Println("开始执行招标任务:", push.PushConfig["tenderStartTime"])
-	push.InitCache("tender")
-	b.createUserInterestWord()
-	b.eachAllBidInfo()
-	return false
+	pj := dopush.Pjob{
+		MaxPushSize: MaxPushSize,
+		Stype:       "tender",
+		StypeName:   "招标",
+	}
+	st, _ := time.ParseInLocation(util.Date_Full_Layout, push.PushConfig["tenderStartTime"].(string), time.Local)
+	return pj.DoPush("", push.PushConfig["tenderStartTime"].(string), 1, st.Unix())
 }

+ 4 - 1
push/src/qfw/push/weixincall.go

@@ -6,9 +6,10 @@ import (
 	"net/rpc"
 	"qfw/util"
 	qrpc "qfw/util/rpc"
+	"time"
 )
 
-var wxpool chan bool = make(chan bool, 50)
+var wxpool chan bool = make(chan bool, 30)
 
 //微信远程调用,实现模板发送消息
 func SendWinXin(p *qrpc.NotifyMsg) {
@@ -18,6 +19,7 @@ func SendWinXin(p *qrpc.NotifyMsg) {
 	}()
 	util.Try(func() {
 		client, err := rpc.DialHTTP("tcp", PushConfig["weixinRpcServer"].(string))
+		defer client.Close()
 		if err != nil {
 			log.Println(err.Error())
 			return
@@ -28,4 +30,5 @@ func SendWinXin(p *qrpc.NotifyMsg) {
 			log.Println(err.Error())
 		}
 	}, func(e interface{}) {})
+	time.Sleep(10 * time.Millisecond)
 }

+ 4 - 6
weixin/src/config.json

@@ -20,8 +20,7 @@
 	"entAuthTip":",请按向导进行操作。第1步(共2步):请输入完整的企业名称。\n(认证过程只涉及您所在企业的公开信息。除非事先获得您的授权,企明星不会将您的个人隐私信息公开或透露给第三方机构。输入q或Q,退出认证操作。)",
 	"perAuthTip":",请按向导进行操作。第1步(共2步):请输入商家名称。\n(除非事先获得您的授权,企明星不会将您的个人隐私信息公开或透露给第三方机构。输入q或Q,退出认证操作。)",
 	"othAuthTip":",请按向导进行操作。第1步(共2步):请输入完整的组织机构名称。\n(认证过程只涉及您所在机构的公开信息。除非事先获得您的授权,企明星不会将您的个人隐私信息公开或透露给第三方机构。输入q或Q,退出认证操作。)",
-	"oWelcomeTip":"您已成功注册企明星!\n企明星是一个为全国企业提供专业化服务的互联网平台。
-",
+	"oWelcomeTip":"您已成功注册企明星!\n企明星是一个为全国企业提供专业化服务的互联网平台。",
         "loginTip":"您已经成功登录企明星,请在电脑端操作。",
         "freezeTip":"您的帐号已经冻结,请联系管理员。",
         "messagetpl":{
@@ -29,11 +28,10 @@
                 "offLinemsgtplid":"ExIeyFfoDNVJXhRDq09JbsjH_zbEJCB6gw6rxcV7atw",
                 "msgnotifytplid":"b7iuAMiTCIolnPhTdueKBVYThEMf2D-Bh2M_9v3J-68",
                 "managernotifytplid":"dplgu5Q644vzPdqcPXY7RqgItS3eXACmU1XDl27CvTA"
-        },
-        "activity":{
+        },"activity":{
                 "activitycode":"topcj",
                 "title":"企明星新年抽奖活动进行中",
                 "picurl":"http://www.qimingxing.info/images/choujiang.png"
-        }
-
+        },"weixinautorpl":"小主的吩咐我们已经收到了,请留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!",
+		"creditRpc":"http://127.0.0.1:8765"
 }

+ 10 - 0
weixin/src/qfw/weixin/dao/logsdao.go

@@ -51,3 +51,13 @@ func FindWinningRecord(openid, activitycode string) bool {
 	ret := mongodb.FindOne("winningrecord", M{"s_openid": openid, "s_actcode": activitycode})
 	return ret != nil && len(*ret) > 0
 }
+
+//存微信的离线消息
+func SaveWeixinOfflineMessage(openid, msg string, timestamp int64) {
+	data := map[string]interface{}{
+		"s_openid":    openid,
+		"s_msg":       msg,
+		"l_timestamp": timestamp,
+	}
+	mongodb.Save("weixinoffline", &data)
+}

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

@@ -0,0 +1,43 @@
+package dao
+
+//分享,邀请类dao
+import (
+	"fmt"
+	. "gopkg.in/mgo.v2/bson"
+	"qfw/util/credit"
+	. "qfw/util/mongodb"
+	"time"
+)
+
+//
+var sharelock chan bool = make(chan bool, 10)
+
+//保存用户邀请关系,走线程池
+func SaveInviteLink(shareid string, myopenid string) {
+	//先找邀请人信息
+	sharelock <- true
+	ret := FindOne("person_share", M{"i_shareid": shareid})
+	if *ret == nil {
+		<-sharelock
+		return
+	}
+	source_opendid := (*ret)["s_openid"]
+	data := map[string]interface{}{
+		"s_target_openid": myopenid,
+		"s_source_openid": source_opendid,
+		"l_timestamp":     time.Now().Unix(),
+		"i_shareid":       shareid,
+		"s_businesscode":  (*ret)["s_businesscode"],
+	}
+	Save("person_invitelink", data)
+	//取用户ID
+	ret = FindOne("user", M{"s_m_openid": source_opendid})
+	if *ret == nil {
+		<-sharelock
+		return
+	}
+	smid := fmt.Sprintf("%x", string(((*ret)["_id"]).(ObjectId)))
+	//积分处理,RPC
+	credit.InCreditB(smid, credit.C_TG, nil)
+	<-sharelock
+}

+ 2 - 7
weixin/src/qfw/weixin/dao/userdao.go

@@ -40,13 +40,8 @@ func AddUser(openid, unionid, bindweixin, userphoto string) (err error, flag int
 		}
 		data["i_identificationway"] = 0
 		data["s_m_openid"] = openid //微信手机端openid
-		if len(Save("user", data)) > 0 {
-			//注册送积分
-			m := FindOne("user", `{"s_m_openid":"`+openid+`"}`)
-			if m != nil {
-				id := fmt.Sprintf("%x", string((*m)["_id"].(ObjectId)))
-				credit.InCreditA(id, credit.A_ZC, 0)
-			}
+		if id := Save("user", data); len(id) > 0 {
+			go credit.InCreditA(id, credit.A_ZC, 0)
 			return nil, 1
 		} else {
 			return errors.New("保存用户失败"), 0

+ 9 - 1
weixin/src/qfw/weixin/msgtxtchandler.go

@@ -73,7 +73,15 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 		}
 	} else {
 		//属于在线咨询,暂时直接中转到微信客服系统
-		w.Reply2CustomerService()
+		//w.Reply2CustomerService()
+		//"小主的吩咐我们已经收到了,请耐心等待或留下您的联系方式(手机号或qq号),企明星客服会在下一个工作日9:00-17:00给小主回复哦!"
+		now := time.Now()
+		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 {
+			w.Reply2CustomerService()
+		}
 	}
 }
 

+ 46 - 0
weixin/src/qfw/weixin/rpc/share.go

@@ -0,0 +1,46 @@
+package rpc
+
+import (
+	"encoding/json"
+	"fmt"
+	"github.com/SKatiyar/qr"
+	"log"
+	"qfw/util/redis"
+)
+
+/**生成分享二维码
+规则:自动生成二维码,存储并存储到redis中
+	开发在使用时,先查看redis,没有的话再调用此RPC方法
+	生成的二维码有效期为一个月
+**/
+func (wxrpc *WeiXinRpc) GetShareQR(shareid uint32, ret *string) (err error) {
+	//构造自定义消息文本
+	var msg struct {
+		Expire int    `json:"expire_seconds"`
+		Name   string `json:"action_name"`
+		Info   struct {
+			Scene struct {
+				Id uint32 `json:"scene_id"`
+			} `json:"scene"`
+		} `json:"action_info"`
+	}
+	msg.Expire = 2592000
+	msg.Name = "QR_SCENE"
+	msg.Info.Scene.Id = shareid
+	data, err := wxrpc.wx.PostCustomMsg("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=", &msg)
+	if err != nil {
+		*ret = "faile"
+		log.Println(err.Error())
+		return nil
+	}
+	tmp := map[string]interface{}{}
+	json.Unmarshal(data, &tmp)
+	url := tmp["url"].(string)
+	//生二维码
+	r, _ := qr.Encode(url, qr.L)
+	pngdat := r.PNG()
+	//存储到redis
+	redis.PutBytes("sso", fmt.Sprintf("p_share_%d", shareid), &pngdat, msg.Expire)
+	*ret = "ok"
+	return nil
+}

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

@@ -12,6 +12,7 @@ import (
 	"qfw/weixin/dao"
 	"qfw/weixinconfig"
 	"regexp"
+	"strings"
 	"time"
 )
 
@@ -37,6 +38,7 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 		bindweixin, _ = ret["nickname"].(string)
 		//取得用户头像
 		headimgurl, _ := ret["headimgurl"].(string)
+		log.Println("download userface :", headimgurl)
 		userphoto = downloadUserFace(headimgurl)
 	}
 	_, flag := dao.AddUser(openid, unionid, bindweixin, userphoto)
@@ -49,12 +51,15 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 	}
 
 	if digitreg.MatchString(source) {
-		//
-		//log.Println("user-key:", source)
 		dao.SaveSubscribeLogs(openid, unionid, bindweixin, "wangzhan", "subscribe")
 		if flag == 1 {
 			w.ReplyText(WELCOME_MSG) // 有新人关注,返回欢迎消息
 			redis.Put("sso", "new_"+source, openid, 900)
+			//TODO 处理分享(邀请)类的二维码,记录邀请关系
+			if strings.HasPrefix(source, "32") {
+				//shareid, _ := strconv.Atoi(source)
+				go dao.SaveInviteLink(source, r.FromUserName)
+			}
 		} else {
 			w.ReplyText(OWELCOME_MSG) // 有旧人关注,返回欢迎消息
 		}
@@ -90,8 +95,8 @@ func UnSubscribeHandler(w ResponseWriter, r *Request) {
 
 //扫描二维码事件处理
 func ScanHandler(w ResponseWriter, r *Request) {
-	//log.Println("扫码事件::", r.EventKey, r.Event)
-	//log.Println("user-key:", r.EventKey)
+	log.Println("扫码事件::", r.EventKey, r.Event)
+	log.Println("user-key:", r.EventKey)
 	w.ReplyText(weixinconfig.SysConfig.LoginTip)
 	DoLogin(r.EventKey, r.FromUserName)
 
@@ -119,6 +124,8 @@ func downloadUserFace(url string) string {
 		defer resp.Body.Close()
 		if err == nil {
 			io.Copy(fi, resp.Body)
+		} else {
+			log.Println("download userface err:", err.Error())
 		}
 	}, func(e interface{}) {})
 	return filename

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

@@ -0,0 +1,13 @@
+package weixin
+
+import (
+	"log"
+	"testing"
+	"time"
+)
+
+func TestWeek(t *testing.T) {
+	d := time.Now()
+	d = d.AddDate(0, 0, 2)
+	log.Println(d.Hour(), d.Weekday(), int(d.Weekday()), d.Weekday() == 5)
+}

+ 2 - 0
weixin/src/qfw/weixin/weixinsdk.go

@@ -1133,10 +1133,12 @@ func (rw responseWriter) GetUserBaseInfo(openid string) (map[string]interface{},
 func (w *Weixin) GetUserBaseInfo(openid string) (map[string]interface{}, error) {
 	bs, err := sendGetRequest(weixinUserInfo+"?openid="+openid+"&lang=zh_CN&access_token=", w.tokenChan)
 	if err == nil {
+		log.Println("get userinfo ", string(bs))
 		ret := map[string]interface{}{}
 		err = json.Unmarshal(bs, &ret)
 		return ret, err
 	} else {
+		log.Println("get userinfo err ", err.Error())
 		return nil, err
 	}
 }

+ 1 - 9
weixin/src/qfw/weixinconfig/config_test.go

@@ -1,16 +1,8 @@
 package weixinconfig
 
-import (
-	"log"
-
-	"qfw/util"
-	"testing"
-)
+import ()
 
 //初始化
 func TestReadConfig(t *testing.T) {
 
-	//读取配置
-	util.ReadConfig("../../config.json", &SysConfig)
-	log.Println(SysConfig)
 }

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

@@ -29,6 +29,7 @@ type wxconfig struct {
 	LoginTip        string            `json:"loginTip"`
 	FreezeTip       string            `json:"freezeTip"`
 	Activity        map[string]string `json:"activity"` //活动配置
+	WeixinAutoRpl   string            `json:"weixinautorpl"`
 }
 
 //系统配置