@@ -7,6 +7,7 @@ import ( | |||
"applet/app/utils/logx" | |||
"applet/consume/md" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||
db2 "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" | |||
"encoding/json" | |||
@@ -162,12 +163,23 @@ func handleCanalGuideOrderForNumericalStatementTable(msg []byte) error { | |||
placeOrderNumOfPeopleValue := decimal.NewFromInt(int64(placeOrderNumOfPeople)) | |||
customerUnitPrice = paymentTotalValue.Div(placeOrderNumOfPeopleValue).String() //客单价 | |||
} | |||
if masterId == 24336737 { | |||
db.Db.InsertOne(models.GuideOrderForNumericalStatementLog{ | |||
MasterId: utils.IntToStr(masterId), | |||
Data: utils.SerializeStr(canalMsg.Data), | |||
UpdateFieldName: "", | |||
OldValue: "", | |||
NowValue: item.State, | |||
Kind: 1, | |||
CreateAt: now.Format("2006-01-02 15:04:05"), | |||
}) | |||
} | |||
isUpdate = true | |||
} | |||
} | |||
if canalMsg.Type == md.CanalMsgUpdateSqlType { | |||
judgeSate := JudgeSate(*canalMsg) | |||
judgeSate := JudgeSate(*canalMsg, utils.IntToStr(masterId)) | |||
if judgeSate > 0 { | |||
if judgeSate == 2 { | |||
//TODO::未收货失效 | |||
@@ -260,7 +272,7 @@ func SecondsUntilTomorrow(now time.Time) int64 { | |||
} | |||
// JudgeSate 处理订单状态(judgeSate[0:不需要处理 1:收货 2:未收货失效 3:已收货失效]) | |||
func JudgeSate(message md.CanalGuideOrderMessage[md.CanalGuideOrder]) (judgeSate int) { | |||
func JudgeSate(message md.CanalGuideOrderMessage[md.CanalGuideOrder], masterId string) (judgeSate int) { | |||
oldData := message.Old | |||
//1、获取 旧的订单状态 | |||
@@ -302,5 +314,18 @@ func JudgeSate(message md.CanalGuideOrderMessage[md.CanalGuideOrder]) (judgeSate | |||
return 3 | |||
} | |||
} | |||
if masterId == "24336737" { | |||
db.Db.InsertOne(models.GuideOrderForNumericalStatementLog{ | |||
MasterId: masterId, | |||
Data: utils.SerializeStr(message), | |||
UpdateFieldName: "state", | |||
OldValue: oldOrdState, | |||
NowValue: nowOrdState, | |||
Kind: 2, | |||
CreateAt: time.Now().Format("2006-01-02 15:04:05"), | |||
}) | |||
} | |||
return | |||
} |
@@ -87,14 +87,13 @@ func initConsumes() { | |||
//////////////////////////////////////// oneCircles ///////////////////////////////////////////////////// | |||
//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.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume | |||
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.OneCirclesSignInUpdateRecordsGreenEnergyFunName] = OneCirclesSignInUpdateRecordsGreenEnergyConsume | |||
//////////////////////////////////////// withdraw ///////////////////////////////////////////////////// | |||
//jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume | |||
@@ -108,8 +107,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 | |||
@@ -562,12 +562,12 @@ var RabbitMqQueueKeyList = []*MqQueue{ | |||
}, | |||
{ | |||
ExchangeName: "one.circles", | |||
Name: "one_circles_sign_in_green_energy_copy", | |||
Name: "one_circles_sign_in_update_records", | |||
Type: TopicQueueType, | |||
IsPersistent: false, | |||
RoutKey: "sign_in_copy", | |||
RoutKey: "sign_in_update_records", | |||
BindKey: "", | |||
ConsumeFunName: "OneCirclesSignInCopyGreenEnergyConsume", | |||
ConsumeFunName: "OneCirclesSignInUpdateRecordsGreenEnergyConsume", | |||
}, | |||
{ | |||
ExchangeName: "zhios.app.user.withdraw.apply.exchange", | |||
@@ -661,8 +661,8 @@ const ( | |||
MallAddSupplyGoodsFunName = "MallAddSupplyGoodsConsume" | |||
CanalUserVirtualCcoinFlowFunName = "CanalUserVirtualCoinFlowConsume" | |||
OneCirclesSignInGreenEnergyFunName = "OneCirclesSignInGreenEnergyConsume" | |||
OneCirclesSignInUpdateRecordsGreenEnergyFunName = "OneCirclesSignInUpdateRecordsGreenEnergyConsume" | |||
OneCirclesStartLevelDividendFunName = "OneCirclesStartLevelDividendConsume" | |||
OneCirclesSignInCopyGreenEnergyFunName = "OneCirclesSignInCopyGreenEnergyConsume" | |||
OneCirclesActivityCoinAutoExchangeGreenEnergyFunName = "OneCirclesActivityCoinAutoExchangeGreenEnergyConsume" | |||
OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName = "OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume" | |||
OneCirclesSettlementPublicGiveActivityCoinFunName = "OneCirclesSettlementPublicGiveActivityCoinConsume" | |||
@@ -25,7 +25,7 @@ func OneCirclesSignInGreenEnergyConsume(queue md.MqQueue) { | |||
//1、将自己绑定到交换机上 | |||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||
//2、取出数据进行消费 | |||
ch.Qos(5) | |||
ch.Qos(10) | |||
delivery := ch.Consume(queue.Name, false) | |||
one_circles.Init(cfg.RedisAddr) | |||
@@ -35,7 +35,7 @@ func OneCirclesSignInGreenEnergyConsume(queue md.MqQueue) { | |||
for { | |||
res, ok = <-delivery | |||
if ok == true { | |||
err = handleOneCirclesSignInGreenEnergy(res.Body) | |||
err = handleOneCirclesSignInGreenEnergy(ch, res.Body) | |||
if err != nil { | |||
fmt.Println("err ::: ", err) | |||
utils.FilePutContents("OneCirclesSignInGreenEnergyConsume_ERR", "[err]:"+err.Error()) | |||
@@ -55,7 +55,7 @@ func OneCirclesSignInGreenEnergyConsume(queue md.MqQueue) { | |||
fmt.Println("get msg done") | |||
} | |||
func handleOneCirclesSignInGreenEnergy(msgData []byte) error { | |||
func handleOneCirclesSignInGreenEnergy(ch *rabbit.Channel, msgData []byte) error { | |||
//1、解析mq中queue的数据结构体 | |||
var msg *md.OneCirclesStructForSignIn | |||
err := json.Unmarshal(msgData, &msg) | |||
@@ -64,7 +64,7 @@ func handleOneCirclesSignInGreenEnergy(msgData []byte) error { | |||
} | |||
engine := db.DBs[msg.MasterId] | |||
err = one_circles.HandleSettlementSignInGreenEnergy(engine, msg.MasterId, msg.Id, msg.Uid, msg.EndTime) | |||
err = one_circles.HandleSettlementSignInGreenEnergy(ch, engine, msg.MasterId, msg.Id, msg.Uid, msg.EndTime) | |||
fmt.Println("err::::", err) | |||
if err != nil { | |||
return err | |||
@@ -6,6 +6,8 @@ import ( | |||
"applet/app/utils/logx" | |||
"applet/consume/md" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" | |||
md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles" | |||
"encoding/json" | |||
"errors" | |||
@@ -13,8 +15,8 @@ import ( | |||
"github.com/streadway/amqp" | |||
) | |||
func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) { | |||
fmt.Println(">>>>>>>>>>>>OneCirclesSignInCopyGreenEnergyConsume>>>>>>>>>>>>") | |||
func OneCirclesSignInUpdateRecordsGreenEnergyConsume(queue md.MqQueue) { | |||
fmt.Println(">>>>>>>>>>>>OneCirclesSignInUpdateRecordsGreenEnergyConsume>>>>>>>>>>>>") | |||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||
if err != nil { | |||
logx.Error(err) | |||
@@ -24,7 +26,7 @@ func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) { | |||
//1、将自己绑定到交换机上 | |||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||
//2、取出数据进行消费 | |||
ch.Qos(1) | |||
ch.Qos(10) | |||
delivery := ch.Consume(queue.Name, false) | |||
one_circles.Init(cfg.RedisAddr) | |||
@@ -34,9 +36,9 @@ func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) { | |||
for { | |||
res, ok = <-delivery | |||
if ok == true { | |||
err = handleOneCirclesSignInCopyGreenEnergy(res.Body) | |||
err = handleOneCirclesSignInUpdateRecordsGreenEnergyConsume(res.Body) | |||
if err != nil { | |||
fmt.Println("OneCirclesSignInCopyGreenEnergyConsume_ERR:::::", err.Error()) | |||
fmt.Println("OneCirclesSignInUpdateRecordsGreenEnergyConsume_ERR:::::", err.Error()) | |||
} | |||
//_ = res.Reject(false) | |||
err = res.Ack(true) | |||
@@ -48,18 +50,17 @@ func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) { | |||
fmt.Println("get msg done") | |||
} | |||
func handleOneCirclesSignInCopyGreenEnergy(msgData []byte) error { | |||
func handleOneCirclesSignInUpdateRecordsGreenEnergyConsume(msgData []byte) error { | |||
//1、解析mq中queue的数据结构体 | |||
var msg *md.OneCirclesStructForSignIn | |||
var msg *md2.UpdateOneCirclesStructForSignInRecords | |||
err := json.Unmarshal(msgData, &msg) | |||
if err != nil { | |||
return err | |||
} | |||
engine := db.DBs[msg.MasterId] | |||
err = one_circles.HandleSettlementSignInGreenEnergy(engine, msg.MasterId, msg.Id, msg.Uid, msg.EndTime) | |||
fmt.Println("err::::", err) | |||
engine := db.DBs["31585332"] | |||
_, err = engine.Where("id =?", msg.Id).Update(&model.OneCirclesGreenEnergySignIn{IsCompleted: 1}) | |||
if err != nil { | |||
fmt.Println("err::::", err) | |||
return err | |||
} | |||
return nil | |||
@@ -9,10 +9,10 @@ require ( | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240607091816-3df1433a2f0d | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.0 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240719082936-c249de79edce | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240726111757-07ae15a5b8fc | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git v1.6.2-0.20231116085701-9ba6e19f877b | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240726130422-c172a5cbb7f5 | |||
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240724040702-a331e3a17921 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240725031213-6f248783bdec | |||
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240726093338-fed880ca12ce | |||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | |||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 | |||
github.com/boombuler/barcode v1.0.1 | |||