package controllers import ( "io" "net/http" "net/url" "strings" "time" "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 得到易联云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 /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) }