diff --git a/app/db/model/mall_ord.go b/app/db/model/mall_ord.go index 78756da..22b3e74 100644 --- a/app/db/model/mall_ord.go +++ b/app/db/model/mall_ord.go @@ -101,4 +101,8 @@ type MallOrd struct { Platform string `json:"platform" xorm:" default '' comment('') VARCHAR(255)"` PayDiscountMoney string `json:"pay_discount_money" xorm:"default '0.00' comment('供应链同一商家总运费') DECIMAL(12,2)"` IsDeductDiscount int `json:"is_deduct_discount" xorm:"comment('') INT(11)"` + IsShareMoney int `json:"is_share_money" xorm:"default 0 comment('') INT(11)"` + PayOid string `json:"pay_oid" xorm:" default '' comment('') VARCHAR(255)"` + ShareMoneyOid string `json:"share_money_oid" xorm:" default '' comment('') VARCHAR(255)"` + MerchantNo string `json:"merchant_no" xorm:" default '' comment('') VARCHAR(255)"` } diff --git a/app/db/model/yibao_share_money.go b/app/db/model/yibao_share_money.go new file mode 100644 index 0000000..7bc2b1f --- /dev/null +++ b/app/db/model/yibao_share_money.go @@ -0,0 +1,19 @@ +package model + +type YibaoShareMoney struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Oid string `json:"oid" xorm:"VARCHAR(255)"` + PayOid string `json:"pay_oid" xorm:"VARCHAR(255)"` + Msg string `json:"msg" xorm:"TEXT"` + StoreMoney string `json:"store_money" xorm:"default 0.00 DECIMAL(20,2)"` + ZhiyingMoney string `json:"zhiying_money" xorm:"default 0.00 DECIMAL(20,2)"` + PlatformMoney string `json:"platform_money" xorm:"default 0.00 DECIMAL(20,2)"` + Platform string `json:"platform" xorm:"VARCHAR(255)"` + PayMethod string `json:"pay_method" xorm:"VARCHAR(255)"` + Status string `json:"status" xorm:"VARCHAR(255)"` + EndOid string `json:"end_oid" xorm:"VARCHAR(255)"` + EndMsg string `json:"end_msg" xorm:"TEXT"` + EndStatus string `json:"end_status" xorm:"VARCHAR(255)"` + Param string `json:"param" xorm:"TEXT"` + EndParam string `json:"end_param" xorm:"TEXT"` +} diff --git a/cloud_issuance/svc/svc_deal_call_back.go b/cloud_issuance/svc/svc_deal_call_back.go index 2b3ecd1..4f1a322 100644 --- a/cloud_issuance/svc/svc_deal_call_back.go +++ b/cloud_issuance/svc/svc_deal_call_back.go @@ -2,13 +2,10 @@ package svc import ( "applet/app/cfg" - db2 "applet/app/db" - "applet/app/svc" "applet/app/utils" "applet/cloud_issuance/db" "applet/cloud_issuance/enum" "applet/cloud_issuance/md" - "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/chain_transfer" cache2 "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils/cache" "fmt" "github.com/gin-gonic/gin" @@ -63,11 +60,6 @@ func (dealCloudIssuanceCallBackService *DealCloudIssuanceCallBackService) DealCa utils.FilePutContents("cloud", utils.SerializeStr(args)) randInt := utils.RandIntRand(10, 100) time.Sleep(time.Millisecond * time.Duration(randInt)) // 等待10 ~ 100毫秒 - chain := chain_transfer.TurnChain(svc.MasterDb(c), db2.Db, args) - utils.FilePutContents("cloud_resp", utils.SerializeStr(chain)) - if chain.Count != "" { - req.Data.Content = chain.Count - } } utils.FilePutContents("cloud", req.Data.Content) err = cloudIssuanceService.RobotMacSendText(md.RobotMacSendTextRequest{ diff --git a/consume/init.go b/consume/init.go index 8646f0e..049aabf 100644 --- a/consume/init.go +++ b/consume/init.go @@ -17,86 +17,8 @@ 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.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal - //jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy - //jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle - //// - //jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder - //jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder - // - //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 - // - - ////////////////////////////////////// V1 ///////////////////////////////////////////////////// - //jobs[consumeMd.CloudIssuanceMsgCallBackFunName] = CloudIssuanceMsgCallBackConsume - - //////////////////////////////////////// V2 ///////////////////////////////////////////////////// - //jobs[consumeMd.SupplyCloudChainFenxiaoNewChangeFunName] = SupplyCloudChainFenxiaoNewChangeConsume - - //////////////////////////////////////// V3 ///////////////////////////////////////////////////// - //jobs[consumeMd.MallAddSupplyGoodsFunName] = MallAddSupplyGoodsConsume - - //////////////////////////////////////// bigData ///////////////////////////////////////////////////// - //jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume - //jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume - //jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume - //jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume - - //////////////////////////////////////// oneCircles ///////////////////////////////////////////////////// - //jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume - //jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume - //jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume - - //////////////////////////////////////// withdraw ///////////////////////////////////////////////////// - //jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume - - //jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分 - - //一个橘子 - jobs[consumeMd.CancalUserMoneyConsumeFunName] = CancalUserMoneyConsume //余额 - jobs[consumeMd.CancalUserRelateConsumeFunName] = CancalUserRelateConsume //推荐人数 - jobs[consumeMd.CancalUserIntegralExchangeConsumeFunName] = CancalUserIntegralExchange //兑换 - jobs[consumeMd.ZhiosTaskRewardConsumeFunName] = ZhiosTaskRewardExchange //兑换 - jobs[consumeMd.CanalOneOrengeUserVirtualCcoinFlowFunName] = CanalOneOrengeUserVirtualCoinFlowConsume - jobs[consumeMd.ZhiosTaskVideoRewardConsumeFunName] = ZhiosTaskVideoRewardExchange //视频分佣 - jobs[consumeMd.ZhiosNewVideoRewardConsumeFunName] = ZhiosNewVideoRewardExchange //短视频奖励 - jobs[consumeMd.ZhiosRelateRewardConsumeFunName] = ZhiosRelateRewardExchange //分佣结算 - jobs[consumeMd.ZhiosOwnNewVideoRewardConsumeFunName] = ZhiosOwnNewVideoRewardExchange //短视频奖励 + jobs[consumeMd.ZhiosYibao0rderShareMoneyMallExchange] = ZhiosYibao0rderShareMoneyMallExchange //自营订单 } diff --git a/consume/md/consume_key.go b/consume/md/consume_key.go index 7ec8ed9..6ff1ba2 100644 --- a/consume/md/consume_key.go +++ b/consume/md/consume_key.go @@ -12,568 +12,16 @@ type MqQueue struct { var RabbitMqQueueKeyList = []*MqQueue{ { - ExchangeName: "", - Name: "cloud_issuance_async_mlogin", - Type: SimpleQueueType, - IsPersistent: false, - RoutKey: "", - BindKey: "", - ConsumeFunName: "CloudIssuanceAsyncMLoginConsume", - }, - { - ExchangeName: "zhios.cloud.issuance.msg.callback.exchange", - Name: "cloud_issuance_msg_call_back", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "", - BindKey: "", - ConsumeFunName: "CloudIssuanceMsgCallBackConsume", - }, - { - ExchangeName: "zhios.cloud_chain.fenxiao.newChange.exchange", - Name: "cloud_chain_fenxiao_newChange", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "", - BindKey: "", - ConsumeFunName: "SupplyCloudChainFenxiaoNewChangeConsume", - }, - { - ExchangeName: "zhios.addSupplyGoods.exchange", - Name: "mall_add_supply_goods", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "", - BindKey: "", - ConsumeFunName: "MallAddSupplyGoodsConsume", - }, - { - ExchangeName: "canal.topic", - Name: "canal_order", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_mall_order", - BindKey: "", - ConsumeFunName: "CanalOrderConsume", - }, - { - ExchangeName: "canal.topic", - Name: "canal_guide_order", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_order_list", - BindKey: "", - ConsumeFunName: "CanalGuideOrderConsume", - }, - { - ExchangeName: "canal.topic", - Name: "canal_guide_order_by_user_up_lv", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_order_list", - BindKey: "", - ConsumeFunName: "CanalGuideOrderByUserUpLvConsume", - }, - { - ExchangeName: "zhios.app.user.visit.ip.address.exchange", - Name: "zhios_user_visit_ip_address_queue", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "queue_one", - BindKey: "", - ConsumeFunName: "ZhiOsUserVisitIpAddressConsume", - }, - { - ExchangeName: "zhios.order.fast.return.exchange", - Name: "zhios_fast_return_order_pay", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_pay", - BindKey: "", - ConsumeFunName: "ZhiosFastReturnOrderPay", - }, - { - ExchangeName: "zhios.order.fast.return.exchange", - Name: "zhios_fast_return_order_success", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_success", - BindKey: "", - ConsumeFunName: "ZhiosFastReturnOrderSuccess", - }, - { - ExchangeName: "zhios.order.fast.return.exchange", - Name: "zhios_fast_return_order_refund", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_refund", - BindKey: "", - ConsumeFunName: "ZhiosFastReturnOrderRefund", - }, - { - ExchangeName: "zhios.order.fast.return.exchange", - Name: "zhios_fast_return_order_refund_second", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_refund_second", - BindKey: "", - ConsumeFunName: "ZhiosFastReturnOrderRefundSecond", - }, - { - ExchangeName: "zhios.doushen.user.register.exchange", - Name: "zhios_doushen_user_register_my_fans", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "my_fans", - BindKey: "my_fans", - ConsumeFunName: "DouShenUserRegisterConsumeForMyFans", - }, - { - ExchangeName: "zhios.doushen.user.register.exchange", - Name: "zhios_doushen_user_register_operation_center", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "operation_center", - BindKey: "operation_center", - ConsumeFunName: "DouShenUserRegisterConsumeForOperationCenter", - }, - { - ExchangeName: "zhios.doushen.user.register.exchange", - Name: "zhios_doushen_user_register_my_recommender", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "my_recommender", - BindKey: "my_recommender", - ConsumeFunName: "DouShenUserRegisterConsumeForMyRecommender", - }, - { - ExchangeName: "zhios.doushen.user.register.exchange", - Name: "zhios_doushen_user_register_official", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "official", - BindKey: "official", - ConsumeFunName: "DouShenUserRegisterConsumeForOfficial", - }, - { - ExchangeName: "zhios.doushen.user.register.exchange", - Name: "zhios_doushen_user_register_user_comm_up_lv", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "user_register_comm_up_lv", - BindKey: "user_register_comm_up_lv", - ConsumeFunName: "DouShenUserRegisterConsumeForUserRegisterUpLv", - }, - { - ExchangeName: "canal.topic", - Name: "canal_mall_ord_for_you_mi_shang", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "canal_mall_order", - BindKey: "", - ConsumeFunName: "CanalMallOrdForYouMiShang", - }, - { - ExchangeName: "zhios.youmishang.exchange", - Name: "zhios_youmishang_exchange_store", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "store", - BindKey: "store", - ConsumeFunName: "YoumishangExchangeStore", - }, - { - ExchangeName: "zhios.recharge.order.exchange", - Name: "zhios_recharge_order_fail", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_fail", - BindKey: "", - ConsumeFunName: "ZhiosRechargeOrderFail", - }, - { - ExchangeName: "zhios.tikTok.exchange", - Name: "zhios_tikTok_update", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "update", - BindKey: "", - ConsumeFunName: "ZhiosTikTokUpdate", - }, - { - ExchangeName: "zhios.tikTok.exchange", - Name: "zhios_tikTok_all_update", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "all_update", - BindKey: "", - ConsumeFunName: "ZhiosTikTokAllUpdate", - }, - { - ExchangeName: "zhios.capital_pool.order_total.exchange", - Name: "zhios_capital_pool_order_total", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_total", - BindKey: "", - ConsumeFunName: "ZhiosCapitalPoolOrderTotal", - }, - { - ExchangeName: "zhios.acquisition.exchange", - Name: "zhios_acquisition_condition", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "condition", - BindKey: "", - ConsumeFunName: "ZhiosAcquisitionCondition", - }, - { - ExchangeName: "zhios.acquisition.exchange", - Name: "zhios_acquisition_condition_dev", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "acq_dev", - BindKey: "", - ConsumeFunName: "ZhiosAcquisitionConditionDev", - }, - { - ExchangeName: "zhios.recharge.order.exchange", - Name: "zhios_recharge_order_fail_dev", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_fail_dev", - BindKey: "", - ConsumeFunName: "ZhiosRechargeOrderFailDev", - }, - { - ExchangeName: "zhios.express.order.exchange", - Name: "zhios_express_order_fail", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_fail", - BindKey: "", - ConsumeFunName: "zhiosExpressOrderFail", - }, - { - ExchangeName: "zhios.withdraw.reward.exchange", - Name: "zhios_withdraw_reward", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "withdraw_reward", - BindKey: "", - ConsumeFunName: "zhiosWithdrawReward", - }, - { - ExchangeName: "zhios.user_valid.exchange", - Name: "zhios_user_valid", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "user_valid", - BindKey: "", - ConsumeFunName: "ZhiosValidUser", - }, - { - ExchangeName: "zhios.appreciation.exchange", - Name: "zhios_appreciation", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "appreciation", - BindKey: "", - ConsumeFunName: "ZhiosAppreciation", - }, - { - ExchangeName: "zhios.appreciation.exchange", - Name: "zhios_appreciation_dev", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "appreciation_dev", - BindKey: "", - ConsumeFunName: "ZhiosAppreciationDev", - }, - { - ExchangeName: "zhios.guide_store.exchange", - Name: "zhios_guide_store_order", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "guide_store_order", - BindKey: "", - ConsumeFunName: "ZhiosGuideStoreOrder", - }, - { - ExchangeName: "zhios.supplier_after_order.exchange", - Name: "zhios_supplier_after_order", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "refund", - BindKey: "", - ConsumeFunName: "ZhiosSupplierAfterOrder", - }, - { - ExchangeName: "zhios.order_buckle.exchange", - Name: "zhios_order_buckle", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_buckle", - BindKey: "", - ConsumeFunName: "ZhiosOrderBuckle", - }, - { - ExchangeName: "zhios.order_hjy.exchange", - Name: "zhios_order_hjy", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_hjy", - BindKey: "", - ConsumeFunName: "ZhiosOrderHjy", - }, - { - ExchangeName: "zhios.order_settle_total.exchange", - Name: "zhios_order_settle_total", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_settle_total", - BindKey: "", - ConsumeFunName: "ZhiosOrderSettleTotal", - }, - { - ExchangeName: "zhios.order_total.exchange", - Name: "zhios_order_total", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_total", - BindKey: "", - ConsumeFunName: "ZhiosOrderTotal", - }, - { - ExchangeName: "zhios.order_total.exchange", - Name: "zhios_order_total_second", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_total_second", - BindKey: "", - ConsumeFunName: "ZhiosOrderTotalSecond", - }, - { - ExchangeName: "zhios.order_free.exchange", - Name: "zhios_order_free", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "order_free", - BindKey: "", - ConsumeFunName: "ZhiosOrderFree", - }, - { - ExchangeName: "zhios.user_up_lv.exchange", - Name: "zhios_user_up_lv", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "user_up_lv", - BindKey: "", - ConsumeFunName: "ZhiosUserUpLv", - }, - { - ExchangeName: "zhios.integral_proxy_recharge.exchange", - Name: "zhios_integral_proxy_recharge", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "integral_proxy_recharge", - BindKey: "", - ConsumeFunName: "ZhiosIntegralProxyRecharge", - }, - { - ExchangeName: "zhios.mall_green_coin_consume.exchange", - Name: "zhios_mall_green_coin_consume", - Type: DirectQueueType, - IsPersistent: false, - RoutKey: "mall_green_coin_consume", - BindKey: "", - ConsumeFunName: "ZhiosMallGreenCoinConsume", - }, - { - ExchangeName: "canal.topic", - Name: "canal_user_virtual_coin_flow", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_user_virtual_coin_flow", - BindKey: "", - ConsumeFunName: "CanalUserVirtualCoinFlowConsume", - }, - { - ExchangeName: "canal.topic", - Name: "canal_user_virtual_coin_flow_15763466", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_user_virtual_coin_flow_15763466", - BindKey: "", - ConsumeFunName: "CanalOneOrengeUserVirtualCoinFlowConsume", - }, - { - ExchangeName: "one.circles", - Name: "one_circles_sign_in_green_energy", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "sign_in", - BindKey: "", - ConsumeFunName: "OneCirclesSignInGreenEnergyConsume", - }, - { - ExchangeName: "one.circles", - Name: "one_circles_start_level_dividend", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "star_level_dividend", - BindKey: "", - ConsumeFunName: "OneCirclesStartLevelDividendConsume", - }, - { - ExchangeName: "one.circles", - Name: "one_circles_sign_in_green_energy_copy", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "sign_in_copy", - BindKey: "", - ConsumeFunName: "OneCirclesSignInCopyGreenEnergyConsume", - }, - { - ExchangeName: "zhios.app.user.withdraw.apply.exchange", - Name: "zhios_app_user_withdraw_apply_queue", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "queues_one", - BindKey: "", - ConsumeFunName: "WithdrawConsume", - }, - { - ExchangeName: "zhios.one.orenge.exchange", - Name: "zhios_one_orenge_exchange", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "integral_exchange", - BindKey: "", - ConsumeFunName: "CancalUserIntegralExchange", - }, - { - ExchangeName: "zhios.one_orenge_task_reward.exchange", - Name: "zhios_one_orenge_task_reward", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "task_reward", - BindKey: "", - ConsumeFunName: "ZhiosTaskRewardExchange", - }, - { - ExchangeName: "zhios.relate_reward.exchange", - Name: "zhios_relate_reward", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "relate_reward", - BindKey: "", - ConsumeFunName: "ZhiosRelateRewardExchange", - }, - { - ExchangeName: "zhios.task_video_reward.exchange", - Name: "zhios_task_video_reward", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "task_video_reward", - BindKey: "", - ConsumeFunName: "ZhiosTaskVideoRewardExchange", - }, - { - ExchangeName: "zhios.new_video_reward.exchange", - Name: "zhios_new_video_reward", + ExchangeName: "zhios.yibao_order_share_money.exchange", + Name: "zhios_yibao_order_share_money_mall", Type: FanOutQueueType, IsPersistent: false, - RoutKey: "new_video_reward", + RoutKey: "mall", BindKey: "", - ConsumeFunName: "ZhiosNewVideoRewardExchange", - }, - { - ExchangeName: "zhios.new_video_reward.exchange", - Name: "zhios_own_new_video_reward", - Type: FanOutQueueType, - IsPersistent: false, - RoutKey: "own_new_video_reward", - BindKey: "", - ConsumeFunName: "ZhiosOwnNewVideoRewardExchange", - }, - { - ExchangeName: "canal.topic", // - Name: "canal_fin_user_flow", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_fin_user_flow", - BindKey: "", - ConsumeFunName: "CancalUserMoneyConsume", - }, - { - ExchangeName: "canal.topic", // - Name: "canal_user_relate", - Type: TopicQueueType, - IsPersistent: false, - RoutKey: "canal_user_relate", - BindKey: "", - ConsumeFunName: "CancalUserRelateConsume", + ConsumeFunName: "ZhiosYibao0rderShareMoneyMallExchange", }, } const ( - ZhiosUserRelateFunName = "ZhiosUserRelate" - ZhiosIntegralProxyRechargeFunName = "ZhiosIntegralProxyRecharge" - ZhiosMallGreenCoinConsumeFunName = "ZhiosMallGreenCoinConsume" - ZhiosUserUpLvFunName = "ZhiosUserUpLv" - CanalGuideOrderByUserUpLvConsume = "CanalGuideOrderByUserUpLvConsume" - ZhiosOrderFreeFunName = "ZhiosOrderFree" - ZhiosOrderSettleTotalFunName = "ZhiosOrderSettleTotal" - ZhiosOrderTotalFunName = "ZhiosOrderTotal" - ZhiosOrderTotalSecondFunName = "ZhiosOrderTotalSecond" - ZhiosOrderHjyFunName = "ZhiosOrderHjy" - ZhiosOrderBuckleFunName = "ZhiosOrderBuckle" - ZhiosSupplierAfterOrderFunName = "ZhiosSupplierAfterOrder" - CanalOrderConsumeFunName = "CanalOrderConsume" - CanalGuideOrderConsumeFunName = "CanalGuideOrderConsume" - ZhiOsUserVisitIpAddressConsumeFunName = "ZhiOsUserVisitIpAddressConsume" - DouShenUserRegisterConsumeForOfficialFunName = "DouShenUserRegisterConsumeForOfficial" - DouShenUserRegisterConsumeForOperationCenterFunName = "DouShenUserRegisterConsumeForOperationCenter" - DouShenUserRegisterConsumeForMyRecommenderFunName = "DouShenUserRegisterConsumeForMyRecommender" - DouShenUserRegisterConsumeForMyFansFunName = "DouShenUserRegisterConsumeForMyFans" - DouShenUserRegisterConsumeForUserRegisterUpLvFunName = "DouShenUserRegisterConsumeForUserRegisterUpLv" - ZhiosFastReturnOrderPayFunName = "ZhiosFastReturnOrderPay" - ZhiosFastReturnOrderSuccessFunName = "ZhiosFastReturnOrderSuccess" - ZhiosFastReturnOrderRefundFunName = "ZhiosFastReturnOrderRefund" - ZhiosFastReturnOrderRefundSecondFunName = "ZhiosFastReturnOrderRefundSecond" - CanalMallOrdForYouMiShangFunName = "CanalMallOrdForYouMiShang" - YoumishangExchangeStoreFunName = "YoumishangExchangeStore" - ZhiosRechargeOrderFailFunName = "ZhiosRechargeOrderFail" - ZhiosRechargeOrderFailDevFunName = "ZhiosRechargeOrderFailDev" - ZhiosCapitalPoolOrderTotalFunName = "ZhiosCapitalPoolOrderTotal" - ZhiosExpressOrderFail = "zhiosExpressOrderFail" - ZhiosWithdrawReward = "zhiosWithdrawReward" - ZhiosTikTokUpdateFunName = "ZhiosTikTokUpdate" - ZhiosTikTokAllUpdateFunName = "ZhiosTikTokAllUpdate" - CloudIssuanceAsyncMLoginFunName = "CloudIssuanceAsyncMLoginConsume" - CloudIssuanceMsgCallBackFunName = "CloudIssuanceMsgCallBackConsume" - ZhiosAcquisitionConditionFunName = "ZhiosAcquisitionCondition" - ZhiosValidUserFunName = "ZhiosValidUser" - ZhiosAppreciationFunName = "ZhiosAppreciation" - ZhiosAppreciationDevFunName = "ZhiosAppreciationDev" - ZhiosGuideStoreOrderFunName = "ZhiosGuideStoreOrder" - ZhiosAcquisitionConditionDevFunName = "ZhiosAcquisitionConditionDev" - SupplyCloudChainFenxiaoNewChangeFunName = "SupplyCloudChainFenxiaoNewChangeConsume" - MallAddSupplyGoodsFunName = "MallAddSupplyGoodsConsume" - CanalUserVirtualCcoinFlowFunName = "CanalUserVirtualCoinFlowConsume" - OneCirclesSignInGreenEnergyFunName = "OneCirclesSignInGreenEnergyConsume" - OneCirclesStartLevelDividendFunName = "OneCirclesStartLevelDividendConsume" - OneCirclesSignInCopyGreenEnergyFunName = "OneCirclesSignInCopyGreenEnergyConsume" - WithdrawConsumeFunName = "WithdrawConsume" - - CancalUserMoneyConsumeFunName = "CancalUserMoneyConsume" - CancalUserRelateConsumeFunName = "CancalUserRelateConsume" - CancalUserIntegralExchangeConsumeFunName = "CancalUserIntegralExchange" - ZhiosTaskRewardConsumeFunName = "ZhiosTaskRewardExchange" - ZhiosRelateRewardConsumeFunName = "ZhiosRelateRewardExchange" - ZhiosTaskVideoRewardConsumeFunName = "ZhiosTaskVideoRewardExchange" - ZhiosNewVideoRewardConsumeFunName = "ZhiosNewVideoRewardExchange" - ZhiosOwnNewVideoRewardConsumeFunName = "ZhiosOwnNewVideoRewardExchange" - CanalOneOrengeUserVirtualCcoinFlowFunName = "CanalOneOrengeUserVirtualCoinFlowConsume" + ZhiosYibao0rderShareMoneyMallExchange = "ZhiosYibao0rderShareMoneyMallExchange" ) diff --git a/consume/md/md.go b/consume/md/md.go index d88752b..848bb2c 100644 --- a/consume/md/md.go +++ b/consume/md/md.go @@ -7,6 +7,11 @@ type ZhiosAcquisition struct { Mid string `json:"mid"` Id string `json:"id"` } +type ZhiosOrderShareMoney struct { + OrdId string `json:"ord_id"` + Mid string `json:"mid"` + PayWay string `json:"pay_way"` +} type ZhiosTaskReward struct { CoinId string `json:"coin_id"` Money string `json:"money"` diff --git a/consume/yibao_order_share_money_mall.go b/consume/yibao_order_share_money_mall.go new file mode 100644 index 0000000..0e9e546 --- /dev/null +++ b/consume/yibao_order_share_money_mall.go @@ -0,0 +1,197 @@ +package consume + +import ( + "applet/app/db" + "applet/app/db/model" + "applet/app/utils" + "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_third_party_api.git/yibao_pay" + "encoding/json" + "errors" + "fmt" + "github.com/streadway/amqp" + "github.com/tidwall/gjson" + "xorm.io/xorm" +) + +func ZhiosYibao0rderShareMoneyMallExchange(queue md.MqQueue) { + fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>") + ch, err := rabbit.Cfg.Pool.GetChannel() + if err != nil { + logx.Error(err) + return + } + defer ch.Release() + //1、将自己绑定到交换机上 + ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) + //2、取出数据进行消费 + ch.Qos(1) + delivery := ch.Consume(queue.Name, false) + + var res amqp.Delivery + var ok bool + for { + res, ok = <-delivery + if ok == true { + //fmt.Println(string(res.Body)) + fmt.Println(">>>>>>>>>>>>>>>>ZhiosYibao0rderShareMoneyMallExchange<<<<<<<<<<<<<<<<<<<<<<<<<") + err = handleZhiosYibao0rderShareMoneyMallExchange(res.Body) + _ = res.Ack(true) + } else { + panic(errors.New("error getting message")) + } + } + fmt.Println("get msg done") +} + +func handleZhiosYibao0rderShareMoneyMallExchange(msg []byte) error { + //1、解析canal采集至mq中queue的数据结构体 + var canalMsg *md.ZhiosOrderShareMoney + fmt.Println(string(msg)) + var tmpString string + err := json.Unmarshal(msg, &tmpString) + if err != nil { + fmt.Println(err.Error()) + return err + } + fmt.Println(tmpString) + err = json.Unmarshal([]byte(tmpString), &canalMsg) + if err != nil { + return err + } + mid := canalMsg.Mid + eg := db.DBs[mid] + if eg == nil { + return nil + } + var ord = make([]model.MallOrd, 0) + eg.In("state", []string{"1", "2", "3"}).And("pay_oid=?", canalMsg.OrdId).Find(&ord) + if len(ord) == 0 { + return nil + } + payMethod := 0 + var total float64 = 0 + var fee float64 = 0 + uniqueOrderNo := "" + payOid := "" + uid := 0 + MerchantNo := "" + for _, v := range ord { + if v.State != 3 { + return nil + } + uid = v.Uid + uniqueOrderNo = v.TransactionId + payOid = v.PayOid + payMethod = v.PayChannel + MerchantNo = v.MerchantNo + fee = utils.StrToFloat64(v.TotalShippingFee) + total += utils.StrToFloat64(v.CostPrice) + } + total += fee + commShare(eg, payMethod, total, payOid, uniqueOrderNo, MerchantNo, uid) + return nil +} +func commShare(eg *xorm.Engine, payMethod int, total float64, payOid, uniqueOrderNo, MerchantNo string, uid int) { + key := yibao_pay.CommKey(db.Db, true) + zhiyingOnlineBili := utils.StrToFloat64(key["zhiyingOnlineBili"]) - utils.StrToFloat64(key["yibaoOnlineBili"]) + zhiyingUnlineBili := utils.StrToFloat64(key["zhiyingUnlineBili"]) - utils.StrToFloat64(key["yibaoUnlineBili"]) + allBili := utils.StrToFloat64(key["zhiyingUnlineBili"]) / 100 + bili := zhiyingUnlineBili / 100 + if payMethod == 22 { + allBili = utils.StrToFloat64(key["zhiyingOnlineBili"]) / 100 + bili = zhiyingOnlineBili / 100 + } + fee := total * bili + if fee < 0.01 { + fee = 0 + } + param := yibao_pay.CommKey(db.Db, true) + divideDetail := []map[string]string{ + {"amount": utils.Float64ToStr(fee), "ledgerNo": key["zhiyingMerchantNo"]}, + } + req1 := map[string]string{ + "merchantNo": MerchantNo, + "orderId": payOid, + "uniqueOrderNo": uniqueOrderNo, + "divideRequestId": utils.OrderUUID(uid), + "divideDetail": utils.SerializeStr(divideDetail), + } + req3 := req1 + req3["key"] = utils.SerializeStr(key) + req3["bili"] = utils.Float64ToStr(bili) + req3["ledgerNo"] = key["zhiyingMerchantNo"] + var tmp = model.YibaoShareMoney{ + Oid: req1["divideRequestId"], + PayOid: payOid, + StoreMoney: utils.Float64ToStr(total - total*allBili), + ZhiyingMoney: utils.Float64ToStr(total * bili), + Platform: "mall", + PayMethod: utils.IntToStr(payMethod), + Param: utils.SerializeStr(req3), + } + eg.Insert(&tmp) + if fee > 0 { + method := "/rest/v1.0/divide/apply" + send, err := yibao_pay.PostFormSend(method, param["appId"], param["isvPriKey"], req1) + if err != nil || send == nil { + if err != nil { + tmp.Msg = err.Error() + } else { + tmp.Msg = "接口错误" + } + eg.Where("id=?", tmp.Id).Cols("msg").Update(&tmp) + fmt.Println(err) + return + } + res := utils.SerializeStr(send.Result) + fmt.Println(res) + if gjson.Get(res, "code").String() != "OPR00000" { + tmp.Msg = res + eg.Where("id=?", tmp.Id).Cols("msg").Update(&tmp) + return + } + if gjson.Get(res, "status").String() != "SUCCESS" { + tmp.Msg = res + tmp.Status = gjson.Get(res, "status").String() + eg.Where("id=?", tmp.Id).Cols("msg,status").Update(&tmp) + return + } + tmp.Msg = res + tmp.Status = gjson.Get(res, "status").String() + eg.Where("id=?", tmp.Id).Cols("msg,status").Update(&tmp) + } + req2 := map[string]string{ + "merchantNo": MerchantNo, + "orderId": payOid, + "uniqueOrderNo": uniqueOrderNo, + "divideRequestId": req1["divideRequestId"] + "1", + } + tmp.EndOid = req2["divideRequestId"] + tmp.EndParam = utils.SerializeStr(req2) + eg.Where("id=?", tmp.Id).Cols("end_param").Update(&tmp) + method2 := "/rest/v1.0/divide/complete" + send2, err2 := yibao_pay.PostFormSend(method2, param["appId"], param["isvPriKey"], req2) + if err2 != nil || send2 == nil { + if err2 != nil { + tmp.EndMsg = err2.Error() + } else { + tmp.EndMsg = "接口错误" + } + eg.Where("id=?", tmp.Id).Cols("end_msg").Update(&tmp) + return + } + res2 := utils.SerializeStr(send2.Result) + fmt.Println(res2) + if gjson.Get(res2, "code").String() != "OPR00000" { + tmp.EndMsg = res2 + eg.Where("id=?", tmp.Id).Cols("end_msg").Update(&tmp) + return + } + tmp.EndMsg = res2 + tmp.EndStatus = gjson.Get(res2, "divideStatus").String() + eg.Where("id=?", tmp.Id).Cols("end_msg,end_status").Update(&tmp) + return +} diff --git a/go.mod b/go.mod index 534c2e6..8f4a4f7 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( 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.20240722064401-49d2884770db 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.20240126015516-38ca248db2fd + code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20241108004357-6b70a3b89bf2 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 @@ -77,11 +77,14 @@ require ( github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/rakyll/statik v0.1.7 // indirect + github.com/satori/go.uuid v1.2.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect + github.com/yop-platform/yop-go-sdk v0.0.0-20241029152043-ff36040e534a // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/arch v0.3.0 // indirect