From 658df62a11fbe72b0c955b5a54d4c29bb4b156ec Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 26 Feb 2024 22:17:10 +0800 Subject: [PATCH] update --- app/db/dbs_map.go | 2 +- consume/canal_guide_order_consume.go | 2 +- consume/canal_order_consume.go | 136 +++++++++++++-------------- consume/init.go | 89 +++++++++--------- 4 files changed, 114 insertions(+), 115 deletions(-) diff --git a/app/db/dbs_map.go b/app/db/dbs_map.go index 1d5edcd..693d4ca 100644 --- a/app/db/dbs_map.go +++ b/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) } diff --git a/consume/canal_guide_order_consume.go b/consume/canal_guide_order_consume.go index 454c8bd..c4b60ee 100644 --- a/consume/canal_guide_order_consume.go +++ b/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() diff --git a/consume/canal_order_consume.go b/consume/canal_order_consume.go index 11605b8..379016f 100644 --- a/consume/canal_order_consume.go +++ b/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) diff --git a/consume/init.go b/consume/init.go index 3e88fe5..72edf09 100644 --- a/consume/init.go +++ b/consume/init.go @@ -17,52 +17,48 @@ func Init() { // 增加消费任务队列 func initConsumes() { - jobs[consumeMd.ZhiosIntegralProxyRechargeFunName] = ZhiosIntegralProxyRecharge - jobs[consumeMd.ZhiosUserUpLvFunName] = ZhiosUserUpLv - jobs[consumeMd.CanalGuideOrderByUserUpLvConsume] = CanalGuideOrderByUserUpLvConsume - jobs[consumeMd.ZhiosOrderFreeFunName] = ZhiosOrderFree - jobs[consumeMd.ZhiosOrderTotalFunName] = ZhiosOrderTotal - jobs[consumeMd.ZhiosOrderTotalSecondFunName] = ZhiosOrderTotalSecond + //jobs[consumeMd.ZhiosIntegralProxyRechargeFunName] = ZhiosIntegralProxyRecharge + //jobs[consumeMd.ZhiosUserUpLvFunName] = ZhiosUserUpLv + //jobs[consumeMd.CanalGuideOrderByUserUpLvConsume] = CanalGuideOrderByUserUpLvConsume + //jobs[consumeMd.ZhiosOrderFreeFunName] = ZhiosOrderFree + //jobs[consumeMd.ZhiosOrderTotalFunName] = ZhiosOrderTotal + //jobs[consumeMd.ZhiosOrderTotalSecondFunName] = ZhiosOrderTotalSecond + //// + //jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal + //jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy + //jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle + //// + //jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder + //jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder // - jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal - jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy - jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle + //jobs[consumeMd.ZhiosAppreciationFunName] = ZhiosAppreciation + //jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser + // + //jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition + // + //jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial + //jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter + //jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender + //jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans + //jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv + // + //jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay + //jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess + //jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund + //jobs[consumeMd.ZhiosFastReturnOrderRefundSecondFunName] = ZhiosFastReturnOrderRefundSecond + // + //jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore + // + //jobs[consumeMd.ZhiosRechargeOrderFailFunName] = ZhiosRechargeOrderFail + // + //jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume + //jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate + //jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate + // + //jobs[consumeMd.ZhiosCapitalPoolOrderTotalFunName] = ZhiosCapitalPoolOrderTotal + //jobs[consumeMd.ZhiosExpressOrderFail] = ZhiosExpressOrderFail + //jobs[consumeMd.ZhiosWithdrawReward] = ZhiosWithdrawReward // - jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder - jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder - - jobs[consumeMd.ZhiosAppreciationFunName] = ZhiosAppreciation - 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 - jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender - jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans - jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv - - jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay - jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess - jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund - jobs[consumeMd.ZhiosFastReturnOrderRefundSecondFunName] = ZhiosFastReturnOrderRefundSecond - - jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore - - jobs[consumeMd.ZhiosRechargeOrderFailFunName] = ZhiosRechargeOrderFail - - jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume - jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate - jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate - - 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() {