Browse Source

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

Conflicts:
	core/src/web/staticres/css/entcommunity.css
	core/src/web/templates/service/detail.html
李广朋 9 years ago
parent
commit
a21cf312ed
56 changed files with 784 additions and 352 deletions
  1. 35 0
      common/src/config.json
  2. 19 14
      common/src/qfw/util/common.go
  3. 5 4
      common/src/qfw/util/credit/credit.go
  4. 13 2
      common/src/qfw/util/elastic/elasticutil_test.go
  5. 2 1
      common/src/qfw/util/encrypt_test.go
  6. 14 4
      common/src/qfw/util/image/imageutil.go
  7. 12 22
      common/src/qfw/util/mongodb/mongodbutil_test.go
  8. 4 3
      core/src/message.json
  9. 1 1
      core/src/qfw/coreutil/share.go
  10. 27 12
      core/src/qfw/manage/auditing.go
  11. 10 0
      core/src/qfw/member/bidmanage.go
  12. 1 1
      core/src/qfw/member/credit/creditdetail.go
  13. 7 10
      core/src/qfw/member/membermanager.go
  14. 10 0
      core/src/qfw/member/ordermanage.go
  15. 25 6
      core/src/qfw/mobile/wxmenu.go
  16. 3 3
      core/src/qfw/search/searchService.go
  17. 5 2
      core/src/qfw/swordfish/swordfishmanage.go
  18. 3 3
      core/src/qfw/yellowpage/yellowpagemanager.go
  19. 2 1
      core/src/timetask.json
  20. 10 33
      core/src/web/staticres/css/dev-qfw.css
  21. 3 5
      core/src/web/staticres/css/entcommunity.css
  22. 1 0
      core/src/web/staticres/css/qfw.css
  23. 26 26
      core/src/web/staticres/css/swordfish.css
  24. 35 7
      core/src/web/staticres/js/entportrait.js
  25. 0 15
      core/src/web/staticres/js/qfw.js
  26. 2 2
      core/src/web/staticres/wxswordfish/main.js
  27. 1 6
      core/src/web/templates/common/hotservice.html
  28. 2 2
      core/src/web/templates/common/login.html
  29. 2 6
      core/src/web/templates/common/memberleft.html
  30. 24 2
      core/src/web/templates/index.html
  31. 1 1
      core/src/web/templates/member/accountset/bindmail.html
  32. 1 1
      core/src/web/templates/member/accountset/bindphone.html
  33. 2 2
      core/src/web/templates/member/accountset/updatephone.html
  34. 3 3
      core/src/web/templates/member/credit/mycredit.html
  35. 4 0
      core/src/web/templates/member/editenterprise.html
  36. 29 13
      core/src/web/templates/search/enterpriseList.html
  37. 0 1
      core/src/web/templates/service/demand.html
  38. 28 4
      core/src/web/templates/service/detail.html
  39. 0 1
      core/src/web/templates/service/list.html
  40. 0 1
      core/src/web/templates/service/viewsingledemand.html
  41. 52 30
      core/src/web/templates/swordfish/infolist.html
  42. 42 23
      core/src/web/templates/swordfish/rssset.html
  43. 27 13
      core/src/web/templates/yellowpage/enterpriseinfo.html
  44. 13 12
      credit/src/config.json
  45. 153 2
      credit/src/main.go
  46. 1 1
      credit/src/qfw/creditlog/creditlog.go
  47. 36 26
      credit/src/qfw/creditrpc/creditrpc.go
  48. 11 14
      credit/src/qfw/creditrpc/creditrpc_test.go
  49. 1 1
      push/src/qfw/push/dopush/dopush.go
  50. 2 2
      weixin/src/config.json
  51. 2 0
      weixin/src/main.go
  52. 11 0
      weixin/src/qfw/weixin/dao/coupon.go
  53. 43 6
      weixin/src/qfw/weixin/dao/sharedao.go
  54. 9 1
      weixin/src/qfw/weixin/dao/userdao.go
  55. 8 0
      weixin/src/qfw/weixin/msgtxtchandler.go
  56. 1 1
      weixin/src/qfw/weixin/subscribehandler.go

+ 35 - 0
common/src/config.json

@@ -0,0 +1,35 @@
+{
+    "webServerPort": "80",
+    "redisServers": "enterprise=192.168.3.14:1379,service=192.168.3.14:2379,other=192.168.3.14:3379,sso=192.168.3.14:1379,credit=192.168.3.14:3379",
+    "useRedis": false,
+    "mongodbServers": "192.168.3.18:27080",
+    "elasticsearch": "http://192.168.3.18:9800",
+    "elasticPoolSize": 30,
+    "mongodbPoolSize": 5,
+    "mongodbName": "qfw",
+    "smtp": {
+        "addr": "smtp.exmail.qq.com",
+        "port": 465,
+        "user": "qyfw@topnet.net.cn",
+        "pwd": "qy123456",
+        "fromuser": "企明星"
+    },
+    "sms": {
+        "company": "企明星"
+    },
+    "entrelation": {
+        "level": 2,
+        "limit": 10
+    },
+    "allownfiletype": "gif,jpg,jpeg,png,doc,docx,xls,xlsx,zip,rar,pdf,txt",
+    "filesize": 15120,
+    "templateCache": false,
+    "httpCache": false,
+    "mailFailureTime": 3,
+    "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"
+
+}

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

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

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

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

+ 13 - 2
common/src/qfw/util/elastic/elasticutil_test.go

