|
@@ -22,10 +22,12 @@ var YYYYMMDDHHMM = "2006-01-02 15:04" //%20用于转义
|
|
|
|
|
|
//线索相关
|
|
|
type SaleClueService struct {
|
|
|
+ AppId string
|
|
|
PositionId int64
|
|
|
EntId int64
|
|
|
EntUserId int64
|
|
|
BaseUserId int64
|
|
|
+ AccountId int64
|
|
|
ClueName string
|
|
|
CluesSource string
|
|
|
Summary string
|
|
@@ -37,10 +39,11 @@ type SaleClueService struct {
|
|
|
}
|
|
|
|
|
|
//Add 创建线索
|
|
|
-func (this *SaleClueService) Add(ctx context.Context) int64 {
|
|
|
+//return 是否成功,群组id
|
|
|
+func (this *SaleClueService) Add(ctx context.Context) (int64, string) {
|
|
|
nowtime := time.Now().Format(date.Date_Full_Layout)
|
|
|
nextFollowTime := time.Unix(this.FollowUpTime, 0).Format(date.Date_Full_Layout)
|
|
|
-
|
|
|
+ groupId := ""
|
|
|
args := []interface{}{}
|
|
|
argsTask := []interface{}{}
|
|
|
argsTaskTeam := []interface{}{}
|
|
@@ -57,10 +60,10 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
|
|
|
})
|
|
|
if err != nil {
|
|
|
log.Println("获取用户职位id信息出错", i_entuserid, "的信息出错", err)
|
|
|
- return -1
|
|
|
+ return -1, groupId
|
|
|
} else if resp == nil {
|
|
|
log.Println("entuser用户", i_entuserid, "没有找到职位信息")
|
|
|
- return -1
|
|
|
+ return -1, groupId
|
|
|
}
|
|
|
transferArr = append(transferArr, resp.PositionId)
|
|
|
baseUserIdArr = append(baseUserIdArr, resp.UserId)
|
|
@@ -73,7 +76,7 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
|
|
|
argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 1, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime), nil, nil)
|
|
|
clueId, taskId = Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, transferArr)
|
|
|
if clueId < 0 {
|
|
|
- return -1
|
|
|
+ return -1, groupId
|
|
|
}
|
|
|
} else if this.Types == 1 {
|
|
|
//线索
|
|
@@ -86,9 +89,20 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
|
|
|
//存库
|
|
|
clueId, taskId = Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, []int64{})
|
|
|
if clueId < 0 {
|
|
|
- return -1
|
|
|
+ return -1, groupId
|
|
|
}
|
|
|
baseUserIdArr = append(baseUserIdArr, this.BaseUserId)
|
|
|
+
|
|
|
+ //自办 创建 群聊
|
|
|
+ gp := &Group{
|
|
|
+ EntId: this.EntId,
|
|
|
+ PositionId: this.PositionId,
|
|
|
+ UserIdArr: []int64{},
|
|
|
+ AppId: this.AppId,
|
|
|
+ EntUserId: this.EntUserId,
|
|
|
+ AccountId: this.AccountId,
|
|
|
+ }
|
|
|
+ groupId = gp.GroupAdd()
|
|
|
}
|
|
|
u := &User{BaseUserIds: baseUserIdArr}
|
|
|
|
|
@@ -99,10 +113,15 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
|
|
|
vb.WriteString(gconv.String(v) + ",")
|
|
|
userId := strings.TrimRight(kb.String(), ",")
|
|
|
positionId := strings.TrimRight(vb.String(), ",")
|
|
|
- StationMailPush(userId, positionId, cm.Push.SaleClue.Create.Title, fmt.Sprintf(cm.Push.SaleClue.Create.Content, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1)), fmt.Sprintf(cm.Push.SaleClue.Create.PcHref, positionId, taskId, clueId), cm.Push.SaleClue.Create.MobileHref)
|
|
|
+ pcHref := ""
|
|
|
+ if this.Types == 1 {
|
|
|
+ pcHref = fmt.Sprintf(cm.Push.SaleClue.Create.MyselfPcHref, positionId, taskId, clueId)
|
|
|
+ } else if this.Types == 2 {
|
|
|
+ pcHref = fmt.Sprintf(cm.Push.SaleClue.Create.TransferPcHref, positionId)
|
|
|
+ }
|
|
|
+ StationMailPush(userId, positionId, cm.Push.SaleClue.Create.Title, fmt.Sprintf(cm.Push.SaleClue.Create.Content, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1)), pcHref, cm.Push.SaleClue.Create.MobileHref)
|
|
|
}
|
|
|
- return 1
|
|
|
-
|
|
|
+ return 1, groupId
|
|
|
}
|
|
|
|
|
|
//SaleClueAdd 线索存储
|