xingzai 1 год назад
Родитель
Сommit
c32db70b4d

+ 2 - 6
controllers/yanxuan_special.go

@@ -736,12 +736,8 @@ func (this *YanxuanSpecialController) Record() {
 		br.ErrMsg = "文章不存在,文章ID错误"
 		br.ErrMsg = "文章不存在,文章ID错误"
 		return
 		return
 	}
 	}
-	err = services.AddSpecialRecord(this.User, specialId, stopTime)
-	if err != nil {
-		br.Msg = "记录失败"
-		br.ErrMsg = "记录失败,Err:" + err.Error()
-		return
-	}
+	services.AddSpecialRecord(this.User, specialId, stopTime)
+
 	br.Ret = 200
 	br.Ret = 200
 	br.Success = true
 	br.Success = true
 	br.Msg = "记录成功"
 	br.Msg = "记录成功"

+ 8 - 0
models/user_record.go

@@ -49,6 +49,14 @@ func GetUserRecordByUserId(userId, platform int) (item *UserRecord, err error) {
 	return
 	return
 }
 }
 
 
+// 根据用户id和平台id获取用户关系
+func GetUserRecordByUnionId(unionId string, platform int) (item *UserRecord, err error) {
+	o := orm.NewOrmUsingDB("weekly_report")
+	sql := `SELECT * FROM user_record WHERE union_id =? AND create_platform = ?`
+	err = o.Raw(sql, unionId, platform).QueryRow(&item)
+	return
+}
+
 // 添加用户关系
 // 添加用户关系
 func AddUserRecord(record *UserRecord) (recordId int64, err error) {
 func AddUserRecord(record *UserRecord) (recordId int64, err error) {
 	o := orm.NewOrmUsingDB("weekly_report")
 	o := orm.NewOrmUsingDB("weekly_report")

+ 2 - 1
services/company_permission.go

@@ -179,7 +179,8 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 			}
 			}
 			hasPermission = hasPermission
 			hasPermission = hasPermission
 			if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 			if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
-				popupMsg = "暂无<b>研选</b>权限<br/>您可申请开通试用"
+				//popupMsg = "暂无<b>研选</b>权限<br/>您可申请开通试用"
+				popupMsg = "暂无权限<br/>您可申请开通试用"
 			} else {
 			} else {
 				popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 				popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 			}
 			}

+ 3 - 4
services/cygx_yanxuan_special_company.go

@@ -20,9 +20,8 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 	}
 	}
 	var sellerName string
 	var sellerName string
 	//获取销售信息
 	//获取销售信息
-	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if e != nil {
-		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+	sellerItem, _ := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if sellerItem == nil {
 		return
 		return
 	}
 	}
 	sellerName = sellerItem.RealName
 	sellerName = sellerItem.RealName
@@ -102,7 +101,7 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 	itemLog.RegisterPlatform = utils.REGISTER_PLATFORM
 	itemLog.RegisterPlatform = utils.REGISTER_PLATFORM
 	itemLog.YanxuanSpecialId = specialId
 	itemLog.YanxuanSpecialId = specialId
 	itemLog.StopTime = stopTime
 	itemLog.StopTime = stopTime
-	_, e = models.AddCygxYanxuanSpecialRecordLog(itemLog) // 添加历史记录
+	_, e := models.AddCygxYanxuanSpecialRecordLog(itemLog) // 添加历史记录
 	if e != nil {
 	if e != nil {
 		err = errors.New("AddCygxYanxuanSpecialRecordLog, Err: " + e.Error())
 		err = errors.New("AddCygxYanxuanSpecialRecordLog, Err: " + e.Error())
 		return
 		return

+ 9 - 0
services/user.go

@@ -46,6 +46,15 @@ func GetWxUserItemByOpenId(openid string) (item *models.WxUserItem, err error) {
 		formatWxUserAndUserRecord(item, userRecord)
 		formatWxUserAndUserRecord(item, userRecord)
 		return
 		return
 	}
 	}
+	//如果查研观向小程序登录过,那么买方研选小程序就做静默登录
+	if userRecord.UserId <= 0 {
+		userRecordCygx, userRecordErrCygx := models.GetUserRecordByUnionId(userRecord.UnionId, 4)
+		//fmt.Println("userRecordErr", userRecordErr)
+		if userRecordErrCygx != nil && userRecordErrCygx.Error() != utils.ErrNoRow() {
+			err = userRecordErrCygx
+		}
+		userRecord = userRecordCygx
+	}
 
 
 	//获取用户信息
 	//获取用户信息
 	item, wxUserErr := models.GetWxUserItemByUserId(userRecord.UserId)
 	item, wxUserErr := models.GetWxUserItemByUserId(userRecord.UserId)