|
@@ -4,6 +4,7 @@ import (
|
|
|
"3dshow-supplier/db/model"
|
|
|
"3dshow-supplier/db/repo"
|
|
|
"errors"
|
|
|
+ "fmt"
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
@@ -79,6 +80,10 @@ func OrderDelivery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
}
|
|
|
// 验证订单是不是自己的
|
|
|
_userId := apictx.User.ID
|
|
|
+ fmt.Println(_userId)
|
|
|
+ fmt.Println(form.Id.Hex())
|
|
|
+ fmt.Println(form.UniqueId.Hex())
|
|
|
+
|
|
|
userId, _ := primitive.ObjectIDFromHex(_userId)
|
|
|
order := model.Order{}
|
|
|
found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
@@ -88,6 +93,7 @@ func OrderDelivery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
if !found || err != nil {
|
|
|
return nil, errors.New("该订单未找到")
|
|
|
}
|
|
|
+ fmt.Println(order.SupplyId)
|
|
|
if userId != order.SupplyId {
|
|
|
return nil, errors.New("非法操作")
|
|
|
}
|
|
@@ -99,9 +105,10 @@ func OrderDelivery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
CollectName: repo.CollectionOrder,
|
|
|
Id: form.Id.Hex(),
|
|
|
Query: repo.Map{"products.id": form.UniqueId},
|
|
|
- Set: repo.Map{"status": 1, "expressNo": form.ExpressNo},
|
|
|
+ Set: repo.Map{"products.$.status": 1, "products.$.expressNo": form.ExpressNo},
|
|
|
})
|
|
|
if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
return nil, errors.New("发货商品异常")
|
|
|
}
|
|
|
|