|
@@ -30,9 +30,8 @@ func CheckHtgj(companyCodeHt, companyNameHt, email, sign string) (errMsg string,
|
|
|
errHt = err
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
wxuUserName = email
|
|
|
- countCompay, err := models.GetCompanyCountByName(companyName)
|
|
|
+ countCompay, err := models.GetCompanyCountByThirdName(tripartiteCompanyCode)
|
|
|
if err != nil {
|
|
|
errHt = err
|
|
|
return
|
|
@@ -97,7 +96,7 @@ func CheckHtgj(companyCodeHt, companyNameHt, email, sign string) (errMsg string,
|
|
|
companyProduct.CreateTime = time.Now()
|
|
|
companyProduct.ModifyTime = time.Now()
|
|
|
companyProduct.CompanyType = "权益"
|
|
|
- companyProduct.OpenCode = GenerateOpenCompanyProductCode(int(companyId), 2)
|
|
|
+ companyProduct.OpenCode = GenerateOpenCompanyProductCode(int(companyId), productId)
|
|
|
companyProductId, err := models.AddCompanyProduct(companyProduct)
|
|
|
if err != nil {
|
|
|
errHt = err
|
|
@@ -194,18 +193,20 @@ func CheckHtgj(companyCodeHt, companyNameHt, email, sign string) (errMsg string,
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- companyInfo, err := models.GetCompanyByName(companyName)
|
|
|
+ companyInfo, err := models.GetCompanyByThirdName(tripartiteCompanyCode)
|
|
|
if err != nil {
|
|
|
errHt = err
|
|
|
return
|
|
|
}
|
|
|
companyId = int64(companyInfo.CompanyId)
|
|
|
}
|
|
|
- countUser, err := models.GetUserCountByName(int(companyId), wxuUserName)
|
|
|
+ countUser, err := models.GetUserCountByThirdName(int(companyId), wxuUserName)
|
|
|
if countUser == 0 {
|
|
|
wxUser.CompanyId = int(companyId)
|
|
|
wxUser.RealName = wxuUserName
|
|
|
wxUser.Email = wxuUserName
|
|
|
+ wxUser.TripartiteCode = wxuUserName
|
|
|
+ wxUser.Source = 7
|
|
|
wxUser.CreatedTime = time.Now()
|
|
|
newUserId, err := models.AddWxUser(wxUser)
|
|
|
if err != nil {
|
|
@@ -220,8 +221,9 @@ func CheckHtgj(companyCodeHt, companyNameHt, email, sign string) (errMsg string,
|
|
|
errHt = err
|
|
|
return
|
|
|
}
|
|
|
+ models.AddUserSellerRelation(newUserId, int(companyId), sellerInfo.AdminId, productId, sellerInfo.RealName, wxUser.Mobile, wxuUserName)
|
|
|
} else {
|
|
|
- wxUser, err = models.GetUserByName(int(companyId), wxuUserName)
|
|
|
+ wxUser, err = models.GetUserByThirdName(int(companyId), wxuUserName)
|
|
|
if err != nil {
|
|
|
errHt = err
|
|
|
return
|