|
@@ -1,46 +1,43 @@
|
|
|
package api
|
|
|
|
|
|
import (
|
|
|
- "3dshow/db/model"
|
|
|
- "3dshow/db/repo"
|
|
|
- "fmt"
|
|
|
-
|
|
|
"github.com/gin-gonic/gin"
|
|
|
)
|
|
|
|
|
|
func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
- // _sort := "a"
|
|
|
- statusMap := make(map[int]struct{})
|
|
|
- // statusMap[-1] = struct{}{}
|
|
|
- statusMap[1] = struct{}{}
|
|
|
- statusMap[2] = struct{}{}
|
|
|
- status := 0
|
|
|
- if len(statusMap) == 1 {
|
|
|
- if _, ok := statusMap[-1]; ok {
|
|
|
- status = -1
|
|
|
- }
|
|
|
- if _, ok := statusMap[1]; ok {
|
|
|
- status = 1
|
|
|
- }
|
|
|
- if _, ok := statusMap[2]; ok {
|
|
|
- status = 2
|
|
|
- }
|
|
|
- }
|
|
|
- if len(statusMap) == 2 {
|
|
|
- if _, ok := statusMap[-1]; ok {
|
|
|
- status = -1
|
|
|
- } else if _, ok := statusMap[1]; ok {
|
|
|
- status = 1
|
|
|
- }
|
|
|
- }
|
|
|
- if len(statusMap) == 3 {
|
|
|
- status = -1
|
|
|
- }
|
|
|
- fmt.Println(status)
|
|
|
- var statusOrder model.Order
|
|
|
- statusOrder.Status = status
|
|
|
- return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionOrder, "636b5b4a0bab456f8a558962", &statusOrder)
|
|
|
- // return repo.RepoUpdateSetDocProps(apictx.CreateRepoCtx(), repo.CollectionOrder, "636b5b4a0bab456f8a558962", repo.Map{"status": status})
|
|
|
- // sort, _ := strconv.Atoi("-1")
|
|
|
- // return status, nil
|
|
|
+ // // _sort := "a"
|
|
|
+ // statusMap := make(map[int]struct{})
|
|
|
+ // // statusMap[-1] = struct{}{}
|
|
|
+ // statusMap[1] = struct{}{}
|
|
|
+ // statusMap[2] = struct{}{}
|
|
|
+ // status := 0
|
|
|
+ // if len(statusMap) == 1 {
|
|
|
+ // if _, ok := statusMap[-1]; ok {
|
|
|
+ // status = -1
|
|
|
+ // }
|
|
|
+ // if _, ok := statusMap[1]; ok {
|
|
|
+ // status = 1
|
|
|
+ // }
|
|
|
+ // if _, ok := statusMap[2]; ok {
|
|
|
+ // status = 2
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if len(statusMap) == 2 {
|
|
|
+ // if _, ok := statusMap[-1]; ok {
|
|
|
+ // status = -1
|
|
|
+ // } else if _, ok := statusMap[1]; ok {
|
|
|
+ // status = 1
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if len(statusMap) == 3 {
|
|
|
+ // status = -1
|
|
|
+ // }
|
|
|
+ // fmt.Println(status)
|
|
|
+ // var statusOrder model.Order
|
|
|
+ // statusOrder.Status = status
|
|
|
+ // return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionOrder, "636b5b4a0bab456f8a558962", &statusOrder)
|
|
|
+ // // return repo.RepoUpdateSetDocProps(apictx.CreateRepoCtx(), repo.CollectionOrder, "636b5b4a0bab456f8a558962", repo.Map{"status": status})
|
|
|
+ // // sort, _ := strconv.Atoi("-1")
|
|
|
+ // // return status, nil
|
|
|
+ return len("61c3d4a0d6649a1d7353e2d9"), nil
|
|
|
}
|