123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package api
- import (
- "box-cost/db/model"
- "box-cost/db/repo"
- "box-cost/log"
- "errors"
- "fmt"
- "time"
- "github.com/gin-gonic/gin"
- )
- func DiffUpdatePlanTest(c *gin.Context, apictx *ApiSession) (interface{}, error) {
- var plan model.ProductPlan
- err := c.ShouldBindJSON(&plan)
- if err != nil {
- fmt.Println(err)
- log.Error(err)
- return nil, errors.New("参数错误")
- }
- if plan.Id.Hex() == "" {
- return nil, errors.New("id的为空")
- }
- plan.UpdateTime = time.Now()
-
-
-
-
-
-
-
-
-
- result, err1 := repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), "product-plan_copy1", plan.Id.Hex(), &plan, &repo.RecordLogReq{
- Path: c.Request.URL.Path,
- UserId: apictx.User.ID,
- TargetId: plan.Id.Hex(),
- })
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return result, err1
- }
- func PrintDiff(c *gin.Context, apictx *ApiSession) (interface{}, error) {
- id := c.Query("id")
- changeLogs := model.Logs{}
- _, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
- CollectName: repo.CollectionLogs,
- Query: repo.Map{"_id": id},
- }, &changeLogs)
- if err != nil {
- return nil, err
- }
- fmt.Println(changeLogs.Diff)
- return changeLogs, nil
- }
|