Browse Source

Merge branch 'master' of http://124.70.149.18:10880/sunsheng/cmf

infish2018 3 months ago
parent
commit
b232930cf6

+ 1 - 1
pack-cmf/config-service.yaml

@@ -8,7 +8,7 @@ configer:
     name: cmf-mongo
     value: mongodb://root:cmfxxx@cmf-mongo:27017/cmf?authSource=admin
     # devValue: mongodb://root:cmf@192.168.110.180:37037/website?authSource=admin
-    devValue: mongodb://root:cmfxxx@192.168.110.131:17019/cmf?authSource=admin
+    devValue: mongodb://root:cmfxxx@124.71.139.24:17019/cmf?authSource=admin
 
 
 

+ 0 - 98
pack-cmf/start.sh

@@ -1,98 +0,0 @@
-package api
-
-import (
-	"cmf/db/model"
-	"cmf/db/repo"
-	"cmf/log"
-	"errors"
-	"time"
-
-	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-func Decorate(r *GinRouter) {
-	r.POST("/decorate/create", CreateDecorate)
-	r.POST("/decorate/delete/:id", DeleteDecorate)
-	r.GET("/decorate/list", DecorateList)
-	r.GET("/decorate/detail/:id", DecorateDetail)
-	r.POST("/decorate/update", UpdateDecorate)
-}
-
-func CreateDecorate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var data model.ModelLib
-	err := c.ShouldBindJSON(&data)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	data.CreateTime = time.Now()
-	data.UpdateTime = time.Now()
-	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionDecorate, &data)
-}
-
-func DeleteDecorate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionDecorate, _id)
-}
-
-func DecorateList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-
-	page, size, query := UtilQueryPageSize(c)
-	catsConf, err := GetModelLibCategory(apictx)
-	if err != nil {
-		return nil, err
-	}
-	err = ParseCategories(query, apictx.CreateRepoCtx(), catsConf)
-	if err != nil {
-		return nil, err
-	}
-
-	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionDecorate,
-		Page:        page,
-		Size:        size,
-		Query:       query,
-		Sort:        bson.M{"createTime": -1},
-	})
-}
-
-func DecorateDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	box := &model.ModelLib{}
-	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		CollectName: repo.CollectionDecorate,
-		Query:       repo.Map{"_id": id},
-	}, box)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-
-	if !found {
-		return nil, errors.New("未找到该数据")
-	}
-	return box, nil
-}
-
-func UpdateDecorate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var box model.ModelLib
-	err := c.ShouldBindJSON(&box)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	if box.Id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionDecorate, box.Id.Hex(), &box)
-}

+ 22 - 24
src/api/nav.go → src/api/finishArtwork.go

@@ -8,60 +8,58 @@ import (
 	"time"
 
 	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 
-func Nav(r *GinRouter) {
-	r.POSTJWT("/nav/create", CreateNav)
-	r.POSTJWT("/nav/delete/:id", DeleteNav)
-	r.GETJWT("/nav/list", NavList)
-	r.GETJWT("/nav/detail/:id", NavDetail)
-	r.POSTJWT("/nav/update", UpdateNav)
+func FinishArtwork(r *GinRouter) {
+	r.POST("/finish/create", CreateFinishArtwork)
+	r.POST("/finish/delete/:id", DeleteFinishArtwork)
+	r.GET("/finish/list", FinishArtworkList)
+	r.GET("/finish/detail/:id", FinishArtworkDetail)
+	r.POST("/finish/update", UpdateFinishArtwork)
 }
 
-func CreateNav(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var nav model.Nav
-	err := c.ShouldBindJSON(&nav)
+func CreateFinishArtwork(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+	var finish model.FinishArtwork
+	err := c.ShouldBindJSON(&finish)
 	if err != nil {
 		log.Error(err)
 		return nil, err
 	}
-	nav.CreateTime = time.Now()
-	nav.UpdateTime = time.Now()
-	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionNav, &nav)
+	finish.CreateTime = time.Now()
+	finish.UpdateTime = time.Now()
+	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionFinishArtwork, &finish)
 }
 
-func DeleteNav(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+func DeleteFinishArtwork(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	_id := c.Param("id")
 	id, _ := primitive.ObjectIDFromHex(_id)
 	if id.IsZero() {
 		return nil, errors.New("id错误")
 	}
-	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionNav, _id)
+	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionFinishArtwork, _id)
 }
 
