25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

64 lines
1.3 KiB

  1. /**
  2. 此文件为旧版支付设置文件,如需增加新的参数、变量等,请在 payment_setting.go 中添加
  3. This file is the old version of the payment settings file. If you need to add new parameters, variables, etc., please add them in payment_setting.go
  4. */
  5. package operation_setting
  6. import (
  7. "github.com/QuantumNous/new-api/common"
  8. )
  9. var PayAddress = ""
  10. var CustomCallbackAddress = ""
  11. var EpayId = ""
  12. var EpayKey = ""
  13. var Price = 7.3
  14. var MinTopUp = 1
  15. var USDExchangeRate = 7.3
  16. var PayMethods = []map[string]string{
  17. {
  18. "name": "支付宝",
  19. "color": "rgba(var(--semi-blue-5), 1)",
  20. "type": "alipay",
  21. },
  22. {
  23. "name": "微信",
  24. "color": "rgba(var(--semi-green-5), 1)",
  25. "type": "wxpay",
  26. },
  27. {
  28. "name": "自定义1",
  29. "color": "black",
  30. "type": "custom1",
  31. "min_topup": "50",
  32. },
  33. }
  34. func UpdatePayMethodsByJsonString(jsonString string) error {
  35. var methods []map[string]string
  36. if err := common.Unmarshal([]byte(jsonString), &methods); err != nil {
  37. return err
  38. }
  39. PayMethods = methods
  40. return nil
  41. }
  42. func PayMethods2JsonString() string {
  43. jsonBytes, err := common.Marshal(PayMethods)
  44. if err != nil {
  45. return "[]"
  46. }
  47. return string(jsonBytes)
  48. }
  49. func ContainsPayMethod(method string) bool {
  50. for _, payMethod := range PayMethods {
  51. if payMethod["type"] == method {
  52. return true
  53. }
  54. }
  55. return false
  56. }