<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Data\Traits; use ModStart\Core\Input\Response; use ModStart\Data\Event\DataFileUploadedEvent; trait LocalMultipartUploadTrait { public function multiPartInit($qHLCM) { goto PU7To; PU7To: $EerLH = $this->multiPartInitToken($qHLCM); goto vFArp; uC5x5: return Response::generate(0, 'ok', $EerLH); goto XbE3D; vFArp: $this->uploadChunkTokenAndUpdateToken($EerLH); goto uC5x5; XbE3D: } public function multiPartUpload($qHLCM) { goto gwiRB; HpP9n: $ZRqAm = $qHLCM['category']; goto XS1RE; P0o_v: if ($CnWtd['chunk'] < $CnWtd['chunks']) { goto j5N7e; thDQZ: $EerLH['chunkUploaded'] = $CnWtd['chunk'] + 1; goto jqibU; s6Dab: $this->localStorage->put($oJLhT . '.' . $CnWtd['chunk'], $Afv_G); goto thDQZ; Oi9dv: $CnWtd['finished'] = false; goto NOhuU; NOhuU: if ($EerLH['chunkUploaded'] == $CnWtd['chunks']) { goto idzKq; jOB9R: $A33WR = $this->localStorage->size($oJLhT); goto cZmqo; KLSxY: $CnWtd['preview'] = $this->getDriverFullPath($EerLH['fullPath']); goto OzT_4; OzT_4: $CnWtd['finished'] = true; goto tGtxO; SxFyK: $this->uploadChunkTokenAndDeleteToken($EerLH); goto jOB9R; f2aZ9: DataFileUploadedEvent::fire($this->remoteType, $ZRqAm, $EerLH['fullPath']); goto IMXI_; IMXI_: $yPirl = $this->repository->addTemp($ZRqAm, $EerLH['path'], $EerLH['name'], $EerLH['size'], empty($EerLH['md5']) ? null : $EerLH['md5']); goto lUPy7; lUPy7: $CnWtd['data'] = $yPirl; goto iXYZ2; Z3QC9: @unlink(public_path($oJLhT)); goto f2aZ9; srMB3: $this->saveLocalToRemote($oJLhT, $EerLH['fullPath']); goto Z3QC9; cZmqo: if ($A33WR != $EerLH['size']) { return Response::generate(-1, 'MultiPartUpload combile file failed (' . $A33WR . ',' . $EerLH['size'] . ') ShouldRetryUpload'); } goto srMB3; iXYZ2: $CnWtd['path'] = $EerLH['fullPath']; goto KLSxY; idzKq: $this->combine($oJLhT); goto SxFyK; tGtxO: } goto c017x; jqibU: $this->uploadChunkTokenAndUpdateToken($EerLH); goto Oi9dv; j5N7e: $Afv_G = file_get_contents($CnWtd['file']->getRealPath()); goto s6Dab; c017x: } goto tCHfN; mg4QP: $CnWtd['chunk'] = $kFc4w['chunk']; goto RLVT7; tCHfN: return Response::generate(0, 'ok', $CnWtd); goto q_zPs; mNp9U: $CnWtd['chunks'] = $kFc4w['chunks']; goto mg4QP; zFleI: if (!isset($kFc4w['chunks'])) { $kFc4w['chunks'] = 1; } goto sJg0M; RLVT7: $CnWtd['file'] = $kFc4w['file']; goto MgFrv; gwiRB: $EerLH = $this->multiPartInitToken($qHLCM); goto K0Jyy; eitiL: if (empty($kFc4w['file'])) { return Response::generateError('MultiPartUpload file empty'); } goto mNp9U; sJg0M: if (!isset($kFc4w['chunk'])) { $kFc4w['chunk'] = 0; } goto eitiL; XS1RE: $CnWtd = array(); goto zFleI; MgFrv: $oJLhT = self::DATA_CHUNK . '/data/' . $EerLH['hash']; goto P0o_v; K0Jyy: $kFc4w = $qHLCM['input']; goto HpP9n; q_zPs: } private function combine($aYJAK) { goto MfYEL; uo6PT: if (flock($oNQ7p, LOCK_EX)) { for ($MqJHJ = 0;; $MqJHJ++) { if (!$this->localStorage->has($aYJAK . '.' . $MqJHJ)) { break; } $Afv_G = file_get_contents($SGkWN . $aYJAK . '.' . $MqJHJ); fwrite($oNQ7p, $Afv_G); @unlink($SGkWN . $aYJAK . '.' . $MqJHJ); } flock($oNQ7p, LOCK_UN); } goto HSaOg; HSaOg: fclose($oNQ7p); goto iExND; MfYEL: $SGkWN = config('filesystems.disks.data.root'); goto cEGhB; cEGhB: $oNQ7p = @fopen($SGkWN . $aYJAK, 'wb'); goto uo6PT; iExND: } }