twin-api/app/api/service/button.go

42 lines
974 B
Go

package service
import (
"twin-api/app/api/response"
"twin-api/base/config"
)
type Button struct {
param map[string]any
}
func New(param map[string]any) *Button {
b := new(Button)
b.param = param
return b
}
func (b *Button) CouponButton() []*response.Button {
button := new(response.Button)
button.Url = b.param[config.ServiceVipExpireUrl].(string)
button.Type = config.ButtonInput
submitBtn := new(response.Button)
submitBtn.Text = "提交"
submitBtn.Type = config.ButtonClick
customBtn := new(response.Button)
customBtn.Text = b.param[config.ButtonTxtContractCustomer].(string)
customBtn.Type = config.ButtonClick
return []*response.Button{button, submitBtn, customBtn}
}
func (b *Button) PayButton() []*response.Button {
button := new(response.Button)
button.Text = b.param[config.ServiceVipExpireButton].(string)
button.Url = b.param[config.ServiceVipExpireUrl].(string)
button.Type = config.ButtonInput
return []*response.Button{button}
}