|
@@ -4,6 +4,7 @@ import (
|
|
|
"3dshow-supplier/db/model"
|
|
|
"3dshow-supplier/db/repo"
|
|
|
"errors"
|
|
|
+ "fmt"
|
|
|
"time"
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
@@ -113,6 +114,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{
|
|
@@ -122,6 +127,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("非法操作")
|
|
|
}
|
|
@@ -133,9 +139,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("发货商品异常")
|
|
|
}
|
|
|
|