Browse Source

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

wangchuanjin 9 years ago
parent
commit
99babe29b8
40 changed files with 916 additions and 310 deletions
  1. 11 1
      common/src/github.com/go-xweb/httpsession/memorystore.go
  2. 72 20
      common/src/qfw/util/credit/credit.go
  3. 2 2
      common/src/qfw/util/rpc/credit.go
  4. 3 2
      core/src/qfw/coreutil/weixinrpc_test.go
  5. 5 2
      core/src/qfw/manage/auditing.go
  6. 13 2
      core/src/qfw/member/bidmanage.go
  7. 3 0
      core/src/qfw/member/credit/credit.go
  8. 90 30
      core/src/qfw/member/credit/creditdetail.go
  9. 11 3
      core/src/qfw/member/membermanager.go
  10. 15 0
      core/src/qfw/member/ordermanage.go
  11. 7 10
      core/src/qfw/member/yellowpage.go
  12. 1 0
      core/src/qfw/mobile/mobile.go
  13. 86 47
      core/src/qfw/mobile/wxmenu.go
  14. 3 6
      core/src/qfw/search/searchService.go
  15. 4 5
      core/src/qfw/searchmarket/demand.go
  16. 1 1
      core/src/qfw/searchmarket/marketservice.go
  17. 12 0
      core/src/qfw/searchmarket/service.go
  18. 4 3
      core/src/qfw/swordfish/swordfishmanage.go
  19. 1 1
      core/src/timetask.json
  20. 19 18
      core/src/web/staticres/css/dev-qfw.css
  21. BIN
      core/src/web/staticres/images/defalut.png
  22. BIN
      core/src/web/staticres/images/default.png
  23. BIN
      core/src/web/staticres/images/services/default.png
  24. BIN
      core/src/web/staticres/images/u20.png
  25. BIN
      core/src/web/staticres/images/u252.png
  26. BIN
      core/src/web/staticres/images/u288.png
  27. 4 5
      core/src/web/staticres/js/marketlist.js
  28. 169 31
      core/src/web/staticres/wxswordfish/main.js
  29. 8 1
      core/src/web/staticres/wxswordfish/style.css
  30. 41 15
      core/src/web/templates/common/memberleft.html
  31. 29 0
      core/src/web/templates/member/credit/creditrule.html
  32. 63 17
      core/src/web/templates/member/credit/mycredit.html
  33. 16 17
      core/src/web/templates/service/detail.html
  34. 61 13
      core/src/web/templates/service/list.html
  35. 5 5
      core/src/web/templates/swordfish/wxrssset.html
  36. 14 0
      core/src/web/templates/swordfish/wxtoolbar.html
  37. 2 0
      credit/src/config.json
  38. 16 18
      credit/src/main.go
  39. 8 4
      credit/src/qfw/creditlog/creditlog.go
  40. 117 31
      credit/src/qfw/creditrpc/creditrpc.go

+ 11 - 1
common/src/github.com/go-xweb/httpsession/memorystore.go

@@ -44,7 +44,17 @@ func (node *sessionNode) UpdateByCustomField(findkey string, findvalue interface
 	if v2, ok := node.kvs[findkey]; ok && v2 == findvalue {
 		//存在
 		if setkey != "" {
-			node.kvs[setkey] = setvalue
+			flag := setkey[:1]
+			switch flag {
+			case "+":
+				nkey := setkey[1:]
+				node.kvs[nkey] = node.kvs[nkey].(int) + setvalue.(int)
+			case "-":
+				nkey := setkey[1:]
+				node.kvs[nkey] = node.kvs[nkey].(int) - setvalue.(int)
+			default:
+				node.kvs[setkey] = setvalue
+			}
 			node.last = time.Now()
 		} else {
 			mapVal := setvalue.(*map[string]interface{})

+ 72 - 20
common/src/qfw/util/credit/credit.go

@@ -3,6 +3,8 @@ package credit
 
 import (
 	"fmt"
+	"github.com/go-xweb/xweb"
+	"log"
 	"qfw/util"
 	mogo "qfw/util/mongodb"
 	"qfw/util/rpc"
@@ -62,36 +64,35 @@ func init() {
 }
 
 //一次性任务积分
-func InCreditA(userId, code string, credit_a int) (bool, int, error) {
+func InCreditA(userId, code string, credit_a int) (bool, int, int, error) {
 	result := false
 	if len(userId) < 1 {
-		return result, credit_a, nil
+		return result, credit_a, 0, nil
 	}
-	var Replay *int
+	var Replay int
 	if !AIsHasDo(code, credit_a) {
 		param := make(map[string]interface{})
-		err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, Replay)
-		if err == nil && *Replay == 1 {
+		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)
 		}
-		return result, credit_a, err
+		return result, credit_a, Replay, err
 	}
-	return result, credit_a, nil
+	return result, credit_a, 0, nil
 }
 
 //日常任务积分
-func InCreditB(userId, code string) (bool, error) {
+func InCreditB(userId, code string, param map[string]interface{}) (bool, int, error) {
 	b := false
 	if len(userId) < 1 {
-		return b, nil
+		return b, 0, nil
 	}
-	var Replay *int
-	param := make(map[string]interface{})
-	err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, Replay)
-	if err == nil && *Replay == 1 {
+	var Replay int
+	err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, &Replay)
+	if err == nil && Replay > 0 {
 		b = true
 	}
-	return b, err
+	return b, Replay, err
 }
 
 //更新用户一次性积分状态
@@ -118,15 +119,66 @@ func AIsHasDo(code string, num int) bool {
 	return b
 }
 
+//判断A是否完成
+func AAllIsHasDo(num int) bool {
+	b := false
+	var ret uint64
+	for k, v := range CreditA {
+		ret = 1 << (v - 1)
+		if k == "a6" || k == "a7" { //过滤收藏
+			b = true
+			continue
+		}
+		if uint64(num)&ret > 0 {
+			b = true
+		} else {
+			b = false
+			break
+		}
+	}
+	return b
+}
+
 //扣积分
-func OutCreditB(userId, code string, score int, param map[string]interface{}) (b bool) {
+func OutCreditB(userId, code, umid string, score int, param map[string]interface{}) (bool, int) {
+	b := false
+	var Replay int
 	if len(userId) < 5 {
-		return
+		return b, Replay
 	}
-	var Replay *int
-	err := Rc.OutCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: score, OtherParam: param}, Replay)
-	if err == nil && *Replay == 1 {
+	err := Rc.OutCreadit(&rpc.CreditData{Code: code, Uid: userId, Umid: umid, Num: score, OtherParam: param}, &Replay)
+	if err == nil && Replay > 0 {
 		b = true
 	}
-	return
+	return b, Replay
+}
+
+//更新积分和session
+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)
+			if b {
+				log.Println(userId, "完成所有一次性任务")
+			}
+		}
+	} 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, "任务送积分失败")
+		}
+	}
+	return b
 }

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

@@ -25,7 +25,7 @@ func (rc *RpcCall) InCreadit(param *CreditData, replay *int) error {
 	if err != nil {
 		return err
 	}
-	err = client.Call("CreditRpc.InCreadit", &param, &replay)
+	err = client.Call("CreditRpc.InCreadit", param, replay)
 	return err
 }
 
@@ -36,6 +36,6 @@ func (rc *RpcCall) OutCreadit(param *CreditData, replay *int) error {
 	if err != nil {
 		return err
 	}
-	err = client.Call("CreditRpc.OutCreadit", &param, &replay)
+	err = client.Call("CreditRpc.OutCreadit", param, replay)
 	return err
 }

+ 3 - 2
core/src/qfw/coreutil/weixinrpc_test.go

@@ -107,9 +107,10 @@ func Test_credit(t *testing.T) {
 	client, _ := rpc.DialHTTP("tcp", "127.0.0.1:8765")
 	defer client.Close()
 	data := qrpc.CreditData{}
-	data.Code = "d1"
+	data.Code = "b2"
 	data.Uid = "55a39942af53740186000004"
-	data.Num = 3000
+	//data.Num = 3000
 	var reply int
 	client.Call("CreditRpc.InCreadit", &data, &reply)
+	log.Println("reply:", reply)
 }

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

@@ -775,8 +775,11 @@ func (s *SystemManage) Updateaudit() error {
 		}
 		//认证送积分
 		if flag == "true" {
-			_, credit_a, _ := credit.InCreditA(s_submitid, credit.A_RZ, util.IntAll((*f)["credit_a"]))
-			s.Session().UpdateByCustomField("id", s_submitid, "credit_a", credit_a)
+			b, credit_a, score, _ := credit.InCreditA(s_submitid, credit.A_RZ, util.IntAll((*f)["credit_a"]))
+			if b {
+				s.Session().UpdateByCustomField("id", s_submitid, "i_credit", util.IntAll((*f)["i_credit"])+score)
+				s.Session().UpdateByCustomField("id", s_submitid, "credit_a", credit_a)
+			}
 		}
 		s.Write(`{"flag":"` + flag + `","msg":"` + msg + `"}`)
 	}

+ 13 - 2
core/src/qfw/member/bidmanage.go

@@ -10,6 +10,7 @@ import (
 	. "gopkg.in/mgo.v2/bson"
 	"log"
 	util "qfw/util"
+	"qfw/util/credit"
 	elastic "qfw/util/elastic"
 	. "qfw/util/mongodb"
 	msg "qfw/util/msg"
@@ -188,7 +189,6 @@ func (d *BidManage) ChangeStatus() error {
 					}
 					m.SaveMsg()
 				}
-
 			} else if status == 2 {
 				//单独拒绝
 				//通知未被选中的人
@@ -202,7 +202,18 @@ func (d *BidManage) ChangeStatus() error {
 				}
 				m.SaveMsg()
 			}
-
+			//选标达成交易送积分
+			if status == 3 {
+				param := make(map[string]interface{})
+				param["objid"] = wtb["s_userid"].(string)
+				credit_a := util.IntAll(d.GetSession("credit_a"))
+				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)
+				}
+			}
 		}
 	}
 	d.ServeJson(M{"result": result})

+ 3 - 0
core/src/qfw/member/credit/credit.go

@@ -8,6 +8,9 @@ import (
 	"github.com/go-xweb/xweb"
 )
 
+var RedisDB string
+
 func init() {
+	RedisDB = "other"
 	xweb.AddAction(&credit{})
 }

+ 90 - 30
core/src/qfw/member/credit/creditdetail.go

