animeic 2 years ago
parent
commit
50457bac73
3 changed files with 5 additions and 4 deletions
  1. 2 2
      boxcost/api/bill.go
  2. 2 2
      boxcost/api/utils.go
  3. 1 0
      boxcost/boxcost.log

+ 2 - 2
boxcost/api/bill.go

@@ -59,12 +59,12 @@ func PurchaseReview(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	}
 	// 查询单据获取已有的签字
 	bill := model.PurchaseBill{}
-	repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
+	found, _ := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
 		CollectName: repo.CollectionBillPurchase,
 		Query:       repo.Map{"_id": id, "reviewed": 1},
 	}, &bill)
 	signs := make([]primitive.ObjectID, 0)
-	if len(bill.SignUsers) > 0 {
+	if found && len(bill.SignUsers) > 0 {
 		// 如果自己已存在该集合中了
 		for _, signUser := range bill.SignUsers {
 			if signUser == userId {

+ 2 - 2
boxcost/api/utils.go

@@ -97,10 +97,10 @@ func getUserById(apictx *ApiSession, id primitive.ObjectID) (*model.UserSmaple,
 	fmt.Println(id.Hex())
 	user := &model.UserSmaple{}
 	_, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-		Db:          "user",
+		Db:          "box-user",
 		CollectName: repo.CollectionUsers,
 		Query:       repo.Map{"_id": id},
-		Project:     []string{"name", "avatar", "city", "loginName"},
+		Project:     []string{"name", "avatar", "city", "loginName", "roles"},
 	}, user)
 	return user, err
 }

+ 1 - 0
boxcost/boxcost.log

@@ -11,3 +11,4 @@
 {"level":"info","timestamp":"2022-12-21 11:20:02","message":"[<nil>]","service_name":"boxcost"}
 {"level":"info","timestamp":"2022-12-21 11:21:28","message":"[<nil>]","service_name":"boxcost"}
 {"level":"info","timestamp":"2022-12-21 11:24:46","message":"[<nil>]","service_name":"boxcost"}
+{"level":"info","timestamp":"2023-01-18 10:09:00","message":"[<nil>]","service_name":"boxcost"}