|
123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package pay
-
- import (
- "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db/model"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/e"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils/cache"
- "xorm.io/xorm"
- )
-
- //支付渠道获取
- func JudgePayChannel(mid, paySceneIdentifier string) (model.PayChannelMaster, error) {
- var payChannelMaster = model.PayChannelMaster{}
- res, err := db.Db.Where("app_id = ?", mid).And("identifier = ?", paySceneIdentifier).Get(&payChannelMaster)
- if err != nil {
- return payChannelMaster, err
- }
- if !res {
- return payChannelMaster, e.NewErr(400, "查询数据失败")
- }
- if payChannelMaster.ChannelId == 0 {
- return payChannelMaster, e.NewErr(400, "请联系服务商绑定支付渠道")
- }
- return payChannelMaster, nil
- }
-
- //客户端支付宝配置
- func OwnCustomAlipayConfig(eg *xorm.Engine, args map[string]string) map[string]string {
- cache.NewRedis(args["redis_addr"])
- var paySet = map[string]string{
- "pay_app_cert_sn": db.SysCfgGetWithDb(eg, args["master_id"], "pay_app_cert_sn"),
- "pay_alipay_root_cert_sn": db.SysCfgGetWithDb(eg, args["master_id"], "pay_alipay_root_cert_sn"),
- "pay_alipayrsa_public_key": db.SysCfgGetWithDb(eg, args["master_id"], "pay_alipayrsa_public_key"),
- "pay_ali_use_type": db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_use_type"),
- "private_key": db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_private_key"),
- "app_id": db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_app_id"),
- "rsa": db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_key_len_type"),
- "pkcs": db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_key_format_type"),
- }
- if paySet["pay_ali_use_type"] == "1" {
- paySet["private_key"] = db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_new_private_key")
- paySet["app_id"] = db.SysCfgGetWithDb(eg, args["master_id"], "pay_ali_new_app_id")
- }
- return paySet
- }
|