浏览代码

一次性积分

zhangjinkun@topnet.net.cn 9 年之前
父节点
当前提交
ef14581cb8

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

@@ -15,6 +15,7 @@ import (
 	"qfw/coreutil"
 	"qfw/member"
 	"qfw/util"
+	credit "qfw/util/credit"
 	"qfw/util/elastic"
 	. "qfw/util/mongodb"
 	. "qfw/util/msg"
@@ -781,7 +782,11 @@ func (s *SystemManage) Updateaudit() error {
 			flag = "false"
 			msg = "审核失败!"
 		}
-
+		//认证送积分
+		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)
+		}
 		s.Write(`{"flag":"` + flag + `","msg":"` + msg + `"}`)
 	}
 	return nil

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

@@ -20,6 +20,7 @@ import (
 	"qfw/coreconfig"
 	. "qfw/coreutil"
 	. "qfw/util"
+	credit "qfw/util/credit"
 	"qfw/util/elastic"
 	. "qfw/util/mongodb"
 	msg "qfw/util/msg"
@@ -85,7 +86,6 @@ func autoAuth(uid, uname, s_avatar, entid, promotion_id string) {
 		if len(s_action) == 2 { //已经认证过
 			return
 		}
-		fmt.Println("222222222222222222222", s_action)
 		entName := ObjToString((*ent)["EntName"])
 		email := ObjToString((*ent)["Nb_email"])
 		t := time.Now().Local().Unix()
@@ -876,12 +876,16 @@ 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 contype == "1" {
 						r := *FindById("enterprise", entid, nil)
 						ac := ObjToString(r["s_action"])
 						if len(r) > 0 && ac == "" {
 							autoAuth(usid, uname, avatar, entid, proid)
+							//认证送积分
+							credit.InCreditA(usid, credit.A_RZ, IntAll(m.GetSession("credit_a")))
 							//发系统消息
 							msg := &msg.Msg{
 								Msgtype:   1,
@@ -1048,6 +1052,8 @@ 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"

+ 5 - 3
core/src/qfw/member/yellowpage.go

@@ -233,9 +233,7 @@ func (yp *Yellowpage) Dosave() error {
 		info = "保存信息失败"
 	} else { //首次创建企业名片,送积分
 		userId := util.ObjToString(yp.GetSession("userId"))
-		_, credit_a, _ := credit.InCreditA(userId,
-			credit.A_CJMP,
-			util.IntAll(yp.GetSession("credit_a")))
+		_, credit_a, _ := credit.InCreditA(userId, credit.A_CJMP, util.IntAll(yp.GetSession("credit_a")))
 		yp.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
 	}
 	return yp.Write("{\"info\":\"" + info + "\",\"status\":\"" + status + "\"}")
@@ -430,6 +428,10 @@ func (yp *Yellowpage) AddService() error {
 		_id := mongodb.Save("service", doc)
 		doc["_id"] = _id
 		tempFlag = len(_id) > 0
+		//发服务送积分
+		if tempFlag {
+			//credit.InCreditB(util.ObjToString(userid), credit.B_FFW)
+		}
 	}
 	currentuser := mongodb.FindById("user", yp.GetSession("userId").(string), nil)
 	log.Println(currentuser)

+ 9 - 1
core/src/qfw/swordfish/swordfishmanage.go

@@ -2,6 +2,8 @@ package swordfish
 
 import (
 	"gopkg.in/mgo.v2/bson"
+	"qfw/util"
+	credit "qfw/util/credit"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
 	"time"
@@ -31,6 +33,7 @@ func (s *SwordFish) RssSet() error {
 	return s.Render("/swordfish/rssset.html", &s.T)
 }
 func (s *SwordFish) RsssetAjaxReq() error {
+	userId := s.GetSession("userId").(string)
 	var flag = "n"
 	msgset := make(map[string]interface{})
 	//投标公告
@@ -49,9 +52,14 @@ func (s *SwordFish) RsssetAjaxReq() error {
 	}
 	//更新数据库
 	msgset["l_modifydate"] = time.Now().Unix()
-	if mongodb.Update("user", `{"_id":"`+s.GetSession("userId").(string)+`"}`, &map[string]interface{}{"$set": map[string]interface{}{"o_msgset": msgset}}, false, false) {
+	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.A_JY, util.IntAll(s.GetSession("credit_a")))
+		s.Session().UpdateByCustomField("id", userId, "credit_a", credit_a)
+	}
 	s.ServeJson(map[string]interface{}{
 		"flag": flag,
 	})