snapshots([ 'data' => [ 'ords' => [ 'fldHeads' => [ ['fld' => 'c_900904', 'title' => '商品编码'], ['fld' => 'c_900910', 'title' => '商品名称'], ['fld' => 'c_900201', 'title' => '商品成本'], ['fld' => 'c_900407', 'title' => '商家运费'], ], 'dataList' => [ [ 'c_900901' => '天猫-卓禾家具旗舰店', 'c_900902' => '5127581702031023636', 'c_900903' => '10097143', 'c_900904' => 'ZWJ003952N181V01', 'c_900910' => '书架', 'c_900201' => 0, 'c_900407' => 7.05, ], [ 'c_900901' => '天猫-卓禾家具旗舰店', 'c_900902' => '5127581702031023636', 'c_900903' => '10097143', 'c_900904' => 'ZWJ003952N181V02', 'c_900910' => '书架配件', 'c_900201' => 18.5, 'c_900407' => 0, ], [ 'c_900901' => '天猫-卓禾家具旗舰店', 'c_900902' => '5127581702031023637', 'c_900903' => '10097144', 'c_900904' => 'ZWJ003952N181V03', 'c_900910' => '置物架', 'c_900201' => 22, 'c_900407' => 6, ], ], ], 'afters' => [ 'fldHeads' => [ ['fld' => 'c_900904', 'title' => '商品编码'], ['fld' => 'c_900201', 'title' => '商品成本'], ], 'dataList' => [[ 'c_900901' => '天猫-卓禾家具旗舰店', 'c_900902' => '5127581702031023636', 'c_900903' => '10097143', 'c_900904' => 'ZWJ003952N181V01', 'c_900201' => 0, ]], ], ], ]); $this->assertCount(2, $snapshots); $snapshot = collect($snapshots)->firstWhere('order_key', '天猫-卓禾家具旗舰店|5127581702031023636'); $this->assertSame(2, $snapshot['item_count']); $this->assertSame(1, $snapshot['after_item_count']); $this->assertSame(1, $snapshot['missing_cost_item_count']); $this->assertSame(['ZWJ003952N181V01'], json_decode($snapshot['missing_cost_barcodes'], true)); $items = json_decode($snapshot['order_items'], true); $this->assertSame('ZWJ003952N181V01', $items[0]['c_900904']); $this->assertSame(18.5, $items[1]['c_900201']); $this->assertCount(4, json_decode($snapshot['order_headers'], true)); $this->assertSame('商品编码', json_decode($snapshot['order_headers'], true)[0]['title']); $this->assertArrayNotHasKey('source_payload', $snapshot); } }