Browse Source

修改credit

renzheng 9 years ago
parent
commit
8acdedcee0
1 changed files with 22 additions and 0 deletions
  1. 22 0
      core/src/qfw/mobile/wxmenu.go

+ 22 - 0
core/src/qfw/mobile/wxmenu.go

@@ -271,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 {
 					//还有一个截止时间字段和一个剑鱼服务状态
@@ -279,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