@@ -180,8 +180,19 @@ func Test_first(t *testing.T) {
 
 func Test_date(t *testing.T) {
 	//"1448267541"
-	s := time.Now().UnixNano()
-	log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
+	//s := time.Now().UnixNano()
+	//log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
+	t1 := time.Now().Unix()
+	t2 := t1 + 10000
+
+	tt1 := time.Unix(t1, 0)
+	tt2 := time.Unix(t2, 0)
+
+	nt1 := time.Date(tt1.Year(), tt1.Month(), tt1.Day(), 0, 0, 0, 0, time.Local)
+	nt2 := time.Date(tt2.Year(), tt2.Month(), tt2.Day(), 0, 0, 0, 0, time.Local)
+
+	log.Println((nt2.Unix() - nt1.Unix()) / 86400)
+
 }
 
 func Test_Getpage(t *testing.T) {

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

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

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

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

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

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

+ 4 - 3
core/src/message.json

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

+ 1 - 1
core/src/qfw/coreutil/share.go

@@ -19,7 +19,7 @@ func FindMyShareId(activecode, openid string) string {
 		data := make(map[string]interface{})
 		data["s_openid"] = openid
 		data["s_businesscode"] = activecode
-		data["shareid"] = shareid
+		data["i_shareid"] = shareid
 		data["l_timestamp"] = time.Now().Unix()
 		mongodb.Save("person_share", data)
 	} else {

+ 27 - 12
core/src/qfw/manage/auditing.go

@@ -21,6 +21,7 @@ import (
 	. "qfw/util/msg"
 	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
+	"runtime"
 	"strconv"
 	"strings"
 	"time"
@@ -419,6 +420,17 @@ func (s *SystemManage) Auditcontent(_id string) error {
 
 //审核用户认证信息
 func (s *SystemManage) Updateaudit() error {
+	defer func() {
+		if err := recover(); err != nil {
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	s.DisableHttpCache()
 	if s.Is("GET") {
 		return s.Render("/manage/systemsetting.html")
@@ -744,19 +756,22 @@ func (s *SystemManage) Updateaudit() error {
 			if (*f)["s_m_openid"] != nil {
 				openid = (*f)["s_m_openid"].(string)
 				go func() {
-					if i_freeze == 2 || i_freeze == 1 { //管理员通知
-						if i_freeze == 2 {
-							s_remark = fmt.Sprintf(util.GetPropertie("freeze.freezeRemark", coreconfig.MessageConfig).(string), freezeremark)
-							s_result = util.GetPropertie("freeze.freezeTitle", coreconfig.MessageConfig).(string)
-							s.Session().UpdateByCustomField("id", s_submitid, "i_freeze", 2)
-						} else {
-							s_remark = util.GetPropertie("freeze.unFreezeRemark", coreconfig.MessageConfig).(string)
-							s_result = util.GetPropertie("freeze.unFreezeTitle", coreconfig.MessageConfig).(string)
+					util.Try(func() {
+						if i_freeze == 2 || i_freeze == 1 { //管理员通知
+							if i_freeze == 2 {
+								s_remark = fmt.Sprintf(util.GetPropertie("freeze.freezeRemark", coreconfig.MessageConfig).(string), freezeremark)
+								s_result = util.GetPropertie("freeze.freezeTitle", coreconfig.MessageConfig).(string)
+								s.Session().UpdateByCustomField("id", s_submitid, "i_freeze", 2)
+							} else {
+								s_remark = util.GetPropertie("freeze.unFreezeRemark", coreconfig.MessageConfig).(string)
+								s_result = util.GetPropertie("freeze.unFreezeTitle", coreconfig.MessageConfig).(string)
+							}
+							coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: s_result, Detail: util.GetPropertie("freeze.manager", coreconfig.MessageConfig).(string), Remark: s_remark})
+						} else { //认证通知
+							s_detail = util.GetPropertie("indentify.success.wxdetail", coreconfig.MessageConfig).(string)
+							coreutil.SendIdentifyTplMsg(&qrpc.NotifyMsg{Openid: openid, Remark: s_remark, Detail: s_detail, Result: s_result})
 						}
-						coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: s_result, Detail: util.GetPropertie("freeze.manager", coreconfig.MessageConfig).(string), Remark: s_remark})
-					} else { //认证通知
-						coreutil.SendIdentifyTplMsg(&qrpc.NotifyMsg{Openid: openid, Remark: s_remark, Detail: s_detail, Result: s_result})
-					}
+					}, func(e interface{}) {})
 				}()
 			}
 			go func() {

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

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

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

@@ -171,7 +171,7 @@ func (c *credit) CreditList() error {
 		if currentPage == 1 {
 			count = mongodb.Count("creditlog", query)
 		}
-		r = *mongodb.Find("creditlog", query, `{"l_date":-1}`, nil, false, start, limit)
+		r = *mongodb.Find("creditlog", query, `{"l_datenm":-1}`, nil, false, start, limit)
 		for i := 0; i < len(r); i++ {
 			r[i]["index"] = (i + 1) + (currentPage-1)*limit
 			d := r[i]["l_date"]

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

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

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

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

+ 25 - 6
core/src/qfw/mobile/wxmenu.go

@@ -64,15 +64,12 @@ func (m *Mobile) Wxrssset() error {
 					if vobj, ok := v.(map[string]interface{}); ok {
 						if vobj["l_enddate"] != nil && vobj["i_status"] != nil {
 							if util.IntAll(vobj["i_status"]) == 1 {
-								sub := vobj["l_enddate"].(int64) - time.Now().Unix()
+								sub := util.GetSubDay(vobj["l_enddate"].(int64))
 								if sub >= 0 {
-									if sub%86400 == 0 {
-										vobj["days"] = sub / 86400
-									} else {
-										vobj["days"] = sub/86400 + 1
-									}
+									vobj["days"] = sub
 								} else {
 									vobj["days"] = 0
+									//是否要扣
 								}
 							}
 						}
@@ -274,6 +271,7 @@ func (m *Mobile) AjaxReq() error {
 		if userId := m.GetSession("userId"); userId != nil {
 			msgset := make(map[string]interface{})
 			set := make(map[string]interface{})
+			mapPush := map[string]string{}
 			for _, v := range []string{"tender", "bid"} {
 				if len(m.GetString(v+"_scope")) > 0 {
 					//还有一个截止时间字段和一个剑鱼服务状态
@@ -282,12 +280,33 @@ func (m *Mobile) AjaxReq() error {
 					set["o_msgset."+v+".a_key"] = m.GetSlice(v + "_keys")
 					set["o_msgset."+v+".s_scope"] = m.GetString(v + "_scope")
 					set["o_msgset."+v+".l_modifydate"] = time.Now().Unix()
+					mapPush[v] = util.If(v == "bid", "中标", "招标").(string)
 				}
 			}
 			//更新数据库
 			msgset["l_modifydate"] = time.Now().Unix()
 			if mongodb.Update("user", `{"_id":"`+userId.(string)+`"}`, &map[string]interface{}{"$set": set}, false, false) {
 				flag = "y"
+				credit_a := util.IntAll(m.GetSession("credit_a"))
+				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)
+					})
+				}
 			}
 		}
 		break

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

@@ -100,7 +100,7 @@ func (search *Search) FindServiceByEntId() error {
 		    }
 		  }}`
 		//需要查到的字段信息
-		fields = `"_id","s_name","s_introduction","s_images","s_enterpriseid","s_isshow","i_status","s_pricemy","i_comments","f_price"`
+		fields = `"_id","s_name","s_introduction","s_images","s_enterpriseid","s_isshow","i_status","s_pricemy","i_comments","f_price","i_sales"`
 		if currentPage == 1 {
 			count = elastic.Count("service", collection, query)
 		}
@@ -324,7 +324,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 						      }
 						    }
 						  }
-						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","OpStateName","s_servicenames","s_action","OpLocDistrict"]
+						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict"]
 						,"from":0,
 						"size":` + fmt.Sprintf("%v", perPage) + `,
 						  "sort": [{"_score": "desc"},{"OpSint":"desc"},{"RegCap":"desc"}]
@@ -469,7 +469,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 			"s_synopsis":{"force_source": true},
 			"stock":{"force_source": true}
         }
-    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","OpStateName","s_servicenames","s_action","OpLocDistrict","s_submitid"]
+    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid"]
 	,"from":` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 	"size":` + fmt.Sprintf("%v", perPage) +
 			`,"sort":[` + sort + `] }`

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

@@ -19,14 +19,15 @@ func (s *SwordFish) Swordfish() error {
 			s.T["data"] = r
 		}
 		content, _ := s.Render4Cache("/swordfish/index.html", &s.T)
-		redis.Put("other", "swordfish", string(content), 30*60*1000) //缓存半个小时
+		redis.Put("other", "swordfish", string(content), 1000) //缓存半个小时
 		return s.SetBody(content)
 	}
 }
 
 //跳转到订阅设置页面
 func (s *SwordFish) RssSet() error {
-	u := mongodb.FindById("user", s.GetSession("userId").(string), `{"o_msgset":1}`)
+	userId := s.GetSession("userId").(string)
+	u := mongodb.FindById("user", userId, `{"o_msgset":1}`)
 	msgset := (*u)["o_msgset"]
 	if msgset != nil {
 		if set, _ := msgset.(map[string]interface{}); set != nil {
@@ -48,7 +49,9 @@ func (s *SwordFish) RssSet() error {
 			}
 		}
 	}
+	list := mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
 	s.T["msgset"] = msgset
+	s.T["list"] = *list
 	return s.Render("/swordfish/rssset.html", &s.T)
 }
 

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

@@ -126,14 +126,14 @@ func GetEntInfo(id string) interface{} {
 //企业黄查询结果
 func (yp *Yellowpage) EnterpriseInfo(id string) error {
 	id = strings.Split(id, "#")[0]
-	if ret, err := redis.GetBytes("enterprise", id); err == nil {
+	if ret, err := redis.GetBytes("enterprise", "enterpriseInfo_"+id); err == nil {
 		return yp.SetBody(*ret)
 	} else {
 		if info := GetEntInfo(id); info != nil {
 			yp.T["res"] = info
 			contentuser, erruser := yp.Render4Cache("/yellowpage/enterpriseinfo.html", &yp.T)
 			if erruser == nil {
-				redis.PutBytes("enterprise", id, &contentuser, 7*ONEDAY)
+				redis.PutBytes("enterprise", "enterpriseInfo_"+id, &contentuser, 7*ONEDAY)
 			}
 			return yp.SetBody(contentuser)
 		} else {
@@ -277,7 +277,7 @@ func (yp *Yellowpage) GetRelation() error {
 		r := relation.(map[string]interface{})
 		var links *[]map[string]interface{}
 		if d, err := json.Marshal(r["links"]); err == nil && json.Unmarshal(d, &links) == nil && len(*links) > 0 {
-			if credit.AIsHasDo(credit.A_CKGXW, util.IntAll(yp.GetSession("credit_a"))) {
+			if !credit.AIsHasDo(credit.A_CKGXW, util.IntAll(yp.GetSession("credit_a"))) {
 				credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.A_CKGXW, "A", nil, yp.Action)
 			}
 		}

+ 2 - 1
core/src/timetask.json

@@ -1 +1,2 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-21 09:33:09"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-21 09:33:09"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 15:44:25"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 15:44:25"}},"marketisstart":true,"marketrate":300}
+

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

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

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

@@ -112,12 +112,9 @@ a:focus, a:hover{
 .entinfo-page .b-com-head .b-com-first{
 	line-height: 25px;
 }
-.entinfo-page .b-com-head .b-com-first>.b-microwebsite,.entinfo-page .b-com-head .b-com-first a{
+.entinfo-page .b-com-head .b-com-first a{
 	color: #16a086;
 }
-.entinfo-page .b-com-head .b-com-first>.b-microwebsite{
-	margin-left: 10px;
-}
 .entinfo-page .b-com-head .b-com-title{
 	font-size: 18px;
 	font-weight: bold;
@@ -629,7 +626,6 @@ a:focus, a:hover{
 }
 .ent-layout-up .b-com-content{
 	padding-top: 30px;
-	padding-bottom: 30px;
 }
 .ent-layout-down .b-com-content{
 	padding: 30px 20px;
@@ -655,6 +651,7 @@ a:focus, a:hover{
 .ent-table td{
 	padding: 15px 0px !important;
 	border-top: none !important;
+	white-space:nowrap;
 }
 .ent-table tr:first-child{
 	border-top: none !important;
@@ -671,4 +668,5 @@ a:focus, a:hover{
 .bd_weixin_popup{
 	opacity: 0;
 	visibility: hidden;
+	white-space: normal;
 }

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

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

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

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

+ 35 - 7
core/src/web/staticres/js/entportrait.js

@@ -75,6 +75,7 @@ function initRelation(){
 				$("#entrelation-limit,#entrelation-noauthe").removeClass("hide");
 				$("#entrelation-infovis").hide();
 			}else if(r.flag == true && (r == null || typeof(r) == "undefined" || typeof(r.relation.links) == "undefined" || r.relation.links.length == 0 || typeof(r.relation.nodes) == "undefined" || r.relation.nodes.length <= 1)){
+				$("#entrelation-limit,#entrelation-nologin").addClass("hide");
 				relation = "";
 				$("#entrelation-infovis").hide();
 				$("#entrelation-findnull").removeClass("hide");
@@ -82,7 +83,7 @@ function initRelation(){
 				loadJS("/js/d3.v3.min.js",function(){
 					loadJS("/js/geometry.js",function(){
 						loadJS("/js/relation.js",function(){
-							$("#entrelation-limit").addClass("hide");
+							$("#entrelation-limit,#entrelation-nologin").addClass("hide");
 							$(".entrelation").height(500);
 							relation = new Relation(legcerNo,regNo,r.relation);
 							relation.init();
@@ -101,17 +102,44 @@ function ServiceList(){
 		paging = new Paging("serviceListPaging","/front/findServiceByEntId",{entId:entId},6,function(r){
 			if(r.length == 0){
 				$("#serviceList").next(".ent-findnull").removeClass("hide");
+				$("#serviceList").remove();
+				return;
 			}
 			var html = '';
 			for(var i=0;i<r.length;i++){
+				var f_price = r[i].f_price;
+				if(typeof(f_price) == "undefined" || f_price == null || f_price == ""){
+					f_price = 0;
+				}
+				var i_sales = r[i].i_sales;
+				if(typeof(i_sales) == "undefined" || i_sales == null || i_sales == ""){
+					i_sales = 0;
+				}
+				var i_comments = r[i].i_comments;
+				if(typeof(i_comments) == "undefined" || i_comments == null || i_comments == ""){
+					i_comments = 0;
+				}
+				var flag = typeof(r[i].s_isshow) != "undefined" && r[i].s_isshow != null && r[i].s_isshow.indexOf("3")>-1;
 				html += '<tr>'
 						+'<td rowspan="2" width="120"><img src="'+(r[i].s_images==""?"null":r[i].s_images)+'" onerror="this.src=\'/images/services/default.png\'"></td>'
-						+'<td class="b-com-name"><a href="/market/detail/'+r[i]._id+'.html">'+r[i].s_name+'</a></td>'
-						+'<td width="100" class="text-center">报价:<font class="text-primary">'+(r[i].s_pricemy==0?"面议":r[i].f_price+"元")+'</font></td>'
-						+'<td width="100" class="text-center">评价:<font class="text-primary">'+r[i].i_comments+'</font></td>'
-						+'</tr><tr>'
-						+'<td>'+r[i].s_introduction+'</td>'
-						+'</tr>';
+						+'<td class="b-com-name">';
+				if(flag){
+					html += '<a href="/market/detail/'+r[i]._id+'.html">';
+				}
+				html += r[i].s_name;
+				if(flag){
+					html += '</a>';
+				}
+				html += '</td>';
+				if(flag){
+					html += '<td width="150" class="text-center"><font class="b-disabled">报价:</font><font class="text-primary">'+(r[i].s_pricemy==1?"面议":f_price+"元")+'</font></td>'
+						+'<td width="250" class="text-center"><font class="b-disabled">成交:</font><font class="text-primary">'+i_sales+'</font><font class="margin-lr-5 b-disabled">|</font><font class="b-disabled">评价:</font><font class="text-primary">'+i_comments+'</font></td>';
+				}else{
+					html += '<td>&nbsp;</td><td>&nbsp;</td>';
+				}
+				html += '</tr><tr>'
+					+'<td>'+r[i].s_introduction+'</td>'
+					+'</tr>';
 			}
 			$("#serviceListPaging").parent().prevAll().remove();
 			$("#serviceListPaging").parent().before(html);

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

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

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

@@ -69,7 +69,7 @@ KeyWordDialog.SetContentHeight = function(dialogObj){
 KeyWordDialog.AppendNode = function(dialogObj,value){
 	var getHtml = function(index,value){
 		return '<div class="keyWordGroup">'
-					+'<lable>关键词<font>'+index+'</font></lable>'
+					+'<lable style="white-space:nowrap;">关键词<font>'+index+'</font></lable>'
 					+'<div><input type="text" value="'+(value?value:"")+'" placeholder="示例:综合布线 电话线 网线" maxlength="100"></div>'
 					+'<div>'+(index==1?'':'<img src="/wxswordfish/images/delete.png" class="delete">')+'</div>'
 				+'</div>';
@@ -251,7 +251,7 @@ function showSnopshot(module,type,on){
 		//显示天数
 		try{
 			var days=eval("msgset."+module+".days")	
-			if(days){
+			if(typeof days=="number"){
 				var tiptxt="本栏目推送服务期还剩<d style='color:red'>"+days+"</d>天"
 				if(winWidth<341){
 					tiptxt="服务期还剩<d style='color:red'>"+days+"</d>天"

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

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

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

@@ -11,7 +11,7 @@
 	width: 520px;
 	height: 440px;
 }
-.loginModal a,.loginModal .text-primary{
+.loginModal .text-primary{
 	color: #ff5a5f !important;
 }
 .loginForm{
@@ -302,7 +302,7 @@ function afterLoginSkip(data,flag){
 							  	<a class="pull-right text-primary" href="/front/findpwd">忘记密码?</a>
 						  	</div>
 						  	<div class="form-group text-center margin-t-20">
-						    	<button type="submit" class="btn btn-primary" style="background-color: #ff5a5f;width: 100%;">登录</button>
+						    	<button type="submit" class="btn btn-primary" style="background-color: #ff5a5f;border-color: #ff5a5f;width: 100%;">登录</button>
 						  	</div>
 						</form>
 					</div>

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

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

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

@@ -115,7 +115,7 @@
 	</div>
 	
 	<div class="a-panel a-rmxq">
-		<div class="a-com-title index-new-rmxq-title" style="margin-bottom:0px;border-top:0px;"><font><a id="indexHotDemand">热门需求</a></font><span class="hidden-xs">成为服务商,马上参与投标</span><span style="float:right;margin-top:10px;"><a href="/market/demand/add.html" class="index-new-fbfw-a">发布需求</a>|<a  href="/market/0/list.html" class="index-new-fbfw-a">更多>></a></span></div>
+		<div class="a-com-title index-new-rmxq-title" style="margin-bottom:0px;border-top:0px;"><font><a id="indexHotDemand">热门需求</a></font><span class="hidden-xs">成为服务商,马上参与投标</span><span style="float:right;margin-top:10px;"><a href="/market/demand/add.html" class="index-new-fbfw-a">发布需求</a>|<a  href="/market/0/list_eyJjX2ZidGltZSI6IiIsImNfZnd0eXBlIjoiMCIsImNfcnp0eXBlIjoiIiwiY19zZWFyY2h0eXBlIjoiZGVtYW5kIiwiY19zb3J0dHlwZSI6IiIsImNfeHF0eXBlIjoiIiwiY2l0eSI6IiIsImNpdHlObyI6IiIsImN1cnJlbnRQYWdlIjoiMSIsInBlclBhZ2UiOiIiLCJxdWVyeSI6IiJ9.html" class="index-new-fbfw-a">更多>></a></span></div>
 		<div class="row index-new-rmxq-list" id="hotDemand">
 			{{$s:=(Ad "index-center-05" 4)}}
 			{{range $k,$v := $s}}
@@ -251,7 +251,7 @@
 		<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>
+		<li><span></span><span><a target="_blank" href="javascript:void(0);" class="reload" src="{{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>
@@ -309,6 +309,28 @@
 </div>
 {{include "/common/bottom.html"}}
 <script>
+$(function(){
+var areload=$("a.reload");
+areload.click(function(){
+	var h=$(this).attr("src");
+	open_window(h);
+	return false;
+})
+})
+function redirect(link){ 
+	if(!/^http/.test(link)){
+		link="http://"+link
+	}
+	window.location.href="/visit/redirect?url="+escape(link)
+
+}
+function open_window(link){
+	if(!/^http/.test(link)){
+		link="http://"+link
+	}
+    var arg = '\u003cscript\u003elocation.replace("'+link+'")\u003c/script\u003e';
+    window.open('javascript:window.name;', arg);
+}
 $(".bmzhsk").mouseover(function(){
 	$(".index-new-bmrzqy").addClass("hidden");
 	$(".index-new-bmjy").addClass("hidden");

+ 1 - 1
core/src/web/templates/member/accountset/bindmail.html

@@ -97,7 +97,7 @@
 					<label class="col-md-1 control-label">验证码</label>
 					<div class="input-group col-md-4 checkCodeId">
 						<input type="text" name="identCode" class="form-control" onkeyup="rePlaceUnDigital(this)" datatype="n6" maxlength="6" nullmsg="请输入邮箱验证码" errormsg="邮箱验证码格式错误" ajaxurl="/front/ajaxReq?oprType=checkIdentCode">
-						<span class="input-group-addon"><div id="sendIdentCodeBtn" class="sendIdentCodeBtn">获取邮箱验证码</div></span>
+						<span id="sendIdentCodeBtn" class="input-group-addon" style="width:96px;">获取邮箱验证码</span>
 					</div>
 					<div class="col-md-7"><span class="Validform_checktip">请输入邮箱验证码</span></div>
 				</div>

+ 1 - 1
core/src/web/templates/member/accountset/bindphone.html

@@ -71,7 +71,7 @@
 					<label class="col-md-1 control-label">验证码</label>
 					<div class="input-group col-md-4 checkCodeId">
 						<input type="text" name="identCode" class="form-control" onkeyup="rePlaceUnDigital(this)" datatype="n6" maxlength="6" nullmsg="请输入短信验证码" errormsg="请输入短信验证码" ajaxurl="/front/ajaxReq?oprType=checkIdentCode">
-						<span class="input-group-addon"><div id="sendIdentCodeBtn" class="sendIdentCodeBtn">获取短信验证码</div></span>
+						<span id="sendIdentCodeBtn" class="input-group-addon" style="width:96px;">获取短信验证码</span>
 					</div>
 					<div class="col-md-7"><span class="Validform_checktip">请输入短信验证码</span></div>
 				</div>

+ 2 - 2
core/src/web/templates/member/accountset/updatephone.html

@@ -78,7 +78,7 @@
 						<label class="col-md-2 control-label">短信验证码</label>
 						<div class="input-group col-md-4 checkCodeId">
 							<input type="text" class="form-control" name="oldIdentCode" onkeyup="rePlaceUnDigital(this)" datatype="n6" maxlength="6" nullmsg="请输入短信验证码" errormsg="短信验证码格式错误" ajaxurl="/front/ajaxReq?oprType=checkOldIdentCode">
-							<span class="input-group-addon"><div class="sendIdentCodeBtn" id="sendIdentCodeBtn_old">获取短信验证码</div></span>
+							<span id="sendIdentCodeBtn_old" class="input-group-addon" style="width:96px;">获取短信验证码</span>
 						</div>
 						<div class="col-md-6"><span class="Validform_checktip">请输入短信验证码</span></div>
 					</div>
@@ -126,7 +126,7 @@
 						<label class="col-md-2 control-label">短信验证码</label>
 						<div class="input-group col-md-4 checkCodeId">
 							<input type="text" class="form-control" name="newIdentCode" onkeyup="rePlaceUnDigital(this)" datatype="n6" maxlength="6" nullmsg="请输入短信验证码" errormsg="短信验证码格式错误" ajaxurl="/front/ajaxReq?oprType=checkIdentCode">
-							<span class="input-group-addon"><div id="sendIdentCodeBtn_new" class="sendIdentCodeBtn">获取短信验证码</div></span>
+							<span id="sendIdentCodeBtn_new" class="input-group-addon" style="width:96px;">获取短信验证码</span>
 						</div>
 						<div class="col-md-6"><span class="Validform_checktip">请输入短信验证码</span></div>
 					</div>

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

@@ -87,7 +87,7 @@
 								<td width="30%" align="center"><b>操作</b></td>
 							</tr>
 							<tr class="rowone">
-								<td width="60%" style="text-indent: 7em;">* 新用户注册,得50积分</td>
+								<td width="60%" style="text-indent: 7em;">* 新用户注册,得2000积分</td>
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 							</tr>
@@ -240,7 +240,7 @@
 								{{end}}
 							</tr>
 							<tr class="rowtwo">
-								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积</td>
+								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积</td>
 								{{if .T.B_QYCX.A }}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">{{.T.B_QYCX.B}}/{{.T.B_QYCX.C}}</span></td>
 								<td width="30%" style="padding:110px"></td>
@@ -363,7 +363,7 @@ $(function(){
 		checkContent("list_"+_v)
 	})
 	var AAll="{{.T.AAll}}"//一次性任务完成,位置切换
-	if (AAll==true){
+	if (AAll=="true"){
 		rcrw=$("#rcrw").html();
 		csrw=$("#csrw").html();
 		$("#rcrw").html(csrw);

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

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

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

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

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

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

+ 28 - 4
core/src/web/templates/service/detail.html

@@ -47,7 +47,6 @@
 <body>
 	<img src="{{.T.sinfo.s_shareimg}}" style="width:0px;height:0px;"/>
 	<!-- 审核头部 -->
-	{{include "/common/login.html"}}
 	{{include "/common/indexhead.html"}}
 	<div class="container-fluid a-content">
 		<div class="a-c-left a-servicedetail" >
@@ -160,7 +159,10 @@
 							{{if .T.einfo.s_qq}}
 							<span class="glyphicon qq1 icon_gray  text-muted"  ></span><span class="text-muted"><a href="tencent://message/?uin={{.T.einfo.s_qq}}&Site=hexun.com/ngdao&Menu=yes" class="margin-r-10"><img src="/images/u124.png" style="margin-top:-10px;cursor:pointer;" /></a></span>
 							{{end}}
-							<br/><span class="glyphicon dizhi icon_gray  text-muted"  ></span><span class="text-muted"><span id="de-address"></span> </span><br/>
+							<br/><span class="glyphicon dizhi icon_gray  text-muted"  ></span><span class="text-muted"><span id="de-address"></span><a href="javascript:void(0)" onclick="showMap()">查看详细地图</a>
+								<input id="location" type="hidden" value="">
+								<input id="cityname" type="hidden" value="">
+							</span><br/>
 						</div>
 		 			</div>
 		 </div>
@@ -323,11 +325,20 @@
 	{{include "/common/hotservice.html"}}
 	</div>
 </div>
+<!--显示地图信息-->
+<div id="mapshowdiv" class="white_content"></div>
+<a href ="javascript:void(0)" onclick="closeMap();"><div id="closeshowmap" class="closeshowmap">X</div></a>
+<div id="fade" class="black_overlay"></div>
 {{include "/common/bottom.html"}}
 <script type="text/javascript">
 compulsoryreRresh = true;
 $(function(){
-	
+	//获取地图的经纬度
+	loadJS("http://api.map.baidu.com/getscript?v=2&ak=AFd8b176f363f23e6a23d516f4cfb742&services=&t=20150522093217",function(){
+		loadJS("/js/geocoder.js",function(){
+			doOptions();
+		});
+	});
 	$(".d_fwfl a").eq(0).addClass("d_fwfl")
 	$(".m-comment li").mouseover(function(a,b,c){
 			var node=$(a.currentTarget);
@@ -653,7 +664,20 @@ function comment(){
 				$(".glyphicon.dizhi.icon_gray.text-muted").remove();
 			}
 		});
-		
+		//显示地图
+	function showMap(){
+		document.getElementById('mapshowdiv').style.display = 'block';
+		document.getElementById('closeshowmap').style.display = 'block';
+		document.getElementById('fade').style.display = 'block';
+		$("html,body").addClass("overflow-hidden");
+	}
+	//关闭地图
+	function closeMap(){
+		document.getElementById('mapshowdiv').style.display = 'none';
+		document.getElementById('closeshowmap').style.display = 'none';
+		document.getElementById('fade').style.display = 'none';
+		$("html,body").removeClass("overflow-hidden");
+	}
 	</script>
 	
 <script src="/js/jquery.cxselect.js" type="text/javascript"> </script>

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

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

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

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

+ 52 - 30
core/src/web/templates/swordfish/infolist.html

@@ -5,9 +5,7 @@
 </head>
 <body>
 <script type="text/javascript">
-	var lasttime=1,s_words,a_visitedindex,a_publishtime,le,f_id,a_interest;
-$(function(){
-	$(".b-nav>ul>li:eq(3)").addClass("b-nav-active");
+	var lasttime=1,a_visitedindex,a_publishtime,le,f_id;
 	var s_words = [];
 	var a_interest = [];
 	if({{.T.msgset.o_msgset.bid.a_key}}){
@@ -16,6 +14,8 @@ $(function(){
 	if({{.T.msgset.o_msgset.tender.a_key}}){
 		a_interest={{.T.msgset.o_msgset.tender.a_key}};
 	}
+$(function(){
+	$(".b-nav>ul>li:eq(3)").addClass("b-nav-active");
 	if(s_words.length!=0){
 		$("#okeywords").append(s_words.join(" ; ").replace(/\+/gm," "));
 	}else{
@@ -62,7 +62,7 @@ $(function(){
 				a_publishtime=temp["a_publishtime"];
 				f_id=temp["_id"];
 			}
-			$("#conlist").append('<div id="ycwords">'+str+'</div>');			
+			$("#conlist").append('<div id="ycwords" datatype="'+temp["s_type"]+'">'+str+'</div>');			
 			//信息条总数
 			le=$(".tslist").length;
 			//
@@ -75,18 +75,24 @@ $(function(){
 				var html = $(this).html();
 				for(var i=0;i<s_words.length;i++){
 					if(s_words[i] != ""){
-						var reg = new RegExp(s_words[i],"gm");
-						html = html.replace(reg,function(word){
-							return '<font class="keyword">'+word+'</font>';
-						});
+						var wordsArray = s_words[i].split("+");
+						for(var si=0;si<wordsArray.length;si++){
+							var reg = new RegExp(wordsArray[si],"gm");
+							html = html.replace(reg,function(word){
+								return '<font class="keyword">'+word+'</font>';
+							});
+						}
 					}
 				}
 				for(var i=0;i<a_interest.length;i++){
 					if(a_interest[i] != ""){
-						var reg = new RegExp(a_interest[i],"gm");
-						html = html.replace(reg,function(word){
-							return '<font class="keyword">'+word+'</font>';
-						});
+						var interestArray = a_interest[i].split("+");
+						for(var si=0;si<interestArray.length;si++){
+							var reg = new RegExp(interestArray[si],"gm");
+							html = html.replace(reg,function(word){
+								return '<font class="keyword">'+word+'</font>';
+							});
+						}
 					}
 				}
 				$(this).html(html);
@@ -99,7 +105,15 @@ $(function(){
 						}
 					}
 				}
-				$(this).find("a.bt").wrap("<div class='bt-parent' id="+xh+"></div>");
+				var datatype = $(this).parents("#ycwords").attr("datatype");
+				if(datatype == "bid"){
+					datatype = "【中标】";
+				}else if(datatype == "tender"){
+					datatype = "【招标】";
+				}else{
+					datatype = "";
+				}
+				$(this).find("a.bt").prepend(datatype).wrap("<div class='bt-parent' id="+xh+"></div>");
 				$(this).append(function(){
 					if(a_publishtime == "" || typeof(a_publishtime[xh]) == "undefined"){
 						return "";
@@ -182,14 +196,8 @@ function loadMore(){
 				a_publishtime=temp["a_publishtime"];
 				f_id=temp["_id"];
 			}
-			if({{.T.msgset.o_msgset.bid.a_key}}){
-				s_words={{.T.msgset.o_msgset.bid.a_key}};
-			}
-			if({{.T.msgset.o_msgset.tender.a_key}}){
-				a_interest={{.T.msgset.o_msgset.tender.a_key}};
-			}
 			
-			$("#conlist").append('<div id="ycwords">'+str+'</div>');
+			$("#conlist").append('<div id="ycwords" datatype="'+temp["s_type"]+'">'+str+'</div>');
 			//
 			$(".tslist").each(function(n){
 				$(this).children(".xh").text(function(i,v){
@@ -200,18 +208,24 @@ function loadMore(){
 				var html = $(this).html();
 				for(var i=0;i<s_words.length;i++){
 					if(s_words[i] != ""){
-						var reg = new RegExp(s_words[i],"gm");
-						html = html.replace(reg,function(word){
-							return '<font class="keyword">'+word+'</font>';
-						});
+						var wordsArray = s_words[i].split("+");
+						for(var si=0;si<wordsArray.length;si++){
+							var reg = new RegExp(wordsArray[si],"gm");
+							html = html.replace(reg,function(word){
+								return '<font class="keyword">'+word+'</font>';
+							});
+						}
 					}
 				}
 				for(var i=0;i<a_interest.length;i++){
 					if(a_interest[i] != ""){
-						var reg = new RegExp(a_interest[i],"gm");
-						html = html.replace(reg,function(word){
-							return '<font class="keyword">'+word+'</font>';
-						});
+						var interestArray = a_interest[i].split("+");
+						for(var si=0;si<interestArray.length;si++){
+							var reg = new RegExp(interestArray[si],"gm");
+							html = html.replace(reg,function(word){
+								return '<font class="keyword">'+word+'</font>';
+							});
+						}
 					}
 				}
 				$(this).html(html);
@@ -226,7 +240,15 @@ function loadMore(){
 					}
 				}
 				if($(this).children(".time-diff").length == 0){
-					$(this).find("a.bt").wrap("<div class='bt-parent' id="+vi+"></div>");
+					var datatype = $(this).parents("#ycwords").attr("datatype");
+					if(datatype == "bid"){
+						datatype = "【中标】";
+					}else if(datatype == "tender"){
+						datatype = "【招标】";
+					}else{
+						datatype = "";
+					}
+					$(this).find("a.bt").prepend(datatype).wrap("<div class='bt-parent' id="+vi+"></div>");
 					$(this).append(function(){
 						if(a_publishtime == "" || typeof(a_publishtime[vi]) == "undefined"){
 							return "";
@@ -302,7 +324,7 @@ function loadMore(){
 }
 .tim{padding:21px 0px;}
 .row{margin-left:10px;margin-right:10px;}
-#ycwords>div:first-child{display:none;}
+#ycwords>div:first-of-type{display:none;}
 #forkw{margin-top: 15px;padding:10px 0px 10px 50px;background-color: #F7F8FA;color: #a0a0a0;}
 .xh{width: 10%;color:#35C5DA;font-size:15px;font-weight:bold;margin:0px 20px;float:left;display: inline-block; width:18px;text-align:right;}
 .tslist{border-bottom:1px solid #ccc;width:100%; padding:15px 0px;}

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

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

+ 27 - 13
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -28,7 +28,6 @@
 				</script>
 				</span>
 				{{end}}
-				{{if .T.res.s_microwebsite}}<span class="b-microwebsite"><i class="glyphicon weiguanwang"></i><a href="/ent/wsite/preview/{{.T.res.entid}}">微官网</a></span>{{end}}
 			</div>
 			<div class="b-com-second">
 				{{if .T.res.EntName }}
@@ -150,8 +149,8 @@
 								</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>
+							{{if .T.res.RegNo}}<div><span>注册号</span><span>{{.T.res.RegNo}}</span></div>{{end}}
+							{{if .T.res.IndustryPhyName}}<div><span>行业</span><span>{{.T.res.IndustryPhyName}}</span></div>{{end}}
 						</div>
 						<!--成立日期-->
 						<div class="entinfo-estdate">
@@ -231,7 +230,7 @@
 							<img src="/images/entcommunity/shijian.png">
 							<div>
 								<span{{if and (not .T.res.OpFrom) (not .T.res.OpTo)}} class="entinfo-disabled"{{end}}>营业期限</span>
-								<span>{{if .T.res.OpFrom}}{{.T.res.OpFrom}}{{end}}{{if .T.res.OpTo}}至{{.T.res.OpTo}}{{end}}</span>
+								<span>{{if .T.res.OpFrom}}{{.T.res.OpFrom}}{{end}}{{if .T.res.OpTo}}至{{.T.res.OpTo}}{{else}}至长期{{end}}</span>
 							</div>
 						</div>
 						<a class="entinfo-operperiod-round"></a>
@@ -290,11 +289,12 @@
 			</div>
 		</div>
 		<div class="hide">
+		{{if or .T.res.OpScope .T.res.s_synopsis}}
 			<div class="ent-layout-up">
 				<div class="b-com-title">
 					<span class="glyphicon jianzhu"></span>公司简介
 				</div>
-				<div class="b-com-content"></div>
+				<div class="b-com-content margin-0"></div>
 			</div>
 			<div class="ent-layout-down">
 				{{if .T.res.OpScope}}
@@ -310,14 +310,20 @@
 				<div class="b-com-content">{{.T.res.s_synopsis}}</div>
 				{{end}}
 			</div>
+			{{else}}
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+			{{end}}
 		</div>
 		<div class="ent-alterinfo hide">
+		{{if gt (len .T.res.alterInfo) 0}}
 			<div class="ent-layout-up">
 				<div class="b-com-title">
 					<span class="glyphicon jianzhu"></span>变更信息
 				</div>
 				<div class="b-com-content">
-				{{if gt (len .T.res.alterInfo) 0}}
 					<ul>
 					{{range $k,$v := .T.res.alterInfo}}
 						<li>
@@ -336,21 +342,29 @@
 						</li>
 					{{end}}
 						<li>
-							<div></div>
 							<div>
+								<div></div>
+								<div></div>
+								<div></div>
+								<a></a>
+							</div>
+							<div>
+								<div></div>
+								<div></div>
+								<div></div>
 								<a></a>
 							</div>
 						</li>
 						<div class="clearfix"></div>
 					</ul>
-				{{else}}
-					<div class="ent-findnull">
-						<img src="/images/findnull.png" class="b-findnull">
-						<h4>抱歉,未找到相关数据!</h4>
-					</div>
-				{{end}}
 				</div>
 			</div>
+			{{else}}
+			<div class="ent-findnull">
+				<img src="/images/findnull.png" class="b-findnull">
+				<h4>抱歉,未找到相关数据!</h4>
+			</div>
+		{{end}}
 		</div>
 		<div class="hide">
 			<div class="ent-findnull">

+ 13 - 12
credit/src/config.json

@@ -9,7 +9,7 @@
     "rpcPort": "8765",
     "weixinrpc": "127.0.0.1:82",
     "num": {
-        "a1": 50,
+        "a1": 2000,
         "a2": 100,
         "a3": 50,
         "a4": 50,
@@ -24,7 +24,7 @@
         "a13": 50,
         "a14": 100,
         "a15": 80,
-        "a64": 1001,
+        "a62": 1001,
         "b1": 10,
         "b1_1": 10,
         "b1_n": 7,
@@ -48,7 +48,7 @@
         "swordfish_closeTitle": "剑鱼服务暂停提醒",
         "swordfish_close": "您的剑鱼服务已经到期,已经暂停,请及时续费。",
         "swordfish_payTitle": "剑鱼服务订单提醒",
-        "swordfish_pay": "您已成功续订剑鱼,扣除%d,剩余积分%d,剑鱼时长延期到%s",
+        "swordfish_pay": "您已成功续订剑鱼,扣除%d积分,剩余%d积分,剑鱼服务时长到:%s",
         "give": "转赠提醒",
         "give_pay": "转赠扣除提醒",
         "recharge": "充值成功提醒",
@@ -60,15 +60,15 @@
         "txt_a6": "收藏名片",
         "txt_a7": "收藏服务",
         "txt_a8": "使用剑鱼",
-        "txt_a9": "使用企业查询",
-        "txt_a10": "发服务",
-        "txt_a11": "发需求",
+        "txt_a9": "首次使用企业查询",
+        "txt_a10": "首次发服务",
+        "txt_a11": "首次发需求",
         "txt_a12": "查看关系网",
-        "txt_a13": "分享服务",
-        "txt_a14": "完成交易",
-        "txt_a15": "完成交易评价",
-		"txt_a63": "剑鱼首次推送",
-        "txt_a64": "完成一次性所有任务",
+        "txt_a13": "首次分享服务",
+        "txt_a14": "完成首次交易",
+        "txt_a15": "完成首次交易评价",
+		"txt_a61": "剑鱼首次推送",
+        "txt_a62": "完成一次性所有任务",
         "txt_b1": "签到",
         "txt_b2": "企业查询",
         "txt_b3": "发服务",
@@ -94,5 +94,6 @@
     "saveLogDuration": 1,
     "checkGiveDuration": 30,
     "swordfish_tipBeforeDays": "3,1",
-    "swordfish_subHour": 18
+    "swordfish_subHour": 16,
+	"timerHM":"40,s,21"
 }

+ 153 - 2
credit/src/main.go

@@ -27,6 +27,8 @@ var SysConfig map[string]interface{}
 var swordfish_subHour int
 var swordfish_tipBeforeDays []int
 var swordfish_dueTitle, swordfish_due, swordfish_closeTitle, swordfish_close, swordfish_payTitle, swordfish_pay string
+var duration_hour time.Duration = 24 * time.Hour
+var minutes = 0
 
 func init() {
 	util.ReadConfig(&SysConfig)
@@ -64,6 +66,37 @@ func init() {
 
 	creditlog.Smtp = SysConfig["smtp"].(map[string]interface{})
 
+	timerHM := util.ObjToString(SysConfig["timerHM"])
+	if timerHM != "" {
+		timerHMS := strings.Split(timerHM, ",")
+		tmp, _ := strconv.Atoi(timerHMS[0])
+		switch timerHMS[1] {
+		case "h":
+			duration_hour = time.Duration(tmp) * time.Hour
+		case "m":
+			duration_hour = time.Duration(tmp) * time.Minute
+		case "s":
+			duration_hour = time.Duration(tmp) * time.Second
+		}
+		minutes, _ = strconv.Atoi(timerHMS[2])
+
+		http.HandleFunc("/m", saveHandlerFunc)
+		go http.ListenAndServe(":8878", nil)
+
+	}
+
+}
+
+var TesB = make(chan bool, 1)
+
+func saveHandlerFunc(res http.ResponseWriter, req *http.Request) {
+	req.ParseForm()
+	form := req.Form
+	t := form.Get("t")
+	ts := strings.Split(t, ".")
+	swordfish_subHour, _ = strconv.Atoi(ts[0])
+	minutes, _ = strconv.Atoi(ts[1])
+	TesB <- true
 }
 
 func main() {
@@ -75,6 +108,7 @@ func main() {
 	go http.Serve(l, nil)
 	quartz()
 	log.Println("启动积分系统", port)
+
 	flag := make(chan bool)
 	<-flag
 }
@@ -106,7 +140,7 @@ func quartz() {
 	//每天一次检查剑鱼积分
 	//有一张增值服务表,记录服务代码、服务起始日期、服务截止日期、服务类型按月、服务数量、是否自动扣费(扣费走rpc调用)、记录是否过期
 
-	TimerSwordFish()
+	TimerSwordFishFromUser()
 
 	//定时任务转赠积分24后无人接收即退回,本月不做了
 	/**
@@ -138,7 +172,122 @@ func quartz() {
 	**/
 }
 
+//剑鱼定时扣分逻辑
+/**
+** 根据user表来处理
+**/
+func TimerSwordFishFromUser() {
+	go func() {
+		for {
+			now := time.Now()
+			// 计算下一个零点
+			next := now.Add(duration_hour)
+			next = time.Date(next.Year(), next.Month(), next.Day(), swordfish_subHour, minutes, 10, 0, next.Location())
+			next64 := next.Unix()
+			if int64(next.Sub(now)) < 0 {
+				continue
+			}
+			t := time.NewTimer(next.Sub(now))
+			select {
+			case <-t.C:
+				/*执行逻辑*/
+				log.Println("执行定时任务...")
+				util.Try(func() {
+					session := mongodb.GetMgoConn()
+					defer mongodb.DestoryMongoConn(session)
+					coll := session.DB("qfw").C("user")
+					for code, typeName := range map[string]string{
+						"A1": "tender",
+						"A2": "bid",
+					} {
+						query := coll.Find(&map[string]interface{}{
+							"o_msgset." + typeName + ".l_enddate": map[string]interface{}{
+								"$gte": next64 - 80000,
+								"$lte": next64 + int64(swordfish_tipBeforeDays[0]*24*3600) + 80000,
+							},
+							"o_msgset." + typeName + ".i_status":       1,
+							"o_msgset." + typeName + ".i_switchstatus": 1,
+						}).Iter()
+
+						for tmp := make(map[string]interface{}); query.Next(tmp); {
+							log.Println(tmp)
+							util.Try(func() {
+								tmpCode := tmp["o_msgset"].(map[string]interface{})[typeName].(map[string]interface{})
+								endDate := tmpCode["l_enddate"].(int64)
+								sub64 := util.GetSubDay(endDate) //(endDate - next64) / 86400
+								log.Println("======---====", sub64)
+								if sub64 <= 0 {
+									//自动扣费
+									doSubCreditByUser(util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string), typeName, code, &next, tmp)
+								} else {
+									//提示
+									for _, v := range swordfish_tipBeforeDays {
+										if v == sub64 {
+											creditrpc.SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string))
+										}
+									}
+								}
+							}, func(e interface{}) {})
+							tmp = make(map[string]interface{})
+						}
+					}
+				}, func(e interface{}) {
+					log.Println("定时任务,扣剑鱼积分时报错", e)
+				})
+				//TimerSwordFishFromUser()
+				break
+			case <-TesB:
+				//TimerSwordFishFromUser()
+				break
+			}
+		}
+	}()
+}
+
+//自动扣费
+func doSubCreditByUser(userId, umid, typeName, code string, next *time.Time, user map[string]interface{}) {
+	//是否生效和是否启用
+	util.Try(func() {
+		i_credit := util.IntAllDef(user["i_credit"], 0)
+		bsub := false
+		codeNum := creditrpc.Score[code]
+		restNum := i_credit + codeNum
+		if i_credit > 0 && restNum > -1 {
+			bsub = true
+		}
+		if bsub { //扣分操作
+			newDate := next.AddDate(0, 1, -1)
+			creditDoc := map[string]interface{}{
+				"s_uid":     userId,
+				"s_umid":    umid,
+				"s_code":    code,
+				"i_type":    0, //是扣
+				"l_date":    next.Unix(),
+				"l_enddate": newDate.Unix(),
+				"i_score":   codeNum,
+				"s_type":    typeName,
+			}
+			if creditlog.Save(creditDoc) {
+				//发送微信通知扣积分成功
+				creditrpc.SendMsgWebAndWx(swordfish_payTitle, fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, umid)
+			}
+		} else { //暂停操作
+			//更新操作
+			if mongodb.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"o_msgset.`+typeName+`.i_status":0}}`, false, false) {
+				//暂停通知,因积分不够
+				creditrpc.SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, umid)
+			}
+		}
+	}, func(e interface{}) {
+		log.Println("查询用户剑鱼状态出错,", e)
+	})
+}
+
 //剑鱼定时扣分逻辑,提前三天提示积分不够、扣积分发通知,下午18点执行
+/**
+** 根据creditlog表来处理
+**/
+/**
 func TimerSwordFish() {
 	go func() {
 		for {
@@ -149,7 +298,7 @@ func TimerSwordFish() {
 			next64 := next.Unix()
 			t := time.NewTimer(next.Sub(now))
 			<-t.C
-			/*执行逻辑*/
+			//执行逻辑
 			util.Try(func() {
 				session := mongodb.GetMgoConn()
 				defer mongodb.DestoryMongoConn(session)
@@ -249,3 +398,5 @@ func doSubCredit(userId, umid, typeName, code string, next *time.Time) {
 
 	}
 }
+
+**/

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

@@ -24,7 +24,7 @@ var Smtp map[string]interface{}
 //对map的同步
 var lock sync.Mutex
 
-func AddLog(logs map[string]interface{}) {
+func AddLog_BACK(logs map[string]interface{}) {
 	lock.Lock()
 	arr = append(arr, logs)
 	lock.Unlock()

+ 36 - 26
credit/src/qfw/creditrpc/creditrpc.go

@@ -60,6 +60,8 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 			}
 		}
 	}()
+	lock := GetMutex(param.Uid)
+	lock.Lock()
 	//a类为即时保存
 	//b、c、d、e为定时保存
 	log.Println("---请求", param)
@@ -73,6 +75,7 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 			"s_operation": Message["txt_"+param.Code],
 			"i_type":      1,
 			"l_date":      time.Now().Unix(),
+			"l_datenm":    time.Now().UnixNano() / 1000000,
 		}
 		i_scorenow := getCreditById(param.Uid)
 		switch first {
@@ -91,8 +94,6 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 		case "b":
 			key := param.Code + "_" + param.Uid
 			//[0/1,time,alltimes] //是否完成,次数,总次数,
-			lock := GetMutex(param.Uid)
-			lock.Lock()
 			if param.Code == "b1" { //签到
 				now := time.Now()
 				daykey := key + "_" + fmt.Sprintf("%d", now.Day())
@@ -114,8 +115,9 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 							creditDoc["i_scorenow"] = i_scorenow + Score[param.Code+"_1"] + int(thist)*Score[param.Code]
 							redis.Put(consts.RedisDB, key, newobj, GetSubSecond(int(newobj[2]-thist)))
 							redis.Put(consts.RedisDB, daykey, true, GetSubSecond(1))
-							creditlog.AddLog(creditDoc)
-							*replay = creditDoc["i_score"].(int)
+							if creditlog.Save(creditDoc) {
+								*replay = creditDoc["i_score"].(int)
+							}
 						} else {
 							//不是连续签到
 							bcon = false
@@ -133,8 +135,9 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 						creditDoc["i_scorenow"] = i_scorenow + Score[param.Code+"_1"]
 						redis.Put(consts.RedisDB, key, newobj, GetSubSecond(int(newobj[2])))
 						redis.Put(consts.RedisDB, daykey, true, GetSubSecond(1))
-						creditlog.AddLog(creditDoc)
-						*replay = creditDoc["i_score"].(int)
+						if creditlog.Save(creditDoc) {
+							*replay = creditDoc["i_score"].(int)
+						}
 					}
 				}
 			} else {
@@ -149,8 +152,9 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 						redis.Put(consts.RedisDB, key, newobj, GetSubSecond(1))
 						creditDoc["i_score"] = Score[param.Code]
 						creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
-						creditlog.AddLog(creditDoc)
-						*replay = creditDoc["i_score"].(int)
+						if creditlog.Save(creditDoc) {
+							*replay = creditDoc["i_score"].(int)
+						}
 					}
 				} else {
 					times := Score[param.Code+"_n"]
@@ -162,15 +166,12 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 					creditDoc["i_score"] = Score[param.Code]
 					creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
 					redis.Put(consts.RedisDB, key, newobj, GetSubSecond(1))
-					creditlog.AddLog(creditDoc)
-					*replay = creditDoc["i_score"].(int)
+					if creditlog.Save(creditDoc) {
+						*replay = creditDoc["i_score"].(int)
+					}
 				}
 			}
