From 70d441beb7545f25caa882013e458005f2c021eb Mon Sep 17 00:00:00 2001 From: kongyuebin Date: Fri, 12 Nov 2021 22:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E5=95=86=E6=88=B7=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- merchant/common/pay_way_code.go | 99 ------------------------- merchant/common/supplier.go | 47 ------------ merchant/conf/app.conf | 2 +- merchant/{common => conf}/consts.go | 2 +- merchant/controllers/account_history.go | 2 +- merchant/controllers/deal_excel.go | 6 +- merchant/controllers/multi_withdraw.go | 12 +-- merchant/controllers/withdraw.go | 12 +-- merchant/models/payfor_info.go | 11 ++- 9 files changed, 23 insertions(+), 170 deletions(-) delete mode 100644 merchant/common/pay_way_code.go delete mode 100644 merchant/common/supplier.go rename merchant/{common => conf}/consts.go (99%) diff --git a/merchant/common/pay_way_code.go b/merchant/common/pay_way_code.go deleted file mode 100644 index a848388..0000000 --- a/merchant/common/pay_way_code.go +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************** - ** @Desc : This file for ... - ** @Time : 2019/10/29 15:01 - ** @Author : yuebin - ** @File : pay_way_code - ** @Last Modified by : yuebin - ** @Last Modified time: 2019/10/29 15:01 - ** @Software: GoLand -****************************************************/ -package common - -var ScanPayWayCodes = []string{ - "WEIXIN_SCAN", - "UNION_SCAN", - "ALI_SCAN", - "BAIDU_SCAN", - "JD_SCAN", - "QQ_SCAN", -} - -var H5PayWayCodes = []string{ - "WEIXIN_H5", - "ALI_H5", - "QQ_H5", - "UNION_H5", - "BAIDU_H5", - "JD_H5", -} - -var SytPayWayCodes = []string{ - "WEIXIN_SYT", - "ALI_SYT", - "QQ_SYT", - "UNION_SYT", - "BAIDU_SYT", - "JD_SYT", -} - -var FastPayWayCodes = []string{ - "UNION-FAST", -} - -var WebPayWayCode = []string{ - "UNION-WAP", -} - -func GetScanPayWayCodes() []string { - return ScanPayWayCodes -} - -func GetNameByPayWayCode(code string) string { - switch code { - case "WEIXIN_SCAN": - return "微信扫码" - case "UNION_SCAN": - return "银联扫码" - case "ALI_SCAN": - return "支付宝扫码" - case "BAIDU_SCAN": - return "百度扫码" - case "JD_SCAN": - return "京东扫码" - case "QQ_SCAN": - return "QQ扫码" - - case "WEIXIN_H5": - return "微信H5" - case "UNION_H5": - return "银联H5" - case "ALI_H5": - return "支付宝H5" - case "BAIDU_H5": - return "百度H5" - case "JD_H5": - return "京东H5" - case "QQ_H5": - return "QQ-H5" - - case "WEIXIN_SYT": - return "微信收银台" - case "UNION_SYT": - return "银联收银台" - case "ALI_SYT": - return "支付宝收银台" - case "BAIDU_SYT": - return "百度收银台" - case "JD_SYT": - return "京东收银台" - case "QQ_SYT": - return "QQ-收银台" - - case "UNION_FAST": - return "银联快捷" - case "UNION_WAP": - return "银联web" - default: - return "未知" - } -} diff --git a/merchant/common/supplier.go b/merchant/common/supplier.go deleted file mode 100644 index 9276277..0000000 --- a/merchant/common/supplier.go +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************** - ** @Desc : 上有支付公司的编号 - ** @Time : 2019/10/28 10:47 - ** @Author : yuebin - ** @File : supplier - ** @Last Modified by : yuebin - ** @Last Modified time: 2019/10/28 10:47 - ** @Software: GoLand -****************************************************/ -package common - -//添加新的上游通道时,需要添加这里 -var supplierCode2Name = map[string]string{ - "KF": "快付支付", - "WEIXIN": "官方微信", - "ALIPAY": "官方支付宝", -} - -func GetSupplierMap() map[string]string { - return supplierCode2Name -} - -func GetSupplierCodes() []string { - var supplierCodes []string - for k := range supplierCode2Name { - supplierCodes = append(supplierCodes, k) - } - - return supplierCodes -} - -func GetSupplierNames() []string { - var supplierNames []string - for _, v := range supplierCode2Name { - supplierNames = append(supplierNames, v) - } - return supplierNames -} - -func CheckSupplierByCode(code string) string { - for k, v := range supplierCode2Name { - if k == code { - return v + ",注册完毕" - } - } - return "未找到上游名称,注册有问题。" -} diff --git a/merchant/conf/app.conf b/merchant/conf/app.conf index 39a58b6..ea9acf0 100644 --- a/merchant/conf/app.conf +++ b/merchant/conf/app.conf @@ -9,7 +9,7 @@ runmode = dev #level =7 level =7 #日志保存路径 -filepath= ./logs/jhmerchant.log +filepath= ../logs/jhmerchant.log #需要显示的日志信息 #separate="["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]" separate="["emergency","alert","critical","error","warning","notice","info","debug"]" diff --git a/merchant/common/consts.go b/merchant/conf/consts.go similarity index 99% rename from merchant/common/consts.go rename to merchant/conf/consts.go index 21f4191..8378bd9 100644 --- a/merchant/common/consts.go +++ b/merchant/conf/consts.go @@ -7,7 +7,7 @@ ** @Last Modified time: 2019/11/25 14:14 ** @Software: GoLand ****************************************************/ -package common +package conf const ( ACTIVE = "active" diff --git a/merchant/controllers/account_history.go b/merchant/controllers/account_history.go index 13bce53..080a224 100644 --- a/merchant/controllers/account_history.go +++ b/merchant/controllers/account_history.go @@ -83,6 +83,6 @@ func (c *History) HistoryQueryAndListPage() { out["root"] = list // 显示数据 c.Data["json"] = out - c.ServeJSON() + _ = c.ServeJSON() c.StopRun() } diff --git a/merchant/controllers/deal_excel.go b/merchant/controllers/deal_excel.go index 36e5a1c..edf13c3 100644 --- a/merchant/controllers/deal_excel.go +++ b/merchant/controllers/deal_excel.go @@ -30,7 +30,7 @@ func (c *DealExcel) DownloadExcelModel() { ranMd5 := encrypt.EncodeMd5([]byte(pubMethod.RandomString(46))) c.Ctx.SetCookie(enum.UserCookie, ranMd5, enum.CookieExpireTime) c.Ctx.SetSecureCookie(ranMd5, enum.UserCookie, ranMd5, enum.CookieExpireTime) - c.SetSession(enum.UserCookie, ranMd5) + _ = c.SetSession(enum.UserCookie, ranMd5) c.Ctx.Output.Download(enum.ExcelModelPath, enum.ExcelModelName) } @@ -152,7 +152,7 @@ func (c *DealExcel) MakeOrderExcel() { stopRun: c.Data["json"] = pubMethod.JsonFormat(flag, "", msg, "") - c.ServeJSON() + _ = c.ServeJSON() c.StopRun() } @@ -163,7 +163,7 @@ func (c *DealExcel) DownloadRecordExcel() { defer func() { if r := recover(); r != nil { - logs.Error(fmt.Sprintf("%s此文件不存在",file)) + logs.Error(fmt.Sprintf("%s此文件不存在", file)) time.Sleep(3 * time.Second) } }() diff --git a/merchant/controllers/multi_withdraw.go b/merchant/controllers/multi_withdraw.go index 8494689..77c1102 100644 --- a/merchant/controllers/multi_withdraw.go +++ b/merchant/controllers/multi_withdraw.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/rs/xid" "github.com/tealeg/xlsx" - "merchant/common" + "merchant/conf" "merchant/models" "merchant/sys/enum" "merchant/utils" @@ -273,18 +273,18 @@ func handleFileContent(name string, u models.MerchantInfo, c *Withdraw) (bool, s PhoneNo: u.LoginAccount, MerchantOrderId: xid.New().String(), BankOrderId: "4444" + xid.New().String(), - PayforFee: common.PAYFOR_FEE, - Type: common.SELF_MERCHANT, + PayforFee: conf.PAYFOR_FEE, + Type: conf.SELF_MERCHANT, PayforAmount: money, - PayforTotalAmount: money + common.PAYFOR_FEE, + PayforTotalAmount: money + conf.PAYFOR_FEE, BankCode: "C", BankName: row.Cells[2].String(), - IsSend: common.NO, + IsSend: conf.NO, BankAccountName: row.Cells[0].String(), BankAccountNo: row.Cells[1].String(), BankAccountType: bankAccountType, BankAccountAddress: row.Cells[2].String(), - Status: common.PAYFOR_COMFRIM, + Status: conf.PAYFOR_COMFRIM, CreateTime: pubMethod.GetNowTime(), UpdateTime: pubMethod.GetNowTime(), } diff --git a/merchant/controllers/withdraw.go b/merchant/controllers/withdraw.go index 761e0c6..e584819 100644 --- a/merchant/controllers/withdraw.go +++ b/merchant/controllers/withdraw.go @@ -12,7 +12,7 @@ package controllers import ( "fmt" "github.com/rs/xid" - "merchant/common" + "merchant/conf" "merchant/models" "merchant/sys/enum" "merchant/utils" @@ -257,18 +257,18 @@ func (c *Withdraw) LaunchSingleWithdraw() { PhoneNo: u.LoginAccount, MerchantOrderId: xid.New().String(), BankOrderId: "4444" + xid.New().String(), - PayforFee: common.PAYFOR_FEE, - Type: common.SELF_MERCHANT, + PayforFee: conf.PAYFOR_FEE, + Type: conf.SELF_MERCHANT, PayforAmount: amount, - PayforTotalAmount: amount + common.PAYFOR_FEE, + PayforTotalAmount: amount + conf.PAYFOR_FEE, BankCode: bankCode, BankName: enum.GetBankInfo()[bankCode], - IsSend: common.NO, + IsSend: conf.NO, BankAccountName: accountName, BankAccountNo: cardNo, BankAccountType: bankAccountType, BankAccountAddress: province + city + bankAccountAddress, - Status: common.PAYFOR_COMFRIM, + Status: conf.PAYFOR_COMFRIM, CreateTime: pubMethod.GetNowTime(), UpdateTime: pubMethod.GetNowTime(), } diff --git a/merchant/models/payfor_info.go b/merchant/models/payfor_info.go index ecdf4e9..d9f6554 100644 --- a/merchant/models/payfor_info.go +++ b/merchant/models/payfor_info.go @@ -15,7 +15,7 @@ import ( "fmt" "github.com/beego/beego/v2/client/orm" "github.com/beego/beego/v2/core/logs" - "merchant/common" + "merchant/conf" "merchant/utils" ) @@ -172,13 +172,13 @@ func ForUpdatePayFor(payFor PayforInfo) bool { return err } - if tmp.Status == common.PAYFOR_FAIL || tmp.Status == common.PAYFOR_SUCCESS { + if tmp.Status == conf.PAYFOR_FAIL || tmp.Status == conf.PAYFOR_SUCCESS { return errors.New("") } //如果是手动打款,并且是需要处理商户金额 - if payFor.Status == common.PAYFOR_SOLVING && tmp.Status == common.PAYFOR_COMFRIM && - payFor.GiveType == common.PAYFOR_HAND && payFor.Type != common.SELF_HELP { + if payFor.Status == conf.PAYFOR_SOLVING && tmp.Status == conf.PAYFOR_COMFRIM && + payFor.GiveType == conf.PAYFOR_HAND && payFor.Type != conf.SELF_HELP { var account AccountInfo if err := txOrm.Raw("select * from account_info where account_uid = ? for update", payFor.MerchantUid).QueryRow(&account); err != nil || account.AccountUid == "" { @@ -197,7 +197,7 @@ func ForUpdatePayFor(payFor PayforInfo) bool { } else { logs.Error(fmt.Sprintf("商户uid=%s,可用金额不够", payFor.MerchantUid)) payFor.ResponseContext = "商户可用余额不足" - payFor.Status = common.PAYFOR_FAIL + payFor.Status = conf.PAYFOR_FAIL } } @@ -206,7 +206,6 @@ func ForUpdatePayFor(payFor PayforInfo) bool { return err } - return nil }); err != nil { return false