caipin před 4 roky
rodič
revize
0101fb73fd

+ 10 - 6
lib/permission.json

@@ -39,23 +39,23 @@
     },
     "safe": {
         "add": [
+            "/api/safe/add"
+        ],
+        "access": [
+            "/api/safe/detail",
             "/api/safe",
             "/api/safe_audit/back",
             "/api/safe_audit/close",
             "/api/safe_audit/pass",
             "/api/safe_audit/start"
         ],
-        "access": [
-            "/api/safe/detail",
-            "/api/safe"
-        ],
         "delete": [
             "/api/safe/del"
         ]
     },
     "quality": {
         "add": [
-            "/api/quality",
+            "/api/quality/add",
             "/api/quality_audit/back",
             "/api/quality_audit/close",
             "/api/quality_audit/pass",
@@ -63,7 +63,11 @@
         ],
         "access": [
             "/api/quality/detail",
-            "/api/quality"
+            "/api/quality",
+            "/api/quality_audit/back",
+            "/api/quality_audit/close",
+            "/api/quality_audit/pass",
+            "/api/quality_audit/start"
         ],
         "delete": [
             "/api/quality/del"

+ 31 - 0
web/api/oss_api.go

@@ -130,6 +130,37 @@ func (c *OssApi) GetSignature() {
 
 }
 
+// 下载文件
+func (c *OssApi) GetDown() {
+	// r.ParseForm() //解析url传递的参数,对于POST则解析响应包的主体(request body)
+	// //注意:如果没有调用ParseForm方法,下面无法获取表单的数据
+	// fileName := r.Form["filename"] //filename  文件名
+	// path := "/data/images/"        //文件存放目录
+	// file, err := os.Open(path + fileName[0])
+	// if err != nil {
+	//     fmt.Println(err)
+	//     return
+	// }
+	// defer file.Close()
+	// content, err := ioutil.ReadAll(file)
+
+	// c.Ctx.Header("Content-type:", "text/html; ") attachment;
+	c.Ctx.Header("Content-Disposition", "attachment; filename=\"https://file-upload.6jlzf.cn/xinxihua/01.%E5%BD%A2%E8%B1%A1%E8%BF%9B%E5%BA%A6.txt\"")
+	c.Ctx.Header("Content-Type", "text/plain;charset=utf-8")
+	// return "https://file-upload.6jlzf.cn/xinxihua/01.%E5%BD%A2%E8%B1%A1%E8%BF%9B%E5%BA%A6.txt"
+
+	// fileNames := url.QueryEscape(fileName[0]) // 防止中文乱码
+	// w.Header().Add("Content-Type", "application/octet-stream")
+	// w.Header().Add("Content-Disposition", "attachment; filename=\""+fileNames+"\"")
+
+	// if err != nil {
+	// 	fmt.Println("Read File Err:", err.Error())
+	// } else {
+	// 	w.Write(content)
+	// }
+
+}
+
 func handlerRequest(w http.ResponseWriter, r *http.Request) {
 	if r.Method == "GET" {
 		response := get_policy_token()

+ 2 - 2
web/api/quality_api.go

@@ -79,8 +79,8 @@ func (c *QualityApi) Get() {
 // @Param   position     body    string     true        "部位"
 // @Success 200 {object} viewmodels.Quality "{code:0成功,msg:}"
 // @Failure 400 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
-// @Router /api/quality [post]
-func (c *QualityApi) Post() {
+// @Router /api/quality/add [post]
+func (c *QualityApi) PostAdd() {
 	// 1.规则验证
 	qualityData, err := c.ServiceQuality.ValidRule(c.Ctx)
 	// fmt.Println("-------------------------------", err)

+ 2 - 2
web/api/safe_api.go

@@ -80,8 +80,8 @@ func (c *SafeApi) Get() {
 // @Param   position     body    string     true        "部位"
 // @Success 200 {object} viewmodels.Safe "{code:0成功,msg:}"
 // @Failure 400 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
-// @Router /api/safe [post]
-func (c *SafeApi) Post() {
+// @Router /api/safe/add [post]
+func (c *SafeApi) PostAdd() {
 	// 1.规则验证
 	safeData, err := c.ServiceSafe.ValidRule(c.Ctx)
 	// fmt.Println("-------------------------------", err)

+ 2 - 2
web/backstage/project_account_bs.go

@@ -211,7 +211,7 @@ func (c *ProjectAccountBs) PostSave() {
 }
 
 // @Summary 账号启用/禁用
-// @Tags 项目设置-管理员
+// @Tags 后台 - 项目账号
 // @Description 账号启用/禁用
 // @Accept  json
 // @Produce  json
@@ -253,7 +253,7 @@ func (c *ProjectAccountBs) PostEnable() {
 }
 
 // @Summary 设置账号密码
-// @Tags 项目设置-管理员
+// @Tags 后台 - 项目账号
 // @Description 设置账号密码
 // @Accept  json
 // @Produce  json

+ 20 - 21
web/routes/routes.go

@@ -12,7 +12,6 @@ import (
 	"go.mod/services"
 	"go.mod/web/api"
 	"go.mod/web/backstage"
-	"go.mod/web/controllers"
 	"go.mod/web/middleware"
 )
 
@@ -44,15 +43,15 @@ func Configure(b *bootstrap.Bootstrapper) {
 
 	//登录相关
 	//login := mvc.New(b.Party("/", protect))
-	login := mvc.New(b.Party("/"))
-	login.Register(ProjectAccountService)
-	login.Register(LoginService)
-	login.Handle(new(controllers.LoginController))
+	// login := mvc.New(b.Party("/"))
+	// login.Register(ProjectAccountService)
+	// login.Register(LoginService)
+	// login.Handle(new(controllers.LoginController))
 
 	// todolist相关
-	todo := mvc.New(b.Party("/todolist"))
-	todo.Router.Use(middleware.SessionsAuth)
-	todo.Handle(new(controllers.TodoController))
+	// todo := mvc.New(b.Party("/todolist"))
+	// todo.Router.Use(middleware.SessionsAuth)
+	// todo.Handle(new(controllers.TodoController))
 
 	// // 合同管理
 	// contract := mvc.New(b.Party("/contract"))
@@ -61,23 +60,23 @@ func Configure(b *bootstrap.Bootstrapper) {
 	// 安全巡检
 
 	//用户相关
-	account := mvc.New(b.Party("/account"))
-	account.Register(ProjectAccountService)
-	account.Router.Use(middleware.SessionsAuth)
-	account.Handle(new(controllers.AccountController))
+	// account := mvc.New(b.Party("/account"))
+	// account.Register(ProjectAccountService)
+	// account.Router.Use(middleware.SessionsAuth)
+	// account.Handle(new(controllers.AccountController))
 
 	// 项目相关
-	project := mvc.New(b.Party("/project"))
-	project.Router.Use(middleware.SessionsAuth)
-	project.Register(TreeService)
-	project.Register(ProjectService)
-	project.Handle(new(controllers.ProjectController))
+	// project := mvc.New(b.Party("/project"))
+	// project.Router.Use(middleware.SessionsAuth)
+	// project.Register(TreeService)
+	// project.Register(ProjectService)
+	// project.Handle(new(controllers.ProjectController))
 
 	//标段相关
-	bidsection := mvc.New(b.Party("/bidsection"))
-	bidsection.Register(ProjectService)
-	bidsection.Router.Use(middleware.SessionsAuth)
-	bidsection.Handle(new(controllers.BidsectionController))
+	// bidsection := mvc.New(b.Party("/bidsection"))
+	// bidsection.Register(ProjectService)
+	// bidsection.Router.Use(middleware.SessionsAuth)
+	// bidsection.Handle(new(controllers.BidsectionController))
 
 	// apiTree.Router.Use(middleware.JwtAuth().Serve)
 	// 接口相关