|
@@ -67,7 +67,7 @@ func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
// 发货
|
|
|
type OrderDeliveryReq struct {
|
|
|
Id primitive.ObjectID `json:"id"`
|
|
|
- ProductId primitive.ObjectID `json:"productId"`
|
|
|
+ UniqueId primitive.ObjectID `json:"uniqueId"`
|
|
|
ExpressNo string `json:"expressNo"`
|
|
|
}
|
|
|
|
|
@@ -98,7 +98,7 @@ func OrderDelivery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
result, err := repo.RepoDocArrayOneUpdate(apictx.CreateRepoCtx(), &repo.ArrayOneUpdateOption{
|
|
|
CollectName: repo.CollectionOrder,
|
|
|
Id: form.Id.Hex(),
|
|
|
- Query: repo.Map{"products.id": form.ProductId},
|
|
|
+ Query: repo.Map{"products.id": form.UniqueId},
|
|
|
Set: repo.Map{"status": 1, "expressNo": form.ExpressNo},
|
|
|
})
|
|
|
if err != nil {
|
|
@@ -106,10 +106,18 @@ func OrderDelivery(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
}
|
|
|
|
|
|
if result.ModifiedCount > 0 {
|
|
|
+
|
|
|
+ // 查询更改后的订单
|
|
|
+ order1 := model.Order{}
|
|
|
+ repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
+ CollectName: repo.CollectionOrder,
|
|
|
+ Query: repo.Map{"_id": form.Id},
|
|
|
+ }, &order1)
|
|
|
+
|
|
|
// 查询其中产品 判断订单状态
|
|
|
// 该订单产品有多少种状态 在此时订单只有-1,1两种状态
|
|
|
statusMap := make(map[int]struct{})
|
|
|
- for _, v := range order.Products {
|
|
|
+ for _, v := range order1.Products {
|
|
|
statusMap[v.Status] = struct{}{}
|
|
|
}
|
|
|
status := order.Status
|