-func NavList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+func FinishArtworkList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 	page, size, query := UtilQueryPageSize(c)
 	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionNav,
+		CollectName: repo.CollectionFinishArtwork,
 		Page:        page,
 		Size:        size,
 		Query:       query,
-		Sort:        bson.D{bson.E{Key: "sort", Value: 1}, bson.E{Key: "createTime", Value: -1}},
 	})
 }
 
-func NavDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+func FinishArtworkDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	_id := c.Param("id")
 	id, _ := primitive.ObjectIDFromHex(_id)
 	if id.IsZero() {
 		return nil, errors.New("id错误")
 	}
-	cate := &model.Nav{}
+	cate := &model.FinishArtwork{}
 	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		CollectName: repo.CollectionNav,
+		CollectName: repo.CollectionFinishArtwork,
 		Query:       repo.Map{"_id": id},
 	}, cate)
 	if err != nil {
@@ -75,8 +73,8 @@ func NavDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	return cate, nil
 }
 
-func UpdateNav(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var cate model.Nav
+func UpdateFinishArtwork(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+	var cate model.FinishArtwork
 	err := c.ShouldBindJSON(&cate)
 	if err != nil {
 		log.Error(err)
@@ -85,5 +83,5 @@ func UpdateNav(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if cate.Id.IsZero() {
 		return nil, errors.New("id错误")
 	}
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionNav, cate.Id.Hex(), &cate)
+	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionFinishArtwork, cate.Id.Hex(), &cate)
 }

+ 0 - 89
src/api/gallery.go

@@ -1,89 +0,0 @@
-package api
-
-import (
-	"cmf/db/model"
-	"cmf/db/repo"
-	"cmf/log"
-	"errors"
-	"time"
-
-	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-func Gallery(r *GinRouter) {
-	r.POSTJWT("/gallery/create", CreateGallery)
-	r.POSTJWT("/gallery/delete/:id", DeleteGallery)
-	r.GETJWT("/gallery/list", GalleryList)
-	r.GETJWT("/gallery/detail/:id", GalleryDetail)
-	r.POSTJWT("/gallery/update", UpdateGallery)
-}
-
-func CreateGallery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var gallery model.Gallery
-	err := c.ShouldBindJSON(&gallery)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	gallery.CreateTime = time.Now()
-	gallery.UpdateTime = time.Now()
-	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionGallery, &gallery)
-}
-
-func DeleteGallery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionGallery, _id)
-}
-
-func GalleryList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-
-	page, size, query := UtilQueryPageSize(c)
-	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionGallery,
-		Page:        page,
-		Size:        size,
-		Query:       query,
-		Sort:        bson.M{"createTime": -1},
-	})
-}
-
-func GalleryDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	gallery := &model.Gallery{}
-	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		CollectName: repo.CollectionGallery,
-		Query:       repo.Map{"_id": id},
-	}, gallery)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-
-	if !found {
-		return nil, errors.New("未找到该数据")
-	}
-	return gallery, nil
-}
-
-func UpdateGallery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var gallery model.Gallery
-	err := c.ShouldBindJSON(&gallery)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	if gallery.Id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionGallery, gallery.Id.Hex(), &gallery)
-}

+ 3 - 1
src/api/router.go

@@ -41,7 +41,9 @@ func RegRouters(svc *Service) {
 	// Decorate(r)
 	// Scene(r)
 	MatLib(r)
-	Craft(r)
+	// ArtworkColor(r)
+	Shape(r)
+	FinishArtwork(r)
 
 	r.GET("/printr", Printr)
 }

+ 0 - 98
src/api/scene.go

