|
- 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"
- "errors"
- )
-
- //支付渠道获取
- 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, errors.New("查询数据失败")
- }
- if payChannelMaster.ChannelId == 0 {
- return payChannelMaster, errors.New("请联系服务商绑定支付渠道")
- }
- return payChannelMaster, nil
- }
-
- //支付方式获取
- func JudgePayChannelPayType(channelId string) (model.PayChannel, error) {
- var payChannel = model.PayChannel{}
- res, err := db.Db.Where("id = ? and is_use=?", channelId, 1).Get(&payChannel)
- if err != nil {
- return payChannel, err
- }
- if !res {
- return payChannel, errors.New("查询数据失败")
- }
- return payChannel, nil
- }
|