浏览代码

update

master
shenjiachi 1 天前
父节点
当前提交
35e9489fb9
共有 2 个文件被更改,包括 58 次插入6 次删除
  1. +4
    -6
      consume/egg_fin_withdraw_apply_consume.go
  2. +54
    -0
      consume/egg_fin_withdraw_apply_consume_test.go

+ 4
- 6
consume/egg_fin_withdraw_apply_consume.go 查看文件

@@ -22,7 +22,6 @@ import (
"github.com/go-pay/gopay"
"github.com/go-pay/gopay/alipay"
"github.com/go-pay/xlog"
"github.com/jinzhu/copier"
"github.com/streadway/amqp"
"time"
)
@@ -73,12 +72,9 @@ func EggFinWithdrawApplyDataConsume(queue md.MqQueue) {
data.Ext = res.Body
} else {
// 解析成功
err2 := copier.Copy(&data, &msg)
if err2 != nil {
data.Ext = res.Body
}
data.EggFinWithdrawApplyData = *msg
}
ch.Publish(md2.EggAppExchange, utils2.SerializeStr(data), md2.EggFinWithdrawApplyError)
ch.Publish(md2.EggAppExchange, data, md2.EggFinWithdrawApplyError)
}
//_ = res.Reject(false)
err = res.Ack(true)
@@ -98,6 +94,8 @@ func handleEggFinWithdrawApplyDataConsume(msgData []byte, client *alipay.Client,
return err
}

return errors.New("测试")

applyDb := implement.NewFinWithdrawApplyDb(db.Db)
apply, err := applyDb.FinWithdrawApplyGet(msg.Id)
if err != nil {


+ 54
- 0
consume/egg_fin_withdraw_apply_consume_test.go 查看文件

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

import (
"applet/app/cfg"
"applet/app/db"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"fmt"
"testing"
)

func TestHandleEggFinWithdrawApplyDataConsume(t *testing.T) {
dbcfg := cfg.DBCfg{
Host: "119.23.182.117:3306",
Name: "egg",
User: "root",
Psw: "Fnuo123com@",
ShowLog: true,
MaxLifetime: 30,
MaxOpenConns: 100,
MaxIdleConns: 100,
Path: "tmp/%s.log",
}
db.InitDB(&dbcfg)
err := rabbit.Init("120.77.153.180", "5672", "guest", "guest")
if err != nil {
return
}
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
fmt.Println("DealFundDataGetRabbitChannel_ERR:::::", err.Error())
return
}
defer ch.Release()
ch.Publish(md2.EggAppExchange, md2.EggFinWithdrawApplyData{
Id: 1,
Uid: 2,
AdmId: 3,
Amount: "10",
RealAmount: "10",
Fee: "4",
Type: 1,
WithdrawAccount: "3",
WithdrawName: "2",
Reason: 2,
PaymentDate: "2",
State: 2,
WithdrawKind: 2,
IsFirst: 2,
Memo: "测试报错例子2",
UpdateAt: "",
CreateAt: "",
}, md2.EggFinWithdrawApply)
}

正在加载...
取消
保存