rdluck 4 years ago
parent
commit
76a6c9d9b0
2 changed files with 8 additions and 1 deletions
  1. 1 1
      controllers/user.go
  2. 7 0
      models/user_record.go

+ 1 - 1
controllers/user.go

@@ -875,7 +875,7 @@ func (this *UserController) ApplyTryOut() {
 
 	cnf, _ := models.GetConfigByCode("tpl_msg")
 	if cnf != nil {
-		openIpItem, _ := models.GetUserRecordByUserId(user.UserId, 1)
+		openIpItem, _ := models.GetUserRecordByMobile(1, cnf.ConfigValue)
 		if openIpItem != nil && openIpItem.OpenId != "" {
 			fmt.Println("推送消息", req.RealName, req.CompanyName, mobile, openIpItem.OpenId, applyMethod)
 			utils.FileLog.Info("推送消息 %s %s,%s,%s,%s", req.RealName, req.CompanyName, mobile, openIpItem.OpenId, applyMethod)

+ 7 - 0
models/user_record.go

@@ -76,3 +76,10 @@ func ModifyUserRecordSessionKey(openId, sessionKey string) (err error) {
 	_, err = o.Raw(sql, sessionKey, openId).Exec()
 	return
 }
+
+//根据用户id和平台id获取用户关系
+func GetUserRecordByMobile(platform int, bindAccount string) (item *UserRecord, err error) {
+	sql := `SELECT * FROM user_record WHERE create_platform=? AND bind_account = ?`
+	err = orm.NewOrm().Raw(sql, platform, bindAccount).QueryRow(&item)
+	return
+}