瀏覽代碼

手机号如果为空的时候展示邮箱号

xingzai 1 年之前
父節點
當前提交
7bcee9f951
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      controllers/activity_sign.go

+ 9 - 3
controllers/activity_sign.go

@@ -91,7 +91,7 @@ func (this *ActivitySignCoAntroller) Detail() {
 	item.CountryCode = user.CountryCode
 	item.OpenId = user.OpenId
 	item.CreateTime = time.Now()
-	if total == 0 && user.Mobile != "" && (applyCount > 0 || user.CompanyId > 1) {
+	if total == 0 && (user.Mobile != "" || user.Email != "") && (applyCount > 0 || user.CompanyId > 1) {
 		err = models.AddCygxActivitySignin(item)
 		if err != nil {
 			br.Msg = "签到失败"
@@ -142,7 +142,7 @@ func (this *ActivitySignCoAntroller) Detail() {
 	//1,没有签到记录不为潜在客户
 	//2,没有签到记录,手机号不为空,没有申请记录
 	//3,已经有签到记录的
-	if total == 0 && user.CompanyId > 1 || (user.Mobile != "" && applyCount > 0) || total > 0 {
+	if total == 0 && user.CompanyId > 1 || ((user.Mobile != "" || user.Email != "") && applyCount > 0) || total > 0 {
 		resp.IsBindingMobile = true
 	}
 	if user.CompanyId == 1 {
@@ -150,7 +150,7 @@ func (this *ActivitySignCoAntroller) Detail() {
 	}
 
 	//潜在客户提交过申请的显示提交时候的公司
-	if applyCount > 0 && user.Mobile != "" && user.CompanyId == 1 {
+	if applyCount > 0 && (user.Mobile != "" || user.Email != "") && user.CompanyId == 1 {
 		detail, err := models.GetCygxApplyRecordByMobile(user.Mobile)
 		if err != nil {
 			br.Msg = "签到失败"
@@ -162,6 +162,9 @@ func (this *ActivitySignCoAntroller) Detail() {
 	detail.ActivityId = activityId
 	detail.ActivityName = activityInfo.ActivityName
 	detail.Mobile = user.Mobile
+	if user.Mobile == "" {
+		detail.Mobile = user.Email
+	}
 	detail.RealName = user.RealName
 	detail.CompanyName = user.CompanyName
 
@@ -179,6 +182,9 @@ func (this *ActivitySignCoAntroller) Detail() {
 		if signinDetail != nil {
 			detail.BusinessCard = signinDetail.BusinessCard
 			detail.Mobile = signinDetail.Mobile
+			if signinDetail.Mobile == "" {
+				detail.Mobile = signinDetail.Email
+			}
 			detail.RealName = signinDetail.RealName
 			detail.CompanyName = signinDetail.CompanyName
 			detail.IsNewUser = true