diff --git a/.version b/.version index f97165942..59172f902 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -{"version":"3.1","md5":"2eb40f6eaea951255fe3cd0e189608f1","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.1\/card_release.tar.gz"} \ No newline at end of file +{"version":"3.11","md5":"073c62cb66606bd3ab5d7eccc085234d","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.11\/card_release.tar.gz"} \ No newline at end of file diff --git a/README.md b/README.md index f31c9b6a6..1ee719da4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

CardSystem

-License +License PHP from Packagist badge License Travis diff --git a/app/Card.php b/app/Card.php index 066ab7b1e..30760ea0c 100644 --- a/app/Card.php +++ b/app/Card.php @@ -1,2 +1,2 @@ hasMany(Order::class); } function product() { return $this->belongsTo(Product::class); } function getCountAttribute() { return $this->count_all - $this->count_sold; } public static function add_cards($spa27b73, $sp52cac1, $sp4ad441, $sp415e3d, $spa504de, $sp24ed58) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spa27b73, $sp52cac1, $sp4ad441, $sp415e3d, $spa504de, (int) $sp24ed58)); } public static function _trash($spd10097) { DB::transaction(function () use($spd10097) { $sp6161c4 = clone $spd10097; $sp6161c4->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp389a95) { foreach ($sp389a95 as $sp29413f) { $sp4aad76 = \App\Product::where('id', $sp29413f->product_id)->lockForUpdate()->first(); if ($sp4aad76) { $sp4aad76->count_all -= $sp29413f->count_left; $sp4aad76->saveOrFail(); } } }); $spd10097->delete(); return true; }); } public static function _restore($spd10097) { DB::transaction(function () use($spd10097) { $sp6161c4 = clone $spd10097; $sp6161c4->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp389a95) { foreach ($sp389a95 as $sp29413f) { $sp4aad76 = \App\Product::where('id', $sp29413f->product_id)->lockForUpdate()->first(); if ($sp4aad76) { $sp4aad76->count_all += $sp29413f->count_left; $sp4aad76->saveOrFail(); } } }); $spd10097->restore(); return true; }); } } \ No newline at end of file +namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\DB; class Card extends Model { protected $guarded = array(); use SoftDeletes; protected $dates = array('deleted_at'); const STATUS_NORMAL = 0; const STATUS_SOLD = 1; const STATUS_USED = 2; const TYPE_ONETIME = 0; const TYPE_REPEAT = 1; function orders() { return $this->hasMany(Order::class); } function product() { return $this->belongsTo(Product::class); } function getCountAttribute() { return $this->count_all - $this->count_sold; } public static function add_cards($sp699450, $sp517398, $spa0789d, $sp0f5dbe, $sp107491, $sp736e02) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp699450, $sp517398, $spa0789d, $sp0f5dbe, $sp107491, (int) $sp736e02)); } public static function _trash($spcfdf85) { DB::transaction(function () use($spcfdf85) { $spe137eb = clone $spcfdf85; $spe137eb->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp06abef) { foreach ($sp06abef as $sp66d858) { $sp222f58 = \App\Product::where('id', $sp66d858->product_id)->lockForUpdate()->first(); if ($sp222f58) { $sp222f58->count_all -= $sp66d858->count_left; $sp222f58->saveOrFail(); } } }); $spcfdf85->delete(); return true; }); } public static function _restore($spcfdf85) { DB::transaction(function () use($spcfdf85) { $spe137eb = clone $spcfdf85; $spe137eb->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp06abef) { foreach ($sp06abef as $sp66d858) { $sp222f58 = \App\Product::where('id', $sp66d858->product_id)->lockForUpdate()->first(); if ($sp222f58) { $sp222f58->count_all += $sp66d858->count_left; $sp222f58->saveOrFail(); } } }); $spcfdf85->restore(); return true; }); } } \ No newline at end of file diff --git a/app/Category.php b/app/Category.php index 223d7ba48..6b9eb5c4b 100644 --- a/app/Category.php +++ b/app/Category.php @@ -1,2 +1,2 @@ id, Helper::ID_TYPE_CATEGORY); } function products() { return $this->hasMany(Product::class); } function user() { return $this->belongsTo(User::class); } function getTmpPassword() { return md5('$wGgMd45Jgi@dBDR' . $this->password . '1#DS2%!VLqJolmMD'); } function getProductsForShop() { $sp0f92be = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp0f92be as $sp4aad76) { $sp4aad76->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp0f92be); return $sp0f92be; } } \ No newline at end of file +namespace App; use App\Library\Helper; use Illuminate\Database\Eloquent\Model; class Category extends Model { protected $guarded = array(); function getUrlAttribute() { return config('app.url') . '/c/' . Helper::id_encode($this->id, Helper::ID_TYPE_CATEGORY); } function products() { return $this->hasMany(Product::class); } function user() { return $this->belongsTo(User::class); } function getTmpPassword() { return md5('$wGgMd45Jgi@dBDR' . $this->password . '1#DS2%!VLqJolmMD'); } function getProductsForShop() { $sp19cd84 = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp19cd84 as $sp222f58) { $sp222f58->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp19cd84); return $sp19cd84; } } \ No newline at end of file diff --git a/app/Console/Commands/ResetPassword.php b/app/Console/Commands/ResetPassword.php index 9ca965f52..d498f1351 100644 --- a/app/Console/Commands/ResetPassword.php +++ b/app/Console/Commands/ResetPassword.php @@ -1,4 +1,4 @@ argument('email'); if (!$sp72ada4) { $this->warn('please input the user\'s email -'); return false; } $spe2c9ac = \App\User::where('email', $sp72ada4)->first(); if (!$spe2c9ac) { $this->warn("can't find the user: {$sp72ada4} \nplease input the user's email\n"); return false; } $sp27b440 = $this->argument('password'); $spe2c9ac->password = bcrypt($sp27b440); $spe2c9ac->save(); $this->info("the password of '{$sp72ada4}' has been set to {$sp27b440}\n"); return true; } } \ No newline at end of file +Usage: php artisan reset:password user@email.com'; public function __construct() { parent::__construct(); } public function handle() { $sp3d0720 = $this->argument('email'); if (!$sp3d0720) { $this->warn('please input the user\'s email +'); return false; } $sp590011 = \App\User::where('email', $sp3d0720)->first(); if (!$sp590011) { $this->warn("can't find the user: {$sp3d0720} \nplease input the user's email\n"); return false; } $sp4b3985 = $this->argument('password'); $sp590011->password = bcrypt($sp4b3985); $sp590011->save(); $this->info("the password of '{$sp3d0720}' has been set to {$sp4b3985}\n"); return true; } } \ No newline at end of file diff --git a/app/Console/Commands/Update.php b/app/Console/Commands/Update.php index ad5c10233..755e04b1a 100644 --- a/app/Console/Commands/Update.php +++ b/app/Console/Commands/Update.php @@ -1,13 +1,13 @@ 0) { echo ' download: ' . sprintf('%.2f', $sp4f6e02 / $sp4b62ad * 100) . '%'; } }); curl_setopt($sp89b559, CURLOPT_NOPROGRESS, false); curl_setopt($sp89b559, CURLOPT_HEADER, 0); curl_setopt($sp89b559, CURLOPT_USERAGENT, 'card update'); if (defined('MY_PROXY')) { $sp4cd3fc = MY_PROXY; $sp27c782 = CURLPROXY_HTTP; if (strpos($sp4cd3fc, 'http://') || strpos($sp4cd3fc, 'https://')) { $sp4cd3fc = str_replace('http://', $sp4cd3fc, $sp4cd3fc); $sp4cd3fc = str_replace('https://', $sp4cd3fc, $sp4cd3fc); $sp27c782 = CURLPROXY_HTTP; } elseif (strpos($sp4cd3fc, 'socks4://')) { $sp4cd3fc = str_replace('socks4://', $sp4cd3fc, $sp4cd3fc); $sp27c782 = CURLPROXY_SOCKS4; } elseif (strpos($sp4cd3fc, 'socks4a://')) { $sp4cd3fc = str_replace('socks4a://', $sp4cd3fc, $sp4cd3fc); $sp27c782 = CURLPROXY_SOCKS4A; } elseif (strpos($sp4cd3fc, 'socks5://')) { $sp4cd3fc = str_replace('socks5://', $sp4cd3fc, $sp4cd3fc); $sp27c782 = CURLPROXY_SOCKS5_HOSTNAME; } curl_setopt($sp89b559, CURLOPT_PROXY, $sp4cd3fc); curl_setopt($sp89b559, CURLOPT_PROXYTYPE, $sp27c782); if (defined('MY_PROXY_PASS')) { curl_setopt($sp89b559, CURLOPT_PROXYUSERPWD, MY_PROXY_PASS); } } curl_exec($sp89b559); curl_close($sp89b559); echo ' -'; return true; } public function handle() { set_time_limit(0); $sp4cd3fc = $this->option('proxy'); if (!empty($sp4cd3fc)) { define('MY_PROXY', $sp4cd3fc); } $spf13787 = $this->option('proxy-auth'); if (!empty($spf13787)) { define('MY_PROXY_PASS', $spf13787); } if (!empty(getenv('_'))) { $sp8eaa5c = '"' . getenv('_') . '" "' . $_SERVER['PHP_SELF'] . '" '; } else { if (!empty($_SERVER['_'])) { $sp8eaa5c = '"' . $_SERVER['_'] . '" "' . $_SERVER['PHP_SELF'] . '" '; } else { if (PHP_OS === 'WINNT') { $sp5e4237 = dirname(php_ini_loaded_file()) . DIRECTORY_SEPARATOR . 'php.exe'; } else { $sp5e4237 = dirname(php_ini_loaded_file()); if (ends_with($sp5e4237, DIRECTORY_SEPARATOR . 'etc')) { $sp5e4237 = substr($sp5e4237, 0, -4); } $sp5e4237 .= DIRECTORY_SEPARATOR . 'php'; } if (!file_exists($sp5e4237)) { echo '未找到php安装路径! -'; goto LABEL_EXIT; } $sp8eaa5c = '"' . $sp5e4237 . '" "' . $_SERVER['PHP_SELF'] . '" '; } } exec($sp8eaa5c . ' cache:clear'); exec($sp8eaa5c . ' config:clear'); echo ' -'; $this->comment('检查更新中...'); $this->info('当前版本: ' . config('app.version')); $sp3ce6e7 = @json_decode(CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'), true); if (!@$sp3ce6e7['version']) { $this->warn('检查更新失败!'); $this->warn('Error: ' . ($sp3ce6e7 ? json_encode($sp3ce6e7) : 'Network error')); goto LABEL_EXIT; } $this->info('最新版本: ' . $sp3ce6e7['version']); $this->info('版本说明: ' . (@$sp3ce6e7['description'] ?? '无')); if (config('app.version') >= $sp3ce6e7['version']) { $this->comment('您的版本已是最新!'); $spb779ce = strtolower($this->ask('是否再次更新 (yes/no)', 'no')); if ($spb779ce !== 'yes') { goto LABEL_EXIT; } } else { $spb779ce = strtolower($this->ask('是否现在更新 (yes/no)', 'no')); if ($spb779ce !== 'yes') { goto LABEL_EXIT; } } $sp889467 = realpath(sys_get_temp_dir()); if (strlen($sp889467) < 3) { $this->warn('获取临时目录失败!'); goto LABEL_EXIT; } $sp889467 .= DIRECTORY_SEPARATOR . Str::random(16); if (!mkdir($sp889467) || !is_writable($sp889467) || !is_readable($sp889467)) { $this->warn('临时目录不可读写!'); goto LABEL_EXIT; } if (!function_exists('exec')) { $this->warn('函数 exec 已被禁用, 无法继续更新!'); goto LABEL_EXIT; } if (PHP_OS === 'WINNT') { $spde64d1 = 'C:\\Program Files\\7-Zip\\7z.exe'; if (!is_file($spde64d1)) { $spde64d1 = strtolower($this->ask('未找到7-Zip, 请手动输入7zG.exe路径', $spde64d1)); } if (!is_file($spde64d1)) { $this->warn('7-Zip不可用, 请安装7-Zip后重试'); goto LABEL_EXIT; } $spde64d1 = '"' . $spde64d1 . '"'; } else { exec('tar --version', $sp68d7be, $sp64bd31); if ($sp64bd31) { $this->warn('Error: tar --version +namespace App\Console\Commands; use App\Library\CurlRequest; use function DeepCopy\deep_copy; use Illuminate\Console\Command; use Illuminate\Support\Str; class Update extends Command { protected $signature = 'update {--proxy=} {--proxy-auth=}'; protected $description = 'check update'; public function __construct() { parent::__construct(); } private function download_progress($sp69c1d6, $sp37b2ad) { $sp72d75d = fopen($sp37b2ad, 'w+'); if (!$sp72d75d) { return false; } $spba6201 = curl_init(); curl_setopt($spba6201, CURLOPT_URL, $sp69c1d6); curl_setopt($spba6201, CURLOPT_FOLLOWLOCATION, true); curl_setopt($spba6201, CURLOPT_RETURNTRANSFER, true); curl_setopt($spba6201, CURLOPT_FILE, $sp72d75d); curl_setopt($spba6201, CURLOPT_PROGRESSFUNCTION, function ($spc3a656, $sp675c6d, $spf30f79, $spc67bcb, $sp0a0c96) { if ($sp675c6d > 0) { echo ' download: ' . sprintf('%.2f', $spf30f79 / $sp675c6d * 100) . '%'; } }); curl_setopt($spba6201, CURLOPT_NOPROGRESS, false); curl_setopt($spba6201, CURLOPT_HEADER, 0); curl_setopt($spba6201, CURLOPT_USERAGENT, 'card update'); if (defined('MY_PROXY')) { $spa7dc76 = MY_PROXY; $sp0d4846 = CURLPROXY_HTTP; if (strpos($spa7dc76, 'http://') || strpos($spa7dc76, 'https://')) { $spa7dc76 = str_replace('http://', $spa7dc76, $spa7dc76); $spa7dc76 = str_replace('https://', $spa7dc76, $spa7dc76); $sp0d4846 = CURLPROXY_HTTP; } elseif (strpos($spa7dc76, 'socks4://')) { $spa7dc76 = str_replace('socks4://', $spa7dc76, $spa7dc76); $sp0d4846 = CURLPROXY_SOCKS4; } elseif (strpos($spa7dc76, 'socks4a://')) { $spa7dc76 = str_replace('socks4a://', $spa7dc76, $spa7dc76); $sp0d4846 = CURLPROXY_SOCKS4A; } elseif (strpos($spa7dc76, 'socks5://')) { $spa7dc76 = str_replace('socks5://', $spa7dc76, $spa7dc76); $sp0d4846 = CURLPROXY_SOCKS5_HOSTNAME; } curl_setopt($spba6201, CURLOPT_PROXY, $spa7dc76); curl_setopt($spba6201, CURLOPT_PROXYTYPE, $sp0d4846); if (defined('MY_PROXY_PASS')) { curl_setopt($spba6201, CURLOPT_PROXYUSERPWD, MY_PROXY_PASS); } } curl_exec($spba6201); curl_close($spba6201); echo ' +'; return true; } public function handle() { set_time_limit(0); $spa7dc76 = $this->option('proxy'); if (!empty($spa7dc76)) { define('MY_PROXY', $spa7dc76); } $sp6cf7f1 = $this->option('proxy-auth'); if (!empty($sp6cf7f1)) { define('MY_PROXY_PASS', $sp6cf7f1); } if (!empty(getenv('_'))) { $sp96ffbe = '"' . getenv('_') . '" "' . $_SERVER['PHP_SELF'] . '" '; } else { if (!empty($_SERVER['_'])) { $sp96ffbe = '"' . $_SERVER['_'] . '" "' . $_SERVER['PHP_SELF'] . '" '; } else { if (PHP_OS === 'WINNT') { $spf3292e = dirname(php_ini_loaded_file()) . DIRECTORY_SEPARATOR . 'php.exe'; } else { $spf3292e = dirname(php_ini_loaded_file()); if (ends_with($spf3292e, DIRECTORY_SEPARATOR . 'etc')) { $spf3292e = substr($spf3292e, 0, -4); } $spf3292e .= DIRECTORY_SEPARATOR . 'php'; } if (!file_exists($spf3292e)) { echo '未找到php安装路径! +'; goto LABEL_EXIT; } $sp96ffbe = '"' . $spf3292e . '" "' . $_SERVER['PHP_SELF'] . '" '; } } exec($sp96ffbe . ' cache:clear'); exec($sp96ffbe . ' config:clear'); echo ' +'; $this->comment('检查更新中...'); $this->info('当前版本: ' . config('app.version')); $spbaaa2b = @json_decode(CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'), true); if (!@$spbaaa2b['version']) { $this->warn('检查更新失败!'); $this->warn('Error: ' . ($spbaaa2b ? json_encode($spbaaa2b) : 'Network error')); goto LABEL_EXIT; } $this->info('最新版本: ' . $spbaaa2b['version']); $this->info('版本说明: ' . (@$spbaaa2b['description'] ?? '无')); if (config('app.version') >= $spbaaa2b['version']) { $this->comment('您的版本已是最新!'); $sp66e739 = strtolower($this->ask('是否再次更新 (yes/no)', 'no')); if ($sp66e739 !== 'yes') { goto LABEL_EXIT; } } else { $sp66e739 = strtolower($this->ask('是否现在更新 (yes/no)', 'no')); if ($sp66e739 !== 'yes') { goto LABEL_EXIT; } } $sp2ad06d = realpath(sys_get_temp_dir()); if (strlen($sp2ad06d) < 3) { $this->warn('获取临时目录失败!'); goto LABEL_EXIT; } $sp2ad06d .= DIRECTORY_SEPARATOR . Str::random(16); if (!mkdir($sp2ad06d) || !is_writable($sp2ad06d) || !is_readable($sp2ad06d)) { $this->warn('临时目录不可读写!'); goto LABEL_EXIT; } if (!function_exists('exec')) { $this->warn('函数 exec 已被禁用, 无法继续更新!'); goto LABEL_EXIT; } if (PHP_OS === 'WINNT') { $sp8421d1 = 'C:\\Program Files\\7-Zip\\7z.exe'; if (!is_file($sp8421d1)) { $sp8421d1 = strtolower($this->ask('未找到7-Zip, 请手动输入7zG.exe路径', $sp8421d1)); } if (!is_file($sp8421d1)) { $this->warn('7-Zip不可用, 请安装7-Zip后重试'); goto LABEL_EXIT; } $sp8421d1 = '"' . $sp8421d1 . '"'; } else { exec('tar --version', $spb3c9e1, $sp231f31); if ($sp231f31) { $this->warn('Error: tar --version ' . join(' -', $sp68d7be)); goto LABEL_EXIT; } } $this->comment('正在下载新版本...'); $spabd452 = $sp889467 . DIRECTORY_SEPARATOR . 'ka_update_' . Str::random(16) . '.tmp'; if (!$this->download_progress($sp3ce6e7['url'], $spabd452)) { $this->warn('写入临时文件失败!'); goto LABEL_EXIT; } $spda2a29 = md5_file($spabd452); if ($spda2a29 !== $sp3ce6e7['md5']) { $this->warn('更新文件md5校验失败!, file:' . $spda2a29 . ', require:' . $sp3ce6e7['md5']); goto LABEL_EXIT; } $this->comment('正在解压...'); unset($sp68d7be); if (PHP_OS === 'WINNT') { exec("{$spde64d1} x -so {$spabd452} | {$spde64d1} x -aoa -si -ttar -o{$sp889467}", $sp68d7be, $sp64bd31); } else { exec("tar -zxf {$spabd452} -C {$sp889467}", $sp68d7be, $sp64bd31); } if ($sp64bd31) { $this->warn('Error: 解压失败 +', $spb3c9e1)); goto LABEL_EXIT; } } $this->comment('正在下载新版本...'); $sp37b2ad = $sp2ad06d . DIRECTORY_SEPARATOR . 'ka_update_' . Str::random(16) . '.tmp'; if (!$this->download_progress($spbaaa2b['url'], $sp37b2ad)) { $this->warn('写入临时文件失败!'); goto LABEL_EXIT; } $spaced8e = md5_file($sp37b2ad); if ($spaced8e !== $spbaaa2b['md5']) { $this->warn('更新文件md5校验失败!, file:' . $spaced8e . ', require:' . $spbaaa2b['md5']); goto LABEL_EXIT; } $this->comment('正在解压...'); unset($spb3c9e1); if (PHP_OS === 'WINNT') { exec("{$sp8421d1} x -so {$sp37b2ad} | {$sp8421d1} x -aoa -si -ttar -o{$sp2ad06d}", $spb3c9e1, $sp231f31); } else { exec("tar -zxf {$sp37b2ad} -C {$sp2ad06d}", $spb3c9e1, $sp231f31); } if ($sp231f31) { $this->warn('Error: 解压失败 ' . join(' -', $sp68d7be)); goto LABEL_EXIT; } $this->comment('正在关闭主站...'); exec($sp8eaa5c . ' down'); sleep(5); $this->comment(' --> 正在清理旧文件...'); $sp6d6730 = base_path(); foreach (array('app', 'bootstrap', 'config', 'public/dist', 'database', 'routes', 'vendor') as $sp2b7370) { \File::deleteDirectory($sp6d6730 . DIRECTORY_SEPARATOR . $sp2b7370); } $this->comment(' --> 正在复制新文件...'); \File::delete($sp889467 . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'logo.png'); \File::delete($sp889467 . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . '.htaccess'); \File::delete($sp889467 . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'web.config'); \File::delete($sp889467 . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'nginx.conf'); \File::delete($sp889467 . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'robots.txt'); \File::copyDirectory($sp889467 . DIRECTORY_SEPARATOR . 'card_system_free_dist', $sp6d6730); $this->comment(' --> 正在创建缓存...'); exec($sp8eaa5c . ' cache:clear'); exec($sp8eaa5c . ' route:cache'); exec($sp8eaa5c . ' config:cache'); $this->comment(' --> 正在更新数据库...'); exec($sp8eaa5c . ' migrate'); if (PHP_OS === 'WINNT') { echo ' +', $spb3c9e1)); goto LABEL_EXIT; } $this->comment('正在关闭主站...'); exec($sp96ffbe . ' down'); sleep(5); $this->comment(' --> 正在清理旧文件...'); $sp03b565 = base_path(); foreach (array('app', 'bootstrap', 'config', 'public/dist', 'database', 'routes', 'vendor') as $sp618c15) { \File::deleteDirectory($sp03b565 . DIRECTORY_SEPARATOR . $sp618c15); } $this->comment(' --> 正在复制新文件...'); \File::delete($sp2ad06d . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'logo.png'); \File::delete($sp2ad06d . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . '.htaccess'); \File::delete($sp2ad06d . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'web.config'); \File::delete($sp2ad06d . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'nginx.conf'); \File::delete($sp2ad06d . DIRECTORY_SEPARATOR . 'card_dist' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'robots.txt'); \File::copyDirectory($sp2ad06d . DIRECTORY_SEPARATOR . 'card_system_free_dist', $sp03b565); $this->comment(' --> 正在创建缓存...'); exec($sp96ffbe . ' cache:clear'); exec($sp96ffbe . ' route:cache'); exec($sp96ffbe . ' config:cache'); $this->comment(' --> 正在更新数据库...'); exec($sp96ffbe . ' migrate'); if (PHP_OS === 'WINNT') { echo ' '; $this->alert('请注意手动设置目录权限'); $this->comment(' storage 可读可写 '); $this->comment(' bootstrap/cache/ 可读可写 '); echo ' -'; } else { $this->comment(' --> 正在设置目录权限...'); exec('rm -rf storage/framework/cache/data/*'); exec('chmod -R 777 storage/'); exec('chmod -R 777 bootstrap/cache/'); } $this->comment('正在启用主站...'); exec($sp8eaa5c . ' up'); exec($sp8eaa5c . ' queue:restart'); $spa3a9fb = true; LABEL_EXIT: if (isset($sp889467) && strlen($sp889467) > 19) { $this->comment('清理临时目录...'); \File::deleteDirectory($sp889467); } if (isset($spa3a9fb) && $spa3a9fb) { $this->info('更新成功!'); } if (PHP_OS === 'WINNT') { } else { exec('rm -rf storage/framework/cache/data/*'); exec('chmod -R 777 storage/'); exec('chmod -R 777 bootstrap/cache/'); } echo ' +'; } else { $this->comment(' --> 正在设置目录权限...'); exec('rm -rf storage/framework/cache/data/*'); exec('chmod -R 777 storage/'); exec('chmod -R 777 bootstrap/cache/'); } $this->comment('正在启用主站...'); exec($sp96ffbe . ' up'); exec($sp96ffbe . ' queue:restart'); $sp154ac7 = true; LABEL_EXIT: if (isset($sp2ad06d) && strlen($sp2ad06d) > 19) { $this->comment('清理临时目录...'); \File::deleteDirectory($sp2ad06d); } if (isset($sp154ac7) && $sp154ac7) { $this->info('更新成功!'); } if (PHP_OS === 'WINNT') { } else { exec('rm -rf storage/framework/cache/data/*'); exec('chmod -R 777 storage/'); exec('chmod -R 777 bootstrap/cache/'); } echo ' '; die; } } \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index b8940f65a..ac4080656 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,4 +1,4 @@ runningInConsole()) { return; } try { System::_init(); } catch (\Throwable $spbd4f27) { return; } if (System::_getInt('order_clean_unpay_open') === 1) { $sp66f4c4 = System::_getInt('order_clean_unpay_day', 7); $spfd9ebd->call(function () use($sp66f4c4) { echo '[' . date('Y-m-d H:i:s') . "] cleaning unpaid orders({$sp66f4c4} days ago)...\n"; \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$sp66f4c4))->delete(); $sp4e57b0 = '[' . date('Y-m-d H:i:s') . '] unpaid-orders cleaned -'; echo $sp4e57b0; })->dailyAt('01:00'); } $spfd9ebd->call(function () { $sp66f4c4 = 7; echo '[' . date('Y-m-d H:i:s') . "] cleaning deleted cards({$sp66f4c4} days ago)...\n"; \App\Card::onlyTrashed()->where('deleted_at', '<', (new Carbon())->addDays(-$sp66f4c4))->forceDelete(); $sp4e57b0 = '[' . date('Y-m-d H:i:s') . '] deleted-cards cleaned -'; echo $sp4e57b0; })->dailyAt('02:00'); } protected function commands() { $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } } \ No newline at end of file +namespace App\Console; use App\System; use Carbon\Carbon; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Schema; class Kernel extends ConsoleKernel { protected $commands = array(); protected function schedule(Schedule $spd0d724) { if (!app()->runningInConsole()) { return; } try { System::_init(); } catch (\Throwable $sp7900a2) { return; } if (System::_getInt('order_clean_unpay_open') === 1) { $spc9ad9e = System::_getInt('order_clean_unpay_day', 7); $spd0d724->call(function () use($spc9ad9e) { echo '[' . date('Y-m-d H:i:s') . "] cleaning unpaid orders({$spc9ad9e} days ago)...\n"; \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$spc9ad9e))->delete(); $spdbd7f3 = '[' . date('Y-m-d H:i:s') . '] unpaid-orders cleaned +'; echo $spdbd7f3; })->dailyAt('01:00'); } $spd0d724->call(function () { $spc9ad9e = 7; echo '[' . date('Y-m-d H:i:s') . "] cleaning deleted cards({$spc9ad9e} days ago)...\n"; \App\Card::onlyTrashed()->where('deleted_at', '<', (new Carbon())->addDays(-$spc9ad9e))->forceDelete(); $spdbd7f3 = '[' . date('Y-m-d H:i:s') . '] deleted-cards cleaned +'; echo $spdbd7f3; })->dailyAt('02:00'); } protected function commands() { $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } } \ No newline at end of file diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 05cfcaa18..ba395489b 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -1,2 +1,2 @@ isXmlHttpRequest() ? response()->json(array('message' => $sp4e57b0), $sp415e3d) : response()->view('errors._', array('code' => $sp415e3d, 'message' => $sp4e57b0), $sp415e3d); } public function render($sp147552, Exception $spbd4f27) { if ($spbd4f27 instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) { return $this->msg($sp147552, trans('exception.resource_not_found'), 404); } elseif ($spbd4f27 instanceof \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException || $spbd4f27 instanceof \Illuminate\Auth\AuthenticationException) { Log::error('Caught a UnauthorizedHttpException', array('exception' => $spbd4f27)); return $this->msg($sp147552, trans('exception.please_login'), 401); } elseif ($spbd4f27 instanceof \Illuminate\Auth\Access\AuthorizationException) { return $this->msg($sp147552, trans('exception.un_authenticated'), 403); } elseif ($spbd4f27 instanceof \Illuminate\Validation\ValidationException) { $sp147552->headers->set('X-Requested-With', 'XMLHttpRequest'); $sp147552->headers->set('Accept', 'application/json'); return parent::render($sp147552, $spbd4f27); } elseif ($spbd4f27 instanceof \Illuminate\Session\TokenMismatchException) { return $this->msg($sp147552, trans('exception.csrf_token_invalid'), 403); } elseif ($spbd4f27 instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { return $this->msg($sp147552, trans('exception.not_found'), 404); } elseif ($spbd4f27 instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException) { return $this->msg($sp147552, trans('exception.method_not_allowed'), 405); } elseif ($spbd4f27 instanceof \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException) { return $this->msg($sp147552, trans('exception.service_unavailable'), 503); } elseif ($spbd4f27 instanceof \Symfony\Component\HttpKernel\Exception\HttpException) { $sp7fefa1 = $spbd4f27->getStatusCode() ?? 500; switch ($sp7fefa1) { case 429: return $this->msg($sp147552, trans('exception.too_many_requests'), $sp7fefa1); break; default: Log::error('Caught a UnknownHttpException', array('exception' => $spbd4f27)); return $this->msg($sp147552, trans('exception.service_unavailable'), $sp7fefa1); } } elseif ($spbd4f27 instanceof \Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException) { return $this->msg($sp147552, trans('exception.method_not_allowed'), 405); } Log::error('Uncaught Exception', array('exception' => $spbd4f27, 'method' => $sp147552->method(), 'url' => $sp147552->fullUrl(), 'data' => file_get_contents('php://input'), 'ip' => Helper::getIP() ?? $sp147552->ip(), 'client_ip' => $sp147552->getClientIp(), 'headers' => $sp147552->header())); if (config('app.debug')) { return parent::render($sp147552, $spbd4f27); } else { return $this->msg($sp147552, trans('exception.unknown_error'), 500); } } } \ No newline at end of file +namespace App\Exceptions; use App\Library\Helper; use App\Library\Response; use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Support\Facades\Log; class Handler extends ExceptionHandler { protected $dontReport = array(); protected $dontFlash = array('password', 'password_confirmation'); public function report(Exception $spa85eb9) { parent::report($spa85eb9); } private function msg($sp26e527, $spdbd7f3, $sp0f5dbe) { return $sp26e527->isXmlHttpRequest() ? response()->json(array('message' => $spdbd7f3), $sp0f5dbe) : response()->view('errors._', array('code' => $sp0f5dbe, 'message' => $spdbd7f3), $sp0f5dbe); } public function render($sp26e527, Exception $sp7900a2) { if ($sp7900a2 instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) { return $this->msg($sp26e527, trans('exception.resource_not_found'), 404); } elseif ($sp7900a2 instanceof \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException || $sp7900a2 instanceof \Illuminate\Auth\AuthenticationException) { Log::error('Caught a UnauthorizedHttpException', array('exception' => $sp7900a2)); return $this->msg($sp26e527, trans('exception.please_login'), 401); } elseif ($sp7900a2 instanceof \Illuminate\Auth\Access\AuthorizationException) { return $this->msg($sp26e527, trans('exception.un_authenticated'), 403); } elseif ($sp7900a2 instanceof \Illuminate\Validation\ValidationException) { $sp26e527->headers->set('X-Requested-With', 'XMLHttpRequest'); $sp26e527->headers->set('Accept', 'application/json'); return parent::render($sp26e527, $sp7900a2); } elseif ($sp7900a2 instanceof \Illuminate\Session\TokenMismatchException) { return $this->msg($sp26e527, trans('exception.csrf_token_invalid'), 403); } elseif ($sp7900a2 instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { return $this->msg($sp26e527, trans('exception.not_found'), 404); } elseif ($sp7900a2 instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException) { return $this->msg($sp26e527, trans('exception.method_not_allowed'), 405); } elseif ($sp7900a2 instanceof \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException) { return $this->msg($sp26e527, trans('exception.service_unavailable'), 503); } elseif ($sp7900a2 instanceof \Symfony\Component\HttpKernel\Exception\HttpException) { $sp2cda1d = $sp7900a2->getStatusCode() ?? 500; switch ($sp2cda1d) { case 429: return $this->msg($sp26e527, trans('exception.too_many_requests'), $sp2cda1d); break; default: Log::error('Caught a UnknownHttpException', array('exception' => $sp7900a2)); return $this->msg($sp26e527, trans('exception.service_unavailable'), $sp2cda1d); } } elseif ($sp7900a2 instanceof \Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException) { return $this->msg($sp26e527, trans('exception.method_not_allowed'), 405); } Log::error('Uncaught Exception', array('exception' => $sp7900a2, 'method' => $sp26e527->method(), 'url' => $sp26e527->fullUrl(), 'data' => file_get_contents('php://input'), 'ip' => Helper::getIP() ?? $sp26e527->ip(), 'client_ip' => $sp26e527->getClientIp(), 'headers' => $sp26e527->header())); if (config('app.debug')) { return parent::render($sp26e527, $sp7900a2); } else { return $this->msg($sp26e527, trans('exception.unknown_error'), 500); } } } \ No newline at end of file diff --git a/app/File.php b/app/File.php index ad04c29e9..732700807 100644 --- a/app/File.php +++ b/app/File.php @@ -1,2 +1,2 @@ driver)->delete($this->path); } catch (\Exception $spbd4f27) { \Log::error('File.deleteFile Error: ' . $spbd4f27->getMessage(), array('exception' => $spbd4f27)); } } public static function getProductFolder() { return 'images/product'; } } \ No newline at end of file +namespace App; use Illuminate\Database\Eloquent\Model; class File extends Model { protected $guarded = array(); public $timestamps = false; function deleteFile() { try { Storage::disk($this->driver)->delete($this->path); } catch (\Exception $sp7900a2) { \Log::error('File.deleteFile Error: ' . $sp7900a2->getMessage(), array('exception' => $sp7900a2)); } } public static function getProductFolder() { return 'images/product'; } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/Dashboard.php b/app/Http/Controllers/Admin/Dashboard.php index 15bacafd6..d68a7c3d6 100644 --- a/app/Http/Controllers/Admin/Dashboard.php +++ b/app/Http/Controllers/Admin/Dashboard.php @@ -1,2 +1,2 @@ array('count' => 0, 'paid' => 0, 'profit' => 0), 'yesterday' => array('count' => 0, 'paid' => 0, 'profit' => 0)); $sp6fdf87 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::now()->toDateString())->where(function ($spd10097) { $spd10097->where('status', Order::STATUS_PAID)->orWhere('status', Order::STATUS_SUCCESS); })->selectRaw('COUNT(*) as `count`,SUM(`paid`) as `paid`,SUM(`paid`-`sms_price`-`cost`-`fee`) as `profit`')->get()->toArray(); $spb56b65 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::yesterday()->toDateString())->where(function ($spd10097) { $spd10097->where('status', Order::STATUS_PAID)->orWhere('status', Order::STATUS_SUCCESS); })->selectRaw('COUNT(*) as `count`,SUM(`paid`) as `paid`,SUM(`paid`-`sms_price`-`cost`-`fee`) as `profit`')->get()->toArray(); if (isset($sp6fdf87[0]) && isset($sp6fdf87[0]['count'])) { $spf8fdb9['today'] = array('count' => (int) $sp6fdf87[0]['count'], 'paid' => (int) $sp6fdf87[0]['paid'], 'profit' => (int) $sp6fdf87[0]['profit']); } if (isset($spb56b65[0]) && isset($spb56b65[0]['count'])) { $spf8fdb9['yesterday'] = array('count' => (int) $spb56b65[0]['count'], 'paid' => (int) $spb56b65[0]['paid'], 'profit' => (int) $spb56b65[0]['profit']); } $spf8fdb9['need_ship_count'] = Order::whereUserId(\Auth::Id())->where('status', Order::STATUS_PAID)->count(); $spf8fdb9['login'] = \App\Log::where('action', \App\Log::ACTION_LOGIN)->latest()->first(); return Response::success($spf8fdb9); } function clearCache() { if (function_exists('opcache_reset')) { opcache_reset(); } try { \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); } catch (\Throwable $spbd4f27) { return Response::fail($spbd4f27->getMessage()); } return Response::success(); } function version() { $sp2fbabe = array(); $sp118acc = CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'); $sp3ce6e7 = @json_decode($sp118acc, true); if (!@$sp3ce6e7['data']['version']) { Log::error('Dashboard.version checkUpdate failed', array('version_raw' => $sp118acc)); $sp2fbabe['message'] = '检查更新失败'; } else { $sp2fbabe = array('version' => $sp3ce6e7['data']['version'], 'description' => $sp3ce6e7['data']['description']); } return Response::success(array('version' => config('app.version'), 'update' => $sp2fbabe)); } function logsToken() { $sp74ce9f = md5(random_bytes(128)); Cache::put($sp74ce9f, Auth::getUser(), 15); return response(array('token' => $sp74ce9f)); } function logsView(Request $sp147552, $sp74ce9f) { if ($spe2c9ac = Cache::get($sp74ce9f)) { Cache::put($sp74ce9f, $spe2c9ac, 15); return (new \Rap2hpoutre\LaravelLogViewer\LogViewerController())->index(); } else { throw new \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException('logs-token'); } } } \ No newline at end of file +namespace App\Http\Controllers\Admin; use App\Library\CurlRequest; use App\Library\Response; use App\Order; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Log; class Dashboard extends Controller { function index(Request $sp26e527) { $sp5aa810 = array('today' => array('count' => 0, 'paid' => 0, 'profit' => 0), 'yesterday' => array('count' => 0, 'paid' => 0, 'profit' => 0)); $spe6aa6d = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::now()->toDateString())->where(function ($spcfdf85) { $spcfdf85->where('status', Order::STATUS_PAID)->orWhere('status', Order::STATUS_SUCCESS); })->selectRaw('COUNT(*) as `count`,SUM(`paid`) as `paid`,SUM(`paid`-`sms_price`-`cost`-`fee`) as `profit`')->get()->toArray(); $sp368eaf = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::yesterday()->toDateString())->where(function ($spcfdf85) { $spcfdf85->where('status', Order::STATUS_PAID)->orWhere('status', Order::STATUS_SUCCESS); })->selectRaw('COUNT(*) as `count`,SUM(`paid`) as `paid`,SUM(`paid`-`sms_price`-`cost`-`fee`) as `profit`')->get()->toArray(); if (isset($spe6aa6d[0]) && isset($spe6aa6d[0]['count'])) { $sp5aa810['today'] = array('count' => (int) $spe6aa6d[0]['count'], 'paid' => (int) $spe6aa6d[0]['paid'], 'profit' => (int) $spe6aa6d[0]['profit']); } if (isset($sp368eaf[0]) && isset($sp368eaf[0]['count'])) { $sp5aa810['yesterday'] = array('count' => (int) $sp368eaf[0]['count'], 'paid' => (int) $sp368eaf[0]['paid'], 'profit' => (int) $sp368eaf[0]['profit']); } $sp5aa810['need_ship_count'] = Order::whereUserId(\Auth::Id())->where('status', Order::STATUS_PAID)->count(); $sp5aa810['login'] = \App\Log::where('action', \App\Log::ACTION_LOGIN)->latest()->first(); return Response::success($sp5aa810); } function clearCache() { if (function_exists('opcache_reset')) { opcache_reset(); } try { \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); } catch (\Throwable $sp7900a2) { return Response::fail($sp7900a2->getMessage()); } return Response::success(); } function version() { $sp4bc79d = array(); $sp318ad9 = CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'); $spbaaa2b = @json_decode($sp318ad9, true); if (!@$spbaaa2b['data']['version']) { Log::error('Dashboard.version checkUpdate failed', array('version_raw' => $sp318ad9)); $sp4bc79d['message'] = '检查更新失败'; } else { $sp4bc79d = array('version' => $spbaaa2b['data']['version'], 'description' => $spbaaa2b['data']['description']); } return Response::success(array('version' => config('app.version'), 'update' => $sp4bc79d)); } function logsToken() { $spce7aba = md5(random_bytes(128)); Cache::put($spce7aba, Auth::getUser(), 15); return response(array('token' => $spce7aba)); } function logsView(Request $sp26e527, $spce7aba) { if ($sp590011 = Cache::get($spce7aba)) { Cache::put($spce7aba, $sp590011, 15); return (new \Rap2hpoutre\LaravelLogViewer\LogViewerController())->index(); } else { throw new \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException('logs-token'); } } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/Order.php b/app/Http/Controllers/Admin/Order.php index 44c841dff..1e258d972 100644 --- a/app/Http/Controllers/Admin/Order.php +++ b/app/Http/Controllers/Admin/Order.php @@ -1,2 +1,2 @@ validate($sp147552, array('ids' => 'required|string', 'income' => 'required|integer', 'balance' => 'required|integer')); $sp548f2b = $sp147552->post('ids'); $spac2a92 = (int) $sp147552->post('income'); $spa50328 = (int) $sp147552->post('balance'); \App\Order::whereIn('id', explode(',', $sp548f2b))->chunk(100, function ($spbb53f2) use($spac2a92, $spa50328) { foreach ($spbb53f2 as $sp7c328e) { $sp7c328e->cards()->detach(); try { if ($spac2a92) { $sp7c328e->fundRecord()->delete(); } if ($spa50328) { $spe2c9ac = \App\User::lockForUpdate()->firstOrFail(); $spe2c9ac->m_all -= $sp7c328e->income; $spe2c9ac->saveOrFail(); } $sp7c328e->delete(); } catch (\Exception $spbd4f27) { } } }); return Response::success(); } function freeze(Request $sp147552) { $this->validate($sp147552, array('ids' => 'required|string')); $sp548f2b = explode(',', $sp147552->post('ids')); $sp0bd758 = $sp147552->post('reason'); $sp75f1cf = 0; $spa48ffd = 0; foreach ($sp548f2b as $spb6ceba) { $sp75f1cf++; if (FundHelper::orderFreeze($spb6ceba, $sp0bd758)) { $spa48ffd++; } } return Response::success(array($sp75f1cf, $spa48ffd)); } function unfreeze(Request $sp147552) { $this->validate($sp147552, array('ids' => 'required|string')); $sp548f2b = explode(',', $sp147552->post('ids')); $sp75f1cf = 0; $spa48ffd = 0; $spd18e4e = \App\Order::STATUS_FROZEN; foreach ($sp548f2b as $spb6ceba) { $sp75f1cf++; if (FundHelper::orderUnfreeze($spb6ceba, '后台操作', null, $spd18e4e)) { $spa48ffd++; } } return Response::success(array($sp75f1cf, $spa48ffd, $spd18e4e)); } function set_paid(Request $sp147552) { $this->validate($sp147552, array('id' => 'required|integer')); $speb3ceb = $sp147552->post('id', ''); $sp7926dc = $sp147552->post('trade_no', ''); if (strlen($sp7926dc) < 1) { return Response::forbidden('请输入支付系统内单号'); } $sp7c328e = \App\Order::findOrFail($speb3ceb); if ($sp7c328e->status !== \App\Order::STATUS_UNPAY) { return Response::forbidden('只能操作未支付订单'); } $spf63a25 = 'Admin.SetPaid'; $sp3bc683 = $sp7c328e->order_no; $sp6d2f0f = $sp7c328e->paid; try { Log::debug($spf63a25 . " shipOrder start, order_no: {$sp3bc683}, amount: {$sp6d2f0f}, trade_no: {$sp7926dc}"); (new \App\Http\Controllers\Shop\Pay())->shipOrder($sp147552, $sp3bc683, $sp6d2f0f, $sp7926dc); Log::debug($spf63a25 . ' shipOrder end, order_no: ' . $sp3bc683); $spa48ffd = true; $sp7ee4b9 = '发货成功'; } catch (\Exception $spbd4f27) { $spa48ffd = false; $sp7ee4b9 = $spbd4f27->getMessage(); Log::error($spf63a25 . ' shipOrder Exception: ' . $spbd4f27->getMessage()); } $sp7c328e = \App\Order::with(array('pay' => function (Relation $spd10097) { $spd10097->select(array('id', 'name')); }, 'card_orders.card' => function (Relation $spd10097) { $spd10097->select(array('id', 'card')); }))->findOrFail($speb3ceb); if ($sp7c328e->status === \App\Order::STATUS_PAID) { if ($sp7c328e->product->delivery === \App\Product::DELIVERY_MANUAL) { $spa48ffd = true; $sp7ee4b9 = '已标记为付款成功
当前商品为手动发货商品, 请手动进行发货。'; } else { $spa48ffd = false; $sp7ee4b9 = '已标记为付款成功,
但是买家库存不足, 发货失败, 请稍后尝试手动发货。'; } } return Response::success(array('code' => $spa48ffd ? 0 : -1, 'msg' => $sp7ee4b9, 'order' => $sp7c328e)); } } \ No newline at end of file +namespace App\Http\Controllers\Admin; use App\Library\FundHelper; use App\Library\Helper; use Carbon\Carbon; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Library\Response; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; class Order extends Controller { public function delete(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string', 'income' => 'required|integer', 'balance' => 'required|integer')); $sp892962 = $sp26e527->post('ids'); $sp07c5c5 = (int) $sp26e527->post('income'); $sp1396aa = (int) $sp26e527->post('balance'); \App\Order::whereIn('id', explode(',', $sp892962))->chunk(100, function ($sp002573) use($sp07c5c5, $sp1396aa) { foreach ($sp002573 as $sp8ac6c1) { $sp8ac6c1->cards()->detach(); try { if ($sp07c5c5) { $sp8ac6c1->fundRecord()->delete(); } if ($sp1396aa) { $sp590011 = \App\User::lockForUpdate()->firstOrFail(); $sp590011->m_all -= $sp8ac6c1->income; $sp590011->saveOrFail(); } $sp8ac6c1->delete(); } catch (\Exception $sp7900a2) { } } }); return Response::success(); } function freeze(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string')); $sp892962 = explode(',', $sp26e527->post('ids')); $sp49115f = $sp26e527->post('reason'); $spe95220 = 0; $sp35c270 = 0; foreach ($sp892962 as $sp27545d) { $spe95220++; if (FundHelper::orderFreeze($sp27545d, $sp49115f)) { $sp35c270++; } } return Response::success(array($spe95220, $sp35c270)); } function unfreeze(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string')); $sp892962 = explode(',', $sp26e527->post('ids')); $spe95220 = 0; $sp35c270 = 0; $sp8591a5 = \App\Order::STATUS_FROZEN; foreach ($sp892962 as $sp27545d) { $spe95220++; if (FundHelper::orderUnfreeze($sp27545d, '后台操作', null, $sp8591a5)) { $sp35c270++; } } return Response::success(array($spe95220, $sp35c270, $sp8591a5)); } function set_paid(Request $sp26e527) { $this->validate($sp26e527, array('id' => 'required|integer')); $sp138835 = $sp26e527->post('id', ''); $sp6324c8 = $sp26e527->post('trade_no', ''); if (strlen($sp6324c8) < 1) { return Response::forbidden('请输入支付系统内单号'); } $sp8ac6c1 = \App\Order::findOrFail($sp138835); if ($sp8ac6c1->status !== \App\Order::STATUS_UNPAY) { return Response::forbidden('只能操作未支付订单'); } $spb399b9 = 'Admin.SetPaid'; $spf82521 = $sp8ac6c1->order_no; $sp7f4b1f = $sp8ac6c1->paid; try { Log::debug($spb399b9 . " shipOrder start, order_no: {$spf82521}, amount: {$sp7f4b1f}, trade_no: {$sp6324c8}"); (new \App\Http\Controllers\Shop\Pay())->shipOrder($sp26e527, $spf82521, $sp7f4b1f, $sp6324c8); Log::debug($spb399b9 . ' shipOrder end, order_no: ' . $spf82521); $sp35c270 = true; $sp93a168 = '发货成功'; } catch (\Exception $sp7900a2) { $sp35c270 = false; $sp93a168 = $sp7900a2->getMessage(); Log::error($spb399b9 . ' shipOrder Exception: ' . $sp7900a2->getMessage()); } $sp8ac6c1 = \App\Order::with(array('pay' => function (Relation $spcfdf85) { $spcfdf85->select(array('id', 'name')); }, 'card_orders.card' => function (Relation $spcfdf85) { $spcfdf85->select(array('id', 'card')); }))->findOrFail($sp138835); if ($sp8ac6c1->status === \App\Order::STATUS_PAID) { if ($sp8ac6c1->product->delivery === \App\Product::DELIVERY_MANUAL) { $sp35c270 = true; $sp93a168 = '已标记为付款成功
当前商品为手动发货商品, 请手动进行发货。'; } else { $sp35c270 = false; $sp93a168 = '已标记为付款成功,
但是买家库存不足, 发货失败, 请稍后尝试手动发货。'; } } return Response::success(array('code' => $sp35c270 ? 0 : -1, 'msg' => $sp93a168, 'order' => $sp8ac6c1)); } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/Pay.php b/app/Http/Controllers/Admin/Pay.php index fd91a5ae8..5ae55a6aa 100644 --- a/app/Http/Controllers/Admin/Pay.php +++ b/app/Http/Controllers/Admin/Pay.php @@ -1,2 +1,2 @@ input('enabled'); if (strlen($sp23f506)) { $spd10097->whereIn('enabled', explode(',', $sp23f506)); } $spa1f2d3 = $sp147552->input('search', false); $spa55e11 = $sp147552->input('val', false); if ($spa1f2d3 && $spa55e11) { if ($spa1f2d3 == 'simple') { return Response::success($spd10097->get(array('id', 'name', 'enabled', 'comment'))); } elseif ($spa1f2d3 == 'id') { $spd10097->where('id', $spa55e11); } else { $spd10097->where($spa1f2d3, 'like', '%' . $spa55e11 . '%'); } } $sp8b8475 = $spd10097->get(); return Response::success(array('list' => $sp8b8475, 'urls' => array('url' => config('app.url'), 'url_api' => config('app.url_api')))); } function stat(Request $sp147552) { $this->validate($sp147552, array('day' => 'required|integer|between:1,30')); $sp66f4c4 = (int) $sp147552->input('day'); if ($sp66f4c4 === 30) { $sp7b3d9e = Carbon::now()->addMonths(-1)->toDateString() . ' 00:00:00'; } else { $sp7b3d9e = Carbon::now()->addDays(-$sp66f4c4)->toDateString() . ' 00:00:00'; } $sp8b8475 = $this->authQuery($sp147552, \App\Order::class)->where(function ($spd10097) { $spd10097->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', $sp7b3d9e)->with(array('pay' => function ($spd10097) { $spd10097->select(array('id', 'name')); }))->groupBy('pay_id')->selectRaw('`pay_id`,COUNT(*) as "count",SUM(`paid`) as "sum"')->get()->toArray(); $sp296935 = array(); foreach ($sp8b8475 as $sp458343) { if (isset($sp458343['pay']) && isset($sp458343['pay']['name'])) { $sp2c79c2 = $sp458343['pay']['name']; } else { $sp2c79c2 = '未知方式#' . $sp458343['pay_id']; } $sp296935[$sp2c79c2] = array((int) $sp458343['count'], (int) $sp458343['sum']); } return Response::success($sp296935); } function edit(Request $sp147552) { $this->validate($sp147552, array('id' => 'sometimes|integer', 'name' => 'required|string', 'driver' => 'required|string', 'way' => 'required|string', 'config' => 'required|string', 'fee_system' => 'required|numeric')); $spf93c32 = \App\Pay::find((int) $sp147552->post('id')); if (!$spf93c32) { $spf93c32 = new \App\Pay(); } $spf93c32->name = $sp147552->post('name'); $spf93c32->comment = $sp147552->post('comment'); $spf93c32->driver = $sp147552->post('driver'); $spf93c32->way = $sp147552->post('way'); $spf93c32->config = $sp147552->post('config'); $spf93c32->enabled = (int) $sp147552->post('enabled'); $spf93c32->fee_system = $sp147552->post('fee_system'); $spf93c32->saveOrFail(); return Response::success(); } function comment(Request $sp147552) { $this->validate($sp147552, array('id' => 'required|integer')); $speb3ceb = (int) $sp147552->post('id'); $spf93c32 = \App\Pay::findOrFail($speb3ceb); $spf93c32->comment = $sp147552->post('comment'); $spf93c32->save(); return Response::success(); } function fee_system(Request $sp147552) { $this->validate($sp147552, array('id' => 'required|integer')); $speb3ceb = (int) $sp147552->post('id'); $spf93c32 = \App\Pay::findOrFail($speb3ceb); $spf93c32->fee_system = $sp147552->post('fee_system'); $spf93c32->saveOrFail(); return Response::success(); } function enable(Request $sp147552) { $this->validate($sp147552, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $sp548f2b = $sp147552->post('ids'); $sp23f506 = (int) $sp147552->post('enabled'); \App\Pay::whereIn('id', explode(',', $sp548f2b))->update(array('enabled' => $sp23f506)); \App\Pay::flushCache(); return Response::success(); } function delete(Request $sp147552) { $this->validate($sp147552, array('ids' => 'required|string')); $sp548f2b = $sp147552->post('ids'); \App\Pay::whereIn('id', explode(',', $sp548f2b))->delete(); \App\Pay::flushCache(); return Response::success(); } } \ No newline at end of file +namespace App\Http\Controllers\Admin; use App\Library\Helper; use Carbon\Carbon; use function foo\func; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Library\Response; class Pay extends Controller { function get(Request $sp26e527) { $spcfdf85 = \App\Pay::query(); $spc9cacd = $sp26e527->input('enabled'); if (strlen($spc9cacd)) { $spcfdf85->whereIn('enabled', explode(',', $spc9cacd)); } $sp78cca0 = $sp26e527->input('search', false); $sp79e569 = $sp26e527->input('val', false); if ($sp78cca0 && $sp79e569) { if ($sp78cca0 == 'simple') { return Response::success($spcfdf85->get(array('id', 'name', 'enabled', 'comment'))); } elseif ($sp78cca0 == 'id') { $spcfdf85->where('id', $sp79e569); } else { $spcfdf85->where($sp78cca0, 'like', '%' . $sp79e569 . '%'); } } $spccc256 = $spcfdf85->get(); return Response::success(array('list' => $spccc256, 'urls' => array('url' => config('app.url'), 'url_api' => config('app.url_api')))); } function stat(Request $sp26e527) { $this->validate($sp26e527, array('day' => 'required|integer|between:1,30')); $spc9ad9e = (int) $sp26e527->input('day'); if ($spc9ad9e === 30) { $sp6bf7ca = Carbon::now()->addMonths(-1)->toDateString() . ' 00:00:00'; } else { $sp6bf7ca = Carbon::now()->addDays(-$spc9ad9e)->toDateString() . ' 00:00:00'; } $spccc256 = $this->authQuery($sp26e527, \App\Order::class)->where(function ($spcfdf85) { $spcfdf85->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', $sp6bf7ca)->with(array('pay' => function ($spcfdf85) { $spcfdf85->select(array('id', 'name')); }))->groupBy('pay_id')->selectRaw('`pay_id`,COUNT(*) as "count",SUM(`paid`) as "sum"')->get()->toArray(); $spa87332 = array(); foreach ($spccc256 as $sp9c771b) { if (isset($sp9c771b['pay']) && isset($sp9c771b['pay']['name'])) { $spd74535 = $sp9c771b['pay']['name']; } else { $spd74535 = '未知方式#' . $sp9c771b['pay_id']; } $spa87332[$spd74535] = array((int) $sp9c771b['count'], (int) $sp9c771b['sum']); } return Response::success($spa87332); } function edit(Request $sp26e527) { $this->validate($sp26e527, array('id' => 'sometimes|integer', 'name' => 'required|string', 'driver' => 'required|string', 'way' => 'required|string', 'config' => 'required|string', 'fee_system' => 'required|numeric')); $spade156 = \App\Pay::find((int) $sp26e527->post('id')); if (!$spade156) { $spade156 = new \App\Pay(); } $spade156->name = $sp26e527->post('name'); $spade156->comment = $sp26e527->post('comment'); $spade156->driver = $sp26e527->post('driver'); $spade156->way = $sp26e527->post('way'); $spade156->config = $sp26e527->post('config'); $spade156->enabled = (int) $sp26e527->post('enabled'); $spade156->fee_system = $sp26e527->post('fee_system'); $spade156->saveOrFail(); return Response::success(); } function comment(Request $sp26e527) { $this->validate($sp26e527, array('id' => 'required|integer')); $sp138835 = (int) $sp26e527->post('id'); $spade156 = \App\Pay::findOrFail($sp138835); $spade156->comment = $sp26e527->post('comment'); $spade156->save(); return Response::success(); } function fee_system(Request $sp26e527) { $this->validate($sp26e527, array('id' => 'required|integer')); $sp138835 = (int) $sp26e527->post('id'); $spade156 = \App\Pay::findOrFail($sp138835); $spade156->fee_system = $sp26e527->post('fee_system'); $spade156->saveOrFail(); return Response::success(); } function enable(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $sp892962 = $sp26e527->post('ids'); $spc9cacd = (int) $sp26e527->post('enabled'); \App\Pay::whereIn('id', explode(',', $sp892962))->update(array('enabled' => $spc9cacd)); \App\Pay::flushCache(); return Response::success(); } function delete(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string')); $sp892962 = $sp26e527->post('ids'); \App\Pay::whereIn('id', explode(',', $sp892962))->delete(); \App\Pay::flushCache(); return Response::success(); } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/PayWay.php b/app/Http/Controllers/Admin/PayWay.php index 9d862f429..6e669c0fb 100644 --- a/app/Http/Controllers/Admin/PayWay.php +++ b/app/Http/Controllers/Admin/PayWay.php @@ -1,2 +1,2 @@ input('current_page', 1); $sp11fa7d = (int) $sp147552->input('per_page', 20); $spd10097 = \App\PayWay::orderBy('sort')->where('type', $sp147552->input('type')); $spa1f2d3 = $sp147552->input('search', false); $spa55e11 = $sp147552->input('val', false); if ($spa1f2d3 && $spa55e11) { if ($spa1f2d3 == 'simple') { return Response::success($spd10097->get(array('id', 'name'))); } elseif ($spa1f2d3 == 'id') { $spd10097->where('id', $spa55e11); } else { $spd10097->where($spa1f2d3, 'like', '%' . $spa55e11 . '%'); } } $sp23f506 = $sp147552->input('enabled'); if (strlen($sp23f506)) { $spd10097->whereIn('enabled', explode(',', $sp23f506)); } $sp8b8475 = $spd10097->paginate($sp11fa7d, array('*'), 'page', $sp95caec); return Response::success($sp8b8475); } function edit(Request $sp147552) { $this->validate($sp147552, array('id' => 'required|integer', 'type' => 'required|integer|between:1,2', 'name' => 'required|string', 'sort' => 'required|integer', 'channels' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $speb3ceb = (int) $sp147552->post('id'); $sp0de38e = \App\PayWay::find($speb3ceb); if (!$sp0de38e) { if (\App\PayWay::where('name', $sp147552->post('name'))->exists()) { return Response::fail('名称已经存在'); } $sp0de38e = new \App\PayWay(); } else { if (\App\PayWay::where('name', $sp147552->post('name'))->where('id', '!=', $sp0de38e->id)->exists()) { return Response::fail('名称已经存在'); } } $sp0de38e->type = (int) $sp147552->post('type'); $sp0de38e->name = $sp147552->post('name'); $sp0de38e->sort = (int) $sp147552->post('sort'); $sp0de38e->img = $sp147552->post('img'); $sp0de38e->channels = @json_decode($sp147552->post('channels')) ?? array(); $sp0de38e->comment = $sp147552->post('comment'); $sp0de38e->enabled = (int) $sp147552->post('enabled'); $sp0de38e->saveOrFail(); return Response::success(); } function enable(Request $sp147552) { $this->validate($sp147552, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $sp548f2b = $sp147552->post('ids'); $sp23f506 = (int) $sp147552->post('enabled'); \App\PayWay::whereIn('id', explode(',', $sp548f2b))->update(array('enabled' => $sp23f506)); return Response::success(); } function sort(Request $sp147552) { $this->validate($sp147552, array('id' => 'required|integer')); $speb3ceb = (int) $sp147552->post('id'); $sp0de38e = \App\PayWay::findOrFail($speb3ceb); $sp0de38e->sort = (int) $sp147552->post('sort'); $sp0de38e->save(); return Response::success(); } function delete(Request $sp147552) { $this->validate($sp147552, array('ids' => 'required|string')); $sp548f2b = $sp147552->post('ids'); \App\PayWay::whereIn('id', explode(',', $sp548f2b))->delete(); return Response::success(); } } \ No newline at end of file +namespace App\Http\Controllers\Admin; use App\Library\Response; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class PayWay extends Controller { function get(Request $sp26e527) { $sp81cf40 = (int) $sp26e527->input('current_page', 1); $sp8de1f1 = (int) $sp26e527->input('per_page', 20); $spcfdf85 = \App\PayWay::orderBy('sort')->where('type', $sp26e527->input('type')); $sp78cca0 = $sp26e527->input('search', false); $sp79e569 = $sp26e527->input('val', false); if ($sp78cca0 && $sp79e569) { if ($sp78cca0 == 'simple') { return Response::success($spcfdf85->get(array('id', 'name'))); } elseif ($sp78cca0 == 'id') { $spcfdf85->where('id', $sp79e569); } else { $spcfdf85->where($sp78cca0, 'like', '%' . $sp79e569 . '%'); } } $spc9cacd = $sp26e527->input('enabled'); if (strlen($spc9cacd)) { $spcfdf85->whereIn('enabled', explode(',', $spc9cacd)); } $spccc256 = $spcfdf85->paginate($sp8de1f1, array('*'), 'page', $sp81cf40); return Response::success($spccc256); } function edit(Request $sp26e527) { $this->validate($sp26e527, array('id' => 'required|integer', 'type' => 'required|integer|between:1,2', 'name' => 'required|string', 'sort' => 'required|integer', 'channels' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $sp138835 = (int) $sp26e527->post('id'); $spe11c68 = \App\PayWay::find($sp138835); if (!$spe11c68) { if (\App\PayWay::where('name', $sp26e527->post('name'))->exists()) { return Response::fail('名称已经存在'); } $spe11c68 = new \App\PayWay(); } else { if (\App\PayWay::where('name', $sp26e527->post('name'))->where('id', '!=', $spe11c68->id)->exists()) { return Response::fail('名称已经存在'); } } $spe11c68->type = (int) $sp26e527->post('type'); $spe11c68->name = $sp26e527->post('name'); $spe11c68->sort = (int) $sp26e527->post('sort'); $spe11c68->img = $sp26e527->post('img'); $spe11c68->channels = @json_decode($sp26e527->post('channels')) ?? array(); $spe11c68->comment = $sp26e527->post('comment'); $spe11c68->enabled = (int) $sp26e527->post('enabled'); $spe11c68->saveOrFail(); return Response::success(); } function enable(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $sp892962 = $sp26e527->post('ids'); $spc9cacd = (int) $sp26e527->post('enabled'); \App\PayWay::whereIn('id', explode(',', $sp892962))->update(array('enabled' => $spc9cacd)); return Response::success(); } function sort(Request $sp26e527) { $this->validate($sp26e527, array('id' => 'required|integer')); $sp138835 = (int) $sp26e527->post('id'); $spe11c68 = \App\PayWay::findOrFail($sp138835); $spe11c68->sort = (int) $sp26e527->post('sort'); $spe11c68->save(); return Response::success(); } function delete(Request $sp26e527) { $this->validate($sp26e527, array('ids' => 'required|string')); $sp892962 = $sp26e527->post('ids'); \App\PayWay::whereIn('id', explode(',', $sp892962))->delete(); return Response::success(); } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/System.php b/app/Http/Controllers/Admin/System.php index 432a331d7..e7a5b6dcb 100644 --- a/app/Http/Controllers/Admin/System.php +++ b/app/Http/Controllers/Admin/System.php @@ -1,2 +1,2 @@ has($sp1a236c)) { \App\System::_set($sp1a236c, $sp147552->post($sp1a236c)); } } } private function setMoney(Request $sp147552, $spc64389) { foreach ($spc64389 as $sp1a236c) { if ($sp147552->has($sp1a236c)) { \App\System::_set($sp1a236c, (int) round($sp147552->post($sp1a236c) * 100)); } } } private function setInt(Request $sp147552, $spc64389) { foreach ($spc64389 as $sp1a236c) { if ($sp147552->has($sp1a236c)) { \App\System::_set($sp1a236c, (int) $sp147552->post($sp1a236c)); } } } function setItem(Request $sp147552) { $sp1a236c = $sp147552->post('name'); $sp0fe43e = $sp147552->post('value'); if (!$sp1a236c || !$sp0fe43e) { return Response::forbidden(); } \App\System::_set($sp1a236c, $sp0fe43e); return Response::success(); } function info(Request $sp147552) { $spcc49a9 = array('app_name', 'app_title', 'app_url', 'app_url_api', 'keywords', 'description', 'shop_ann', 'shop_ann_pop', 'shop_qq', 'company', 'js_tj', 'js_kf'); $spb44fbb = array('shop_inventory'); if ($sp147552->isMethod('GET')) { $spf516d3 = array(); foreach ($spcc49a9 as $sp1a236c) { $spf516d3[$sp1a236c] = \App\System::_get($sp1a236c); } foreach ($spb44fbb as $sp1a236c) { $spf516d3[$sp1a236c] = (int) \App\System::_get($sp1a236c); } return Response::success($spf516d3); } $sp556150 = array('app_url' => Helper::format_url($_POST['app_url']), 'app_url_api' => Helper::format_url($_POST['app_url_api'])); $sp147552->merge($sp556150); $this->set($sp147552, $spcc49a9); $this->setInt($sp147552, $spb44fbb); return Response::success(); } function theme(Request $sp147552) { if ($sp147552->isMethod('GET')) { \App\ShopTheme::freshList(); return Response::success(array('themes' => \App\ShopTheme::get(), 'default' => \App\ShopTheme::defaultTheme()->name)); } $sp65f321 = \App\ShopTheme::whereName($sp147552->post('shop_theme'))->firstOrFail(); \App\System::_set('shop_theme_default', $sp65f321->name); $sp65f321->config = @json_decode($sp147552->post('theme_config')) ?? array(); $sp65f321->saveOrFail(); return Response::success(); } function order(Request $sp147552) { $spc64389 = array('order_clean_unpay_open', 'order_clean_unpay_day'); if ($sp147552->isMethod('GET')) { $spf516d3 = array(); foreach ($spc64389 as $sp1a236c) { $spf516d3[$sp1a236c] = (int) \App\System::_get($sp1a236c); } return Response::success($spf516d3); } $this->setInt($sp147552, $spc64389); return Response::success(); } function vcode(Request $sp147552) { $spcc49a9 = array('vcode_driver', 'vcode_geetest_id', 'vcode_geetest_key'); $spb44fbb = array('vcode_login_admin', 'vcode_shop_buy', 'vcode_shop_search'); if ($sp147552->isMethod('GET')) { $spf516d3 = array(); foreach ($spcc49a9 as $sp1a236c) { $spf516d3[$sp1a236c] = \App\System::_get($sp1a236c); } foreach ($spb44fbb as $sp1a236c) { $spf516d3[$sp1a236c] = (int) \App\System::_get($sp1a236c); } return Response::success($spf516d3); } $this->set($sp147552, $spcc49a9); $this->setInt($sp147552, $spb44fbb); return Response::success(); } function email(Request $sp147552) { $spcc49a9 = array('mail_driver', 'mail_smtp_host', 'mail_smtp_port', 'mail_smtp_username', 'mail_smtp_password', 'mail_smtp_from_address', 'mail_smtp_from_name', 'mail_smtp_encryption', 'sendcloud_user', 'sendcloud_key'); $spb44fbb = array('mail_send_order', 'mail_send_order_use_contact'); if ($sp147552->isMethod('GET')) { $spf516d3 = array(); foreach ($spcc49a9 as $sp1a236c) { $spf516d3[$sp1a236c] = \App\System::_get($sp1a236c); } foreach ($spb44fbb as $sp1a236c) { $spf516d3[$sp1a236c] = (int) \App\System::_get($sp1a236c); } return Response::success($spf516d3); } $this->set($sp147552, $spcc49a9); $this->setInt($sp147552, $spb44fbb); return Response::success(); } function sms(Request $sp147552) { $spcc49a9 = array('sms_api_id', 'sms_api_key'); $spb44fbb = array('sms_send_order', 'sms_price'); if ($sp147552->isMethod('GET')) { $spf516d3 = array(); foreach ($spcc49a9 as $sp1a236c) { $spf516d3[$sp1a236c] = \App\System::_get($sp1a236c); } foreach ($spb44fbb as $sp1a236c) { $spf516d3[$sp1a236c] = (int) \App\System::_get($sp1a236c); } return Response::success($spf516d3); } $this->set($sp147552, $spcc49a9); $this->setInt($sp147552, $spb44fbb); return Response::success(); } function storage(Request $sp147552) { $spcc49a9 = array('storage_driver', 'storage_s3_access_key', 'storage_s3_secret_key', 'storage_s3_region', 'storage_s3_bucket', 'storage_oss_access_key', 'storage_oss_secret_key', 'storage_oss_bucket', 'storage_oss_endpoint', 'storage_oss_cdn_domain', 'storage_qiniu_domains_default', 'storage_qiniu_domains_https', 'storage_qiniu_access_key', 'storage_qiniu_secret_key', 'storage_qiniu_bucket', 'storage_qiniu_notify_url'); $spb44fbb = array('storage_oss_is_ssl', 'storage_oss_is_cname'); if ($sp147552->isMethod('GET')) { $spf516d3 = array(); foreach ($spcc49a9 as $sp1a236c) { $spf516d3[$sp1a236c] = \App\System::_get($sp1a236c); } foreach ($spb44fbb as $sp1a236c) { $spf516d3[$sp1a236c] = (int) \App\System::_get($sp1a236c); } return Response::success($spf516d3); } $this->set($sp147552, $spcc49a9); $this->set($sp147552, $spb44fbb); return Response::success(); } function emailTest(Request $sp147552) { $this->validate($sp147552, array('to' => 'required')); $sp8e4e29 = $sp147552->post('to'); try { $sp296935 = Mail::to($sp8e4e29)->send(new \App\Mail\Test()); return Response::success($sp296935); } catch (\Throwable $spbd4f27) { \App\Library\LogHelper::setLogFile('mail'); \Log::error('Mail Test Exception:' . $spbd4f27->getMessage()); return Response::fail($spbd4f27->getMessage(), $spbd4f27); } } function orderClean(Request $sp147552) { $this->validate($sp147552, array('day' => 'required|integer|min:1')); $sp66f4c4 = (int) $sp147552->post('day'); \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new \Carbon\Carbon())->addDays(-$sp66f4c4))->delete(); return Response::success(); } } \ No newline at end of file +namespace App\Http\Controllers\Admin; use App\Library\Helper; use App\Library\Response; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Mail; class System extends Controller { private function set(Request $sp26e527, $sp440f25) { foreach ($sp440f25 as $sp2dce9c) { if ($sp26e527->has($sp2dce9c)) { \App\System::_set($sp2dce9c, $sp26e527->post($sp2dce9c)); } } } private function setMoney(Request $sp26e527, $sp440f25) { foreach ($sp440f25 as $sp2dce9c) { if ($sp26e527->has($sp2dce9c)) { \App\System::_set($sp2dce9c, (int) round($sp26e527->post($sp2dce9c) * 100)); } } } private function setInt(Request $sp26e527, $sp440f25) { foreach ($sp440f25 as $sp2dce9c) { if ($sp26e527->has($sp2dce9c)) { \App\System::_set($sp2dce9c, (int) $sp26e527->post($sp2dce9c)); } } } function setItem(Request $sp26e527) { $sp2dce9c = $sp26e527->post('name'); $sp1e3ccc = $sp26e527->post('value'); if (!$sp2dce9c || !$sp1e3ccc) { return Response::forbidden(); } \App\System::_set($sp2dce9c, $sp1e3ccc); return Response::success(); } function info(Request $sp26e527) { $sp96ba77 = array('app_name', 'app_title', 'app_url', 'app_url_api', 'keywords', 'description', 'shop_ann', 'shop_ann_pop', 'shop_qq', 'company', 'js_tj', 'js_kf'); $sp6ca843 = array('shop_inventory'); if ($sp26e527->isMethod('GET')) { $sp799f04 = array(); foreach ($sp96ba77 as $sp2dce9c) { $sp799f04[$sp2dce9c] = \App\System::_get($sp2dce9c); } foreach ($sp6ca843 as $sp2dce9c) { $sp799f04[$sp2dce9c] = (int) \App\System::_get($sp2dce9c); } return Response::success($sp799f04); } $sp69c1d6 = array('app_url' => Helper::format_url($_POST['app_url']), 'app_url_api' => Helper::format_url($_POST['app_url_api'])); $sp26e527->merge($sp69c1d6); $this->set($sp26e527, $sp96ba77); $this->setInt($sp26e527, $sp6ca843); return Response::success(); } function theme(Request $sp26e527) { if ($sp26e527->isMethod('GET')) { \App\ShopTheme::freshList(); return Response::success(array('themes' => \App\ShopTheme::get(), 'default' => \App\ShopTheme::defaultTheme()->name)); } $sp8f385e = \App\ShopTheme::whereName($sp26e527->post('shop_theme'))->firstOrFail(); \App\System::_set('shop_theme_default', $sp8f385e->name); $sp8f385e->config = @json_decode($sp26e527->post('theme_config')) ?? array(); $sp8f385e->saveOrFail(); return Response::success(); } function order(Request $sp26e527) { $sp440f25 = array('order_clean_unpay_open', 'order_clean_unpay_day'); if ($sp26e527->isMethod('GET')) { $sp799f04 = array(); foreach ($sp440f25 as $sp2dce9c) { $sp799f04[$sp2dce9c] = (int) \App\System::_get($sp2dce9c); } return Response::success($sp799f04); } $this->setInt($sp26e527, $sp440f25); return Response::success(); } function vcode(Request $sp26e527) { $sp96ba77 = array('vcode_driver', 'vcode_geetest_id', 'vcode_geetest_key'); $sp6ca843 = array('vcode_login_admin', 'vcode_shop_buy', 'vcode_shop_search'); if ($sp26e527->isMethod('GET')) { $sp799f04 = array(); foreach ($sp96ba77 as $sp2dce9c) { $sp799f04[$sp2dce9c] = \App\System::_get($sp2dce9c); } foreach ($sp6ca843 as $sp2dce9c) { $sp799f04[$sp2dce9c] = (int) \App\System::_get($sp2dce9c); } return Response::success($sp799f04); } $this->set($sp26e527, $sp96ba77); $this->setInt($sp26e527, $sp6ca843); return Response::success(); } function email(Request $sp26e527) { $sp96ba77 = array('mail_driver', 'mail_smtp_host', 'mail_smtp_port', 'mail_smtp_username', 'mail_smtp_password', 'mail_smtp_from_address', 'mail_smtp_from_name', 'mail_smtp_encryption', 'sendcloud_user', 'sendcloud_key'); $sp6ca843 = array('mail_send_order', 'mail_send_order_use_contact'); if ($sp26e527->isMethod('GET')) { $sp799f04 = array(); foreach ($sp96ba77 as $sp2dce9c) { $sp799f04[$sp2dce9c] = \App\System::_get($sp2dce9c); } foreach ($sp6ca843 as $sp2dce9c) { $sp799f04[$sp2dce9c] = (int) \App\System::_get($sp2dce9c); } return Response::success($sp799f04); } $this->set($sp26e527, $sp96ba77); $this->setInt($sp26e527, $sp6ca843); return Response::success(); } function sms(Request $sp26e527) { $sp96ba77 = array('sms_api_id', 'sms_api_key'); $sp6ca843 = array('sms_send_order', 'sms_price'); if ($sp26e527->isMethod('GET')) { $sp799f04 = array(); foreach ($sp96ba77 as $sp2dce9c) { $sp799f04[$sp2dce9c] = \App\System::_get($sp2dce9c); } foreach ($sp6ca843 as $sp2dce9c) { $sp799f04[$sp2dce9c] = (int) \App\System::_get($sp2dce9c); } return Response::success($sp799f04); } $this->set($sp26e527, $sp96ba77); $this->setInt($sp26e527, $sp6ca843); return Response::success(); } function storage(Request $sp26e527) { $sp96ba77 = array('storage_driver', 'storage_s3_access_key', 'storage_s3_secret_key', 'storage_s3_region', 'storage_s3_bucket', 'storage_oss_access_key', 'storage_oss_secret_key', 'storage_oss_bucket', 'storage_oss_endpoint', 'storage_oss_cdn_domain', 'storage_qiniu_domains_default', 'storage_qiniu_domains_https', 'storage_qiniu_access_key', 'storage_qiniu_secret_key', 'storage_qiniu_bucket', 'storage_qiniu_notify_url'); $sp6ca843 = array('storage_oss_is_ssl', 'storage_oss_is_cname'); if ($sp26e527->isMethod('GET')) { $sp799f04 = array(); foreach ($sp96ba77 as $sp2dce9c) { $sp799f04[$sp2dce9c] = \App\System::_get($sp2dce9c); } foreach ($sp6ca843 as $sp2dce9c) { $sp799f04[$sp2dce9c] = (int) \App\System::_get($sp2dce9c); } return Response::success($sp799f04); } $this->set($sp26e527, $sp96ba77); $this->set($sp26e527, $sp6ca843); return Response::success(); } function emailTest(Request $sp26e527) { $this->validate($sp26e527, array('to' => 'required')); $sp837c4b = $sp26e527->post('to'); try { $spa87332 = Mail::to($sp837c4b)->send(new \App\Mail\Test()); return Response::success($spa87332); } catch (\Throwable $sp7900a2) { \App\Library\LogHelper::setLogFile('mail'); \Log::error('Mail Test Exception:' . $sp7900a2->getMessage()); return Response::fail($sp7900a2->getMessage(), $sp7900a2); } } function orderClean(Request $sp26e527) { $this->validate($sp26e527, array('day' => 'required|integer|min:1')); $spc9ad9e = (int) $sp26e527->post('day'); \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new \Carbon\Carbon())->addDays(-$spc9ad9e))->delete(); return Response::success(); } } \ No newline at end of file diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index f15b82d51..1842f438c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -1,2 +1,2 @@ validate($sp147552, array('email' => 'required|email', 'password' => 'required|string')); if (System::_getInt('vcode_login_admin') === 1) { $this->validateCaptcha($sp147552); } if ($this->hasTooManyLoginAttempts($sp147552)) { $this->fireLockoutEvent($sp147552); $sp1ec7b6 = $this->limiter()->availableIn($this->throttleKey($sp147552)); return response(array('message' => trans('auth.throttle', array('seconds' => $sp1ec7b6))), Response::HTTP_BAD_REQUEST); } if ($sp74ce9f = Auth::attempt($sp147552->only('email', 'password'))) { $spe2c9ac = Auth::getUser(); $sp012164 = Helper::getIP() ?? $sp147552->ip(); $spe2c9ac->logs()->create(array('action' => \App\Log::ACTION_LOGIN, 'ip' => $sp012164, 'address' => (new QQWry())->getLocation($sp012164))); return response($this->getUserInfo()->getContent(), Response::HTTP_CREATED, array('Authorization' => 'Bearer ' . $sp74ce9f)); } LOGIN_FAILED: $this->incrementLoginAttempts($sp147552); return response(array('message' => trans('auth.failed')), Response::HTTP_BAD_REQUEST); } public function getUserInfo() { $spe2c9ac = Auth::getUser(); $spe2c9ac->addHidden(array('created_at', 'updated_at')); $spe2c9ac->append(array('last_login_at')); $spe2c9ac->setAttribute('shop_name', config('app.name')); $sp014e61 = array(); $sp014e61['user'] = $spe2c9ac; return response($sp014e61); } public function logout() { try { @Auth::logout(); } catch (\Throwable $spbd4f27) { } return response(array()); } } \ No newline at end of file +namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Library\Helper; use App\Library\QQWry\QQWry; use App\Library\WeChat; use App\System; use Illuminate\Http\Request; use Illuminate\Foundation\Auth\ThrottlesLogins; use Illuminate\Http\Response; use Illuminate\Support\Facades\Auth; class LoginController extends Controller { use ThrottlesLogins; protected function username() { return 'email'; } public function login(Request $sp26e527) { $this->validate($sp26e527, array('email' => 'required|email', 'password' => 'required|string')); if (System::_getInt('vcode_login_admin') === 1) { $this->validateCaptcha($sp26e527); } if ($this->hasTooManyLoginAttempts($sp26e527)) { $this->fireLockoutEvent($sp26e527); $sp0ab0ca = $this->limiter()->availableIn($this->throttleKey($sp26e527)); return response(array('message' => trans('auth.throttle', array('seconds' => $sp0ab0ca))), Response::HTTP_BAD_REQUEST); } if ($spce7aba = Auth::attempt($sp26e527->only('email', 'password'))) { $sp590011 = Auth::getUser(); $sp350e6d = Helper::getIP() ?? $sp26e527->ip(); $sp590011->logs()->create(array('action' => \App\Log::ACTION_LOGIN, 'ip' => $sp350e6d, 'address' => (new QQWry())->getLocation($sp350e6d))); return response($this->getUserInfo()->getContent(), Response::HTTP_CREATED, array('Authorization' => 'Bearer ' . $spce7aba)); } LOGIN_FAILED: $this->incrementLoginAttempts($sp26e527); return response(array('message' => trans('auth.failed')), Response::HTTP_BAD_REQUEST); } public function getUserInfo() { $sp590011 = Auth::getUser(); $sp590011->addHidden(array('created_at', 'updated_at')); $sp590011->append(array('last_login_at')); $sp590011->setAttribute('shop_name', config('app.name')); $sp7c95a4 = array(); $sp7c95a4['user'] = $sp590011; return response($sp7c95a4); } public function logout() { try { @Auth::logout(); } catch (\Throwable $sp7900a2) { } return response(array()); } } \ No newline at end of file diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 75e66d36e..5e5c98318 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -1,2 +1,2 @@ validate($sp147552, array('token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6')); $sp014e61 = Password::broker()->reset($sp147552->only('email', 'password', 'password_confirmation', 'token'), function ($spe2c9ac, $sp27b440) { $this->resetPassword($spe2c9ac, $sp27b440); }); return $sp014e61 == Password::PASSWORD_RESET ? response(array()) : response(array('message' => trans($sp014e61)), 400); } public function change(Request $sp147552) { $this->validate($sp147552, array('old' => 'required|string', 'password' => 'required|string|min:6|max:32|confirmed')); $spe2c9ac = Auth::user(); if (!Hash::check($sp147552->post('old'), $spe2c9ac->password)) { return response(array('message' => '旧密码错误,请检查'), Response::HTTP_BAD_REQUEST); } $sp74ce9f = $this->resetPassword($spe2c9ac, $sp147552->post('password')); return response(array(), 200, array('Authorization' => 'Bearer ' . $sp74ce9f)); } public static function resetPassword($spe2c9ac, $sp27b440, $spbb50ca = true) { $spe2c9ac->password = Hash::make($sp27b440); $spe2c9ac->setRememberToken(time()); $spe2c9ac->saveOrFail(); event(new PasswordReset($spe2c9ac)); if ($spbb50ca) { return Auth::login($spe2c9ac); } else { return true; } } } \ No newline at end of file +namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Auth\Events\PasswordReset; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Password; class ResetPasswordController extends Controller { public function reset(Request $sp26e527) { $this->validate($sp26e527, array('token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6')); $sp7c95a4 = Password::broker()->reset($sp26e527->only('email', 'password', 'password_confirmation', 'token'), function ($sp590011, $sp4b3985) { $this->resetPassword($sp590011, $sp4b3985); }); return $sp7c95a4 == Password::PASSWORD_RESET ? response(array()) : response(array('message' => trans($sp7c95a4)), 400); } public function change(Request $sp26e527) { $this->validate($sp26e527, array('old' => 'required|string', 'password' => 'required|string|min:6|max:32|confirmed')); $sp590011 = Auth::user(); if (!Hash::check($sp26e527->post('old'), $sp590011->password)) { return response(array('message' => '旧密码错误,请检查'), Response::HTTP_BAD_REQUEST); } $spce7aba = $this->resetPassword($sp590011, $sp26e527->post('password')); return response(array(), 200, array('Authorization' => 'Bearer ' . $spce7aba)); } public static function resetPassword($sp590011, $sp4b3985, $sp4b0ea9 = true) { $sp590011->password = Hash::make($sp4b3985); $sp590011->setRememberToken(time()); $sp590011->saveOrFail(); event(new PasswordReset($sp590011)); if ($sp4b0ea9) { return Auth::login($sp590011); } else { return true; } } } \ No newline at end of file diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 639eb98be..e22f1c21a 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,2 +1,2 @@ validate($sp147552, array('captcha.key' => 'required|string', 'captcha.code' => 'required|captcha_api:' . $sp147552->input('captcha.key'))); } elseif ($sp95374a === 'geetest') { $this->validate($sp147552, array('captcha.a' => 'required|string', 'captcha.b' => 'required|string', 'captcha.c' => 'required|string', 'captcha.d' => 'required|string')); if (!Geetest\API::verify($sp147552->input('captcha.a'), $sp147552->input('captcha.b'), $sp147552->input('captcha.c'), $sp147552->input('captcha.d'))) { throw \Illuminate\Validation\ValidationException::withMessages(array('captcha' => array(trans('validation.captcha')))); } } elseif ($sp95374a === 'recaptcha') { $this->validate($sp147552, array('captcha.t' => 'required|string')); } } function authQuery(Request $sp147552, $sp5d7293, $sp501f47 = 'user_id', $spbf7bf3 = 'user_id') { return $sp5d7293::where($sp501f47, \Auth::id()); } protected function getUserId(Request $sp147552, $spbf7bf3 = 'user_id') { return \Auth::id(); } protected function getUserIdOrFail(Request $sp147552, $spbf7bf3 = 'user_id') { $spa27b73 = self::getUserId($sp147552, $spbf7bf3); if ($spa27b73) { return $spa27b73; } else { throw new \Exception('参数缺少 ' . $spbf7bf3); } } protected function getUser(Request $sp147552) { return \Auth::getUser(); } protected function checkIsInMaintain() { if (System::_getInt('maintain') === 1) { $sp961ba4 = System::_get('maintain_info'); echo view('message', array('title' => '维护中', 'message' => $sp961ba4)); die; } } protected function msg($sp4e57b0, $sp8694df = null, $sp4611be = null) { return view('message', array('message' => $sp4e57b0, 'title' => $sp8694df, 'exception' => $sp4611be)); } } \ No newline at end of file +namespace App\Http\Controllers; use App\System; use App\Library\Geetest; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Http\Response; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; public function getCaptcha() { $spafe885 = System::_get('vcode_driver'); if ($spafe885 === 'code') { return response(array()); } elseif ($spafe885 === 'geetest') { return response(Geetest\API::get()); } elseif ($spafe885 === 'recaptcha') { } return response(array(), Response::HTTP_NOT_IMPLEMENTED); } function validateCaptcha(Request $sp26e527) { $spafe885 = System::_get('vcode_driver'); if ($spafe885 === 'code') { $this->validate($sp26e527, array('captcha.key' => 'required|string', 'captcha.code' => 'required|captcha_api:' . $sp26e527->input('captcha.key'))); } elseif ($spafe885 === 'geetest') { $this->validate($sp26e527, array('captcha.a' => 'required|string', 'captcha.b' => 'required|string', 'captcha.c' => 'required|string', 'captcha.d' => 'required|string')); if (!Geetest\API::verify($sp26e527->input('captcha.a'), $sp26e527->input('captcha.b'), $sp26e527->input('captcha.c'), $sp26e527->input('captcha.d'))) { throw \Illuminate\Validation\ValidationException::withMessages(array('captcha' => array(trans('validation.captcha')))); } } elseif ($spafe885 === 'recaptcha') { $this->validate($sp26e527, array('captcha.t' => 'required|string')); } } function authQuery(Request $sp26e527, $spcc5caa, $sp470feb = 'user_id', $spbeb4af = 'user_id') { return $spcc5caa::where($sp470feb, \Auth::id()); } protected function getUserId(Request $sp26e527, $spbeb4af = 'user_id') { return \Auth::id(); } protected function getUserIdOrFail(Request $sp26e527, $spbeb4af = 'user_id') { $sp699450 = self::getUserId($sp26e527, $spbeb4af); if ($sp699450) { return $sp699450; } else { throw new \Exception('参数缺少 ' . $spbeb4af); } } protected function getUser(Request $sp26e527) { return \Auth::getUser(); } protected function checkIsInMaintain() { if (System::_getInt('maintain') === 1) { $spad87ef = System::_get('maintain_info'); echo view('message', array('title' => '维护中', 'message' => $spad87ef)); die; } } protected function msg($spdbd7f3, $sp808668 = null, $spa85eb9 = null) { return view('message', array('message' => $spdbd7f3, 'title' => $sp808668, 'exception' => $spa85eb9)); } } \ No newline at end of file diff --git a/app/Http/Controllers/DevController.php b/app/Http/Controllers/DevController.php index fd6ca930b..a587c6724 100644 --- a/app/Http/Controllers/DevController.php +++ b/app/Http/Controllers/DevController.php @@ -1,2 +1,2 @@ R
'; return true; } else { echo $sp303e6e . ' ...... R
'; return false; } } else { if (file_exists($sp303e6e)) { return is_readable($sp303e6e); } } echo $sp303e6e . ' ...... 文件不存在
'; return false; } private function check_writable_r($sp303e6e) { if (is_dir($sp303e6e)) { if (is_writable($sp303e6e)) { $spc6313b = scandir($sp303e6e); foreach ($spc6313b as $sp8f76bb) { if ($sp8f76bb != '.' && $sp8f76bb != '..') { if (!self::check_writable_r($sp303e6e . '/' . $sp8f76bb)) { return false; } else { continue; } } } echo $sp303e6e . ' ...... W
'; return true; } else { echo $sp303e6e . ' ...... W
'; return false; } } else { if (file_exists($sp303e6e)) { return is_writable($sp303e6e); } } echo $sp303e6e . ' ...... 文件不存在
'; return false; } private function checkPathPermission($sp2b7370) { self::check_readable_r($sp2b7370); self::check_writable_r($sp2b7370); } public function install() { $spcd9e7f = array(); @ob_start(); self::checkPathPermission(base_path('storage')); self::checkPathPermission(base_path('bootstrap/cache')); $spcd9e7f['permission'] = @ob_get_clean(); return view('install', array('var' => $spcd9e7f)); } public function test(Request $sp147552) { } } \ No newline at end of file +namespace App\Http\Controllers; use App\System; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; class DevController extends Controller { private function check_readable_r($sp0e3884) { if (is_dir($sp0e3884)) { if (is_readable($sp0e3884)) { $sp968ada = scandir($sp0e3884); foreach ($sp968ada as $spe5d678) { if ($spe5d678 != '.' && $spe5d678 != '..') { if (!self::check_readable_r($sp0e3884 . '/' . $spe5d678)) { return false; } else { continue; } } } echo $sp0e3884 . ' ...... R
'; return true; } else { echo $sp0e3884 . ' ...... R
'; return false; } } else { if (file_exists($sp0e3884)) { return is_readable($sp0e3884); } } echo $sp0e3884 . ' ...... 文件不存在
'; return false; } private function check_writable_r($sp0e3884) { if (is_dir($sp0e3884)) { if (is_writable($sp0e3884)) { $sp968ada = scandir($sp0e3884); foreach ($sp968ada as $spe5d678) { if ($spe5d678 != '.' && $spe5d678 != '..') { if (!self::check_writable_r($sp0e3884 . '/' . $spe5d678)) { return false; } else { continue; } } } echo $sp0e3884 . ' ...... W
'; return true; } else { echo $sp0e3884 . ' ...... W
'; return false; } } else { if (file_exists($sp0e3884)) { return is_writable($sp0e3884); } } echo $sp0e3884 . ' ...... 文件不存在
'; return false; } private function checkPathPermission($sp618c15) { self::check_readable_r($sp618c15); self::check_writable_r($sp618c15); } public function install() { $sp31c259 = array(); @ob_start(); self::checkPathPermission(base_path('storage')); self::checkPathPermission(base_path('bootstrap/cache')); $sp31c259['permission'] = @ob_get_clean(); return view('install', array('var' => $sp31c259)); } public function test(Request $sp26e527) { } } \ No newline at end of file diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index a855344c2..37ad1e1bb 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -1,6 +1,6 @@ config('app.url'), 'company' => config('app.company'), 'name' => config('app.name'), 'logo' => config('app.logo'), 'functions' => array()); if (System::_getInt('product_manual')) { $spf516d3['functions'][] = 'product_manual'; } if (System::_getInt('mail_send_order')) { $spf516d3['functions'][] = 'mail_send_order'; if (System::_getInt('mail_send_order_use_contact')) { $spf516d3['functions'][] = 'mail_send_order_use_contact'; } } if (System::_getInt('sms_send_order')) { $spf516d3['functions'][] = 'sms_send_order'; $spf516d3['sms_send_order'] = array('sms_price' => System::_getInt('sms_price')); } $spf516d3['captcha'] = array('driver' => System::_get('vcode_driver'), 'config' => array(), 'scene' => array('shop' => array('buy' => System::_getInt('vcode_shop_buy'), 'search' => System::_getInt('vcode_shop_search')))); $sp4bdf4a = Cookie::get('customer'); $sp34cd44 = Cookie::make('customer', strlen($sp4bdf4a) !== 32 ? md5(str_random(16)) : $sp4bdf4a, 43200, null, null, false, false); $sp65f321 = null; if (isset($_GET['theme'])) { $sp65f321 = \App\ShopTheme::whereName($_GET['theme'])->first(); } if ($spe2c9ac) { $spf516d3['shop'] = array('name' => config('app.name'), 'qq' => System::_get('shop_qq'), 'ann' => System::_get('shop_ann'), 'ann_pop' => System::_get('shop_ann_pop'), 'inventory' => System::_getInt('shop_inventory')); $spa989c5 = false; if ($sp4aad76) { $sp62ae3e->setVisible(array('id', 'name', 'password_open')); if ($sp62ae3e->password_open) { $sp62ae3e->setAttribute('password', $sp62ae3e->getTmpPassword()); $sp62ae3e->addVisible(array('password')); } $sp4aad76->setForShop($spe2c9ac); $spf516d3['categories'] = array($sp62ae3e); $spf516d3['product'] = $sp4aad76; $sp1a236c = $sp4aad76->name . ' - ' . $spf516d3['name']; $spb402e7 = $sp4aad76->description; if (@$spb402e7[0] === '{') { $sp21f940 = array(); preg_match_all('/"insert":"(.+?)"/', $spb402e7, $sp21f940); $spb402e7 = str_replace('\\n', ' ', @join(' ', $sp21f940[1])); } } elseif ($sp62ae3e) { $sp62ae3e->setVisible(array('id', 'name', 'password_open')); $spf516d3['categories'] = array($sp62ae3e); $spf516d3['product'] = null; $sp1a236c = $sp62ae3e->name . ' - ' . $spf516d3['name']; $spb402e7 = $sp62ae3e->name; } else { $sp2f5b90 = Category::where('user_id', $spe2c9ac->id)->orderBy('sort')->where('enabled', 1)->get(); foreach ($sp2f5b90 as $sp62ae3e) { $sp62ae3e->setVisible(array('id', 'name', 'password_open')); } $spf516d3['categories'] = $sp2f5b90; if (config('app.name') && config('app.title')) { $sp1a236c = config('app.name') . ' - ' . config('app.title'); } else { $sp1a236c = config('app.name') ? config('app.name') : config('app.title'); } $spb402e7 = config('app.description'); $spa989c5 = config('app.keywords'); } $spf516d3['pays'] = \App\PayWay::gets($spe2c9ac, function ($spd10097) { $spd10097->where('type', \App\PayWay::TYPE_SHOP)->whereRaw('enabled&' . (Helper::is_mobile() ? \App\PayWay::ENABLED_MOBILE : \App\PayWay::ENABLED_PC) . '!=0'); }); if (!$sp65f321) { $sp65f321 = \App\ShopTheme::defaultTheme(); } $spf516d3['theme'] = $spe2c9ac->theme_config && isset($spe2c9ac->theme_config[$sp65f321->name]) ? $spe2c9ac->theme_config[$sp65f321->name] : $sp65f321->config; $spa989c5 = $spa989c5 ? $spa989c5 : preg_replace('/[、,;。!?]/', ', ', $sp1a236c); } else { throw new \Exception('不可能到这'); } if (isset($spf516d3['theme']['background']) && $spf516d3['theme']['background'] === '内置1') { $spf516d3['theme']['background'] = Helper::b1_rand_background(); } if ($spe2c9ac && $sp4aad76 === null) { if (@$spf516d3['theme']['list_type'] === 'list') { foreach ($spf516d3['categories'] as $sp6161c4) { if (!$sp6161c4->password_open) { $sp6161c4->getProductsForShop(); } } } else { if (count($spf516d3['categories']) === 1) { $sp6161c4 = $spf516d3['categories'][0]; if (!$sp6161c4->password_open) { $sp6161c4->getProductsForShop(); } } } } return response()->view('shop_theme.' . $sp65f321->name . '.index', array('name' => $sp1a236c, 'title' => config('app.title'), 'keywords' => $spa989c5, 'description' => $spb402e7, 'js_tj' => System::_get('js_tj'), 'js_kf' => System::_get('js_kf'), 'config' => $spf516d3))->cookie($sp34cd44); } public function shop_default(Request $sp147552) { $this->checkIsInMaintain(); $spa18dd9 = $sp147552->get('tab', ''); return response()->redirectTo('/?theme=Material#/record?tab=' . $spa18dd9); } private function _shop_404() { $this->checkIsInMaintain(); return view('message', array('title' => '404 NotFound', 'message' => '该链接不存在
-查询订单')); } public function shop_category($sp520f19) { $this->checkIsInMaintain(); $sp62ae3e = Category::whereId(Helper::id_decode($sp520f19, Helper::ID_TYPE_CATEGORY))->with('user')->first(); if (!$sp62ae3e && is_numeric($sp62ae3e)) { $sp62ae3e = Category::whereId($sp520f19)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with('user')->first(); } if (!$sp62ae3e) { return $this->_shop_404(); } return $this->_shop_render($sp62ae3e->user, $sp62ae3e); } public function shop_product(Request $sp147552, $spc2ecf7) { $this->checkIsInMaintain(); $sp4aad76 = Product::whereId(Helper::id_decode($spc2ecf7, Helper::ID_TYPE_PRODUCT))->with(array('user', 'category'))->first(); if (!$sp4aad76 && is_numeric($spc2ecf7)) { $sp4aad76 = Product::whereId($spc2ecf7)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with(array('user', 'category'))->first(); } if (!$sp4aad76 || !$sp4aad76->category) { return $this->_shop_404(); } if ($sp4aad76->password_open && $sp4aad76->password !== $sp147552->input('p')) { return view('message', array('title' => '当前商品需要密码', 'message' => ($sp147552->has('p') ? '密码错误,请重新输入' : '请输入商品密码') . '
+namespace App\Http\Controllers; use App\Category; use App\Library\Helper; use App\Pay; use App\Product; use App\System; use App\User; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Library\Geetest; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cookie; class HomeController extends Controller { private function _shop_render($sp590011, $sp08b465 = null, $sp222f58 = null) { $sp799f04 = array('url' => config('app.url'), 'company' => config('app.company'), 'name' => config('app.name'), 'logo' => config('app.logo'), 'functions' => array()); if (System::_getInt('product_manual')) { $sp799f04['functions'][] = 'product_manual'; } if (System::_getInt('mail_send_order')) { $sp799f04['functions'][] = 'mail_send_order'; if (System::_getInt('mail_send_order_use_contact')) { $sp799f04['functions'][] = 'mail_send_order_use_contact'; } } if (System::_getInt('sms_send_order')) { $sp799f04['functions'][] = 'sms_send_order'; $sp799f04['sms_send_order'] = array('sms_price' => System::_getInt('sms_price')); } $sp799f04['captcha'] = array('driver' => System::_get('vcode_driver'), 'config' => array(), 'scene' => array('shop' => array('buy' => System::_getInt('vcode_shop_buy'), 'search' => System::_getInt('vcode_shop_search')))); $sp5fb842 = Cookie::get('customer'); $sp75a3c7 = Cookie::make('customer', strlen($sp5fb842) !== 32 ? md5(str_random(16)) : $sp5fb842, 43200, null, null, false, false); $sp8f385e = null; if (isset($_GET['theme'])) { $sp8f385e = \App\ShopTheme::whereName($_GET['theme'])->first(); } if ($sp590011) { $sp799f04['shop'] = array('name' => config('app.name'), 'qq' => System::_get('shop_qq'), 'ann' => System::_get('shop_ann'), 'ann_pop' => System::_get('shop_ann_pop'), 'inventory' => System::_getInt('shop_inventory')); $spa37691 = false; if ($sp222f58) { $sp08b465->setVisible(array('id', 'name', 'password_open')); if ($sp08b465->password_open) { $sp08b465->setAttribute('password', $sp08b465->getTmpPassword()); $sp08b465->addVisible(array('password')); } $sp222f58->setForShop($sp590011); $sp799f04['categories'] = array($sp08b465); $sp799f04['product'] = $sp222f58; $sp2dce9c = $sp222f58->name . ' - ' . $sp799f04['name']; $sp7cb065 = $sp222f58->description; if (@$sp7cb065[0] === '{') { $sp66d84b = array(); preg_match_all('/"insert":"(.+?)"/', $sp7cb065, $sp66d84b); $sp7cb065 = str_replace('\\n', ' ', @join(' ', $sp66d84b[1])); } } elseif ($sp08b465) { $sp08b465->setVisible(array('id', 'name', 'password_open')); $sp799f04['categories'] = array($sp08b465); $sp799f04['product'] = null; $sp2dce9c = $sp08b465->name . ' - ' . $sp799f04['name']; $sp7cb065 = $sp08b465->name; } else { $sp8fc8fc = Category::where('user_id', $sp590011->id)->orderBy('sort')->where('enabled', 1)->get(); foreach ($sp8fc8fc as $sp08b465) { $sp08b465->setVisible(array('id', 'name', 'password_open')); } $sp799f04['categories'] = $sp8fc8fc; if (config('app.name') && config('app.title')) { $sp2dce9c = config('app.name') . ' - ' . config('app.title'); } else { $sp2dce9c = config('app.name') ? config('app.name') : config('app.title'); } $sp7cb065 = config('app.description'); $spa37691 = config('app.keywords'); } $sp799f04['pays'] = \App\PayWay::gets($sp590011, function ($spcfdf85) { $spcfdf85->where('type', \App\PayWay::TYPE_SHOP)->whereRaw('enabled&' . (Helper::is_mobile() ? \App\PayWay::ENABLED_MOBILE : \App\PayWay::ENABLED_PC) . '!=0'); }); if (!$sp8f385e) { $sp8f385e = \App\ShopTheme::defaultTheme(); } $sp799f04['theme'] = $sp590011->theme_config && isset($sp590011->theme_config[$sp8f385e->name]) ? $sp590011->theme_config[$sp8f385e->name] : $sp8f385e->config; $spa37691 = $spa37691 ? $spa37691 : preg_replace('/[、,;。!?]/', ', ', $sp2dce9c); } else { throw new \Exception('不可能到这'); } if (isset($sp799f04['theme']['background']) && $sp799f04['theme']['background'] === '内置1') { $sp799f04['theme']['background'] = Helper::b1_rand_background(); } if ($sp590011 && $sp222f58 === null) { if (@$sp799f04['theme']['list_type'] === 'list') { foreach ($sp799f04['categories'] as $spe137eb) { if (!$spe137eb->password_open) { $spe137eb->getProductsForShop(); } } } else { if (count($sp799f04['categories']) === 1) { $spe137eb = $sp799f04['categories'][0]; if (!$spe137eb->password_open) { $spe137eb->getProductsForShop(); } } } } return response()->view('shop_theme.' . $sp8f385e->name . '.index', array('name' => $sp2dce9c, 'title' => config('app.title'), 'keywords' => $spa37691, 'description' => $sp7cb065, 'js_tj' => System::_get('js_tj'), 'js_kf' => System::_get('js_kf'), 'config' => $sp799f04))->cookie($sp75a3c7); } public function shop_default(Request $sp26e527) { $this->checkIsInMaintain(); $sp787e69 = $sp26e527->get('tab', ''); return response()->redirectTo('/?theme=Material#/record?tab=' . $sp787e69); } private function _shop_404() { $this->checkIsInMaintain(); return view('message', array('title' => '404 NotFound', 'message' => '该链接不存在
+查询订单')); } public function shop_category($spbe1bf0) { $this->checkIsInMaintain(); $sp08b465 = Category::whereId(Helper::id_decode($spbe1bf0, Helper::ID_TYPE_CATEGORY))->with('user')->first(); if (!$sp08b465 && is_numeric($sp08b465)) { $sp08b465 = Category::whereId($spbe1bf0)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with('user')->first(); } if (!$sp08b465) { return $this->_shop_404(); } return $this->_shop_render($sp08b465->user, $sp08b465); } public function shop_product(Request $sp26e527, $sp6b2eb2) { $this->checkIsInMaintain(); $sp222f58 = Product::whereId(Helper::id_decode($sp6b2eb2, Helper::ID_TYPE_PRODUCT))->with(array('user', 'category'))->first(); if (!$sp222f58 && is_numeric($sp6b2eb2)) { $sp222f58 = Product::whereId($sp6b2eb2)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with(array('user', 'category'))->first(); } if (!$sp222f58 || !$sp222f58->category) { return $this->_shop_404(); } if ($sp222f58->password_open && $sp222f58->password !== $sp26e527->input('p')) { return view('message', array('title' => '当前商品需要密码', 'message' => ($sp26e527->has('p') ? '密码错误,请重新输入' : '请输入商品密码') . '

\ No newline at end of file + }, 10000);
\ No newline at end of file diff --git a/routes/channels.php b/routes/channels.php index d3cab3672..a9f9c3116 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -1,2 +1,2 @@ id === (int) $speb3ceb; }); \ No newline at end of file +Broadcast::channel('App.User.{id}', function ($sp590011, $sp138835) { return (int) $sp590011->id === (int) $sp138835; }); \ No newline at end of file