find($id); } return self::$sellerCache[$id]; } protected function skuByCode($code) { if (!isset(self::$skuCache[$code])) { self::$skuCache[$code] = Dever::db('goods/info_sku')->find(array('code' => $code)); } return self::$skuCache[$code]; } protected function goods($id) { if (!isset(self::$goodsCache[$id])) { self::$goodsCache[$id] = Dever::db('goods/info')->find($id); } return self::$goodsCache[$id]; } public function run() { $order = Dever::input('order'); $info = Dever::db('seller/order')->find($order); Dever::load(\Seller\Lib\Order::class)->handle($info); } # 压力测试 public function test() { $code = Dever::input('code', 'lt10'); $sellerId = Dever::input('seller_id', 1); $info = $this->seller($sellerId); if (!$info) { Dever::error('商户不存在'); } $sku = $this->skuByCode($code); if (!$sku) { Dever::error('规格不存在'); } $goods = $this->goods($sku['info_id']); if (!$goods) { Dever::error('商品不存在'); } $account = '1' . Str::rand(10, 0); $order = Str::order('T'); $num = 1; return Dever::load(\Seller\Lib\Order::class)->add($info, $goods, $sku, $account, $order, $num); } # 将当前订单置为失败 public function test_no() { while(1) { $order = Dever::db('seller/order')->find(array('seller_id' => 1, 'status' => 2)); if ($order) { $msg = 'error'; $update = array(); $update['official_msg'] = ''; $update['official_order_num'] = ''; Dever::load(\Seller\Lib\Order::class)->notify($order, $msg, $update); } }; } }