Browse Source

api文档

yuliang1112 3 years ago
parent
commit
db20e3764c
6 changed files with 565 additions and 46 deletions
  1. 1 1
      db/project.go
  2. 203 17
      docs/docs.go
  3. 202 16
      docs/swagger.json
  4. 137 12
      docs/swagger.yaml
  5. 11 0
      handler/project_change_taskStatus.go
  6. 11 0
      handler/project_taskList.go

+ 1 - 1
db/project.go

@@ -133,7 +133,7 @@ func GetProjectTaskList(ctx context.Context, projectID string, pageSize, pageNum
 	} else {
 		misNum = totalTask - totalAccount
 	}
-	logrus.Println("misNum:", misNum)
+	logrus.Println("totalAccount,totalTask,misNum:", totalAccount, totalTask, misNum)
 	// 查询该页数据
 	limit := pageSize + misNum
 	offset := pageSize * pageNum // assert pageNum start with 0

+ 203 - 17
docs/docs.go

@@ -1,4 +1,4 @@
-// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
+// Package docs GENERATED BY SWAG; DO NOT EDIT
 // This file was generated by swaggo/swag
 package docs
 
@@ -59,6 +59,37 @@ const docTemplate = `{
                 }
             }
         },
+        "/product/changeTaskStatus": {
+            "post": {
+                "description": "更改项目任务的状态",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "ProjectChangeTaskStatus 更改项目任务状态",
+                "parameters": [
+                    {
+                        "description": "更改项目任务状态的请求结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.ProjectChangeTaskStatusRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "更改项目任务状态相应结构体",
+                        "schema": {
+                            "$ref": "#/definitions/http_model.CommonResponse"
+                        }
+                    }
+                }
+            }
+        },
         "/product/create": {
             "post": {
                 "description": "企业创建商品,添加到商品库",
@@ -209,6 +240,49 @@ const docTemplate = `{
                 }
             }
         },