-			lock.Unlock()
-			//
 		case "c":
-			lock := GetMutex(param.Uid)
-			lock.Lock()
 			if param.Code == "c1" { //交易
 				objid := param.OtherParam["objid"]
 				if objid != nil {
@@ -186,13 +187,16 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 							"i_type":      1,
 							"s_sourceid":  param.Uid,
 							"l_date":      time.Now().Unix(),
+							"l_datenm":    time.Now().UnixNano() / 1000000,
 							"i_score":     Score[param.Code],
 							"i_scorenow":  i_scorenow + Score[param.Code],
 						}
-						creditlog.AddLog(creditDoc)
-						creditlog.AddLog(newDoc)
+						//creditlog.AddLog(creditDoc)
+						//creditlog.AddLog(newDoc)
 						redis.Put(consts.RedisDB, key, true, GetSubSecond(1))
-						*replay = creditDoc["i_score"].(int)
+						if creditlog.Save(creditDoc) && creditlog.Save(newDoc) {
+							*replay = creditDoc["i_score"].(int)
+						}
 					}
 				}
 			} else if param.Code == "c2" { //评价
@@ -203,29 +207,33 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 						creditDoc["i_score"] = Score[param.Code]
 						creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
 						creditDoc["o_param"] = param.OtherParam
-						creditlog.AddLog(creditDoc)
+						if creditlog.Save(creditDoc) {
+							*replay = creditDoc["i_score"].(int)
+						}
 						redis.Put(consts.RedisDB, key, true, GetSubSecond(1))
-						*replay = creditDoc["i_score"].(int)
+
 					}
 				}
 			} else {
 				creditDoc["i_score"] = Score[param.Code]
 				creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
 				creditDoc["o_param"] = param.OtherParam
-				creditlog.AddLog(creditDoc)
-				*replay = creditDoc["i_score"].(int)
+				if creditlog.Save(creditDoc) {
+					*replay = creditDoc["i_score"].(int)
+				}
 			}
