12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package controllers
- import (
- "Yunlot/RunCode/ctl"
- "Yunlot/conf"
- "Yunlot/lib"
- "Yunlot/logs"
- "fmt"
- beego "github.com/beego/beego/v2/server/web"
- )
- type RuncodeController struct {
- beego.Controller
- }
- func (c *RuncodeController) Languages() {
- ctl.LanguagesController(c.Ctx.ResponseWriter, c.Ctx.Request)
- }
- func (c *RuncodeController) Run() {
- ctl.RunController(c.Ctx.ResponseWriter, c.Ctx.Request)
- }
- func (c *RuncodeController) Build() {
- ctl.BuildController(c.Ctx.Output, c.Ctx.ResponseWriter, c.Ctx.Request)
- }
- func (c *RuncodeController) Download() {
- T_describe, err := c.GetInt("T_describe")
- if err != nil {
- c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_describe!"}
- c.ServeJSON()
- return
- }
- if T_describe <= 0 {
- c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_describe!"}
- c.ServeJSON()
- return
- }
- filePath := conf.Analysis_Dir + fmt.Sprintf("%d.so", T_describe) // 替换为实际的文件路径
- logs.Println("filePath:", filePath)
- c.Ctx.Output.Download(filePath, fmt.Sprintf("%d.so", T_describe))
- return
- }
|