|
@@ -614,6 +614,28 @@ func (this *UserController) ApplyTryOut() {
|
|
|
}
|
|
|
uid := user.UserId
|
|
|
|
|
|
+ var title string
|
|
|
+ tryType := req.TryType
|
|
|
+ detailId := req.DetailId
|
|
|
+ if tryType == "Article" {
|
|
|
+ detail, err := models.GetArticleDetailById(detailId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ title = detail.Title
|
|
|
+ } else if tryType == "Activity" {
|
|
|
+ detail, err := models.GetAddActivityInfoById(detailId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(detailId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ title = detail.ActivityName
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println(title)
|
|
|
//缓存校验
|
|
|
cacheKey := fmt.Sprint("xygx:apply_record:add:", uid)
|
|
|
ttlTime := utils.Rc.GetRedisTTL(cacheKey)
|
|
@@ -706,7 +728,7 @@ func (this *UserController) ApplyTryOut() {
|
|
|
}
|
|
|
|
|
|
//获取销售信息
|
|
|
- sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId)
|
|
|
+ sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "申请失败"
|
|
|
br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
|
|
@@ -720,7 +742,6 @@ func (this *UserController) ApplyTryOut() {
|
|
|
mobile = user.Email
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
applyMethod := ""
|
|
|
cnf, _ := models.GetConfigByCode("tpl_msg")
|
|
|
if cnf != nil {
|
|
@@ -734,12 +755,49 @@ func (this *UserController) ApplyTryOut() {
|
|
|
}
|
|
|
if companyItem != nil && companyItem.CompanyId > 0 {
|
|
|
applyMethod = companyItem.Status + "客户申请"
|
|
|
+ if detailId > 0 {
|
|
|
+ companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if companyProduct != nil && companyProduct.IsSuspend == 1 {
|
|
|
+ applyMethod = "试用暂停客户"
|
|
|
+ } else {
|
|
|
+ if companyItem.Status == "正式" || companyItem.Status == "试用" {
|
|
|
+ applyMethod = companyItem.Status + "客户申请,无对应权限"
|
|
|
+ } else if companyItem.Status == "冻结" || companyItem.Status == "流失" {
|
|
|
+ applyMethod = companyItem.Status + "客户"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ applyMethod = applyMethod + "," + title
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
+ if detailId > 0 {
|
|
|
+ //获取销售信息
|
|
|
+ sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "申请失败"
|
|
|
+ br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if sellerItem != nil {
|
|
|
+ applyMethod = "FICC客户"
|
|
|
+ } else {
|
|
|
+ applyMethod = "潜在客户"
|
|
|
+ }
|
|
|
+ applyMethod = applyMethod + "," + title
|
|
|
+ }
|
|
|
applyMethod = "潜在客户申请"
|
|
|
}
|
|
|
openIpItem, _ := models.GetUserRecordByMobile(4, cnf.ConfigValue)
|
|
|
if openIpItem != nil && openIpItem.OpenId != "" {
|
|
|
+ if applyMethod != "2" {
|
|
|
+ req.RealName = user.RealName
|
|
|
+ req.CompanyName = user.CompanyName
|
|
|
+ }
|
|
|
fmt.Println("推送消息", req.RealName, req.CompanyName, mobile, openIpItem.OpenId, applyMethod)
|
|
|
utils.FileLog.Info("推送消息 %s %s,%s,%s,%s", req.RealName, req.CompanyName, mobile, openIpItem.OpenId, applyMethod)
|
|
|
go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, openIpItem.OpenId, applyMethod)
|