|
|
@@ -189,6 +189,7 @@ func (dealSuperCloudIssuanceCallBackService *DealSuperCloudIssuanceCallBackServi |
|
|
|
return |
|
|
|
} |
|
|
|
if superCloudIssuanceUserRobotBindSource != nil { |
|
|
|
//1、插入"源头群消息记录" |
|
|
|
superCloudIssuanceUserRobotBindSourceMessageLog := models.SuperCloudIssuanceUserRobotBindSourceMessageLog{ |
|
|
|
ActivateGroupId: superCloudIssuanceUserRobotBindSource.ActivateGroupId, |
|
|
|
MessageType: req.MessageType, |
|
|
@@ -204,6 +205,111 @@ func (dealSuperCloudIssuanceCallBackService *DealSuperCloudIssuanceCallBackServi |
|
|
|
fmt.Println("DealSourceGroupMessage_Err:::::", err.Error()) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
//初始化云发单类 |
|
|
|
cloudIssuanceService := CloudIssuanceService{} |
|
|
|
//2、判断消息类型 |
|
|
|
var superCloudIssuanceUserRobotBindSourceFollowGroups []*models.SuperCloudIssuanceUserRobotBindSourceFollowGroup |
|
|
|
switch req.MessageType { |
|
|
|
case 9: |
|
|
|
//群聊文本消息 |
|
|
|
//3、查询需转发的群 |
|
|
|
err = engine.Where("activate_group_id =?", superCloudIssuanceUserRobotBindSource.ActivateGroupId).Find(&superCloudIssuanceUserRobotBindSourceFollowGroups) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("DealSourceGroupMessage_Err:::::", err.Error()) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
cache.NewRedis(cfg.RedisAddr) |
|
|
|
for _, superCloudIssuanceUserRobotBindSourceFollowGroup := range superCloudIssuanceUserRobotBindSourceFollowGroups { |
|
|
|
//转链 |
|
|
|
if superCloudIssuanceUserRobotBindSourceFollowGroup.Uid > 0 { |
|
|
|
args := map[string]string{ |
|
|
|
"uid": utils.IntToStr(superCloudIssuanceUserRobotBindSourceFollowGroup.Uid), |
|
|
|
"platform": "", |
|
|
|
"master_id": dealSuperCloudIssuanceCallBackService.Context.GetString("mid"), |
|
|
|
"content": req.Data.Content, |
|
|
|
} |
|
|
|
utils.FilePutContents("cloud_source", utils.SerializeStr(args)) |
|
|
|
chain := chain_transfer.TurnChain(MasterDb(dealSuperCloudIssuanceCallBackService.Context), db.Db, db2.ZhimengDb, args) |
|
|
|
utils.FilePutContents("cloud_source", utils.SerializeStr(chain)) |
|
|
|
if chain.Count != "" { |
|
|
|
req.Data.Content = chain.Count |
|
|
|
} |
|
|
|
} |
|
|
|
utils.FilePutContents("cloud", req.Data.Content) |
|
|
|
|
|
|
|
superCloudIssuanceUserRobotDb := implement.NewSuperCloudIssuanceUserRobotDb(engine, superCloudIssuanceUserRobotBindSourceFollowGroup.Uid, dealSuperCloudIssuanceCallBackService.Context.GetString("mid")) |
|
|
|
robot, _ := superCloudIssuanceUserRobotDb.GetSuperCloudIssuanceUserRobot() |
|
|
|
if robot != nil { |
|
|
|
cloudIssuanceService.Set(nil, enum.RobotMacSendTextMethodName, "127.0.0.1") |
|
|
|
err = cloudIssuanceService.RobotMacSendText(md.RobotMacSendTextRequest{ |
|
|
|
RobotId: robot.RobotId, |
|
|
|
WxId: superCloudIssuanceUserRobotBindSourceFollowGroup.FollowChatRoomId, |
|
|
|
Content: req.Data.Content, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("DealCallBack_err::::", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break |
|
|
|
case 10: |
|
|
|
//群聊图片消息 |
|
|
|
|
|
|
|
//3、查询需转发的群 |
|
|
|
err = engine.Where("activate_group_id =?", superCloudIssuanceUserRobotBindSource.ActivateGroupId).Find(&superCloudIssuanceUserRobotBindSourceFollowGroups) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("DealSourceGroupMessage_Err:::::", err.Error()) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
for _, superCloudIssuanceUserRobotBindSourceFollowGroup := range superCloudIssuanceUserRobotBindSourceFollowGroups { |
|
|
|
superCloudIssuanceUserRobotDb := implement.NewSuperCloudIssuanceUserRobotDb(engine, superCloudIssuanceUserRobotBindSourceFollowGroup.Uid, dealSuperCloudIssuanceCallBackService.Context.GetString("mid")) |
|
|
|
robot, _ := superCloudIssuanceUserRobotDb.GetSuperCloudIssuanceUserRobot() |
|
|
|
if robot != nil { |
|
|
|
cloudIssuanceService.Set(nil, enum.RobotMacSendRecvImageMethodName, "127.0.0.1") |
|
|
|
err = cloudIssuanceService.RobotMacSendRecvImage(md.RobotMacSendRecvImageRequest{ |
|
|
|
RobotId: robot.RobotId, |
|
|
|
WxId: superCloudIssuanceUserRobotBindSourceFollowGroup.FollowChatRoomId, |
|
|
|
Content: req.Data.Content, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("DealCallBack_err::::", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
case 11: |
|
|
|
//群聊视屏消息 |
|
|
|
|
|
|
|
//3、查询需转发的群 |
|
|
|
err = engine.Where("activate_group_id =?", superCloudIssuanceUserRobotBindSource.ActivateGroupId).Find(&superCloudIssuanceUserRobotBindSourceFollowGroups) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("DealSourceGroupMessage_Err:::::", err.Error()) |
|
|
|
return err |
|
|
|
} |
|
|
|
for _, superCloudIssuanceUserRobotBindSourceFollowGroup := range superCloudIssuanceUserRobotBindSourceFollowGroups { |
|
|
|
superCloudIssuanceUserRobotDb := implement.NewSuperCloudIssuanceUserRobotDb(engine, superCloudIssuanceUserRobotBindSourceFollowGroup.Uid, dealSuperCloudIssuanceCallBackService.Context.GetString("mid")) |
|
|
|
robot, _ := superCloudIssuanceUserRobotDb.GetSuperCloudIssuanceUserRobot() |
|
|
|
if robot != nil { |
|
|
|
cloudIssuanceService.Set(nil, enum.RobotMacSendRecvViedoMethodName, "127.0.0.1") |
|
|
|
err = cloudIssuanceService.RobotMacSendRecvVideo(md.RobotMacSendRecvVideoRequest{ |
|
|
|
RobotId: robot.RobotId, |
|
|
|
WxId: superCloudIssuanceUserRobotBindSourceFollowGroup.FollowChatRoomId, |
|
|
|
Content: req.Data.Content, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("DealCallBack_err::::", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|