|
|
|
@ -136,11 +136,11 @@ class NotifyController extends BaseController |
|
|
|
|
|
|
|
// 更新商户销量
|
|
|
|
$upStoreScore = Store::query() |
|
|
|
->whereIn('id', $orderMain->order_ids) |
|
|
|
->whereIn('id', explode(',', $orderMain->store_ids)) |
|
|
|
->update(['score' => Db::raw('score+1')]); |
|
|
|
|
|
|
|
// 更新商品库存和销量
|
|
|
|
$orders = Order::query()->select(['id', 'money', 'user_id', 'store_id', 'createtime']) |
|
|
|
$orders = Order::query()->select(['id', 'money', 'user_id', 'store_id']) |
|
|
|
->where(['order_main_id' => $orderMain->id]) |
|
|
|
->get() |
|
|
|
->toArray(); |
|
|
|
@ -153,7 +153,7 @@ class NotifyController extends BaseController |
|
|
|
$goods = Goods::find($goodsItem['id']); |
|
|
|
|
|
|
|
// 库存处理,有规格
|
|
|
|
if ($goodsItem->combination_id) { |
|
|
|
if ($goodsItem['combination_id']) { |
|
|
|
$combination = SpecCombination::find($goodsItem['combination_id']); |
|
|
|
$combination->number = $combination->number - $goodsItem['number']; |
|
|
|
$combination->save(); |
|
|
|
@ -168,14 +168,14 @@ class NotifyController extends BaseController |
|
|
|
|
|
|
|
// 月销流水
|
|
|
|
$statistics = []; |
|
|
|
foreach ($orders as $key => & $order) { |
|
|
|
foreach ($orders as $key => &$order) { |
|
|
|
$statistics[] = [ |
|
|
|
'money' => $order->money, |
|
|
|
'user_id' => $order->user_id, |
|
|
|
'store_id' => $order->store_id, |
|
|
|
'money' => $order['money'], |
|
|
|
'user_id' => $order['user_id'], |
|
|
|
'store_id' => $order['store_id'], |
|
|
|
'market_id' => $orderMain->market_id, |
|
|
|
'order_id' => $order->id, |
|
|
|
'createtime' => strtotime($order->pay_time), |
|
|
|
'order_id' => $order['id'], |
|
|
|
'createtime' => strtotime($order['pay_time']), |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
|