瀏覽代碼

微信注册送积分

zhangjinkun@topnet.net.cn 9 年之前
父節點
當前提交
8c8d8bafe0
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      weixin/src/qfw/weixin/dao/userdao.go

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

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