Browse Source

fix:申请时同步修改发起人信息

Roc 3 years ago
parent
commit
93ec8fe49e
2 changed files with 25 additions and 1 deletions
  1. 1 1
      logic/public.go
  2. 24 0
      logic/user/user.go

+ 1 - 1
logic/public.go

@@ -14,7 +14,7 @@ func GetApplyVarietyList() (list []ApplyVariety) {
 	list = append(list, ApplyVariety{Name: "双焦(焦煤、焦炭)", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/双焦(焦煤、焦炭).png"})
 	list = append(list, ApplyVariety{Name: "有色(锌、铅)", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/有色(锌、铅).png"})
 	list = append(list, ApplyVariety{Name: "有色(铜、铝)", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/有色(铜、铝).png"})
-	list = append(list, ApplyVariety{Name: "镍+不锈钢", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/镍+不锈钢.png"})
+	list = append(list, ApplyVariety{Name: "镍+不锈钢", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/镍2不锈钢.png"})
 	list = append(list, ApplyVariety{Name: "原油", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/原油.png"})
 	list = append(list, ApplyVariety{Name: "聚烯烃", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/聚烯烃.png"})
 	list = append(list, ApplyVariety{Name: "苯乙烯", PicUrl: "http://hongze.oss-cn-shanghai.aliyuncs.com/static/yb_variety/苯乙烯.png"})

+ 24 - 0
logic/user/user.go

@@ -7,6 +7,7 @@ import (
 	"hongze/hongze_yb/models/tables/company"
 	"hongze/hongze_yb/models/tables/company_product"
 	"hongze/hongze_yb/models/tables/rddp/msg_code"
+	"hongze/hongze_yb/models/tables/wx_user"
 	"hongze/hongze_yb/models/tables/yb_apply_record"
 	"hongze/hongze_yb/services"
 	companyService "hongze/hongze_yb/services/company"
@@ -218,6 +219,12 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
 	status := `潜在客户`
 	companyName := applyInfo.CompanyName
 
+	// 联系人信息
+	wxUserInfo, err := wx_user.GetByUserId(userId)
+	if err != nil {
+		return
+	}
+
 	if companyId > 1 {
 		//客户信息
 		companyInfo, tmpErr := company.GetByCompanyId(companyId)
@@ -259,5 +266,22 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
 		CreateTime:      time.Now(),
 	}
 	err = ybApplyRecord.Create()
+	if err != nil {
+		return
+	}
+
+	// 修改客户信息
+	wxUserInfo.RealName = applyInfo.RealName
+	wxUserInfo.Note = applyInfo.CompanyName
+	wxUserInfo.IsNote = 1
+
+	applyMethod := wxUserInfo.ApplyMethod //0:未申请,1:已付费客户申请试用,2:非客户申请试用
+	applyMethod = 2
+	if sellerName != "" {
+		applyMethod = 1
+	}
+	wxUserInfo.ApplyMethod = applyMethod
+
+	_ = wxUserInfo.Update([]string{"RealName", "Note", "IsNote", "ApplyMethod"})
 	return
 }