dengbiao pirms 3 mēnešiem
vecāks
revīzija
b345060c68
6 mainītis faili ar 147 papildinājumiem un 9 dzēšanām
  1. +1
    -1
      app/db/dbs_map.go
  2. +8
    -8
      consume/init.go
  3. +3
    -0
      super_cloud_issuance/enum/enum_api.go
  4. +7
    -0
      super_cloud_issuance/md/md_api.go
  5. +11
    -0
      super_cloud_issuance/svc/svc_cloud_issuance.go
  6. +117
    -0
      super_cloud_issuance/svc/svc_deal_call_back.go

+ 1
- 1
app/db/dbs_map.go Parādīt failu

@@ -111,7 +111,7 @@ func GetAllDatabaseDev() *[]model.DbMapping {
if cfg.Local { // 本地调试 加快速度
fmt.Println("notice:LOCAL TEST, only masterId:** 123456 ** available!")
err = Db.Where("deleted_at != ? AND is_dev = '1' AND db_master_id= ?", 1, 123456).
Or("db_master_id = ?", 31585332).Find(&m)
Or("db_master_id = ?", 12293740).Find(&m)
} else {
err = Db.Where("deleted_at != ? AND is_dev = '1' ", 1).Find(&m)
}


+ 8
- 8
consume/init.go Parādīt failu

@@ -86,12 +86,12 @@ func initConsumes() {
//jobs[consumeMd.CanalB2cOrderForNumericalStatementConsumeFunName] = CanalB2cOrderForNumericalStatementConsume

//////////////////////////////////////// oneCircles-v1 /////////////////////////////////////////////////////
jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume
jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume
jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume
jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume
jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume
jobs[consumeMd.OneCirclesAddPublicPlatoonUserRelationCommissionFunName] = OneCirclesAddPublicPlatoonUserRelationCommissionConsume
//jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume
//jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume
//jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume
//jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume
//jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume
//jobs[consumeMd.OneCirclesAddPublicPlatoonUserRelationCommissionFunName] = OneCirclesAddPublicPlatoonUserRelationCommissionConsume

//////////////////////////////////////// oneCircles-v2 /////////////////////////////////////////////////////
//jobs[consumeMd.OneCirclesDealUserCoinConsumeFunName] = OneCirclesDealUserCoinConsume
@@ -108,8 +108,8 @@ func initConsumes() {
//jobs[consumeMd.InstallmentPaymentAutoRepaidConsumeFunName] = InstallmentPaymentAutoRepaidConsume //分期付 - 自动扣款

////////////////////////////////////// SuperCloudIssuance /////////////////////////////////////////////////////
//jobs[consumeMd.SuperCloudIssuanceMsgCallBackFunName] = SuperCloudIssuanceMsgCallBackConsume
//jobs[consumeMd.SuperCloudIssuanceAsyncMLoginFunName] = SuperCloudIssuanceAsyncMLoginConsume
jobs[consumeMd.SuperCloudIssuanceMsgCallBackFunName] = SuperCloudIssuanceMsgCallBackConsume
jobs[consumeMd.SuperCloudIssuanceAsyncMLoginFunName] = SuperCloudIssuanceAsyncMLoginConsume

////////////////////////////////////// DMS /////////////////////////////////////////////////////
//jobs[consumeMd.CanalGimMessageConsumeFunName] = CanalGimMessageConsume


+ 3
- 0
super_cloud_issuance/enum/enum_api.go Parādīt failu

@@ -22,6 +22,7 @@ const (
RobotMacRepeatCircleMethodName = "itaoke.robot.macrepeat.circle"
RobotMacSendAppMethodName = "itaoke.robot.macsend.app"
RobotMacSendCircleMethodName = "itaoke.robot.macsend.circle"
RobotMacSendEmojiMethodName = "itaoke.robot.macsend.emoji"
)

func (gt CloudIssuanceMethodName) String() string {
@@ -64,6 +65,8 @@ func (gt CloudIssuanceMethodName) String() string {
return "转发小程序等XML"
case RobotMacSendCircleMethodName:
return "发送朋友圈"
case RobotMacSendEmojiMethodName:
return "转发emoji表情"
default:
return "未知"
}


+ 7
- 0
super_cloud_issuance/md/md_api.go Parādīt failu

@@ -142,6 +142,13 @@ type RobotMacSendRecvVideoRequest struct {
Content string `json:"content"` //消息xml内容
}

type RobotMacSendEmojiRequest struct {
RobotId int `json:"robot_id"` //机器人id
WxId string `json:"wx_id"` //发送微信好友/群id。一般wxid_开头
ImageMd5 string `json:"image_md5"` //取回调中xml中md5字段值
ImageSize string `json:"image_size"` //取回调中xml中len字段值
}

type RobotMacSendCircleRequest struct {
RobotId int `json:"robot_id"` //机器人id
PicUrl string `json:"pic_url"` //图片url,多个请用;分隔


+ 11
- 0
super_cloud_issuance/svc/svc_cloud_issuance.go Parādīt failu

@@ -324,6 +324,17 @@ func (svcCloudIssuance *CloudIssuanceService) RobotMacSendRecvVideo(args md.Robo
return
}

func (svcCloudIssuance *CloudIssuanceService) RobotMacSendEmoji(args md.RobotMacSendEmojiRequest) (err error) { // 发送文本消息
url := super_cloud_issuance.HttpBuild(svcCloudIssuance.RequestMethodName, svcCloudIssuance.RequestClientIp, map[string]string{
"robot_id": strconv.Itoa(args.RobotId),
"wx_id": args.WxId,
"image_md5": args.ImageMd5,
"image_size": args.ImageSize,
})
_, err = svcCloudIssuance.SendPost(url, args)
return
}

func (svcCloudIssuance *CloudIssuanceService) RobotMacSendCircle(args md.RobotMacSendCircleRequest) (err error) { // 下线机器人
url := super_cloud_issuance.HttpBuild(svcCloudIssuance.RequestMethodName, svcCloudIssuance.RequestClientIp, map[string]string{
"robot_id": strconv.Itoa(args.RobotId),


+ 117
- 0
super_cloud_issuance/svc/svc_deal_call_back.go Parādīt failu

@@ -15,6 +15,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"math/rand"
"regexp"
"time"
)

@@ -140,6 +141,60 @@ func (dealSuperCloudIssuanceCallBackService *DealSuperCloudIssuanceCallBackServi
}
}
break
case 20:
if req.Data.MsgType == "47" {
//TODO::表情
dealSuperCloudIssuanceCallBackService.DealSourceGroupMessage(req.Data.FromGroup, req)

utils.FilePutContents("DealSourceGroupMessage_Tmp", utils.SerializeStr(req))
//解析 content 中的xml 数据
// 编译正则表达式
// 注意:这里假设md5和len属性只会出现一次,并且格式如上所述
md5Regex := regexp.MustCompile(`md5="([^"]*)"`)
lenRegex := regexp.MustCompile(`len\s*=\s*"([^"]*)"`)
// 查找md5
md5Matches := md5Regex.FindStringSubmatch(req.Data.Content)
if len(md5Matches) > 1 {
fmt.Println("md5:", md5Matches[1])
} else {
fmt.Println("md5 not found")
return
}
// 查找len
lenMatches := lenRegex.FindStringSubmatch(req.Data.Content)
if len(lenMatches) > 1 {
fmt.Println("len:", lenMatches[1])
} else {
fmt.Println("len not found")
return
}

bindId := dealSuperCloudIssuanceCallBackService.IsNeedDealGroupMessage(req.Data.FromGroup, req.Data.FromUser, req.RobotId)
if bindId == 0 {
return
}
//3、查询需转发的群
superCloudIssuanceUserRobotBindFollowGroupDb := implement.NewSuperCloudIssuanceUserRobotBindFollowGroupDb(engine)
cloudIssuanceUserRobotBindFollowGroups, err := superCloudIssuanceUserRobotBindFollowGroupDb.GetCloudIssuanceUserRobotBindFollowGroupByBindId(bindId)
if err != nil {
fmt.Println("DealCallBack_err::::", err.Error())
return
}
for _, cloudIssuanceUserRobotBindFollowGroup := range cloudIssuanceUserRobotBindFollowGroups {
cloudIssuanceService.Set(nil, enum.RobotMacSendEmojiMethodName, "127.0.0.1")
err = cloudIssuanceService.RobotMacSendEmoji(md.RobotMacSendEmojiRequest{
RobotId: req.RobotId,
WxId: cloudIssuanceUserRobotBindFollowGroup.FollowChatRoomId,
ImageMd5: md5Matches[1],
ImageSize: lenMatches[1],
})
if err != nil {
fmt.Println("DealCallBack_err::::", err.Error())
return
}
}
}
break
}
}
}
@@ -351,6 +406,68 @@ func (dealSuperCloudIssuanceCallBackService *DealSuperCloudIssuanceCallBackServi
}
}
break
case 20:
if req.Data.MsgType == "47" {
//TODO::表情
//解析 content 中的xml 数据
// 编译正则表达式
// 注意:这里假设md5和len属性只会出现一次,并且格式如上所述
md5Regex := regexp.MustCompile(`md5="([^"]*)"`)
lenRegex := regexp.MustCompile(`len\s*=\s*"([^"]*)"`)
// 查找md5
md5Matches := md5Regex.FindStringSubmatch(req.Data.Content)
if len(md5Matches) > 1 {
fmt.Println("md5:", md5Matches[1])
} else {
fmt.Println("md5 not found")
return
}
// 查找len
lenMatches := lenRegex.FindStringSubmatch(req.Data.Content)
if len(lenMatches) > 1 {
fmt.Println("len:", lenMatches[1])
} else {
fmt.Println("len not found")
return
}
//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 {
group, err6 := superCloudIssuanceUserRobotWithActivateGroupDb.GetSuperCloudIssuanceUserRobotWithActivateGroup(superCloudIssuanceUserRobotBindSourceFollowGroup.FollowActivateGroupId)
if err6 != nil {
fmt.Println("DealSourceGroupMessage_Err:::::", err6.Error())
return err
}
if group == nil {
fmt.Println("DealSourceGroupMessage_Err:::::", "未查询到激活群记录")
return errors.New("未查询到激活群记录")
}
if group.State != 1 {
continue
}

superCloudIssuanceUserRobotDb := implement.NewSuperCloudIssuanceUserRobotDb(engine, superCloudIssuanceUserRobotBindSourceFollowGroup.Uid, dealSuperCloudIssuanceCallBackService.Context.GetString("mid"))
robot, _ := superCloudIssuanceUserRobotDb.GetSuperCloudIssuanceUserRobot()
if robot != nil {
cloudIssuanceService.Set(nil, enum.RobotMacSendEmojiMethodName, "127.0.0.1")
err5 := cloudIssuanceService.RobotMacSendEmoji(md.RobotMacSendEmojiRequest{
RobotId: robot.RobotId,
WxId: superCloudIssuanceUserRobotBindSourceFollowGroup.FollowChatRoomId,
ImageMd5: md5Matches[1],
ImageSize: lenMatches[1],
})
if err5 != nil {
fmt.Println("DealCallBack_err::::", err5.Error())
return
}
}
}
}
break
}
}



Notiek ielāde…
Atcelt
Saglabāt