<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Assets\Driver; use ModStart\Core\Assets\AssetsPath; use Illuminate\Support\Facades\Cache; class CdnAssetsPath implements AssetsPath { const CACHE_PREFIX = 'modstart:asset-file:'; public function getPathWithHash($oU8qf) { goto x7cMY; x7cMY: $J5ee9 = Cache::get($GN5XH = self::CACHE_PREFIX . $oU8qf, null); goto jF1AZ; OJpcP: return $oU8qf; goto gXzrF; W6hU_: if (file_exists($oU8qf)) { goto o4_U4; TmvFl: Cache::put($GN5XH, $J5ee9, 0); goto LX183; o4_U4: $J5ee9 = '' . crc32(md5_file($oU8qf)); goto TmvFl; LX183: return $oU8qf . '?' . $J5ee9; goto WvFxI; WvFxI: } goto EjI0V; EjI0V: Cache::put($GN5XH, '', 0); goto OJpcP; jF1AZ: if (null !== $J5ee9) { return $oU8qf . '?' . $J5ee9; } goto W6hU_; gXzrF: } public function getCDN($oU8qf) { goto bVnUZ; yS0Zy: return $IaHBi[$tzgIm]; goto TVezp; bVnUZ: $IaHBi = config('modstart.asset.cdn_array', array('/')); goto ffPlt; ffPlt: $tzgIm = abs(crc32($oU8qf) % count($IaHBi)); goto yS0Zy; TVezp: } }