Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	go.mod
master
huangjiajun 4 months ago
parent
commit
0888120d15
9 changed files with 168 additions and 73 deletions
  1. +1
    -1
      app/db/dbs_map.go
  2. +9
    -9
      app/flexible_employment/db/db_new_flexible_employment_pupiao_ord.go
  3. +7
    -4
      app/flexible_employment/enum/enum_pupiao_api.go
  4. +2
    -3
      app/lib/flexible_employment/new_pupiao.go
  5. +86
    -0
      consume/honey_dividends_consume.go
  6. +49
    -48
      consume/init.go
  7. +10
    -0
      consume/md/consume_key.go
  8. +1
    -5
      consume/withdraw_consume_new_pupiao.go
  9. +3
    -3
      go.mod

+ 1
- 1
app/db/dbs_map.go View File

@@ -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 = ?", 23674801).Find(&m)
Or("db_master_id = ?", 25616402).Find(&m)
} else {
err = Db.Where("deleted_at != ? AND is_dev = '1' ", 1).Find(&m)
}


+ 9
- 9
app/flexible_employment/db/db_new_flexible_employment_pupiao_ord.go View File

@@ -11,31 +11,31 @@ type NewFlexibleEmploymentPupiaoOrdDb struct {
Db *xorm.Engine `json:"model"`
}