@@ -1,98 +0,0 @@
-package api
-
-import (
-	"cmf/db/model"
-	"cmf/db/repo"
-	"cmf/log"
-	"errors"
-	"time"
-
-	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-func Scene(r *GinRouter) {
-	r.POST("/scene/create", CreateScene)
-	r.POST("/scene/delete/:id", DeleteScene)
-	r.GET("/scene/list", SceneList)
-	r.GET("/scene/detail/:id", SceneDetail)
-	r.POST("/scene/update", UpdateScene)
-}
-
-func CreateScene(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var data model.ModelLib
-	err := c.ShouldBindJSON(&data)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	data.CreateTime = time.Now()
-	data.UpdateTime = time.Now()
-	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionScene, &data)
-}
-
-func DeleteScene(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionScene, _id)
-}
-
-func SceneList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-
-	page, size, query := UtilQueryPageSize(c)
-	catsConf, err := GetModelLibCategory(apictx)
-	if err != nil {
-		return nil, err
-	}
-	err = ParseCategories(query, apictx.CreateRepoCtx(), catsConf)
-	if err != nil {
-		return nil, err
-	}
-
-	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionScene,
-		Page:        page,
-		Size:        size,
-		Query:       query,
-		Sort:        bson.M{"createTime": -1},
-	})
-}
-
-func SceneDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	_id := c.Param("id")
-	id, _ := primitive.ObjectIDFromHex(_id)
-	if id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	box := &model.ModelLib{}
-	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		CollectName: repo.CollectionScene,
-		Query:       repo.Map{"_id": id},
-	}, box)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-
-	if !found {
-		return nil, errors.New("未找到该数据")
-	}
-	return box, nil
-}
-
-func UpdateScene(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var box model.ModelLib
-	err := c.ShouldBindJSON(&box)
-	if err != nil {
-		log.Error(err)
-		return nil, err
-	}
-	if box.Id.IsZero() {
-		return nil, errors.New("id错误")
-	}
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionScene, box.Id.Hex(), &box)
-}

+ 22 - 22
src/api/craft.go → src/api/shape.go

@@ -11,55 +11,55 @@ import (
 	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 
-func Craft(r *GinRouter) {
-	r.POST("/craft/create", CreateCraft)
-	r.POST("/craft/delete/:id", DeleteCraft)
-	r.GET("/craft/list", CraftList)
-	r.GET("/craft/detail/:id", CraftDetail)
-	r.POST("/craft/update", UpdateCraft)
+func Shape(r *GinRouter) {
+	r.POST("/shape/create", CreateShape)
+	r.POST("/shape/delete/:id", DeleteShape)
+	r.GET("/shape/list", ShapeList)
+	r.GET("/shape/detail/:id", ShapeDetail)
+	r.POST("/shape/update", UpdateShape)
 }
 
-func CreateCraft(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var craft model.Craft
-	err := c.ShouldBindJSON(&craft)
+func CreateShape(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+	var shape model.Shape
+	err := c.ShouldBindJSON(&shape)
 	if err != nil {
 		log.Error(err)
 		return nil, err
 	}
-	craft.CreateTime = time.Now()
-	craft.UpdateTime = time.Now()
-	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionCraft, &craft)
+	shape.CreateTime = time.Now()
+	shape.UpdateTime = time.Now()
+	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionShape, &shape)
 }
 
-func DeleteCraft(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+func DeleteShape(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	_id := c.Param("id")
 	id, _ := primitive.ObjectIDFromHex(_id)
 	if id.IsZero() {
 		return nil, errors.New("id错误")
 	}
-	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionCraft, _id)
+	return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionShape, _id)
 }
 
-func CraftList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+func ShapeList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 	page, size, query := UtilQueryPageSize(c)
 	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionCraft,
+		CollectName: repo.CollectionShape,
 		Page:        page,
 		Size:        size,
 		Query:       query,
 	})
 }
 
-func CraftDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+func ShapeDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	_id := c.Param("id")
 	id, _ := primitive.ObjectIDFromHex(_id)
 	if id.IsZero() {
 		return nil, errors.New("id错误")
 	}
-	cate := &model.Craft{}
+	cate := &model.Shape{}
 	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		CollectName: repo.CollectionCraft,
+		CollectName: repo.CollectionShape,
 		Query:       repo.Map{"_id": id},
 	}, cate)
 	if err != nil {
@@ -73,8 +73,8 @@ func CraftDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	return cate, nil
 }
 
