package controllers import ( "fmt" "wsc-go/enums" "wsc-go/service" "github.com/astaxie/beego" ) type FxlinkApiController struct { BaseAuthAPIController } func FxlinkApiRegistRouters() { beego.Router("/api/getfxlink", &FxlinkApiController{}, "get:GetFxlink") } func (c *FxlinkApiController) GetFxlink() { link := c.GetString("link", "") if link != "fxlink" && link != "sylink" && link != "zxlink" { c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误:link(sylink,zxlink,fxlink)") return } fxlink := beego.AppConfig.String(link) adminUserInfo := c.GetAdminUserInfo() orgId := adminUserInfo.CurrentOrgId appId := adminUserInfo.CurrentAppId thisApp := adminUserInfo.OrgApps[orgId][appId] creator := thisApp.Creator fxToken, fxTime := service.CreateFxToken(orgId, creator) fxlink = fxlink + fmt.Sprintf("&fxtoken=%s&fxorgid=%d×tamp=%d&fxadmin=%d", fxToken, orgId, fxTime, creator) c.ServeSuccessJSON(map[string]interface{}{ "fxlink": fxlink, }) return }