func (NewFlexibleEmploymentPupiaoOrdDb *NewFlexibleEmploymentPupiaoOrdDb) Set(masterId string) { // set方法
NewFlexibleEmploymentPupiaoOrdDb.Db = commDb.DBs[masterId]
func (newFlexibleEmploymentPupiaoOrdDb *NewFlexibleEmploymentPupiaoOrdDb) Set(masterId string) { // set方法
newFlexibleEmploymentPupiaoOrdDb.Db = commDb.DBs[masterId]
}

func (NewFlexibleEmploymentPupiaoOrdDb *NewFlexibleEmploymentPupiaoOrdDb) Get(outBatchNo string) (m *model.NewFlexibleEmploymentPupiaoOrd, err error) {
m = new(model.NewFlexibleEmploymentPupiaoOrd)
has, err := NewFlexibleEmploymentPupiaoOrdDb.Db.Where("out_batch_no = ?", outBatchNo).Get(m)
func (newFlexibleEmploymentPupiaoOrdDb *NewFlexibleEmploymentPupiaoOrdDb) Get(outBatchNo string) (*model.NewFlexibleEmploymentPupiaoOrd, error) {
var m model.NewFlexibleEmploymentPupiaoOrd
has, err := newFlexibleEmploymentPupiaoOrdDb.Db.Where("out_batch_no = ?", outBatchNo).Get(&m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
return &m, nil
}

func (NewFlexibleEmploymentPupiaoOrdDb *NewFlexibleEmploymentPupiaoOrdDb) Update(id interface{}, m *model.NewFlexibleEmploymentPupiaoOrd, forceColums ...string) (int64, error) {
func (newFlexibleEmploymentPupiaoOrdDb *NewFlexibleEmploymentPupiaoOrdDb) Update(id interface{}, m *model.NewFlexibleEmploymentPupiaoOrd, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = NewFlexibleEmploymentPupiaoOrdDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
affected, err = newFlexibleEmploymentPupiaoOrdDb.Db.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = NewFlexibleEmploymentPupiaoOrdDb.Db.Where("id=?", id).Update(m)
affected, err = newFlexibleEmploymentPupiaoOrdDb.Db.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err


+ 7
- 4
app/flexible_employment/enum/enum_pupiao_api.go View File

@@ -3,9 +3,10 @@ package enum
type PuPiaoMethodName string

const (
OpenApiContractSignApply = "/open/api/contract/signApply"
OpenApiPaymentReceiveOrder = "/open/api/payment/receiveOrder"
OpenApiPaymentConfirmPay = "/open/api/payment/confirmPay"
OpenApiContractSignApply = "/open/api/contract/signApply"
OpenApiPaymentReceiveOrder = "/open/api/payment/receiveOrder"
NewOpenApiPaymentReceiveOrder = "/merchant/exportApi/pay/payApi"
OpenApiPaymentConfirmPay = "/open/api/payment/confirmPay"
)

func (gt PuPiaoMethodName) String() string {
@@ -13,7 +14,9 @@ func (gt PuPiaoMethodName) String() string {
case OpenApiContractSignApply:
return "申请签约接口"
case OpenApiPaymentReceiveOrder:
return "发起制单"
return "发起制单(废弃)"
case NewOpenApiPaymentReceiveOrder:
return "委托代征佣金发放API"
case OpenApiPaymentConfirmPay:
return "确认支付"
default:


+ 2
- 3
app/lib/flexible_employment/new_pupiao.go View File

@@ -1,7 +1,6 @@
package flexible_employment

import (
"applet/app/cfg"
"applet/app/utils"
"crypto/md5"
"encoding/hex"
@@ -23,12 +22,12 @@ type PuPiaoService struct {
SecretKey string
}

const NewUrlForPrd = "http://merchant-hlg.youjiayun.com"
const NewUrlForPrd = "http://merchant.linglong.net.cn"
const NewUrlForDev = "http://saas-merchant-test.youjiayun.com"

func NewNewPuPiao(appKey, secretKey, merchantNo, agreementId string) *PuPiaoService {
var baseURL string
if cfg.Prd {
if true {
baseURL = NewUrlForPrd
} else {
baseURL = NewUrlForDev


+ 86
- 0
consume/honey_dividends_consume.go View File

@@ -0,0 +1,86 @@
package consume

import (
"applet/app/cfg"
"applet/app/db"
"applet/app/utils"
"applet/app/utils/logx"
"applet/consume/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md"
honey_dividend "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/honey_dividend"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles"
"encoding/json"
"errors"
"fmt"
"github.com/streadway/amqp"
)

func DividendRewardConsume(queue md.MqQueue) {
fmt.Println(">>>>>>>>>>>>DividendRewardConsume>>>>>>>>>>>>")
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)

one_circles.Init(cfg.RedisAddr)

var res amqp.Delivery
var ok bool
for {
res, ok = <-delivery
if ok == true {
err = handleDividendRewardConsume(res.Body)
if err != nil {
fmt.Println("err ::: ", err)
utils.FilePutContents("ServiceAwardDividendRelationConsume_ERR", "[err]:"+err.Error())
_ = res.Reject(true) //TODO::拒绝 Ack
} else {
_ = res.Ack(true)
}
} else {
panic(errors.New("error getting message"))
}
}
fmt.Println("get msg done")
}

func handleDividendRewardConsume(msgData []byte) error {
//1、解析mq中queue的数据结构体
var msg *md2.HoneyDividendForUserDividend
err := json.Unmarshal(msgData, &msg)
if err != nil {
return err
}

engine := db.DBs[msg.MasterId]
session := engine.NewSession()
defer func() {
session.Close()
if err := recover(); err != nil {
_ = logx.Error(err)
}
}()
session.Begin()

err = honey_dividend.DealDividendReward(session, *msg)
if err != nil {
_ = session.Rollback()
fmt.Println("err:::::!!!", err.Error())
return err
}

err = session.Commit()
if err != nil {
_ = session.Rollback()
return errors.New("事务提交失败")
}
return nil
}

+ 49
- 48
consume/init.go View File

@@ -19,49 +19,49 @@ func Init() {
func initConsumes() {
//jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder

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.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.ZhiosTaskTotal] = ZhiosTaskTotal
jobs[consumeMd.ZhiosAutoUnFreeze] = ZhiosAutoUnFreeze
jobs[consumeMd.ZhiosUserProfileInviteCode] = ZhiosUserProfileInviteCode
//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.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.ZhiosTaskTotal] = ZhiosTaskTotal
//jobs[consumeMd.ZhiosAutoUnFreeze] = ZhiosAutoUnFreeze
//jobs[consumeMd.ZhiosUserProfileInviteCode] = ZhiosUserProfileInviteCode

//

@@ -97,11 +97,12 @@ func initConsumes() {
//jobs[consumeMd.OneCirclesDealUserCoinConsumeFunName] = OneCirclesDealUserCoinConsume

//////////////////////////////////////// withdraw /////////////////////////////////////////////////////
//jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume
//jobs[consumeMd.FlexibleEmploymentWithdrawForGongMaoConsumeFunName] = FlexibleEmploymentWithdrawForGongMaoConsume
//jobs[consumeMd.FlexibleEmploymentWithdrawForPupiaoConsumeFunName] = FlexibleEmploymentWithdrawForPupiaoConsume
//jobs[consumeMd.NewFlexibleEmploymentWithdrawForPupiaoConsumeFunName] = NewFlexibleEmploymentWithdrawForPupiaoConsume
//jobs[consumeMd.ServiceAwardDividendRelationConsumeFunName] = ServiceAwardDividendRelationConsume
jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume
jobs[consumeMd.FlexibleEmploymentWithdrawForGongMaoConsumeFunName] = FlexibleEmploymentWithdrawForGongMaoConsume
jobs[consumeMd.FlexibleEmploymentWithdrawForPupiaoConsumeFunName] = FlexibleEmploymentWithdrawForPupiaoConsume
jobs[consumeMd.NewFlexibleEmploymentWithdrawForPupiaoConsumeFunName] = NewFlexibleEmploymentWithdrawForPupiaoConsume
jobs[consumeMd.ServiceAwardDividendRelationConsumeFunName] = ServiceAwardDividendRelationConsume
jobs[consumeMd.DividendRewardConsumeFunName] = DividendRewardConsume //蜂蜜分红

//jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分
//jobs[consumeMd.ZhiosOneCirclesCoinConsumeFunName] = ZhiosOneCirclesCoinConsume //一个圈圈虚拟币变化


+ 10
- 0
consume/md/consume_key.go View File

@@ -623,6 +623,15 @@ var RabbitMqQueueKeyList = []*MqQueue{
BindKey: "",
ConsumeFunName: "ServiceAwardDividendRelationConsume",
},
{
ExchangeName: "honey.dividend",
Name: "honey_dividend_user_reward",
Type: DirectQueueType,
IsPersistent: false,
RoutKey: "user_dividend",
BindKey: "",
ConsumeFunName: "DividendRewardConsume",
},
}

const (
@@ -695,4 +704,5 @@ const (
InstallmentPaymentAutoRepaidConsumeFunName = "InstallmentPaymentAutoRepaidConsume"
CanalGimMessageConsumeFunName = "CanalGimMessageConsume"
ServiceAwardDividendRelationConsumeFunName = "ServiceAwardDividendRelationConsume"
DividendRewardConsumeFunName = "DividendRewardConsume"
)

+ 1
- 5
consume/withdraw_consume_new_pupiao.go View File

@@ -1,7 +1,6 @@
package consume

import (
"applet/app/cfg"
"applet/app/db"
db2 "applet/app/flexible_employment/db"
"applet/app/flexible_employment/enum"
@@ -11,7 +10,6 @@ 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/rule/one_circles"
"encoding/json"
"errors"
"fmt"
@@ -33,8 +31,6 @@ func NewFlexibleEmploymentWithdrawForPupiaoConsume(queue md.MqQueue) {
ch.Qos(1)
delivery := ch.Consume(queue.Name, false)

one_circles.Init(cfg.RedisAddr)

var res amqp.Delivery
var ok bool
for {
@@ -132,7 +128,7 @@ func handleNewFlexibleEmploymentWithdrawForPupiaoConsume(msgData []byte) error {
bankType = "3"
payMethod = "2"
}
result, err := puPiao.CurlPost(enum.OpenApiPaymentReceiveOrder, map[string]interface{}{
result, err := puPiao.CurlPost(puPiao.BaseURL+enum.NewOpenApiPaymentReceiveOrder, map[string]interface{}{
"bizOrderNo": flexibleEmploymentPupiaoOrd.OutBatchNo,
"totalCount": "1",
"totalAmount": flexibleEmploymentPupiaoOrd.TotalAmount,


+ 3
- 3
go.mod View File

@@ -6,13 +6,13 @@ go 1.18
//replace code.fnuoos.com/go_rely_warehouse/zyos_model.git => E:/company/go_rely_warehouse/zyos_model/

require (
code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240816060517-24249c56fded
code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240807064209-787723fc1317
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.20240816060436-32b59f7a7d14
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240812063533-c7e6269357a6
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.20240730013105-a13176f971e9
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240816014008-a236ebf42395
code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240812063422-6380c884a38b
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


Loading…
Cancel
Save