shenzekai 3 лет назад
Родитель
Сommit
ae2784803e

+ 1 - 1
config/pro.yaml

@@ -15,4 +15,4 @@ server:
   host: 0.0.0.0
   port: 8300
   session:
-    ttl: 60 #minute
+    ttl: -1 #minute

+ 38 - 2
db/project.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"fmt"
 	"github.com/sirupsen/logrus"
+	"gorm.io/gorm"
 	"reflect"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/gorm_model"
@@ -22,7 +23,7 @@ func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageN
 	db := GetReadDB(ctx)
 	// 根据企业id过滤
 	db = db.Debug().Model(gorm_model.ProjectInfo{}).Where("enterprise_id = ?", enterpriseID)
-	logrus.Printf("db:%V",db)
+	logrus.Printf("db:%V", db)
 	// 根据Project条件过滤
 	conditionType := reflect.TypeOf(condition).Elem()
 	conditionValue := reflect.ValueOf(condition).Elem()
@@ -32,7 +33,7 @@ func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageN
 		value := conditionValue.FieldByName(field.Name)
 		db = db.Where(fmt.Sprintf("%s = ?", tag), value)
 	}
-	logrus.Printf("db:%V",db)
+	logrus.Printf("db:%V", db)
 	// 查询总数
 	var total int64
 	var fullProjects []*gorm_model.ProjectInfo
@@ -50,3 +51,38 @@ func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageN
 	}
 	return fullProjects, total, nil
 }
+
+func GetProjectDetail(ctx context.Context, projectID int64) (*gorm_model.ProjectInfo, error) {
+	db := GetReadDB(ctx)
+	var ProjectDetail *gorm_model.ProjectInfo
+	err := db.Where("project_id = ?", projectID).First(&ProjectDetail).Error
+	if err != nil {
+		if err == gorm.ErrRecordNotFound {
+			return nil, nil
+		} else {
+			return nil, err
+		}
+	}
+	fmt.Printf("look %+v", ProjectDetail.EnterpriseID)
+	return ProjectDetail, nil
+}
+
+func GetProjectPhoto(ctx context.Context, ProjectID int64) ([]gorm_model.ProjectPhoto, error) {
+	db := GetReadDB(ctx)
+	ProjectPhoto := []gorm_model.ProjectPhoto{}
+	err := db.Where("project_id=?", ProjectID).Find(&ProjectPhoto).Error
+	if err != nil {
+		return nil, err
+	}
+	return ProjectPhoto, nil
+}
+
+func GetRecruitStrategys(ctx context.Context, ProjectID int64) ([]gorm_model.RecruitStrategy, error) {
+	db := GetReadDB(ctx)
+	RecruitStrategys := []gorm_model.RecruitStrategy{}
+	err := db.Where("project_id=?", ProjectID).Find(&RecruitStrategys).Error
+	if err != nil {
+		return nil, err
+	}
+	return RecruitStrategys, nil
+}

+ 347 - 2
docs/docs.go

@@ -1,4 +1,4 @@
-// Package docs GENERATED BY SWAG; DO NOT EDIT
+// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 // This file was generated by swaggo/swag
 package docs
 
@@ -16,6 +16,49 @@ const docTemplate = `{
     "host": "{{.Host}}",
     "basePath": "{{.BasePath}}",
     "paths": {
+        "/login": {
+            "post": {
+                "description": "输入手机号和验证码,并登录",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "login 登录",
+                "parameters": [
+                    {
+                        "description": "登录输入内容请求参数结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.CodeLoginRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "登录返回相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.CodeLoginData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/product/create": {
             "post": {
                 "description": "企业创建商品,添加到商品库",
@@ -66,8 +109,58 @@ const docTemplate = `{
                 }
             }
         },
