|
@@ -0,0 +1,52 @@
|
|
|
+/*
|
|
|
+ * @description: 项目管理首页
|
|
|
+ * @Author: CP
|
|
|
+ * @Date: 2021-01-18 14:57:19
|
|
|
+ * @FilePath: \construction_management\web\api\dashboard_api.go
|
|
|
+ */
|
|
|
+package api
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/kataras/iris/v12"
|
|
|
+ "go.mod/services"
|
|
|
+ "go.mod/web/utils"
|
|
|
+)
|
|
|
+
|
|
|
+type DashboardApi struct {
|
|
|
+ //框架-web应用上下文环境
|
|
|
+ Ctx iris.Context
|
|
|
+ // // 需要用的service
|
|
|
+ ServiceSafe services.SafeService
|
|
|
+ ServiceQuality services.QualityService
|
|
|
+}
|
|
|
+
|
|
|
+// @Summary 获得代办事项的内容
|
|
|
+// @Tags 代办事项
|
|
|
+// @Description 获得代办事项的内容
|
|
|
+// @Accept json
|
|
|
+// @Produce json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Success 200 {object} viewmodels.FolderContract "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}"
|
|
|
+// @Router /api/contract/folder [get]
|
|
|
+func (c *DashboardApi) Get() {
|
|
|
+ // 获得项目ID
|
|
|
+ projectId, err := utils.GetProjectId(c.Ctx)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 获得项目账号ID
|
|
|
+ projectAccountId, err := utils.GetProjectAccountId(c.Ctx)
|
|
|
+ if err != nil {
|
|
|
+ c.Ctx.JSON(iris.Map{"code": -1, "msg": err})
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ safeData := c.ServiceSafe.GetPending(projectId, projectAccountId)
|
|
|
+
|
|
|
+ c.Ctx.JSON(iris.Map{
|
|
|
+ "code": 0,
|
|
|
+ "msg": "",
|
|
|
+ "safeData": safeData,
|
|
|
+ })
|
|
|
+}
|