65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
package service
|
||
|
||
import (
|
||
"twin-api/app/api/response"
|
||
"twin-api/base/config"
|
||
)
|
||
|
||
type Button struct {
|
||
param Params
|
||
}
|
||
|
||
func NewButton(param Params) *Button {
|
||
return &Button{param: param}
|
||
}
|
||
|
||
func (b *Button) CouponButton() []*response.Button {
|
||
return []*response.Button{
|
||
{Url: b.param.Str(config.ServiceVipExpireUrl), Type: config.ButtonInput},
|
||
{Text: b.param.Str(config.ServiceCouponSubmitButton), Type: config.ButtonClick},
|
||
{Text: b.param.Str(config.ButtonTxtContractCustomer), Type: config.ButtonClick},
|
||
}
|
||
}
|
||
|
||
func (b *Button) PayButton() []*response.Button {
|
||
return []*response.Button{
|
||
{
|
||
Text: b.param.Str(config.ServiceVipExpireButton),
|
||
Url: b.param.Str(config.ServiceVipExpireUrl),
|
||
Type: config.ButtonClick,
|
||
},
|
||
}
|
||
}
|
||
|
||
// LackButton 用户包缺失时的安装按钮
|
||
func (b *Button) LackButton() []*response.Button {
|
||
return []*response.Button{
|
||
{
|
||
Text: b.param.Str(config.ServicePackageLackButton),
|
||
Url: b.param.Str(config.ServicePackageLackUrl),
|
||
Type: config.ButtonClick,
|
||
},
|
||
}
|
||
}
|
||
|
||
// UpgradeButton 强制更新时的安装按钮,link 为运行时的包下载地址
|
||
func (b *Button) UpgradeButton(link string) []*response.Button {
|
||
return []*response.Button{
|
||
{
|
||
Text: b.param.Str(config.ServiceInstallButton),
|
||
Url: link,
|
||
Type: config.ButtonClick,
|
||
},
|
||
}
|
||
}
|
||
|
||
func (b *Button) ContractCustomer() []*response.Button {
|
||
return []*response.Button{
|
||
{
|
||
Text: b.param.Str(config.ServiceContactCustomer),
|
||
Url: b.param.Str(config.ServiceVipExpireUrl),
|
||
Type: config.ButtonClick,
|
||
},
|
||
}
|
||
}
|