144 lines
5.3 KiB
Go
144 lines
5.3 KiB
Go
package controllers
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
"time"
|
|
|
|
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
|
|
|
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
|
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
|
|
"git.rosy.net.cn/jx-callback/business/jxutils/eventhub/syseventhub"
|
|
"git.rosy.net.cn/jx-callback/business/model"
|
|
"github.com/astaxie/beego"
|
|
)
|
|
|
|
type SysController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
// @Title 得到微信token
|
|
// @Description 得到微信token
|
|
// @Param accessKey query string true "假token"
|
|
// @Param oldToken query string false "之前的token"
|
|
// @Param waitSecond query int false "等待秒数"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetWXToken [get]
|
|
func (c *SysController) GetWXToken() {
|
|
c.callGetWXToken(func(params *tSysGetWXTokenParams) (retVal interface{}, errCode string, err error) {
|
|
if params.AccessKey == globals.GetWeixinTokenKey {
|
|
retVal = syseventhub.SysEventHub.GetWXToken(params.OldToken, time.Duration(params.WaitSecond)*time.Second)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 得到微信小程序2token
|
|
// @Description 得到微信小程序2token
|
|
// @Param accessKey query string true "假token"
|
|
// @Param oldToken query string false "之前的token"
|
|
// @Param waitSecond query int false "等待秒数"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetWX2Token [get]
|
|
func (c *SysController) GetWX2Token() {
|
|
c.callGetWX2Token(func(params *tSysGetWX2TokenParams) (retVal interface{}, errCode string, err error) {
|
|
if params.AccessKey == globals.GetWeixinTokenKey {
|
|
retVal = syseventhub.SysEventHub.GetWX2Token(params.OldToken, time.Duration(params.WaitSecond)*time.Second)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 得到易联云token
|
|
// @Description 得到易联云token
|
|
// @Param accessKey query string true "假token"
|
|
// @Param oldToken query string false "之前的token"
|
|
// @Param waitSecond query int false "等待秒数"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetYLYToken [get]
|
|
func (c *SysController) GetYLYToken() {
|
|
c.callGetYLYToken(func(params *tSysGetYLYTokenParams) (retVal interface{}, errCode string, err error) {
|
|
if params.AccessKey == globals.GetWeixinTokenKey {
|
|
retVal = syseventhub.SysEventHub.GetYLYToken(params.OldToken, time.Duration(params.WaitSecond)*time.Second)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 得到个推token
|
|
// @Description 得到个推token
|
|
// @Param accessKey query string true "假token"
|
|
// @Param oldToken query string false "之前的token"
|
|
// @Param waitSecond query int false "等待秒数"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetPushToken [get]
|
|
func (c *SysController) GetPushToken() {
|
|
c.callGetPushToken(func(params *tSysGetPushTokenParams) (retVal interface{}, errCode string, err error) {
|
|
if params.AccessKey == globals.GetWeixinTokenKey {
|
|
retVal = syseventhub.SysEventHub.GetPushToken(params.OldToken, time.Duration(params.WaitSecond)*time.Second)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 得到微盟token
|
|
// @Description 得到微盟token
|
|
// @Param accessKey query string true "假token"
|
|
// @Param oldToken query string false "之前的token"
|
|
// @Param waitSecond query int false "等待秒数"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetWeimobToken [get]
|
|
func (c *SysController) GetWeimobToken() {
|
|
c.callGetWeimobToken(func(params *tSysGetWeimobTokenParams) (retVal interface{}, errCode string, err error) {
|
|
if params.AccessKey == globals.GetWeixinTokenKey {
|
|
retVal = syseventhub.SysEventHub.GetWeimobToken(params.OldToken, time.Duration(params.WaitSecond)*time.Second)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 得到饿百RTF转换内容
|
|
// @Description 得到饿百RTF转换内容
|
|
// @Param imgListStr query string true "逗号分隔的图片列表可以是转义后的"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetEbaiRTFDetail [get]
|
|
func (c *SysController) GetEbaiRTFDetail() {
|
|
var html string
|
|
c.callGetEbaiRTFDetail(func(params *tSysGetEbaiRTFDetailParams) (retVal interface{}, errCode string, err error) {
|
|
params.ImgListStr, _ = url.QueryUnescape(params.ImgListStr)
|
|
imgList := strings.Split(params.ImgListStr, ",")
|
|
html = ebaiapi.BuildRFTFromImgs(imgList...)
|
|
return retVal, model.ErrorCodeIgnore, err
|
|
})
|
|
w := c.Ctx.ResponseWriter
|
|
w.Header().Add("Content-Type", "text/html")
|
|
w.WriteHeader(http.StatusOK)
|
|
io.WriteString(w, html)
|
|
}
|
|
|
|
// @Title 得到平台账号信息
|
|
// @Description 得到平台账号信息
|
|
// @Param token header string true "token"
|
|
// @Param vendorID query int false "平台ID"
|
|
// @Param vendorOrgCode query string false "平台账号"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetVendorOrgCode [get]
|
|
func (c *SysController) GetVendorOrgCode() {
|
|
c.callGetVendorOrgCode(func(params *tSysGetVendorOrgCodeParams) (retVal interface{}, errCode string, err error) {
|
|
retVal, err = common.GetVendorOrgCode(params.Ctx, params.VendorID, params.VendorOrgCode)
|
|
return retVal, "", err
|
|
})
|
|
}
|