-func UpdateCraft(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var cate model.Craft
+func UpdateShape(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+	var cate model.Shape
 	err := c.ShouldBindJSON(&cate)
 	if err != nil {
 		log.Error(err)
@@ -83,5 +83,5 @@ func UpdateCraft(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if cate.Id.IsZero() {
 		return nil, errors.New("id错误")
 	}
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionCraft, cate.Id.Hex(), &cate)
+	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionShape, cate.Id.Hex(), &cate)
 }

+ 0 - 17
src/db/model/Craft.go

@@ -1,17 +0,0 @@
-package model
-
-import (
-	"time"
-
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-type Craft struct {
-	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	Name       string             `bson:"name,omitempty" json:"name"`
-	Desc       string             `bson:"desc,omitempty" json:"desc"`
-	SurfArt    string             `bson:"surfArt,omitempty" json:"surfArt"`
-	ShapArt    string             `bson:"shapArt,omitempty" json:"shapArt"`
-	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
-}

+ 18 - 7
src/db/model/MatLib.go

@@ -13,13 +13,16 @@ type ArtworkColor struct {
 }
 
 type FinishArtwork struct {
-	Name          string         `bson:"name,omitempty" json:"name"`
-	Thumb         string         `bson:"thumb,omitempty" json:"thumb"`
-	FinishId      string         `bson:"finishId,omitempty" json:"finishId"`
-	Uuid          string         `bson:"uuid,omitempty" json:"uuid"`
-	IsCanCusColor bool           `bson:"isCanCusColor,omitempty" json:"isCanCusColor"` //是否支持定义颜色
-	Colors        []ArtworkColor `bson:"colors,omitempty" json:"colors"`               //支持的颜色
-	ShapeIds      []string       `bson:"shapeIds,omitempty" json:"shapeIds"`           //支持成型工艺
+	Id            primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name          string             `bson:"name,omitempty" json:"name"`
+	Thumb         string             `bson:"thumb,omitempty" json:"thumb"`
+	FinishId      string             `bson:"finishId,omitempty" json:"finishId"`
+	Uuid          string             `bson:"uuid,omitempty" json:"uuid"`
+	IsCanCusColor bool               `bson:"isCanCusColor,omitempty" json:"isCanCusColor"` //是否支持定义颜色
+	Colors        []ArtworkColor     `bson:"colors,omitempty" json:"colors"`               //支持的颜色
+	ShapeIds      []string           `bson:"shapeIds,omitempty" json:"shapeIds"`           //支持成型工艺
+	CreateTime    time.Time          `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime    time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
 }
 
 type MatLib struct {
@@ -36,3 +39,11 @@ type MatLib struct {
 	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
 	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
 }
+
+type Shape struct {
+	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name       string             `bson:"name,omitempty" json:"name"`
+	Desc       string             `bson:"desc,omitempty" json:"desc"`
+	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
+}

+ 0 - 17
src/db/model/gallery.go

@@ -1,17 +0,0 @@
-package model
-
-import (
-	"time"
-
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-// 画廊
-type Gallery struct {
-	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	Title      string             `bson:"title,omitempty" json:"title"`
-	Cover      string             `bson:"cover,omitempty" json:"cover"`
-	Images     []string           `bson:"images,omitempty" json:"images"`
-	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
-}

+ 0 - 21
src/db/model/nav.go

@@ -1,21 +0,0 @@
-package model
-
-import (
-	"time"
-
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-// db.getCollection(banner).createIndexes([{aid: 1}, {isHome: 1}])
-type Nav struct {
-	Id primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	// Aid        primitive.ObjectID `bson:"aid,omitempty" json:"aid"` // 内联id
-	Url   string `bson:"url,omitempty" json:"url"` // 外联url
-	Name  string `bson:"name,omitempty" json:"name"`
-	Cover string `bson:"cover,omitempty" json:"cover"`
-	// Lang       string             `bson:"lang,omitempty" json:"lang"`     // cn en
-	Sort *int `bson:"sort,omitempty" json:"sort"` // 排序,使用创建时间联合排序。排序按升序排,默认为0
-	// IsHome     *bool              `bson:"isHome,omitempty" json:"isHome"` // 是否展示到首页
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
-}

+ 5 - 4
src/db/repo/repo.go

@@ -23,10 +23,11 @@ const (
 	CollectionDecorate = "decorate"
 	CollectionScene    = "scene"
 
-	CollectionCategories = "categories"
-	CollectionModelLib   = "models"
-	CollectionMat        = "mats"
-	CollectionCraft      = "crafts"
+	CollectionCategories    = "categories"
+	CollectionModelLib      = "models"
+	CollectionMat           = "mats"
+	CollectionShape         = "Shapes"
+	CollectionFinishArtwork = "finishes"
 )
 
 type Map map[string]interface{}