-			lock.Unlock()
 		default: //定时任务
 			sc := util.If(param.Num > 0, param.Num, Score[param.Code]).(int)
 			if sc > 0 {
 				creditDoc["i_score"] = sc
 				creditDoc["i_scorenow"] = i_scorenow + sc
-				creditlog.AddLog(creditDoc)
-				*replay = creditDoc["i_score"].(int)
+				if creditlog.Save(creditDoc) {
+					*replay = creditDoc["i_score"].(int)
+				}
 			}
 		}
 	}
+	lock.Unlock()
 	return nil
 }
 
@@ -256,6 +264,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 			"s_operation": Message["txt_"+param.Code],
 			"i_type":      0,
 			"l_date":      now.Unix(),
+			"l_datenm":    time.Now().UnixNano() / 1000000,
 		}
 		if param.OtherParam != nil && param.OtherParam["i_way"] != nil {
 			creditDoc["i_way"] = param.OtherParam["i_way"]
@@ -263,7 +272,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 		var newDate time.Time
 		switch first {
 		case "A":
-			newDate = GetTimeByNow(now, Hour).AddDate(0, 1, 1)
+			newDate = GetTimeByNow(now, Hour).AddDate(0, 1, -1)
 			creditDoc["l_enddate"] = newDate.Unix()
 			creditDoc["i_valid"] = 1
 			if param.OtherParam != nil {
@@ -301,7 +310,7 @@ func SendMsgWebAndWx(title, content, userId, umid string) {
 		ReceiveId: userId,
 	}
 	go m.SaveMsg()
-	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "管理员", Remark: content})
+	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "剑鱼君", Remark: content})
 
 }
 
