make(UserServices::class); /** @var StoreOrderCartInfoServices $cartInfoServices */ $cartInfoServices = app()->make(StoreOrderCartInfoServices::class); /** @var $replyServices */ $replyServices = app()->make(StoreProductReplyServices::class); /** @var StoreOrderServices $orderServices */ $orderServices = app()->make(StoreOrderServices::class); $list = $cartInfoServices->getColumn([['cart_id', 'in', $cart_ids]], 'cart_info,uid,oid,unique,product_id'); $uids = array_column($list, 'uid'); $userInfos = $userServices->getColumn([['uid', 'in', $uids]], 'nickname,avatar', 'uid'); $reply = []; foreach ($list as $item) { $reply[] = [ 'uid' => $item['uid'], 'oid' => $item['oid'], 'unique' => $item['unique'], 'product_id' => json_decode($item['cart_info'],true)['product_id'], 'reply_type' => 'product', 'nickname' => $userInfos[$item['uid']]['nickname'], 'avatar' => $userInfos[$item['uid']]['avatar'], 'comment' => sys_config('comment_content',''), 'product_score' => 5, 'service_score' => 5, 'add_time' => time(), ]; } if (count($reply)) { $replyServices->saveAll($reply); } $orderServices->checkOrderOver($replyServices, $cartInfoServices->getCartColunm(['oid' => $id], 'unique', ''), $id); return true; } }