package work import ( "time" "zhiyuan/models" "zhiyuan/pkg/app" "zhiyuan/pkg/utils" "github.com/gin-gonic/gin" ) func WorkWorkPkgCopy(c *gin.Context) { id := utils.ToInt(c.Param("id")) if id <= 0 { app.ErrorMsg(c, "id must be a number", nil) return } pkg := models.GetWorkPkgModel(int64(id), true) if pkg == nil { app.ErrorMsg(c, "项目不存在", nil) return } order := time.Now().Unix() cid, err := pkg.Copy(pkg.Name, order) if err != nil { app.ErrorMsg(c, err.Error(), nil) return } app.Success(c, gin.H{"id": cid}) }