支付模块
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

pay_config.go 1.0 KiB

123456789101112131415161718192021222324252627282930313233343536
  1. package pay
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db"
  4. "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db/model"
  5. "errors"
  6. )
  7. //支付渠道获取
  8. func JudgePayChannel(mid, paySceneIdentifier string) (model.PayChannelMaster, error) {
  9. var payChannelMaster = model.PayChannelMaster{}
  10. res, err := db.Db.Where("app_id = ?", mid).And("identifier = ?", paySceneIdentifier).Get(&payChannelMaster)
  11. if err != nil {
  12. return payChannelMaster, err
  13. }
  14. if !res {
  15. return payChannelMaster, errors.New("查询数据失败")
  16. }
  17. if payChannelMaster.ChannelId == 0 {
  18. return payChannelMaster, errors.New("请联系服务商绑定支付渠道")
  19. }
  20. return payChannelMaster, nil
  21. }
  22. //支付方式获取
  23. func JudgePayChannelPayType(channelId string) (model.PayChannel, error) {
  24. var payChannel = model.PayChannel{}
  25. res, err := db.Db.Where("id = ? and is_use=?", channelId, 1).Get(&payChannel)
  26. if err != nil {
  27. return payChannel, err
  28. }
  29. if !res {
  30. return payChannel, errors.New("查询数据失败")
  31. }
  32. return payChannel, nil
  33. }