From b027a9cab0194c3d9fd3bb2e69d6ecfb83156e7c Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 27 Apr 2022 15:58:46 +0800 Subject: [PATCH] add Reverse: for v0.1.0 --- pay/init.go | 2 +- pay/pay.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pay/init.go b/pay/init.go index 6ebe556..223cc47 100644 --- a/pay/init.go +++ b/pay/init.go @@ -26,7 +26,7 @@ func Init(host, name, user, psw string) error { cfg.MaxLifetime = 30 cfg.MaxOpenConns = 100 cfg.MaxIdleConns = 100 - cfg.Path = "tmp/%s.log" + cfg.Path = "logs/%s.log" if err := db.InitDB(&cfg); err != nil { return err } diff --git a/pay/pay.go b/pay/pay.go index 4b2b2e5..715db48 100644 --- a/pay/pay.go +++ b/pay/pay.go @@ -9,10 +9,13 @@ import ( func JudgePayChannel(mid, paySceneIdentifier string) (model.PayChannel, error) { var payChannelMaster = model.PayChannelMaster{} var payChannel = model.PayChannel{} - _, err := db.Db.Where("app_id = ?", mid).And("identifier = ?", paySceneIdentifier).Get(&payChannelMaster) + res, err := db.Db.Where("app_id = ?", mid).And("identifier = ?", paySceneIdentifier).Get(&payChannelMaster) if err != nil { return payChannel, err } + if !res { + return payChannel, errors.New("查询数据失败") + } if payChannelMaster.ChannelId == 0 { return payChannel, errors.New("请联系服务商绑定支付渠道") }