| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- namespace App\Http\Controllers;
- use App\Exports\InventoryBlindReceiveExcelExport;
- use App\InventoryBlindReceiveExcel;
- use Carbon\Carbon;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Storage;
- use Maatwebsite\Excel\Facades\Excel;
- use function foo\func;
- class ExcelController extends Controller
- {
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function index()
- {
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function create()
- {
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\Response
- */
- public function store(Request $request)
- {
- //
- }
- public function makeExcel()
- {
- ini_set('max_execution_time',2500);
- ini_set('memory_limit','1526M');
- $filePathName='d:/02.json';
- $goodsesExcelArray=[['barcode','weight','id','key','time','url']];
- $handler=fopen($filePathName,'r');
- $json = fread($handler, filesize($filePathName));
- // $json = '[' . $json . ']';
- $jsonArr=json_decode($json,true);
- foreach ($jsonArr as $obj){
- $url = $obj['url']??'';
- $barcode=($obj['barcode']??'').' ';
- array_push($goodsesExcelArray,[$barcode,$obj['weight']??'',($obj['id']??'').' '
- ,($obj['key'])??'',($obj['time'])??'', ($url)??'']);
- }
- Excel::store(new InventoryBlindReceiveExcelExport($goodsesExcelArray),'exportedJson.xlsx','public');
- return ['result'=>'success'];
- }
- /**
- * Display the specified resource.
- *
- * @param \App\InventoryBlindReceiveExcel $goodsNeateningExcel
- * @return \Illuminate\Http\Response
- */
- public function show(InventoryBlindReceiveExcel $goodsNeateningExcel)
- {
- //
- }
- /**
- * Show the form for editing the specified resource.
- *
- * @param \App\InventoryBlindReceiveExcel $goodsNeateningExcel
- * @return \Illuminate\Http\Response
- */
- public function edit(InventoryBlindReceiveExcel $goodsNeateningExcel)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param \App\InventoryBlindReceiveExcel $goodsNeateningExcel
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, InventoryBlindReceiveExcel $goodsNeateningExcel)
- {
- //
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param \App\InventoryBlindReceiveExcel $goodsNeateningExcel
- * @return \Illuminate\Http\Response
- */
- public function destroy(InventoryBlindReceiveExcel $goodsNeateningExcel)
- {
- //
- }
- }
|