浏览代码

Merge remote-tracking branch 'origin/master'

one_orenge
huangjiajun 9 个月前
父节点
当前提交
b435bf934e
共有 4 个文件被更改,包括 75 次插入76 次删除
  1. +1
    -1
      app/db/dbs_map.go
  2. +1
    -1
      consume/canal_guide_order_consume.go
  3. +67
    -69
      consume/canal_order_consume.go
  4. +6
    -5
      consume/init.go

+ 1
- 1
app/db/dbs_map.go 查看文件

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


+ 1
- 1
consume/canal_guide_order_consume.go 查看文件

@@ -31,7 +31,7 @@ func CanalGuideOrderConsume(queue md.MqQueue) {
//1、将自己绑定到交换机上
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey)
//2、取出数据进行消费
ch.Qos(1000)
ch.Qos(500)
delivery := ch.Consume(queue.Name, true) //设置自动应答

geoIp2db, _ := geoip2db.NewGeoipDbByStatik()


+ 67
- 69
consume/canal_order_consume.go 查看文件

@@ -14,8 +14,6 @@ import (
"errors"
"fmt"
"github.com/streadway/amqp"
"regexp"
"strconv"
"strings"
"time"
)
@@ -94,73 +92,73 @@ func CanalOrderConsumev2(queue md.MqQueue) {
}

func CanalOrderConsume(queue md.MqQueue) {
now := time.Now()
var list []model2.Group
err := db.ImDb.Where("master_id = 68823769").And("user_num > ?", 500).Find(&list)
//eg := db.DBs["68823769"]
for _, v := range list {
var groupUsers []model2.GroupUser
var groupLeader model2.GroupUser
err = db.ImDb.Where("group_id = ?", v.Id).And("member_type = 2").Limit(10000, 499).Find(&groupUsers)
db.ImDb.Where("group_id = ?", v.Id).And("member_type = 1").Get(&groupLeader)
//新增一个群
re := regexp.MustCompile("[0-9]+")
num := re.FindAllString(v.Name, -1)[0]
name := strings.Replace(v.Name, num, strconv.Itoa(utils.StrToInt(num)+1), 1)
temGroup := model2.Group{
Name: name,
AvatarUrl: "",
Introduction: "",
UserNum: int32(len(groupUsers)) + 1,
IsAllMemberBanned: 0,
MasterId: v.MasterId,
Extra: "",
CreateTime: now,
UpdateTime: now,
}
_, err := db.ImDb.InsertOne(&temGroup)
if err != nil {
panic(err)
}
groupId := temGroup.Id
//新增群主
_, err = db.ImDb.InsertOne(model2.GroupUser{
GroupId: groupId,
UserId: groupLeader.UserId,
MemberType: 1,
Status: 0,
CreateTime: now.Format("2006-01-02 15:04:05"),
UpdateTime: now.Format("2006-01-02 15:04:05"),
})
if err != nil {
panic(err)
}
for _, groupUser := range groupUsers {
groupUser.GroupId = groupId
db.ImDb.ID(groupUser.Id).Update(groupUser)
}
v.UserNum = 500
db.ImDb.ID(v.Id).Update(v)
var oldDouShenImGroup model.DouShenImGroup
if has, err := db.Db.Where("group_id =?", v.Id).Get(&oldDouShenImGroup); err != nil || has == false {
panic(err)
}
_, err = db.DouShenImGroupInsert(db.Db, &model.DouShenImGroup{
Kind: oldDouShenImGroup.Kind,
Uid: int(oldDouShenImGroup.Uid),
GroupId: int(groupId),
IsFull: 0,
Name: name,
CreateTime: now,
UpdateTime: now,
})
}
return
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>")
//now := time.Now()
//var list []model2.Group
//err := db.ImDb.Where("master_id = 68823769").And("user_num > ?", 500).Find(&list)
////eg := db.DBs["68823769"]
//for _, v := range list {
// var groupUsers []model2.GroupUser
// var groupLeader model2.GroupUser
// err = db.ImDb.Where("group_id = ?", v.Id).And("member_type = 2").Limit(10000, 499).Find(&groupUsers)
// db.ImDb.Where("group_id = ?", v.Id).And("member_type = 1").Get(&groupLeader)
//
// //新增一个群
// re := regexp.MustCompile("[0-9]+")
// num := re.FindAllString(v.Name, -1)[0]
// name := strings.Replace(v.Name, num, strconv.Itoa(utils.StrToInt(num)+1), 1)
// temGroup := model2.Group{
// Name: name,
// AvatarUrl: "",
// Introduction: "",
// UserNum: int32(len(groupUsers)) + 1,
// IsAllMemberBanned: 0,
// MasterId: v.MasterId,
// Extra: "",
// CreateTime: now,
// UpdateTime: now,
// }
// _, err := db.ImDb.InsertOne(&temGroup)
// if err != nil {
// panic(err)
// }
// groupId := temGroup.Id
//
// //新增群主
// _, err = db.ImDb.InsertOne(model2.GroupUser{
// GroupId: groupId,
// UserId: groupLeader.UserId,
// MemberType: 1,
// Status: 0,
// CreateTime: now.Format("2006-01-02 15:04:05"),
// UpdateTime: now.Format("2006-01-02 15:04:05"),
// })
// if err != nil {
// panic(err)
// }
//
// for _, groupUser := range groupUsers {
// groupUser.GroupId = groupId
// db.ImDb.ID(groupUser.Id).Update(groupUser)
// }
// v.UserNum = 500
// db.ImDb.ID(v.Id).Update(v)
// var oldDouShenImGroup model.DouShenImGroup
// if has, err := db.Db.Where("group_id =?", v.Id).Get(&oldDouShenImGroup); err != nil || has == false {
// panic(err)
// }
// _, err = db.DouShenImGroupInsert(db.Db, &model.DouShenImGroup{
// Kind: oldDouShenImGroup.Kind,
// Uid: int(oldDouShenImGroup.Uid),
// GroupId: int(groupId),
// IsFull: 0,
// Name: name,
// CreateTime: now,
// UpdateTime: now,
// })
//}
//
//return
//fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>")
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
logx.Error(err)


+ 6
- 5
consume/init.go 查看文件

@@ -35,9 +35,6 @@ func initConsumes() {
jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser

jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition
jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume
jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume
jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume

jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial
jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter
@@ -61,8 +58,7 @@ func initConsumes() {
jobs[consumeMd.ZhiosCapitalPoolOrderTotalFunName] = ZhiosCapitalPoolOrderTotal
jobs[consumeMd.ZhiosExpressOrderFail] = ZhiosExpressOrderFail
jobs[consumeMd.ZhiosWithdrawReward] = ZhiosWithdrawReward

jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume
//

////////////////////////////////////// V1 /////////////////////////////////////////////////////
//jobs[consumeMd.CloudIssuanceMsgCallBackFunName] = CloudIssuanceMsgCallBackConsume
@@ -73,6 +69,11 @@ func initConsumes() {
//////////////////////////////////////// V3 /////////////////////////////////////////////////////
//jobs[consumeMd.MallAddSupplyGoodsFunName] = MallAddSupplyGoodsConsume

//////////////////////////////////////// bigData /////////////////////////////////////////////////////
//jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume
//jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume
//jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume
//jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume
}

func Run() {


正在加载...
取消
保存