+        "/product/find": {
+            "post": {
+                "description": "根据产品名称查询产品信息",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "findProduct 根据产品名称查询产品信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "登录TOKEN信息",
+                        "name": "Authorization",
+                        "in": "header",
+                        "required": true
+                    },
+                    {
+                        "description": "发送产品id请求参数结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.FindProductRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "查询对应产品返回相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.FindProductData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/product/list": {
-            "get": {
+            "post": {
                 "description": "展示企业的商品列表",
                 "consumes": [
                     "application/json"
@@ -116,6 +209,56 @@ const docTemplate = `{
                 }
             }
         },
+        "/project/show": {
+            "post": {
+                "description": "企业查看执行中项目",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "CreateProduct 创建商品",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "登录TOKEN信息",
+                        "name": "Authorization",
+                        "in": "header",
+                        "required": true
+                    },
+                    {
+                        "description": "查看项目请求结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.ShowProjectRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "查看项目相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.ShowProjectData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/sendCode": {
             "post": {
                 "description": "发送验证码,每次发送到邮箱",
@@ -161,6 +304,25 @@ const docTemplate = `{
         }
     },
     "definitions": {
+        "http_model.CodeLoginData": {
+            "type": "object",
+            "properties": {
+                "token": {
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.CodeLoginRequest": {
+            "type": "object",
+            "properties": {
+                "code": {
+                    "type": "string"
+                },
+                "phone": {
+                    "type": "string"
+                }
+            }
+        },
         "http_model.CommonResponse": {
             "type": "object",
             "properties": {
@@ -239,6 +401,60 @@ const docTemplate = `{
                 }
             }
         },
+        "http_model.FindProductData": {
+            "type": "object",
+            "properties": {
+                "brand_name": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "enterprise_id": {
+                    "description": "所属企业id",
+                    "type": "integer"
+                },
+                "product_detail": {
+                    "type": "string"
+                },
+                "product_id": {
+                    "type": "integer"
+                },
+                "product_name": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "product_photos": {
+                    "description": "商品图片列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ProductPhoto"
+                    }
+                },
+                "product_price": {
+                    "description": "商品价值",
+                    "type": "integer"
+                },
+                "product_type": {
+                    "description": "商品类型",
+                    "type": "integer"
+                },
+                "product_url": {
+                    "description": "商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;",
+                    "type": "string"
+                },
+                "shop_address": {
+                    "description": "店铺地址,商品类型为线下品牌时需填写",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.FindProductRequest": {
+            "type": "object",
+            "properties": {
+                "product_id": {
+                    "type": "integer"
+                }
+            }
+        },
         "http_model.FullProjectListData": {
             "type": "object",
             "properties": {
@@ -328,6 +544,22 @@ const docTemplate = `{
                 }
             }
         },
+        "http_model.ProductPhoto": {
+            "type": "object",
+            "properties": {
+                "photo_uid": {
+                    "type": "string"
+                },
+                "photo_url": {
+                    "description": "图片或视频url",
+                    "type": "string"
+                },
+                "symbol": {
+                    "description": "图片为主图或详情图标志位,1为主图,2为详情图,3为视频",
+                    "type": "integer"
+                }
+            }
+        },
         "http_model.SendCodeData": {
             "type": "object"
         },
@@ -338,6 +570,119 @@ const docTemplate = `{
                     "type": "string"
                 }
             }
+        },
+        "http_model.ShowProjectData": {
+            "type": "object",
+            "properties": {
+                "Project_id": {
+                    "description": "项目id",
+                    "type": "string"
+                },
+                "content_type": {
+                    "description": "内容形式,1代表图文,2代表视频",
+                    "type": "string"
+                },
+                "product_id": {
+                    "description": "关联商品id",
+                    "type": "string"
+                },
+                "project_detail": {
+                    "description": "项目详情",
+                    "type": "string"
+                },
+                "project_form": {
+                    "description": "项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创",
+                    "type": "string"
+                },
+                "project_name": {
+                    "description": "项目名称",
+                    "type": "string"
+                },
+                "project_photos": {
+                    "description": "项目图片",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ShowProjectPhoto"
+                    }
+                },
+                "project_platform": {
+                    "description": "项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎",
+                    "type": "string"
+                },
+                "project_status": {
+                    "description": "项目状态,1-7分别代表创建中、待审核、招募中、待支付、失效、执行中、已结案",
+                    "type": "string"
+                },
+                "project_type": {
+                    "description": "项目类型,1代表全流程项目,2代表专项项目",
+                    "type": "string"
+                },
+                "recruit_ddl": {
+                    "description": "招募截止时间",
+                    "type": "string"
+                },
+                "recruit_strategys": {
+                    "description": "定价策略",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ShowRecruitStrategy"
+                    }
+                },
+                "talent_type": {
+                    "description": "达人类型",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ShowProjectPhoto": {
+            "type": "object",
+            "properties": {
+                "photo_uid": {
+                    "type": "string"
+                },
+                "photo_url": {
+                    "description": "图片url",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ShowProjectRequest": {
+            "type": "object",
+            "properties": {
+                "Project_id": {
+                    "description": "项目id",
+                    "type": "integer"
+                }
+            }
+        },
+        "http_model.ShowRecruitStrategy": {
+            "type": "object",
+            "properties": {
+                "fee_form": {
+                    "description": "稿费形式,1-3分别代表自报价、固定稿费、产品置换",
+                    "type": "string"
+                },
+                "followers_low": {
+                    "description": "达人粉丝数下限",
+                    "type": "string"
+                },
+                "followers_up": {
+                    "description": "达人粉丝数上限",
+                    "type": "string"
+                },
+                "offer": {
+                    "description": "报价",
+                    "type": "string"
+                },
+                "recruit_number": {
+                    "description": "招募数量",
+                    "type": "string"
+                },
+                "strategy_id": {
+                    "description": "策略id",
+                    "type": "string"
+                }
+            }
         }
     }
 }`

+ 346 - 1
docs/swagger.json

@@ -4,6 +4,49 @@
         "contact": {}
     },
     "paths": {
+        "/login": {
+            "post": {
+                "description": "输入手机号和验证码,并登录",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "login 登录",
+                "parameters": [
+                    {
+                        "description": "登录输入内容请求参数结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.CodeLoginRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "登录返回相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.CodeLoginData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/product/create": {
             "post": {
                 "description": "企业创建商品,添加到商品库",
@@ -54,8 +97,58 @@
                 }
             }
         },
+        "/product/find": {
+            "post": {
+                "description": "根据产品名称查询产品信息",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "findProduct 根据产品名称查询产品信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "登录TOKEN信息",
+                        "name": "Authorization",
+                        "in": "header",
+                        "required": true
+                    },
+                    {
+                        "description": "发送产品id请求参数结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.FindProductRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "查询对应产品返回相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.FindProductData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/product/list": {
-            "get": {
+            "post": {
                 "description": "展示企业的商品列表",
                 "consumes": [
                     "application/json"
@@ -104,6 +197,56 @@
                 }
             }
         },
+        "/project/show": {
+            "post": {
+                "description": "企业查看执行中项目",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "summary": "CreateProduct 创建商品",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "登录TOKEN信息",
+                        "name": "Authorization",
+                        "in": "header",
+                        "required": true
+                    },
+                    {
+                        "description": "查看项目请求结构体",
+                        "name": "req",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/http_model.ShowProjectRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "查看项目相应结构体",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/http_model.CommonResponse"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/http_model.ShowProjectData"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/sendCode": {
             "post": {
                 "description": "发送验证码,每次发送到邮箱",
@@ -149,6 +292,25 @@
         }
     },
     "definitions": {
+        "http_model.CodeLoginData": {
+            "type": "object",
+            "properties": {
+                "token": {
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.CodeLoginRequest": {
+            "type": "object",
+            "properties": {
+                "code": {
+                    "type": "string"
+                },
+                "phone": {
+                    "type": "string"
+                }
+            }
+        },
         "http_model.CommonResponse": {
             "type": "object",
             "properties": {
@@ -227,6 +389,60 @@
                 }
             }
         },
+        "http_model.FindProductData": {
+            "type": "object",
+            "properties": {
+                "brand_name": {
+                    "description": "品牌名称",
+                    "type": "string"
+                },
+                "enterprise_id": {
+                    "description": "所属企业id",
+                    "type": "integer"
+                },
+                "product_detail": {
+                    "type": "string"
+                },
+                "product_id": {
+                    "type": "integer"
+                },
+                "product_name": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "product_photos": {
+                    "description": "商品图片列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ProductPhoto"
+                    }
+                },
+                "product_price": {
+                    "description": "商品价值",
+                    "type": "integer"
+                },
+                "product_type": {
+                    "description": "商品类型",
+                    "type": "integer"
+                },
+                "product_url": {
+                    "description": "商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;",
+                    "type": "string"
+                },
+                "shop_address": {
+                    "description": "店铺地址,商品类型为线下品牌时需填写",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.FindProductRequest": {
+            "type": "object",
+            "properties": {
+                "product_id": {
+                    "type": "integer"
+                }
+            }
+        },
         "http_model.FullProjectListData": {
             "type": "object",
             "properties": {
@@ -316,6 +532,22 @@
                 }
             }
         },
+        "http_model.ProductPhoto": {
+            "type": "object",
+            "properties": {
+                "photo_uid": {
+                    "type": "string"
+                },
+                "photo_url": {
+                    "description": "图片或视频url",
+                    "type": "string"
+                },
+                "symbol": {
+                    "description": "图片为主图或详情图标志位,1为主图,2为详情图,3为视频",
+                    "type": "integer"
+                }
+            }
+        },
         "http_model.SendCodeData": {
             "type": "object"
         },
@@ -326,6 +558,119 @@
                     "type": "string"
                 }
             }
+        },
+        "http_model.ShowProjectData": {
+            "type": "object",
+            "properties": {
+                "Project_id": {
+                    "description": "项目id",
+                    "type": "string"
+                },
+                "content_type": {
+                    "description": "内容形式,1代表图文,2代表视频",
+                    "type": "string"
+                },
+                "product_id": {
+                    "description": "关联商品id",
+                    "type": "string"
+                },
+                "project_detail": {
+                    "description": "项目详情",
+                    "type": "string"
+                },
+                "project_form": {
+                    "description": "项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创",
+                    "type": "string"
+                },
+                "project_name": {
+                    "description": "项目名称",
+                    "type": "string"
+                },
+                "project_photos": {
+                    "description": "项目图片",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ShowProjectPhoto"
+                    }
+                },
+                "project_platform": {
+                    "description": "项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎",
+                    "type": "string"
+                },
+                "project_status": {
+                    "description": "项目状态,1-7分别代表创建中、待审核、招募中、待支付、失效、执行中、已结案",
+                    "type": "string"
+                },
+                "project_type": {
+                    "description": "项目类型,1代表全流程项目,2代表专项项目",
+                    "type": "string"
+                },
+                "recruit_ddl": {
+                    "description": "招募截止时间",
+                    "type": "string"
+                },
+                "recruit_strategys": {
+                    "description": "定价策略",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/http_model.ShowRecruitStrategy"
+                    }
+                },
+                "talent_type": {
+                    "description": "达人类型",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ShowProjectPhoto": {
+            "type": "object",
+            "properties": {
+                "photo_uid": {
+                    "type": "string"
+                },
+                "photo_url": {
+                    "description": "图片url",
+                    "type": "string"
+                }
+            }
+        },
+        "http_model.ShowProjectRequest": {
+            "type": "object",
+            "properties": {
+                "Project_id": {
+                    "description": "项目id",
+                    "type": "integer"
+                }
+            }
+        },
+        "http_model.ShowRecruitStrategy": {
+            "type": "object",
+            "properties": {
+                "fee_form": {
+                    "description": "稿费形式,1-3分别代表自报价、固定稿费、产品置换",
+                    "type": "string"
+                },
+                "followers_low": {
+                    "description": "达人粉丝数下限",
+                    "type": "string"
+                },
+                "followers_up": {
+                    "description": "达人粉丝数上限",
+                    "type": "string"
+                },
+                "offer": {
+                    "description": "报价",
+                    "type": "string"
+                },
+                "recruit_number": {
+                    "description": "招募数量",
+                    "type": "string"
+                },
+                "strategy_id": {
+                    "description": "策略id",
+                    "type": "string"
+                }
+            }
         }
     }
 }

+ 228 - 1
docs/swagger.yaml

@@ -1,4 +1,16 @@
 definitions:
+  http_model.CodeLoginData:
+    properties:
+      token:
+        type: string
+    type: object
+  http_model.CodeLoginRequest:
+    properties:
+      code:
+        type: string
+      phone:
+        type: string
+    type: object
   http_model.CommonResponse:
     properties:
       data: {}
@@ -53,6 +65,44 @@ definitions:
         description: 店铺地址,商品类型为线下品牌时需填写
         type: string
     type: object
+  http_model.FindProductData:
+    properties:
+      brand_name:
+        description: 品牌名称
+        type: string
+      enterprise_id:
+        description: 所属企业id
+        type: integer
+      product_detail:
+        type: string
+      product_id:
+        type: integer
+      product_name:
+        description: 商品名称
+        type: string
+      product_photos:
+        description: 商品图片列表
+        items:
+          $ref: '#/definitions/http_model.ProductPhoto'
+        type: array
+      product_price:
+        description: 商品价值
+        type: integer
+      product_type:
+        description: 商品类型
+        type: integer
+      product_url:
+        description: 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
+        type: string
+      shop_address:
+        description: 店铺地址,商品类型为线下品牌时需填写
+        type: string
+    type: object
+  http_model.FindProductRequest:
+    properties:
+      product_id:
+        type: integer
+    type: object
   http_model.FullProjectListData:
     properties:
       full_project_pre_view:
@@ -116,6 +166,17 @@ definitions:
         description: 最后操作时间
         type: string
     type: object
+  http_model.ProductPhoto:
+    properties:
+      photo_uid:
+        type: string
+      photo_url:
+        description: 图片或视频url
+        type: string
+      symbol:
+        description: 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
+        type: integer
+    type: object
   http_model.SendCodeData:
     type: object
   http_model.SendCodeRequest:
@@ -123,9 +184,115 @@ definitions:
       phone:
         type: string
     type: object
+  http_model.ShowProjectData:
+    properties:
+      Project_id:
+        description: 项目id
+        type: string
+      content_type:
+        description: 内容形式,1代表图文,2代表视频
+        type: string
+      product_id:
+        description: 关联商品id
+        type: string
+      project_detail:
+        description: 项目详情
+        type: string
+      project_form:
+        description: 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
+        type: string
+      project_name:
+        description: 项目名称
+        type: string
+      project_photos:
+        description: 项目图片
+        items:
+          $ref: '#/definitions/http_model.ShowProjectPhoto'
+        type: array
+      project_platform:
+        description: 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+        type: string
+      project_status:
+        description: 项目状态,1-7分别代表创建中、待审核、招募中、待支付、失效、执行中、已结案
+        type: string
+      project_type:
+        description: 项目类型,1代表全流程项目,2代表专项项目
+        type: string
+      recruit_ddl:
+        description: 招募截止时间
+        type: string
+      recruit_strategys:
+        description: 定价策略
+        items:
+          $ref: '#/definitions/http_model.ShowRecruitStrategy'
+        type: array
+      talent_type:
+        description: 达人类型
+        type: string
+    type: object
+  http_model.ShowProjectPhoto:
+    properties:
+      photo_uid:
+        type: string
+      photo_url:
+        description: 图片url
+        type: string
+    type: object
+  http_model.ShowProjectRequest:
+    properties:
+      Project_id:
+        description: 项目id
+        type: integer
+    type: object
+  http_model.ShowRecruitStrategy:
+    properties:
+      fee_form:
+        description: 稿费形式,1-3分别代表自报价、固定稿费、产品置换
+        type: string
+      followers_low:
+        description: 达人粉丝数下限
+        type: string
+      followers_up:
+        description: 达人粉丝数上限
+        type: string
+      offer:
+        description: 报价
+        type: string
+      recruit_number:
+        description: 招募数量
+        type: string
+      strategy_id:
+        description: 策略id
+        type: string
+    type: object
 info:
   contact: {}
 paths:
+  /login:
+    post:
+      consumes:
+      - application/json
+      description: 输入手机号和验证码,并登录
+      parameters:
+      - description: 登录输入内容请求参数结构体
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/http_model.CodeLoginRequest'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 登录返回相应结构体
+          schema:
+            allOf:
+            - $ref: '#/definitions/http_model.CommonResponse'
+            - properties:
+                data:
+                  $ref: '#/definitions/http_model.CodeLoginData'
+              type: object
+      summary: login 登录
   /product/create:
     post:
       consumes:
@@ -156,8 +323,38 @@ paths:
                   $ref: '#/definitions/http_model.CreateProductData'
               type: object
       summary: CreateProduct 创建商品
+  /product/find:
+    post:
+      consumes:
+      - application/json
+      description: 根据产品名称查询产品信息
+      parameters:
+      - description: 登录TOKEN信息
+        in: header
+        name: Authorization
+        required: true
+        type: string
+      - description: 发送产品id请求参数结构体
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/http_model.FindProductRequest'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 查询对应产品返回相应结构体
+          schema:
+            allOf:
+            - $ref: '#/definitions/http_model.CommonResponse'
+            - properties:
+                data:
+                  $ref: '#/definitions/http_model.FindProductData'
+              type: object
+      summary: findProduct 根据产品名称查询产品信息
   /product/list:
-    get:
+    post:
       consumes:
       - application/json
       description: 展示企业的商品列表
@@ -186,6 +383,36 @@ paths:
                   $ref: '#/definitions/http_model.FullProjectListData'
               type: object
       summary: ProjectList 商品列表
+  /project/show:
+    post:
+      consumes:
+      - application/json
+      description: 企业查看执行中项目
+      parameters:
+      - description: 登录TOKEN信息
+        in: header
+        name: Authorization
+        required: true
+        type: string
+      - description: 查看项目请求结构体
+        in: body
+        name: req
+        required: true
+        schema:
+          $ref: '#/definitions/http_model.ShowProjectRequest'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 查看项目相应结构体
+          schema:
+            allOf:
+            - $ref: '#/definitions/http_model.CommonResponse'
+            - properties:
+                data:
+                  $ref: '#/definitions/http_model.ShowProjectData'
+              type: object
+      summary: CreateProduct 创建商品
   /sendCode:
     post:
       consumes:

+ 11 - 0
handler/code_login.go

@@ -11,6 +11,17 @@ import (
 	log "github.com/sirupsen/logrus"
 )
 
+// WrapSendCodeHandler
+// @BasePath /youngee/m/
+// Codelogin godoc
+// @Summary login 登录
+// @Schemes
+// @Description 输入手机号和验证码,并登录
+// @Accept json
+// @Produce json
+// @Param req body http_model.CodeLoginRequest true "登录输入内容请求参数结构体"
+// @Success 200 {object} http_model.CommonResponse{data=http_model.CodeLoginData} "登录返回相应结构体"
+// @Router /login [post]
 func WrapCodeLoginHandler(ctx *gin.Context) {
 	handler := newCodeLoginHandler(ctx)
 	baseRun(handler)

+ 4 - 4
handler/product_create.go

@@ -58,16 +58,16 @@ func (h *CreateProductHandler) run() {
 	auth := middleware.GetSessionAuth(h.ctx)
 	enterpriseID := auth.EnterpriseID
 	//根据品牌名和商品名查询商品是否存在,若存在则更新,否则新增
-	productID, err := service.Product.FindByName(h.ctx, data.BrandName, data.ProductName)
+	product, err := service.Product.FindByID(h.ctx, data.ProductId)
 	if err != nil {
-		logrus.Errorf("[CreateProductHandler] call FindByName err:%+v\n", err)
+		logrus.Errorf("[CreateProductHandler] call FindByID err:%+v\n", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
 		log.Info("CreateProduct fail,req:%+v", h.req)
 		return
 	} else {
-		if productID != nil {
+		if product != nil {
 			// 该商品存在,更新
-			data.ProductId = *productID
+			data.ProductId = product.ProductID
 			res, err := service.Product.Update(h.ctx, data, enterpriseID)
 			if err != nil {
 				logrus.Errorf("[CreateProductHandler] call Update err:%+v\n", err)

+ 12 - 0
handler/product_find.go

@@ -11,6 +11,18 @@ import (
 	log "github.com/sirupsen/logrus"
 )
 
+// WrapSendCodeHandler
+// @BasePath /youngee/m/
+// FindProduct godoc
+// @Summary findProduct 根据产品名称查询产品信息
+// @Schemes
+// @Description 根据产品名称查询产品信息
+// @Accept json
+// @Produce json
+// @Param Authorization header string true "登录TOKEN信息"
+// @Param req body http_model.FindProductRequest true "发送产品id请求参数结构体"
+// @Success 200 {object} http_model.CommonResponse{data=http_model.FindProductData} "查询对应产品返回相应结构体"
+// @Router /product/find [post]
 func WrapFindProductHandler(ctx *gin.Context) {
 	handler := newFindProductHandler(ctx)
 	baseRun(handler)

+ 71 - 0
handler/project_show.go

@@ -0,0 +1,71 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+)
+
+// WrapShowProjectHandler
+// @BasePath /youngee/m/
+// SendCode godoc
+// @Summary CreateProduct 创建商品
+// @Schemes
+// @Description 企业查看执行中项目
+// @Accept json
+// @Produce json
+// @Param Authorization header string true "登录TOKEN信息"
+// @Param req body http_model.ShowProjectRequest true "查看项目请求结构体"
+// @Success 200 {object} http_model.CommonResponse{data=http_model.ShowProjectData} "查看项目相应结构体"
+// @Router /project/show [post]
+func WrapShowProjectHandler(ctx *gin.Context) {
+	handler := newShowProjectHandler(ctx)
+	baseRun(handler)
+}
+
+func newShowProjectHandler(ctx *gin.Context) *ShowProjectHandler {
+	return &ShowProjectHandler{
+		req:  http_model.NewShowProjectRequest(),
+		resp: http_model.NewShowProjectResponse(),
+		ctx:  ctx,
+	}
+}
+
+type ShowProjectHandler struct {
+	req  *http_model.ShowProjectRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *ShowProjectHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *ShowProjectHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *ShowProjectHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *ShowProjectHandler) run() {
+	data := http_model.ShowProjectRequest{}
+	data = *h.req
+	//auth := middleware.GetSessionAuth(h.ctx)
+	//enterpriseID := auth.EnterpriseID
+	res, err := service.Project.GetPorjectDetail(h.ctx, data.ProjectID)
+	if err != nil {
+		logrus.Errorf("[ShowProjectHandler] call Show err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("ShowProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功查询项目"
+	h.resp.Data = res
+}
+func (h *ShowProjectHandler) checkParam() error {
+	return nil
+}

+ 47 - 0
model/http_model/project_show.go

@@ -0,0 +1,47 @@
+package http_model
+
+import "time"
+
+type ShowProjectPhoto struct {
+	PhotoUrl string `json:"photo_url"` // 图片url
+	PhotoUid string `json:"photo_uid"`
+}
+
+type ShowRecruitStrategy struct {
+	FeeForm       string `json:"fee_form"`       // 稿费形式,1-3分别代表自报价、固定稿费、产品置换
+	StrategyID    string `json:"strategy_id"`    // 策略id
+	FollowersLow  string `json:"followers_low"`  // 达人粉丝数下限
+	FollowersUp   string `json:"followers_up"`   // 达人粉丝数上限
+	RecruitNumber string `json:"recruit_number"` // 招募数量
+	Offer         string `json:"offer"`          // 报价
+}
+
+type ShowProjectData struct {
+	ProjectName      string                `json:"project_name"`      // 项目名称
+	ProjectStatus    string                `json:"project_status"`    // 项目状态,1-7分别代表创建中、待审核、招募中、待支付、失效、执行中、已结案
+	ProjectType      string                `json:"project_type"`      // 项目类型,1代表全流程项目,2代表专项项目
+	ProjectPlatform  string                `json:"project_platform"`  // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ProjectForm      string                `json:"project_form"`      // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
+	TalentType       string                `json:"talent_type"`       // 达人类型
+	RecruitDdl       time.Time             `json:"recruit_ddl"`       // 招募截止时间
+	ContentType      string                `json:"content_type"`      // 内容形式,1代表图文,2代表视频
+	ProjectDetail    string                `json:"project_detail"`    // 项目详情
+	RecruitStrategys []ShowRecruitStrategy `json:"recruit_strategys"` // 定价策略
+	ProjectPhotos    []ShowProjectPhoto    `json:"project_photos"`    // 项目图片
+	ProductID        string                `json:"product_id"`        // 关联商品id
+	EnterpriseID     string                `json:"enterprise_id"`     // 企业id
+	ProjectID        string                `json:"project_id"`        // 项目id
+}
+
+type ShowProjectRequest struct {
+	ProjectID int64 `json:"Project_id"` // 项目id
+}
+
+func NewShowProjectRequest() *ShowProjectRequest {
+	return new(ShowProjectRequest)
+}
+func NewShowProjectResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ShowProjectData)
+	return resp
+}

+ 7 - 0
pack/Project_Deatil.go

@@ -0,0 +1,7 @@
+package pack
+
+//func MGormProjectDeatilToHttpProjectDeatilPreview(gormProjectDeatil *gorm_model.ProjectInfo) *http_model.ShowProjectData {
+//	var httpProjectDetail *http_model.ShowProjectData
+//	httpProjectDetail=
+//	return httpProjectDetail
+//}

+ 1 - 0
route/init.go

@@ -45,6 +45,7 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/product/findall", handler.WrapFindAllProductHandler)
 		m.POST("/product/find", handler.WrapFindProductHandler)
 		m.POST("/project/create", handler.WrapCreateProjectHandler)
+		m.POST("/project/show", handler.WrapShowProjectHandler)
 		m.POST("/product/create", handler.WrapCreateProductHandler)
 		m.POST("/product/list", handler.WrapFullProjectListHandler)
 	}

+ 54 - 0
service/project.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"context"
+	"fmt"
 	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 	"time"
@@ -82,6 +83,7 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 	res := &http_model.CreateProjectData{
 		ProjectID: *projectID,
 	}
+	fmt.Printf("%+v", res)
 	return res, nil
 }
 
@@ -97,3 +99,55 @@ func (*project) GetFullProjectList(ctx context.Context, enterpriseID int64, page
 	fullProjectListData.Total = conv.MustString(total)
 	return fullProjectListData, nil
 }
+
+func (*project) GetPorjectDetail(ctx context.Context, projectID int64) (*http_model.ShowProjectData, error) {
+	project, err := db.GetProjectDetail(ctx, projectID)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[project service] call GetPorjectDetail error,err:%+v", err)
+		return nil, err
+	}
+	//var RecruitStrategys []http_model.ShowRecruitStrategy
+	ProjectDetail := http_model.ShowProjectData{
+		ProjectID:       conv.MustString(project.ProjectID),
+		ProjectName:     conv.MustString(project.ProjectName),
+		ProjectStatus:   conv.MustString(project.ProjectStatus),
+		ProjectType:     conv.MustString(project.ProjectType),
+		ProjectPlatform: conv.MustString(project.ProjectPlatform),
+		ProjectForm:     conv.MustString(project.ProjectForm),
+		TalentType:      conv.MustString(project.TalentType),
+		RecruitDdl:      project.RecruitDdl,
+		ContentType:     conv.MustString(project.ContentType),
+		ProductID:       conv.MustString(project.ProductID),
+		EnterpriseID:    conv.MustString(project.EnterpriseID),
+	}
+	fmt.Printf("%+v", ProjectDetail.EnterpriseID)
+	Strategys, err := db.GetRecruitStrategys(ctx, projectID)
+	if err != nil {
+		logrus.WithContext(ctx).Error()
+		return nil, err
+	}
+	for _, strategy := range Strategys {
+		RecruitStrategy := http_model.ShowRecruitStrategy{
+			FeeForm:       conv.MustString(strategy.FeeForm),
+			StrategyID:    conv.MustString(strategy.StrategyID),
+			FollowersLow:  conv.MustString(strategy.FollowersLow),
+			FollowersUp:   conv.MustString(strategy.FollowersUp),
+			RecruitNumber: conv.MustString(strategy.RecruitNumber),
+			Offer:         conv.MustString(strategy.Offer),
+		}
+		ProjectDetail.RecruitStrategys = append(ProjectDetail.RecruitStrategys, RecruitStrategy)
+	}
+	Photos, err := db.GetProjectPhoto(ctx, projectID)
+	if err != nil {
+		logrus.WithContext(ctx).Error()
+		return nil, err
+	}
+	for _, Photo := range Photos {
+		ProjectPhoto := http_model.ShowProjectPhoto{
+			PhotoUrl: Photo.PhotoUrl,
+			PhotoUid: Photo.PhotoUid,
+		}
+		ProjectDetail.ProjectPhotos = append(ProjectDetail.ProjectPhotos, ProjectPhoto)
+	}
+	return &ProjectDetail, nil
+}