123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package config
- import "eta/eta_mini_ht_api/common/contants"
- // ESOpts es连接属性
- type HTOpts struct {
- ReportIndex string
- MediaIndex string
- ChartIndex string
- Encode string
- DesCode string
- Task string
- AccountApiUrl string
- PaymentApiUrl string
- WebhookPrivateKey string
- WebhookPublicKey string
- AccountInfoUrl string
- CapAppId string
- CapSecretKey string
- PaymentAppId string
- PaymentSign string
- MerchantId string
- }
- type HTBizConfig struct {
- BaseConfig
- opts HTOpts
- }
- func (e *HTBizConfig) GetReportIndex() string {
- return e.opts.ReportIndex
- }
- func (e *HTBizConfig) GetMediaIndex() string {
- return e.opts.MediaIndex
- }
- func (e *HTBizConfig) GetChartIndex() string {
- return e.opts.ChartIndex
- }
- func (e *HTBizConfig) GetAccountInfoUrl() string {
- return e.opts.AccountInfoUrl
- }
- func (e *HTBizConfig) NeedEncode() bool {
- if e.opts.Encode == "true" {
- return true
- }
- return false
- }
- func (e *HTBizConfig) EnableTask() bool {
- if e.opts.Task == "true" {
- return true
- }
- return false
- }
- func (e *HTBizConfig) GetWebhookPrivateKey() string {
- return e.opts.WebhookPrivateKey
- }
- func (e *HTBizConfig) GetWebhookPublicKey() string {
- return e.opts.WebhookPublicKey
- }
- func (e *HTBizConfig) GetAccountApiUrl() string {
- return e.opts.AccountApiUrl
- }
- func (e *HTBizConfig) GetMerchantId() string {
- return e.opts.MerchantId
- }
- func (e *HTBizConfig) GetPaymentApiUrl() string {
- return e.opts.PaymentApiUrl
- }
- func (e *HTBizConfig) GetPaymentAppId() string {
- return e.opts.PaymentAppId
- }
- func (e *HTBizConfig) GetPaymentSign() string {
- return e.opts.PaymentSign
- }
- func (e *HTBizConfig) GetAppId() string {
- return e.opts.CapAppId
- }
- func (e *HTBizConfig) GetSecretKey() string {
- return e.opts.CapSecretKey
- }
- func (e *HTBizConfig) GetDesCode() string {
- return e.opts.DesCode
- }
- func (e *HTBizConfig) InitConfig() {
- opts := HTOpts{
- ReportIndex: e.GetString("es_report_index"),
- MediaIndex: e.GetString("es_media_index"),
- ChartIndex: e.GetString("es_chart_index"),
- Encode: e.GetString("response.encode"),
- DesCode: e.GetString("response.des_code"),
- Task: e.GetString("task"),
- AccountApiUrl: e.GetString("api.account_url"),
- WebhookPrivateKey: e.GetString("webhook.private_key"),
- WebhookPublicKey: e.GetString("webhook.public_key"),
- AccountInfoUrl: e.GetString("api.account_url"),
- PaymentApiUrl: e.GetString("api.payment_url"),
- CapAppId: e.GetString("api.app_id"),
- CapSecretKey: e.GetString("api.secret_key"),
- PaymentAppId: e.GetString("api.payment_app_id"),
- PaymentSign: e.GetString("api.payment_secret_key"),
- MerchantId: e.GetString("merchant_id"),
- }
- e.opts = opts
- }
- func NewHT() Config {
- return &HTBizConfig{
- BaseConfig: BaseConfig{prefix: contants.HT},
- opts: HTOpts{},
- }
- }
- func init() {
- Register(contants.HT, NewHT)
- }
|