@@ -319,6 +328,7 @@ func SendManagerNotifyMsg(p *qrpc.NotifyMsg) {
 		}
 	}()
 	client, err := rpc.DialHTTP("tcp", Rpcserver)
+	defer client.Close()
 	if err != nil {
 		log.Println(err.Error())
 		return

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

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

+ 1 - 1
push/src/qfw/push/dopush/dopush.go

@@ -208,7 +208,7 @@ func SendWeixin(k *push.MemberInterest, TITLE, ShortTitle, str, stype string, no
 		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, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“会员服务—剑鱼”进行修改。"
+	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“剑鱼”进行修改。"
 	push.SendWinXin(&qrpc.NotifyMsg{
 		Openid:  k.Openid,
 		Title:   push.PushConfig[stype+"Title"].(string),

+ 2 - 2
weixin/src/config.json

@@ -27,11 +27,11 @@
                 "identifytplid":"oGxkPyaV42z3KWykt58Tow9mBe_ImJvi8R3ajorVWOY",
                 "offLinemsgtplid":"ExIeyFfoDNVJXhRDq09JbsjH_zbEJCB6gw6rxcV7atw",
                 "msgnotifytplid":"b7iuAMiTCIolnPhTdueKBVYThEMf2D-Bh2M_9v3J-68",
-                "managernotifytplid":"dplgu5Q644vzPdqcPXY7RqgItS3eXACmU1XDl27CvTA"
+                "managernotifytplid":"DIwMrPQToOhGfa6ZAQCCrqquzbLKajiXsKY0K_lQtWQ"
         },"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"
+		"creditRpc":"127.0.0.1:8765"
 }

+ 2 - 0
weixin/src/main.go

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

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

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

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

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

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

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

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

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

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

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