|
@@ -3,8 +3,10 @@ package price_driven
|
|
|
import (
|
|
|
"errors"
|
|
|
"hongze/hongze_yb/models/response"
|
|
|
+ "hongze/hongze_yb/models/tables/company_product"
|
|
|
"hongze/hongze_yb/models/tables/yb_price_driven"
|
|
|
"hongze/hongze_yb/models/tables/yb_price_driven_visit_log"
|
|
|
+ "hongze/hongze_yb/services/user"
|
|
|
"hongze/hongze_yb/utils"
|
|
|
)
|
|
|
|
|
@@ -32,14 +34,27 @@ func GetPriceDrivenDetail(chartPermissionId int) (resp *response.PriceDrivenItem
|
|
|
}
|
|
|
|
|
|
// SavePriceDrivenVisitLog 保存价格驱动访问记录
|
|
|
-func SavePriceDrivenVisitLog(priceDrivenId, sourceAgent, userId int) (errMsg string, err error) {
|
|
|
+func SavePriceDrivenVisitLog(priceDrivenId, sourceAgent int, userInfo user.UserInfo) (errMsg string, err error) {
|
|
|
+ companyInfo, e := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
|
|
|
+ if e != nil {
|
|
|
+ errMsg = "保存失败"
|
|
|
+ err = errors.New("获取客户信息失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
logItem := &yb_price_driven_visit_log.YbPriceDrivenVisitLog{
|
|
|
PriceDrivenID: priceDrivenId,
|
|
|
- UserID: userId,
|
|
|
+ UserID: int(userInfo.UserID),
|
|
|
+ Mobile: userInfo.Mobile,
|
|
|
+ RealName: userInfo.RealName,
|
|
|
+ NickName: userInfo.NickName,
|
|
|
+ CompanyID: int(userInfo.CompanyID),
|
|
|
+ CompanyName: companyInfo.CompanyName,
|
|
|
+ CompanyStatus: companyInfo.Status,
|
|
|
SourceAgent: sourceAgent,
|
|
|
}
|
|
|
if e := logItem.Create(); e != nil {
|
|
|
- err = errors.New("保存失败")
|
|
|
+ errMsg = "保存失败"
|
|
|
+ err = errors.New("新增价格驱动访问记录失败, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
return
|