@@ -16,9 +16,11 @@ import (
 
 type credit struct {
 	*xweb.Action
-	myCredit    xweb.Mapper `xweb:"/member/credit/myCredit"`    //我的积分
-	creditRule  xweb.Mapper `xweb:"/member/credit/creditRule"`  //积分规则
-	inCreditAjx xweb.Mapper `xweb:"/member/credit/inCreditAjx"` //ajx调用
+	myCredit     xweb.Mapper `xweb:"/member/credit/myCredit"`     //我的积分
+	creditRule   xweb.Mapper `xweb:"/member/credit/creditRule"`   //积分规则
+	inCreditAjx  xweb.Mapper `xweb:"/member/credit/inCreditAjx"`  //ajx调用
+	sessionQdAjx xweb.Mapper `xweb:"/member/credit/sessionQdAjx"` //查看签到
+	creditList   xweb.Mapper `xweb:"/member/credit/creditList"`   //查询积分明细
 }
 
 func (c *credit) MyCredit() error {
@@ -27,21 +29,27 @@ func (c *credit) MyCredit() error {
 		user := *mongodb.FindById("user", userId, nil)
 		c.T["user"] = user
 		credit_a := util.IntAll(user["credit_a"])
-		c.T["A_RZ"] = cd.AIsHasDo(cd.A_RZ, credit_a)         //认证
-		c.T["A_CJMP"] = cd.AIsHasDo(cd.A_CJMP, credit_a)     //创建名片
-		c.T["A_BYX"] = cd.AIsHasDo(cd.A_BYX, credit_a)       //绑定邮箱
-		c.T["A_BSJ"] = cd.AIsHasDo(cd.A_BSJ, credit_a)       //绑定手机
-		c.T["A_SCMP"] = cd.AIsHasDo(cd.A_SCMP, credit_a)     //收藏名片
-		c.T["A_SCFW"] = cd.AIsHasDo(cd.A_SCFW, credit_a)     //收藏服务
-		c.T["A_SYJY"] = cd.AIsHasDo(cd.A_SYJY, credit_a)     //使用剑鱼
-		c.T["A_QYCX"] = cd.AIsHasDo(cd.A_QYCX, credit_a)     //使用企业查询
-		c.T["A_FFW"] = cd.AIsHasDo(cd.A_FFW, credit_a)       //发服务
-		c.T["A_FXQ"] = cd.AIsHasDo(cd.A_FXQ, credit_a)       //发需求
-		c.T["A_CKGXW"] = cd.AIsHasDo(cd.A_CKGXW, credit_a)   //查看关系网
-		c.T["A_FXFWXQ"] = cd.AIsHasDo(cd.A_FXFWXQ, credit_a) //分享服务需求
-		c.T["A_WCJY"] = cd.AIsHasDo(cd.A_WCJY, credit_a)     //完成交易
-		c.T["A_WCJYPJ"] = cd.AIsHasDo(cd.A_WCJYPJ, credit_a) //完成交易评价
-		if ret := redis.Get("other", cd.B_QD+"_"+userId); ret != nil {
+		b := cd.AAllIsHasDo(credit_a)
+		if b {
+			c.T["AAll"] = true
+		} else {
+			c.T["AAll"] = false
+			c.T["A_RZ"] = cd.AIsHasDo(cd.A_RZ, credit_a)         //认证
+			c.T["A_CJMP"] = cd.AIsHasDo(cd.A_CJMP, credit_a)     //创建名片
+			c.T["A_BYX"] = cd.AIsHasDo(cd.A_BYX, credit_a)       //绑定邮箱
+			c.T["A_BSJ"] = cd.AIsHasDo(cd.A_BSJ, credit_a)       //绑定手机
+			c.T["A_SCMP"] = cd.AIsHasDo(cd.A_SCMP, credit_a)     //收藏名片
+			c.T["A_SCFW"] = cd.AIsHasDo(cd.A_SCFW, credit_a)     //收藏服务
+			c.T["A_SYJY"] = cd.AIsHasDo(cd.A_SYJY, credit_a)     //使用剑鱼
+			c.T["A_QYCX"] = cd.AIsHasDo(cd.A_QYCX, credit_a)     //使用企业查询
+			c.T["A_FFW"] = cd.AIsHasDo(cd.A_FFW, credit_a)       //发服务
+			c.T["A_FXQ"] = cd.AIsHasDo(cd.A_FXQ, credit_a)       //发需求
+			c.T["A_CKGXW"] = cd.AIsHasDo(cd.A_CKGXW, credit_a)   //查看关系网
+			c.T["A_FXFWXQ"] = cd.AIsHasDo(cd.A_FXFWXQ, credit_a) //分享服务需求
+			c.T["A_WCJY"] = cd.AIsHasDo(cd.A_WCJY, credit_a)     //完成交易
+			c.T["A_WCJYPJ"] = cd.AIsHasDo(cd.A_WCJYPJ, credit_a) //完成交易评价
+		}
+		if ret := redis.Get(RedisDB, cd.B_QD+"_"+userId); ret != nil {
 			tmp := util.InterfaceArrTointArr(ret.([]interface{}))
 			qd := false
 			if time.Unix(int64(tmp[0]), 0).Day() == time.Now().Day() {
@@ -49,27 +57,27 @@ func (c *credit) MyCredit() error {
 			}
 			c.T["B_QD"] = map[string]interface{}{"A": qd, "B": tmp[1]}
 		} else {
-			c.T["B_QD"] = map[string]interface{}{"B": 1}
+			c.T["B_QD"] = map[string]interface{}{"A": false, "B": 1}
 		}
-		if ret := redis.Get("other", cd.B_FFW+"_"+userId); ret != nil {
+		if ret := redis.Get(RedisDB, cd.B_FFW+"_"+userId); ret != nil {
 			tmp := util.InterfaceArrTointArr(ret.([]interface{}))
 			c.T["B_FFW"] = map[string]interface{}{"A": tmp[0], "B": tmp[1], "C": tmp[2]}
 		} else {
 			c.T["B_FFW"] = map[string]interface{}{"A": 0, "B": 0, "C": cd.B_FFW_T}
 		}
-		if ret := redis.Get("other", cd.B_FXQ+"_"+userId); ret != nil {
+		if ret := redis.Get(RedisDB, cd.B_FXQ+"_"+userId); ret != nil {
 			tmp := util.InterfaceArrTointArr(ret.([]interface{}))
 			c.T["B_FXQ"] = map[string]interface{}{"A": tmp[0], "B": tmp[1], "C": tmp[2]}
 		} else {
 			c.T["B_FXQ"] = map[string]interface{}{"A": 0, "B": 0, "C": cd.B_FXQ_T}
 		}
-		if ret := redis.Get("other", cd.B_FXFWXQ+"_"+userId); ret != nil {
+		if ret := redis.Get(RedisDB, cd.B_FXFWXQ+"_"+userId); ret != nil {
 			tmp := util.InterfaceArrTointArr(ret.([]interface{}))
 			c.T["B_FXFWXQ"] = map[string]interface{}{"A": tmp[0], "B": tmp[1], "C": tmp[2]}
 		} else {
 			c.T["B_FXFWXQ"] = map[string]interface{}{"A": 0, "B": 0, "C": cd.B_FXFWXQ_T}
 		}
-		if ret := redis.Get("other", cd.B_QYCX+"_"+userId); ret != nil {
+		if ret := redis.Get(RedisDB, cd.B_QYCX+"_"+userId); ret != nil {
 			tmp := util.InterfaceArrTointArr(ret.([]interface{}))
 			c.T["B_QYCX"] = map[string]interface{}{"A": tmp[0], "B": tmp[1], "C": tmp[2]}
 		} else {
@@ -85,28 +93,80 @@ func (c *credit) MyCredit() error {
 func (c *credit) InCreditAjx() error {
 	userId := util.ObjToString(c.GetSession("userId"))
 	result := make(M)
+	result["result"] = "n"
 	if len(userId) > 0 {
 		credit_a := util.IntAll(c.GetSession("credit_a"))
 		param := c.GetString("param")
 		//分享服务
 		if param == "fx" {
 			if cd.AIsHasDo(cd.A_FXFWXQ, credit_a) {
-				//日常任务
-				cd.InCreditB(userId, cd.B_FXFWXQ)
+				cd.UpuserCreditSession(userId, cd.B_FXFWXQ, "B", nil, c.Action)
 			} else {
-				//一次性任务
-				cd.InCreditA(userId, cd.A_FXFWXQ, credit_a)
-				cd.InCreditB(userId, cd.B_FXFWXQ)
+				cd.UpuserCreditSession(userId, cd.A_FXFWXQ, "A", nil, c.Action)
 			}
 		}
 		if param == "qd" {
-			cd.InCreditB(userId, cd.B_QD)
-			log.Println("qiandao")
+			b := cd.UpuserCreditSession(userId, cd.B_QD, "A", nil, c.Action)
+			if b {
+				c.Session().UpdateByCustomField("id", userId, "credit_qd", "y")
+				result["result"] = "y"
+			}
 		}
 	}
 	c.ServeJson(result)
 	return nil
 }
+
+//会员中心更新session签到信息
+func (c *credit) SessionQdAjx() error {
+	credit_qd := util.ObjToString(c.GetSession("credit_qd"))
+	result := make(M)
+	if credit_qd == "y" {
+		return nil
+	}
+	userId := util.ObjToString(c.GetSession("userId"))
+	if ret := redis.Get(RedisDB, cd.B_QD+"_"+userId); ret != nil {
+		tmp := util.InterfaceArrTointArr(ret.([]interface{}))
+		if time.Unix(int64(tmp[0]), 0).Day() == time.Now().Day() {
+			c.Session().UpdateByCustomField("id", userId, "credit_qd", "y")
+			result["result"] = "y"
+		} else {
+			result["result"] = "n"
+		}
+	} else {
+		c.Session().UpdateByCustomField("id", userId, "credit_qd", "n")
+	}
+	c.ServeJson(result)
+	return nil
+}
+
+//取积分列表
+func (c *credit) CreditList() error {
+	if c.Is("GET") {
+		return c.Render("/member/credit/creditList")
+	} else {
+		limit, _ := c.GetInteger("pageSize")
+		currentPage, _ := c.GetInteger("currentPage")
+		start := (currentPage - 1) * limit
+		var count int
+		var r []map[string]interface{}
+		userId := c.Action.GetSession("userId").(string)
+		query := M{"s_uid": userId}
+		if currentPage == 1 {
+			count = mongodb.Count("creditlog", query)
+		}
+		r = *mongodb.Find("creditlog", query, `{"l_date":-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"]
+			r[i]["l_date"] = util.FormatDateWithObj(&d, util.Date_Full_Layout)
+		}
+		c.ServeJson(M{"list": r, "count": count})
+		log.Println(r)
+		return nil
+	}
+}
+
 func (c *credit) CreditRule() error {
 	return c.Render("/member/credit/creditrule.html")
 }

+ 11 - 3
core/src/qfw/member/membermanager.go

@@ -668,7 +668,9 @@ func (m *Member) Logout() error {
 	m.DelSession("audittype")     //认证后是否是第一次登录的标识第一次:y
 	m.DelSession("promotion_id")  //推广id
 	m.DelSession("promotion_c")   //推广邮件代码
+	m.DelSession("i_credit")      //用户积分
 	m.DelSession("credit_a")      //a积分任务
+	m.DelSession("credit_qd")     //签到
 
 	deleteCookie(m)
 	return m.Redirect("/")
@@ -876,7 +878,9 @@ func (m *Member) Bindmail() error {
 				bol := Update("user", M{"_id": ObjectIdHex(m.GetSession("userId").(string))}, M{"$set": updateMap}, false, false)
 				if bol {
 					//绑邮箱送积分
-					credit.InCreditA(usid, credit.A_BYX, IntAll(m.GetSession("credit_a")))
+					if !credit.AIsHasDo(credit.A_BYX, IntAll(m.GetSession("credit_a"))) {
+						credit.UpuserCreditSession(usid, credit.A_BYX, "A", nil, m.Action)
+					}
 					//邮箱绑定认证
 					if contype == "1" {
 						r := *FindById("enterprise", entid, nil)
@@ -961,6 +965,10 @@ func (m *Member) Bindphone() error {
 				}
 				bol := Update("user", M{"_id": ObjectIdHex(m.GetSession("userId").(string))}, M{"$set": updateMap}, false, false)
 				if bol {
+					//绑手机送积分
+					if !credit.AIsHasDo(credit.A_BSJ, IntAll(m.GetSession("credit_a"))) {
+						credit.UpuserCreditSession(m.GetSession("userId").(string), credit.A_BSJ, "A", nil, m.Action)
+					}
 					UpdateCookieSession(m.Action, m.GetSession("loginType").(string), false, *FindById("user", m.GetSession("userId").(string), nil))
 					result = "y"
 				} else {
@@ -1051,8 +1059,6 @@ func (m *Member) Updatephone() error {
 				if bol {
 					result = "y"
 					encryPhone = newPhone
-					//绑定手机送积分
-					credit.InCreditA(ObjToString(m.GetSession("userId")), credit.A_BSJ, IntAll(m.GetSession("credit_a")))
 					UpdateCookieSession(m.Action, m.GetSession("loginType").(string), false, *FindById("user", m.GetSession("userId").(string), nil))
 				} else {
 					result = "n"
@@ -1118,6 +1124,7 @@ func UpdateSession(action *xweb.Action, r map[string]interface{}) {
 			setSessMap["nickName"] = r["s_nickname"]
 		}
 		setSessMap["userId"] = r["_id"]
+		setSessMap["s_m_openid"] = r["s_m_openid"]
 		setSessMap["userType"] = IntAllDef(r["i_type"], 2)
 		setSessMap["userInfo"] = &r
 		setSessMap["userName"] = r["s_name"]
@@ -1128,6 +1135,7 @@ func UpdateSession(action *xweb.Action, r map[string]interface{}) {
 		setSessMap["identWay"] = IntAll(r["i_identificationway"])
 		setSessMap["opLocDistrict"] = r["opLocDistrict"]
 		setSessMap["credit_a"] = IntAll(r["credit_a"])
+		setSessMap["i_credit"] = IntAll(r["i_credit"])
 		if r["s_phone"] == nil || r["s_phone"].(string) == "" {
 			setSessMap["phone"] = ""
 		} else {

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

@@ -7,6 +7,7 @@ import (
 	"github.com/go-xweb/xweb"
 	. "gopkg.in/mgo.v2/bson"
 	util "qfw/util"
+	"qfw/util/credit"
 	. "qfw/util/mongodb"
 	msg "qfw/util/msg"
 	"time"
@@ -71,6 +72,20 @@ func (o *OrderManage) ChangeStatus() error {
 			}
 			m.SaveMsg()
 		}
+		//预约成交送积分
+		if flag && status == 3 {
+			param := make(map[string]interface{})
+			param["objid"] = (*r)["s_editorid"]
+			credit_a := util.IntAll(o.GetSession("credit_a"))
+			userId := util.ObjToString(o.GetSession("userId"))
+			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)
+			}
+		}
+
 	}
 	o.ServeJson(M{"result": result})
 	return nil

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

@@ -232,9 +232,9 @@ func (yp *Yellowpage) Dosave() error {
 		status = "n"
 		info = "保存信息失败"
 	} else { //首次创建企业名片,送积分
-		userId := util.ObjToString(yp.GetSession("userId"))
-		_, credit_a, _ := credit.InCreditA(userId, credit.A_CJMP, util.IntAll(yp.GetSession("credit_a")))
-		yp.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
+		if !credit.AIsHasDo(credit.A_CJMP, util.IntAll(yp.GetSession("credit_a"))) {
+			credit.UpuserCreditSession(util.ObjToString(yp.GetSession("userId")), credit.A_CJMP, "A", nil, yp.Action)
+		}
 	}
 	return yp.Write("{\"info\":\"" + info + "\",\"status\":\"" + status + "\"}")
 }
@@ -430,14 +430,11 @@ func (yp *Yellowpage) AddService() error {
 		tempFlag = len(_id) > 0
 		//发服务送积分
 		if tempFlag {
-			credit_a := util.IntAll(yp.GetSession("credit_a"))
-			if credit.AIsHasDo(credit.A_FFW, credit_a) {
-				//日常任务
-				credit.InCreditB(util.ObjToString(userid), credit.B_FFW)
+			if credit.AIsHasDo(credit.A_FFW, util.IntAll(yp.GetSession("credit_a"))) {
+				credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.B_FFW, "B", nil, yp.Action)
 			} else {
-				//一次性任务
-				credit.InCreditB(util.ObjToString(userid), credit.B_FFW)
-				credit.InCreditA(util.ObjToString(userid), credit.A_FFW, credit_a)
+				credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.A_FFW, "A", nil, yp.Action)
+				credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.B_FFW, "B", nil, yp.Action)
 			}
 		}
 	}

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

@@ -14,6 +14,7 @@ type Mobile struct {
 	share         xweb.Mapper `xweb:"/swordfish/share"`
 	wxrssset      xweb.Mapper `xweb:"/swordfish/page"`
 	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"`
 	advise        xweb.Mapper `xweb:"/mobile/advise"`

+ 86 - 47
core/src/qfw/mobile/wxmenu.go

@@ -47,15 +47,38 @@ func (m *Mobile) Wxrssset() error {
 	if m.Session().Get("userId") != nil {
 		m.T["signature"] = GetSignature(m.Url())
 		userInfo := mongodb.FindById("user", m.GetSession("userId").(string), nil)
-		if i_m_guide := (*userInfo)["i_m_guide"]; util.IntAll(i_m_guide) == 0 {
-			mongodb.Update("user", `{"_id":"`+m.GetSession("userId").(string)+`"}`, map[string]interface{}{
-				"$set": map[string]interface{}{
-					"i_m_guide": 1,
-				},
-			}, false, false)
-			return m.Redirect("/swordfish/guide")
+		if *userInfo != nil {
+			if i_m_guide := (*userInfo)["i_m_guide"]; util.IntAll(i_m_guide) == 0 {
+				mongodb.Update("user", `{"_id":"`+m.GetSession("userId").(string)+`"}`, map[string]interface{}{
+					"$set": map[string]interface{}{
+						"i_m_guide": 1,
+					},
+				}, false, false)
+				return m.Redirect("/swordfish/guide")
+			}
+			if (*userInfo)["o_msgset"] != nil {
+				for _, v := range (*userInfo)["o_msgset"].(map[string]interface{}) {
+					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()
+								if sub >= 0 {
+									if sub%86400 == 0 {
+										vobj["days"] = sub / 86400
+									} else {
+										vobj["days"] = sub/86400 + 1
+									}
+								} else {
+									vobj["days"] = 0
+								}
+							}
+						}
+					}
+				}
+			}
+			m.T["msgset"] = (*userInfo)["o_msgset"]
 		}
-		m.T["msgset"] = (*userInfo)["o_msgset"]
+
 		return m.Render("/swordfish/wxrssset.html", &m.T)
 	} else {
 		return m.Render("_err.html")
@@ -94,69 +117,85 @@ func getMsgSetById(userId string) map[string]interface{} {
 }
 
 //扣分操作
-func (m *Mobile) SwordfishPay() {
+func (m *Mobile) SwordfishPay() error {
 	userId := m.GetSession("userId")
 	res := map[string]interface{}{}
 	if userId != nil {
 		types := m.GetSlice("types")
 		res["flag"] = true
 		if len(types) > 0 {
-			//获取积分
-			user := getMsgSetById(userId.(string))
-			if user == nil {
-				res["flag"] = false
-			} else {
-				i_credit := util.IntAll(user["i_credit"])
-				if i_credit > 0 {
-					isPay := map[string]interface{}{}
-					for _, v := range types {
-						util.Try(func() {
-							obj_typei := user["o_msgset"].(map[string]interface{})[v]
-							b_newopen := false
-							if obj_typei == 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 {
+			no, _ := m.GetInteger("no")
+			if no == 0 {
+				//获取积分
+				user := getMsgSetById(userId.(string))
+				if user == nil {
+					res["flag"] = false
+				} else {
+					i_credit := util.IntAll(user["i_credit"])
+					if i_credit > 0 {
+						isPay := map[string]interface{}{}
+						for _, v := range types {
+							util.Try(func() {
+								obj_typei := user["o_msgset"].(map[string]interface{})[v]
+								b_newopen := false
+								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
+								}
+							}, func(e interface{}) {
+								log.Println(e)
+							})
+						}
+						//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 {
+								//先扣分,然后更新,然后返回结果
+								res["credit"] = i_credit
+								res["oprstatus"] = true
 							}
-							if b_newopen { //进行扣费操作
-								isPay[v] = v
-							}
-						}, func(e interface{}) {
-							log.Println(e)
-						})
-					}
-					i_credit -= len(isPay) * 1000
-					if i_credit >= 0 {
-						if credit.OutCreditB(userId.(string), credit.V_JY, -len(isPay)*1000, isPay) {
-							//先扣分,然后更新,然后返回结果
+						} else {
 							res["credit"] = i_credit
-							res["oprstatus"] = true
 						}
+
 					} else {
 						res["credit"] = i_credit
 					}
+				}
 
-				} else {
-					res["credit"] = i_credit
+			} else if no == 1 {
+				//取消操作
+				set := map[string]interface{}{}
+				for _, v := range types {
+					set["o_msgset."+v+".i_switchstatus"] = 0
+				}
+				if mongodb.Update("user", `{"_id":"`+userId.(string)+`"}`, &map[string]interface{}{
+					"$set": set,
+				}, false, false) {
+					res["oprstatus"] = true
 				}
 			}
 		}
 	} else {
 		res["flag"] = false
 	}
-
+	m.ServeJson(&res)
+	return nil
 }
 
 //剑鱼保存

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

@@ -108,13 +108,10 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
 			if len(userId) > 0 {
 				credit_a := IntAll(n.GetSession("credit_a"))
 				if credit.AIsHasDo(credit.A_QYCX, credit_a) {
-					//日常任务
-					credit.InCreditB(userId, credit.B_QYCX)
+					credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
 				} else {
-					//一次性任务
-					credit.InCreditB(userId, credit.A_QYCX)
-					credit.InCreditA(userId, credit.B_QYCX, credit_a)
-					n.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
+					credit.UpuserCreditSession(userId, credit.A_QYCX, "A", nil, n.Action)
+					credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
 				}
 			}
 		}

+ 4 - 5
core/src/qfw/searchmarket/demand.go

@@ -173,15 +173,14 @@ func (d *Demand) AddDemand() error {
 			}
 			rs := mongo.Save("demand", demandInfo)
 			b := UpdateNewDoc("demand", "demand", mongo.FindById("demand", rs, ""))
+			//发布需求送积分
 			if b {
 				credit_a := util.IntAll(d.GetSession("credit_a"))
 				if credit.AIsHasDo(credit.A_FXQ, credit_a) {
-					//日常任务
-					credit.InCreditB(util.ObjToString(s_userid), credit.B_FXQ)
+					credit.UpuserCreditSession(util.ObjToString(s_userid), credit.B_FXQ, "B", nil, d.Action)
 				} else {
-					//一次性任务
-					credit.InCreditB(util.ObjToString(s_userid), credit.B_FXQ)
-					credit.InCreditA(util.ObjToString(s_userid), credit.A_FXQ, credit_a)
+					credit.UpuserCreditSession(util.ObjToString(s_userid), credit.A_FXQ, "A", nil, d.Action)
+					credit.UpuserCreditSession(util.ObjToString(s_userid), credit.B_FXQ, "B", nil, d.Action)
 				}
 			}
 			if s_userid == nil {

+ 1 - 1
core/src/qfw/searchmarket/marketservice.go

@@ -196,7 +196,7 @@ func searhService(querymap map[string]string, n *Market) (*[]map[string]interfac
             "s_name":{"force_source": true},
 			"s_introduction":{"force_source": true}
         }
-    },"_source":["_id","s_name","s_images","i_comments","i_hits","i_sales","i_bids","s_enterprisename","s_enterpriseid","s_nickname","s_introduction","l_createdate","i_identType","i_comauthenttype"]
+    },"_source":["_id","s_name","s_images","i_comments","i_hits","i_sales","i_status","i_bids","s_enterprisename","s_enterpriseid","s_nickname","s_introduction","l_createdate","i_identType","f_price","i_identtype","i_comauthenttype"]
 	,"from":` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 	"size":` + fmt.Sprintf("%v", perPage) +
 		`,"sort":[` + sort + `] }`

+ 12 - 0
core/src/qfw/searchmarket/service.go

@@ -10,6 +10,7 @@ import (
 	"log"
 	webcentent "qfw/front"
 	"qfw/util"
+	"qfw/util/credit"
 	"qfw/util/image"
 	mongo "qfw/util/mongodb"
 	"strings"
@@ -266,6 +267,17 @@ func (s *Service) Comment() error {
 							mongo.Update("service", `{"_id":"`+s_serviceid+`"}`, M{"$set": M{"i_comments": i_comments, "i_score": i_score}}, false, false)
 							mongo.Update("serviceorder", `{"_id":"`+s_orderid+`"}`, M{"$set": M{"i_status": 4}}, false, false)
 						}
+
+						//评价送积分
+						param := make(map[string]interface{})
+						param["serviceid"] = s_serviceid
+						credit_a := util.IntAll(s.GetSession("credit_a"))
+						if credit.AIsHasDo(credit.A_WCJYPJ, credit_a) {
+							credit.UpuserCreditSession(s_userid, credit.C_PJ, "B", param, s.Action)
+						} else {
+							credit.UpuserCreditSession(s_userid, credit.A_WCJYPJ, "A", nil, s.Action)
+							credit.UpuserCreditSession(s_userid, credit.C_PJ, "B", param, s.Action)
+						}
 						return s.Write("{'success':'true','content':'y'}")
 					} else {
 						content = "保存失败!"

+ 4 - 3
core/src/qfw/swordfish/swordfishmanage.go

@@ -55,10 +55,11 @@ func (s *SwordFish) RsssetAjaxReq() error {
 	if mongodb.Update("user", `{"_id":"`+userId+`"}`, &map[string]interface{}{"$set": map[string]interface{}{"o_msgset": msgset}}, false, false) {
 		flag = "y"
 	}
-	//使用剑鱼送积分
+	//首次使用剑鱼送积分
 	if flag == "y" {
-		_, credit_a, _ := credit.InCreditA(userId, credit.V_JY, util.IntAll(s.GetSession("credit_a")))
-		s.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
+		if credit.AIsHasDo(credit.A_SYJY, util.IntAll(s.GetSession("credit_a"))) {
+			credit.UpuserCreditSession(userId, credit.A_SYJY, "A", nil, s.Action)
+		}
 	}
 	s.ServeJson(map[string]interface{}{
 		"flag": flag,

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":10,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-14 16:37:50"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-14 16:37:50"}},"marketisstart":true,"marketrate":300}
+{"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}

+ 19 - 18
core/src/web/staticres/css/dev-qfw.css

@@ -711,8 +711,9 @@ a{
 }
 
 .a-table tr:first-child>td {
-	background-color: #f7f6f4;
+	background-color: #FBF0F1;
 	line-height: 40px !important;
+	color: #FF5A5F;
 }
 
 .a-table .a-table-operation a{
@@ -1296,18 +1297,18 @@ a{
 }
 
 .a-servicedetail .d_fwfl {
-	padding-left: 5px;
+	background-color: #F6F8FA;
 	height: 40px;
-	border-bottom: 1px solid #CCCCCC;
-	border-top: 1px solid #CCCCCC;
-	background-color: #f7f6f4;
 }
 
-.a-servicedetail .d_fwfl>a {
-	margin-left: -4px;
-	background-color: #f7f6f4;
-	border-radius: 0px;
-	border-right: 1px solid #CCCCCC;
+.a-servicedetail .d_fwfl a {
+	float: left;
+	display: block;
+	border-right: 1px solid #FFF;
+	min-width: 115px;
+	height: 40px;
+	line-height: 40px;
+	text-align: center;
 	font-size: 13px;
 }
 
@@ -1346,10 +1347,11 @@ a{
 }
 
 .a-servicedetail .d_star_f {
-	margin-top: 20px;
+	margin-top: 10px;
 	height: 40px;
-	background-color: #f7f6f4;
+	background-color: #FBF0F1;
 	padding: 10px;
+	margin-left: 4px;
 }
 
 .a-servicedetail .d_star_f input {
@@ -1390,10 +1392,6 @@ a{
 	line-height: 32px;
 }
 
-.a-servicedetail .d_liebiao table {
-	border-bottom: 1px solid #CCCCCC;
-}
-
 .a-servicedetail .d_liebiao tr td:first-child {
 	text-align: center;
 	padding-left: 22px;
@@ -1470,7 +1468,6 @@ style="color:#D03102;margin-right:5px;"
 	color: #555;
 	background-color: #fff;
 	border: 1px solid #ccc;
-	border-radius: 4px;
 }
 
 .a-servicelist .d_group {
@@ -1512,7 +1509,7 @@ style="color:#D03102;margin-right:5px;"
 	height: 45px;
 	padding: 10px 20px;
 	width:112px;
-	font-size: 14px;
+	font-size: 13px;
 	text-align:center;
 
 }
@@ -1677,6 +1674,10 @@ style="color:#D03102;margin-right:5px;"
 	color: #fff;
 	background-color: #DC4715;
 }
+.m-detailintroduction{
+	background:#FFF;
+	padding:15px;
+}
 .f-d.u-overflow img,.m-detailintroduction img{
 	max-width:100%;
 }

BIN
core/src/web/staticres/images/defalut.png


BIN
core/src/web/staticres/images/default.png


BIN
core/src/web/staticres/images/services/default.png


BIN
core/src/web/staticres/images/u20.png


BIN
core/src/web/staticres/images/u252.png


BIN
core/src/web/staticres/images/u288.png


+ 4 - 5
core/src/web/staticres/js/marketlist.js

@@ -1,7 +1,6 @@
 
 var citySim = [{"k":" 11","n":"北京市"},{"k":" 12","n":"天津市"},{"k":" 13","n":"河北省"},{"k":" 14","n":"山西省"},{"k":" 15","n":"内蒙古"},{"k":" 21","n":"辽宁省"},{"k":" 22","n":"吉林省"},{"k":" 23","n":"黑龙江省"},{"k":" 31","n":"上海市"},{"k":" 32","n":"江苏省"},{"k":" 33","n":"浙江省"},{"k":" 34","n":"安徽省"},{"k":" 35","n":"福建省"},{"k":" 36","n":"江西省"},{"k":" 37","n":"山东省"},{"k":" 41","n":"河南省"},{"k":" 42","n":"湖北省"},{"k":" 43","n":"湖南省"},{"k":" 44","n":"广东省"},{"k":" 45","n":"广西"},{"k":" 46","n":"海南省"},{"k":" 50","n":"重庆市"},{"k":" 51","n":"四川省"},{"k":" 52","n":"贵州省"},{"k":" 53","n":"云南省"},{"k":" 54","n":"西藏"},{"k":" 61","n":"陕西省"},{"k":" 62","n":"甘肃省"},{"k":" 63","n":"青海省"},{"k":" 64","n":"宁夏"},{"k":" 65","n":"新疆"},{"k":" 71","n":"台湾省"},{"k":" 81","n":"香港"},{"k":" 82","n":"澳门"}];
 $(function() {
-
   getServiceType();
   //地区下拉框
   if ($chiancity) {
@@ -25,8 +24,7 @@ $(function() {
 	$(".d_tj div").click(function(n){
 			var node=$(n.target);
 			if(!node.hasClass("d_zhpx")){
-				
-				
+				$("form#searchForm").attr("action","/market/"+$("#c_fwtype").val()+"/list.html");
 				searchBeforeSumbit("c_sorttype",node.attr("value"))
 			}
 	})
@@ -45,6 +43,8 @@ $(function() {
 			}
 			if(name=="c_fwtype"){
 				$("form#searchForm").attr("action","/market/"+node.attr("value")+"/list.html");
+			}else{
+				$("form#searchForm").attr("action","/market/"+$("#c_fwtype").val()+"/list.html");
 			}
 			searchBeforeSumbit(name,node.attr("value"));
   });
@@ -180,8 +180,7 @@ function getServiceType(){
 		}
 	}
 	str += "</ul>";
-	$("#fwlb").html(str);
-	
+	$("#fwlb").html(str);	
 }
 
 function less(obj) {

+ 169 - 31
core/src/web/staticres/wxswordfish/main.js

@@ -1,6 +1,5 @@
 //招标公告
 var Tender = {
-	status:false,
 	keyWordDialog: null,
 	getKeyWordDialog: function(clickLi){
 		if(this.keyWordDialog == null){
@@ -18,7 +17,6 @@ var Tender = {
 };
 //中标公告
 var Bid = {
-	status:false,
 	keyWordDialog: null,
 	getKeyWordDialog: function(clickLi){
 		if(this.keyWordDialog == null){
@@ -151,6 +149,158 @@ function getCredit(){
 	})
 	return score
 }
+var snopshot=[];
+function showAlls(){
+	
+	var n=0,str=[],sel=[];
+	for(var i in snopshot){
+		if(snopshot[i]){
+			n++;
+			str.push((i=="tender")?"招标公告":"中标公告")
+			sel.push("types="+i)	
+		}
+	}
+	if(n>0){
+		var num=getCredit();
+		var pay=1000*n, rem=num-pay,strs="扣除后将剩余"+rem+"积分";
+		var contents="您添加了"+n+"个信息栏目("+str.join("、")+"),确认后系统将每月扣除"+pay+"积分,您目前的积分余额是"+num+"积分,";
+		if(rem<0){
+			$("#credit_yes").unbind("click").hide()
+			strs="请充值或去赚积分。";
+		}else{
+			$("#credit_yes").unbind("click").bind("click",function(e){
+				$("#rule-content").text(contents+strs)
+				$(".tip-dialog").show();
+				$("#tip-dialog-back").unbind("click").bind("click",function(e){
+					$("#tip-dialog-back").unbind("click");
+					$.ajax({
+						dataType:"json",
+						url:"/member/credit/swordfishpay",
+						data:sel.join("&"),
+						type:"POST",
+						async:false,
+						success:function(msg){
+							if(msg){
+								if(msg.flag){
+									//有session
+									if(msg.oprstatus){
+										//扣积分操作成功
+										$(".visible").hide()
+									}else{
+										//扣积分操作无效
+										alert("操作无效,请重新进入页剑鱼页面后操作")
+									}				
+								}else{
+									//无session
+									alert("请重新进入页剑鱼页面后操作")
+								}
+							}			
+						},
+						error:function(x,st,err){
+							alert("请稍后再试"+st)
+						}
+					})
+					window.location.reload()
+				})
+				$("html,body").addClass("overflow-hidden");
+			})
+		}
+		$("#credit_no").unbind("click").bind("click",function(e){
+			$.ajax({
+					dataType:"json",
+					url:"/member/credit/swordfishpay",
+					data:sel.join("&")+"&no=1",
+					type:"POST",
+					async:false,
+					success:function(msg){
+						if(msg){
+							if(msg.flag){
+								//有session
+								if(msg.oprstatus){
+									//取消操作成功
+									$(".visible").hide()
+								}else{
+									//取消操作无效
+									alert("操作无效,请重新进入页剑鱼页面后操作")
+								}				
+							}else{
+								//无session
+								alert("请重新进入页剑鱼页面后操作")
+							}
+						}			
+					},
+					error:function(x,st,err){
+						alert("请稍后再试"+st)
+					}
+				})
+				window.location.reload()
+		})
+		$("#txt_tip").text(contents+strs)
+		$(".visible").show()
+	}else{
+		$("#credit_yes").unbind("click")
+		$(".visible").hide()		
+	}
+}
+
+function showSnopshot(module,type,on){
+	//提示扣积分
+	//alert(getCredit())
+	if(type==0){//初始化
+		//是开启状态
+		//显示天数
+		try{
+			var days=eval("msgset."+module+".days")	
+			if(days){
+				var tiptxt="本栏目推送服务期还剩<d style='color:red'>"+days+"</d>天"
+				if(winWidth<341){
+					tiptxt="服务期还剩<d style='color:red'>"+days+"</d>天"
+				}
+			}
+		}catch(e){}
+		if(on){
+			if (!eval("msgset."+module+".i_status")){
+				snopshot[module]=true
+				showAlls()
+			}
+			$("#"+module+" .show-days").html(tiptxt)
+		}else{
+			$("#"+module+" .show-days").html(tiptxt).hide()
+		}
+	}else if(type==1){//提交修改时
+		if(on){
+			if(module=="tender"){
+				if(typeof(msgset.tender) != "undefined"){
+					if(!msgset.tender.i_status){
+						if (!msgset.tender.i_status){
+							snopshot[module]=true
+						}else{
+							snopshot[module]=false
+						}
+					}
+				}else{
+					snopshot[module]=true
+				}
+			}else if(module=="bid"){
+				if(typeof(msgset.bid) != "undefined"){
+					if(!msgset.bid.i_status){
+						if (!msgset.bid.i_status){
+							snopshot[module]=true
+						}else{
+							snopshot[module]=false
+						}
+					}
+				}else{
+					snopshot[module]=true
+				}
+			}
+			showAlls()
+		}else{
+			snopshot[module]=false
+			showAlls()
+		}		
+	}
+}
 
 function commonAjaxReq(object,module){
 	//是关的不用处理
@@ -160,32 +310,12 @@ function commonAjaxReq(object,module){
 	};
 	if($("#"+module+"-on-off").hasClass("open")){
 		//开服务要校验
-		if(module=="tender"){
-			if(!Tender.status){
-				alert(getCredit())
-				//提示扣积分
-				//先取积分,规则然后提示
-				$(".credit-tip").show()
-				//生成快照
-				dataObj[module+"_snopshot"]=true
-			}
-		}else if(module=="bid"){
-			if(!Bid.status){
-				//提示扣积分
-				alert(getCredit())
-				$(".credit-tip").show()
-				//生成快照
-				dataObj[module+"_snopshot"]=true
-			}
-		}
+		showSnopshot(module,1,1)
+		$("#"+module+" .show-days").show()
 	}else{
-		if(module=="tender"){
-			Tender.status=false
-		}else if(module=="bid"){
-			Bid.status=false
-		}
+		showSnopshot(module,1,0)
+		$("#"+module+" .show-days").hide()
 	}
-
 	var keysString = "",scopeString = "";
 	var thisClass = this;
 	this.afterCommit = function(){
@@ -252,7 +382,7 @@ function commonAjaxReq(object,module){
 	if(dataObj[module+"_keys"].length > 0 && dataObj[module+"_scope"] == ""){
 		dataObj[module+"_scope"] = "A";
 	}
-	dataObj[module+"_status"] = $("#"+module+"-on-off").hasClass("open")?1:0
+	dataObj[module+"_switchstatus"] = $("#"+module+"-on-off").hasClass("open")?1:0
 	
 	/*****************************************/
 	$.ajax({
@@ -271,7 +401,9 @@ function commonAjaxReq(object,module){
 		}
 	});
 }
+var winWidth=300;
 $(function(){
+	winWidth=$(window).width();
 	var turnOn = function(obj){
 		obj.addClass("open");
 		var liobj = obj.parents("li");
@@ -318,17 +450,23 @@ $(function(){
 	if(typeof(msgset.tender) != "undefined"){
 		setKeyWord("tender",msgset.tender.a_key);
 		setScope("tender",msgset.tender.s_scope);
-		if(msgset.tender.i_status){
+		if(msgset.tender.i_switchstatus){
 			turnOn($("#tender-on-off"));
-			Tender.status=true
+			//判断要不要还原提示
+			showSnopshot("tender",0,1)
+		}else{
+			showSnopshot("tender",0,0)			
 		}
 	}
 	if(typeof(msgset.bid) != "undefined"){
 		setKeyWord("bid",msgset.bid.a_key);
 		setScope("bid",msgset.bid.s_scope);
-		if(msgset.bid.i_status){
+		if(msgset.bid.i_switchstatus){
 			turnOn($("#bid-on-off"));
-			Bid.status=true
+			//判断要不要还原提示
+			showSnopshot("bid",0,1)
+		}else{
+			showSnopshot("bid",0,0)
 		}
 	}
 	//开关

+ 8 - 1
core/src/web/staticres/wxswordfish/style.css

@@ -545,4 +545,11 @@ img{
 }
 .visible{
 	display:none;
-}
+}
+.show-days{
+	font-size:10px;
+	display:inline-block;
+	margin-left:2px;
+	color:#999;
+}
+	

+ 41 - 15
core/src/web/templates/common/memberleft.html

@@ -66,32 +66,46 @@
 {{$s_role := printf "%v" (index (session "userInfo") "s_role")}}
 <div class="list-group" id="member-left-nav">
 	<a class="list-group-item" id="member-left-headInfo">
-		<div id="member_headImg">
-			{{$s_avatar := printf "%v" (index (session "userInfo") "s_avatar")}}
-			{{if session "headImg"}}
-				<img class="img-circle" src="{{$s_avatar}}" onerror="this.src='{{session "headImg"}}'">
+		<div style="width:185px;text-align:center;">
+			<div id="member_headImg">
+				{{$s_avatar := printf "%v" (index (session "userInfo") "s_avatar")}}
+				{{if session "headImg"}}
+					<img class="img-circle" src="{{$s_avatar}}" onerror="this.src='{{session "headImg"}}'">
+				{{else}}
+					<img class="img-circle" src="{{$s_avatar}}" onerror="this.className='img-circle defaultHeadImg';this.src='/images/image_radius_bg.png'">
+				{{end}}
+			</div>
+			<div><span class="member-loginName cursor-pointer" onclick="window.location.href = '/member/show/memberindex'">{{session "nickName"}}</span></div>
+			<div>
+			{{if session "credit_qd"}}
+				{{if eq (session "credit_qd") "y"}}
+					<button style="width:100px" class="btn" disabled>签到</button>
+				{{else}}
+					<button id="credit_qd" style="width:100px" class="btn btn-primary" onclick="qd()">签到</button>
+				{{end}}	
 			{{else}}
-				<img class="img-circle" src="{{$s_avatar}}" onerror="this.className='img-circle defaultHeadImg';this.src='/images/image_radius_bg.png'">
-			{{end}}
-		</div>
-		<div>
-			<span class="member-loginName text-primary cursor-pointer" onclick="window.location.href = '/member/show/memberindex'">{{session "nickName"}}</span>
-			<div style="margin-top: 10px;" class="identType text-muted font-size-12">
+				<button id="credit_qd" style="width:100px" class="btn btn-primary" onclick="qd()">签到</button>
+			{{end}}	
+			</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}}
-						<span class="glyphicon qyrz   margin-l-10 " style="color:#FF5A5F;top:4px;"></span>已认证企业
+						<i class="glyphicon qyrz" style="color:#FF5A5F;top:4px;"></i>已认证企业
 						{{end}}
 					{{else if eq 2 $identType}}
 						{{if eq 1 $identWay}}
-						<span class="glyphicon grrz   margin-l-10 " style="color:#FF5A5F;top:4px;"></span>已认证个人
+						<i class="glyphicon grrz" style="color:#FF5A5F;top:4px;"></i>已认证个人
 						{{end}}
 					{{else if eq 3 $identType}}
 						{{if eq 1 $identWay}}
-						<span class="glyphicon jgrz   margin-l-10" style="color:#FF5A5F;top:4px;"></span>已认证机构
+						<i class="glyphicon jgrz" style="color:#FF5A5F;top:4px;"></i>已认证机构
 						{{end}}
 					{{end}}
+				{{else}}
+					<i class="glyphicon grrz" style="top:4px;"></i>未认证
 				{{end}}
 			</div>
 		</div>
@@ -200,7 +214,7 @@ var MemberLeftMenu = {
 	},
 	//vip会有菜单
 	vipMenu: function(){
-		return '<a class="list-group-item" id="vipMenu"><i class="glyphicon zhanghao"></i>会员中心<i class="a-com-collapse2 bootstrap-glyphicon glyphicon glyphicon-menu-down"></i></a>';
+		return '<a class="list-group-item" id="vipMenu"><i class="glyphicon jinbi"></i>会员中心<i class="a-com-collapse2 bootstrap-glyphicon glyphicon glyphicon-menu-down"></i></a>';
 	},
 	//我的积分
 	myCredit: function(){
@@ -214,6 +228,12 @@ var MemberLeftMenu = {
 $(function (){
 	//初始化菜单
 	MemberLeftMenu.init();
+	$.post("/member/credit/sessionQdAjx",{},function(r){
+		if(r&&r.result=="y"){
+			$("#credit_qd").attr("disabled","disabled");
+			$("#credit_qd").removeClass("btn-primary");
+		}
+	});
 });
 function openSChat() {
 	try {
@@ -221,5 +241,11 @@ function openSChat() {
 		window.open(url, "Topchat", "toolbar=0,scrollbars=0,location=0,menubar=0,resizable=1,width=920,height=620");
 	} catch (e) {}
 }
-
+function qd(){
+	$.post("/member/credit/inCreditAjx",{"param":"qd"},function(r){
+		if (r.result=="y"){
+			window.location.reload()
+		}
+	});
+}
 </script>

+ 29 - 0
core/src/web/templates/member/credit/creditrule.html

@@ -0,0 +1,29 @@
+<html>
+<head>
+<title>积分规则</title>
+{{include "/common/inc.html"}}
+<style>
+ 
+</style>
+</head>
+<body>
+{{$identType := session "identType"}}
+<!-- 头部 -->
+{{include "/common/head.html"}}
+<!-- 中间 -->
+<div class="a-content member-content">
+	<div class="member-left">
+		{{include "/common/memberleft.html"}}
+	</div>
+	<div class="member-right">
+		积分规则...
+	</div>
+</div>
+ 
+<!-- 底部 -->
+{{include "/common/bottom.html"}}
+<script type="text/javascript">
+ 
+</script>
+</body>
+</html>

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

@@ -2,7 +2,7 @@
 <head>
 <title>我的积分</title>
 {{include "/common/inc.html"}}
-<script src="/js/qfwtable.js"></script>
+<script charset="utf-8" src="/js/paging.js"></script>
 <style>
 .credit-explain {
     background-color: #FCF8E3;
@@ -74,6 +74,7 @@
 				<div class="tab-content" id="list_0">
 					<div class="credit-explain">当前积分 <span style="font-size:22;color:red">{{$.T.user.i_credit}}</span><span class="mx" onclick="outoClick('c_1')">查看积分明细</span></div>
 					<div class="credit">
+						<div id="csrw">
 						<div class="btzrw">
 							<div class="btzrw-z">做任务赚积分</div>
 							<div class="btzrw-ms">(完成全部带 * 号的任务,可以额外获得1001积分哦)</div>
@@ -91,7 +92,7 @@
 							</tr>
 							<tr class="rowtwo">
 								<td width="60%" style="text-indent: 7em;">* 完成实名认证,得100积分</td>
-								{{if eq .T.A_RZ true}}
+								{{if or .T.AAll .T.A_RZ}}
 								<td width="10%" align="center">
 								<span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
@@ -104,7 +105,7 @@
 							</tr>
 							<tr class="rowone">
 								<td width="60%" style="text-indent: 7em;">* 绑定邮箱,得50积分</td>
-								{{if .T.A_BYX}}
+								{{if or .T.AAll .T.A_BYX}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -117,7 +118,7 @@
 							</tr>
 							<tr class="rowtwo">
 								<td width="60%" style="text-indent: 7em;">* 绑定手机,得50积分</td>
-								{{if .T.A_BSJ}}
+								{{if or .T.AAll .T.A_BSJ}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -127,7 +128,7 @@
 							</tr>
 							<tr class="rowone">
 								<td width="60%" style="text-indent: 7em;">* 完善你的企业黄页,得50积分(实名认证后才可使用)</td>
-								{{if .T.A_CJMP}}
+								{{if or .T.AAll .T.A_CJMP}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -137,7 +138,7 @@
 							</tr>
 							<tr class="rowtwo">
 								<td width="60%" style="text-indent: 7em;">* 完成一次企业查询,得50积分</td>
-								{{if .T.A_QYCX}}
+								{{if or .T.AAll .T.A_QYCX}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -147,7 +148,7 @@
 							</tr>
 							<tr class="rowone">
 								<td width="60%" style="text-indent: 7em;">* 发布一条服务信息,得50积分(实名认证后才可使用)</td>
-								{{if .T.A_FFW}}
+								{{if or .T.AAll .T.A_FFW}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -157,7 +158,7 @@
 							</tr>
 							<tr class="rowtwo">
 								<td width="60%" style="text-indent: 7em;">*  发布一条需求信息,得50积分</td>
-								{{if .T.A_FXQ}}
+								{{if or .T.AAll .T.A_FXQ}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -167,7 +168,7 @@
 							</tr>
 							<tr class="rowone">
 								<td width="60%" style="text-indent: 7em;">* 去剑鱼订阅一组关键词,得50积分</td>
-								{{if .T.A_SYJY}}
+								{{if or .T.AAll .T.A_SYJY}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -177,7 +178,7 @@
 							</tr>
 							<tr class="rowtwo">
 								<td width="60%" style="text-indent: 7em;">* 查看神奇的关系网,得50积分(实名认证后才可查看)</td>
-								{{if .T.A_CKGXW}}
+								{{if or .T.AAll .T.A_CKGXW}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -187,7 +188,7 @@
 							</tr>
 							<tr class="rowone">
 								<td width="60%" style="text-indent: 7em;">* 分享一条服务/需求信息,得50积分</td>
-								{{if .T.A_FXFWXQ}}
+								{{if or .T.AAll .T.A_FXFWXQ}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -197,7 +198,7 @@
 							</tr>
 							<tr class="rowtwo">
 								<td width="60%" style="text-indent: 7em;">* 完成一次交易,得100积分</td>
-								{{if .T.A_WCJY}}
+								{{if or .T.AAll .T.A_WCJY}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -207,7 +208,7 @@
 							</tr>
 							<tr class="rowone">
 								<td width="60%" style="text-indent: 7em;">* 完成一次交易评价,得80积分</td>
-								{{if .T.A_WCJYPJ}}
+								{{if or .T.AAll .T.A_WCJYPJ}}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 								{{else}}
@@ -216,6 +217,8 @@
 								{{end}}
 							</tr>
 						</table>
+						</div>
+						<div id="rcrw">
 						<div class="btzrw">
 							<div class="btzrw-z">日常任务</div>
 							<div class="btzrw-ms"></div>
@@ -280,29 +283,72 @@
 								<td width="10%" align="center"></td>
 								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">邀请</span></td>
 							</tr>
-							</table>
+						</table>
+						</div>
 						</div>
 					</div>
 				</div>
 				<div class="tab-content hide" id="list_1">
-					<div class="tab-pane" >
-						 222
+					<div class="creditinfo">
+						<table class="table a-table" id="credittable">
+							<tr id="tableTitle" style="text-align:center;">
+								<td width="10%"><b>编号</b></td>
+								<td width="25%" align="center"><b>日期</b></td>
+								<td width="35%" align="center"><b>操作</b></td>
+								<td width="15%" align="center"><b>积分</b></td>
+								<td width="15%" align="center"><b>账户余额</b></td>
+							</tr>
+							<tr>
+								<td colspan="5" class="text-center" id="creditPaging"></td>
+							</tr>
+						</table>
 					</div>
 				</div>
 			</div>	
 		</div>
 	</div>
 </div>
- 
 <!-- 底部 -->
 {{include "/common/bottom.html"}}
+
 <script type="text/javascript">
 $(function(){
 	$("#c_0,#c_1").click(function(){
 		var _v=$(this).attr("value")
 		checkContent("list_"+_v)
 	})
+	var AAll="{{.T.AAll}}"//一次性任务完成,位置切换
+	if (AAll==true){
+		rcrw=$("#rcrw").html();
+		csrw=$("#csrw").html();
+		$("#rcrw").html(csrw);
+		$("#csrw").html(rcrw);
+	}
 })
+
+var pag;
+$(function(){
+	pag=new Paging("creditPaging","/member/credit/creditList",null,10,function(r){
+		var html = '';
+		var classattr="rowone";
+		for(var i in r){
+			if((r[i].index%2)>0){
+				classattr="rowone"
+			}else{
+				classattr="rowtwo"
+			}
+			html += '<tr class="'+classattr+'" data-id="'+r[i]._id+'" class="a-border-b">'
+					+'<td width="10%" align="center">'+r[i].index+'</td>'
+					+'<td width="25%" align="center">'+r[i].l_date+'</td>'
+					+'<td width="35%" align="center">'+r[i].s_operation+'</td>'
+					+'<td width="15%" align="center">'+r[i].i_score+'</td>'
+					+'<td width="15%" align="center">'+r[i].i_scorenow+'</td>';
+		}
+		$("#credittable #tableTitle").nextAll("[data-id]").remove();
+		$("#credittable #tableTitle").after(html);
+	});
+});
+
 function checkContent(id){
 	$(".tab-content").each(function(){
 	    if($(this).attr("id")!=id){

+ 16 - 17
core/src/web/templates/service/detail.html

@@ -27,8 +27,9 @@
 	.text-muted a{
 		color: #aea79f;
 	}
-	.text-primary{
-		color:#FF5A5F;
+	.a-servicedetail .btnactive{
+		border-top:3px solid #FF5A5F;
+		line-height: 30px !important;
 	}
 	</style>
 <link href="/css/index-new.css" rel="stylesheet">
@@ -150,9 +151,9 @@
 		<div class="d_fwfl" >
 			
 			{{if eq .T.isComment 0}}	
-			<a type="button" class="btn text-muted btnactive" >服务详情</a>
-			<a type="button" class="btn text-muted">服务评价({{.T.sinfo.i_comments}})</a>
-			<a type="button" class="btn text-muted">预约记录({{.T.appcount}})</a>
+			<a type="button" class="text-muted btnactive" style="margin-left:18px;border-left:1px solid #FFF;">服务详情</a>
+			<a type="button" class="text-muted">服务评价({{.T.sinfo.i_comments}})</a>
+			<a type="button" class="text-muted">预约记录({{.T.appcount}})</a>
 			{{end}}
 			
 			{{if .T.status }}
@@ -169,23 +170,21 @@
 		
 		{{if eq .T.isComment 0}}	
 		<!--添加详情-->
-		<div class="margin-15 m-detailintroduction">
+		<div class="m-detailintroduction" style="padding:30px 100px 30px 100px;">
 		{{.T.sinfo.s_introduction}}
 		
 		
 		</div>
 		
 		<!--服务评价-->
-		<div class="margin-15 hide">
-			 <div>
-			 <span>综合评分:<div class="gray-star1">
-			 <div class="green-star1" style="width:{{.T.style}}%"></div>
-			 </div>
-			 <div  class="d_service_app1">
-			 <span  class="margin-lr-15" >{{.T.fscore}} 分 </span>
-			 <span  >共 {{.T.sinfo.i_comments}}条评价 </span>
+		<div class="m-detailintroduction hide">
+			<div style="margin-left:40px;">
+				<span class="text-muted">综合评分:<div class="gray-star1">
+				<div class="green-star1" style="width:{{.T.style}}%"></div>
+			</div>
+		 	<div  class="d_service_app1">
+				 <span  class="margin-lr-15" >{{.T.fscore}} 分 </span>
 			 </div>
-		 
 		 </div>
 		 <div class="d_star_f radio">
 		  <label class="rad">
@@ -209,7 +208,7 @@
 		{{end}}
 		</div>
 		<!--预约记录-->
-		<div class="margin-15 hide">
+		<div class="m-detailintroduction hide">
 			<div class="d_liebiao">
 				<table class="table a-table"  id="appRecord">
 				     <tr style="height:30px;"  id="tableTitle">
@@ -296,7 +295,7 @@
 compulsoryreRresh = true;
 $(function(){
 	
-	$(".d_fwfl a").eq(0).addClass(".d_fwfl")
+	$(".d_fwfl a").eq(0).addClass("d_fwfl")
 	$(".m-comment li").mouseover(function(a,b,c){
 			var node=$(a.currentTarget);
 			$("#i_score").val(node.index()+1);

+ 61 - 13
core/src/web/templates/service/list.html

@@ -81,7 +81,7 @@
 					<div class="d_style_hylb text-muted less u-key" style="width:80%;" id="fwlb"></div>
 					<div class="d_more qfw-text-more" onClick="less(this)"><small  style="cursor:hand">更多></small></div>	
 				</div>
-				<div class="f_zw">
+				<div class="f_zw ">
 					
 				</div>
 				<div class="list-new-row">
@@ -134,19 +134,51 @@
 						</div></a>
 					{{end}}
 				</div>
-				<div class="col-sm-6 col-xs-8">		
-				<div class="title">
+				<div class="col-sm-4 col-xs-8">		
+				<div class="title" style="height:40px;" >
 					{{if eq "demand" $.T.querymap.c_searchtype}}
-						<a target="_blank" href="/market/demandview/{{$v._id}}.html">{{$v.s_name}}</a>
+						<a target="_blank" style="float: left;max-width: 230px;display: inline-block;word-break: break-all;" href="/market/demandview/{{$v._id}}.html">{{$v.s_name}}</a>
 					{{else}}
-						<a target="_blank" href="/market/detail/{{$v._id}}.html">{{$v.s_name}}</a>	
+						<a target="_blank" style="float: left;max-width: 230px;display: inline-block;word-break: break-all;" href="/market/detail/{{$v._id}}.html">{{$v.s_name}}</a>	
+					{{end}}
+					{{if eq "demand" $.T.querymap.c_searchtype}}
+					
+					<div class="col-sm-2 col-xs-4" style="margin-left:10px;">
+					{{if eq $v.i_status 1.0 }}
+						<img src="/images/u288.png" />
+					{{else}}
+						{{if eq $v.i_status 2.0}}
+						<img src="/images/u252.png" />
+						{{end}}
+					{{end}}
+					</div>
+					
 					{{end}}
 				</div>
-				<div style="padding-top:10px;padding-bottom:10px;">
-					<span class="d_service_span text-muted">{{if $v.s_enterprisename}}<a style="color:#aea79f;" href="/enterprise/{{$v.s_enterpriseid}}.html" target="_blank">{{$v.s_enterprisename}}</a>{{else}}{{$v.s_nickname}}{{end}}</span>
-				</div>
-					<div class="col-xs-12" style="margin-left:-9px;">
-					{{if $v.s_enterprisename}} 
+				<div class="col-xs-12" style="margin-top:2px;margin-left:-9px;{{if $v.s_enterprisename}} margin-bottom:5px;{{else}}margin-bottom:25px;{{end}}">
+				{{if $v.s_enterprisename}} 
+					{{if eq "demand" $.T.querymap.c_searchtype}}
+						{{ if $v.i_identtype }}
+							{{ if eq $v.i_identtype 1.0}}
+								<span class="glyphicon qyrz   margin-l-10 jhtb"></span><span class="lineb " ><small style="margin-left:5px;margin-right:5px;">已认证企业 </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>					
+										{{else if eq $v.i_comauthenttype "1"}}
+											<span class="glyphicon yyzzrz   margin-r-10 jhtbtype"></span><span class="lineb " ><small style="margin-left:3px;margin-right:5px;">营业执照认证</small></span>
+										{{else if eq $v.i_comauthenttype "3"}}
+											<span class="glyphicon yjrz   margin-r-10 jhtbtype"></span><span class="lineb " ><small style="margin-right:5px;">年报邮箱认证</small></span>
+										{{end}}
+								{{else}}
+										<span class="glyphicon yyzzrz   margin-r-10 jhtbtype"></span><span class="lineb " ><small style="margin-left:3px;margin-right:5px;">营业执照认证</small></span>
+								{{end}}
+							{{else if eq $v.i_identtype 2.0}}
+								<span class="glyphicon grrz   margin-l-10 jhtb"></span><span class="lineb " ><small style="margin-left:-5px;margin-right:5px;"> 已认证个人</small></span>
+							{{else if eq $v.i_identtype 3.0}}
+								<span class="glyphicon jgrz   margin-l-10 jhtb"></span><span class="lineb " ><small style="margin-left:5px;margin-right:5px;">已认证机构</small></span>
+							{{end}}
+						{{end}}
+					{{else}}
 						{{ if $v.i_identType }}
 							{{ if eq $v.i_identType "1"}}
 								<span class="glyphicon qyrz   margin-l-10 jhtb"></span><span class="lineb " ><small style="margin-left:5px;margin-right:5px;">已认证企业 </small></span>
@@ -168,18 +200,26 @@
 							{{end}}
 						{{end}}
 					{{end}}
+				{{end}}
+				</div>
+					<div style="padding-top:10px;padding-bottom:10px;">
+						<span class="d_service_span text-muted" style="margin-top:10px;">{{if $v.s_enterprisename}}<a style="color:#aea79f;" href="/enterprise/{{$v.s_enterpriseid}}.html" target="_blank">{{$v.s_enterprisename}}</a>{{else}}{{$v.s_nickname}}{{end}}</span>
 					</div>
 				</div>
+				
 				{{if eq "service" $.T.querymap.c_searchtype}}
-				<div class="col-sm-4 col-xs-4 text-center hidden-xs" style="margin-top:10px;padding-right:0px;margin-left:30px;">
+				<div class="col-sm-2 col-xs-4" style="margin-top: 5px;">
+					价格:<span class="text-primary text-bold">5000</span>元
+				</div>
+				<div class="col-sm-4 col-xs-4 text-center hidden-xs" style="margin-top:5px;padding-right:0px;margin-left:30px;">
 					<div class="col-sm-8 " style="float:right;text-align:right;">
 						<div style="float:right;"><span class="d_col_span" style="font-size:14px;">成交量:<span style="color:#FF5A5F;font-weight:600;">{{$v.i_sales}}</span></span></div>
 						<div style="float:right;" ><span class="d_col_span" style="font-size:14px;">评价数:<span style="color:#FF5A5F;font-weight:600;">{{$v.i_comments}}</span></span>&nbsp;&nbsp;|&nbsp;&nbsp;</div>
 					</div>
 				</div>
 				{{else}}
-				<div class="col-sm-4 col-xs-4 text-center">
-					<div><span class="d_col_span">报价服务商:{{$v.i_bids}}</span></div>
+				<div class="col-sm-4 col-xs-4" style="margin-left:10px;float: right;">
+					<div style="width: 130px;float: right;">预算:<span class="d_col_span text-primary text-bold f-price" style="font-size:13px;">{{$v.f_price}}</span></div>
 				</div>
 				{{end}}
 			</div>
@@ -262,6 +302,14 @@
 			$(".a-c-right.hidden-xs").hide();
 			$(".list-new-list").css("max-width","1200px");
 		}
+		$(".f-price").each(function(i,n){
+			var text=$(n).text();
+			if(text=="0"){
+				$(n).text("面议");
+			}else{
+				$(n).text(parseFloat(text)+"元");
+			}
+		});
 	});
 </script>
 </body>

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

@@ -10,15 +10,13 @@
 <script src="/wxswordfish/share.js"></script>
 <script>
 	var msgset= {{.T.msgset}};
-	var snopshot_tender= "{{.T.snopshot_tender}}";
-	var snopshot_bid= "{{.T.snopshot_bid}}";
 </script>
 <script src="/wxswordfish/main.js"></script>
 </head>
 <body>
 <div class="credit-tip visible">
 	<div class="tip">
-		<div>您添加了1个信息栏目(招标公告),确认后系统将每月扣除1000积分,您目前的积分余额是1500积分,扣除后将剩余500积分。</div>
+		<div id="txt_tip"></div>
 		<div class="tip-button">
 		<span id="credit_yes">提交</span>
 		<span id="credit_no">取消</span>
@@ -27,9 +25,10 @@
 	</div>
 </div>
 	<ul class="operation">
-		<li class="parent-node">
+		<li class="parent-node" id="tender">
 			<img src="/wxswordfish/images/zhaobiao.png">
 			招标公告
+			<day class="show-days"></day>
 			<span class="on-off" id="tender-on-off" v="tender"></span>
 		</li>
 		<li class="child-node">
@@ -42,9 +41,10 @@
 				</li>
 			</ul>
 		</li>
-		<li class="parent-node">
+		<li class="parent-node" id="bid">
 			<img src="/wxswordfish/images/zhongbiao.png">
 			中标公告
+			<day class="show-days"></day>
 			<span class="on-off" id="bid-on-off" v="bid"></span>
 		</li>
 		<li class="child-node">

+ 14 - 0
core/src/web/templates/swordfish/wxtoolbar.html

@@ -41,6 +41,20 @@
 	</div>
 </div>
 
+<div class="dialog tip-dialog">
+	<div class="dialog-main">
+		<div class="dialog-head">
+			<div>提示信息</div>
+			<div><span id="tip-dialog-back" style="cursor:pointer">确定</span></div>
+		</div>
+		<div class="dialog-content" style="height:115px;">
+			<div id="rule-content">
+				
+			</div>
+		</div>
+	</div>
+</div>
+
 
 <!--意见反馈-->
 <div class="dialog feedback-dialog">

+ 2 - 0
credit/src/config.json

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

+ 16 - 18
credit/src/main.go

@@ -16,9 +16,8 @@ import (
 	"qfw/timewheel"
 	"qfw/util"
 	"qfw/util/mongodb"
-	"qfw/util/msg"
 	"qfw/util/redis"
-	qrpc "qfw/util/rpc"
+	"runtime"
 	"strconv"
 	"strings"
 	"time"
@@ -61,6 +60,7 @@ func init() {
 	swordfish_close = creditrpc.Message["swordfish_close"]
 	swordfish_payTitle = creditrpc.Message["swordfish_payTitle"]
 	swordfish_pay = creditrpc.Message["swordfish_pay"]
+	creditrpc.Hour = swordfish_subHour
 
 	creditlog.Smtp = SysConfig["smtp"].(map[string]interface{})
 
@@ -80,6 +80,17 @@ func main() {
 }
 
 func quartz() {
+	defer func() {
+		if r := recover(); r != nil {
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	//定时保存日志
 	go func() {
 		for {
@@ -170,7 +181,7 @@ func TimerSwordFish() {
 							//提示
 							for _, v := range swordfish_tipBeforeDays {
 								if int64(v) == sub64 {
-									SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), tmp["s_uid"].(string), tmp["s_umid"].(string))
+									creditrpc.SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), tmp["s_uid"].(string), tmp["s_umid"].(string))
 								}
 							}
 						}
@@ -219,14 +230,14 @@ func doSubCredit(userId, umid, typeName, code string, next *time.Time) {
 
 						if creditlog.Save(creditDoc) {
 							//发送微信通知扣积分成功
-							SendMsgWebAndWx(swordfish_payTitle, fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, umid)
+							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) {
 							//暂停通知,因积分不够
-							SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, umid)
+							creditrpc.SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, umid)
 						}
 
 					}
@@ -238,16 +249,3 @@ func doSubCredit(userId, umid, typeName, code string, next *time.Time) {
 
 	}
 }
-
-//发送微信和站内信通知
-func SendMsgWebAndWx(title, content, userId, umid string) {
-	m := &msg.Msg{
-		Msgtype:   1,
-		Title:     title,
-		Content:   content,
-		ReceiveId: userId,
-	}
-	go m.SaveMsg()
-	go creditrpc.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "管理员", Remark: content})
-
-}

+ 8 - 4
credit/src/qfw/creditlog/creditlog.go

@@ -46,10 +46,14 @@ func Save(doc map[string]interface{}) bool {
 				"$inc": map[string]int{
 					"i_credit": doc["i_score"].(int),
 				},
-				"$set": map[string]interface{}{
-					"o_msgset." + doc["s_type"].(string) + ".l_enddate": doc["l_enddate"],
-					"o_msgset." + doc["s_type"].(string) + ".i_status":  1,
-				},
+				"$set": func() map[string]interface{} {
+					tmp := map[string]interface{}{}
+					for _, ty := range strings.Split(doc["s_type"].(string), ",") {
+						tmp["o_msgset."+ty+".l_enddate"] = doc["l_enddate"]
+						tmp["o_msgset."+ty+".i_status"] = 1
+					}
+					return tmp
+				}(),
 			}, false, false)
 		} else {
 			b = mongodb.Update("user", `{"_id":"`+doc["s_uid"].(string)+`"}`, &map[string]interface{}{

+ 117 - 31
credit/src/qfw/creditrpc/creditrpc.go

@@ -7,8 +7,12 @@ import (
 	"qfw/consts"
 	"qfw/creditlog"
 	"qfw/util"
+	"qfw/util/mongodb"
+	"qfw/util/msg"
 	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
+	"runtime"
+	"strings"
 	"sync"
 	"time"
 )
@@ -18,6 +22,7 @@ type CreditRpc struct{}
 var Message map[string]string
 var Score map[string]int
 var Rpcserver string
+var Hour int
 
 //用户访问redis加锁
 var SN = 100
@@ -34,8 +39,27 @@ func GetMutex(uid string) *sync.Mutex {
 	return SLM[util.HashCode(uid)%SN]
 }
 
+func getCreditById(userId string) int {
+	user := mongodb.FindById("user", userId, `{"_id":0,"i_credit":1}`)
+	if *user != nil {
+		return util.IntAll((*user)["i_credit"])
+	}
+	return 0
+}
+
 //增加积分
 func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
+	defer func() {
+		if r := recover(); r != nil {
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	//a类为即时保存
 	//b、c、d、e为定时保存
 	log.Println("---请求", param)
@@ -44,21 +68,25 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 		first := param.Code[:1]
 		//num := Score[param.code]
 		creditDoc := map[string]interface{}{
-			"s_uid":  param.Uid,
-			"s_code": param.Code,
-			"i_type": 1,
-			"l_date": time.Now().Unix(),
+			"s_uid":       param.Uid,
+			"s_code":      param.Code,
+			"s_operation": Message["txt_"+param.Code],
+			"i_type":      1,
+			"l_date":      time.Now().Unix(),
 		}
+		i_scorenow := getCreditById(param.Uid)
 		switch first {
 		case "a": //立即生效
 			creditDoc["i_score"] = Score[param.Code]
+			creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
 			if creditlog.Save(creditDoc) {
-				*replay = 1
+				*replay = creditDoc["i_score"].(int)
 			}
 		case "d", "e":
 			creditDoc["i_score"] = util.If(param.Num > 0, param.Num, Score[param.Code]).(int)
+			creditDoc["i_scorenow"] = i_scorenow + util.If(param.Num > 0, param.Num, Score[param.Code]).(int)
 			if creditlog.Save(creditDoc) {
-				*replay = 1
+				*replay = creditDoc["i_score"].(int)
 			}
 		case "b":
 			key := param.Code + "_" + param.Uid
@@ -83,10 +111,11 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 							thist := newobj[1]
 							newobj[1] = thist + 1
 							creditDoc["i_score"] = Score[param.Code+"_1"] + int(thist)*Score[param.Code]
+							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 = 1
+							*replay = creditDoc["i_score"].(int)
 						} else {
 							//不是连续签到
 							bcon = false
@@ -101,10 +130,11 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 						newobj[1] = 1
 						newobj[2] = int64(Score[param.Code+"_n"])
 						creditDoc["i_score"] = Score[param.Code+"_1"]
+						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 = 1
+						*replay = creditDoc["i_score"].(int)
 					}
 				}
 			} else {
@@ -118,8 +148,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 = 1
+						*replay = creditDoc["i_score"].(int)
 					}
 				} else {
 					times := Score[param.Code+"_n"]
@@ -129,9 +160,10 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 						newobj[0] = 1
 					}
 					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 = 1
+					*replay = creditDoc["i_score"].(int)
 				}
 			}
 			lock.Unlock()
@@ -145,19 +177,22 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 					key := param.Code + "_" + param.Uid + "_" + objid.(string)
 					if redis.Get(consts.RedisDB, key) == nil {
 						creditDoc["i_score"] = Score[param.Code]
+						creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
 						creditDoc["s_objid"] = objid.(string)
 						newDoc := map[string]interface{}{
-							"s_uid":      objid.(string),
-							"s_code":     param.Code,
-							"i_type":     1,
-							"s_sourceid": param.Uid,
-							"l_date":     time.Now().Unix(),
-							"i_score":    Score[param.Code],
+							"s_uid":       objid.(string),
+							"s_code":      param.Code,
+							"s_operation": Message["txt_"+param.Code],
+							"i_type":      1,
+							"s_sourceid":  param.Uid,
+							"l_date":      time.Now().Unix(),
+							"i_score":     Score[param.Code],
+							"i_scorenow":  i_scorenow + Score[param.Code],
 						}
 						creditlog.AddLog(creditDoc)
 						creditlog.AddLog(newDoc)
 						redis.Put(consts.RedisDB, key, true, GetSubSecond(1))
-						*replay = 1
+						*replay = creditDoc["i_score"].(int)
 					}
 				}
 			} else if param.Code == "c2" { //评价
@@ -166,25 +201,28 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 					key := param.Code + "_" + param.Uid + "_" + objid.(string)
 					if redis.Get(consts.RedisDB, key) == nil {
 						creditDoc["i_score"] = Score[param.Code]
+						creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]
 						creditDoc["o_param"] = param.OtherParam
 						creditlog.AddLog(creditDoc)
 						redis.Put(consts.RedisDB, key, true, GetSubSecond(1))
-						*replay = 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 = 1
+				*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 = 1
+				*replay = creditDoc["i_score"].(int)
 			}
 		}
 	}
@@ -193,50 +231,93 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 
 //消费积分,增加扣费方式、手动还是自动
 func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
+	defer func() {
+		if r := recover(); r != nil {
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	*replay = 0
 	lock := GetMutex(param.Uid)
 	lock.Lock()
 	if len(param.Code) > 1 && Message[("txt_"+param.Code)] != "" {
+		i_scorenow := getCreditById(param.Uid)
 		first := param.Code[:1]
 		now := time.Now()
 		creditDoc := map[string]interface{}{
-			"s_uid":   param.Uid,
-			"s_umid":  param.Umid,
-			"s_code":  param.Code,
-			"i_type":  0,
-			"l_date":  now.Unix(),
-			"i_score": param.Num,
+			"s_uid":       param.Uid,
+			"s_umid":      param.Umid,
+			"s_code":      param.Code,
+			"s_operation": Message["txt_"+param.Code],
+			"i_type":      0,
+			"l_date":      now.Unix(),
 		}
 		if param.OtherParam != nil && param.OtherParam["i_way"] != nil {
 			creditDoc["i_way"] = param.OtherParam["i_way"]
 		}
+		var newDate time.Time
 		switch first {
 		case "A":
-			creditDoc["l_enddate"] = now.AddDate(0, 1, 0).Unix()
+			newDate = GetTimeByNow(now, Hour).AddDate(0, 1, 1)
+			creditDoc["l_enddate"] = newDate.Unix()
 			creditDoc["i_valid"] = 1
 			if param.OtherParam != nil {
-				creditDoc["s_type"] = param.OtherParam["s_type"]
+				str := []string{}
+				for k, _ := range param.OtherParam {
+					str = append(str, k)
+				}
+				creditDoc["s_type"] = strings.Join(str, ",")
+				creditDoc["i_score"] = Score[param.Code] * len(str)
+				creditDoc["i_scorenow"] = i_scorenow + Score[param.Code]*len(str)
 			}
 		case "B":
+			creditDoc["i_score"] = param.Num
+			creditDoc["i_scorenow"] = i_scorenow + param.Num
 			creditDoc["i_givestatus"] = 0
 		}
 		if creditlog.Save(creditDoc) {
 			*replay = 1
 			//发送微信通知扣积分成功
-			go SendWeixin(param.Num, param.Umid, "")
+			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)
+			}
 		}
 	}
 	lock.Unlock()
 	return nil
 }
 
-//发送微信积分变动通知
-func SendWeixin(num int, uid, info string) {
+//发送微信和站内信通知
+func SendMsgWebAndWx(title, content, userId, umid string) {
+	m := &msg.Msg{
+		Msgtype:   1,
+		Title:     title,
+		Content:   content,
+		ReceiveId: userId,
+	}
+	go m.SaveMsg()
+	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "管理员", Remark: content})
 
 }
 
 //微信远程调用,实现模板发送消息
 func SendManagerNotifyMsg(p *qrpc.NotifyMsg) {
+	defer func() {
+		if r := recover(); r != nil {
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	client, err := rpc.DialHTTP("tcp", Rpcserver)
 	if err != nil {
 		log.Println(err.Error())
@@ -255,3 +336,8 @@ func GetSubSecond(n int) int {
 	tom := time.Date(now.Year(), now.Month(), now.Day()+n, 0, 0, 0, 0, time.Local)
 	return int(tom.Unix() - now.Unix())
 }
+
+func GetTimeByNow(now time.Time, nhour int) time.Time {
+	tom := time.Date(now.Year(), now.Month(), now.Day(), nhour, 0, 0, 0, time.Local)
+	return tom
+}