where("shop_id",$data['shop'])->where("openid",$data['openid'])->order("create_at desc")->select(); if ($cart->isEmpty()) return success('ok',['cart' => []]); $orderDetail = []; foreach ($cart->toArray() as $key=>$val) { unset($val['id']); $orderDetail[$key] = $val; $orderDetail[$key]['order_sn'] = $data['order']; if ($val['extension'] == "pdf") { $orderDetail[$key]['status'] = 1; } else { $orderDetail[$key]['status'] = 0; } } $state = (new SaasOrderDetail)->strict(false)->insertAll($orderDetail); echo "写入订单详情{$data['order']}\n"; var_dump($state); events("merge-pdf",$data); (new SaasCart)->where("shop_id",$data['shop'])->where("openid",$data['openid'])->delete(); } catch (\Throwable $throwable) { echo "写入订单详情错误\n"; echo $throwable->getLine()."\n"; echo $throwable->getFile()."\n"; echo $throwable->getMessage()."\n"; return error($throwable->getMessage()); } } }