mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2024-11-14 14:39:21 +08:00
精简商户后台的代码
This commit is contained in:
parent
0bb777213b
commit
70d441beb7
@ -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 "未知"
|
||||
}
|
||||
}
|
@ -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 "未找到上游名称,注册有问题。"
|
||||
}
|
@ -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"]"
|
||||
|
@ -7,7 +7,7 @@
|
||||
** @Last Modified time: 2019/11/25 14:14
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package common
|
||||
package conf
|
||||
|
||||
const (
|
||||
ACTIVE = "active"
|
@ -83,6 +83,6 @@ func (c *History) HistoryQueryAndListPage() {
|
||||
out["root"] = list // 显示数据
|
||||
|
||||
c.Data["json"] = out
|
||||
c.ServeJSON()
|
||||
_ = c.ServeJSON()
|
||||
c.StopRun()
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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(),
|
||||
}
|
||||
|
@ -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(),
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user