+        "/product/taskList": {
+            "post": {
+                "description": "展示某个项目的任务列表",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "ProjectTaskList 项目任务列表",
+                "parameters": [
+                    {
+                        "description": "查询项目的任务列表的请求结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.ProjectTaskListRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "查询项目的任务列表相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.ProjectTaskListData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/project/show": {
             "post": {
                 "description": "企业查看执行中项目",
@@ -482,14 +556,18 @@ const docTemplate = `{
                     "description": "内容形式",
                     "type": "string"
                 },
-                "project_fee_forms": {
-                    "description": "稿费形式",
-                    "type": "string"
-                },
                 "project_form": {
                     "description": "项目形式",
                     "type": "string"
                 },
+                "project_id": {
+                    "description": "项目ID",
+                    "type": "string"
+                },
+                "project_name": {
+                    "description": "项目名",
+                    "type": "string"
+                },
                 "project_platform": {
                     "description": "项目平台",
                     "type": "string"
@@ -508,16 +586,9 @@ const docTemplate = `{
             "type": "object",
             "properties": {
                 "project_content_type": {
-                    "description": "内容形式",
+                    "description": "ProjectFeeForms    []string ` + "`" + `json:\"project_fee_forms\"` + "`" + `    // 稿费形式",
                     "type": "string"
                 },
-                "project_fee_forms": {
-                    "description": "稿费形式",
-                    "type": "array",
-                    "items": {
-                        "type": "string"
-                    }
-                },
                 "project_form": {
                     "description": "项目形式",
                     "type": "string"
@@ -560,12 +631,115 @@ const docTemplate = `{
                 }
             }
         },
+        "http_model.ProjectChangeTaskStatusRequest": {
+            "type": "object",
+            "properties": {
+                "taskIds": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "task_status": {
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ProjectTaskListData": {
+            "type": "object",
+            "properties": {
+                "project_task_pre_view": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ProjectTaskPreview"
+                    }
+                },
+                "total": {
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ProjectTaskListRequest": {
+            "type": "object",
+            "properties": {
+                "page_num": {
+                    "type": "integer"
+                },
+                "page_size": {
+                    "type": "integer"
+                },
+                "platform_nickname": {
+                    "description": "账号昵称",
+                    "type": "string"
+                },
+                "project_id": {
+                    "description": "项目ID",
+                    "type": "string"
+                },
+                "strategy_id": {
+                    "description": "策略ID",
+                    "type": "string"
+                },
+                "task_id": {
+                    "description": "任务ID",
+                    "type": "string"
+                },
+                "task_status": {
+                    "description": "任务状态",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ProjectTaskPreview": {
+            "type": "object",
+            "properties": {
+                "create_date": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "fans_count": {
+                    "description": "粉丝数",
+                    "type": "string"
+                },
+                "home_page_capture_url": {
+                    "description": "主页链接",
+                    "type": "string"
+                },
+                "platform_nickname": {
+                    "description": "账号昵称",
+                    "type": "string"
+                },
+                "strategy_id": {
+                    "description": "报名选择的招募策略id",
+                    "type": "string"
+                },
+                "talent_personal_info_snap": {
+                    "description": "达人个人信息快照",
+                    "type": "string"
+                },
+                "task_id": {
+                    "description": "任务ID",
+                    "type": "string"
+                },
+                "task_reward": {
+                    "description": "任务奖励金额",
+                    "type": "string"
+                },
+                "task_status": {
+                    "description": "任务状态",
+                    "type": "string"
+                }
+            }
+        },
         "http_model.SendCodeData": {
             "type": "object"
         },
         "http_model.SendCodeRequest": {
             "type": "object",
             "properties": {
+                "email": {
+                    "type": "string"
+                },
                 "phone": {
                     "type": "string"
                 }
@@ -574,14 +748,22 @@ const docTemplate = `{
         "http_model.ShowProjectData": {
             "type": "object",
             "properties": {
-                "Project_id": {
-                    "description": "项目id",
-                    "type": "string"
-                },
                 "content_type": {
                     "description": "内容形式,1代表图文,2代表视频",
                     "type": "string"
                 },
+                "create_at": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "enterprise_id": {
+                    "description": "企业id",
+                    "type": "string"
+                },
+                "phone": {
+                    "description": "联系方式",
+                    "type": "string"
+                },
                 "product_id": {
                     "description": "关联商品id",
                     "type": "string"
@@ -594,6 +776,10 @@ const docTemplate = `{
                     "description": "项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创",
                     "type": "string"
                 },
+                "project_id": {
+                    "description": "项目id",
+                    "type": "string"
+                },
                 "project_name": {
                     "description": "项目名称",
                     "type": "string"

+ 202 - 16
docs/swagger.json

@@ -47,6 +47,37 @@
                 }
             }
         },
+        "/product/changeTaskStatus": {
+            "post": {
+                "description": "更改项目任务的状态",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "ProjectChangeTaskStatus 更改项目任务状态",
+                "parameters": [
+                    {
+                        "description": "更改项目任务状态的请求结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.ProjectChangeTaskStatusRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "更改项目任务状态相应结构体",
+                        "schema": {
+                            "$ref": "#/definitions/http_model.CommonResponse"
+                        }
+                    }
+                }
+            }
+        },
         "/product/create": {
             "post": {
                 "description": "企业创建商品,添加到商品库",
@@ -197,6 +228,49 @@
                 }
             }
         },
+        "/product/taskList": {
+            "post": {
+                "description": "展示某个项目的任务列表",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "ProjectTaskList 项目任务列表",
+                "parameters": [
+                    {
+                        "description": "查询项目的任务列表的请求结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.ProjectTaskListRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "查询项目的任务列表相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.ProjectTaskListData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/project/show": {
             "post": {
                 "description": "企业查看执行中项目",
@@ -470,14 +544,18 @@
                     "description": "内容形式",
                     "type": "string"
                 },
-                "project_fee_forms": {
-                    "description": "稿费形式",
-                    "type": "string"
-                },
                 "project_form": {
                     "description": "项目形式",
                     "type": "string"
                 },
+                "project_id": {
+                    "description": "项目ID",
+                    "type": "string"
+                },
+                "project_name": {
+                    "description": "项目名",
+                    "type": "string"
+                },
                 "project_platform": {
                     "description": "项目平台",
                     "type": "string"
@@ -496,16 +574,9 @@
             "type": "object",
             "properties": {
                 "project_content_type": {
-                    "description": "内容形式",
+                    "description": "ProjectFeeForms    []string `json:\"project_fee_forms\"`    // 稿费形式",
                     "type": "string"
                 },
-                "project_fee_forms": {
-                    "description": "稿费形式",
-                    "type": "array",
-                    "items": {
-                        "type": "string"
-                    }
-                },
                 "project_form": {
                     "description": "项目形式",
                     "type": "string"
@@ -548,12 +619,115 @@
                 }
             }
         },
+        "http_model.ProjectChangeTaskStatusRequest": {
+            "type": "object",
+            "properties": {
+                "taskIds": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "task_status": {
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ProjectTaskListData": {
+            "type": "object",
+            "properties": {
+                "project_task_pre_view": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ProjectTaskPreview"
+                    }
+                },
+                "total": {
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ProjectTaskListRequest": {
+            "type": "object",
+            "properties": {
+                "page_num": {
+                    "type": "integer"
+                },
+                "page_size": {
+                    "type": "integer"
+                },
+                "platform_nickname": {
+                    "description": "账号昵称",
+                    "type": "string"
+                },
+                "project_id": {
+                    "description": "项目ID",
+                    "type": "string"
+                },
+                "strategy_id": {
+                    "description": "策略ID",
+                    "type": "string"
+                },
+                "task_id": {
+                    "description": "任务ID",
+                    "type": "string"
+                },
+                "task_status": {
+                    "description": "任务状态",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ProjectTaskPreview": {
+            "type": "object",
+            "properties": {
+                "create_date": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "fans_count": {
+                    "description": "粉丝数",
+                    "type": "string"
+                },
+                "home_page_capture_url": {
+                    "description": "主页链接",
+                    "type": "string"
+                },
+                "platform_nickname": {
+                    "description": "账号昵称",
+                    "type": "string"
+                },
+                "strategy_id": {
+                    "description": "报名选择的招募策略id",
+                    "type": "string"
+                },
+                "talent_personal_info_snap": {
+                    "description": "达人个人信息快照",
+                    "type": "string"
+                },
+                "task_id": {
+                    "description": "任务ID",
+                    "type": "string"
+                },
+                "task_reward": {
+                    "description": "任务奖励金额",
+                    "type": "string"
+                },
+                "task_status": {
+                    "description": "任务状态",
+                    "type": "string"
+                }
+            }
+        },
         "http_model.SendCodeData": {
             "type": "object"
         },
         "http_model.SendCodeRequest": {
             "type": "object",
             "properties": {
+                "email": {
+                    "type": "string"
+                },
                 "phone": {
                     "type": "string"
                 }
@@ -562,14 +736,22 @@
         "http_model.ShowProjectData": {
             "type": "object",
             "properties": {
-                "Project_id": {
-                    "description": "项目id",
-                    "type": "string"
-                },
                 "content_type": {
                     "description": "内容形式,1代表图文,2代表视频",
                     "type": "string"
                 },
+                "create_at": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "enterprise_id": {
+                    "description": "企业id",
+                    "type": "string"
+                },
+                "phone": {
+                    "description": "联系方式",
+                    "type": "string"
+                },
                 "product_id": {
                     "description": "关联商品id",
                     "type": "string"
@@ -582,6 +764,10 @@
                     "description": "项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创",
                     "type": "string"
                 },
+                "project_id": {
+                    "description": "项目id",
+                    "type": "string"
+                },
                 "project_name": {
                     "description": "项目名称",
                     "type": "string"

+ 137 - 12
docs/swagger.yaml

@@ -121,12 +121,15 @@ definitions:
       project_content_type:
         description: 内容形式
         type: string
-      project_fee_forms:
-        description: 稿费形式
-        type: string
       project_form:
         description: 项目形式
         type: string
+      project_id:
+        description: 项目ID
+        type: string
+      project_name:
+        description: 项目名
+        type: string
       project_platform:
         description: 项目平台
         type: string
@@ -140,13 +143,9 @@ definitions:
   http_model.FullProjectPreview:
     properties:
       project_content_type:
-        description: 内容形式
+        description: ProjectFeeForms    []string `json:"project_fee_forms"`    //
+          稿费形式
         type: string
-      project_fee_forms:
-        description: 稿费形式
-        items:
-          type: string
-        type: array
       project_form:
         description: 项目形式
         type: string
@@ -177,21 +176,99 @@ definitions:
         description: 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
         type: integer
     type: object
+  http_model.ProjectChangeTaskStatusRequest:
+    properties:
+      task_status:
+        type: string
+      taskIds:
+        items:
+          type: string
+        type: array
+    type: object
+  http_model.ProjectTaskListData:
+    properties:
+      project_task_pre_view:
+        items:
+          $ref: '#/definitions/http_model.ProjectTaskPreview'
+        type: array
+      total:
+        type: string
+    type: object
+  http_model.ProjectTaskListRequest:
+    properties:
+      page_num:
+        type: integer
+      page_size:
+        type: integer
+      platform_nickname:
+        description: 账号昵称
+        type: string
+      project_id:
+        description: 项目ID
+        type: string
+      strategy_id:
+        description: 策略ID
+        type: string
+      task_id:
+        description: 任务ID
+        type: string
+      task_status:
+        description: 任务状态
+        type: string
+    type: object
+  http_model.ProjectTaskPreview:
+    properties:
+      create_date:
+        description: 创建时间
+        type: string
+      fans_count:
+        description: 粉丝数
+        type: string
+      home_page_capture_url:
+        description: 主页链接
+        type: string
+      platform_nickname:
+        description: 账号昵称
+        type: string
+      strategy_id:
+        description: 报名选择的招募策略id
+        type: string
+      talent_personal_info_snap:
+        description: 达人个人信息快照
+        type: string
+      task_id:
+        description: 任务ID
+        type: string
+      task_reward:
+        description: 任务奖励金额
+        type: string
+      task_status:
+        description: 任务状态
+        type: string
+    type: object
   http_model.SendCodeData:
     type: object
   http_model.SendCodeRequest:
     properties:
+      email:
+        type: string
       phone:
         type: string
     type: object
   http_model.ShowProjectData:
     properties:
-      Project_id:
-        description: 项目id
-        type: string
       content_type:
         description: 内容形式,1代表图文,2代表视频
         type: string
+      create_at:
+        description: 创建时间
+        type: string
+      enterprise_id:
+        description: 企业id
+        type: string
+      phone:
+        description: 联系方式
+        type: string
       product_id:
         description: 关联商品id
         type: string
@@ -201,6 +278,9 @@ definitions:
       project_form:
         description: 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
         type: string
+      project_id:
+        description: 项目id
+        type: string
       project_name:
         description: 项目名称
         type: string
@@ -293,6 +373,26 @@ paths:
                   $ref: '#/definitions/http_model.CodeLoginData'
               type: object
       summary: login 登录
+  /product/changeTaskStatus:
+    post:
+      consumes:
+      - application/json
+      description: 更改项目任务的状态
+      parameters:
+      - description: 更改项目任务状态的请求结构体
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/http_model.ProjectChangeTaskStatusRequest'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 更改项目任务状态相应结构体
+          schema:
+            $ref: '#/definitions/http_model.CommonResponse'
+      summary: ProjectChangeTaskStatus 更改项目任务状态
   /product/create:
     post:
       consumes:
@@ -383,6 +483,31 @@ paths:
                   $ref: '#/definitions/http_model.FullProjectListData'
               type: object
       summary: ProjectList 商品列表
+  /product/taskList:
+    post:
+      consumes:
+      - application/json
+      description: 展示某个项目的任务列表
+      parameters:
+      - description: 查询项目的任务列表的请求结构体
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/http_model.ProjectTaskListRequest'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 查询项目的任务列表相应结构体
+          schema:
+            allOf:
+            - $ref: '#/definitions/http_model.CommonResponse'
+            - properties:
+                data:
+                  $ref: '#/definitions/http_model.ProjectTaskListData'
+              type: object
+      summary: ProjectTaskList 项目任务列表
   /project/show:
     post:
       consumes:

+ 11 - 0
handler/project_change_taskStatus.go

@@ -11,6 +11,17 @@ import (
 	"github.com/gin-gonic/gin"
 )
 
+// WrapProjectChangeTaskStatusHandler
+// @BasePath /youngee/m/
+// SendCode godoc
+// @Summary ProjectChangeTaskStatus 更改项目任务状态
+// @Schemes
+// @Description  更改项目任务的状态
+// @Accept json
+// @Produce json
+// @Param req body http_model.ProjectChangeTaskStatusRequest true "更改项目任务状态的请求结构体"
+// @Success 200 {object} http_model.CommonResponse{} "更改项目任务状态相应结构体"
+// @Router /product/changeTaskStatus [post]
 func WrapProjectChangeTaskStatusHandler(ctx *gin.Context) {
 	handler := newProjectChangeTaskStatusHandler(ctx)
 	baseRun(handler)

+ 11 - 0
handler/project_taskList.go

@@ -14,6 +14,17 @@ import (
 	"github.com/sirupsen/logrus"
 )
 
+// WrapProjectTaskListHandler
+// @BasePath /youngee/m/
+// SendCode godoc
+// @Summary ProjectTaskList 项目任务列表
+// @Schemes
+// @Description 展示某个项目的任务列表
+// @Accept json
+// @Produce json
+// @Param req body http_model.ProjectTaskListRequest true "查询项目的任务列表的请求结构体"
+// @Success 200 {object} http_model.CommonResponse{data=http_model.ProjectTaskListData} "查询项目的任务列表相应结构体"
+// @Router /product/taskList [post]
 func WrapProjectTaskListHandler(ctx *gin.Context) {
 	handler := newProjectTaskListHandler(ctx)
 	baseRun(handler)