|
@@ -2,6 +2,7 @@ package yb
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
+ "hongze/hongze_open_api/models/tables/company"
|
|
|
"hongze/hongze_open_api/models/tables/company_product"
|
|
|
"hongze/hongze_open_api/models/tables/qs_event"
|
|
|
"hongze/hongze_open_api/models/tables/qs_event_user"
|
|
@@ -30,6 +31,7 @@ func SyncUser(qsEventId int) (err error) {
|
|
|
}
|
|
|
|
|
|
companyProductMap := make(map[string]*company_product.CompanyProduct)
|
|
|
+ companyMap := make(map[string]*company.Company)
|
|
|
people := len(qsData.Summary) //参与人数
|
|
|
if qsData.Summary != nil && people > 0 {
|
|
|
for _, v := range qsData.Summary {
|
|
@@ -37,6 +39,7 @@ func SyncUser(qsEventId int) (err error) {
|
|
|
trimMobile := mobile
|
|
|
countryCode := "86"
|
|
|
var companyProductInfo *company_product.CompanyProduct
|
|
|
+ var companyInfo *company.Company
|
|
|
var wxUserInfo *wx_user.WxUser
|
|
|
if mobile != "" {
|
|
|
trimMobileSlice := strings.Split(v.Mobile, "-")
|
|
@@ -46,7 +49,7 @@ func SyncUser(qsEventId int) (err error) {
|
|
|
countryCode = strings.Replace(trimMobileSlice[0], "+", "", -1)
|
|
|
}
|
|
|
wxUserInfo, _ = wx_user.GetWxUserByMobileCountryCode(trimMobile, countryCode)
|
|
|
- if wxUserInfo != nil {
|
|
|
+ if wxUserInfo != nil && wxUserInfo.CompanyId != 1 {
|
|
|
//获取客户产品信息
|
|
|
key := fmt.Sprint(wxUserInfo.CompanyId, "_", 1)
|
|
|
if tmpCompanyProductInfo, ok := companyProductMap[key]; ok {
|
|
@@ -56,6 +59,16 @@ func SyncUser(qsEventId int) (err error) {
|
|
|
if companyProductInfo != nil {
|
|
|
companyProductMap[key] = companyProductInfo
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if tmpCompanyInfo, ok := companyMap[key]; ok {
|
|
|
+ companyInfo = tmpCompanyInfo
|
|
|
+ } else {
|
|
|
+ companyInfo, _ = company.GetCompanyById(wxUserInfo.CompanyId)
|
|
|
+ if companyProductInfo != nil {
|
|
|
+ companyMap[key] = companyInfo
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -93,7 +106,7 @@ func SyncUser(qsEventId int) (err error) {
|
|
|
qsEventUserInfo.Name = wxUserInfo.RealName
|
|
|
qsEventUserInfo.CompanyId = companyProductInfo.CompanyId
|
|
|
qsEventUserInfo.ProductId = companyProductInfo.ProductId
|
|
|
- qsEventUserInfo.CompanyName = companyProductInfo.ProductName
|
|
|
+ qsEventUserInfo.CompanyName = companyInfo.CompanyName
|
|
|
qsEventUserInfo.Status = companyProductInfo.Status
|
|
|
qsEventUserInfo.SellerId = companyProductInfo.SellerId
|
|
|
qsEventUserInfo.SellerName = companyProductInfo.SellerName
|