系统账户 出错 TransferWithContextTx

来源:6-21 红包模块-抢红包应用服务层测试用例调试【调试方法和技巧】

慕粉3444241

2019-08-27

下载了V7版本的代码,依旧有错误

time="2019-08-27T20:14:46+08:00" level=debug msg="[imooc.com/resk/infra.(*BootApplication).start(infra/boot.go:61)] Starting: *base.PropsStarter" func="imooc.com/resk/infra.(*BootApplication).start" file="infra/boot.go:61"
time="2019-08-27T20:14:46+08:00" level=debug msg="[imooc.com/resk/infra.(*BootApplication).start(infra/boot.go:61)] Starting: *base.DbxDatabaseStarter" func="imooc.com/resk/infra.(*BootApplication).start" file="infra/boot.go:61"
time="2019-08-27T20:14:46+08:00" level=debug msg="[imooc.com/resk/infra.(*BootApplication).start(infra/boot.go:61)] Starting: *base.ValidatorStarter" func="imooc.com/resk/infra.(*BootApplication).start" file="infra/boot.go:61"
time="2019-08-27T20:14:46+08:00" level=error msg="[imooc.com/resk/core/accounts.(*accountDomain).TransferWithContextTx(accounts/domain_account.go:151)] 10000020190101010000000000000001账户出错" func="imooc.com/resk/core/accounts.(*accountDomain).TransferWithContextTx" file="accounts/domain_account.go:151"
time="2019-08-27T20:14:46+08:00" level=info msg="[imooc.com/resk/core/envelopes.TestRedEnvelopeService_Receive.func1.1(envelopes/service_recieve_test.go:71)] 0" func=imooc.com/resk/core/envelopes.TestRedEnvelopeService_Receive.func1.1 file="envelopes/service_recieve_test.go:71"
time="2019-08-27T20:14:46+08:00" level=info msg="[imooc.com/resk/core/envelopes.TestRedEnvelopeService_Receive.func1.1(envelopes/service_recieve_test.go:72)] &{ItemNo:1Q0We8YFeenkO7mVh8zRXpejBWx EnvelopeNo:1Q0WeEnCNp0XvQiODqKkT1SUyGd RecvUsername:测试用户1 RecvUserId:1Q0We8uiSlJshzLtmHF1O1bmyDH Amount:1.88 Quantity:1 RemainAmount:16.92 AccountNo:1Q0WeBCDEepjn4boHkKUgyNXbUw PayStatus:2 CreatedAt:0001-01-01 00:00:00 +0000 UTC UpdatedAt:0001-01-01 00:00:00 +0000 UTC}" func=imooc.com/resk/core/envelopes.TestRedEnvelopeService_Receive.func1.1 file="envelopes/service_recieve_test.go:72"
time="2019-08-27T20:14:46+08:00" level=error msg="[imooc.com/resk/core/accounts.(*accountDomain).TransferWithContextTx(accounts/domain_account.go:151)] 10000020190101010000000000000001账户出错" func="imooc.com/resk/core/accounts.(*accountDomain).TransferWithContextTx" file="accounts/domain_account.go:151"
time="2019-08-27T20:14:46+08:00" level=info msg="[imooc.com/resk/core/envelopes.TestRedEnvelopeService_Receive.func1.2(envelopes/service_recieve_test.go:116)] 1 3.36 3.36" func=imooc.com/resk/core/envelopes.TestRedEnvelopeService_Receive.func1.2 file="envelopes/service_recieve_test.go:116"
写回答

1回答

枫荇

2019-08-31

您好!同学,您是不是没有执行系统红包账户的初始化脚本,请执行如下脚本再试一下:

# --初始化系统红包账户

INSERT INTO `account`(`id`, `account_no`, `account_name`, `account_type`, `currency_code`, `user_id`, `username`, `balance`, `status`, `created_at`, `updated_at`) VALUES (32937, '10000020190101010000000000000001', '系统红包账户', 2, 'CNY', '100001', '系统红包账户', 0.000000, 1, '2019-05-01 08:41:10.346', '2019-05-12 09:37:55.462');

INSERT INTO `account_log`(`id`, `trade_no`, `log_no`, `account_no`, `user_id`, `username`, `target_account_no`, `target_user_id`, `target_username`, `amount`, `balance`, `change_type`, `change_flag`, `status`, `decs`, `created_at`) VALUES (43208, '20190501084054283000000002110000', '20190501084054283000000002110000', '10000020190101010000000000000001', '100001', '系统红包账户', '10000020190101010000000000000001', '100001', '系统红包账户', 0.000000, 0.000000, 0, 0, 0, '开户', '2019-05-01 08:41:10.371');


脚本也可以在仓库中下载

https://git.imooc.com/coding-345/resk/_edit/master/doc/init.sql

1
0

仿微信抢红包 Golang实战多版本抢红包系统

Golang红包系统单体版+并发版+分布式+微服务版,四大金装版、超值必修课

582 学习 · 159 问题

查看课程