diff --git a/.version b/.version
index 2b154cba4..eee24ac21 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-{"version":"2.9","md5":"12be8c987fc6d46370b9de555236a28d","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/2.9\/card_release.tar.gz"}
\ No newline at end of file
+{"version":"2.9","md5":"9b0367de9ea5caf51669d612b61df9f7","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/2.9\/card_release.tar.gz"}
\ No newline at end of file
diff --git a/app/Card.php b/app/Card.php
index 004c672fb..19d108947 100644
--- a/app/Card.php
+++ b/app/Card.php
@@ -1,2 +1,2 @@
hasMany(Order::class); } function product() { return $this->belongsTo(Product::class); } public static function add_cards($spfa021e, $sp0e30a6, $sp8f5ac7, $sp7a9982, $sp62ca36, $sp518449) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spfa021e, $sp0e30a6, $sp8f5ac7, $sp7a9982, $sp62ca36, (int) $sp518449)); } public static function _trash($sp5786ca) { DB::transaction(function () use($sp5786ca) { $sp654541 = clone $sp5786ca; $sp654541->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp2300d6) { foreach ($sp2300d6 as $sp2fe3cd) { $sp71cb0c = \App\Product::where('id', $sp2fe3cd->product_id)->lockForUpdate()->first(); if ($sp71cb0c) { $sp71cb0c->count_all -= $sp2fe3cd->count_left; $sp71cb0c->saveOrFail(); } } }); $sp5786ca->delete(); return true; }); } public static function _restore($sp5786ca) { DB::transaction(function () use($sp5786ca) { $sp654541 = clone $sp5786ca; $sp654541->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp2300d6) { foreach ($sp2300d6 as $sp2fe3cd) { $sp71cb0c = \App\Product::where('id', $sp2fe3cd->product_id)->lockForUpdate()->first(); if ($sp71cb0c) { $sp71cb0c->count_all += $sp2fe3cd->count_left; $sp71cb0c->saveOrFail(); } } }); $sp5786ca->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); } public static function add_cards($sp15a746, $spbb5d29, $sp4f56c1, $sp27b58d, $spa5ca46, $spc564ba) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp15a746, $spbb5d29, $sp4f56c1, $sp27b58d, $spa5ca46, (int) $spc564ba)); } public static function _trash($sp5044a7) { DB::transaction(function () use($sp5044a7) { $spee4521 = clone $sp5044a7; $spee4521->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp2e1960) { foreach ($sp2e1960 as $sp87990b) { $sp2cf004 = \App\Product::where('id', $sp87990b->product_id)->lockForUpdate()->first(); if ($sp2cf004) { $sp2cf004->count_all -= $sp87990b->count_left; $sp2cf004->saveOrFail(); } } }); $sp5044a7->delete(); return true; }); } public static function _restore($sp5044a7) { DB::transaction(function () use($sp5044a7) { $spee4521 = clone $sp5044a7; $spee4521->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp2e1960) { foreach ($sp2e1960 as $sp87990b) { $sp2cf004 = \App\Product::where('id', $sp87990b->product_id)->lockForUpdate()->first(); if ($sp2cf004) { $sp2cf004->count_all += $sp87990b->count_left; $sp2cf004->saveOrFail(); } } }); $sp5044a7->restore(); return true; }); } }
\ No newline at end of file
diff --git a/app/Category.php b/app/Category.php
index 9a2fcf72a..f56f1b69d 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() { $sp8b05f0 = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp8b05f0 as $sp71cb0c) { $sp71cb0c->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp8b05f0); return $sp8b05f0; } }
\ 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() { $sp7c2d5f = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp7c2d5f as $sp2cf004) { $sp2cf004->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp7c2d5f); return $sp7c2d5f; } }
\ No newline at end of file
diff --git a/app/Console/Commands/ResetPassword.php b/app/Console/Commands/ResetPassword.php
index 2bb7eeba5..ca91ef2af 100644
--- a/app/Console/Commands/ResetPassword.php
+++ b/app/Console/Commands/ResetPassword.php
@@ -1,4 +1,4 @@
argument('email'); if (!$sp807378) { $this->warn('please input the user\'s email
-'); return false; } $spafa70b = \App\User::where('email', $sp807378)->first(); if (!$spafa70b) { $this->warn("can't find the user: {$sp807378} \nplease input the user's email\n"); return false; } $spb6833a = $this->argument('password'); $spafa70b->password = bcrypt($spb6833a); $spafa70b->save(); $this->info("the password of '{$sp807378}' has been set to {$spb6833a}\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() { $sp0fa228 = $this->argument('email'); if (!$sp0fa228) { $this->warn('please input the user\'s email
+'); return false; } $spbbb773 = \App\User::where('email', $sp0fa228)->first(); if (!$spbbb773) { $this->warn("can't find the user: {$sp0fa228} \nplease input the user's email\n"); return false; } $sp8f68ce = $this->argument('password'); $spbbb773->password = bcrypt($sp8f68ce); $spbbb773->save(); $this->info("the password of '{$sp0fa228}' has been set to {$sp8f68ce}\n"); return true; } }
\ No newline at end of file
diff --git a/app/Console/Commands/Update.php b/app/Console/Commands/Update.php
index e372fbc71..e82e85d0d 100644
--- a/app/Console/Commands/Update.php
+++ b/app/Console/Commands/Update.php
@@ -1,12 +1,12 @@
0) { echo '
download: ' . sprintf('%.2f', $spdd5ef1 / $sp61a3e7 * 100) . '%'; } }); curl_setopt($sp9b0943, CURLOPT_NOPROGRESS, false); curl_setopt($sp9b0943, CURLOPT_HEADER, 0); curl_setopt($sp9b0943, CURLOPT_USERAGENT, 'card update'); curl_exec($sp9b0943); curl_close($sp9b0943); echo '
-'; return true; } public function handle() { set_time_limit(0); $sp57f18d = $this->option('proxy'); if (!empty($sp57f18d)) { define('MY_PROXY', $sp57f18d); } $spc34df8 = $this->option('proxy-auth'); if (!empty($spc34df8)) { define('MY_PROXY_PASS', $spc34df8); } \Artisan::call('cache:clear'); \Artisan::call('config:clear'); echo '
-'; $this->comment('检查更新中...'); $this->info('当前版本: ' . config('app.version')); $sp631694 = @json_decode(CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'), true); if (!@$sp631694['version']) { $this->warn('检查更新失败!'); $this->warn('Error: ' . ($sp631694 ? json_encode($sp631694) : 'Network error')); goto LABEL_EXIT; } if (config('app.version') >= $sp631694['version']) { $this->comment('您的版本已是最新!'); goto LABEL_EXIT; } $this->info('最新版本: ' . $sp631694['version']); $this->info('版本说明: ' . (@$sp631694['description'] ?? '无')); $sp777a44 = strtolower($this->ask('是否现在更新 (yes/no)', 'no')); if ($sp777a44 !== 'yes') { goto LABEL_EXIT; } $sp504e6f = realpath(sys_get_temp_dir()); if (strlen($sp504e6f) < 3) { $this->warn('获取临时目录失败!'); goto LABEL_EXIT; } $sp504e6f .= DIRECTORY_SEPARATOR . Str::random(16); if (!mkdir($sp504e6f) || !is_writable($sp504e6f) || !is_readable($sp504e6f)) { $this->warn('临时目录不可读写!'); goto LABEL_EXIT; } if (!function_exists('exec')) { $this->warn('函数 exec 已被禁用, 无法继续更新!'); goto LABEL_EXIT; } if (PHP_OS === 'WINNT') { $sp328f27 = 'C:\\Program Files\\7-Zip\\7z.exe'; if (!is_file($sp328f27)) { $sp328f27 = strtolower($this->ask('未找到7-Zip, 请手动输入7zG.exe路径', $sp328f27)); } if (!is_file($sp328f27)) { $this->warn('7-Zip不可用, 请安装7-Zip后重试'); goto LABEL_EXIT; } $sp328f27 = '"' . $sp328f27 . '"'; } else { exec('tar --version', $sp8f7022, $spb611b7); if ($spb611b7) { $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($spd2457c, $sp98dd00) { $sp26c226 = fopen($sp98dd00, 'w+'); if (!$sp26c226) { return false; } $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_FOLLOWLOCATION, true); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, true); curl_setopt($sp9f83d6, CURLOPT_FILE, $sp26c226); curl_setopt($sp9f83d6, CURLOPT_PROGRESSFUNCTION, function ($sp1facb6, $spfddf8d, $sp32b55b, $spc41e48, $sp0e22a3) { if ($spfddf8d > 0) { echo '
download: ' . sprintf('%.2f', $sp32b55b / $spfddf8d * 100) . '%'; } }); curl_setopt($sp9f83d6, CURLOPT_NOPROGRESS, false); curl_setopt($sp9f83d6, CURLOPT_HEADER, 0); curl_setopt($sp9f83d6, CURLOPT_USERAGENT, 'card update'); curl_exec($sp9f83d6); curl_close($sp9f83d6); echo '
+'; return true; } public function handle() { set_time_limit(0); $spa0fa4a = $this->option('proxy'); if (!empty($spa0fa4a)) { define('MY_PROXY', $spa0fa4a); } $spa75587 = $this->option('proxy-auth'); if (!empty($spa75587)) { define('MY_PROXY_PASS', $spa75587); } \Artisan::call('cache:clear'); \Artisan::call('config:clear'); echo '
+'; $this->comment('检查更新中...'); $this->info('当前版本: ' . config('app.version')); $sp4d0456 = @json_decode(CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'), true); if (!@$sp4d0456['version']) { $this->warn('检查更新失败!'); $this->warn('Error: ' . ($sp4d0456 ? json_encode($sp4d0456) : 'Network error')); goto LABEL_EXIT; } if (config('app.version') >= $sp4d0456['version']) { $this->comment('您的版本已是最新!'); goto LABEL_EXIT; } $this->info('最新版本: ' . $sp4d0456['version']); $this->info('版本说明: ' . (@$sp4d0456['description'] ?? '无')); $sp5eeb86 = strtolower($this->ask('是否现在更新 (yes/no)', 'no')); if ($sp5eeb86 !== 'yes') { goto LABEL_EXIT; } $spe1433d = realpath(sys_get_temp_dir()); if (strlen($spe1433d) < 3) { $this->warn('获取临时目录失败!'); goto LABEL_EXIT; } $spe1433d .= DIRECTORY_SEPARATOR . Str::random(16); if (!mkdir($spe1433d) || !is_writable($spe1433d) || !is_readable($spe1433d)) { $this->warn('临时目录不可读写!'); goto LABEL_EXIT; } if (!function_exists('exec')) { $this->warn('函数 exec 已被禁用, 无法继续更新!'); goto LABEL_EXIT; } if (PHP_OS === 'WINNT') { $sp2003b5 = 'C:\\Program Files\\7-Zip\\7z.exe'; if (!is_file($sp2003b5)) { $sp2003b5 = strtolower($this->ask('未找到7-Zip, 请手动输入7zG.exe路径', $sp2003b5)); } if (!is_file($sp2003b5)) { $this->warn('7-Zip不可用, 请安装7-Zip后重试'); goto LABEL_EXIT; } $sp2003b5 = '"' . $sp2003b5 . '"'; } else { exec('tar --version', $spad2be8, $sp1bf350); if ($sp1bf350) { $this->warn('Error: tar --version
' . join('
-', $sp8f7022)); goto LABEL_EXIT; } } $this->comment('正在下载新版本...'); $spb701ff = $sp504e6f . DIRECTORY_SEPARATOR . 'ka_update_' . Str::random(16) . '.tmp'; if (!$this->download_progress($sp631694['url'], $spb701ff)) { $this->warn('写入临时文件失败!'); goto LABEL_EXIT; } $sp26ee73 = md5_file($spb701ff); if ($sp26ee73 !== $sp631694['md5']) { $this->warn('更新文件md5校验失败!, file:' . $sp26ee73 . ', require:' . $sp631694['md5']); goto LABEL_EXIT; } $this->comment('正在解压...'); unset($sp8f7022); if (PHP_OS === 'WINNT') { exec("{$sp328f27} x -so {$spb701ff} | {$sp328f27} x -aoa -si -ttar -o{$sp504e6f}", $sp8f7022, $spb611b7); } else { exec("tar -zxf {$spb701ff} -C {$sp504e6f}", $sp8f7022, $spb611b7); } if ($spb611b7) { $this->warn('Error: 解压失败
+', $spad2be8)); goto LABEL_EXIT; } } $this->comment('正在下载新版本...'); $sp98dd00 = $spe1433d . DIRECTORY_SEPARATOR . 'ka_update_' . Str::random(16) . '.tmp'; if (!$this->download_progress($sp4d0456['url'], $sp98dd00)) { $this->warn('写入临时文件失败!'); goto LABEL_EXIT; } $sp565d4d = md5_file($sp98dd00); if ($sp565d4d !== $sp4d0456['md5']) { $this->warn('更新文件md5校验失败!, file:' . $sp565d4d . ', require:' . $sp4d0456['md5']); goto LABEL_EXIT; } $this->comment('正在解压...'); unset($spad2be8); if (PHP_OS === 'WINNT') { exec("{$sp2003b5} x -so {$sp98dd00} | {$sp2003b5} x -aoa -si -ttar -o{$spe1433d}", $spad2be8, $sp1bf350); } else { exec("tar -zxf {$sp98dd00} -C {$spe1433d}", $spad2be8, $sp1bf350); } if ($sp1bf350) { $this->warn('Error: 解压失败
' . join('
-', $sp8f7022)); goto LABEL_EXIT; } $this->comment('正在关闭主站...'); \Artisan::call('down'); sleep(5); $this->comment(' --> 正在清理旧文件...'); $spe753b2 = base_path(); foreach (array('app', 'bootstrap', 'config', 'public/dist', 'database', 'routes', 'vendor') as $sp61aa55) { \File::deleteDirectory($spe753b2 . DIRECTORY_SEPARATOR . $sp61aa55); } $this->comment(' --> 正在复制新文件...'); \File::copyDirectory($sp504e6f . DIRECTORY_SEPARATOR . 'card_dist', $spe753b2); $this->comment(' --> 正在创建缓存...'); \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); $this->comment(' --> 正在更新数据库...'); \Artisan::call('migrate'); if (PHP_OS === 'WINNT') { echo '
+', $spad2be8)); goto LABEL_EXIT; } $this->comment('正在关闭主站...'); \Artisan::call('down'); sleep(5); $this->comment(' --> 正在清理旧文件...'); $spbdeee3 = base_path(); foreach (array('app', 'bootstrap', 'config', 'public/dist', 'database', 'routes', 'vendor') as $sp14400e) { \File::deleteDirectory($spbdeee3 . DIRECTORY_SEPARATOR . $sp14400e); } $this->comment(' --> 正在复制新文件...'); \File::copyDirectory($spe1433d . DIRECTORY_SEPARATOR . 'card_system_free_dist', $spbdeee3); $this->comment(' --> 正在创建缓存...'); \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); $this->comment(' --> 正在更新数据库...'); \Artisan::call('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('正在启用主站...'); \Artisan::call('up'); \Artisan::call('queue:restart'); $spbe70b3 = true; LABEL_EXIT: if (isset($sp504e6f) && strlen($sp504e6f) > 19) { $this->comment('清理临时目录...'); \File::deleteDirectory($sp504e6f); } if (isset($spbe70b3) && $spbe70b3) { $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('正在启用主站...'); \Artisan::call('up'); \Artisan::call('queue:restart'); $spe23ad8 = true; LABEL_EXIT: if (isset($spe1433d) && strlen($spe1433d) > 19) { $this->comment('清理临时目录...'); \File::deleteDirectory($spe1433d); } if (isset($spe23ad8) && $spe23ad8) { $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 f0ae75937..e1775efd2 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -1,4 +1,4 @@
runningInConsole()) { return; } try { System::_init(); } catch (\Throwable $sp81eee8) { return; } if (System::_getInt('order_clean_unpay_open') === 1) { $sp842b0e = System::_getInt('order_clean_unpay_day', 7); $spe90c59->call(function () use($sp842b0e) { echo '[' . date('Y-m-d H:i:s') . "] cleaning unpaid orders({$sp842b0e} days ago)...\n"; \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$sp842b0e))->delete(); $spd6860c = '[' . date('Y-m-d H:i:s') . '] unpaid-orders cleaned
-'; echo $spd6860c; })->dailyAt('01:00'); } $spe90c59->call(function () { $sp842b0e = 7; echo '[' . date('Y-m-d H:i:s') . "] cleaning deleted cards({$sp842b0e} days ago)...\n"; \App\Card::onlyTrashed()->where('deleted_at', '<', (new Carbon())->addDays(-$sp842b0e))->forceDelete(); $spd6860c = '[' . date('Y-m-d H:i:s') . '] deleted-cards cleaned
-'; echo $spd6860c; })->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 $sp04c765) { if (!app()->runningInConsole()) { return; } try { System::_init(); } catch (\Throwable $sp3f4aab) { return; } if (System::_getInt('order_clean_unpay_open') === 1) { $sp403e35 = System::_getInt('order_clean_unpay_day', 7); $sp04c765->call(function () use($sp403e35) { echo '[' . date('Y-m-d H:i:s') . "] cleaning unpaid orders({$sp403e35} days ago)...\n"; \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$sp403e35))->delete(); $spe95830 = '[' . date('Y-m-d H:i:s') . '] unpaid-orders cleaned
+'; echo $spe95830; })->dailyAt('01:00'); } $sp04c765->call(function () { $sp403e35 = 7; echo '[' . date('Y-m-d H:i:s') . "] cleaning deleted cards({$sp403e35} days ago)...\n"; \App\Card::onlyTrashed()->where('deleted_at', '<', (new Carbon())->addDays(-$sp403e35))->forceDelete(); $spe95830 = '[' . date('Y-m-d H:i:s') . '] deleted-cards cleaned
+'; echo $spe95830; })->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 f0eb20c63..f6bcbddce 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -1,2 +1,2 @@
isXmlHttpRequest() ? response()->json(array('message' => $spd6860c), $sp7a9982) : response()->view('errors._', array('code' => $sp7a9982, 'message' => $spd6860c), $sp7a9982); } public function render($spfeab54, Exception $sp81eee8) { if ($sp81eee8 instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) { return $this->msg($spfeab54, '记录未找到', 404); } elseif ($sp81eee8 instanceof \Illuminate\Auth\AuthenticationException) { return $this->msg($spfeab54, '您需要登录您的账户再进行此操作', 401); } elseif ($sp81eee8 instanceof \Illuminate\Auth\Access\AuthorizationException) { return $this->msg($spfeab54, '未授权的操作', 403); } elseif ($sp81eee8 instanceof \Illuminate\Validation\ValidationException) { return parent::render($spfeab54, $sp81eee8); } elseif ($sp81eee8 instanceof \Illuminate\Session\TokenMismatchException) { return $this->msg($spfeab54, '请刷新页面后重试', 403); } elseif ($sp81eee8 instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { return $this->msg($spfeab54, '页面未找到', 404); } elseif ($sp81eee8 instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException) { return $this->msg($spfeab54, '请求方法不允许', 405); } elseif ($sp81eee8 instanceof \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException) { Log::error('Caught a ServiceUnavailableHttpException', array('Exception' => $sp81eee8)); return $this->msg($spfeab54, '当前服务不可用,请稍后重试', 503); } elseif ($sp81eee8 instanceof \Symfony\Component\HttpKernel\Exception\HttpException) { $sp7515ef = $spfeab54->isXmlHttpRequest(); switch ($sp7515ef) { case 429: return $this->msg($spfeab54, '您的请求过于频繁,请稍后重试', $sp7515ef); break; default: Log::error('Caught a UnknownHttpException', array('Exception' => $sp81eee8)); return $this->msg($spfeab54, '当前服务不可用,请稍后重试', $sp7515ef); } } Log::error('Uncaught Exception', array('Exception' => $sp81eee8)); if (config('app.debug')) { return parent::render($spfeab54, $sp81eee8); } else { return $this->msg($spfeab54, '未知错误,请查看错误日志(storage/logs)', 500); } } }
\ No newline at end of file
+namespace App\Exceptions; 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 $sp2a9b1e) { parent::report($sp2a9b1e); } private function msg($spf066f3, $spe95830, $sp27b58d) { return $spf066f3->isXmlHttpRequest() ? response()->json(array('message' => $spe95830), $sp27b58d) : response()->view('errors._', array('code' => $sp27b58d, 'message' => $spe95830), $sp27b58d); } public function render($spf066f3, Exception $sp3f4aab) { if ($sp3f4aab instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) { return $this->msg($spf066f3, '记录未找到', 404); } elseif ($sp3f4aab instanceof \Illuminate\Auth\AuthenticationException) { return $this->msg($spf066f3, '您需要登录您的账户再进行此操作', 401); } elseif ($sp3f4aab instanceof \Illuminate\Auth\Access\AuthorizationException) { return $this->msg($spf066f3, '未授权的操作', 403); } elseif ($sp3f4aab instanceof \Illuminate\Validation\ValidationException) { return parent::render($spf066f3, $sp3f4aab); } elseif ($sp3f4aab instanceof \Illuminate\Session\TokenMismatchException) { return $this->msg($spf066f3, '请刷新页面后重试', 403); } elseif ($sp3f4aab instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { return $this->msg($spf066f3, '页面未找到', 404); } elseif ($sp3f4aab instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException) { return $this->msg($spf066f3, '请求方法不允许', 405); } elseif ($sp3f4aab instanceof \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException) { Log::error('Caught a ServiceUnavailableHttpException', array('Exception' => $sp3f4aab)); return $this->msg($spf066f3, '当前服务不可用,请稍后重试', 503); } elseif ($sp3f4aab instanceof \Symfony\Component\HttpKernel\Exception\HttpException) { $sp789a6f = $spf066f3->isXmlHttpRequest(); switch ($sp789a6f) { case 429: return $this->msg($spf066f3, '您的请求过于频繁,请稍后重试', $sp789a6f); break; default: Log::error('Caught a UnknownHttpException', array('Exception' => $sp3f4aab)); return $this->msg($spf066f3, '当前服务不可用,请稍后重试', $sp789a6f); } } Log::error('Uncaught Exception', array('Exception' => $sp3f4aab)); if (config('app.debug')) { return parent::render($spf066f3, $sp3f4aab); } else { return $this->msg($spf066f3, '未知错误,请查看错误日志(storage/logs)', 500); } } }
\ No newline at end of file
diff --git a/app/File.php b/app/File.php
index d539275bf..327bed47d 100644
--- a/app/File.php
+++ b/app/File.php
@@ -1,2 +1,2 @@
driver)->delete($this->path); } catch (\Exception $sp81eee8) { \Log::error('File.deleteFile Error: ' . $sp81eee8->getMessage(), array('exception' => $sp81eee8)); } } 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 $sp3f4aab) { \Log::error('File.deleteFile Error: ' . $sp3f4aab->getMessage(), array('exception' => $sp3f4aab)); } } 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 7682c1202..4612c1b2d 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)); $sp62f21c = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::now()->toDateString())->where(function ($sp5786ca) { $sp5786ca->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(); $spf54030 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::yesterday()->toDateString())->where(function ($sp5786ca) { $sp5786ca->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($sp62f21c[0]) && isset($sp62f21c[0]['count'])) { $spf9a2cd['today'] = array('count' => (int) $sp62f21c[0]['count'], 'paid' => (int) $sp62f21c[0]['paid'], 'profit' => (int) $sp62f21c[0]['profit']); } if (isset($spf54030[0]) && isset($spf54030[0]['count'])) { $spf9a2cd['yesterday'] = array('count' => (int) $spf54030[0]['count'], 'paid' => (int) $spf54030[0]['paid'], 'profit' => (int) $spf54030[0]['profit']); } $spf9a2cd['need_ship_count'] = Order::whereUserId(\Auth::Id())->where('status', Order::STATUS_PAID)->count(); $spf9a2cd['login'] = \App\Log::where('action', \App\Log::ACTION_LOGIN)->latest()->firstOrFail(); return Response::success($spf9a2cd); } function clearCache() { if (function_exists('opcache_reset')) { opcache_reset(); } try { \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); } catch (\Throwable $sp81eee8) { return Response::fail($sp81eee8->getMessage()); } return Response::success(); } function version() { return Response::success(array('version' => config('app.version'))); } function checkUpdate() { return Response::success(@json_decode(CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'), true)); } }
\ 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; class Dashboard extends Controller { function index(Request $spf066f3) { $spf832df = array('today' => array('count' => 0, 'paid' => 0, 'profit' => 0), 'yesterday' => array('count' => 0, 'paid' => 0, 'profit' => 0)); $sp698ac8 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::now()->toDateString())->where(function ($sp5044a7) { $sp5044a7->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(); $sp7a6714 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::yesterday()->toDateString())->where(function ($sp5044a7) { $sp5044a7->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($sp698ac8[0]) && isset($sp698ac8[0]['count'])) { $spf832df['today'] = array('count' => (int) $sp698ac8[0]['count'], 'paid' => (int) $sp698ac8[0]['paid'], 'profit' => (int) $sp698ac8[0]['profit']); } if (isset($sp7a6714[0]) && isset($sp7a6714[0]['count'])) { $spf832df['yesterday'] = array('count' => (int) $sp7a6714[0]['count'], 'paid' => (int) $sp7a6714[0]['paid'], 'profit' => (int) $sp7a6714[0]['profit']); } $spf832df['need_ship_count'] = Order::whereUserId(\Auth::Id())->where('status', Order::STATUS_PAID)->count(); $spf832df['login'] = \App\Log::where('action', \App\Log::ACTION_LOGIN)->latest()->firstOrFail(); return Response::success($spf832df); } function clearCache() { if (function_exists('opcache_reset')) { opcache_reset(); } try { \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); } catch (\Throwable $sp3f4aab) { return Response::fail($sp3f4aab->getMessage()); } return Response::success(); } function version() { return Response::success(array('version' => config('app.version'))); } function checkUpdate() { return Response::success(@json_decode(CurlRequest::get('https://raw.githubusercontent.com/Tai7sy/card-system/master/.version'), true)); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/Login.php b/app/Http/Controllers/Admin/Login.php
index 931657d96..735c3b992 100644
--- a/app/Http/Controllers/Admin/Login.php
+++ b/app/Http/Controllers/Admin/Login.php
@@ -1,2 +1,2 @@
'geetest', 'geetest' => Geetest\API::get()); return Response::success($sp303806); } public function login(Request $spfeab54) { if ((int) \App\System::_get('vcode_login') === 1) { $spb9589c = Geetest\API::verify($spfeab54->post('gt_c'), $spfeab54->post('gt_v'), $spfeab54->post('gt_s')); if (!$spb9589c) { return Response::fail('滑动验证超时,请返回页面重试。'); } } $sp900ccf = $spfeab54->input('remember') == 'true'; if (!Auth::attempt(array('email' => $spfeab54->input('email'), 'password' => $spfeab54->input('password')), $sp900ccf)) { return Response::fail('邮箱或密码错误, 请检查'); } else { $sp77595d = new \App\Log(); $sp77595d->user_id = Auth::Id(); $sp77595d->ip = Helper::getIP(); $sp77595d->action = \App\Log::ACTION_LOGIN; $sp77595d->save(); $spafa70b = Auth::getUser(); $spafa70b->addHidden(array('created_at', 'updated_at')); return Response::success(array('token' => 'login', 'user' => $spafa70b->toArray())); } } function info() { $spafa70b = Auth::getUser(); $spafa70b->addHidden(array('created_at', 'updated_at')); $spafa70b->setAttribute('shop_name', \App\System::_get('app_name')); return Response::success(array('token' => 'login', 'user' => $spafa70b->toArray())); } function logout(Request $spfeab54) { @Auth::logout(); return Response::success(); } function changePassword(Request $spfeab54) { $spafa70b = Auth::getUser(); $sp50470d = $spfeab54->post('old', null); $spb6833a = $spfeab54->post('password', null); if (strlen($spb6833a) < 6 || strlen($spb6833a) > 32) { return Response::fail('请输入6-32位密码'); } if (!Hash::check($sp50470d, $spafa70b->password)) { return Response::fail('旧密码错误,请检查'); } $spafa70b->password = Hash::make($spb6833a); $spafa70b->setRememberToken(str_random(60)); $spafa70b->saveOrFail(); event(new PasswordReset($spafa70b)); Auth::guard()->login($spafa70b); return Response::success(); } }
\ No newline at end of file
+namespace App\Http\Controllers\Admin; use App\Library\Helper; use App\Library\Geetest; use Illuminate\Auth\Events\PasswordReset; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Library\Response; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class Login extends Controller { function getVerify() { $sp2a2ac0 = array('driver' => 'geetest', 'geetest' => Geetest\API::get()); return Response::success($sp2a2ac0); } public function login(Request $spf066f3) { if ((int) \App\System::_get('vcode_login') === 1) { $sp9b52fe = Geetest\API::verify($spf066f3->post('gt_c'), $spf066f3->post('gt_v'), $spf066f3->post('gt_s')); if (!$sp9b52fe) { return Response::fail('滑动验证超时,请返回页面重试。'); } } $sp7d2107 = $spf066f3->input('remember') == 'true'; if (!Auth::attempt(array('email' => $spf066f3->input('email'), 'password' => $spf066f3->input('password')), $sp7d2107)) { return Response::fail('邮箱或密码错误, 请检查'); } else { $sp275d8f = new \App\Log(); $sp275d8f->user_id = Auth::Id(); $sp275d8f->ip = Helper::getIP(); $sp275d8f->action = \App\Log::ACTION_LOGIN; $sp275d8f->save(); $spbbb773 = Auth::getUser(); $spbbb773->addHidden(array('created_at', 'updated_at')); return Response::success(array('token' => 'login', 'user' => $spbbb773->toArray())); } } function info() { $spbbb773 = Auth::getUser(); $spbbb773->addHidden(array('created_at', 'updated_at')); $spbbb773->setAttribute('shop_name', \App\System::_get('app_name')); return Response::success(array('token' => 'login', 'user' => $spbbb773->toArray())); } function logout(Request $spf066f3) { @Auth::logout(); return Response::success(); } function changePassword(Request $spf066f3) { $spbbb773 = Auth::getUser(); $sp7c77cf = $spf066f3->post('old', null); $sp8f68ce = $spf066f3->post('password', null); if (strlen($sp8f68ce) < 6 || strlen($sp8f68ce) > 32) { return Response::fail('请输入6-32位密码'); } if (!Hash::check($sp7c77cf, $spbbb773->password)) { return Response::fail('旧密码错误,请检查'); } $spbbb773->password = Hash::make($sp8f68ce); $spbbb773->setRememberToken(str_random(60)); $spbbb773->saveOrFail(); event(new PasswordReset($spbbb773)); Auth::guard()->login($spbbb773); return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/Order.php b/app/Http/Controllers/Admin/Order.php
index c53717aa5..7aba529f5 100644
--- a/app/Http/Controllers/Admin/Order.php
+++ b/app/Http/Controllers/Admin/Order.php
@@ -1,2 +1,2 @@
validate($spfeab54, array('ids' => 'required|string', 'income' => 'required|integer', 'balance' => 'required|integer')); $spbd9db0 = $spfeab54->post('ids'); $spdc46ce = (int) $spfeab54->post('income'); $sp88feb2 = (int) $spfeab54->post('balance'); \App\Order::whereIn('id', explode(',', $spbd9db0))->chunk(100, function ($spc544b7) use($spdc46ce, $sp88feb2) { foreach ($spc544b7 as $sp4f4c0d) { $sp4f4c0d->cards()->detach(); try { if ($spdc46ce) { $sp4f4c0d->fundRecord()->delete(); } if ($sp88feb2) { $spafa70b = \App\User::lockForUpdate()->firstOrFail(); $spafa70b->m_all -= $sp4f4c0d->income; $spafa70b->saveOrFail(); } $sp4f4c0d->delete(); } catch (\Exception $sp81eee8) { } } }); return Response::success(); } function freeze(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = explode(',', $spfeab54->post('ids')); $spe3efa4 = $spfeab54->post('reason'); $spfdb02a = 0; $sp65fc58 = 0; foreach ($spbd9db0 as $sp48ee76) { $spfdb02a++; if (FundHelper::orderFreeze($sp48ee76, $spe3efa4)) { $sp65fc58++; } } return Response::success(array($spfdb02a, $sp65fc58)); } function unfreeze(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = explode(',', $spfeab54->post('ids')); $spfdb02a = 0; $sp65fc58 = 0; $sp56845b = \App\Order::STATUS_FROZEN; foreach ($spbd9db0 as $sp48ee76) { $spfdb02a++; if (FundHelper::orderUnfreeze($sp48ee76, '后台操作', null, $sp56845b)) { $sp65fc58++; } } return Response::success(array($spfdb02a, $sp65fc58, $sp56845b)); } function set_paid(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp53f8aa = $spfeab54->post('id', ''); $sp4d48a7 = $spfeab54->post('trade_no', ''); if (strlen($sp4d48a7) < 1) { return Response::forbidden('请输入支付系统内单号'); } $sp4f4c0d = \App\Order::findOrFail($sp53f8aa); if ($sp4f4c0d->status !== \App\Order::STATUS_UNPAY) { return Response::forbidden('只能操作未支付订单'); } $sp9df21a = 'Admin.SetPaid'; $sp7c88f3 = $sp4f4c0d->order_no; $sp429fcc = $sp4f4c0d->paid; try { Log::debug($sp9df21a . " shipOrder start, order_no: {$sp7c88f3}, amount: {$sp429fcc}, trade_no: {$sp4d48a7}"); (new \App\Http\Controllers\Shop\Pay())->shipOrder($spfeab54, $sp7c88f3, $sp429fcc, $sp4d48a7); Log::debug($sp9df21a . ' shipOrder end, order_no: ' . $sp7c88f3); $sp65fc58 = true; $sp093e23 = '发货成功'; } catch (\Exception $sp81eee8) { $sp65fc58 = false; $sp093e23 = $sp81eee8->getMessage(); Log::error($sp9df21a . ' shipOrder Exception: ' . $sp81eee8->getMessage()); } $sp4f4c0d = \App\Order::with(array('pay' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'name')); }, 'card_orders.card' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'card')); }))->findOrFail($sp53f8aa); if ($sp4f4c0d->status === \App\Order::STATUS_PAID) { if ($sp4f4c0d->product->delivery === \App\Product::DELIVERY_MANUAL) { $sp65fc58 = true; $sp093e23 = '已标记为付款成功
当前商品为手动发货商品, 请手动进行发货。'; } else { $sp65fc58 = false; $sp093e23 = '已标记为付款成功,
但是买家库存不足, 发货失败, 请稍后尝试手动发货。'; } } return Response::success(array('code' => $sp65fc58 ? 0 : -1, 'msg' => $sp093e23, 'order' => $sp4f4c0d)); } }
\ 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 $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string', 'income' => 'required|integer', 'balance' => 'required|integer')); $sp1f71d9 = $spf066f3->post('ids'); $sp877e18 = (int) $spf066f3->post('income'); $sp507a29 = (int) $spf066f3->post('balance'); \App\Order::whereIn('id', explode(',', $sp1f71d9))->chunk(100, function ($sp0e06cc) use($sp877e18, $sp507a29) { foreach ($sp0e06cc as $spe0613f) { $spe0613f->cards()->detach(); try { if ($sp877e18) { $spe0613f->fundRecord()->delete(); } if ($sp507a29) { $spbbb773 = \App\User::lockForUpdate()->firstOrFail(); $spbbb773->m_all -= $spe0613f->income; $spbbb773->saveOrFail(); } $spe0613f->delete(); } catch (\Exception $sp3f4aab) { } } }); return Response::success(); } function freeze(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = explode(',', $spf066f3->post('ids')); $sp1abd79 = $spf066f3->post('reason'); $spdd51cd = 0; $spcfee73 = 0; foreach ($sp1f71d9 as $spd04f8a) { $spdd51cd++; if (FundHelper::orderFreeze($spd04f8a, $sp1abd79)) { $spcfee73++; } } return Response::success(array($spdd51cd, $spcfee73)); } function unfreeze(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = explode(',', $spf066f3->post('ids')); $spdd51cd = 0; $spcfee73 = 0; $sp3f483e = \App\Order::STATUS_FROZEN; foreach ($sp1f71d9 as $spd04f8a) { $spdd51cd++; if (FundHelper::orderUnfreeze($spd04f8a, '后台操作', null, $sp3f483e)) { $spcfee73++; } } return Response::success(array($spdd51cd, $spcfee73, $sp3f483e)); } function set_paid(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sp3c46ab = $spf066f3->post('id', ''); $sp565d18 = $spf066f3->post('trade_no', ''); if (strlen($sp565d18) < 1) { return Response::forbidden('请输入支付系统内单号'); } $spe0613f = \App\Order::findOrFail($sp3c46ab); if ($spe0613f->status !== \App\Order::STATUS_UNPAY) { return Response::forbidden('只能操作未支付订单'); } $sp5d5f28 = 'Admin.SetPaid'; $sp845b45 = $spe0613f->order_no; $spf59c91 = $spe0613f->paid; try { Log::debug($sp5d5f28 . " shipOrder start, order_no: {$sp845b45}, amount: {$spf59c91}, trade_no: {$sp565d18}"); (new \App\Http\Controllers\Shop\Pay())->shipOrder($spf066f3, $sp845b45, $spf59c91, $sp565d18); Log::debug($sp5d5f28 . ' shipOrder end, order_no: ' . $sp845b45); $spcfee73 = true; $sp417133 = '发货成功'; } catch (\Exception $sp3f4aab) { $spcfee73 = false; $sp417133 = $sp3f4aab->getMessage(); Log::error($sp5d5f28 . ' shipOrder Exception: ' . $sp3f4aab->getMessage()); } $spe0613f = \App\Order::with(array('pay' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'name')); }, 'card_orders.card' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'card')); }))->findOrFail($sp3c46ab); if ($spe0613f->status === \App\Order::STATUS_PAID) { if ($spe0613f->product->delivery === \App\Product::DELIVERY_MANUAL) { $spcfee73 = true; $sp417133 = '已标记为付款成功
当前商品为手动发货商品, 请手动进行发货。'; } else { $spcfee73 = false; $sp417133 = '已标记为付款成功,
但是买家库存不足, 发货失败, 请稍后尝试手动发货。'; } } return Response::success(array('code' => $spcfee73 ? 0 : -1, 'msg' => $sp417133, 'order' => $spe0613f)); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/Pay.php b/app/Http/Controllers/Admin/Pay.php
index 596e3b178..15bb807ae 100644
--- a/app/Http/Controllers/Admin/Pay.php
+++ b/app/Http/Controllers/Admin/Pay.php
@@ -1,2 +1,2 @@
post('enabled'); if (strlen($sp17fe52)) { $sp5786ca->whereIn('enabled', explode(',', $sp17fe52)); } $sped0aef = $spfeab54->post('search', false); $sp86d9ea = $spfeab54->post('val', false); if ($sped0aef && $sp86d9ea) { if ($sped0aef == 'simple') { return Response::success($sp5786ca->get(array('id', 'name'))); } elseif ($sped0aef == 'id') { $sp5786ca->where('id', $sp86d9ea); } else { $sp5786ca->where($sped0aef, 'like', '%' . $sp86d9ea . '%'); } } $spaff91c = $sp5786ca->get(); return Response::success(array('list' => $spaff91c, 'urls' => array('url' => config('app.url'), 'url_api' => config('app.url_api')))); } function stat(Request $spfeab54) { $this->validate($spfeab54, array('day' => 'required|integer|between:1,30')); $sp842b0e = (int) $spfeab54->input('day'); if ($sp842b0e === 30) { $spa470da = Carbon::now()->addMonths(-1); } else { $spa470da = Carbon::now()->addDays(-$sp842b0e); } $spaff91c = $this->authQuery($spfeab54, \App\Order::class)->where(function ($sp5786ca) { $sp5786ca->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', $spa470da)->with(array('pay' => function ($sp5786ca) { $sp5786ca->select(array('id', 'name')); }))->groupBy('pay_id')->selectRaw('`pay_id`,COUNT(*) as "count",SUM(`paid`) as "sum"')->get()->toArray(); $spb9589c = array(); foreach ($spaff91c as $sp4a9ec3) { if (isset($sp4a9ec3['pay']) && isset($sp4a9ec3['pay']['name'])) { $sp6de9f7 = $sp4a9ec3['pay']['name']; } else { $sp6de9f7 = '未知方式#' . $sp4a9ec3['pay_id']; } $spb9589c[$sp6de9f7] = array((int) $sp4a9ec3['count'], (int) $sp4a9ec3['sum']); } return Response::success($spb9589c); } function edit(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer', 'name' => 'required|string', 'img' => 'required|string', 'driver' => 'required|string', 'way' => 'required|string', 'config' => 'required|string')); $sp53f8aa = (int) $spfeab54->post('id'); $sp505b52 = $spfeab54->post('name'); $spa14ef6 = $spfeab54->post('img'); $sp5dfa6e = $spfeab54->post('comment'); $sp33ee9e = $spfeab54->post('driver'); $sp63b9f2 = $spfeab54->post('way'); $spbe80b7 = $spfeab54->post('config'); $sp17fe52 = (int) $spfeab54->post('enabled'); $spd46fd8 = \App\Pay::find($sp53f8aa); if (!$spd46fd8) { $spd46fd8 = new \App\Pay(); } $spd46fd8->name = $sp505b52; $spd46fd8->img = $spa14ef6; $spd46fd8->comment = $sp5dfa6e; $spd46fd8->driver = $sp33ee9e; $spd46fd8->way = $sp63b9f2; $spd46fd8->config = $spbe80b7; $spd46fd8->enabled = $sp17fe52; $spd46fd8->fee_system = $spfeab54->post('fee_system'); $spd46fd8->saveOrFail(); return Response::success(); } function comment(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp53f8aa = (int) $spfeab54->post('id'); $spd46fd8 = \App\Pay::findOrFail($sp53f8aa); $spd46fd8->comment = $spfeab54->post('comment'); $spd46fd8->save(); return Response::success(); } function sort(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp53f8aa = (int) $spfeab54->post('id'); $spd46fd8 = \App\Pay::findOrFail($sp53f8aa); $spd46fd8->sort = (int) $spfeab54->post('sort', 1000); $spd46fd8->save(); return Response::success(); } function fee_system(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp53f8aa = (int) $spfeab54->post('id'); $spd46fd8 = \App\Pay::findOrFail($sp53f8aa); $spd46fd8->fee_system = $spfeab54->post('fee_system'); $spd46fd8->saveOrFail(); return Response::success(); } function enable(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $spbd9db0 = $spfeab54->post('ids'); $sp17fe52 = (int) $spfeab54->post('enabled'); \App\Pay::whereIn('id', explode(',', $spbd9db0))->update(array('enabled' => $sp17fe52)); return Response::success(); } function delete(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp53f8aa = (int) $spfeab54->post('id'); \App\Pay::whereId($sp53f8aa)->delete(); 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 $spf066f3) { $sp5044a7 = \App\Pay::orderBy('sort'); $sp4ec09d = $spf066f3->post('enabled'); if (strlen($sp4ec09d)) { $sp5044a7->whereIn('enabled', explode(',', $sp4ec09d)); } $spca736c = $spf066f3->post('search', false); $sp56dec1 = $spf066f3->post('val', false); if ($spca736c && $sp56dec1) { if ($spca736c == 'simple') { return Response::success($sp5044a7->get(array('id', 'name'))); } elseif ($spca736c == 'id') { $sp5044a7->where('id', $sp56dec1); } else { $sp5044a7->where($spca736c, 'like', '%' . $sp56dec1 . '%'); } } $sp293456 = $sp5044a7->get(); return Response::success(array('list' => $sp293456, 'urls' => array('url' => config('app.url'), 'url_api' => config('app.url_api')))); } function stat(Request $spf066f3) { $this->validate($spf066f3, array('day' => 'required|integer|between:1,30')); $sp403e35 = (int) $spf066f3->input('day'); if ($sp403e35 === 30) { $sp586aba = Carbon::now()->addMonths(-1); } else { $sp586aba = Carbon::now()->addDays(-$sp403e35); } $sp293456 = $this->authQuery($spf066f3, \App\Order::class)->where(function ($sp5044a7) { $sp5044a7->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', $sp586aba)->with(array('pay' => function ($sp5044a7) { $sp5044a7->select(array('id', 'name')); }))->groupBy('pay_id')->selectRaw('`pay_id`,COUNT(*) as "count",SUM(`paid`) as "sum"')->get()->toArray(); $sp9b52fe = array(); foreach ($sp293456 as $sp10eb73) { if (isset($sp10eb73['pay']) && isset($sp10eb73['pay']['name'])) { $sp3437bd = $sp10eb73['pay']['name']; } else { $sp3437bd = '未知方式#' . $sp10eb73['pay_id']; } $sp9b52fe[$sp3437bd] = array((int) $sp10eb73['count'], (int) $sp10eb73['sum']); } return Response::success($sp9b52fe); } function edit(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer', 'name' => 'required|string', 'img' => 'required|string', 'driver' => 'required|string', 'way' => 'required|string', 'config' => 'required|string')); $sp3c46ab = (int) $spf066f3->post('id'); $sp34e4b5 = $spf066f3->post('name'); $sp3334e2 = $spf066f3->post('img'); $spd73e08 = $spf066f3->post('comment'); $spd1dcf7 = $spf066f3->post('driver'); $spf9a85f = $spf066f3->post('way'); $sp9d4382 = $spf066f3->post('config'); $sp4ec09d = (int) $spf066f3->post('enabled'); $sp5de949 = \App\Pay::find($sp3c46ab); if (!$sp5de949) { $sp5de949 = new \App\Pay(); } $sp5de949->name = $sp34e4b5; $sp5de949->img = $sp3334e2; $sp5de949->comment = $spd73e08; $sp5de949->driver = $spd1dcf7; $sp5de949->way = $spf9a85f; $sp5de949->config = $sp9d4382; $sp5de949->enabled = $sp4ec09d; $sp5de949->fee_system = $spf066f3->post('fee_system'); $sp5de949->saveOrFail(); return Response::success(); } function comment(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sp3c46ab = (int) $spf066f3->post('id'); $sp5de949 = \App\Pay::findOrFail($sp3c46ab); $sp5de949->comment = $spf066f3->post('comment'); $sp5de949->save(); return Response::success(); } function sort(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sp3c46ab = (int) $spf066f3->post('id'); $sp5de949 = \App\Pay::findOrFail($sp3c46ab); $sp5de949->sort = (int) $spf066f3->post('sort', 1000); $sp5de949->save(); return Response::success(); } function fee_system(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sp3c46ab = (int) $spf066f3->post('id'); $sp5de949 = \App\Pay::findOrFail($sp3c46ab); $sp5de949->fee_system = $spf066f3->post('fee_system'); $sp5de949->saveOrFail(); return Response::success(); } function enable(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,3')); $sp1f71d9 = $spf066f3->post('ids'); $sp4ec09d = (int) $spf066f3->post('enabled'); \App\Pay::whereIn('id', explode(',', $sp1f71d9))->update(array('enabled' => $sp4ec09d)); return Response::success(); } function delete(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sp3c46ab = (int) $spf066f3->post('id'); \App\Pay::whereId($sp3c46ab)->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 526730d0c..9b7ed6426 100644
--- a/app/Http/Controllers/Admin/System.php
+++ b/app/Http/Controllers/Admin/System.php
@@ -1,2 +1,2 @@
has($sp505b52)) { \App\System::_set($sp505b52, $spfeab54->post($sp505b52)); } } } private function setMoney(Request $spfeab54, $sp342c1c) { foreach ($sp342c1c as $sp505b52) { if ($spfeab54->has($sp505b52)) { \App\System::_set($sp505b52, (int) round($spfeab54->post($sp505b52) * 100)); } } } private function setInt(Request $spfeab54, $sp342c1c) { foreach ($sp342c1c as $sp505b52) { if ($spfeab54->has($sp505b52)) { \App\System::_set($sp505b52, (int) $spfeab54->post($sp505b52)); } } } function setItem(Request $spfeab54) { $sp505b52 = $spfeab54->post('name'); $spb914e6 = $spfeab54->post('value'); if (!$sp505b52 || !$spb914e6) { return Response::forbidden(); } \App\System::_set($sp505b52, $spb914e6); return Response::success(); } function info(Request $spfeab54) { $spfb8dfb = array('app_name', 'app_title', 'app_url', 'app_url_api', 'keywords', 'description', 'shop_ann', 'shop_ann_pop', 'shop_qq', 'company', 'js_tj', 'js_kf'); $sp397a5c = array('shop_inventory'); if ($spfeab54->isMethod('GET')) { $spbe80b7 = array(); foreach ($spfb8dfb as $sp505b52) { $spbe80b7[$sp505b52] = \App\System::_get($sp505b52); } foreach ($sp397a5c as $sp505b52) { $spbe80b7[$sp505b52] = (int) \App\System::_get($sp505b52); } return Response::success($spbe80b7); } $sp3db1b2 = array('app_url' => Helper::format_url($_POST['app_url']), 'app_url_api' => Helper::format_url($_POST['app_url_api'])); $spfeab54->merge($sp3db1b2); $this->set($spfeab54, $spfb8dfb); $this->setInt($spfeab54, $sp397a5c); return Response::success(); } function theme(Request $spfeab54) { if ($spfeab54->isMethod('GET')) { \App\ShopTheme::freshList(); return Response::success(array('themes' => \App\ShopTheme::get(), 'default' => \App\ShopTheme::defaultTheme()->name)); } $sp1f7915 = \App\ShopTheme::whereName($spfeab54->post('shop_theme'))->firstOrFail(); \App\System::_set('shop_theme_default', $sp1f7915->name); $sp1f7915->config = @json_decode($spfeab54->post('theme_config')) ?? array(); $sp1f7915->saveOrFail(); return Response::success(); } function order(Request $spfeab54) { $sp342c1c = array('order_clean_unpay_open', 'order_clean_unpay_day'); if ($spfeab54->isMethod('GET')) { $spbe80b7 = array(); foreach ($sp342c1c as $sp505b52) { $spbe80b7[$sp505b52] = (int) \App\System::_get($sp505b52); } return Response::success($spbe80b7); } $this->setInt($spfeab54, $sp342c1c); return Response::success(); } function vcode(Request $spfeab54) { $spfb8dfb = array('vcode_driver', 'vcode_geetest_id', 'vcode_geetest_key'); $sp397a5c = array('vcode_login', 'vcode_shop_buy', 'vcode_shop_search'); if ($spfeab54->isMethod('GET')) { $spbe80b7 = array(); foreach ($spfb8dfb as $sp505b52) { $spbe80b7[$sp505b52] = \App\System::_get($sp505b52); } foreach ($sp397a5c as $sp505b52) { $spbe80b7[$sp505b52] = (int) \App\System::_get($sp505b52); } return Response::success($spbe80b7); } $this->set($spfeab54, $spfb8dfb); $this->setInt($spfeab54, $sp397a5c); return Response::success(); } function email(Request $spfeab54) { $spfb8dfb = 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'); $sp397a5c = array('mail_send_order'); if ($spfeab54->isMethod('GET')) { $spbe80b7 = array(); foreach ($spfb8dfb as $sp505b52) { $spbe80b7[$sp505b52] = \App\System::_get($sp505b52); } foreach ($sp397a5c as $sp505b52) { $spbe80b7[$sp505b52] = (int) \App\System::_get($sp505b52); } return Response::success($spbe80b7); } $this->set($spfeab54, $spfb8dfb); $this->setInt($spfeab54, $sp397a5c); return Response::success(); } function sms(Request $spfeab54) { $spfb8dfb = array('sms_api_id', 'sms_api_key'); $sp397a5c = array('sms_send_order', 'sms_price'); if ($spfeab54->isMethod('GET')) { $spbe80b7 = array(); foreach ($spfb8dfb as $sp505b52) { $spbe80b7[$sp505b52] = \App\System::_get($sp505b52); } foreach ($sp397a5c as $sp505b52) { $spbe80b7[$sp505b52] = (int) \App\System::_get($sp505b52); } return Response::success($spbe80b7); } $this->set($spfeab54, $spfb8dfb); $this->setInt($spfeab54, $sp397a5c); return Response::success(); } function storage(Request $spfeab54) { $spfb8dfb = 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'); $sp397a5c = array('storage_oss_is_ssl', 'storage_oss_is_cname'); if ($spfeab54->isMethod('GET')) { $spbe80b7 = array(); foreach ($spfb8dfb as $sp505b52) { $spbe80b7[$sp505b52] = \App\System::_get($sp505b52); } foreach ($sp397a5c as $sp505b52) { $spbe80b7[$sp505b52] = (int) \App\System::_get($sp505b52); } return Response::success($spbe80b7); } $this->set($spfeab54, $spfb8dfb); $this->set($spfeab54, $sp397a5c); return Response::success(); } function emailTest(Request $spfeab54) { $this->validate($spfeab54, array('to' => 'required')); $sp4af8fe = $spfeab54->post('to'); try { $spb9589c = Mail::to($sp4af8fe)->send(new \App\Mail\Test()); return Response::success($spb9589c); } catch (\Throwable $sp81eee8) { \App\Library\LogHelper::setLogFile('mail'); \Log::error('Mail Test Exception:' . $sp81eee8->getMessage()); return Response::fail($sp81eee8->getMessage(), $sp81eee8); } } function orderClean(Request $spfeab54) { $this->validate($spfeab54, array('day' => 'required|integer|min:1')); $sp842b0e = (int) $spfeab54->post('day'); \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new \Carbon\Carbon())->addDays(-$sp842b0e))->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 $spf066f3, $spfb8cbe) { foreach ($spfb8cbe as $sp34e4b5) { if ($spf066f3->has($sp34e4b5)) { \App\System::_set($sp34e4b5, $spf066f3->post($sp34e4b5)); } } } private function setMoney(Request $spf066f3, $spfb8cbe) { foreach ($spfb8cbe as $sp34e4b5) { if ($spf066f3->has($sp34e4b5)) { \App\System::_set($sp34e4b5, (int) round($spf066f3->post($sp34e4b5) * 100)); } } } private function setInt(Request $spf066f3, $spfb8cbe) { foreach ($spfb8cbe as $sp34e4b5) { if ($spf066f3->has($sp34e4b5)) { \App\System::_set($sp34e4b5, (int) $spf066f3->post($sp34e4b5)); } } } function setItem(Request $spf066f3) { $sp34e4b5 = $spf066f3->post('name'); $sp8b9401 = $spf066f3->post('value'); if (!$sp34e4b5 || !$sp8b9401) { return Response::forbidden(); } \App\System::_set($sp34e4b5, $sp8b9401); return Response::success(); } function info(Request $spf066f3) { $spe8d0d0 = array('app_name', 'app_title', 'app_url', 'app_url_api', 'keywords', 'description', 'shop_ann', 'shop_ann_pop', 'shop_qq', 'company', 'js_tj', 'js_kf'); $spbf0f91 = array('shop_inventory'); if ($spf066f3->isMethod('GET')) { $sp9d4382 = array(); foreach ($spe8d0d0 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = \App\System::_get($sp34e4b5); } foreach ($spbf0f91 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = (int) \App\System::_get($sp34e4b5); } return Response::success($sp9d4382); } $spd2457c = array('app_url' => Helper::format_url($_POST['app_url']), 'app_url_api' => Helper::format_url($_POST['app_url_api'])); $spf066f3->merge($spd2457c); $this->set($spf066f3, $spe8d0d0); $this->setInt($spf066f3, $spbf0f91); return Response::success(); } function theme(Request $spf066f3) { if ($spf066f3->isMethod('GET')) { \App\ShopTheme::freshList(); return Response::success(array('themes' => \App\ShopTheme::get(), 'default' => \App\ShopTheme::defaultTheme()->name)); } $spa8b8a9 = \App\ShopTheme::whereName($spf066f3->post('shop_theme'))->firstOrFail(); \App\System::_set('shop_theme_default', $spa8b8a9->name); $spa8b8a9->config = @json_decode($spf066f3->post('theme_config')) ?? array(); $spa8b8a9->saveOrFail(); return Response::success(); } function order(Request $spf066f3) { $spfb8cbe = array('order_clean_unpay_open', 'order_clean_unpay_day'); if ($spf066f3->isMethod('GET')) { $sp9d4382 = array(); foreach ($spfb8cbe as $sp34e4b5) { $sp9d4382[$sp34e4b5] = (int) \App\System::_get($sp34e4b5); } return Response::success($sp9d4382); } $this->setInt($spf066f3, $spfb8cbe); return Response::success(); } function vcode(Request $spf066f3) { $spe8d0d0 = array('vcode_driver', 'vcode_geetest_id', 'vcode_geetest_key'); $spbf0f91 = array('vcode_login', 'vcode_shop_buy', 'vcode_shop_search'); if ($spf066f3->isMethod('GET')) { $sp9d4382 = array(); foreach ($spe8d0d0 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = \App\System::_get($sp34e4b5); } foreach ($spbf0f91 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = (int) \App\System::_get($sp34e4b5); } return Response::success($sp9d4382); } $this->set($spf066f3, $spe8d0d0); $this->setInt($spf066f3, $spbf0f91); return Response::success(); } function email(Request $spf066f3) { $spe8d0d0 = 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'); $spbf0f91 = array('mail_send_order'); if ($spf066f3->isMethod('GET')) { $sp9d4382 = array(); foreach ($spe8d0d0 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = \App\System::_get($sp34e4b5); } foreach ($spbf0f91 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = (int) \App\System::_get($sp34e4b5); } return Response::success($sp9d4382); } $this->set($spf066f3, $spe8d0d0); $this->setInt($spf066f3, $spbf0f91); return Response::success(); } function sms(Request $spf066f3) { $spe8d0d0 = array('sms_api_id', 'sms_api_key'); $spbf0f91 = array('sms_send_order', 'sms_price'); if ($spf066f3->isMethod('GET')) { $sp9d4382 = array(); foreach ($spe8d0d0 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = \App\System::_get($sp34e4b5); } foreach ($spbf0f91 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = (int) \App\System::_get($sp34e4b5); } return Response::success($sp9d4382); } $this->set($spf066f3, $spe8d0d0); $this->setInt($spf066f3, $spbf0f91); return Response::success(); } function storage(Request $spf066f3) { $spe8d0d0 = 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'); $spbf0f91 = array('storage_oss_is_ssl', 'storage_oss_is_cname'); if ($spf066f3->isMethod('GET')) { $sp9d4382 = array(); foreach ($spe8d0d0 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = \App\System::_get($sp34e4b5); } foreach ($spbf0f91 as $sp34e4b5) { $sp9d4382[$sp34e4b5] = (int) \App\System::_get($sp34e4b5); } return Response::success($sp9d4382); } $this->set($spf066f3, $spe8d0d0); $this->set($spf066f3, $spbf0f91); return Response::success(); } function emailTest(Request $spf066f3) { $this->validate($spf066f3, array('to' => 'required')); $sp6c6383 = $spf066f3->post('to'); try { $sp9b52fe = Mail::to($sp6c6383)->send(new \App\Mail\Test()); return Response::success($sp9b52fe); } catch (\Throwable $sp3f4aab) { \App\Library\LogHelper::setLogFile('mail'); \Log::error('Mail Test Exception:' . $sp3f4aab->getMessage()); return Response::fail($sp3f4aab->getMessage(), $sp3f4aab); } } function orderClean(Request $spf066f3) { $this->validate($spf066f3, array('day' => 'required|integer|min:1')); $sp403e35 = (int) $spf066f3->post('day'); \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new \Carbon\Carbon())->addDays(-$sp403e35))->delete(); return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index e9f640730..6b4f6ce12 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -1,2 +1,2 @@
'维护中', 'message' => $spb12747)); die; } } protected function msg($spd6860c, $sp1dcefc = null, $spd8e3ad = null) { return view('message', array('message' => $spd6860c, 'title' => $sp1dcefc, 'exception' => $spd8e3ad)); } }
\ No newline at end of file
+namespace App\Http\Controllers; use App\System; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Http\Request; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; function authQuery(Request $spf066f3, $spc38b39, $sp6465e8 = 'user_id', $spbcc347 = 'user_id') { return $spc38b39::where($sp6465e8, \Auth::id()); } protected function getUserId(Request $spf066f3, $spbcc347 = 'user_id') { return \Auth::id(); } protected function getUserIdOrFail(Request $spf066f3, $spbcc347 = 'user_id') { $sp15a746 = self::getUserId($spf066f3, $spbcc347); if ($sp15a746) { return $sp15a746; } else { throw new \Exception('参数缺少 ' . $spbcc347); } } protected function getUser(Request $spf066f3) { return \Auth::getUser(); } protected function checkIsInMaintain() { if ((int) System::_get('maintain') === 1) { $spf74618 = System::_get('maintain_info'); echo view('message', array('title' => '维护中', 'message' => $spf74618)); die; } } protected function msg($spe95830, $sp8fa982 = null, $sp2a9b1e = null) { return view('message', array('message' => $spe95830, 'title' => $sp8fa982, 'exception' => $sp2a9b1e)); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/DevController.php b/app/Http/Controllers/DevController.php
index 9de6a97cc..4098176fb 100644
--- a/app/Http/Controllers/DevController.php
+++ b/app/Http/Controllers/DevController.php
@@ -1,2 +1,2 @@
R
'; return true; } else { echo $sp5198e2 . ' ...... R
'; return false; } } else { if (file_exists($sp5198e2)) { return is_readable($sp5198e2); } } echo $sp5198e2 . ' ...... 文件不存在
'; return false; } private function check_writable_r($sp5198e2) { if (is_dir($sp5198e2)) { if (is_writable($sp5198e2)) { $spb295de = scandir($sp5198e2); foreach ($spb295de as $spc7294d) { if ($spc7294d != '.' && $spc7294d != '..') { if (!self::check_writable_r($sp5198e2 . '/' . $spc7294d)) { return false; } else { continue; } } } echo $sp5198e2 . ' ...... W
'; return true; } else { echo $sp5198e2 . ' ...... W
'; return false; } } else { if (file_exists($sp5198e2)) { return is_writable($sp5198e2); } } echo $sp5198e2 . ' ...... 文件不存在
'; return false; } private function checkPathPermission($sp61aa55) { self::check_readable_r($sp61aa55); self::check_writable_r($sp61aa55); } public function install() { $sp325bc5 = array(); @ob_start(); self::checkPathPermission(base_path('storage')); self::checkPathPermission(base_path('bootstrap/cache')); $sp325bc5['permission'] = @ob_get_clean(); return view('install', array('var' => $sp325bc5)); } public function test(Request $spfeab54) { } }
\ 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($sp7893fa) { if (is_dir($sp7893fa)) { if (is_readable($sp7893fa)) { $sp63bc25 = scandir($sp7893fa); foreach ($sp63bc25 as $sp6d2e44) { if ($sp6d2e44 != '.' && $sp6d2e44 != '..') { if (!self::check_readable_r($sp7893fa . '/' . $sp6d2e44)) { return false; } else { continue; } } } echo $sp7893fa . ' ...... R
'; return true; } else { echo $sp7893fa . ' ...... R
'; return false; } } else { if (file_exists($sp7893fa)) { return is_readable($sp7893fa); } } echo $sp7893fa . ' ...... 文件不存在
'; return false; } private function check_writable_r($sp7893fa) { if (is_dir($sp7893fa)) { if (is_writable($sp7893fa)) { $sp63bc25 = scandir($sp7893fa); foreach ($sp63bc25 as $sp6d2e44) { if ($sp6d2e44 != '.' && $sp6d2e44 != '..') { if (!self::check_writable_r($sp7893fa . '/' . $sp6d2e44)) { return false; } else { continue; } } } echo $sp7893fa . ' ...... W
'; return true; } else { echo $sp7893fa . ' ...... W
'; return false; } } else { if (file_exists($sp7893fa)) { return is_writable($sp7893fa); } } echo $sp7893fa . ' ...... 文件不存在
'; return false; } private function checkPathPermission($sp14400e) { self::check_readable_r($sp14400e); self::check_writable_r($sp14400e); } public function install() { $sp546bd5 = array(); @ob_start(); self::checkPathPermission(base_path('storage')); self::checkPathPermission(base_path('bootstrap/cache')); $sp546bd5['permission'] = @ob_get_clean(); return view('install', array('var' => $sp546bd5)); } public function test(Request $spf066f3) { } }
\ No newline at end of file
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index ad1d86414..c47417a6d 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -1,8 +1,8 @@
config('app.url'), 'company' => config('app.company'), 'name' => config('app.name'), 'logo' => config('app.logo'), 'functions' => array()); if (System::_getInt('product_manual')) { $spbe80b7['functions'][] = 'product_manual'; } if (System::_getInt('mail_send_order')) { $spbe80b7['functions'][] = 'mail_send_order'; } if (System::_getInt('sms_send_order')) { $spbe80b7['functions'][] = 'sms_send_order'; $spbe80b7['sms_send_order'] = array('sms_price' => System::_getInt('sms_price')); } $spbe80b7['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')); if ($sp71cb0c) { $spb7fea4->setVisible(array('id', 'name', 'password_open')); if ($spb7fea4->password_open) { $spb7fea4->setAttribute('password', $spb7fea4->getTmpPassword()); $spb7fea4->addVisible(array('password')); } $sp71cb0c->setForShop($spafa70b); $spbe80b7['categories'] = array($spb7fea4); $spbe80b7['product'] = $sp71cb0c; $sp505b52 = $sp71cb0c->name . ' - ' . $spbe80b7['name']; $sp86f371 = $sp71cb0c->description; if (@$sp86f371[0] === '{') { $sp14bc95 = array(); preg_match_all('/"insert":"(.+?)"/', $sp86f371, $sp14bc95); $sp86f371 = str_replace('\\n', ' ', @join(' ', $sp14bc95[1])); } } elseif ($spb7fea4) { $spb7fea4->setVisible(array('id', 'name', 'password_open')); $spbe80b7['categories'] = array($spb7fea4); $spbe80b7['product'] = null; $sp505b52 = $spb7fea4->name . ' - ' . $spbe80b7['name']; $sp86f371 = $spb7fea4->name; } else { $sp9d81c0 = Category::where('user_id', $spafa70b->id)->orderBy('sort')->where('enabled', 1)->get(); foreach ($sp9d81c0 as $spb7fea4) { $spb7fea4->setVisible(array('id', 'name', 'password_open')); } $spbe80b7['categories'] = $sp9d81c0; $sp505b52 = $spbe80b7['name']; $sp86f371 = $spbe80b7['shop']['ann']; if (@$sp86f371[0] === '{') { $sp14bc95 = array(); preg_match_all('/"insert":"(.+?)"/', $sp86f371, $sp14bc95); $sp86f371 = str_replace('\\n', ' ', @join(' ', $sp14bc95[1])); } } $spbe80b7['vcode'] = array('driver' => System::_get('vcode_driver'), 'buy' => (int) System::_get('vcode_shop_buy'), 'search' => (int) System::_get('vcode_shop_search')); if ($spbe80b7['vcode']['driver'] === 'geetest' && ($spbe80b7['vcode'] || $spbe80b7['search'])) { $spbe80b7['vcode']['geetest'] = Geetest\API::get(); } $spbe80b7['pays'] = Pay::whereRaw('enabled&' . (Helper::is_mobile() ? Pay::ENABLED_MOBILE : Pay::ENABLED_PC) . '!=0')->orderBy('sort')->get(array('id', 'name', 'img')); $sp0daafb = Cookie::get('customer'); $spe0ae41 = Cookie::make('customer', strlen($sp0daafb) !== 32 ? md5(str_random(16)) : $sp0daafb, 43200, null, null, false, false); $sp1f7915 = null; if (isset($_GET['theme'])) { $sp1f7915 = \App\ShopTheme::whereName($_GET['theme'])->first(); } if (!$sp1f7915) { $sp1f7915 = \App\ShopTheme::defaultTheme(); } $spbe80b7['theme'] = $spafa70b->theme_config && isset($spafa70b->theme_config[$sp1f7915->name]) ? $spafa70b->theme_config[$sp1f7915->name] : $sp1f7915->config; if (isset($spbe80b7['theme']['background']) && $spbe80b7['theme']['background'] === '内置1') { $spbe80b7['theme']['background'] = Helper::b1_rand_background(); } if ($sp71cb0c === null) { if (@$spbe80b7['theme']['list_type'] === 'list') { foreach ($spbe80b7['categories'] as $sp654541) { if (!$sp654541->password_open) { $sp654541->getProductsForShop(); } } } else { if (count($spbe80b7['categories']) === 1) { $sp654541 = $spbe80b7['categories'][0]; if (!$sp654541->password_open) { $sp654541->getProductsForShop(); } } } } return response()->view('shop_theme.' . $sp1f7915->name . '.index', array('name' => $sp505b52, 'title' => config('app.title'), 'keywords' => preg_replace('/[、,;。!?]/', ', ', $sp505b52), 'description' => $sp86f371, 'js_tj' => System::_get('js_tj'), 'js_kf' => System::_get('js_kf'), 'config' => $spbe80b7))->cookie($spe0ae41); } private function _shop_404() { $this->checkIsInMaintain(); return view('message', array('title' => '404 NotFound', 'message' => '该链接不存在
-查询订单')); } public function shop_default(Request $spfeab54) { $spbdce12 = $spfeab54->get('tab', ''); return response()->redirectTo('/?theme=Material#/record?tab=' . $spbdce12); } public function shop_category($spf7b7a7) { $this->checkIsInMaintain(); $spb7fea4 = Category::whereId(Helper::id_decode($spf7b7a7, Helper::ID_TYPE_CATEGORY))->with('user')->first(); if (!$spb7fea4 && is_numeric($spb7fea4)) { $spb7fea4 = Category::whereId($spf7b7a7)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with('user')->first(); } if (!$spb7fea4) { return $this->_shop_404(); } return $this->_shop_render($spb7fea4->user, $spb7fea4); } public function shop_product(Request $spfeab54, $spcf462f) { $this->checkIsInMaintain(); $sp71cb0c = Product::whereId(Helper::id_decode($spcf462f, Helper::ID_TYPE_PRODUCT))->with(array('user', 'category'))->first(); if (!$sp71cb0c && is_numeric($spcf462f)) { $sp71cb0c = Product::whereId($spcf462f)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with(array('user', 'category'))->first(); } if (!$sp71cb0c || !$sp71cb0c->category) { return $this->_shop_404(); } if ($sp71cb0c->password_open && $sp71cb0c->password !== $spfeab54->input('p')) { return view('message', array('title' => '当前商品需要密码', 'message' => ($spfeab54->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 App\UserDomain; 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($spbbb773, $sped57d9 = null, $sp2cf004 = null) { $sp9d4382 = array('url' => config('app.url'), 'company' => config('app.company'), 'name' => config('app.name'), 'logo' => config('app.logo'), 'functions' => array()); if (System::_getInt('product_manual')) { $sp9d4382['functions'][] = 'product_manual'; } if (System::_getInt('mail_send_order')) { $sp9d4382['functions'][] = 'mail_send_order'; } if (System::_getInt('sms_send_order')) { $sp9d4382['functions'][] = 'sms_send_order'; $sp9d4382['sms_send_order'] = array('sms_price' => System::_getInt('sms_price')); } $sp9d4382['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')); if ($sp2cf004) { $sped57d9->setVisible(array('id', 'name', 'password_open')); if ($sped57d9->password_open) { $sped57d9->setAttribute('password', $sped57d9->getTmpPassword()); $sped57d9->addVisible(array('password')); } $sp2cf004->setForShop($spbbb773); $sp9d4382['categories'] = array($sped57d9); $sp9d4382['product'] = $sp2cf004; $sp34e4b5 = $sp2cf004->name . ' - ' . $sp9d4382['name']; $sp1eddd3 = $sp2cf004->description; if (@$sp1eddd3[0] === '{') { $spec4358 = array(); preg_match_all('/"insert":"(.+?)"/', $sp1eddd3, $spec4358); $sp1eddd3 = str_replace('\\n', ' ', @join(' ', $spec4358[1])); } } elseif ($sped57d9) { $sped57d9->setVisible(array('id', 'name', 'password_open')); $sp9d4382['categories'] = array($sped57d9); $sp9d4382['product'] = null; $sp34e4b5 = $sped57d9->name . ' - ' . $sp9d4382['name']; $sp1eddd3 = $sped57d9->name; } else { $spc8bdf7 = Category::where('user_id', $spbbb773->id)->orderBy('sort')->where('enabled', 1)->get(); foreach ($spc8bdf7 as $sped57d9) { $sped57d9->setVisible(array('id', 'name', 'password_open')); } $sp9d4382['categories'] = $spc8bdf7; $sp34e4b5 = $sp9d4382['name']; $sp1eddd3 = $sp9d4382['shop']['ann']; if (@$sp1eddd3[0] === '{') { $spec4358 = array(); preg_match_all('/"insert":"(.+?)"/', $sp1eddd3, $spec4358); $sp1eddd3 = str_replace('\\n', ' ', @join(' ', $spec4358[1])); } } $sp9d4382['vcode'] = array('driver' => System::_get('vcode_driver'), 'buy' => (int) System::_get('vcode_shop_buy'), 'search' => (int) System::_get('vcode_shop_search')); if ($sp9d4382['vcode']['driver'] === 'geetest' && ($sp9d4382['vcode'] || $sp9d4382['search'])) { $sp9d4382['vcode']['geetest'] = Geetest\API::get(); } $sp9d4382['pays'] = Pay::whereRaw('enabled&' . (Helper::is_mobile() ? Pay::ENABLED_MOBILE : Pay::ENABLED_PC) . '!=0')->orderBy('sort')->get(array('id', 'name', 'img')); $sp173146 = Cookie::get('customer'); $sp5ee4b6 = Cookie::make('customer', strlen($sp173146) !== 32 ? md5(str_random(16)) : $sp173146, 43200, null, null, false, false); $spa8b8a9 = null; if (isset($_GET['theme'])) { $spa8b8a9 = \App\ShopTheme::whereName($_GET['theme'])->first(); } if (!$spa8b8a9) { $spa8b8a9 = \App\ShopTheme::defaultTheme(); } $sp9d4382['theme'] = $spbbb773->theme_config && isset($spbbb773->theme_config[$spa8b8a9->name]) ? $spbbb773->theme_config[$spa8b8a9->name] : $spa8b8a9->config; if (isset($sp9d4382['theme']['background']) && $sp9d4382['theme']['background'] === '内置1') { $sp9d4382['theme']['background'] = Helper::b1_rand_background(); } if ($sp2cf004 === null) { if (@$sp9d4382['theme']['list_type'] === 'list') { foreach ($sp9d4382['categories'] as $spee4521) { if (!$spee4521->password_open) { $spee4521->getProductsForShop(); } } } else { if (count($sp9d4382['categories']) === 1) { $spee4521 = $sp9d4382['categories'][0]; if (!$spee4521->password_open) { $spee4521->getProductsForShop(); } } } } return response()->view('shop_theme.' . $spa8b8a9->name . '.index', array('name' => $sp34e4b5, 'title' => config('app.title'), 'keywords' => preg_replace('/[、,;。!?]/', ', ', $sp34e4b5), 'description' => $sp1eddd3, 'js_tj' => System::_get('js_tj'), 'js_kf' => System::_get('js_kf'), 'config' => $sp9d4382))->cookie($sp5ee4b6); } private function _shop_404() { $this->checkIsInMaintain(); return view('message', array('title' => '404 NotFound', 'message' => '该链接不存在
+查询订单')); } public function shop_default(Request $spf066f3) { $sp358fb6 = $spf066f3->get('tab', ''); return response()->redirectTo('/?theme=Material#/record?tab=' . $sp358fb6); } public function shop_category($sp187c78) { $this->checkIsInMaintain(); $sped57d9 = Category::whereId(Helper::id_decode($sp187c78, Helper::ID_TYPE_CATEGORY))->with('user')->first(); if (!$sped57d9 && is_numeric($sped57d9)) { $sped57d9 = Category::whereId($sp187c78)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with('user')->first(); } if (!$sped57d9) { return $this->_shop_404(); } return $this->_shop_render($sped57d9->user, $sped57d9); } public function shop_product(Request $spf066f3, $sp5f274d) { $this->checkIsInMaintain(); $sp2cf004 = Product::whereId(Helper::id_decode($sp5f274d, Helper::ID_TYPE_PRODUCT))->with(array('user', 'category'))->first(); if (!$sp2cf004 && is_numeric($sp5f274d)) { $sp2cf004 = Product::whereId($sp5f274d)->where('created_at', '<', \Carbon\Carbon::createFromDate(2019, 1, 1))->with(array('user', 'category'))->first(); } if (!$sp2cf004 || !$sp2cf004->category) { return $this->_shop_404(); } if ($sp2cf004->password_open && $sp2cf004->password !== $spf066f3->input('p')) { return view('message', array('title' => '当前商品需要密码', 'message' => ($spf066f3->has('p') ? '密码错误,请重新输入' : '请输入密码') . '
-')); } return $this->_shop_render($sp71cb0c->user, $sp71cb0c->category, $sp71cb0c); } public function shop() { $this->checkIsInMaintain(); $spafa70b = User::firstOrFail(); return $this->_shop_render($spafa70b); } public function admin() { $spbe80b7 = array(); $spbe80b7['url'] = config('app.url'); if (System::_getInt('product_manual')) { $spbe80b7['functions'] = array('product_manual'); } $spbe80b7['vcode'] = array('driver' => System::_get('vcode_driver'), 'login' => (int) System::_get('vcode_login')); if ($spbe80b7['vcode']['driver'] === 'geetest') { $spbe80b7['vcode']['geetest'] = Geetest\API::get(); } return view('admin', array('config' => $spbe80b7)); } }
\ No newline at end of file
+')); } return $this->_shop_render($sp2cf004->user, $sp2cf004->category, $sp2cf004); } public function shop() { $this->checkIsInMaintain(); $spbbb773 = User::firstOrFail(); return $this->_shop_render($spbbb773); } public function admin() { $sp9d4382 = array(); $sp9d4382['url'] = config('app.url'); if (System::_getInt('product_manual')) { $sp9d4382['functions'] = array('product_manual'); } $sp9d4382['vcode'] = array('driver' => System::_get('vcode_driver'), 'login' => (int) System::_get('vcode_login')); if ($sp9d4382['vcode']['driver'] === 'geetest') { $sp9d4382['vcode']['geetest'] = Geetest\API::get(); } return view('admin', array('config' => $sp9d4382)); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/Card.php b/app/Http/Controllers/Merchant/Card.php
index 3abd8fe1f..534bb221a 100644
--- a/app/Http/Controllers/Merchant/Card.php
+++ b/app/Http/Controllers/Merchant/Card.php
@@ -1,4 +1,4 @@
authQuery($spfeab54, \App\Card::class)->with(array('product' => function ($sp5786ca) { $sp5786ca->select(array('id', 'name')); })); $sped0aef = $spfeab54->input('search', false); $sp86d9ea = $spfeab54->input('val', false); if ($sped0aef && $sp86d9ea) { if ($sped0aef == 'id') { $sp5786ca->where('id', $sp86d9ea); } else { $sp5786ca->where($sped0aef, 'like', '%' . $sp86d9ea . '%'); } } $sp790613 = (int) $spfeab54->input('category_id'); $sp0e30a6 = $spfeab54->input('product_id', -1); if ($sp790613 > 0) { if ($sp0e30a6 > 0) { $sp5786ca->where('product_id', $sp0e30a6); } else { $sp5786ca->whereHas('product', function ($sp5786ca) use($sp790613) { $sp5786ca->where('category_id', $sp790613); }); } } $sp7a9982 = $spfeab54->input('status'); if (strlen($sp7a9982)) { $sp5786ca->whereIn('status', explode(',', $sp7a9982)); } $spad6849 = (int) $spfeab54->input('onlyCanSell'); if ($spad6849) { $sp5786ca->whereRaw('`count_all`>`count_sold`'); } $sp8f5ac7 = $spfeab54->input('type'); if (strlen($sp8f5ac7)) { $sp5786ca->whereIn('type', explode(',', $sp8f5ac7)); } $spd6f8c7 = $spfeab54->input('trashed') === 'true'; if ($spd6f8c7) { $sp5786ca->onlyTrashed(); } if ($sp63c1ab === true) { if ($spd6f8c7) { $sp5786ca->forceDelete(); } else { \App\Card::_trash($sp5786ca); } return Response::success(); } else { if ($spd6f8c7 && $spe223bf === true) { \App\Card::_restore($sp5786ca); return Response::success(); } else { $sp5786ca->orderByRaw('`product_id`,`type`,`status`,`id`'); if ($sp5389f4 === true) { $spb41b87 = ''; $sp5786ca->chunk(100, function ($sp33f345) use(&$spb41b87) { foreach ($sp33f345 as $sp0f75bb) { $spb41b87 .= $sp0f75bb->card . '
-'; } }); $spcf532d = 'export_cards_' . $this->getUserIdOrFail($spfeab54) . '_' . date('YmdHis') . '.txt'; $sp28070b = array('Content-type' => 'text/plain', 'Content-Disposition' => sprintf('attachment; filename="%s"', $spcf532d), 'Content-Length' => strlen($spb41b87)); return response()->make($spb41b87, 200, $sp28070b); } $spd5ff21 = $spfeab54->input('current_page', 1); $sp372a98 = $spfeab54->input('per_page', 20); $spaff91c = $sp5786ca->paginate($sp372a98, array('*'), 'page', $spd5ff21); return Response::success($spaff91c); } } } function export(Request $spfeab54) { return self::get($spfeab54, true); } function trash(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = $spfeab54->post('ids'); $sp5786ca = $this->authQuery($spfeab54, \App\Card::class)->whereIn('id', explode(',', $spbd9db0)); \App\Card::_trash($sp5786ca); return Response::success(); } function restoreTrashed(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = $spfeab54->post('ids'); $sp5786ca = $this->authQuery($spfeab54, \App\Card::class)->whereIn('id', explode(',', $spbd9db0)); \App\Card::_restore($sp5786ca); return Response::success(); } function deleteTrashed(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = $spfeab54->post('ids'); $this->authQuery($spfeab54, \App\Card::class)->whereIn('id', explode(',', $spbd9db0))->forceDelete(); return Response::success(); } function deleteAll(Request $spfeab54) { return $this->get($spfeab54, false, true); } function restoreAll(Request $spfeab54) { return $this->get($spfeab54, false, false, true); } function add(Request $spfeab54) { $sp0e30a6 = (int) $spfeab54->post('product_id'); $sp33f345 = $spfeab54->post('card'); $sp8f5ac7 = (int) $spfeab54->post('type', \App\Card::TYPE_ONETIME); $sp518449 = $spfeab54->post('is_check') === 'true'; if (str_contains($sp33f345, '<') || str_contains($sp33f345, '>')) { return Response::fail('卡密不能包含 < 或 > 符号'); } $spfa021e = $this->getUserIdOrFail($spfeab54); $sp7d5568 = $this->authQuery($spfeab54, \App\Product::class)->where('id', $sp0e30a6); $sp7d5568->firstOrFail(array('id')); if ($sp8f5ac7 === \App\Card::TYPE_REPEAT) { if ($sp518449) { if (\App\Card::where('product_id', $sp0e30a6)->where('card', $sp33f345)->exists()) { return Response::fail('该卡密已经存在,添加失败'); } } $sp0f75bb = new \App\Card(array('user_id' => $spfa021e, 'product_id' => $sp0e30a6, 'card' => $sp33f345, 'type' => \App\Card::TYPE_REPEAT, 'count_sold' => 0, 'count_all' => (int) $spfeab54->post('count_all', 1))); if ($sp0f75bb->count_all < 1 || $sp0f75bb->count_all > 10000000) { return Response::forbidden('可售总次数不能超过10000000'); } return DB::transaction(function () use($sp7d5568, $sp0f75bb) { $sp0f75bb->saveOrFail(); $sp71cb0c = $sp7d5568->lockForUpdate()->firstOrFail(); $sp71cb0c->buy_max = 1; $sp71cb0c->count_all += $sp0f75bb->count_all; $sp71cb0c->saveOrFail(); return Response::success(); }); } else { $sp62ca36 = explode('
-', $sp33f345); $sp88fa34 = count($sp62ca36); $spd766ff = 500; if ($sp88fa34 > $spd766ff) { return Response::fail('每次添加不能超过 ' . $spd766ff . ' 张'); } $sp4a02d3 = array(); if ($sp518449) { $spc5ff53 = \App\Card::where('user_id', $spfa021e)->where('product_id', $sp0e30a6)->get(array('card'))->all(); foreach ($spc5ff53 as $sp10dbb4) { $sp4a02d3[] = $sp10dbb4['card']; } } $spc387f8 = array(); $sp4a4b10 = 0; for ($spea591f = 0; $spea591f < $sp88fa34; $spea591f++) { $sp0f75bb = trim($sp62ca36[$spea591f]); if (strlen($sp0f75bb) < 1) { continue; } if (strlen($sp0f75bb) > 255) { return Response::fail('第 ' . $spea591f . ' 张卡密 ' . $sp0f75bb . ' 长度错误
卡密最大长度为255'); } if ($sp518449) { if (in_array($sp0f75bb, $sp4a02d3)) { continue; } $sp4a02d3[] = $sp0f75bb; } $spc387f8[] = array('user_id' => $spfa021e, 'product_id' => $sp0e30a6, 'card' => $sp0f75bb, 'type' => \App\Card::TYPE_ONETIME); $sp4a4b10++; } if ($sp4a4b10 === 0) { return Response::success(); } return DB::transaction(function () use($sp7d5568, $spc387f8, $sp4a4b10) { \App\Card::insert($spc387f8); $sp71cb0c = $sp7d5568->lockForUpdate()->firstOrFail(); $sp71cb0c->count_all += $sp4a4b10; $sp71cb0c->saveOrFail(); return Response::success(); }); } } function edit(Request $spfeab54) { $sp53f8aa = (int) $spfeab54->post('id'); $sp0f75bb = $this->authQuery($spfeab54, \App\Card::class)->findOrFail($sp53f8aa); if ($sp0f75bb) { $spb80db2 = $spfeab54->post('card'); $sp8f5ac7 = (int) $spfeab54->post('type', \App\Card::TYPE_ONETIME); $spca59a8 = (int) $spfeab54->post('count_all', 1); return DB::transaction(function () use($sp0f75bb, $spb80db2, $sp8f5ac7, $spca59a8) { $sp0f75bb = \App\Card::where('id', $sp0f75bb->id)->lockForUpdate()->firstOrFail(); $sp0f75bb->card = $spb80db2; $sp0f75bb->type = $sp8f5ac7; if ($sp0f75bb->type === \App\Card::TYPE_REPEAT) { if ($spca59a8 < $sp0f75bb->count_sold) { return Response::forbidden('可售总次数不能低于当前已售次数'); } if ($spca59a8 < 1 || $spca59a8 > 10000000) { return Response::forbidden('可售总次数不能超过10000000'); } $sp0f75bb->count_all = $spca59a8; } else { $sp0f75bb->count_all = 1; } $sp0f75bb->saveOrFail(); $sp71cb0c = $sp0f75bb->product()->lockForUpdate()->firstOrFail(); if ($sp0f75bb->type === \App\Card::TYPE_REPEAT) { $sp71cb0c->buy_max = 1; } $sp71cb0c->count_all -= $sp0f75bb->count_all; $sp71cb0c->count_all += $spca59a8; $sp71cb0c->saveOrFail(); return Response::success(); }); } return Response::success(); } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Library\Response; use App\System; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Storage; class Card extends Controller { function get(Request $spf066f3, $spaf67ea = false, $spb6ce1a = false, $speb9a35 = false) { $sp5044a7 = $this->authQuery($spf066f3, \App\Card::class)->with(array('product' => function ($sp5044a7) { $sp5044a7->select(array('id', 'name')); })); $spca736c = $spf066f3->input('search', false); $sp56dec1 = $spf066f3->input('val', false); if ($spca736c && $sp56dec1) { if ($spca736c == 'id') { $sp5044a7->where('id', $sp56dec1); } else { $sp5044a7->where($spca736c, 'like', '%' . $sp56dec1 . '%'); } } $spe478dd = (int) $spf066f3->input('category_id'); $spbb5d29 = $spf066f3->input('product_id', -1); if ($spe478dd > 0) { if ($spbb5d29 > 0) { $sp5044a7->where('product_id', $spbb5d29); } else { $sp5044a7->whereHas('product', function ($sp5044a7) use($spe478dd) { $sp5044a7->where('category_id', $spe478dd); }); } } $sp27b58d = $spf066f3->input('status'); if (strlen($sp27b58d)) { $sp5044a7->whereIn('status', explode(',', $sp27b58d)); } $spa86c4b = (int) $spf066f3->input('onlyCanSell'); if ($spa86c4b) { $sp5044a7->whereRaw('`count_all`>`count_sold`'); } $sp4f56c1 = $spf066f3->input('type'); if (strlen($sp4f56c1)) { $sp5044a7->whereIn('type', explode(',', $sp4f56c1)); } $sp6cb6b8 = $spf066f3->input('trashed') === 'true'; if ($sp6cb6b8) { $sp5044a7->onlyTrashed(); } if ($spb6ce1a === true) { if ($sp6cb6b8) { $sp5044a7->forceDelete(); } else { \App\Card::_trash($sp5044a7); } return Response::success(); } else { if ($sp6cb6b8 && $speb9a35 === true) { \App\Card::_restore($sp5044a7); return Response::success(); } else { $sp5044a7->orderByRaw('`product_id`,`type`,`status`,`id`'); if ($spaf67ea === true) { $sp0de9bb = ''; $sp5044a7->chunk(100, function ($sp54decd) use(&$sp0de9bb) { foreach ($sp54decd as $spc3a8a6) { $sp0de9bb .= $spc3a8a6->card . '
+'; } }); $spc11887 = 'export_cards_' . $this->getUserIdOrFail($spf066f3) . '_' . date('YmdHis') . '.txt'; $spc69671 = array('Content-type' => 'text/plain', 'Content-Disposition' => sprintf('attachment; filename="%s"', $spc11887), 'Content-Length' => strlen($sp0de9bb)); return response()->make($sp0de9bb, 200, $spc69671); } $sp72b123 = $spf066f3->input('current_page', 1); $spcfcad4 = $spf066f3->input('per_page', 20); $sp293456 = $sp5044a7->paginate($spcfcad4, array('*'), 'page', $sp72b123); return Response::success($sp293456); } } } function export(Request $spf066f3) { return self::get($spf066f3, true); } function trash(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = $spf066f3->post('ids'); $sp5044a7 = $this->authQuery($spf066f3, \App\Card::class)->whereIn('id', explode(',', $sp1f71d9)); \App\Card::_trash($sp5044a7); return Response::success(); } function restoreTrashed(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = $spf066f3->post('ids'); $sp5044a7 = $this->authQuery($spf066f3, \App\Card::class)->whereIn('id', explode(',', $sp1f71d9)); \App\Card::_restore($sp5044a7); return Response::success(); } function deleteTrashed(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = $spf066f3->post('ids'); $this->authQuery($spf066f3, \App\Card::class)->whereIn('id', explode(',', $sp1f71d9))->forceDelete(); return Response::success(); } function deleteAll(Request $spf066f3) { return $this->get($spf066f3, false, true); } function restoreAll(Request $spf066f3) { return $this->get($spf066f3, false, false, true); } function add(Request $spf066f3) { $spbb5d29 = (int) $spf066f3->post('product_id'); $sp54decd = $spf066f3->post('card'); $sp4f56c1 = (int) $spf066f3->post('type', \App\Card::TYPE_ONETIME); $spc564ba = $spf066f3->post('is_check') === 'true'; if (str_contains($sp54decd, '<') || str_contains($sp54decd, '>')) { return Response::fail('卡密不能包含 < 或 > 符号'); } $sp15a746 = $this->getUserIdOrFail($spf066f3); $sp273177 = $this->authQuery($spf066f3, \App\Product::class)->where('id', $spbb5d29); $sp273177->firstOrFail(array('id')); if ($sp4f56c1 === \App\Card::TYPE_REPEAT) { if ($spc564ba) { if (\App\Card::where('product_id', $spbb5d29)->where('card', $sp54decd)->exists()) { return Response::fail('该卡密已经存在,添加失败'); } } $spc3a8a6 = new \App\Card(array('user_id' => $sp15a746, 'product_id' => $spbb5d29, 'card' => $sp54decd, 'type' => \App\Card::TYPE_REPEAT, 'count_sold' => 0, 'count_all' => (int) $spf066f3->post('count_all', 1))); if ($spc3a8a6->count_all < 1 || $spc3a8a6->count_all > 10000000) { return Response::forbidden('可售总次数不能超过10000000'); } return DB::transaction(function () use($sp273177, $spc3a8a6) { $spc3a8a6->saveOrFail(); $sp2cf004 = $sp273177->lockForUpdate()->firstOrFail(); $sp2cf004->buy_max = 1; $sp2cf004->count_all += $spc3a8a6->count_all; $sp2cf004->saveOrFail(); return Response::success(); }); } else { $spa5ca46 = explode('
+', $sp54decd); $sp5533b7 = count($spa5ca46); $sp62d1fc = 500; if ($sp5533b7 > $sp62d1fc) { return Response::fail('每次添加不能超过 ' . $sp62d1fc . ' 张'); } $sp74f136 = array(); if ($spc564ba) { $sp697ce2 = \App\Card::where('user_id', $sp15a746)->where('product_id', $spbb5d29)->get(array('card'))->all(); foreach ($sp697ce2 as $sp00625a) { $sp74f136[] = $sp00625a['card']; } } $spd9d278 = array(); $spe07134 = 0; for ($sp6b283c = 0; $sp6b283c < $sp5533b7; $sp6b283c++) { $spc3a8a6 = trim($spa5ca46[$sp6b283c]); if (strlen($spc3a8a6) < 1) { continue; } if (strlen($spc3a8a6) > 255) { return Response::fail('第 ' . $sp6b283c . ' 张卡密 ' . $spc3a8a6 . ' 长度错误
卡密最大长度为255'); } if ($spc564ba) { if (in_array($spc3a8a6, $sp74f136)) { continue; } $sp74f136[] = $spc3a8a6; } $spd9d278[] = array('user_id' => $sp15a746, 'product_id' => $spbb5d29, 'card' => $spc3a8a6, 'type' => \App\Card::TYPE_ONETIME); $spe07134++; } if ($spe07134 === 0) { return Response::success(); } return DB::transaction(function () use($sp273177, $spd9d278, $spe07134) { \App\Card::insert($spd9d278); $sp2cf004 = $sp273177->lockForUpdate()->firstOrFail(); $sp2cf004->count_all += $spe07134; $sp2cf004->saveOrFail(); return Response::success(); }); } } function edit(Request $spf066f3) { $sp3c46ab = (int) $spf066f3->post('id'); $spc3a8a6 = $this->authQuery($spf066f3, \App\Card::class)->findOrFail($sp3c46ab); if ($spc3a8a6) { $spdfa149 = $spf066f3->post('card'); $sp4f56c1 = (int) $spf066f3->post('type', \App\Card::TYPE_ONETIME); $spb3c1e9 = (int) $spf066f3->post('count_all', 1); return DB::transaction(function () use($spc3a8a6, $spdfa149, $sp4f56c1, $spb3c1e9) { $spc3a8a6 = \App\Card::where('id', $spc3a8a6->id)->lockForUpdate()->firstOrFail(); $spc3a8a6->card = $spdfa149; $spc3a8a6->type = $sp4f56c1; if ($spc3a8a6->type === \App\Card::TYPE_REPEAT) { if ($spb3c1e9 < $spc3a8a6->count_sold) { return Response::forbidden('可售总次数不能低于当前已售次数'); } if ($spb3c1e9 < 1 || $spb3c1e9 > 10000000) { return Response::forbidden('可售总次数不能超过10000000'); } $spc3a8a6->count_all = $spb3c1e9; } else { $spc3a8a6->count_all = 1; } $spc3a8a6->saveOrFail(); $sp2cf004 = $spc3a8a6->product()->lockForUpdate()->firstOrFail(); if ($spc3a8a6->type === \App\Card::TYPE_REPEAT) { $sp2cf004->buy_max = 1; } $sp2cf004->count_all -= $spc3a8a6->count_all; $sp2cf004->count_all += $spb3c1e9; $sp2cf004->saveOrFail(); return Response::success(); }); } return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/Category.php b/app/Http/Controllers/Merchant/Category.php
index cb09055d6..eca7ad40f 100644
--- a/app/Http/Controllers/Merchant/Category.php
+++ b/app/Http/Controllers/Merchant/Category.php
@@ -1,2 +1,2 @@
post('current_page', 1); $sp372a98 = $spfeab54->post('per_page', 20); $sp5786ca = $this->authQuery($spfeab54, \App\Category::class); $sped0aef = $spfeab54->post('search', false); $sp86d9ea = $spfeab54->post('val', false); if ($sped0aef && $sp86d9ea) { if ($sped0aef == 'simple') { return Response::success($sp5786ca->get(array('id', 'name'))); } elseif ($sped0aef == 'id') { $sp5786ca->where('id', $sp86d9ea); } else { $sp5786ca->where($sped0aef, 'like', '%' . $sp86d9ea . '%'); } } $sp17fe52 = $spfeab54->post('enabled'); if (strlen($sp17fe52)) { $sp5786ca->whereIn('enabled', explode(',', $sp17fe52)); } $spaff91c = $sp5786ca->withCount('products')->orderBy('sort')->paginate($sp372a98, array('*'), 'page', $spd5ff21); foreach ($spaff91c->items() as $spb7fea4) { $spb7fea4->setAppends(array('url')); } return Response::success($spaff91c); } function sort(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $spb7fea4 = $this->authQuery($spfeab54, \App\Category::class)->findOrFail($spfeab54->post('id')); $spb7fea4->sort = (int) $spfeab54->post('sort', 1000); $spb7fea4->save(); return Response::success(); } function edit(Request $spfeab54) { $this->validate($spfeab54, array('name' => 'required|string|max:128')); $sp505b52 = $spfeab54->post('name'); $sp17fe52 = (int) $spfeab54->post('enabled'); $spea978f = $spfeab54->post('sort'); $spea978f = $spea978f === NULL ? 1000 : (int) $spea978f; if (System::_getInt('filter_words_open') === 1) { $spe40b13 = explode('|', System::_get('filter_words')); if (($spb9589c = Helper::filterWords($sp505b52, $spe40b13)) !== false) { return Response::fail('提交失败! 分类名称包含敏感词: ' . $spb9589c); } } if ($spea978f < 0 || $spea978f > 1000000) { return Response::fail('排序需要在0-1000000之间'); } $spb6833a = $spfeab54->post('password'); $spe8f36f = $spfeab54->post('password_open') === 'true'; if ((int) $spfeab54->post('id')) { $spb7fea4 = $this->authQuery($spfeab54, \App\Category::class)->findOrFail($spfeab54->post('id')); } else { $spb7fea4 = new \App\Category(); $spb7fea4->user_id = $this->getUserIdOrFail($spfeab54); } $spb7fea4->name = $sp505b52; $spb7fea4->sort = $spea978f; $spb7fea4->password = $spb6833a; $spb7fea4->password_open = $spe8f36f; $spb7fea4->enabled = $sp17fe52; $spb7fea4->saveOrFail(); return Response::success(); } function enable(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,1')); $spbd9db0 = $spfeab54->post('ids', ''); $sp17fe52 = (int) $spfeab54->post('enabled'); $this->authQuery($spfeab54, \App\Category::class)->whereIn('id', explode(',', $spbd9db0))->update(array('enabled' => $sp17fe52)); return Response::success(); } function delete(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = $spfeab54->post('ids', ''); $this->authQuery($spfeab54, \App\Category::class)->whereIn('id', explode(',', $spbd9db0))->delete(); return Response::success(); } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Library\Helper; use App\Library\Response; use App\System; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class Category extends Controller { function get(Request $spf066f3) { $sp72b123 = $spf066f3->post('current_page', 1); $spcfcad4 = $spf066f3->post('per_page', 20); $sp5044a7 = $this->authQuery($spf066f3, \App\Category::class); $spca736c = $spf066f3->post('search', false); $sp56dec1 = $spf066f3->post('val', false); if ($spca736c && $sp56dec1) { if ($spca736c == 'simple') { return Response::success($sp5044a7->get(array('id', 'name'))); } elseif ($spca736c == 'id') { $sp5044a7->where('id', $sp56dec1); } else { $sp5044a7->where($spca736c, 'like', '%' . $sp56dec1 . '%'); } } $sp4ec09d = $spf066f3->post('enabled'); if (strlen($sp4ec09d)) { $sp5044a7->whereIn('enabled', explode(',', $sp4ec09d)); } $sp293456 = $sp5044a7->withCount('products')->orderBy('sort')->paginate($spcfcad4, array('*'), 'page', $sp72b123); foreach ($sp293456->items() as $sped57d9) { $sped57d9->setAppends(array('url')); } return Response::success($sp293456); } function sort(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sped57d9 = $this->authQuery($spf066f3, \App\Category::class)->findOrFail($spf066f3->post('id')); $sped57d9->sort = (int) $spf066f3->post('sort', 1000); $sped57d9->save(); return Response::success(); } function edit(Request $spf066f3) { $this->validate($spf066f3, array('name' => 'required|string|max:128')); $sp34e4b5 = $spf066f3->post('name'); $sp4ec09d = (int) $spf066f3->post('enabled'); $sp2ee169 = $spf066f3->post('sort'); $sp2ee169 = $sp2ee169 === NULL ? 1000 : (int) $sp2ee169; if (System::_getInt('filter_words_open') === 1) { $spe817ab = explode('|', System::_get('filter_words')); if (($sp9b52fe = Helper::filterWords($sp34e4b5, $spe817ab)) !== false) { return Response::fail('提交失败! 分类名称包含敏感词: ' . $sp9b52fe); } } if ($sp2ee169 < 0 || $sp2ee169 > 1000000) { return Response::fail('排序需要在0-1000000之间'); } $sp8f68ce = $spf066f3->post('password'); $sp8092e7 = $spf066f3->post('password_open') === 'true'; if ((int) $spf066f3->post('id')) { $sped57d9 = $this->authQuery($spf066f3, \App\Category::class)->findOrFail($spf066f3->post('id')); } else { $sped57d9 = new \App\Category(); $sped57d9->user_id = $this->getUserIdOrFail($spf066f3); } $sped57d9->name = $sp34e4b5; $sped57d9->sort = $sp2ee169; $sped57d9->password = $sp8f68ce; $sped57d9->password_open = $sp8092e7; $sped57d9->enabled = $sp4ec09d; $sped57d9->saveOrFail(); return Response::success(); } function enable(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,1')); $sp1f71d9 = $spf066f3->post('ids', ''); $sp4ec09d = (int) $spf066f3->post('enabled'); $this->authQuery($spf066f3, \App\Category::class)->whereIn('id', explode(',', $sp1f71d9))->update(array('enabled' => $sp4ec09d)); return Response::success(); } function delete(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = $spf066f3->post('ids', ''); $this->authQuery($spf066f3, \App\Category::class)->whereIn('id', explode(',', $sp1f71d9))->delete(); return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/Coupon.php b/app/Http/Controllers/Merchant/Coupon.php
index 9474727c5..919100f88 100644
--- a/app/Http/Controllers/Merchant/Coupon.php
+++ b/app/Http/Controllers/Merchant/Coupon.php
@@ -1,3 +1,3 @@
authQuery($spfeab54, \App\Coupon::class)->with(array('category' => function ($sp5786ca) { $sp5786ca->select(array('id', 'name')); }))->with(array('product' => function ($sp5786ca) { $sp5786ca->select(array('id', 'name')); })); $sped0aef = $spfeab54->post('search', false); $sp86d9ea = $spfeab54->post('val', false); if ($sped0aef && $sp86d9ea) { if ($sped0aef == 'id') { $sp5786ca->where('id', $sp86d9ea); } else { $sp5786ca->where($sped0aef, 'like', '%' . $sp86d9ea . '%'); } } $sp790613 = (int) $spfeab54->post('category_id'); $sp0e30a6 = $spfeab54->post('product_id', -1); if ($sp790613 > 0) { if ($sp0e30a6 > 0) { $sp5786ca->where('product_id', $sp0e30a6); } else { $sp5786ca->where('category_id', $sp790613); } } $sp7a9982 = $spfeab54->post('status'); if (strlen($sp7a9982)) { $sp5786ca->whereIn('status', explode(',', $sp7a9982)); } $sp8f5ac7 = $spfeab54->post('type'); if (strlen($sp8f5ac7)) { $sp5786ca->whereIn('type', explode(',', $sp8f5ac7)); } $sp5786ca->orderByRaw('expire_at DESC,category_id,product_id,type,status'); $spd5ff21 = $spfeab54->post('current_page', 1); $sp372a98 = $spfeab54->post('per_page', 20); $spaff91c = $sp5786ca->paginate($sp372a98, array('*'), 'page', $spd5ff21); return Response::success($spaff91c); } function create(Request $spfeab54) { $spfdb02a = $spfeab54->post('count', 0); $sp8f5ac7 = (int) $spfeab54->post('type', \App\Coupon::TYPE_ONETIME); $spfd6415 = $spfeab54->post('expire_at'); $sp4f286e = (int) $spfeab54->post('discount_val'); $spe83774 = (int) $spfeab54->post('discount_type', \App\Coupon::DISCOUNT_TYPE_AMOUNT); $sp894a06 = $spfeab54->post('remark'); if ($spe83774 === \App\Coupon::DISCOUNT_TYPE_AMOUNT) { if ($sp4f286e < 1 || $sp4f286e > 1000000000) { return Response::fail('优惠券面额需要在0.01-10000000之间'); } } if ($spe83774 === \App\Coupon::DISCOUNT_TYPE_PERCENT) { if ($sp4f286e < 1 || $sp4f286e > 100) { return Response::fail('优惠券面额需要在1-100之间'); } } $sp790613 = (int) $spfeab54->post('category_id', -1); $sp0e30a6 = (int) $spfeab54->post('product_id', -1); if ($sp8f5ac7 === \App\Coupon::TYPE_REPEAT) { $spd5c9d2 = $spfeab54->post('coupon'); if (!$spd5c9d2) { $spd5c9d2 = strtoupper(str_random()); } $sp6fac42 = new \App\Coupon(); $sp6fac42->user_id = $this->getUserIdOrFail($spfeab54); $sp6fac42->category_id = $sp790613; $sp6fac42->product_id = $sp0e30a6; $sp6fac42->coupon = $spd5c9d2; $sp6fac42->type = $sp8f5ac7; $sp6fac42->discount_val = $sp4f286e; $sp6fac42->discount_type = $spe83774; $sp6fac42->count_all = (int) $spfeab54->post('count_all', 1); if ($sp6fac42->count_all < 1 || $sp6fac42->count_all > 10000000) { return Response::fail('可用次数不能超过10000000'); } $sp6fac42->expire_at = $spfd6415; $sp6fac42->saveOrFail(); return Response::success(array($sp6fac42->coupon)); } elseif ($sp8f5ac7 === \App\Coupon::TYPE_ONETIME) { if (!$spfdb02a) { return Response::forbidden('请输入生成数量'); } if ($spfdb02a > 100) { return Response::forbidden('每次生成不能大于100张'); } $spdacc62 = array(); $sp7d188b = array(); $spfa021e = $this->getUserIdOrFail($spfeab54); $sp3df13f = Carbon::now(); for ($spea591f = 0; $spea591f < $spfdb02a; $spea591f++) { $sp6fac42 = strtoupper(str_random()); $sp7d188b[] = $sp6fac42; $spdacc62[] = array('user_id' => $spfa021e, 'coupon' => $sp6fac42, 'category_id' => $sp790613, 'product_id' => $sp0e30a6, 'type' => $sp8f5ac7, 'discount_val' => $sp4f286e, 'discount_type' => $spe83774, 'status' => \App\Coupon::STATUS_NORMAL, 'remark' => $sp894a06, 'created_at' => $sp3df13f, 'expire_at' => $spfd6415); } \App\Coupon::insert($spdacc62); return Response::success($sp7d188b); } else { return Response::forbidden('unknown type: ' . $sp8f5ac7); } } function edit(Request $spfeab54) { $sp53f8aa = (int) $spfeab54->post('id'); $spd5c9d2 = $spfeab54->post('coupon'); $sp790613 = (int) $spfeab54->post('category_id', -1); $sp0e30a6 = (int) $spfeab54->post('product_id', -1); $spfd6415 = $spfeab54->post('expire_at', NULL); $sp7a9982 = (int) $spfeab54->post('status', \App\Coupon::STATUS_NORMAL); $sp8f5ac7 = (int) $spfeab54->post('type', \App\Coupon::TYPE_ONETIME); $sp4f286e = (int) $spfeab54->post('discount_val'); $spe83774 = (int) $spfeab54->post('discount_type', \App\Coupon::DISCOUNT_TYPE_AMOUNT); if ($spe83774 === \App\Coupon::DISCOUNT_TYPE_AMOUNT) { if ($sp4f286e < 1 || $sp4f286e > 1000000000) { return Response::fail('优惠券面额需要在0.01-10000000之间'); } } if ($spe83774 === \App\Coupon::DISCOUNT_TYPE_PERCENT) { if ($sp4f286e < 1 || $sp4f286e > 100) { return Response::fail('优惠券面额需要在1-100之间'); } } $sp6fac42 = $this->authQuery($spfeab54, \App\Coupon::class)->find($sp53f8aa); if ($sp6fac42) { $sp6fac42->coupon = $spd5c9d2; $sp6fac42->category_id = $sp790613; $sp6fac42->product_id = $sp0e30a6; $sp6fac42->status = $sp7a9982; $sp6fac42->type = $sp8f5ac7; $sp6fac42->discount_val = $sp4f286e; $sp6fac42->discount_type = $spe83774; if ($sp8f5ac7 === \App\Coupon::TYPE_REPEAT) { $sp6fac42->count_all = (int) $spfeab54->post('count_all', 1); if ($sp6fac42->count_all < 1 || $sp6fac42->count_all > 10000000) { return Response::fail('可用次数不能超过10000000'); } } if ($spfd6415) { $sp6fac42->expire_at = $spfd6415; } $sp6fac42->saveOrFail(); } else { $spab71bc = explode('
-', $spd5c9d2); for ($spea591f = 0; $spea591f < count($spab71bc); $spea591f++) { $spa388e1 = str_replace('
', '', trim($spab71bc[$spea591f])); $sp6fac42 = new \App\Coupon(); $sp6fac42->coupon = $spa388e1; $sp6fac42->category_id = $sp790613; $sp6fac42->product_id = $sp0e30a6; $sp6fac42->status = $sp7a9982; $sp6fac42->type = $sp8f5ac7; $sp6fac42->discount_val = $sp4f286e; $sp6fac42->discount_type = $spe83774; $spab71bc[$spea591f] = $sp6fac42; } \App\Product::find($sp0e30a6)->coupons()->saveMany($spab71bc); } return Response::success(); } function enable(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,1')); $spbd9db0 = $spfeab54->post('ids'); $sp17fe52 = (int) $spfeab54->post('enabled'); $this->authQuery($spfeab54, \App\Coupon::class)->whereIn('id', explode(',', $spbd9db0))->update(array('enabled' => $sp17fe52)); return Response::success(); } function delete(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = $spfeab54->post('ids'); $this->authQuery($spfeab54, \App\Coupon::class)->whereIn('id', explode(',', $spbd9db0))->delete(); return Response::success(); } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Library\Response; use Carbon\Carbon; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class Coupon extends Controller { function get(Request $spf066f3) { $sp5044a7 = $this->authQuery($spf066f3, \App\Coupon::class)->with(array('category' => function ($sp5044a7) { $sp5044a7->select(array('id', 'name')); }))->with(array('product' => function ($sp5044a7) { $sp5044a7->select(array('id', 'name')); })); $spca736c = $spf066f3->post('search', false); $sp56dec1 = $spf066f3->post('val', false); if ($spca736c && $sp56dec1) { if ($spca736c == 'id') { $sp5044a7->where('id', $sp56dec1); } else { $sp5044a7->where($spca736c, 'like', '%' . $sp56dec1 . '%'); } } $spe478dd = (int) $spf066f3->post('category_id'); $spbb5d29 = $spf066f3->post('product_id', -1); if ($spe478dd > 0) { if ($spbb5d29 > 0) { $sp5044a7->where('product_id', $spbb5d29); } else { $sp5044a7->where('category_id', $spe478dd); } } $sp27b58d = $spf066f3->post('status'); if (strlen($sp27b58d)) { $sp5044a7->whereIn('status', explode(',', $sp27b58d)); } $sp4f56c1 = $spf066f3->post('type'); if (strlen($sp4f56c1)) { $sp5044a7->whereIn('type', explode(',', $sp4f56c1)); } $sp5044a7->orderByRaw('expire_at DESC,category_id,product_id,type,status'); $sp72b123 = $spf066f3->post('current_page', 1); $spcfcad4 = $spf066f3->post('per_page', 20); $sp293456 = $sp5044a7->paginate($spcfcad4, array('*'), 'page', $sp72b123); return Response::success($sp293456); } function create(Request $spf066f3) { $spdd51cd = $spf066f3->post('count', 0); $sp4f56c1 = (int) $spf066f3->post('type', \App\Coupon::TYPE_ONETIME); $spe84656 = $spf066f3->post('expire_at'); $spa6d6f0 = (int) $spf066f3->post('discount_val'); $spf42f1f = (int) $spf066f3->post('discount_type', \App\Coupon::DISCOUNT_TYPE_AMOUNT); $sp615115 = $spf066f3->post('remark'); if ($spf42f1f === \App\Coupon::DISCOUNT_TYPE_AMOUNT) { if ($spa6d6f0 < 1 || $spa6d6f0 > 1000000000) { return Response::fail('优惠券面额需要在0.01-10000000之间'); } } if ($spf42f1f === \App\Coupon::DISCOUNT_TYPE_PERCENT) { if ($spa6d6f0 < 1 || $spa6d6f0 > 100) { return Response::fail('优惠券面额需要在1-100之间'); } } $spe478dd = (int) $spf066f3->post('category_id', -1); $spbb5d29 = (int) $spf066f3->post('product_id', -1); if ($sp4f56c1 === \App\Coupon::TYPE_REPEAT) { $sp38c2cc = $spf066f3->post('coupon'); if (!$sp38c2cc) { $sp38c2cc = strtoupper(str_random()); } $sp9f96c5 = new \App\Coupon(); $sp9f96c5->user_id = $this->getUserIdOrFail($spf066f3); $sp9f96c5->category_id = $spe478dd; $sp9f96c5->product_id = $spbb5d29; $sp9f96c5->coupon = $sp38c2cc; $sp9f96c5->type = $sp4f56c1; $sp9f96c5->discount_val = $spa6d6f0; $sp9f96c5->discount_type = $spf42f1f; $sp9f96c5->count_all = (int) $spf066f3->post('count_all', 1); if ($sp9f96c5->count_all < 1 || $sp9f96c5->count_all > 10000000) { return Response::fail('可用次数不能超过10000000'); } $sp9f96c5->expire_at = $spe84656; $sp9f96c5->saveOrFail(); return Response::success(array($sp9f96c5->coupon)); } elseif ($sp4f56c1 === \App\Coupon::TYPE_ONETIME) { if (!$spdd51cd) { return Response::forbidden('请输入生成数量'); } if ($spdd51cd > 100) { return Response::forbidden('每次生成不能大于100张'); } $sp659504 = array(); $sp3d4029 = array(); $sp15a746 = $this->getUserIdOrFail($spf066f3); $spdfb5de = Carbon::now(); for ($sp6b283c = 0; $sp6b283c < $spdd51cd; $sp6b283c++) { $sp9f96c5 = strtoupper(str_random()); $sp3d4029[] = $sp9f96c5; $sp659504[] = array('user_id' => $sp15a746, 'coupon' => $sp9f96c5, 'category_id' => $spe478dd, 'product_id' => $spbb5d29, 'type' => $sp4f56c1, 'discount_val' => $spa6d6f0, 'discount_type' => $spf42f1f, 'status' => \App\Coupon::STATUS_NORMAL, 'remark' => $sp615115, 'created_at' => $spdfb5de, 'expire_at' => $spe84656); } \App\Coupon::insert($sp659504); return Response::success($sp3d4029); } else { return Response::forbidden('unknown type: ' . $sp4f56c1); } } function edit(Request $spf066f3) { $sp3c46ab = (int) $spf066f3->post('id'); $sp38c2cc = $spf066f3->post('coupon'); $spe478dd = (int) $spf066f3->post('category_id', -1); $spbb5d29 = (int) $spf066f3->post('product_id', -1); $spe84656 = $spf066f3->post('expire_at', NULL); $sp27b58d = (int) $spf066f3->post('status', \App\Coupon::STATUS_NORMAL); $sp4f56c1 = (int) $spf066f3->post('type', \App\Coupon::TYPE_ONETIME); $spa6d6f0 = (int) $spf066f3->post('discount_val'); $spf42f1f = (int) $spf066f3->post('discount_type', \App\Coupon::DISCOUNT_TYPE_AMOUNT); if ($spf42f1f === \App\Coupon::DISCOUNT_TYPE_AMOUNT) { if ($spa6d6f0 < 1 || $spa6d6f0 > 1000000000) { return Response::fail('优惠券面额需要在0.01-10000000之间'); } } if ($spf42f1f === \App\Coupon::DISCOUNT_TYPE_PERCENT) { if ($spa6d6f0 < 1 || $spa6d6f0 > 100) { return Response::fail('优惠券面额需要在1-100之间'); } } $sp9f96c5 = $this->authQuery($spf066f3, \App\Coupon::class)->find($sp3c46ab); if ($sp9f96c5) { $sp9f96c5->coupon = $sp38c2cc; $sp9f96c5->category_id = $spe478dd; $sp9f96c5->product_id = $spbb5d29; $sp9f96c5->status = $sp27b58d; $sp9f96c5->type = $sp4f56c1; $sp9f96c5->discount_val = $spa6d6f0; $sp9f96c5->discount_type = $spf42f1f; if ($sp4f56c1 === \App\Coupon::TYPE_REPEAT) { $sp9f96c5->count_all = (int) $spf066f3->post('count_all', 1); if ($sp9f96c5->count_all < 1 || $sp9f96c5->count_all > 10000000) { return Response::fail('可用次数不能超过10000000'); } } if ($spe84656) { $sp9f96c5->expire_at = $spe84656; } $sp9f96c5->saveOrFail(); } else { $spc3e8c0 = explode('
+', $sp38c2cc); for ($sp6b283c = 0; $sp6b283c < count($spc3e8c0); $sp6b283c++) { $sp6fb42e = str_replace('
', '', trim($spc3e8c0[$sp6b283c])); $sp9f96c5 = new \App\Coupon(); $sp9f96c5->coupon = $sp6fb42e; $sp9f96c5->category_id = $spe478dd; $sp9f96c5->product_id = $spbb5d29; $sp9f96c5->status = $sp27b58d; $sp9f96c5->type = $sp4f56c1; $sp9f96c5->discount_val = $spa6d6f0; $sp9f96c5->discount_type = $spf42f1f; $spc3e8c0[$sp6b283c] = $sp9f96c5; } \App\Product::find($spbb5d29)->coupons()->saveMany($spc3e8c0); } return Response::success(); } function enable(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string', 'enabled' => 'required|integer|between:0,1')); $sp1f71d9 = $spf066f3->post('ids'); $sp4ec09d = (int) $spf066f3->post('enabled'); $this->authQuery($spf066f3, \App\Coupon::class)->whereIn('id', explode(',', $sp1f71d9))->update(array('enabled' => $sp4ec09d)); return Response::success(); } function delete(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = $spf066f3->post('ids'); $this->authQuery($spf066f3, \App\Coupon::class)->whereIn('id', explode(',', $sp1f71d9))->delete(); return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/File.php b/app/Http/Controllers/Merchant/File.php
index 666d5bfb7..c9d6894b4 100644
--- a/app/Http/Controllers/Merchant/File.php
+++ b/app/Http/Controllers/Merchant/File.php
@@ -1,2 +1,2 @@
extension(); } catch (\Throwable $sp81eee8) { return Response::fail($sp81eee8->getMessage()); } if (!$sp7c04ba || !in_array(strtolower($sp8d4fd9), array('jpg', 'jpeg', 'png', 'gif'))) { return Response::fail('图片错误, 系统支持jpg/png/gif格式'); } if ($sp7c04ba->getSize() > 5 * 1024 * 1024) { return Response::fail('图片不能大于5MB'); } try { $sp61aa55 = $sp7c04ba->store($sp5a8117, array('disk' => System::_get('storage_driver'))); } catch (\Exception $sp81eee8) { \Log::error('File.uploadImg folder:' . $sp5a8117 . ', error:' . $sp81eee8->getMessage(), array('exception' => $sp81eee8)); if (config('app.debug')) { return Response::fail($sp81eee8->getMessage()); } else { return Response::fail('上传文件失败, 内部错误, 请联系客服'); } } if (!$sp61aa55) { return Response::fail('系统保存文件出错, 请稍后再试'); } $sp33ee9e = System::_get('storage_driver'); $sp3db1b2 = Storage::disk($sp33ee9e)->url($sp61aa55); $spe26681 = \App\File::insertGetId(array('user_id' => $spfa021e, 'driver' => $sp33ee9e, 'path' => $sp61aa55, 'url' => $sp3db1b2)); if ($spe26681 < 1) { Storage::disk($sp33ee9e)->delete($sp61aa55); return Response::fail('数据库繁忙,请稍后再试'); } $spb9589c = array('id' => $spe26681, 'url' => $sp3db1b2, 'name' => pathinfo($sp61aa55, PATHINFO_BASENAME)); if ($sp3deb4f) { return $spb9589c; } return Response::success($spb9589c); } function upload_merchant(Request $spfeab54) { $spafa70b = $this->getUser($spfeab54); if ($spafa70b === null) { return Response::forbidden('无效的用户'); } $sp7c04ba = $spfeab54->file('file'); return $this->uploadImg($sp7c04ba, $spafa70b->id, \App\File::getProductFolder()); } public function renderImage(Request $spfeab54, $sp40a3a6) { if (str_contains($sp40a3a6, '..') || str_contains($sp40a3a6, './') || str_contains($sp40a3a6, '.\\') || !starts_with($sp40a3a6, 'images/')) { $sp02ec60 = file_get_contents(public_path('images/illegal.jpg')); } else { $sp40a3a6 = str_replace('\\', '/', $sp40a3a6); $sp7c04ba = \App\File::wherePath($sp40a3a6)->first(); if ($sp7c04ba) { $sp33ee9e = $sp7c04ba->driver; } else { $sp33ee9e = System::_get('storage_driver'); } if (!in_array($sp33ee9e, array('local', 's3', 'oss', 'qiniu'))) { return response()->view('message', array('title' => '404', 'message' => '404 Driver NotFound'), 404); } try { $sp02ec60 = Storage::disk($sp33ee9e)->get($sp40a3a6); } catch (\Illuminate\Contracts\Filesystem\FileNotFoundException $sp81eee8) { \Log::error('File.renderImage error: ' . $sp81eee8->getMessage(), array('exception' => $sp81eee8)); return response()->view('message', array('title' => '404', 'message' => '404 NotFound'), 404); } } ob_end_clean(); header('Content-Type: ' . mimetype_from_filename($sp40a3a6)); die($sp02ec60); } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Library\Response; use App\System; use function GuzzleHttp\Psr7\mimetype_from_filename; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Storage; class File extends Controller { public static function uploadImg($sp7819f2, $sp15a746, $sp0332ad, $sp8dd66e = false) { try { $sp078d84 = $sp7819f2->extension(); } catch (\Throwable $sp3f4aab) { return Response::fail($sp3f4aab->getMessage()); } if (!$sp7819f2 || !in_array(strtolower($sp078d84), array('jpg', 'jpeg', 'png', 'gif'))) { return Response::fail('图片错误, 系统支持jpg/png/gif格式'); } if ($sp7819f2->getSize() > 5 * 1024 * 1024) { return Response::fail('图片不能大于5MB'); } try { $sp14400e = $sp7819f2->store($sp0332ad, array('disk' => System::_get('storage_driver'))); } catch (\Exception $sp3f4aab) { \Log::error('File.uploadImg folder:' . $sp0332ad . ', error:' . $sp3f4aab->getMessage(), array('exception' => $sp3f4aab)); if (config('app.debug')) { return Response::fail($sp3f4aab->getMessage()); } else { return Response::fail('上传文件失败, 内部错误, 请联系客服'); } } if (!$sp14400e) { return Response::fail('系统保存文件出错, 请稍后再试'); } $spd1dcf7 = System::_get('storage_driver'); $spd2457c = Storage::disk($spd1dcf7)->url($sp14400e); $sp899977 = \App\File::insertGetId(array('user_id' => $sp15a746, 'driver' => $spd1dcf7, 'path' => $sp14400e, 'url' => $spd2457c)); if ($sp899977 < 1) { Storage::disk($spd1dcf7)->delete($sp14400e); return Response::fail('数据库繁忙,请稍后再试'); } $sp9b52fe = array('id' => $sp899977, 'url' => $spd2457c, 'name' => pathinfo($sp14400e, PATHINFO_BASENAME)); if ($sp8dd66e) { return $sp9b52fe; } return Response::success($sp9b52fe); } function upload_merchant(Request $spf066f3) { $spbbb773 = $this->getUser($spf066f3); if ($spbbb773 === null) { return Response::forbidden('无效的用户'); } $sp7819f2 = $spf066f3->file('file'); return $this->uploadImg($sp7819f2, $spbbb773->id, \App\File::getProductFolder()); } public function renderImage(Request $spf066f3, $sp0dbcdb) { if (str_contains($sp0dbcdb, '..') || str_contains($sp0dbcdb, './') || str_contains($sp0dbcdb, '.\\') || !starts_with($sp0dbcdb, 'images/')) { $sp0114c4 = file_get_contents(public_path('images/illegal.jpg')); } else { $sp0dbcdb = str_replace('\\', '/', $sp0dbcdb); $sp7819f2 = \App\File::wherePath($sp0dbcdb)->first(); if ($sp7819f2) { $spd1dcf7 = $sp7819f2->driver; } else { $spd1dcf7 = System::_get('storage_driver'); } if (!in_array($spd1dcf7, array('local', 's3', 'oss', 'qiniu'))) { return response()->view('message', array('title' => '404', 'message' => '404 Driver NotFound'), 404); } try { $sp0114c4 = Storage::disk($spd1dcf7)->get($sp0dbcdb); } catch (\Illuminate\Contracts\Filesystem\FileNotFoundException $sp3f4aab) { \Log::error('File.renderImage error: ' . $sp3f4aab->getMessage(), array('exception' => $sp3f4aab)); return response()->view('message', array('title' => '404', 'message' => '404 NotFound'), 404); } } ob_end_clean(); header('Content-Type: ' . mimetype_from_filename($sp0dbcdb)); die($sp0114c4); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/Log.php b/app/Http/Controllers/Merchant/Log.php
index 26252a977..9b224d11b 100644
--- a/app/Http/Controllers/Merchant/Log.php
+++ b/app/Http/Controllers/Merchant/Log.php
@@ -1,2 +1,2 @@
post('user_id'); $spce52fe = $spfeab54->post('action', \App\Log::ACTION_LOGIN); $sp5786ca = \App\Log::where('action', $spce52fe); $sp5786ca->where('user_id', Auth::id()); $spd3b73a = $spfeab54->post('start_at'); if (strlen($spd3b73a)) { $sp5786ca->where('created_at', '>=', $spd3b73a . ' 00:00:00'); } $sp694c55 = $spfeab54->post('end_at'); if (strlen($sp694c55)) { $sp5786ca->where('created_at', '<=', $sp694c55 . ' 23:59:59'); } $spd5ff21 = $spfeab54->post('current_page', 1); $sp372a98 = $spfeab54->post('per_page', 20); $spaff91c = $sp5786ca->orderBy('created_at', 'DESC')->paginate($sp372a98, array('*'), 'page', $spd5ff21); return Response::success($spaff91c); } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Library\Response; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; class Log extends Controller { function get(Request $spf066f3) { $sp15a746 = $spf066f3->post('user_id'); $sp3786fd = $spf066f3->post('action', \App\Log::ACTION_LOGIN); $sp5044a7 = \App\Log::where('action', $sp3786fd); $sp5044a7->where('user_id', Auth::id()); $spba7d12 = $spf066f3->post('start_at'); if (strlen($spba7d12)) { $sp5044a7->where('created_at', '>=', $spba7d12 . ' 00:00:00'); } $sp3bf1fb = $spf066f3->post('end_at'); if (strlen($sp3bf1fb)) { $sp5044a7->where('created_at', '<=', $sp3bf1fb . ' 23:59:59'); } $sp72b123 = $spf066f3->post('current_page', 1); $spcfcad4 = $spf066f3->post('per_page', 20); $sp293456 = $sp5044a7->orderBy('created_at', 'DESC')->paginate($spcfcad4, array('*'), 'page', $sp72b123); return Response::success($sp293456); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/Order.php b/app/Http/Controllers/Merchant/Order.php
index f88534afb..3e674be2d 100644
--- a/app/Http/Controllers/Merchant/Order.php
+++ b/app/Http/Controllers/Merchant/Order.php
@@ -1,4 +1,4 @@
authQuery($spfeab54, \App\Order::class); $sp790613 = (int) $spfeab54->input('category_id'); $sp0e30a6 = (int) $spfeab54->input('product_id'); $sp6b0fdc = (int) $spfeab54->input('profit'); $spc32d4d = $sp790613 === \App\Product::ID_API || $sp0e30a6 === \App\Product::ID_API; $sped0aef = $spfeab54->input('search', false); $sp86d9ea = $spfeab54->input('val', false); if ($sped0aef && $sp86d9ea) { if ($sped0aef == 'id' || $sped0aef == 'order_no' || $sped0aef === 'pay_trade_no' || $sped0aef === 'api_out_no') { $sp5786ca->where($sped0aef, $sp86d9ea); } else { $sp5786ca->where($sped0aef, 'like', '%' . $sp86d9ea . '%'); } } if ($sp790613 > 0) { if ($sp0e30a6 > 0) { $sp5786ca->where('product_id', $sp0e30a6); } else { $sp5786ca->whereHas('product', function ($sp5786ca) use($sp790613) { $sp5786ca->where('category_id', $sp790613); }); } } $sp5cfe40 = (int) $spfeab54->input('recent', 0); if ($sp5cfe40) { $spd3b73a = (new Carbon())->addDay(-$sp5cfe40); $sp5786ca->where(function ($sp5786ca) use($spd3b73a) { $sp5786ca->where('paid_at', '>=', $spd3b73a)->orWhere(function ($sp5786ca) use($spd3b73a) { $sp5786ca->whereNull('paid_at')->where('created_at', '>=', $spd3b73a); }); }); } else { $spd3b73a = $spfeab54->input('start_at', false); if (strlen($spd3b73a)) { $sp5786ca->where(function ($sp5786ca) use($spd3b73a) { $sp5786ca->where('paid_at', '>=', $spd3b73a . ' 00:00:00')->orWhere(function ($sp5786ca) use($spd3b73a) { $sp5786ca->whereNull('paid_at')->where('created_at', '>=', $spd3b73a . ' 00:00:00'); }); }); } $sp694c55 = $spfeab54->input('end_at', false); if (strlen($sp694c55)) { $sp5786ca->where(function ($sp5786ca) use($sp694c55) { $sp5786ca->where('paid_at', '<=', $sp694c55 . ' 23:59:59')->orWhere(function ($sp5786ca) use($sp694c55) { $sp5786ca->whereNull('paid_at')->where('created_at', '<=', $sp694c55 . ' 23:59:59'); }); }); } } if ($sp6b0fdc) { $sp5786ca->where('status', \App\Order::STATUS_SUCCESS); $sp140d8b = clone $sp5786ca; $sp4ebdb2 = $sp140d8b->selectRaw('SUM(`income`) as income, SUM(`paid`-`sms_price`-`cost`-`fee`) as profit')->first(); } else { $sp7a9982 = $spfeab54->input('status'); if (strlen($sp7a9982)) { $sp5786ca->whereIn('status', explode(',', $sp7a9982)); } else { $sp5786ca->where('status', '!=', \App\Order::STATUS_UNPAY); } } if ($spc32d4d) { $sp5786ca->where('product_id', \App\Product::ID_API); } else { $sp5786ca->where('product_id', '>', 0); $sp5786ca->with(array('product' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'name', 'delivery')); }, 'card_orders.card' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'card')); })); } $sp5786ca->with(array('pay' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'name')); })); $sp5786ca->orderBy('id', 'DESC'); if ($sp5389f4 === true) { $spe292f7 = (int) $spfeab54->input('export_update_status'); $sp483f11 = $spfeab54->input('export_update_card'); $spcbd397 = ''; $spcbd397 .= '"订单号","商品名称","下单时间","订单金额","优惠金额","实付金额","手续费","成本价","利润","支付方式","支付流水号","支付时间","订单状态","买家联系方式","买家附加信息"' . '
-'; $sp5786ca->chunk(100, function ($spc544b7) use(&$spcbd397, $spe292f7, $sp483f11) { foreach ($spc544b7 as $sp4f4c0d) { if ($sp4f4c0d->status === \App\Order::STATUS_PAID) { if ($spe292f7 === \App\Order::SEND_STATUS_CARD_PROCESSING) { $sp4f4c0d->send_status = $spe292f7; $sp4f4c0d->saveOrFail(); } elseif ($spe292f7 === \App\Order::SEND_STATUS_CARD_SUCCESS) { $sp4f4c0d->send_status = $spe292f7; $sp4f4c0d->saveOrFail(); $this->ship(new Request(array('id' => $sp4f4c0d->id, 'card' => $sp483f11))); } } $sp5e5f4d = $sp4f4c0d->contact_ext; if ($sp5e5f4d) { if ($sp5e5f4d[0] === '[') { $sp5e5f4d = substr($sp5e5f4d, 2); } if ($sp5e5f4d[strlen($sp5e5f4d) - 1] === ']') { $sp5e5f4d = substr($sp5e5f4d, 0, -2); } } $spcbd397 .= '"' . $sp4f4c0d->order_no . '","' . $sp4f4c0d->product_name . '","' . $sp4f4c0d->created_at . '","' . sprintf('%.2f', $sp4f4c0d->price / 100) . '","' . sprintf('%.2f', $sp4f4c0d->discount / 100) . '","' . sprintf('%.2f', $sp4f4c0d->paid / 100) . '","' . sprintf('%.2f', $sp4f4c0d->fee / 100) . '","' . sprintf('%.2f', $sp4f4c0d->cost / 100) . '","' . sprintf('%.2f', ($sp4f4c0d->paid - $sp4f4c0d->fee - $sp4f4c0d->cost) / 100) . '","' . ($sp4f4c0d->pay ? $sp4f4c0d->pay->name : '未知#' . $sp4f4c0d->pay_id) . '","' . $sp4f4c0d->pay_trade_no . '","' . $sp4f4c0d->paid_at . '","' . \App\Order::STATUS[$sp4f4c0d->status] . '","' . $sp4f4c0d->contact . '","' . $sp5e5f4d . '"'; $spcbd397 .= '
-'; } }); $spcf532d = 'export_orders_' . $this->getUserIdOrFail($spfeab54) . '_' . date('YmdHis') . '.csv'; $sp28070b = array('Content-type' => 'text/plain', 'Content-Disposition' => sprintf('attachment; filename="%s"', $spcf532d), 'Content-Length' => strlen($spcbd397)); return response()->make($spcbd397, 200, $sp28070b); } $spd5ff21 = $spfeab54->input('current_page', 1); $sp372a98 = $spfeab54->input('per_page', 20); $spaff91c = $sp5786ca->paginate($sp372a98, array('*'), 'page', $spd5ff21); if ($sp6b0fdc) { $spaff91c = $spaff91c->toArray(); $spaff91c['profit_sum'] = $sp4ebdb2; } return Response::success($spaff91c); } function export(Request $spfeab54) { return self::get($spfeab54, true); } function stat(Request $spfeab54) { $this->validate($spfeab54, array('day' => 'required|integer|between:7,30')); $sp842b0e = (int) $spfeab54->input('day'); if ($sp842b0e === 30) { $spa470da = Carbon::now()->addMonths(-1); } else { $spa470da = Carbon::now()->addDays(-$sp842b0e); } $spaff91c = $this->authQuery($spfeab54, \App\Order::class)->where(function ($sp5786ca) { $sp5786ca->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', $spa470da)->groupBy('date')->orderBy('date', 'DESC')->selectRaw('DATE(`paid_at`) as "date",COUNT(*) as "count",SUM(`paid`) as "paid",SUM(`paid`-`sms_price`-`cost`-`fee`) as "profit"')->get()->toArray(); $spb9589c = array(); foreach ($spaff91c as $sp4a9ec3) { $spb9589c[$sp4a9ec3['date']] = array((int) $sp4a9ec3['count'], (int) $sp4a9ec3['paid'], (int) $sp4a9ec3['profit']); } return Response::success($spb9589c); } function info(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp53f8aa = $spfeab54->input('id'); $sp4f4c0d = $this->authQuery($spfeab54, \App\Order::class)->with(array('pay' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'name')); }, 'card_orders.card' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'card')); }))->findOrFail($sp53f8aa); $sp4f4c0d->addHidden(array('system_fee')); return Response::success($sp4f4c0d); } function remark(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer', 'remark' => 'required|string')); $sp53f8aa = $spfeab54->input('id'); $sp4f4c0d = $this->authQuery($spfeab54, \App\Order::class)->findOrFail($sp53f8aa); $sp4f4c0d->remark = $spfeab54->input('remark'); $sp4f4c0d->save(); return Response::success(); } function set_send_status(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer', 'send_status' => 'required|integer')); $sp53f8aa = $spfeab54->input('id'); $sp4f4c0d = $this->authQuery($spfeab54, \App\Order::class)->findOrFail($sp53f8aa); if ($sp4f4c0d->status !== \App\Order::STATUS_PAID) { return Response::fail('此订单不是未发货状态, 无法增加发货标记'); } $sp4f4c0d->send_status = $spfeab54->input('send_status'); $sp4f4c0d->saveOrFail(); return Response::success(); } function ship(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer')); $sp4f4c0d = $this->authQuery($spfeab54, \App\Order::class)->with('product')->findOrFail($spfeab54->input('id')); if ($sp4f4c0d->status !== \App\Order::STATUS_PAID) { return Response::fail('订单不是待发货状态, 无法发货'); } if ($sp4f4c0d->product === null) { return Response::fail('订单对应商品不存在, 无法发货'); } $spcda929 = $sp4f4c0d->product->delivery; $spe64362 = ''; if ($spcda929 === \App\Product::DELIVERY_MANUAL) { $this->validate($spfeab54, array('card' => 'required|string')); $spe64362 = $spfeab54->input('card'); } $sp3d7336 = null; $sp62ca36 = array(); if (FundHelper::orderSuccess($sp4f4c0d->id, function () use(&$sp4f4c0d, &$sp3d7336, &$sp62ca36, $spcda929, $spe64362) { $sp4f4c0d = \App\Order::where('id', $sp4f4c0d->id)->lockForUpdate()->firstOrFail(); if ($sp4f4c0d->cards && count($sp4f4c0d->cards)) { $sp3d7336 = '该订单已经发货,无需再次发货'; return false; } $sp71cb0c = $sp4f4c0d->product()->lockForUpdate()->firstOrFail(); if ($spcda929 === \App\Product::DELIVERY_MANUAL) { $sp4f4c0d->status = \App\Order::STATUS_SUCCESS; $sp4f4c0d->send_status = \App\Order::SEND_STATUS_CARD_SUCCESS; $sp4f4c0d->saveOrFail(); $sp0f75bb = \App\Card::create(array('user_id' => Auth::id(), 'product_id' => $sp71cb0c->id, 'card' => $spe64362, 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_SOLD, 'count_sold' => 1, 'count_all' => 1)); $sp62ca36[] = $sp0f75bb->card; $sp4f4c0d->cards()->attach($sp0f75bb->id); $sp71cb0c->count_sold += $sp4f4c0d->count; $sp71cb0c->saveOrFail(); return FundHelper::ACTION_CONTINUE; } $sp33f345 = \App\Card::where('product_id', $sp71cb0c->id)->whereRaw('`count_sold`<`count_all`')->take($sp4f4c0d->count)->lockForUpdate()->get(); if (count($sp33f345) !== $sp4f4c0d->count) { $sp3d7336 = '商品卡密不足, 请添加卡密后再发货'; return false; } else { $sp4f4c0d->status = \App\Order::STATUS_SUCCESS; $sp4f4c0d->saveOrFail(); $sp011030 = array(); foreach ($sp33f345 as $sp0f75bb) { $sp011030[] = $sp0f75bb->id; $sp62ca36[] = $sp0f75bb->card; } $sp4f4c0d->cards()->attach($sp011030); \App\Card::whereIn('id', $sp011030)->update(array('status' => \App\Card::STATUS_SOLD, 'count_sold' => DB::raw('`count_sold`+1'))); $sp71cb0c->count_sold += $sp4f4c0d->count; $sp71cb0c->saveOrFail(); return FundHelper::ACTION_CONTINUE; } })) { if (System::_getInt('mail_send_order')) { $sp4c999d = @json_decode($sp4f4c0d->contact_ext, true)['_mail']; if ($sp4c999d) { $sp4f4c0d->sendEmail($sp4c999d); } } if ($sp4f4c0d->status === \App\Order::STATUS_SUCCESS && System::_getInt('sms_send_order')) { $sp6566f0 = @json_decode($sp4f4c0d->contact_ext, true)['_mobile']; if ($sp6566f0) { $sp4f4c0d->sendSms($sp6566f0); } } $sp4f4c0d['card_orders'] = array_map(function ($sp4a9ec3) { return array('card' => array('card' => $sp4a9ec3)); }, $sp62ca36); $sp4f4c0d->addHidden(array('system_fee')); return Response::success($sp4f4c0d); } else { return Response::fail($sp3d7336 ?? '数据库繁忙, 请联系客服'); } } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Http\Controllers\Shop\ApiPay; use App\Library\CurlRequest; use App\Library\FundHelper; use App\Library\Helper; use App\Library\Response; use App\Mail\OrderShipped; use App\System; use Carbon\Carbon; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; class Order extends Controller { function get(Request $spf066f3, $spaf67ea = false) { $sp5044a7 = $this->authQuery($spf066f3, \App\Order::class); $spe478dd = (int) $spf066f3->input('category_id'); $spbb5d29 = (int) $spf066f3->input('product_id'); $spd16e61 = (int) $spf066f3->input('profit'); $spa4ff3c = $spe478dd === \App\Product::ID_API || $spbb5d29 === \App\Product::ID_API; $spca736c = $spf066f3->input('search', false); $sp56dec1 = $spf066f3->input('val', false); if ($spca736c && $sp56dec1) { if ($spca736c == 'id' || $spca736c == 'order_no' || $spca736c === 'pay_trade_no' || $spca736c === 'api_out_no') { $sp5044a7->where($spca736c, $sp56dec1); } else { $sp5044a7->where($spca736c, 'like', '%' . $sp56dec1 . '%'); } } if ($spe478dd > 0) { if ($spbb5d29 > 0) { $sp5044a7->where('product_id', $spbb5d29); } else { $sp5044a7->whereHas('product', function ($sp5044a7) use($spe478dd) { $sp5044a7->where('category_id', $spe478dd); }); } } $sp55fcdc = (int) $spf066f3->input('recent', 0); if ($sp55fcdc) { $spba7d12 = (new Carbon())->addDay(-$sp55fcdc); $sp5044a7->where(function ($sp5044a7) use($spba7d12) { $sp5044a7->where('paid_at', '>=', $spba7d12)->orWhere(function ($sp5044a7) use($spba7d12) { $sp5044a7->whereNull('paid_at')->where('created_at', '>=', $spba7d12); }); }); } else { $spba7d12 = $spf066f3->input('start_at', false); if (strlen($spba7d12)) { $sp5044a7->where(function ($sp5044a7) use($spba7d12) { $sp5044a7->where('paid_at', '>=', $spba7d12 . ' 00:00:00')->orWhere(function ($sp5044a7) use($spba7d12) { $sp5044a7->whereNull('paid_at')->where('created_at', '>=', $spba7d12 . ' 00:00:00'); }); }); } $sp3bf1fb = $spf066f3->input('end_at', false); if (strlen($sp3bf1fb)) { $sp5044a7->where(function ($sp5044a7) use($sp3bf1fb) { $sp5044a7->where('paid_at', '<=', $sp3bf1fb . ' 23:59:59')->orWhere(function ($sp5044a7) use($sp3bf1fb) { $sp5044a7->whereNull('paid_at')->where('created_at', '<=', $sp3bf1fb . ' 23:59:59'); }); }); } } if ($spd16e61) { $sp5044a7->where('status', \App\Order::STATUS_SUCCESS); $sp234fc3 = clone $sp5044a7; $sp1d0cd2 = $sp234fc3->selectRaw('SUM(`income`) as income, SUM(`paid`-`sms_price`-`cost`-`fee`) as profit')->first(); } else { $sp27b58d = $spf066f3->input('status'); if (strlen($sp27b58d)) { $sp5044a7->whereIn('status', explode(',', $sp27b58d)); } else { $sp5044a7->where('status', '!=', \App\Order::STATUS_UNPAY); } } if ($spa4ff3c) { $sp5044a7->where('product_id', \App\Product::ID_API); } else { $sp5044a7->where('product_id', '>', 0); $sp5044a7->with(array('product' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'name', 'delivery')); }, 'card_orders.card' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'card')); })); } $sp5044a7->with(array('pay' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'name')); })); $sp5044a7->orderBy('id', 'DESC'); if ($spaf67ea === true) { $sp654f72 = (int) $spf066f3->input('export_update_status'); $spb539b9 = $spf066f3->input('export_update_card'); $spbf887f = ''; $spbf887f .= '"订单号","商品名称","下单时间","订单金额","优惠金额","实付金额","手续费","成本价","利润","支付方式","支付流水号","支付时间","订单状态","买家联系方式","买家附加信息"' . '
+'; $sp5044a7->chunk(100, function ($sp0e06cc) use(&$spbf887f, $sp654f72, $spb539b9) { foreach ($sp0e06cc as $spe0613f) { if ($spe0613f->status === \App\Order::STATUS_PAID) { if ($sp654f72 === \App\Order::SEND_STATUS_CARD_PROCESSING) { $spe0613f->send_status = $sp654f72; $spe0613f->saveOrFail(); } elseif ($sp654f72 === \App\Order::SEND_STATUS_CARD_SUCCESS) { $spe0613f->send_status = $sp654f72; $spe0613f->saveOrFail(); $this->ship(new Request(array('id' => $spe0613f->id, 'card' => $spb539b9))); } } $sp7df2ff = $spe0613f->contact_ext; if ($sp7df2ff) { if ($sp7df2ff[0] === '[') { $sp7df2ff = substr($sp7df2ff, 2); } if ($sp7df2ff[strlen($sp7df2ff) - 1] === ']') { $sp7df2ff = substr($sp7df2ff, 0, -2); } } $spbf887f .= '"' . $spe0613f->order_no . '","' . $spe0613f->product_name . '","' . $spe0613f->created_at . '","' . sprintf('%.2f', $spe0613f->price / 100) . '","' . sprintf('%.2f', $spe0613f->discount / 100) . '","' . sprintf('%.2f', $spe0613f->paid / 100) . '","' . sprintf('%.2f', $spe0613f->fee / 100) . '","' . sprintf('%.2f', $spe0613f->cost / 100) . '","' . sprintf('%.2f', ($spe0613f->paid - $spe0613f->fee - $spe0613f->cost) / 100) . '","' . ($spe0613f->pay ? $spe0613f->pay->name : '未知#' . $spe0613f->pay_id) . '","' . $spe0613f->pay_trade_no . '","' . $spe0613f->paid_at . '","' . \App\Order::STATUS[$spe0613f->status] . '","' . $spe0613f->contact . '","' . $sp7df2ff . '"'; $spbf887f .= '
+'; } }); $spc11887 = 'export_orders_' . $this->getUserIdOrFail($spf066f3) . '_' . date('YmdHis') . '.csv'; $spc69671 = array('Content-type' => 'text/plain', 'Content-Disposition' => sprintf('attachment; filename="%s"', $spc11887), 'Content-Length' => strlen($spbf887f)); return response()->make($spbf887f, 200, $spc69671); } $sp72b123 = $spf066f3->input('current_page', 1); $spcfcad4 = $spf066f3->input('per_page', 20); $sp293456 = $sp5044a7->paginate($spcfcad4, array('*'), 'page', $sp72b123); if ($spd16e61) { $sp293456 = $sp293456->toArray(); $sp293456['profit_sum'] = $sp1d0cd2; } return Response::success($sp293456); } function export(Request $spf066f3) { return self::get($spf066f3, true); } function stat(Request $spf066f3) { $this->validate($spf066f3, array('day' => 'required|integer|between:7,30')); $sp403e35 = (int) $spf066f3->input('day'); if ($sp403e35 === 30) { $sp586aba = Carbon::now()->addMonths(-1); } else { $sp586aba = Carbon::now()->addDays(-$sp403e35); } $sp293456 = $this->authQuery($spf066f3, \App\Order::class)->where(function ($sp5044a7) { $sp5044a7->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', $sp586aba)->groupBy('date')->orderBy('date', 'DESC')->selectRaw('DATE(`paid_at`) as "date",COUNT(*) as "count",SUM(`paid`) as "paid",SUM(`paid`-`sms_price`-`cost`-`fee`) as "profit"')->get()->toArray(); $sp9b52fe = array(); foreach ($sp293456 as $sp10eb73) { $sp9b52fe[$sp10eb73['date']] = array((int) $sp10eb73['count'], (int) $sp10eb73['paid'], (int) $sp10eb73['profit']); } return Response::success($sp9b52fe); } function info(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $sp3c46ab = $spf066f3->input('id'); $spe0613f = $this->authQuery($spf066f3, \App\Order::class)->with(array('pay' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'name')); }, 'card_orders.card' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'card')); }))->findOrFail($sp3c46ab); $spe0613f->addHidden(array('system_fee')); return Response::success($spe0613f); } function remark(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer', 'remark' => 'required|string')); $sp3c46ab = $spf066f3->input('id'); $spe0613f = $this->authQuery($spf066f3, \App\Order::class)->findOrFail($sp3c46ab); $spe0613f->remark = $spf066f3->input('remark'); $spe0613f->save(); return Response::success(); } function set_send_status(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer', 'send_status' => 'required|integer')); $sp3c46ab = $spf066f3->input('id'); $spe0613f = $this->authQuery($spf066f3, \App\Order::class)->findOrFail($sp3c46ab); if ($spe0613f->status !== \App\Order::STATUS_PAID) { return Response::fail('此订单不是未发货状态, 无法增加发货标记'); } $spe0613f->send_status = $spf066f3->input('send_status'); $spe0613f->saveOrFail(); return Response::success(); } function ship(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer')); $spe0613f = $this->authQuery($spf066f3, \App\Order::class)->with('product')->findOrFail($spf066f3->input('id')); if ($spe0613f->status !== \App\Order::STATUS_PAID) { return Response::fail('订单不是待发货状态, 无法发货'); } if ($spe0613f->product === null) { return Response::fail('订单对应商品不存在, 无法发货'); } $spa44b12 = $spe0613f->product->delivery; $sp3536fb = ''; if ($spa44b12 === \App\Product::DELIVERY_MANUAL) { $this->validate($spf066f3, array('card' => 'required|string')); $sp3536fb = $spf066f3->input('card'); } $sp9ff388 = null; $spa5ca46 = array(); if (FundHelper::orderSuccess($spe0613f->id, function () use(&$spe0613f, &$sp9ff388, &$spa5ca46, $spa44b12, $sp3536fb) { $spe0613f = \App\Order::where('id', $spe0613f->id)->lockForUpdate()->firstOrFail(); if ($spe0613f->cards && count($spe0613f->cards)) { $sp9ff388 = '该订单已经发货,无需再次发货'; return false; } $sp2cf004 = $spe0613f->product()->lockForUpdate()->firstOrFail(); if ($spa44b12 === \App\Product::DELIVERY_MANUAL) { $spe0613f->status = \App\Order::STATUS_SUCCESS; $spe0613f->send_status = \App\Order::SEND_STATUS_CARD_SUCCESS; $spe0613f->saveOrFail(); $spc3a8a6 = \App\Card::create(array('user_id' => Auth::id(), 'product_id' => $sp2cf004->id, 'card' => $sp3536fb, 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_SOLD, 'count_sold' => 1, 'count_all' => 1)); $spa5ca46[] = $spc3a8a6->card; $spe0613f->cards()->attach($spc3a8a6->id); $sp2cf004->count_sold += $spe0613f->count; $sp2cf004->saveOrFail(); return FundHelper::ACTION_CONTINUE; } $sp54decd = \App\Card::where('product_id', $sp2cf004->id)->whereRaw('`count_sold`<`count_all`')->take($spe0613f->count)->lockForUpdate()->get(); if (count($sp54decd) !== $spe0613f->count) { $sp9ff388 = '商品卡密不足, 请添加卡密后再发货'; return false; } else { $spe0613f->status = \App\Order::STATUS_SUCCESS; $spe0613f->saveOrFail(); $sp6d094b = array(); foreach ($sp54decd as $spc3a8a6) { $sp6d094b[] = $spc3a8a6->id; $spa5ca46[] = $spc3a8a6->card; } $spe0613f->cards()->attach($sp6d094b); \App\Card::whereIn('id', $sp6d094b)->update(array('status' => \App\Card::STATUS_SOLD, 'count_sold' => DB::raw('`count_sold`+1'))); $sp2cf004->count_sold += $spe0613f->count; $sp2cf004->saveOrFail(); return FundHelper::ACTION_CONTINUE; } })) { if (System::_getInt('mail_send_order')) { $spa7590c = @json_decode($spe0613f->contact_ext, true)['_mail']; if ($spa7590c) { $spe0613f->sendEmail($spa7590c); } } if ($spe0613f->status === \App\Order::STATUS_SUCCESS && System::_getInt('sms_send_order')) { $spc7e576 = @json_decode($spe0613f->contact_ext, true)['_mobile']; if ($spc7e576) { $spe0613f->sendSms($spc7e576); } } $spe0613f['card_orders'] = array_map(function ($sp10eb73) { return array('card' => array('card' => $sp10eb73)); }, $spa5ca46); $spe0613f->addHidden(array('system_fee')); return Response::success($spe0613f); } else { return Response::fail($sp9ff388 ?? '数据库繁忙, 请联系客服'); } } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Merchant/Product.php b/app/Http/Controllers/Merchant/Product.php
index 467b8b17b..52added9f 100644
--- a/app/Http/Controllers/Merchant/Product.php
+++ b/app/Http/Controllers/Merchant/Product.php
@@ -1,2 +1,2 @@
authQuery($spfeab54, \App\Product::class)->with(array('category' => function (Relation $sp5786ca) { $sp5786ca->select(array('id', 'name', 'password_open')); })); $sped0aef = $spfeab54->post('search', false); $sp86d9ea = $spfeab54->post('val', false); if ($sped0aef && $sp86d9ea) { if ($sped0aef == 'simple') { if ($spfeab54->post('from') === 'card') { $sp5786ca->where('delivery', \App\Product::DELIVERY_AUTO); } return Response::success($sp5786ca->where('category_id', $sp86d9ea)->get(array('id', 'name'))); } elseif ($sped0aef == 'id') { $sp5786ca->where('id', $sp86d9ea); } elseif ($sped0aef == 'category_id') { $sp5786ca->where('category_id', $sp86d9ea); } else { $sp5786ca->where($sped0aef, 'like', '%' . $sp86d9ea . '%'); } } $sp790613 = (int) $spfeab54->post('category_id'); if ($sp790613 > 0) { $sp5786ca->where('category_id', $sp790613); } $sp17fe52 = $spfeab54->post('enabled'); if (strlen($sp17fe52)) { $sp5786ca->whereIn('enabled', explode(',', $sp17fe52)); } $spd5ff21 = (int) $spfeab54->post('current_page', 1); $sp372a98 = (int) $spfeab54->post('per_page', 20); $spaff91c = $sp5786ca->orderBy('sort')->paginate($sp372a98, array('*'), 'page', $spd5ff21); foreach ($spaff91c->items() as $sp71cb0c) { $sp71cb0c->setAppends(array('count', 'url')); } return Response::success($spaff91c); } function sort(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer', 'sort' => 'required|integer')); $sp71cb0c = $this->authQuery($spfeab54, \App\Product::class)->findOrFail($spfeab54->post('id')); $sp71cb0c->sort = $spfeab54->post('sort'); $sp71cb0c->saveOrFail(); return Response::success(); } function set_count(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer', 'count' => 'required|integer')); $sp71cb0c = $this->authQuery($spfeab54, \App\Product::class)->findOrFail($spfeab54->post('id')); $sp71cb0c->count_all = $sp71cb0c->count_sold + $spfeab54->post('count'); $sp71cb0c->saveOrFail(); return Response::success(); } function category_change(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'required|integer', 'category_id' => 'required|integer')); $spb7fea4 = $this->authQuery($spfeab54, \App\Category::class)->findOrFail($spfeab54->post('category_id')); $sp71cb0c = $this->authQuery($spfeab54, \App\Product::class)->findOrFail($spfeab54->post('id')); $sp71cb0c->category_id = $spb7fea4->id; $sp71cb0c->save(); return Response::success(); } function edit(Request $spfeab54) { $this->validate($spfeab54, array('id' => 'sometimes|integer', 'category_id' => 'required|integer', 'description' => 'required|string', 'instructions' => 'required|string', 'fields' => 'required|string', 'sort' => 'required|integer|min:0|max:10000000', 'inventory' => 'required|integer|between:0,2', 'buy_min' => 'required|integer|min:0|max:10000', 'buy_max' => 'required|integer|min:0|max:10000', 'cost' => 'required|numeric|min:0|max:10000000', 'price' => 'required|numeric|min:0.01|max:10000000', 'price_whole' => 'required|string', 'enabled' => 'required|integer|between:0,1')); $sp790613 = (int) $spfeab54->post('category_id'); if (!$this->authQuery($spfeab54, \App\Category::class)->where('id', $sp790613)->exists()) { return Response::fail('商品分类不存在'); } $sp505b52 = $spfeab54->post('name'); $sp86f371 = $spfeab54->post('description'); $spca5ce7 = $spfeab54->post('instructions'); $sp48869c = (int) $spfeab54->post('buy_min', 0); $sp0c0148 = (int) $spfeab54->post('buy_max', 0); $sp585cd5 = (int) round($spfeab54->post('cost') * 100); $sp62b824 = (int) round($spfeab54->post('price') * 100); $sp4ab772 = $spfeab54->post('price_whole'); $speb09d0 = @json_decode($sp4ab772, true); foreach ($speb09d0 as $sp4703b0) { if ($sp4703b0[1] < 1 || $sp4703b0[1] > 1000000000) { return Response::fail('商品批发价需要在 0.01-10000000 之间'); } } if (System::_getInt('filter_words_open') === 1) { $spe40b13 = explode('|', System::_get('filter_words')); if (($spb9589c = Helper::filterWords($sp505b52, $spe40b13)) !== false) { return Response::fail('提交失败! 商品名称包含敏感词: ' . $spb9589c); } if (($spb9589c = Helper::filterWords($sp86f371, $spe40b13)) !== false) { return Response::fail('提交失败! 商品描述包含敏感词: ' . $spb9589c); } if (($spb9589c = Helper::filterWords($spca5ce7, $spe40b13)) !== false) { return Response::fail('提交失败! 商品使用说明包含敏感词: ' . $spb9589c); } } if ((int) $spfeab54->post('id')) { $sp71cb0c = $this->authQuery($spfeab54, \App\Product::class)->findOrFail($spfeab54->post('id')); if (\App\Card::whereProductId($sp71cb0c->id)->where('type', \App\Card::TYPE_REPEAT)->whereRaw('`count_all`>`count_sold`')->exists()) { if ($sp48869c !== 1) { return Response::fail('该商品含有重复售卖的卡密, 最小购买量必须为1件'); } if ($sp0c0148 !== 1) { return Response::fail('该商品含有重复售卖的卡密, 最大购买量必须为1件'); } } } else { $sp71cb0c = new \App\Product(); $sp71cb0c->count_sold = 0; $sp71cb0c->user_id = $this->getUserIdOrFail($spfeab54); } $sp71cb0c->category_id = $sp790613; $sp71cb0c->name = $sp505b52; $spf3f2ca = new AntiXSS(); $sp71cb0c->description = $spf3f2ca->xss_clean($sp86f371); $sp71cb0c->instructions = $spf3f2ca->xss_clean($spca5ce7); $sp71cb0c->fields = $spfeab54->post('fields'); $sp71cb0c->delivery = (int) $spfeab54->post('delivery'); $sp71cb0c->sort = $spfeab54->post('sort'); $sp71cb0c->buy_min = $sp48869c; $sp71cb0c->buy_max = $sp0c0148; $sp71cb0c->count_warn = $spfeab54->post('count_warn'); $sp71cb0c->support_coupon = $spfeab54->post('support_coupon') === 'true'; $sp71cb0c->password = $spfeab54->post('password'); $sp71cb0c->password_open = $spfeab54->post('password_open') === 'true'; $sp71cb0c->cost = $sp585cd5; $sp71cb0c->price = $sp62b824; $sp71cb0c->price_whole = $sp4ab772; $sp71cb0c->enabled = (int) $spfeab54->post('enabled'); $sp71cb0c->inventory = (int) $spfeab54->post('inventory'); $sp71cb0c->saveOrFail(); return Response::success(); } function enable(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string', 'enabled' => 'required|integer')); $spbd9db0 = $spfeab54->post('ids'); $sp17fe52 = (int) $spfeab54->post('enabled'); $this->authQuery($spfeab54, \App\Product::class)->whereIn('id', explode(',', $spbd9db0))->update(array('enabled' => $sp17fe52)); return Response::success(); } function delete(Request $spfeab54) { $this->validate($spfeab54, array('ids' => 'required|string')); $spbd9db0 = $spfeab54->post('ids'); $spbd9db0 = explode(',', $spbd9db0); $sp7d5568 = $this->authQuery($spfeab54, \App\Product::class)->whereIn('id', $spbd9db0); $sp51054d = $this->authQuery($spfeab54, \App\Card::class)->whereIn('product_id', $spbd9db0); return DB::transaction(function () use($sp7d5568, $sp51054d) { $sp7d5568->delete(); $sp51054d->forceDelete(); return Response::success(); }); } function count_sync(Request $spfeab54) { \App\Product::refreshCount($this->getUser($spfeab54)); return Response::success(); } }
\ No newline at end of file
+namespace App\Http\Controllers\Merchant; use App\Library\Helper; use App\Library\Response; use App\System; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\DB; use voku\helper\AntiXSS; class Product extends Controller { function get(Request $spf066f3) { $sp5044a7 = $this->authQuery($spf066f3, \App\Product::class)->with(array('category' => function (Relation $sp5044a7) { $sp5044a7->select(array('id', 'name', 'password_open')); })); $spca736c = $spf066f3->post('search', false); $sp56dec1 = $spf066f3->post('val', false); if ($spca736c && $sp56dec1) { if ($spca736c == 'simple') { if ($spf066f3->post('from') === 'card') { $sp5044a7->where('delivery', \App\Product::DELIVERY_AUTO); } return Response::success($sp5044a7->where('category_id', $sp56dec1)->get(array('id', 'name'))); } elseif ($spca736c == 'id') { $sp5044a7->where('id', $sp56dec1); } elseif ($spca736c == 'category_id') { $sp5044a7->where('category_id', $sp56dec1); } else { $sp5044a7->where($spca736c, 'like', '%' . $sp56dec1 . '%'); } } $spe478dd = (int) $spf066f3->post('category_id'); if ($spe478dd > 0) { $sp5044a7->where('category_id', $spe478dd); } $sp4ec09d = $spf066f3->post('enabled'); if (strlen($sp4ec09d)) { $sp5044a7->whereIn('enabled', explode(',', $sp4ec09d)); } $sp72b123 = (int) $spf066f3->post('current_page', 1); $spcfcad4 = (int) $spf066f3->post('per_page', 20); $sp293456 = $sp5044a7->orderBy('sort')->paginate($spcfcad4, array('*'), 'page', $sp72b123); foreach ($sp293456->items() as $sp2cf004) { $sp2cf004->setAppends(array('count', 'url')); } return Response::success($sp293456); } function sort(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer', 'sort' => 'required|integer')); $sp2cf004 = $this->authQuery($spf066f3, \App\Product::class)->findOrFail($spf066f3->post('id')); $sp2cf004->sort = $spf066f3->post('sort'); $sp2cf004->saveOrFail(); return Response::success(); } function set_count(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer', 'count' => 'required|integer')); $sp2cf004 = $this->authQuery($spf066f3, \App\Product::class)->findOrFail($spf066f3->post('id')); $sp2cf004->count_all = $sp2cf004->count_sold + $spf066f3->post('count'); $sp2cf004->saveOrFail(); return Response::success(); } function category_change(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'required|integer', 'category_id' => 'required|integer')); $sped57d9 = $this->authQuery($spf066f3, \App\Category::class)->findOrFail($spf066f3->post('category_id')); $sp2cf004 = $this->authQuery($spf066f3, \App\Product::class)->findOrFail($spf066f3->post('id')); $sp2cf004->category_id = $sped57d9->id; $sp2cf004->save(); return Response::success(); } function edit(Request $spf066f3) { $this->validate($spf066f3, array('id' => 'sometimes|integer', 'category_id' => 'required|integer', 'description' => 'required|string', 'instructions' => 'required|string', 'fields' => 'required|string', 'sort' => 'required|integer|min:0|max:10000000', 'inventory' => 'required|integer|between:0,2', 'buy_min' => 'required|integer|min:0|max:10000', 'buy_max' => 'required|integer|min:0|max:10000', 'cost' => 'required|numeric|min:0|max:10000000', 'price' => 'required|numeric|min:0.01|max:10000000', 'price_whole' => 'required|string', 'enabled' => 'required|integer|between:0,1')); $spe478dd = (int) $spf066f3->post('category_id'); if (!$this->authQuery($spf066f3, \App\Category::class)->where('id', $spe478dd)->exists()) { return Response::fail('商品分类不存在'); } $sp34e4b5 = $spf066f3->post('name'); $sp1eddd3 = $spf066f3->post('description'); $sp9349d1 = $spf066f3->post('instructions'); $spf5ec7d = (int) $spf066f3->post('buy_min', 0); $sp05d365 = (int) $spf066f3->post('buy_max', 0); $spb03602 = (int) round($spf066f3->post('cost') * 100); $sp45d662 = (int) round($spf066f3->post('price') * 100); $sp806a0f = $spf066f3->post('price_whole'); $sp66b443 = @json_decode($sp806a0f, true); foreach ($sp66b443 as $spf44cbe) { if ($spf44cbe[1] < 1 || $spf44cbe[1] > 1000000000) { return Response::fail('商品批发价需要在 0.01-10000000 之间'); } } if (System::_getInt('filter_words_open') === 1) { $spe817ab = explode('|', System::_get('filter_words')); if (($sp9b52fe = Helper::filterWords($sp34e4b5, $spe817ab)) !== false) { return Response::fail('提交失败! 商品名称包含敏感词: ' . $sp9b52fe); } if (($sp9b52fe = Helper::filterWords($sp1eddd3, $spe817ab)) !== false) { return Response::fail('提交失败! 商品描述包含敏感词: ' . $sp9b52fe); } if (($sp9b52fe = Helper::filterWords($sp9349d1, $spe817ab)) !== false) { return Response::fail('提交失败! 商品使用说明包含敏感词: ' . $sp9b52fe); } } if ((int) $spf066f3->post('id')) { $sp2cf004 = $this->authQuery($spf066f3, \App\Product::class)->findOrFail($spf066f3->post('id')); if (\App\Card::whereProductId($sp2cf004->id)->where('type', \App\Card::TYPE_REPEAT)->whereRaw('`count_all`>`count_sold`')->exists()) { if ($spf5ec7d !== 1) { return Response::fail('该商品含有重复售卖的卡密, 最小购买量必须为1件'); } if ($sp05d365 !== 1) { return Response::fail('该商品含有重复售卖的卡密, 最大购买量必须为1件'); } } } else { $sp2cf004 = new \App\Product(); $sp2cf004->count_sold = 0; $sp2cf004->user_id = $this->getUserIdOrFail($spf066f3); } $sp2cf004->category_id = $spe478dd; $sp2cf004->name = $sp34e4b5; $spadd670 = new AntiXSS(); $sp2cf004->description = $spadd670->xss_clean($sp1eddd3); $sp2cf004->instructions = $spadd670->xss_clean($sp9349d1); $sp2cf004->fields = $spf066f3->post('fields'); $sp2cf004->delivery = (int) $spf066f3->post('delivery'); $sp2cf004->sort = $spf066f3->post('sort'); $sp2cf004->buy_min = $spf5ec7d; $sp2cf004->buy_max = $sp05d365; $sp2cf004->count_warn = $spf066f3->post('count_warn'); $sp2cf004->support_coupon = $spf066f3->post('support_coupon') === 'true'; $sp2cf004->password = $spf066f3->post('password'); $sp2cf004->password_open = $spf066f3->post('password_open') === 'true'; $sp2cf004->cost = $spb03602; $sp2cf004->price = $sp45d662; $sp2cf004->price_whole = $sp806a0f; $sp2cf004->enabled = (int) $spf066f3->post('enabled'); $sp2cf004->inventory = (int) $spf066f3->post('inventory'); $sp2cf004->saveOrFail(); return Response::success(); } function enable(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string', 'enabled' => 'required|integer')); $sp1f71d9 = $spf066f3->post('ids'); $sp4ec09d = (int) $spf066f3->post('enabled'); $this->authQuery($spf066f3, \App\Product::class)->whereIn('id', explode(',', $sp1f71d9))->update(array('enabled' => $sp4ec09d)); return Response::success(); } function delete(Request $spf066f3) { $this->validate($spf066f3, array('ids' => 'required|string')); $sp1f71d9 = $spf066f3->post('ids'); $sp1f71d9 = explode(',', $sp1f71d9); $sp273177 = $this->authQuery($spf066f3, \App\Product::class)->whereIn('id', $sp1f71d9); $sp626a3f = $this->authQuery($spf066f3, \App\Card::class)->whereIn('product_id', $sp1f71d9); return DB::transaction(function () use($sp273177, $sp626a3f) { $sp273177->delete(); $sp626a3f->forceDelete(); return Response::success(); }); } function count_sync(Request $spf066f3) { \App\Product::refreshCount($this->getUser($spf066f3)); return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Shop/Coupon.php b/app/Http/Controllers/Shop/Coupon.php
index 98228c790..562bc2907 100644
--- a/app/Http/Controllers/Shop/Coupon.php
+++ b/app/Http/Controllers/Shop/Coupon.php
@@ -1,2 +1,2 @@
post('category_id', -1); $sp0e30a6 = (int) $spfeab54->post('product_id', -1); $spd5c9d2 = $spfeab54->post('coupon'); if (!$spd5c9d2) { return Response::fail('请输入优惠券'); } if ($sp790613 > 0) { $spb7fea4 = Category::findOrFail($sp790613); $spfa021e = $spb7fea4->user_id; } elseif ($sp0e30a6 > 0) { $sp71cb0c = Product::findOrFail($sp0e30a6); $spfa021e = $sp71cb0c->user_id; } else { return Response::fail('请先选择分类或商品'); } $spdacc62 = \App\Coupon::where('user_id', $spfa021e)->where('coupon', $spd5c9d2)->where('expire_at', '>', Carbon::now())->whereRaw('`count_used`<`count_all`')->get(); foreach ($spdacc62 as $spd5c9d2) { if ($spd5c9d2->category_id === -1 || $spd5c9d2->category_id === $sp790613 && ($spd5c9d2->product_id === -1 || $spd5c9d2->product_id === $sp0e30a6)) { $spd5c9d2->setVisible(array('discount_type', 'discount_val')); return Response::success($spd5c9d2); } } return Response::fail('您输入的优惠券信息无效
如果没有优惠券请不要填写'); } }
\ No newline at end of file
+namespace App\Http\Controllers\Shop; use App\Category; use App\Product; use App\Library\Response; use Carbon\Carbon; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class Coupon extends Controller { function info(Request $spf066f3) { $spe478dd = (int) $spf066f3->post('category_id', -1); $spbb5d29 = (int) $spf066f3->post('product_id', -1); $sp38c2cc = $spf066f3->post('coupon'); if (!$sp38c2cc) { return Response::fail('请输入优惠券'); } if ($spe478dd > 0) { $sped57d9 = Category::findOrFail($spe478dd); $sp15a746 = $sped57d9->user_id; } elseif ($spbb5d29 > 0) { $sp2cf004 = Product::findOrFail($spbb5d29); $sp15a746 = $sp2cf004->user_id; } else { return Response::fail('请先选择分类或商品'); } $sp659504 = \App\Coupon::where('user_id', $sp15a746)->where('coupon', $sp38c2cc)->where('expire_at', '>', Carbon::now())->whereRaw('`count_used`<`count_all`')->get(); foreach ($sp659504 as $sp38c2cc) { if ($sp38c2cc->category_id === -1 || $sp38c2cc->category_id === $spe478dd && ($sp38c2cc->product_id === -1 || $sp38c2cc->product_id === $spbb5d29)) { $sp38c2cc->setVisible(array('discount_type', 'discount_val')); return Response::success($sp38c2cc); } } return Response::fail('您输入的优惠券信息无效
如果没有优惠券请不要填写'); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Shop/Order.php b/app/Http/Controllers/Shop/Order.php
index 32d63b5f5..ab3f05849 100644
--- a/app/Http/Controllers/Shop/Order.php
+++ b/app/Http/Controllers/Shop/Order.php
@@ -1,2 +1,2 @@
post('geetest_challenge'), $spfeab54->post('geetest_validate'), $spfeab54->post('geetest_seccode')); if (!$spb9589c) { return Response::fail('系统无法接受您的验证结果,请刷新页面后重试。'); } } $sp5786ca = \App\Order::where('created_at', '>=', (new Carbon())->addDay(-30)); $sp8f5ac7 = $spfeab54->post('type', ''); if ($sp8f5ac7 === 'cookie') { $sp0daafb = Cookie::get('customer'); if (strlen($sp0daafb) !== 32) { return Response::success(); } $sp5786ca->where('customer', $sp0daafb); } elseif ($sp8f5ac7 === 'order_no') { $sp7c88f3 = $spfeab54->post('order_no', ''); if (strlen($sp7c88f3) !== 19) { return Response::success(); } $sp5786ca->where('order_no', $sp7c88f3); } elseif ($sp8f5ac7 === 'contact') { $sp09279e = $spfeab54->post('contact', ''); if (strlen($sp09279e) < 6) { return Response::success(); } $sp5786ca->where('contact', $sp09279e); } else { return Response::fail('请选择查询类型'); } $spbd14f4 = array('id', 'created_at', 'order_no', 'contact', 'status', 'send_status', 'count', 'paid'); if (1) { $spbd14f4[] = 'product_name'; $spbd14f4[] = 'contact'; $spbd14f4[] = 'contact_ext'; } $spaff91c = $sp5786ca->orderBy('id', 'DESC')->get($spbd14f4); $sp5952ba = ''; return Response::success(array('list' => $spaff91c, 'msg' => count($spaff91c) ? $sp5952ba : '')); } }
\ No newline at end of file
+namespace App\Http\Controllers\Shop; use Carbon\Carbon; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Library\Response; use App\Library\Geetest; use Illuminate\Support\Facades\Cookie; class Order extends Controller { function get(Request $spf066f3) { if ((int) \App\System::_get('vcode_shop_search') === 1) { $sp9b52fe = Geetest\API::verify($spf066f3->post('geetest_challenge'), $spf066f3->post('geetest_validate'), $spf066f3->post('geetest_seccode')); if (!$sp9b52fe) { return Response::fail('系统无法接受您的验证结果,请刷新页面后重试。'); } } $sp5044a7 = \App\Order::where('created_at', '>=', (new Carbon())->addDay(-30)); $sp4f56c1 = $spf066f3->post('type', ''); if ($sp4f56c1 === 'cookie') { $sp173146 = Cookie::get('customer'); if (strlen($sp173146) !== 32) { return Response::success(); } $sp5044a7->where('customer', $sp173146); } elseif ($sp4f56c1 === 'order_no') { $sp845b45 = $spf066f3->post('order_no', ''); if (strlen($sp845b45) !== 19) { return Response::success(); } $sp5044a7->where('order_no', $sp845b45); } elseif ($sp4f56c1 === 'contact') { $spedfbdb = $spf066f3->post('contact', ''); if (strlen($spedfbdb) < 6) { return Response::success(); } $sp5044a7->where('contact', $spedfbdb); } else { return Response::fail('请选择查询类型'); } $sp8cf7f5 = array('id', 'created_at', 'order_no', 'contact', 'status', 'send_status', 'count', 'paid'); if (1) { $sp8cf7f5[] = 'product_name'; $sp8cf7f5[] = 'contact'; $sp8cf7f5[] = 'contact_ext'; } $sp293456 = $sp5044a7->orderBy('id', 'DESC')->get($sp8cf7f5); $sp23dff4 = ''; return Response::success(array('list' => $sp293456, 'msg' => count($sp293456) ? $sp23dff4 : '')); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Shop/Pay.php b/app/Http/Controllers/Shop/Pay.php
index 1f3db2023..b280bb5bd 100644
--- a/app/Http/Controllers/Shop/Pay.php
+++ b/app/Http/Controllers/Shop/Pay.php
@@ -1,15 +1,15 @@
goPay($spdc9a36, $sp7c88f3, $sp403be9, $sp403be9, $spbccd60); return self::renderResultPage($spfeab54, array('success' => false, 'title' => '请稍后', 'msg' => '支付方式加载中,请稍后')); } catch (\Exception $sp81eee8) { return self::renderResultPage($spfeab54, array('msg' => $sp81eee8->getMessage())); } } function buy(Request $spfeab54) { $sp0daafb = $spfeab54->input('customer'); if (strlen($sp0daafb) !== 32) { return self::renderResultPage($spfeab54, array('msg' => '提交超时,请刷新购买页面并重新提交
-当前网址: ' . $spfeab54->getQueryString() . '
-提交内容: ' . var_export($sp0daafb) . ', 提交长度:' . strlen($sp0daafb) . '
-若您刷新后仍然出现此问题. 请加网站客服反馈')); } if ((int) System::_get('vcode_shop_buy') === 1) { $spb9589c = Geetest\API::verify($spfeab54->input('geetest_challenge'), $spfeab54->input('geetest_validate'), $spfeab54->input('geetest_seccode')); if (!$spb9589c) { return self::renderResultPage($spfeab54, array('msg' => '滑动验证超时,请返回页面重试。')); } } $sp790613 = (int) $spfeab54->input('category_id'); $sp0e30a6 = (int) $spfeab54->input('product_id'); $spfdb02a = (int) $spfeab54->input('count'); $spd5c9d2 = $spfeab54->input('coupon'); $sp09279e = $spfeab54->input('contact'); $sp5e5f4d = $spfeab54->input('contact_ext') ?? null; $spb5f208 = !empty(@json_decode($sp5e5f4d, true)['_mobile']); $sp15a8b5 = (int) $spfeab54->input('pay_id'); if (!$sp790613 || !$sp0e30a6) { return self::renderResultPage($spfeab54, array('msg' => '请选择商品')); } if (strlen($sp09279e) < 1) { return self::renderResultPage($spfeab54, array('msg' => '请输入联系方式')); } $spb7fea4 = Category::findOrFail($sp790613); $sp71cb0c = Product::where('id', $sp0e30a6)->where('category_id', $sp790613)->where('enabled', 1)->with(array('user'))->first(); if ($sp71cb0c == null || $sp71cb0c->user == null) { return self::renderResultPage($spfeab54, array('msg' => '该商品未找到,请重新选择')); } if ($sp71cb0c->password_open) { if ($sp71cb0c->password !== $spfeab54->input('product_password')) { return self::renderResultPage($spfeab54, array('msg' => '商品密码输入错误')); } } else { if ($spb7fea4->password_open) { if ($spb7fea4->password !== $spfeab54->input('category_password')) { if ($spb7fea4->getTmpPassword() !== $spfeab54->input('category_password')) { return self::renderResultPage($spfeab54, array('msg' => '分类密码输入错误')); } } } } if ($spfdb02a < $sp71cb0c->buy_min) { return self::renderResultPage($spfeab54, array('msg' => '该商品最少购买' . $sp71cb0c->buy_min . '件,请重新选择')); } if ($spfdb02a > $sp71cb0c->buy_max) { return self::renderResultPage($spfeab54, array('msg' => '该商品限购' . $sp71cb0c->buy_max . '件,请重新选择')); } if ($sp71cb0c->count < $spfdb02a) { return self::renderResultPage($spfeab54, array('msg' => '该商品库存不足')); } $spd46fd8 = \App\Pay::find($sp15a8b5); if ($spd46fd8 == null || !$spd46fd8->enabled) { return self::renderResultPage($spfeab54, array('msg' => '支付方式未找到,请重新选择')); } $spf60d59 = $sp71cb0c->price; if ($sp71cb0c->price_whole) { $sp4ab772 = json_decode($sp71cb0c->price_whole, true); for ($spea591f = count($sp4ab772) - 1; $spea591f >= 0; $spea591f--) { if ($spfdb02a >= (int) $sp4ab772[$spea591f][0]) { $spf60d59 = (int) $sp4ab772[$spea591f][1]; break; } } } $sp62b824 = $spfdb02a * $spf60d59; $spbccd60 = $sp62b824; $spafa6ef = 0; $sp6be256 = null; if ($sp71cb0c->support_coupon && strlen($spd5c9d2) > 0) { $spdacc62 = \App\Coupon::where('user_id', $sp71cb0c->user_id)->where('coupon', $spd5c9d2)->where('expire_at', '>', Carbon::now())->whereRaw('`count_used`<`count_all`')->get(); foreach ($spdacc62 as $sp6fac42) { if ($sp6fac42->category_id === -1 || $sp6fac42->category_id === $sp790613 && ($sp6fac42->product_id === -1 || $sp6fac42->product_id === $sp0e30a6)) { if ($sp6fac42->discount_type === \App\Coupon::DISCOUNT_TYPE_AMOUNT && $spbccd60 >= $sp6fac42->discount_val) { $sp6be256 = $sp6fac42; $spafa6ef = $sp6fac42->discount_val; break; } if ($sp6fac42->discount_type === \App\Coupon::DISCOUNT_TYPE_PERCENT) { $sp6be256 = $sp6fac42; $spafa6ef = (int) round($spbccd60 * $sp6fac42->discount_val / 100); break; } } } if ($sp6be256 === null) { return self::renderResultPage($spfeab54, array('msg' => '优惠券信息错误,请重新输入')); } $spbccd60 -= $spafa6ef; } $sp7752ec = (int) round($spbccd60 * $spd46fd8->fee_system); $sp950db8 = $spbccd60 - $sp7752ec; $sp06862b = $spb5f208 ? System::_getInt('sms_price', 10) : 0; $spbccd60 += $sp06862b; $sp585cd5 = $spfdb02a * $sp71cb0c->cost; $sp7c88f3 = \App\Order::unique_no(); try { DB::transaction(function () use($sp71cb0c, $sp7c88f3, $sp6be256, $sp09279e, $sp5e5f4d, $sp0daafb, $spfdb02a, $sp585cd5, $sp62b824, $sp06862b, $spafa6ef, $spbccd60, $spd46fd8, $sp7752ec, $sp950db8) { if ($sp6be256) { $sp6be256->status = \App\Coupon::STATUS_USED; $sp6be256->count_used++; $sp6be256->save(); $sp894a06 = '使用优惠券: ' . $sp6be256->coupon; } else { $sp894a06 = null; } $sp4f4c0d = \App\Order::create(array('user_id' => $sp71cb0c->user_id, 'order_no' => $sp7c88f3, 'product_id' => $sp71cb0c->id, 'product_name' => $sp71cb0c->name, 'count' => $spfdb02a, 'ip' => Helper::getIP(), 'customer' => $sp0daafb, 'contact' => $sp09279e, 'contact_ext' => $sp5e5f4d, 'cost' => $sp585cd5, 'price' => $sp62b824, 'sms_price' => $sp06862b, 'discount' => $spafa6ef, 'paid' => $spbccd60, 'pay_id' => $spd46fd8->id, 'fee' => $sp7752ec, 'system_fee' => $sp7752ec, 'income' => $sp950db8, 'status' => \App\Order::STATUS_UNPAY, 'remark' => $sp894a06, 'created_at' => Carbon::now())); assert($sp4f4c0d !== null); }); } catch (\Throwable $sp81eee8) { Log::error('Shop.Pay.buy 下单失败', array('Exception' => $sp81eee8)); return self::renderResultPage($spfeab54, array('msg' => '发生错误,下单失败,请稍后重试')); } if ($spbccd60 === 0) { $this->shipOrder($spfeab54, $sp7c88f3, $spbccd60, null); return redirect('/pay/result/' . $sp7c88f3); } $sp403be9 = $sp7c88f3; return $this->goPay($spfeab54, $sp7c88f3, $sp403be9, $spd46fd8, $spbccd60); } function pay(Request $spfeab54, $sp7c88f3) { $sp4f4c0d = \App\Order::whereOrderNo($sp7c88f3)->first(); if ($sp4f4c0d == null) { return self::renderResultPage($spfeab54, array('msg' => '订单未找到,请重试')); } if ($sp4f4c0d->status !== \App\Order::STATUS_UNPAY) { return redirect('/pay/result/' . $sp7c88f3); } $sp9df21a = 'pay: ' . $sp4f4c0d->pay_id; $spdc9a36 = $sp4f4c0d->pay; if (!$spdc9a36) { \Log::error($sp9df21a . ' cannot find Pay'); return $this->renderResultPage($spfeab54, array('msg' => '支付方式未找到')); } $sp9df21a .= ',' . $spdc9a36->driver; $spbe80b7 = json_decode($spdc9a36->config, true); $spbe80b7['payway'] = $spdc9a36->way; $spbe80b7['out_trade_no'] = $sp7c88f3; try { $this->payApi = PayApi::getDriver($spdc9a36->id, $spdc9a36->driver); } catch (\Exception $sp81eee8) { \Log::error($sp9df21a . ' cannot find Driver: ' . $sp81eee8->getMessage()); return $this->renderResultPage($spfeab54, array('msg' => '支付驱动未找到')); } if ($this->payApi->verify($spbe80b7, function ($sp7c88f3, $sp429fcc, $sp4d48a7) use($spfeab54) { try { $this->shipOrder($spfeab54, $sp7c88f3, $sp429fcc, $sp4d48a7); } catch (\Exception $sp81eee8) { $this->renderResultPage($spfeab54, array('success' => false, 'msg' => $sp81eee8->getMessage())); } })) { \Log::notice($sp9df21a . ' already success' . '
+namespace App\Http\Controllers\Shop; use App\Card; use App\Category; use App\Library\FundHelper; use App\Library\Helper; use App\Library\LogHelper; use App\Product; use App\Library\Response; use App\Library\Pay\Pay as PayApi; use App\Library\Geetest; use App\Mail\OrderShipped; use App\Mail\ProductCountWarn; use App\System; use Carbon\Carbon; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Cookie; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; class Pay extends Controller { public function __construct() { define('SYS_NAME', config('app.name')); define('SYS_URL', config('app.url')); define('SYS_URL_API', config('app.url_api')); } private $payApi = null; public function goPay($spf066f3, $sp845b45, $sp021b00, $spf9ca0c, $spfb596a) { try { (new PayApi())->goPay($spf9ca0c, $sp845b45, $sp021b00, $sp021b00, $spfb596a); return self::renderResultPage($spf066f3, array('success' => false, 'title' => '请稍后', 'msg' => '支付方式加载中,请稍后')); } catch (\Exception $sp3f4aab) { return self::renderResultPage($spf066f3, array('msg' => $sp3f4aab->getMessage())); } } function buy(Request $spf066f3) { $sp173146 = $spf066f3->input('customer'); if (strlen($sp173146) !== 32) { return self::renderResultPage($spf066f3, array('msg' => '提交超时,请刷新购买页面并重新提交
+当前网址: ' . $spf066f3->getQueryString() . '
+提交内容: ' . var_export($sp173146) . ', 提交长度:' . strlen($sp173146) . '
+若您刷新后仍然出现此问题. 请加网站客服反馈')); } if ((int) System::_get('vcode_shop_buy') === 1) { $sp9b52fe = Geetest\API::verify($spf066f3->input('geetest_challenge'), $spf066f3->input('geetest_validate'), $spf066f3->input('geetest_seccode')); if (!$sp9b52fe) { return self::renderResultPage($spf066f3, array('msg' => '滑动验证超时,请返回页面重试。')); } } $spe478dd = (int) $spf066f3->input('category_id'); $spbb5d29 = (int) $spf066f3->input('product_id'); $spdd51cd = (int) $spf066f3->input('count'); $sp38c2cc = $spf066f3->input('coupon'); $spedfbdb = $spf066f3->input('contact'); $sp7df2ff = $spf066f3->input('contact_ext') ?? null; $sp057f24 = !empty(@json_decode($sp7df2ff, true)['_mobile']); $spc035b6 = (int) $spf066f3->input('pay_id'); if (!$spe478dd || !$spbb5d29) { return self::renderResultPage($spf066f3, array('msg' => '请选择商品')); } if (strlen($spedfbdb) < 1) { return self::renderResultPage($spf066f3, array('msg' => '请输入联系方式')); } $sped57d9 = Category::findOrFail($spe478dd); $sp2cf004 = Product::where('id', $spbb5d29)->where('category_id', $spe478dd)->where('enabled', 1)->with(array('user'))->first(); if ($sp2cf004 == null || $sp2cf004->user == null) { return self::renderResultPage($spf066f3, array('msg' => '该商品未找到,请重新选择')); } if ($sp2cf004->password_open) { if ($sp2cf004->password !== $spf066f3->input('product_password')) { return self::renderResultPage($spf066f3, array('msg' => '商品密码输入错误')); } } else { if ($sped57d9->password_open) { if ($sped57d9->password !== $spf066f3->input('category_password')) { if ($sped57d9->getTmpPassword() !== $spf066f3->input('category_password')) { return self::renderResultPage($spf066f3, array('msg' => '分类密码输入错误')); } } } } if ($spdd51cd < $sp2cf004->buy_min) { return self::renderResultPage($spf066f3, array('msg' => '该商品最少购买' . $sp2cf004->buy_min . '件,请重新选择')); } if ($spdd51cd > $sp2cf004->buy_max) { return self::renderResultPage($spf066f3, array('msg' => '该商品限购' . $sp2cf004->buy_max . '件,请重新选择')); } if ($sp2cf004->count < $spdd51cd) { return self::renderResultPage($spf066f3, array('msg' => '该商品库存不足')); } $sp5de949 = \App\Pay::find($spc035b6); if ($sp5de949 == null || !$sp5de949->enabled) { return self::renderResultPage($spf066f3, array('msg' => '支付方式未找到,请重新选择')); } $sp7c17c8 = $sp2cf004->price; if ($sp2cf004->price_whole) { $sp806a0f = json_decode($sp2cf004->price_whole, true); for ($sp6b283c = count($sp806a0f) - 1; $sp6b283c >= 0; $sp6b283c--) { if ($spdd51cd >= (int) $sp806a0f[$sp6b283c][0]) { $sp7c17c8 = (int) $sp806a0f[$sp6b283c][1]; break; } } } $sp45d662 = $spdd51cd * $sp7c17c8; $spfb596a = $sp45d662; $spcde107 = 0; $sp8bdd84 = null; if ($sp2cf004->support_coupon && strlen($sp38c2cc) > 0) { $sp659504 = \App\Coupon::where('user_id', $sp2cf004->user_id)->where('coupon', $sp38c2cc)->where('expire_at', '>', Carbon::now())->whereRaw('`count_used`<`count_all`')->get(); foreach ($sp659504 as $sp9f96c5) { if ($sp9f96c5->category_id === -1 || $sp9f96c5->category_id === $spe478dd && ($sp9f96c5->product_id === -1 || $sp9f96c5->product_id === $spbb5d29)) { if ($sp9f96c5->discount_type === \App\Coupon::DISCOUNT_TYPE_AMOUNT && $spfb596a >= $sp9f96c5->discount_val) { $sp8bdd84 = $sp9f96c5; $spcde107 = $sp9f96c5->discount_val; break; } if ($sp9f96c5->discount_type === \App\Coupon::DISCOUNT_TYPE_PERCENT) { $sp8bdd84 = $sp9f96c5; $spcde107 = (int) round($spfb596a * $sp9f96c5->discount_val / 100); break; } } } if ($sp8bdd84 === null) { return self::renderResultPage($spf066f3, array('msg' => '优惠券信息错误,请重新输入')); } $spfb596a -= $spcde107; } $sp820958 = (int) round($spfb596a * $sp5de949->fee_system); $sp911ac3 = $spfb596a - $sp820958; $sp56f86e = $sp057f24 ? System::_getInt('sms_price', 10) : 0; $spfb596a += $sp56f86e; $spb03602 = $spdd51cd * $sp2cf004->cost; $sp845b45 = \App\Order::unique_no(); try { DB::transaction(function () use($sp2cf004, $sp845b45, $sp8bdd84, $spedfbdb, $sp7df2ff, $sp173146, $spdd51cd, $spb03602, $sp45d662, $sp56f86e, $spcde107, $spfb596a, $sp5de949, $sp820958, $sp911ac3) { if ($sp8bdd84) { $sp8bdd84->status = \App\Coupon::STATUS_USED; $sp8bdd84->count_used++; $sp8bdd84->save(); $sp615115 = '使用优惠券: ' . $sp8bdd84->coupon; } else { $sp615115 = null; } $spe0613f = \App\Order::create(array('user_id' => $sp2cf004->user_id, 'order_no' => $sp845b45, 'product_id' => $sp2cf004->id, 'product_name' => $sp2cf004->name, 'count' => $spdd51cd, 'ip' => Helper::getIP(), 'customer' => $sp173146, 'contact' => $spedfbdb, 'contact_ext' => $sp7df2ff, 'cost' => $spb03602, 'price' => $sp45d662, 'sms_price' => $sp56f86e, 'discount' => $spcde107, 'paid' => $spfb596a, 'pay_id' => $sp5de949->id, 'fee' => $sp820958, 'system_fee' => $sp820958, 'income' => $sp911ac3, 'status' => \App\Order::STATUS_UNPAY, 'remark' => $sp615115, 'created_at' => Carbon::now())); assert($spe0613f !== null); }); } catch (\Throwable $sp3f4aab) { Log::error('Shop.Pay.buy 下单失败', array('Exception' => $sp3f4aab)); return self::renderResultPage($spf066f3, array('msg' => '发生错误,下单失败,请稍后重试')); } if ($spfb596a === 0) { $this->shipOrder($spf066f3, $sp845b45, $spfb596a, null); return redirect('/pay/result/' . $sp845b45); } $sp021b00 = $sp845b45; return $this->goPay($spf066f3, $sp845b45, $sp021b00, $sp5de949, $spfb596a); } function pay(Request $spf066f3, $sp845b45) { $spe0613f = \App\Order::whereOrderNo($sp845b45)->first(); if ($spe0613f == null) { return self::renderResultPage($spf066f3, array('msg' => '订单未找到,请重试')); } if ($spe0613f->status !== \App\Order::STATUS_UNPAY) { return redirect('/pay/result/' . $sp845b45); } $sp5d5f28 = 'pay: ' . $spe0613f->pay_id; $spf9ca0c = $spe0613f->pay; if (!$spf9ca0c) { \Log::error($sp5d5f28 . ' cannot find Pay'); return $this->renderResultPage($spf066f3, array('msg' => '支付方式未找到')); } $sp5d5f28 .= ',' . $spf9ca0c->driver; $sp9d4382 = json_decode($spf9ca0c->config, true); $sp9d4382['payway'] = $spf9ca0c->way; $sp9d4382['out_trade_no'] = $sp845b45; try { $this->payApi = PayApi::getDriver($spf9ca0c->id, $spf9ca0c->driver); } catch (\Exception $sp3f4aab) { \Log::error($sp5d5f28 . ' cannot find Driver: ' . $sp3f4aab->getMessage()); return $this->renderResultPage($spf066f3, array('msg' => '支付驱动未找到')); } if ($this->payApi->verify($sp9d4382, function ($sp845b45, $spf59c91, $sp565d18) use($spf066f3) { try { $this->shipOrder($spf066f3, $sp845b45, $spf59c91, $sp565d18); } catch (\Exception $sp3f4aab) { $this->renderResultPage($spf066f3, array('success' => false, 'msg' => $sp3f4aab->getMessage())); } })) { \Log::notice($sp5d5f28 . ' already success' . '
-'); return redirect('/pay/result/' . $sp7c88f3); } if ($sp4f4c0d->created_at < Carbon::now()->addMinutes(-5)) { return $this->renderResultPage($spfeab54, array('msg' => '当前订单长时间未支付已作废, 请重新下单')); } $sp71cb0c = Product::where('id', $sp4f4c0d->product_id)->where('enabled', 1)->first(); if ($sp71cb0c == null) { return self::renderResultPage($spfeab54, array('msg' => '该商品已下架')); } $sp71cb0c->setAttribute('count', count($sp71cb0c->cards) ? $sp71cb0c->cards[0]->count : 0); if ($sp71cb0c->count < $sp4f4c0d->count) { return self::renderResultPage($spfeab54, array('msg' => '该商品库存不足')); } $sp403be9 = $sp7c88f3; return $this->goPay($spfeab54, $sp7c88f3, $sp403be9, $spdc9a36, $sp4f4c0d->paid); } function qrcode(Request $spfeab54, $sp7c88f3, $sp1e8720) { $sp4f4c0d = \App\Order::whereOrderNo($sp7c88f3)->with('product')->first(); if ($sp4f4c0d == null) { return self::renderResultPage($spfeab54, array('msg' => '订单未找到,请重试')); } if ($sp4f4c0d->product_id !== \App\Product::ID_API && $sp4f4c0d->product == null) { return self::renderResultPage($spfeab54, array('msg' => '商品未找到,请重试')); } return view('pay/' . $sp1e8720, array('pay_id' => $sp4f4c0d->pay_id, 'name' => $sp4f4c0d->product->name . ' x ' . $sp4f4c0d->count . '件', 'amount' => $sp4f4c0d->paid, 'qrcode' => $spfeab54->get('url'), 'id' => $sp7c88f3)); } function qrQuery(Request $spfeab54, $sp15a8b5) { $spc7b84a = $spfeab54->input('id', ''); return self::payReturn($spfeab54, $sp15a8b5, $spc7b84a); } function payReturn(Request $spfeab54, $sp15a8b5, $spa3e681 = '') { $sp9df21a = 'payReturn: ' . $sp15a8b5; \Log::debug($sp9df21a); $spdc9a36 = \App\Pay::where('id', $sp15a8b5)->first(); if (!$spdc9a36) { return $this->renderResultPage($spfeab54, array('success' => 0, 'msg' => '支付方式错误')); } $sp9df21a .= ',' . $spdc9a36->driver; if (strlen($spa3e681) > 0) { $sp4f4c0d = \App\Order::whereOrderNo($spa3e681)->first(); if ($sp4f4c0d && ($sp4f4c0d->status === \App\Order::STATUS_PAID || $sp4f4c0d->status === \App\Order::STATUS_SUCCESS)) { \Log::notice($sp9df21a . ' already success' . '
+'); return redirect('/pay/result/' . $sp845b45); } if ($spe0613f->created_at < Carbon::now()->addMinutes(-5)) { return $this->renderResultPage($spf066f3, array('msg' => '当前订单长时间未支付已作废, 请重新下单')); } $sp2cf004 = Product::where('id', $spe0613f->product_id)->where('enabled', 1)->first(); if ($sp2cf004 == null) { return self::renderResultPage($spf066f3, array('msg' => '该商品已下架')); } $sp2cf004->setAttribute('count', count($sp2cf004->cards) ? $sp2cf004->cards[0]->count : 0); if ($sp2cf004->count < $spe0613f->count) { return self::renderResultPage($spf066f3, array('msg' => '该商品库存不足')); } $sp021b00 = $sp845b45; return $this->goPay($spf066f3, $sp845b45, $sp021b00, $spf9ca0c, $spe0613f->paid); } function qrcode(Request $spf066f3, $sp845b45, $spcc1a16) { $spe0613f = \App\Order::whereOrderNo($sp845b45)->with('product')->first(); if ($spe0613f == null) { return self::renderResultPage($spf066f3, array('msg' => '订单未找到,请重试')); } if ($spe0613f->product_id !== \App\Product::ID_API && $spe0613f->product == null) { return self::renderResultPage($spf066f3, array('msg' => '商品未找到,请重试')); } return view('pay/' . $spcc1a16, array('pay_id' => $spe0613f->pay_id, 'name' => $spe0613f->product->name . ' x ' . $spe0613f->count . '件', 'amount' => $spe0613f->paid, 'qrcode' => $spf066f3->get('url'), 'id' => $sp845b45)); } function qrQuery(Request $spf066f3, $spc035b6) { $spaeb1c1 = $spf066f3->input('id', ''); return self::payReturn($spf066f3, $spc035b6, $spaeb1c1); } function payReturn(Request $spf066f3, $spc035b6, $sp2e47fc = '') { $sp5d5f28 = 'payReturn: ' . $spc035b6; \Log::debug($sp5d5f28); $spf9ca0c = \App\Pay::where('id', $spc035b6)->first(); if (!$spf9ca0c) { return $this->renderResultPage($spf066f3, array('success' => 0, 'msg' => '支付方式错误')); } $sp5d5f28 .= ',' . $spf9ca0c->driver; if (strlen($sp2e47fc) > 0) { $spe0613f = \App\Order::whereOrderNo($sp2e47fc)->first(); if ($spe0613f && ($spe0613f->status === \App\Order::STATUS_PAID || $spe0613f->status === \App\Order::STATUS_SUCCESS)) { \Log::notice($sp5d5f28 . ' already success' . '
-'); if ($spfeab54->ajax()) { return self::renderResultPage($spfeab54, array('success' => 1, 'data' => '/pay/result/' . $spa3e681), array('order' => $sp4f4c0d)); } else { return redirect('/pay/result/' . $spa3e681); } } } try { $this->payApi = PayApi::getDriver($spdc9a36->id, $spdc9a36->driver); } catch (\Exception $sp81eee8) { \Log::error($sp9df21a . ' cannot find Driver: ' . $sp81eee8->getMessage()); return $this->renderResultPage($spfeab54, array('success' => 0, 'msg' => '支付驱动未找到')); } $spbe80b7 = json_decode($spdc9a36->config, true); $spbe80b7['out_trade_no'] = $spa3e681; $spbe80b7['payway'] = $spdc9a36->way; \Log::debug($sp9df21a . ' will verify'); if ($this->payApi->verify($spbe80b7, function ($sp7c88f3, $sp429fcc, $sp4d48a7) use($spfeab54, $sp9df21a, &$spa3e681) { $spa3e681 = $sp7c88f3; try { \Log::debug($sp9df21a . " shipOrder start, order_no: {$sp7c88f3}, amount: {$sp429fcc}, trade_no: {$sp4d48a7}"); $this->shipOrder($spfeab54, $sp7c88f3, $sp429fcc, $sp4d48a7); \Log::debug($sp9df21a . ' shipOrder end, order_no: ' . $sp7c88f3); } catch (\Exception $sp81eee8) { \Log::error($sp9df21a . ' shipOrder Exception: ' . $sp81eee8->getMessage()); } })) { \Log::debug($sp9df21a . ' verify finished: 1' . '
+'); if ($spf066f3->ajax()) { return self::renderResultPage($spf066f3, array('success' => 1, 'data' => '/pay/result/' . $sp2e47fc), array('order' => $spe0613f)); } else { return redirect('/pay/result/' . $sp2e47fc); } } } try { $this->payApi = PayApi::getDriver($spf9ca0c->id, $spf9ca0c->driver); } catch (\Exception $sp3f4aab) { \Log::error($sp5d5f28 . ' cannot find Driver: ' . $sp3f4aab->getMessage()); return $this->renderResultPage($spf066f3, array('success' => 0, 'msg' => '支付驱动未找到')); } $sp9d4382 = json_decode($spf9ca0c->config, true); $sp9d4382['out_trade_no'] = $sp2e47fc; $sp9d4382['payway'] = $spf9ca0c->way; \Log::debug($sp5d5f28 . ' will verify'); if ($this->payApi->verify($sp9d4382, function ($sp845b45, $spf59c91, $sp565d18) use($spf066f3, $sp5d5f28, &$sp2e47fc) { $sp2e47fc = $sp845b45; try { \Log::debug($sp5d5f28 . " shipOrder start, order_no: {$sp845b45}, amount: {$spf59c91}, trade_no: {$sp565d18}"); $this->shipOrder($spf066f3, $sp845b45, $spf59c91, $sp565d18); \Log::debug($sp5d5f28 . ' shipOrder end, order_no: ' . $sp845b45); } catch (\Exception $sp3f4aab) { \Log::error($sp5d5f28 . ' shipOrder Exception: ' . $sp3f4aab->getMessage()); } })) { \Log::debug($sp5d5f28 . ' verify finished: 1' . '
-'); if ($spfeab54->ajax()) { return self::renderResultPage($spfeab54, array('success' => 1, 'data' => '/pay/result/' . $spa3e681)); } else { return redirect('/pay/result/' . $spa3e681); } } else { \Log::debug($sp9df21a . ' verify finished: 0' . '
+'); if ($spf066f3->ajax()) { return self::renderResultPage($spf066f3, array('success' => 1, 'data' => '/pay/result/' . $sp2e47fc)); } else { return redirect('/pay/result/' . $sp2e47fc); } } else { \Log::debug($sp5d5f28 . ' verify finished: 0' . '
-'); return $this->renderResultPage($spfeab54, array('success' => 0, 'msg' => '支付验证失败,您可以稍后查看支付状态。')); } } function payNotify(Request $spfeab54, $sp15a8b5) { $sp9df21a = 'payNotify pay_id: ' . $sp15a8b5; \Log::debug($sp9df21a); $spdc9a36 = \App\Pay::where('id', $sp15a8b5)->first(); if (!$spdc9a36) { \Log::error($sp9df21a . ' cannot find PayModel'); echo 'fail'; die; } $sp9df21a .= ',' . $spdc9a36->driver; try { $this->payApi = PayApi::getDriver($spdc9a36->id, $spdc9a36->driver); } catch (\Exception $sp81eee8) { \Log::error($sp9df21a . ' cannot find Driver: ' . $sp81eee8->getMessage()); echo 'fail'; die; } $spbe80b7 = json_decode($spdc9a36->config, true); $spbe80b7['payway'] = $spdc9a36->way; $spbe80b7['isNotify'] = true; \Log::debug($sp9df21a . ' will verify'); $spb9589c = $this->payApi->verify($spbe80b7, function ($sp7c88f3, $sp429fcc, $sp4d48a7) use($spfeab54, $sp9df21a) { try { \Log::debug($sp9df21a . " shipOrder start, order_no: {$sp7c88f3}, amount: {$sp429fcc}, trade_no: {$sp4d48a7}"); $this->shipOrder($spfeab54, $sp7c88f3, $sp429fcc, $sp4d48a7); \Log::debug($sp9df21a . ' shipOrder end, order_no: ' . $sp7c88f3); } catch (\Exception $sp81eee8) { \Log::error($sp9df21a . ' shipOrder Exception: ' . $sp81eee8->getMessage()); } }); \Log::debug($sp9df21a . ' notify finished: ' . (int) $spb9589c . '
+'); return $this->renderResultPage($spf066f3, array('success' => 0, 'msg' => '支付验证失败,您可以稍后查看支付状态。')); } } function payNotify(Request $spf066f3, $spc035b6) { $sp5d5f28 = 'payNotify pay_id: ' . $spc035b6; \Log::debug($sp5d5f28); $spf9ca0c = \App\Pay::where('id', $spc035b6)->first(); if (!$spf9ca0c) { \Log::error($sp5d5f28 . ' cannot find PayModel'); echo 'fail'; die; } $sp5d5f28 .= ',' . $spf9ca0c->driver; try { $this->payApi = PayApi::getDriver($spf9ca0c->id, $spf9ca0c->driver); } catch (\Exception $sp3f4aab) { \Log::error($sp5d5f28 . ' cannot find Driver: ' . $sp3f4aab->getMessage()); echo 'fail'; die; } $sp9d4382 = json_decode($spf9ca0c->config, true); $sp9d4382['payway'] = $spf9ca0c->way; $sp9d4382['isNotify'] = true; \Log::debug($sp5d5f28 . ' will verify'); $sp9b52fe = $this->payApi->verify($sp9d4382, function ($sp845b45, $spf59c91, $sp565d18) use($spf066f3, $sp5d5f28) { try { \Log::debug($sp5d5f28 . " shipOrder start, order_no: {$sp845b45}, amount: {$spf59c91}, trade_no: {$sp565d18}"); $this->shipOrder($spf066f3, $sp845b45, $spf59c91, $sp565d18); \Log::debug($sp5d5f28 . ' shipOrder end, order_no: ' . $sp845b45); } catch (\Exception $sp3f4aab) { \Log::error($sp5d5f28 . ' shipOrder Exception: ' . $sp3f4aab->getMessage()); } }); \Log::debug($sp5d5f28 . ' notify finished: ' . (int) $sp9b52fe . '
-'); die; } function result(Request $spfeab54, $sp7c88f3) { $sp4f4c0d = \App\Order::where('order_no', $sp7c88f3)->first(); if ($sp4f4c0d == null) { return self::renderResultPage($spfeab54, array('msg' => '订单未找到,请重试')); } if ($sp4f4c0d->status === \App\Order::STATUS_PAID) { $sp18d561 = $sp4f4c0d->user->qq; if ($sp4f4c0d->product->delivery === \App\Product::DELIVERY_MANUAL) { $sp093e23 = '您购买的为手动充值商品,请耐心等待处理'; } else { $sp093e23 = '商家库存不足,因此没有自动发货,请联系商家客服发货'; } if ($sp18d561) { $sp093e23 .= '
客服QQ:' . $sp18d561 . ''; } return self::renderResultPage($spfeab54, array('success' => false, 'title' => '订单已支付', 'msg' => $sp093e23), array('order' => $sp4f4c0d)); } elseif ($sp4f4c0d->status === \App\Order::STATUS_SUCCESS) { return self::showOrderResult($spfeab54, $sp4f4c0d); } return self::renderResultPage($spfeab54, array('success' => false, 'msg' => $sp4f4c0d->remark ? '失败原因:
' . $sp4f4c0d->remark : '订单支付失败,请重试'), array('order' => $sp4f4c0d)); } function renderResultPage(Request $spfeab54, $spbbda25, $spee2ceb = array()) { if ($spfeab54->ajax()) { if (@$spbbda25['success']) { return Response::success($spbbda25['data']); } else { return Response::fail('error', $spbbda25['msg']); } } else { return view('pay.result', array_merge(array('result' => $spbbda25, 'data' => $spee2ceb), $spee2ceb)); } } function shipOrder($spfeab54, $sp7c88f3, $sp429fcc, $sp4d48a7) { $sp4f4c0d = \App\Order::whereOrderNo($sp7c88f3)->first(); if ($sp4f4c0d === null) { \Log::error('shipOrder: No query results for model [App\\Order:' . $sp7c88f3 . ',trade_no:' . $sp4d48a7 . ',amount:' . $sp429fcc . ']. die(\'success\');'); die('success'); } if ($sp4f4c0d->paid > $sp429fcc) { \Log::alert('shipOrder, price may error, order_no:' . $sp7c88f3 . ', paid:' . $sp4f4c0d->paid . ', $amount get:' . $sp429fcc); $sp4f4c0d->remark = '支付金额(' . sprintf('%0.2f', $sp429fcc / 100) . ') 小于 订单金额(' . sprintf('%0.2f', $sp4f4c0d->paid / 100) . ')'; $sp4f4c0d->save(); throw new \Exception($sp4f4c0d->remark); } $sp71cb0c = null; if ($sp4f4c0d->status === \App\Order::STATUS_UNPAY) { \Log::debug('shipOrder.first_process:' . $sp7c88f3); $sp48ee76 = $sp4f4c0d->id; if (FundHelper::orderSuccess($sp4f4c0d->id, function ($spf56da4) use($sp48ee76, $sp4d48a7, &$sp4f4c0d, &$sp71cb0c) { $sp4f4c0d = $spf56da4; if ($sp4f4c0d->status !== \App\Order::STATUS_UNPAY) { \Log::debug('Shop.Pay.shipOrder: .first_process:' . $sp4f4c0d->order_no . ' already processed! #2'); return false; } $sp71cb0c = $sp4f4c0d->product()->lockForUpdate()->firstOrFail(); $sp4f4c0d->pay_trade_no = $sp4d48a7; $sp4f4c0d->paid_at = Carbon::now(); if ($sp71cb0c->delivery === \App\Product::DELIVERY_MANUAL) { $sp4f4c0d->status = \App\Order::STATUS_PAID; $sp4f4c0d->send_status = \App\Order::SEND_STATUS_CARD_UN; $sp4f4c0d->saveOrFail(); return true; } $sp33f345 = Card::where('product_id', $sp4f4c0d->product_id)->whereRaw('`count_sold`<`count_all`')->take($sp4f4c0d->count)->lockForUpdate()->get(); if (count($sp33f345) !== $sp4f4c0d->count) { Log::alert('Shop.Pay.shipOrder: 订单:' . $sp4f4c0d->order_no . ', 购买数量:' . $sp4f4c0d->count . ', 卡数量:' . count($sp33f345) . ' 卡密不足(已支付 未发货)'); $sp4f4c0d->status = \App\Order::STATUS_PAID; $sp4f4c0d->saveOrFail(); return true; } else { $sp011030 = array(); foreach ($sp33f345 as $sp0f75bb) { $sp011030[] = $sp0f75bb->id; } $sp4f4c0d->cards()->attach($sp011030); Card::whereIn('id', $sp011030)->update(array('status' => Card::STATUS_SOLD, 'count_sold' => DB::raw('`count_sold`+1'))); $sp4f4c0d->status = \App\Order::STATUS_SUCCESS; $sp4f4c0d->saveOrFail(); $sp71cb0c->count_sold += $sp4f4c0d->count; $sp71cb0c->saveOrFail(); return FundHelper::ACTION_CONTINUE; } })) { if ($sp71cb0c->count_warn > 0 && $sp71cb0c->count < $sp71cb0c->count_warn) { try { Mail::to($sp4f4c0d->user->email)->Queue(new ProductCountWarn($sp71cb0c, $sp71cb0c->count)); } catch (\Throwable $sp81eee8) { LogHelper::setLogFile('mail'); Log::error('shipOrder.count_warn error', array('product_id' => $sp4f4c0d->product_id, 'email' => $sp4f4c0d->user->email, 'exception' => $sp81eee8->getMessage())); LogHelper::setLogFile('card'); } } if (System::_getInt('mail_send_order')) { $sp4c999d = @json_decode($sp4f4c0d->contact_ext, true)['_mail']; if ($sp4c999d) { $sp4f4c0d->sendEmail($sp4c999d); } } if ($sp4f4c0d->status === \App\Order::STATUS_SUCCESS && System::_getInt('sms_send_order')) { $sp6566f0 = @json_decode($sp4f4c0d->contact_ext, true)['_mobile']; if ($sp6566f0) { $sp4f4c0d->sendSms($sp6566f0); } } } else { } } else { Log::debug('Shop.Pay.shipOrder: .order_no:' . $sp4f4c0d->order_no . ' already processed! #1'); } return FALSE; } private function showOrderResult($spfeab54, $sp4f4c0d) { return self::renderResultPage($spfeab54, array('success' => true, 'msg' => $sp4f4c0d->getSendMessage()), array('card_txt' => join('
', $sp4f4c0d->getCardsArray()), 'order' => $sp4f4c0d, 'product' => $sp4f4c0d->product)); } }
\ No newline at end of file
+'); die; } function result(Request $spf066f3, $sp845b45) { $spe0613f = \App\Order::where('order_no', $sp845b45)->first(); if ($spe0613f == null) { return self::renderResultPage($spf066f3, array('msg' => '订单未找到,请重试')); } if ($spe0613f->status === \App\Order::STATUS_PAID) { $sp0e815c = $spe0613f->user->qq; if ($spe0613f->product->delivery === \App\Product::DELIVERY_MANUAL) { $sp417133 = '您购买的为手动充值商品,请耐心等待处理'; } else { $sp417133 = '商家库存不足,因此没有自动发货,请联系商家客服发货'; } if ($sp0e815c) { $sp417133 .= '
客服QQ:' . $sp0e815c . ''; } return self::renderResultPage($spf066f3, array('success' => false, 'title' => '订单已支付', 'msg' => $sp417133), array('order' => $spe0613f)); } elseif ($spe0613f->status === \App\Order::STATUS_SUCCESS) { return self::showOrderResult($spf066f3, $spe0613f); } return self::renderResultPage($spf066f3, array('success' => false, 'msg' => $spe0613f->remark ? '失败原因:
' . $spe0613f->remark : '订单支付失败,请重试'), array('order' => $spe0613f)); } function renderResultPage(Request $spf066f3, $spb72f32, $spac7a25 = array()) { if ($spf066f3->ajax()) { if (@$spb72f32['success']) { return Response::success($spb72f32['data']); } else { return Response::fail('error', $spb72f32['msg']); } } else { return view('pay.result', array_merge(array('result' => $spb72f32, 'data' => $spac7a25), $spac7a25)); } } function shipOrder($spf066f3, $sp845b45, $spf59c91, $sp565d18) { $spe0613f = \App\Order::whereOrderNo($sp845b45)->first(); if ($spe0613f === null) { \Log::error('shipOrder: No query results for model [App\\Order:' . $sp845b45 . ',trade_no:' . $sp565d18 . ',amount:' . $spf59c91 . ']. die(\'success\');'); die('success'); } if ($spe0613f->paid > $spf59c91) { \Log::alert('shipOrder, price may error, order_no:' . $sp845b45 . ', paid:' . $spe0613f->paid . ', $amount get:' . $spf59c91); $spe0613f->remark = '支付金额(' . sprintf('%0.2f', $spf59c91 / 100) . ') 小于 订单金额(' . sprintf('%0.2f', $spe0613f->paid / 100) . ')'; $spe0613f->save(); throw new \Exception($spe0613f->remark); } $sp2cf004 = null; if ($spe0613f->status === \App\Order::STATUS_UNPAY) { \Log::debug('shipOrder.first_process:' . $sp845b45); $spd04f8a = $spe0613f->id; if (FundHelper::orderSuccess($spe0613f->id, function ($sp4e5f00) use($spd04f8a, $sp565d18, &$spe0613f, &$sp2cf004) { $spe0613f = $sp4e5f00; if ($spe0613f->status !== \App\Order::STATUS_UNPAY) { \Log::debug('Shop.Pay.shipOrder: .first_process:' . $spe0613f->order_no . ' already processed! #2'); return false; } $sp2cf004 = $spe0613f->product()->lockForUpdate()->firstOrFail(); $spe0613f->pay_trade_no = $sp565d18; $spe0613f->paid_at = Carbon::now(); if ($sp2cf004->delivery === \App\Product::DELIVERY_MANUAL) { $spe0613f->status = \App\Order::STATUS_PAID; $spe0613f->send_status = \App\Order::SEND_STATUS_CARD_UN; $spe0613f->saveOrFail(); return true; } $sp54decd = Card::where('product_id', $spe0613f->product_id)->whereRaw('`count_sold`<`count_all`')->take($spe0613f->count)->lockForUpdate()->get(); if (count($sp54decd) !== $spe0613f->count) { Log::alert('Shop.Pay.shipOrder: 订单:' . $spe0613f->order_no . ', 购买数量:' . $spe0613f->count . ', 卡数量:' . count($sp54decd) . ' 卡密不足(已支付 未发货)'); $spe0613f->status = \App\Order::STATUS_PAID; $spe0613f->saveOrFail(); return true; } else { $sp6d094b = array(); foreach ($sp54decd as $spc3a8a6) { $sp6d094b[] = $spc3a8a6->id; } $spe0613f->cards()->attach($sp6d094b); Card::whereIn('id', $sp6d094b)->update(array('status' => Card::STATUS_SOLD, 'count_sold' => DB::raw('`count_sold`+1'))); $spe0613f->status = \App\Order::STATUS_SUCCESS; $spe0613f->saveOrFail(); $sp2cf004->count_sold += $spe0613f->count; $sp2cf004->saveOrFail(); return FundHelper::ACTION_CONTINUE; } })) { if ($sp2cf004->count_warn > 0 && $sp2cf004->count < $sp2cf004->count_warn) { try { Mail::to($spe0613f->user->email)->Queue(new ProductCountWarn($sp2cf004, $sp2cf004->count)); } catch (\Throwable $sp3f4aab) { LogHelper::setLogFile('mail'); Log::error('shipOrder.count_warn error', array('product_id' => $spe0613f->product_id, 'email' => $spe0613f->user->email, 'exception' => $sp3f4aab->getMessage())); LogHelper::setLogFile('card'); } } if (System::_getInt('mail_send_order')) { $spa7590c = @json_decode($spe0613f->contact_ext, true)['_mail']; if ($spa7590c) { $spe0613f->sendEmail($spa7590c); } } if ($spe0613f->status === \App\Order::STATUS_SUCCESS && System::_getInt('sms_send_order')) { $spc7e576 = @json_decode($spe0613f->contact_ext, true)['_mobile']; if ($spc7e576) { $spe0613f->sendSms($spc7e576); } } } else { } } else { Log::debug('Shop.Pay.shipOrder: .order_no:' . $spe0613f->order_no . ' already processed! #1'); } return FALSE; } private function showOrderResult($spf066f3, $spe0613f) { return self::renderResultPage($spf066f3, array('success' => true, 'msg' => $spe0613f->getSendMessage()), array('card_txt' => join('
', $spe0613f->getCardsArray()), 'order' => $spe0613f, 'product' => $spe0613f->product)); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Shop/Product.php b/app/Http/Controllers/Shop/Product.php
index d2831da66..dd1f0e2dd 100644
--- a/app/Http/Controllers/Shop/Product.php
+++ b/app/Http/Controllers/Shop/Product.php
@@ -1,2 +1,2 @@
post('category_id'); if (!$sp790613) { return Response::forbidden('请选择商品分类'); } $spb7fea4 = \App\Category::where('id', $sp790613)->first(); if (!$spb7fea4) { return Response::forbidden('商品分类未找到'); } if ($spb7fea4->password_open && $spfeab54->post('password') !== $spb7fea4->password) { return Response::fail('分类密码输入错误'); } $sp8b05f0 = \App\Product::where('category_id', $sp790613)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp8b05f0 as $sp71cb0c) { $sp71cb0c->setForShop(); } return Response::success($sp8b05f0); } function verifyPassword(Request $spfeab54) { $sp0e30a6 = (int) $spfeab54->post('product_id'); if (!$sp0e30a6) { return Response::forbidden('请选择商品'); } $sp71cb0c = \App\Product::where('id', $sp0e30a6)->first(); if (!$sp71cb0c) { return Response::forbidden('商品未找到'); } if ($sp71cb0c->password_open && $spfeab54->post('password') !== $sp71cb0c->password) { return Response::fail('商品密码输入错误'); } return Response::success(); } }
\ No newline at end of file
+namespace App\Http\Controllers\Shop; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Library\Response; class Product extends Controller { function get(Request $spf066f3) { $spe478dd = (int) $spf066f3->post('category_id'); if (!$spe478dd) { return Response::forbidden('请选择商品分类'); } $sped57d9 = \App\Category::where('id', $spe478dd)->first(); if (!$sped57d9) { return Response::forbidden('商品分类未找到'); } if ($sped57d9->password_open && $spf066f3->post('password') !== $sped57d9->password) { return Response::fail('分类密码输入错误'); } $sp7c2d5f = \App\Product::where('category_id', $spe478dd)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp7c2d5f as $sp2cf004) { $sp2cf004->setForShop(); } return Response::success($sp7c2d5f); } function verifyPassword(Request $spf066f3) { $spbb5d29 = (int) $spf066f3->post('product_id'); if (!$spbb5d29) { return Response::forbidden('请选择商品'); } $sp2cf004 = \App\Product::where('id', $spbb5d29)->first(); if (!$sp2cf004) { return Response::forbidden('商品未找到'); } if ($sp2cf004->password_open && $spf066f3->post('password') !== $sp2cf004->password) { return Response::fail('商品密码输入错误'); } return Response::success(); } }
\ No newline at end of file
diff --git a/app/Http/Controllers/Shop/VerifyCode.php b/app/Http/Controllers/Shop/VerifyCode.php
index 86cccddd5..0d2d23210 100644
--- a/app/Http/Controllers/Shop/VerifyCode.php
+++ b/app/Http/Controllers/Shop/VerifyCode.php
@@ -1,2 +1,2 @@
'geetest', 'geetest' => Geetest\API::get()); return Response::success($sp303806); } }
\ No newline at end of file
+namespace App\Http\Controllers\Shop; use App\Library\Response; use App\Library\Geetest; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class VerifyCode extends Controller { function getVerify() { $sp2a2ac0 = array('driver' => 'geetest', 'geetest' => Geetest\API::get()); return Response::success($sp2a2ac0); } }
\ No newline at end of file
diff --git a/app/Http/Middleware/CORS.php b/app/Http/Middleware/CORS.php
index 517f957c8..1fd9e8d35 100644
--- a/app/Http/Middleware/CORS.php
+++ b/app/Http/Middleware/CORS.php
@@ -1,2 +1,2 @@
$spfeab54->header('Origin'), 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Headers' => 'Content-Type, Accept, Authorization, Cookie, X-Requested-With, X-XSRF-TOKEN', 'Access-Control-Allow-Credentials' => 'true'); if ($spfeab54->isMethod('OPTIONS')) { return response()->make('', 200, $sp28070b); } $sp3ac4e3 = $spdb228e($spfeab54); foreach ($sp28070b as $sp1ed429 => $spb914e6) { $sp3ac4e3->headers->set($sp1ed429, $spb914e6); } return $sp3ac4e3; } return $spdb228e($spfeab54); } }
\ No newline at end of file
+namespace App\Http\Middleware; use Closure; class CORS { public function handle($spf066f3, Closure $spba6eab) { if (config('app.debug')) { $spc69671 = array('Access-Control-Allow-Origin' => $spf066f3->header('Origin'), 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Headers' => 'Content-Type, Accept, Authorization, Cookie, X-Requested-With, X-XSRF-TOKEN', 'Access-Control-Allow-Credentials' => 'true'); if ($spf066f3->isMethod('OPTIONS')) { return response()->make('', 200, $spc69671); } $spdc5091 = $spba6eab($spf066f3); foreach ($spc69671 as $spf1241f => $sp8b9401) { $spdc5091->headers->set($spf1241f, $sp8b9401); } return $spdc5091; } return $spba6eab($spf066f3); } }
\ No newline at end of file
diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php
index ced1b64a3..3070119f6 100644
--- a/app/Http/Middleware/RedirectIfAuthenticated.php
+++ b/app/Http/Middleware/RedirectIfAuthenticated.php
@@ -1,2 +1,2 @@
check()) { return redirect('/home'); } return $spdb228e($spfeab54); } }
\ No newline at end of file
+namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { public function handle($spf066f3, Closure $spba6eab, $sp38399f = null) { if (Auth::guard($sp38399f)->check()) { return redirect('/home'); } return $spba6eab($spf066f3); } }
\ No newline at end of file
diff --git a/app/Jobs/OrderSms.php b/app/Jobs/OrderSms.php
index a21ac04f9..566d5182e 100644
--- a/app/Jobs/OrderSms.php
+++ b/app/Jobs/OrderSms.php
@@ -1,2 +1,2 @@
mobile = $sp6566f0; $this->order = $sp4f4c0d; } public function handle() { CurlRequest::post('https://api.his.cat/api/sms/send', http_build_query(array('id' => System::_get('sms_api_id'), 'key' => System::_get('sms_api_key'), 'to' => $this->mobile, 'msg' => config('app.url') . '/pay/result/' . $this->order->order_no))); } }
\ No newline at end of file
+namespace App\Jobs; use App\Library\CurlRequest; use App\System; use Illuminate\Bus\Queueable; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; class OrderSms implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; private $mobile = null; private $order = null; public function __construct($spc7e576, $spe0613f) { $this->mobile = $spc7e576; $this->order = $spe0613f; } public function handle() { CurlRequest::post('https://api.his.cat/api/sms/send', http_build_query(array('id' => System::_get('sms_api_id'), 'key' => System::_get('sms_api_key'), 'to' => $this->mobile, 'msg' => config('app.url') . '/pay/result/' . $this->order->order_no))); } }
\ No newline at end of file
diff --git a/app/Library/CurlRequest.php b/app/Library/CurlRequest.php
index cf976f959..39c43e23a 100644
--- a/app/Library/CurlRequest.php
+++ b/app/Library/CurlRequest.php
@@ -1,3 +1,3 @@
$spf9847c) { $sp263179[] = $sp0a9b77 . ': ' . $spf9847c; } $sp263179[] = 'Expect:'; $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp9b0943, CURLOPT_FOLLOWLOCATION, true); curl_setopt($sp9b0943, CURLOPT_MAXREDIRS, 3); if ($sp2e8ea8 == 1) { curl_setopt($sp9b0943, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($sp9b0943, CURLOPT_POST, 1); if ($sp0e98cb !== '') { curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $sp0e98cb); curl_setopt($sp9b0943, CURLOPT_POSTREDIR, 3); } } if (defined('MY_PROXY')) { $sp57f18d = MY_PROXY; $spb194f2 = CURLPROXY_HTTP; if (strpos($sp57f18d, 'http://') || strpos($sp57f18d, 'https://')) { $sp57f18d = str_replace('http://', $sp57f18d, $sp57f18d); $sp57f18d = str_replace('https://', $sp57f18d, $sp57f18d); $spb194f2 = CURLPROXY_HTTP; } elseif (strpos($sp57f18d, 'socks4://')) { $sp57f18d = str_replace('socks4://', $sp57f18d, $sp57f18d); $spb194f2 = CURLPROXY_SOCKS4; } elseif (strpos($sp57f18d, 'socks4a://')) { $sp57f18d = str_replace('socks4a://', $sp57f18d, $sp57f18d); $spb194f2 = CURLPROXY_SOCKS4A; } elseif (strpos($sp57f18d, 'socks5://')) { $sp57f18d = str_replace('socks5://', $sp57f18d, $sp57f18d); $spb194f2 = CURLPROXY_SOCKS5_HOSTNAME; } curl_setopt($sp9b0943, CURLOPT_PROXY, $sp57f18d); curl_setopt($sp9b0943, CURLOPT_PROXYTYPE, $spb194f2); if (defined('MY_PROXY_PASS')) { curl_setopt($sp9b0943, CURLOPT_PROXYUSERPWD, MY_PROXY_PASS); } } curl_setopt($sp9b0943, CURLOPT_TIMEOUT, $sp39139f); curl_setopt($sp9b0943, CURLOPT_CONNECTTIMEOUT, $sp39139f); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9b0943, CURLOPT_HEADER, 1); curl_setopt($sp9b0943, CURLOPT_HTTPHEADER, $sp263179); $sp3ac4e3 = curl_exec($sp9b0943); $sp70c798 = curl_getinfo($sp9b0943, CURLINFO_HEADER_SIZE); $sp79148a = substr($sp3ac4e3, 0, $sp70c798); $sp873488 = substr($sp3ac4e3, $sp70c798); curl_close($sp9b0943); if ($spe0ae41 !== false) { $sp28070b = explode('
-', $sp79148a); $sp7fb521 = ''; foreach ($sp28070b as $sp79148a) { if (strpos($sp79148a, 'Set-Cookie') !== false) { if (strpos($sp79148a, ';') !== false) { $sp7fb521 = $sp7fb521 . trim(Helper::str_between($sp79148a, 'Set-Cookie:', ';')) . ';'; } else { $sp7fb521 = $sp7fb521 . trim(str_replace('Set-Cookie:', '', $sp79148a)) . ';'; } } } $spe0ae41 = self::combineCookie($spe0ae41, $sp7fb521); } return $sp873488; } public static function get($sp3db1b2, $sp28070b = array(), $sp39139f = 5, &$spe0ae41 = false) { return self::curl($sp3db1b2, 0, '', $sp28070b, $sp39139f, $spe0ae41); } public static function post($sp3db1b2, $sp0e98cb = '', $sp28070b = array(), $sp39139f = 5, &$spe0ae41 = false) { return self::curl($sp3db1b2, 1, $sp0e98cb, $sp28070b, $sp39139f, $spe0ae41); } public static function combineCookie($sp50470d, $spc14a3e) { $sp017a37 = explode(';', $sp50470d); $spd07747 = explode(';', $spc14a3e); foreach ($sp017a37 as $sp6e92a4) { if (self::cookieIsExists($spd07747, self::cookieGetName($sp6e92a4)) == false) { array_push($spd07747, $sp6e92a4); } } $spd26b12 = ''; foreach ($spd07747 as $sp6e92a4) { if (substr($sp6e92a4, -8, 8) != '=deleted' && strlen($sp6e92a4) > 1) { $spd26b12 .= $sp6e92a4 . '; '; } } return substr($spd26b12, 0, strlen($spd26b12) - 2); } public static function cookieGetName($sp5c601e) { $sp6de9f7 = strpos($sp5c601e, '='); return substr($sp5c601e, 0, $sp6de9f7); } public static function cookieGetValue($sp5c601e) { $sp6de9f7 = strpos($sp5c601e, '='); $sp31ee84 = substr($sp5c601e, $sp6de9f7 + 1, strlen($sp5c601e) - $sp6de9f7); return $sp31ee84; } public static function cookieGet($spe0ae41, $sp505b52, $sp32d9c3 = false) { $spe0ae41 = str_replace(' ', '', $spe0ae41); if (substr($spe0ae41, -1, 1) != ';') { $spe0ae41 = ';' . $spe0ae41 . ';'; } else { $spe0ae41 = ';' . $spe0ae41; } $spa5cb9b = Helper::str_between($spe0ae41, ';' . $sp505b52 . '=', ';'); if (!$sp32d9c3 || $spa5cb9b == '') { return $spa5cb9b; } else { return $sp505b52 . '=' . $spa5cb9b; } } private static function cookieIsExists($sp3b0476, $sp00e97c) { foreach ($sp3b0476 as $sp6e92a4) { if (self::cookieGetName($sp6e92a4) == $sp00e97c) { return true; } } return false; } function test() { $sp31ee84 = self::combineCookie('a=1;b=2;c=3', 'c=5'); var_dump($sp31ee84); } }
\ No newline at end of file
+namespace App\Library; use Illuminate\Support\Facades\Log; class CurlRequest { private static function curl($spd2457c, $spd0c59e = 0, $spe25017 = '', $spc69671 = array(), $spdecb3f = 5, &$sp5ee4b6 = false) { if (!isset($spc69671['Accept'])) { $spc69671['Accept'] = '*/*'; } if (!isset($spc69671['Referer'])) { $spc69671['Referer'] = $spd2457c; } if (!isset($spc69671['Content-Type'])) { $spc69671['Content-Type'] = 'application/x-www-form-urlencoded'; } if (!isset($spc69671['User-Agent'])) { $spc69671['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'; } if ($sp5ee4b6 !== false) { $spc69671['Cookie'] = $sp5ee4b6; } $sp3db035 = array(); foreach ($spc69671 as $sp517f03 => $sp438dc5) { $sp3db035[] = $sp517f03 . ': ' . $sp438dc5; } $sp3db035[] = 'Expect:'; $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp9f83d6, CURLOPT_FOLLOWLOCATION, true); curl_setopt($sp9f83d6, CURLOPT_MAXREDIRS, 3); if ($spd0c59e == 1) { curl_setopt($sp9f83d6, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($sp9f83d6, CURLOPT_POST, 1); if ($spe25017 !== '') { curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $spe25017); curl_setopt($sp9f83d6, CURLOPT_POSTREDIR, 3); } } if (defined('MY_PROXY')) { $spa0fa4a = MY_PROXY; $spec22d9 = CURLPROXY_HTTP; if (strpos($spa0fa4a, 'http://') || strpos($spa0fa4a, 'https://')) { $spa0fa4a = str_replace('http://', $spa0fa4a, $spa0fa4a); $spa0fa4a = str_replace('https://', $spa0fa4a, $spa0fa4a); $spec22d9 = CURLPROXY_HTTP; } elseif (strpos($spa0fa4a, 'socks4://')) { $spa0fa4a = str_replace('socks4://', $spa0fa4a, $spa0fa4a); $spec22d9 = CURLPROXY_SOCKS4; } elseif (strpos($spa0fa4a, 'socks4a://')) { $spa0fa4a = str_replace('socks4a://', $spa0fa4a, $spa0fa4a); $spec22d9 = CURLPROXY_SOCKS4A; } elseif (strpos($spa0fa4a, 'socks5://')) { $spa0fa4a = str_replace('socks5://', $spa0fa4a, $spa0fa4a); $spec22d9 = CURLPROXY_SOCKS5_HOSTNAME; } curl_setopt($sp9f83d6, CURLOPT_PROXY, $spa0fa4a); curl_setopt($sp9f83d6, CURLOPT_PROXYTYPE, $spec22d9); if (defined('MY_PROXY_PASS')) { curl_setopt($sp9f83d6, CURLOPT_PROXYUSERPWD, MY_PROXY_PASS); } } curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, $spdecb3f); curl_setopt($sp9f83d6, CURLOPT_CONNECTTIMEOUT, $spdecb3f); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9f83d6, CURLOPT_HEADER, 1); curl_setopt($sp9f83d6, CURLOPT_HTTPHEADER, $sp3db035); $spdc5091 = curl_exec($sp9f83d6); $sp4c5a1f = curl_getinfo($sp9f83d6, CURLINFO_HEADER_SIZE); $sp06401d = substr($spdc5091, 0, $sp4c5a1f); $spd0789a = substr($spdc5091, $sp4c5a1f); curl_close($sp9f83d6); if ($sp5ee4b6 !== false) { $spc69671 = explode('
+', $sp06401d); $spa46b28 = ''; foreach ($spc69671 as $sp06401d) { if (strpos($sp06401d, 'Set-Cookie') !== false) { if (strpos($sp06401d, ';') !== false) { $spa46b28 = $spa46b28 . trim(Helper::str_between($sp06401d, 'Set-Cookie:', ';')) . ';'; } else { $spa46b28 = $spa46b28 . trim(str_replace('Set-Cookie:', '', $sp06401d)) . ';'; } } } $sp5ee4b6 = self::combineCookie($sp5ee4b6, $spa46b28); } return $spd0789a; } public static function get($spd2457c, $spc69671 = array(), $spdecb3f = 5, &$sp5ee4b6 = false) { return self::curl($spd2457c, 0, '', $spc69671, $spdecb3f, $sp5ee4b6); } public static function post($spd2457c, $spe25017 = '', $spc69671 = array(), $spdecb3f = 5, &$sp5ee4b6 = false) { return self::curl($spd2457c, 1, $spe25017, $spc69671, $spdecb3f, $sp5ee4b6); } public static function combineCookie($sp7c77cf, $spc96365) { $sp556d33 = explode(';', $sp7c77cf); $spf9952d = explode(';', $spc96365); foreach ($sp556d33 as $spb0a0bf) { if (self::cookieIsExists($spf9952d, self::cookieGetName($spb0a0bf)) == false) { array_push($spf9952d, $spb0a0bf); } } $sp491331 = ''; foreach ($spf9952d as $spb0a0bf) { if (substr($spb0a0bf, -8, 8) != '=deleted' && strlen($spb0a0bf) > 1) { $sp491331 .= $spb0a0bf . '; '; } } return substr($sp491331, 0, strlen($sp491331) - 2); } public static function cookieGetName($spf7924d) { $sp3437bd = strpos($spf7924d, '='); return substr($spf7924d, 0, $sp3437bd); } public static function cookieGetValue($spf7924d) { $sp3437bd = strpos($spf7924d, '='); $sp8a97b1 = substr($spf7924d, $sp3437bd + 1, strlen($spf7924d) - $sp3437bd); return $sp8a97b1; } public static function cookieGet($sp5ee4b6, $sp34e4b5, $sp432313 = false) { $sp5ee4b6 = str_replace(' ', '', $sp5ee4b6); if (substr($sp5ee4b6, -1, 1) != ';') { $sp5ee4b6 = ';' . $sp5ee4b6 . ';'; } else { $sp5ee4b6 = ';' . $sp5ee4b6; } $sp70089e = Helper::str_between($sp5ee4b6, ';' . $sp34e4b5 . '=', ';'); if (!$sp432313 || $sp70089e == '') { return $sp70089e; } else { return $sp34e4b5 . '=' . $sp70089e; } } private static function cookieIsExists($spf904d7, $sp8534d0) { foreach ($spf904d7 as $spb0a0bf) { if (self::cookieGetName($spb0a0bf) == $sp8534d0) { return true; } } return false; } function test() { $sp8a97b1 = self::combineCookie('a=1;b=2;c=3', 'c=5'); var_dump($sp8a97b1); } }
\ No newline at end of file
diff --git a/app/Library/FundHelper.php b/app/Library/FundHelper.php
index db31dd237..64416fd21 100644
--- a/app/Library/FundHelper.php
+++ b/app/Library/FundHelper.php
@@ -1,2 +1,2 @@
lockForUpdate()->firstOrFail(); $spb9589c = $sp8b6933($sp4f4c0d); if ($spb9589c !== self::ACTION_CONTINUE) { return $spb9589c; } $spafa70b = User::where('id', $sp4f4c0d->user_id)->lockForUpdate()->firstOrFail(); $spafa70b->m_all += $sp4f4c0d->income; $spafa70b->saveOrFail(); $sp1d0214 = new FundRecord(); $sp1d0214->user_id = $sp4f4c0d->user_id; $sp1d0214->type = FundRecord::TYPE_IN; $sp1d0214->amount = $sp4f4c0d->income; $sp1d0214->all = $spafa70b->m_all; $sp1d0214->frozen = $spafa70b->m_frozen; $sp1d0214->paid = $spafa70b->m_paid; $sp1d0214->balance = $spafa70b->m_balance; $sp1d0214->remark = '订单#' . $sp4f4c0d->order_no; $sp1d0214->order_id = $sp4f4c0d->id; $sp1d0214->saveOrFail(); return true; }); } catch (\Throwable $sp81eee8) { $sp093e23 = 'FundHelper.orderSuccess error, order_id:' . $sp48ee76; if ($sp4f4c0d) { $sp093e23 .= ', user_id:' . $sp4f4c0d->user_id . ',income:' . $sp4f4c0d->income . ',order_no:' . $sp4f4c0d->order_no; } Log::error($sp093e23 . ' with exception:', array('Exception' => $sp81eee8)); return false; } } public static function orderFreeze($sp48ee76, $spe3efa4) { $sp4f4c0d = null; try { return DB::transaction(function () use($sp48ee76, &$sp4f4c0d, $spe3efa4) { $sp4f4c0d = \App\Order::where('id', $sp48ee76)->lockForUpdate()->firstOrFail(); if ($sp4f4c0d->status === Order::STATUS_REFUND) { return false; } if ($sp4f4c0d->status === Order::STATUS_FROZEN) { return true; } $sp278862 = $sp4f4c0d->status; if ($sp278862 === \App\Order::STATUS_SUCCESS) { $spa88bbc = '已发货'; } elseif ($sp278862 === \App\Order::STATUS_UNPAY) { $spa88bbc = '未付款'; } elseif ($sp278862 === \App\Order::STATUS_PAID) { $spa88bbc = '未发货'; } else { throw new \Exception('unknown'); } $spafa70b = User::where('id', $sp4f4c0d->user_id)->lockForUpdate()->firstOrFail(); $sp1d0214 = new FundRecord(); $sp1d0214->user_id = $sp4f4c0d->user_id; $sp1d0214->type = FundRecord::TYPE_OUT; $sp1d0214->order_id = $sp4f4c0d->id; $sp1d0214->remark = $sp4f4c0d === $sp4f4c0d ? '' : '关联订单#' . $sp4f4c0d->order_no . ': '; if ($sp278862 === \App\Order::STATUS_SUCCESS) { $spafa70b->m_frozen += $sp4f4c0d->income; $spafa70b->saveOrFail(); $sp1d0214->amount = -$sp4f4c0d->income; $sp1d0214->remark .= $spe3efa4 . ', 冻结订单#' . $sp4f4c0d->order_no; } else { $sp1d0214->amount = 0; $sp1d0214->remark .= $spe3efa4 . ', 冻结订单(' . $spa88bbc . ')#' . $sp4f4c0d->order_no; } $sp1d0214->all = $spafa70b->m_all; $sp1d0214->frozen = $spafa70b->m_frozen; $sp1d0214->paid = $spafa70b->m_paid; $sp1d0214->balance = $spafa70b->m_balance; $sp1d0214->saveOrFail(); $sp4f4c0d->status = \App\Order::STATUS_FROZEN; $sp4f4c0d->frozen_reason = ($sp4f4c0d === $sp4f4c0d ? '' : '关联订单#' . $sp4f4c0d->order_no . ': ') . $spe3efa4; $sp4f4c0d->saveOrFail(); return true; }); } catch (\Throwable $sp81eee8) { $sp093e23 = 'FundHelper.orderFreeze error'; if ($sp4f4c0d) { $sp093e23 .= ', order_no:' . $sp4f4c0d->order_no . ', user_id:' . $sp4f4c0d->user_id . ', amount:' . $sp4f4c0d->income; } else { $sp093e23 .= ', order_no: null'; } Log::error($sp093e23 . ' with exception:', array('Exception' => $sp81eee8)); return false; } } public static function orderUnfreeze($sp48ee76, $sp114fde, callable $spab60c4 = null, &$sp56845b = null) { $sp4f4c0d = null; try { return DB::transaction(function () use($sp48ee76, &$sp4f4c0d, $sp114fde, $spab60c4, &$sp56845b) { $sp4f4c0d = \App\Order::where('id', $sp48ee76)->lockForUpdate()->firstOrFail(); if ($spab60c4 !== null) { $spb9589c = $spab60c4(); if ($spb9589c !== self::ACTION_CONTINUE) { return $spb9589c; } } if ($sp4f4c0d->status === Order::STATUS_REFUND) { $sp56845b = $sp4f4c0d->status; return false; } if ($sp4f4c0d->status !== Order::STATUS_FROZEN) { $sp56845b = $sp4f4c0d->status; return true; } $sp34c679 = $sp4f4c0d->card_orders()->exists(); if ($sp34c679) { $sp56845b = \App\Order::STATUS_SUCCESS; $spa88bbc = '已发货'; } else { if ($sp4f4c0d->paid_at === NULL) { $sp56845b = \App\Order::STATUS_UNPAY; $spa88bbc = '未付款'; } else { $sp56845b = \App\Order::STATUS_PAID; $spa88bbc = '未发货'; } } $spafa70b = User::where('id', $sp4f4c0d->user_id)->lockForUpdate()->firstOrFail(); $sp1d0214 = new FundRecord(); $sp1d0214->user_id = $sp4f4c0d->user_id; $sp1d0214->type = FundRecord::TYPE_IN; $sp1d0214->remark = $sp4f4c0d === $sp4f4c0d ? '' : '关联订单#' . $sp4f4c0d->order_no . ': '; $sp1d0214->order_id = $sp4f4c0d->id; if ($sp34c679) { $spafa70b->m_frozen -= $sp4f4c0d->income; $spafa70b->saveOrFail(); $sp1d0214->amount = $sp4f4c0d->income; $sp1d0214->remark .= $sp114fde . ', 解冻订单#' . $sp4f4c0d->order_no; } else { $sp1d0214->amount = 0; $sp1d0214->remark .= $sp114fde . ', 解冻订单(' . $spa88bbc . ')#' . $sp4f4c0d->order_no; } $sp1d0214->all = $spafa70b->m_all; $sp1d0214->frozen = $spafa70b->m_frozen; $sp1d0214->paid = $spafa70b->m_paid; $sp1d0214->balance = $spafa70b->m_balance; $sp1d0214->saveOrFail(); $sp4f4c0d->status = $sp56845b; $sp4f4c0d->saveOrFail(); return true; }); } catch (\Throwable $sp81eee8) { $sp093e23 = 'FundHelper.orderUnfreeze error'; if ($sp4f4c0d) { $sp093e23 .= ', order_no:' . $sp4f4c0d->order_no . ', user_id:' . $sp4f4c0d->user_id . ',amount:' . $sp4f4c0d->income; } else { $sp093e23 .= ', order_no: null'; } Log::error($sp093e23 . ' with exception:', array('Exception' => $sp81eee8)); return false; } } }
\ No newline at end of file
+namespace App\Library; use App\Order; use App\User; use App\FundRecord; use Illuminate\Support\Facades\DB; class FundHelper { const ACTION_CONTINUE = 1001; public static function orderSuccess($spd04f8a, callable $sp44d51d) { $spe0613f = null; try { return DB::transaction(function () use($spd04f8a, &$spe0613f, $sp44d51d) { $spe0613f = \App\Order::where('id', $spd04f8a)->lockForUpdate()->firstOrFail(); $sp9b52fe = $sp44d51d($spe0613f); if ($sp9b52fe !== self::ACTION_CONTINUE) { return $sp9b52fe; } $spbbb773 = User::where('id', $spe0613f->user_id)->lockForUpdate()->firstOrFail(); $spbbb773->m_all += $spe0613f->income; $spbbb773->saveOrFail(); $spf4b37f = new FundRecord(); $spf4b37f->user_id = $spe0613f->user_id; $spf4b37f->type = FundRecord::TYPE_IN; $spf4b37f->amount = $spe0613f->income; $spf4b37f->all = $spbbb773->m_all; $spf4b37f->frozen = $spbbb773->m_frozen; $spf4b37f->paid = $spbbb773->m_paid; $spf4b37f->balance = $spbbb773->m_balance; $spf4b37f->remark = '订单#' . $spe0613f->order_no; $spf4b37f->order_id = $spe0613f->id; $spf4b37f->saveOrFail(); return true; }); } catch (\Throwable $sp3f4aab) { $sp417133 = 'FundHelper.orderSuccess error, order_id:' . $spd04f8a; if ($spe0613f) { $sp417133 .= ', user_id:' . $spe0613f->user_id . ',income:' . $spe0613f->income . ',order_no:' . $spe0613f->order_no; } Log::error($sp417133 . ' with exception:', array('Exception' => $sp3f4aab)); return false; } } public static function orderFreeze($spd04f8a, $sp1abd79) { $spe0613f = null; try { return DB::transaction(function () use($spd04f8a, &$spe0613f, $sp1abd79) { $spe0613f = \App\Order::where('id', $spd04f8a)->lockForUpdate()->firstOrFail(); if ($spe0613f->status === Order::STATUS_REFUND) { return false; } if ($spe0613f->status === Order::STATUS_FROZEN) { return true; } $spc9c73d = $spe0613f->status; if ($spc9c73d === \App\Order::STATUS_SUCCESS) { $sp630f04 = '已发货'; } elseif ($spc9c73d === \App\Order::STATUS_UNPAY) { $sp630f04 = '未付款'; } elseif ($spc9c73d === \App\Order::STATUS_PAID) { $sp630f04 = '未发货'; } else { throw new \Exception('unknown'); } $spbbb773 = User::where('id', $spe0613f->user_id)->lockForUpdate()->firstOrFail(); $spf4b37f = new FundRecord(); $spf4b37f->user_id = $spe0613f->user_id; $spf4b37f->type = FundRecord::TYPE_OUT; $spf4b37f->order_id = $spe0613f->id; $spf4b37f->remark = $spe0613f === $spe0613f ? '' : '关联订单#' . $spe0613f->order_no . ': '; if ($spc9c73d === \App\Order::STATUS_SUCCESS) { $spbbb773->m_frozen += $spe0613f->income; $spbbb773->saveOrFail(); $spf4b37f->amount = -$spe0613f->income; $spf4b37f->remark .= $sp1abd79 . ', 冻结订单#' . $spe0613f->order_no; } else { $spf4b37f->amount = 0; $spf4b37f->remark .= $sp1abd79 . ', 冻结订单(' . $sp630f04 . ')#' . $spe0613f->order_no; } $spf4b37f->all = $spbbb773->m_all; $spf4b37f->frozen = $spbbb773->m_frozen; $spf4b37f->paid = $spbbb773->m_paid; $spf4b37f->balance = $spbbb773->m_balance; $spf4b37f->saveOrFail(); $spe0613f->status = \App\Order::STATUS_FROZEN; $spe0613f->frozen_reason = ($spe0613f === $spe0613f ? '' : '关联订单#' . $spe0613f->order_no . ': ') . $sp1abd79; $spe0613f->saveOrFail(); return true; }); } catch (\Throwable $sp3f4aab) { $sp417133 = 'FundHelper.orderFreeze error'; if ($spe0613f) { $sp417133 .= ', order_no:' . $spe0613f->order_no . ', user_id:' . $spe0613f->user_id . ', amount:' . $spe0613f->income; } else { $sp417133 .= ', order_no: null'; } Log::error($sp417133 . ' with exception:', array('Exception' => $sp3f4aab)); return false; } } public static function orderUnfreeze($spd04f8a, $sp970605, callable $sp9ac62f = null, &$sp3f483e = null) { $spe0613f = null; try { return DB::transaction(function () use($spd04f8a, &$spe0613f, $sp970605, $sp9ac62f, &$sp3f483e) { $spe0613f = \App\Order::where('id', $spd04f8a)->lockForUpdate()->firstOrFail(); if ($sp9ac62f !== null) { $sp9b52fe = $sp9ac62f(); if ($sp9b52fe !== self::ACTION_CONTINUE) { return $sp9b52fe; } } if ($spe0613f->status === Order::STATUS_REFUND) { $sp3f483e = $spe0613f->status; return false; } if ($spe0613f->status !== Order::STATUS_FROZEN) { $sp3f483e = $spe0613f->status; return true; } $spc79f05 = $spe0613f->card_orders()->exists(); if ($spc79f05) { $sp3f483e = \App\Order::STATUS_SUCCESS; $sp630f04 = '已发货'; } else { if ($spe0613f->paid_at === NULL) { $sp3f483e = \App\Order::STATUS_UNPAY; $sp630f04 = '未付款'; } else { $sp3f483e = \App\Order::STATUS_PAID; $sp630f04 = '未发货'; } } $spbbb773 = User::where('id', $spe0613f->user_id)->lockForUpdate()->firstOrFail(); $spf4b37f = new FundRecord(); $spf4b37f->user_id = $spe0613f->user_id; $spf4b37f->type = FundRecord::TYPE_IN; $spf4b37f->remark = $spe0613f === $spe0613f ? '' : '关联订单#' . $spe0613f->order_no . ': '; $spf4b37f->order_id = $spe0613f->id; if ($spc79f05) { $spbbb773->m_frozen -= $spe0613f->income; $spbbb773->saveOrFail(); $spf4b37f->amount = $spe0613f->income; $spf4b37f->remark .= $sp970605 . ', 解冻订单#' . $spe0613f->order_no; } else { $spf4b37f->amount = 0; $spf4b37f->remark .= $sp970605 . ', 解冻订单(' . $sp630f04 . ')#' . $spe0613f->order_no; } $spf4b37f->all = $spbbb773->m_all; $spf4b37f->frozen = $spbbb773->m_frozen; $spf4b37f->paid = $spbbb773->m_paid; $spf4b37f->balance = $spbbb773->m_balance; $spf4b37f->saveOrFail(); $spe0613f->status = $sp3f483e; $spe0613f->saveOrFail(); return true; }); } catch (\Throwable $sp3f4aab) { $sp417133 = 'FundHelper.orderUnfreeze error'; if ($spe0613f) { $sp417133 .= ', order_no:' . $spe0613f->order_no . ', user_id:' . $spe0613f->user_id . ',amount:' . $spe0613f->income; } else { $sp417133 .= ', order_no: null'; } Log::error($sp417133 . ' with exception:', array('Exception' => $sp3f4aab)); return false; } } }
\ No newline at end of file
diff --git a/app/Library/Geetest/API.php b/app/Library/Geetest/API.php
index 8b67aa05b..0624da0b0 100644
--- a/app/Library/Geetest/API.php
+++ b/app/Library/Geetest/API.php
@@ -1,2 +1,2 @@
geetest_conf = $spbe80b7; } public static function get() { $sp53f8aa = config('services.geetest.id'); $sp1ed429 = config('services.geetest.key'); if (!strlen($sp53f8aa) || !strlen($sp1ed429)) { return null; } $sp75b3c0 = new Lib($sp53f8aa, $sp1ed429); $spfa021e = time() . rand(1, 10000); $sp7a9982 = $sp75b3c0->pre_process($spfa021e); $spb9589c = json_decode($sp75b3c0->get_response_str()); Session::put('gt_server', $sp7a9982); Session::put('gt_user_id', $spfa021e); return $spb9589c; } public static function verify($sp00e976, $sp2beb18, $sp8d704b) { $sp75b3c0 = new Lib(config('services.geetest.id'), config('services.geetest.key')); $spfa021e = Session::get('gt_user_id'); if (Session::get('gt_server') == 1) { $spbbda25 = $sp75b3c0->success_validate($sp00e976, $sp2beb18, $sp8d704b, $spfa021e); if ($spbbda25) { return true; } else { return false; } } else { if ($sp75b3c0->fail_validate($sp00e976, $sp2beb18, $sp8d704b)) { return true; } else { return false; } } } }
\ No newline at end of file
+namespace App\Library\Geetest; use Illuminate\Support\Facades\Session; class API { private $geetest_conf = null; public function __construct($sp9d4382) { $this->geetest_conf = $sp9d4382; } public static function get() { $sp3c46ab = config('services.geetest.id'); $spf1241f = config('services.geetest.key'); if (!strlen($sp3c46ab) || !strlen($spf1241f)) { return null; } $sp5fca3c = new Lib($sp3c46ab, $spf1241f); $sp15a746 = time() . rand(1, 10000); $sp27b58d = $sp5fca3c->pre_process($sp15a746); $sp9b52fe = json_decode($sp5fca3c->get_response_str()); Session::put('gt_server', $sp27b58d); Session::put('gt_user_id', $sp15a746); return $sp9b52fe; } public static function verify($spb4583e, $spc112fc, $spafb567) { $sp5fca3c = new Lib(config('services.geetest.id'), config('services.geetest.key')); $sp15a746 = Session::get('gt_user_id'); if (Session::get('gt_server') == 1) { $spb72f32 = $sp5fca3c->success_validate($spb4583e, $spc112fc, $spafb567, $sp15a746); if ($spb72f32) { return true; } else { return false; } } else { if ($sp5fca3c->fail_validate($spb4583e, $spc112fc, $spafb567)) { return true; } else { return false; } } } }
\ No newline at end of file
diff --git a/app/Library/Geetest/Lib.php b/app/Library/Geetest/Lib.php
index d58bc8ba3..18c9a1d37 100644
--- a/app/Library/Geetest/Lib.php
+++ b/app/Library/Geetest/Lib.php
@@ -1,4 +1,4 @@
captcha_id = $spb40eab; $this->private_key = $spe57db5; } public function pre_process($spfa021e = null) { $sp3db1b2 = 'http://api.geetest.com/register.php?gt=' . $this->captcha_id; if ($spfa021e != null and is_string($spfa021e)) { $sp3db1b2 = $sp3db1b2 . '&user_id=' . $spfa021e; } $spc94e0a = $this->send_request($sp3db1b2); if (strlen($spc94e0a) != 32) { $this->failback_process(); return 0; } $this->success_process($spc94e0a); return 1; } private function success_process($spc94e0a) { $spc94e0a = md5($spc94e0a . $this->private_key); $spbbda25 = array('success' => 1, 'gt' => $this->captcha_id, 'challenge' => $spc94e0a); $this->response = $spbbda25; } private function failback_process() { $spd8f9a7 = md5(rand(0, 100)); $sp42225e = md5(rand(0, 100)); $spc94e0a = $spd8f9a7 . substr($sp42225e, 0, 2); $spbbda25 = array('success' => 0, 'gt' => $this->captcha_id, 'challenge' => $spc94e0a); $this->response = $spbbda25; } public function get_response_str() { return json_encode($this->response); } public function get_response() { return $this->response; } public function success_validate($spc94e0a, $spca2c04, $sp6b2070, $spfa021e = null) { if (!$this->check_validate($spc94e0a, $spca2c04)) { return 0; } $sp5aa598 = array('seccode' => $sp6b2070, 'sdk' => self::GT_SDK_VERSION); if ($spfa021e != null and is_string($spfa021e)) { $sp5aa598['user_id'] = $spfa021e; } $sp3db1b2 = 'http://api.geetest.com/validate.php'; $spb9d297 = $this->post_request($sp3db1b2, $sp5aa598); if ($spb9d297 == md5($sp6b2070)) { return 1; } else { if ($spb9d297 == 'false') { return 0; } else { return 0; } } } public function fail_validate($spc94e0a, $spca2c04, $sp6b2070) { if ($spca2c04) { $spb914e6 = explode('_', $spca2c04); try { $sp9f5c31 = $this->decode_response($spc94e0a, $spb914e6['0']); $spf1db98 = $this->decode_response($spc94e0a, $spb914e6['1']); $spba55ad = $this->decode_response($spc94e0a, $spb914e6['2']); $sped666b = $this->get_failback_pic_ans($spf1db98, $spba55ad); $sp777a44 = abs($sp9f5c31 - $sped666b); } catch (\Exception $sp81eee8) { return 1; } if ($sp777a44 < 4) { return 1; } else { return 0; } } else { return 0; } } private function check_validate($spc94e0a, $spca2c04) { if (strlen($spca2c04) != 32) { return false; } if (md5($this->private_key . 'geetest' . $spc94e0a) != $spca2c04) { return false; } return true; } private function send_request($sp3db1b2) { if (function_exists('curl_exec')) { $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout); curl_setopt($sp9b0943, CURLOPT_TIMEOUT, self::$socketTimeout); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, 1); $sp5aa598 = curl_exec($sp9b0943); if (curl_errno($sp9b0943)) { $spae8f1a = sprintf('curl[%s] error[%s]', $sp3db1b2, curl_errno($sp9b0943) . ':' . curl_error($sp9b0943)); $this->triggerError($spae8f1a); } curl_close($sp9b0943); } else { $spcef4b3 = array('http' => array('method' => 'GET', 'timeout' => self::$connectTimeout + self::$socketTimeout)); $sp1a1db3 = stream_context_create($spcef4b3); $sp5aa598 = file_get_contents($sp3db1b2, false, $sp1a1db3); } return $sp5aa598; } private function post_request($sp3db1b2, $sp50d070 = '') { if (!$sp50d070) { return false; } $sp5aa598 = http_build_query($sp50d070); if (function_exists('curl_exec')) { $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9b0943, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout); curl_setopt($sp9b0943, CURLOPT_TIMEOUT, self::$socketTimeout); if (!$sp50d070) { curl_setopt($sp9b0943, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); } else { curl_setopt($sp9b0943, CURLOPT_POST, 1); curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $sp5aa598); } $sp5aa598 = curl_exec($sp9b0943); if (curl_errno($sp9b0943)) { $spae8f1a = sprintf('curl[%s] error[%s]', $sp3db1b2, curl_errno($sp9b0943) . ':' . curl_error($sp9b0943)); $this->triggerError($spae8f1a); } curl_close($sp9b0943); } else { if ($sp50d070) { $spcef4b3 = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded
-' . 'Content-Length: ' . strlen($sp5aa598) . '
-', 'content' => $sp5aa598, 'timeout' => self::$connectTimeout + self::$socketTimeout)); $sp1a1db3 = stream_context_create($spcef4b3); $sp5aa598 = file_get_contents($sp3db1b2, false, $sp1a1db3); } } return $sp5aa598; } private function decode_response($spc94e0a, $sp9ad127) { if (strlen($sp9ad127) > 100) { return 0; } $sp1ed429 = array(); $spcbc8da = array(); $sp8f6ac5 = array('0' => 1, '1' => 2, '2' => 5, '3' => 10, '4' => 50); $spfdb02a = 0; $sp32d1c7 = 0; $sp7d0c7d = str_split($spc94e0a); $spbac1e7 = str_split($sp9ad127); for ($spea591f = 0; $spea591f < strlen($spc94e0a); $spea591f++) { $sp4a9ec3 = $sp7d0c7d[$spea591f]; if (in_array($sp4a9ec3, $spcbc8da)) { continue; } else { $spb914e6 = $sp8f6ac5[$spfdb02a % 5]; array_push($spcbc8da, $sp4a9ec3); $spfdb02a++; $sp1ed429[$sp4a9ec3] = $spb914e6; } } for ($spabe616 = 0; $spabe616 < strlen($sp9ad127); $spabe616++) { $sp32d1c7 += $sp1ed429[$spbac1e7[$spabe616]]; } $sp32d1c7 = $sp32d1c7 - $this->decodeRandBase($spc94e0a); return $sp32d1c7; } private function get_x_pos_from_str($spdcdf3c) { if (strlen($spdcdf3c) != 5) { return 0; } $sp13c4c5 = 0; $spf6de2c = 200; $sp13c4c5 = base_convert($spdcdf3c, 16, 10); $spbbda25 = $sp13c4c5 % $spf6de2c; $spbbda25 = $spbbda25 < 40 ? 40 : $spbbda25; return $spbbda25; } private function get_failback_pic_ans($sp0aacbd, $spc3821d) { $spf4f898 = substr(md5($sp0aacbd), 0, 9); $spb62152 = substr(md5($spc3821d), 10, 9); $spfe2428 = ''; for ($spea591f = 0; $spea591f < 9; $spea591f++) { if ($spea591f % 2 == 0) { $spfe2428 = $spfe2428 . $spf4f898[$spea591f]; } elseif ($spea591f % 2 == 1) { $spfe2428 = $spfe2428 . $spb62152[$spea591f]; } } $sp08851d = substr($spfe2428, 4, 5); $sped666b = $this->get_x_pos_from_str($sp08851d); return $sped666b; } private function decodeRandBase($spc94e0a) { $sp457d29 = substr($spc94e0a, 32, 2); $sp2ad775 = array(); for ($spea591f = 0; $spea591f < strlen($sp457d29); $spea591f++) { $spd053a4 = ord($sp457d29[$spea591f]); $spbbda25 = $spd053a4 > 57 ? $spd053a4 - 87 : $spd053a4 - 48; array_push($sp2ad775, $spbbda25); } $sp3a31d7 = $sp2ad775['0'] * 36 + $sp2ad775['1']; return $sp3a31d7; } private function triggerError($spae8f1a) { } }
\ No newline at end of file
+namespace App\Library\Geetest; class Lib { const GT_SDK_VERSION = 'php_3.2.0'; public static $connectTimeout = 1; public static $socketTimeout = 1; private $response; public $captcha_id; public $private_key; public function __construct($sp51d48d, $spdb68db) { $this->captcha_id = $sp51d48d; $this->private_key = $spdb68db; } public function pre_process($sp15a746 = null) { $spd2457c = 'http://api.geetest.com/register.php?gt=' . $this->captcha_id; if ($sp15a746 != null and is_string($sp15a746)) { $spd2457c = $spd2457c . '&user_id=' . $sp15a746; } $spd2db0d = $this->send_request($spd2457c); if (strlen($spd2db0d) != 32) { $this->failback_process(); return 0; } $this->success_process($spd2db0d); return 1; } private function success_process($spd2db0d) { $spd2db0d = md5($spd2db0d . $this->private_key); $spb72f32 = array('success' => 1, 'gt' => $this->captcha_id, 'challenge' => $spd2db0d); $this->response = $spb72f32; } private function failback_process() { $sp0eb557 = md5(rand(0, 100)); $spf7d3c1 = md5(rand(0, 100)); $spd2db0d = $sp0eb557 . substr($spf7d3c1, 0, 2); $spb72f32 = array('success' => 0, 'gt' => $this->captcha_id, 'challenge' => $spd2db0d); $this->response = $spb72f32; } public function get_response_str() { return json_encode($this->response); } public function get_response() { return $this->response; } public function success_validate($spd2db0d, $sp58e4bb, $sp8160b3, $sp15a746 = null) { if (!$this->check_validate($spd2db0d, $sp58e4bb)) { return 0; } $sp6fd648 = array('seccode' => $sp8160b3, 'sdk' => self::GT_SDK_VERSION); if ($sp15a746 != null and is_string($sp15a746)) { $sp6fd648['user_id'] = $sp15a746; } $spd2457c = 'http://api.geetest.com/validate.php'; $spd40723 = $this->post_request($spd2457c, $sp6fd648); if ($spd40723 == md5($sp8160b3)) { return 1; } else { if ($spd40723 == 'false') { return 0; } else { return 0; } } } public function fail_validate($spd2db0d, $sp58e4bb, $sp8160b3) { if ($sp58e4bb) { $sp8b9401 = explode('_', $sp58e4bb); try { $sp41cfc8 = $this->decode_response($spd2db0d, $sp8b9401['0']); $sp2224cd = $this->decode_response($spd2db0d, $sp8b9401['1']); $sp7a9fb4 = $this->decode_response($spd2db0d, $sp8b9401['2']); $sp4f577f = $this->get_failback_pic_ans($sp2224cd, $sp7a9fb4); $sp5eeb86 = abs($sp41cfc8 - $sp4f577f); } catch (\Exception $sp3f4aab) { return 1; } if ($sp5eeb86 < 4) { return 1; } else { return 0; } } else { return 0; } } private function check_validate($spd2db0d, $sp58e4bb) { if (strlen($sp58e4bb) != 32) { return false; } if (md5($this->private_key . 'geetest' . $spd2db0d) != $sp58e4bb) { return false; } return true; } private function send_request($spd2457c) { if (function_exists('curl_exec')) { $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout); curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, self::$socketTimeout); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, 1); $sp6fd648 = curl_exec($sp9f83d6); if (curl_errno($sp9f83d6)) { $sp6b9990 = sprintf('curl[%s] error[%s]', $spd2457c, curl_errno($sp9f83d6) . ':' . curl_error($sp9f83d6)); $this->triggerError($sp6b9990); } curl_close($sp9f83d6); } else { $spe3a26a = array('http' => array('method' => 'GET', 'timeout' => self::$connectTimeout + self::$socketTimeout)); $sp3d7e0d = stream_context_create($spe3a26a); $sp6fd648 = file_get_contents($spd2457c, false, $sp3d7e0d); } return $sp6fd648; } private function post_request($spd2457c, $spe4b65a = '') { if (!$spe4b65a) { return false; } $sp6fd648 = http_build_query($spe4b65a); if (function_exists('curl_exec')) { $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9f83d6, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout); curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, self::$socketTimeout); if (!$spe4b65a) { curl_setopt($sp9f83d6, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); } else { curl_setopt($sp9f83d6, CURLOPT_POST, 1); curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $sp6fd648); } $sp6fd648 = curl_exec($sp9f83d6); if (curl_errno($sp9f83d6)) { $sp6b9990 = sprintf('curl[%s] error[%s]', $spd2457c, curl_errno($sp9f83d6) . ':' . curl_error($sp9f83d6)); $this->triggerError($sp6b9990); } curl_close($sp9f83d6); } else { if ($spe4b65a) { $spe3a26a = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded
+' . 'Content-Length: ' . strlen($sp6fd648) . '
+', 'content' => $sp6fd648, 'timeout' => self::$connectTimeout + self::$socketTimeout)); $sp3d7e0d = stream_context_create($spe3a26a); $sp6fd648 = file_get_contents($spd2457c, false, $sp3d7e0d); } } return $sp6fd648; } private function decode_response($spd2db0d, $sp29fcf1) { if (strlen($sp29fcf1) > 100) { return 0; } $spf1241f = array(); $sp9a3274 = array(); $sp6057d5 = array('0' => 1, '1' => 2, '2' => 5, '3' => 10, '4' => 50); $spdd51cd = 0; $spab3a3a = 0; $sp8978e5 = str_split($spd2db0d); $spe3f6b1 = str_split($sp29fcf1); for ($sp6b283c = 0; $sp6b283c < strlen($spd2db0d); $sp6b283c++) { $sp10eb73 = $sp8978e5[$sp6b283c]; if (in_array($sp10eb73, $sp9a3274)) { continue; } else { $sp8b9401 = $sp6057d5[$spdd51cd % 5]; array_push($sp9a3274, $sp10eb73); $spdd51cd++; $spf1241f[$sp10eb73] = $sp8b9401; } } for ($spc12a13 = 0; $spc12a13 < strlen($sp29fcf1); $spc12a13++) { $spab3a3a += $spf1241f[$spe3f6b1[$spc12a13]]; } $spab3a3a = $spab3a3a - $this->decodeRandBase($spd2db0d); return $spab3a3a; } private function get_x_pos_from_str($sp7b07dd) { if (strlen($sp7b07dd) != 5) { return 0; } $sp5707e7 = 0; $sp469ed5 = 200; $sp5707e7 = base_convert($sp7b07dd, 16, 10); $spb72f32 = $sp5707e7 % $sp469ed5; $spb72f32 = $spb72f32 < 40 ? 40 : $spb72f32; return $spb72f32; } private function get_failback_pic_ans($sp2435cc, $spdfae7a) { $sp9772e3 = substr(md5($sp2435cc), 0, 9); $spd42798 = substr(md5($spdfae7a), 10, 9); $sp4762b8 = ''; for ($sp6b283c = 0; $sp6b283c < 9; $sp6b283c++) { if ($sp6b283c % 2 == 0) { $sp4762b8 = $sp4762b8 . $sp9772e3[$sp6b283c]; } elseif ($sp6b283c % 2 == 1) { $sp4762b8 = $sp4762b8 . $spd42798[$sp6b283c]; } } $sp83ed8d = substr($sp4762b8, 4, 5); $sp4f577f = $this->get_x_pos_from_str($sp83ed8d); return $sp4f577f; } private function decodeRandBase($spd2db0d) { $sp469fe5 = substr($spd2db0d, 32, 2); $spcb07a3 = array(); for ($sp6b283c = 0; $sp6b283c < strlen($sp469fe5); $sp6b283c++) { $sp7c4609 = ord($sp469fe5[$sp6b283c]); $spb72f32 = $sp7c4609 > 57 ? $sp7c4609 - 87 : $sp7c4609 - 48; array_push($spcb07a3, $spb72f32); } $spbe38a6 = $spcb07a3['0'] * 36 + $spcb07a3['1']; return $spbe38a6; } private function triggerError($sp6b9990) { } }
\ No newline at end of file
diff --git a/app/Library/Helper.php b/app/Library/Helper.php
index 713e87228..094b583e0 100644
--- a/app/Library/Helper.php
+++ b/app/Library/Helper.php
@@ -1,2 +1,2 @@
= $sp70b0e5) { return ''; } $sp19f67c = strlen($sp518d68); $spb9589c = substr($sp72201b, $spae03e3 + $sp19f67c, $sp70b0e5 - $spae03e3 - $sp19f67c); return $spb9589c; } public static function str_between_longest($sp72201b, $sp518d68, $sp966620) { $spae03e3 = strpos($sp72201b, $sp518d68); if ($spae03e3 === false) { return ''; } $sp70b0e5 = strrpos($sp72201b, $sp966620, $spae03e3 + strlen($sp518d68)); if ($sp70b0e5 === false || $spae03e3 >= $sp70b0e5) { return ''; } $sp19f67c = strlen($sp518d68); $spb9589c = substr($sp72201b, $spae03e3 + $sp19f67c, $sp70b0e5 - $spae03e3 - $sp19f67c); return $spb9589c; } public static function format_url($sp3db1b2) { if (!strlen($sp3db1b2)) { return $sp3db1b2; } if (!starts_with($sp3db1b2, 'http://') && !starts_with($sp3db1b2, 'https://')) { $sp3db1b2 = 'http://' . $sp3db1b2; } while (ends_with($sp3db1b2, '/')) { $sp3db1b2 = substr($sp3db1b2, 0, -1); } return $sp3db1b2; } public static function lite_hash($sp72201b) { $spd07afe = crc32((string) $sp72201b); if ($spd07afe < 0) { $spd07afe &= 1 << 7; } return $spd07afe; } const ID_TYPE_USER = 0; const ID_TYPE_CATEGORY = 1; const ID_TYPE_PRODUCT = 2; public static function id_encode($sp53f8aa, $sp8f5ac7) { $sp5f0a8f = new Hashids(config('app.key'), 8, 'abcdefghijklmnopqrstuvwxyz1234567890'); return @$sp5f0a8f->encode(self::lite_hash($sp53f8aa), $sp53f8aa, self::lite_hash($sp8f5ac7), $sp8f5ac7); } public static function id_decode($spb0e6fb, $sp8f5ac7) { if (strlen($spb0e6fb) < 8) { $sp5f0a8f = new Hashids(config('app.key')); if ($sp8f5ac7 === self::ID_TYPE_USER) { return intval(@$sp5f0a8f->decodeHex($spb0e6fb)); } else { return intval(@$sp5f0a8f->decode($spb0e6fb)[0]); } } $sp5f0a8f = new Hashids(config('app.key'), 8, 'abcdefghijklmnopqrstuvwxyz1234567890'); return intval(@$sp5f0a8f->decode($spb0e6fb)[1]); } public static function is_mobile() { if (isset($_SERVER['HTTP_USER_AGENT'])) { if (preg_match('/(iPhone|iPod|Android|ios|SymbianOS|Windows Phone)/i', $_SERVER['HTTP_USER_AGENT'])) { return true; } } return false; } public static function b1_rand_background() { if (self::is_mobile()) { $sp0aa15d = array('//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpgyq8n5j20u01hcne2.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpfyjbd0j20u01hcte2.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpw3b5mkj20u01hcnfh.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxoybkicbj20u01hc7de.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpes8rmmj20u01hctn7.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxp8ond6gj20u01hctji.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxp4ljhhvj20u01hck0r.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpstrwnsj20u01hc7he.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxq2a1vthj20u01hc4gs.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpiebjztj20u01hcaom.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxow4b14kj20u01hc43x.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxohtyvgfj20u01hc7gk.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxp6vexa3j20u01hcdj3.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxqa0zhc6j20u01hc14e.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxomnbr0gj20u01hc79r.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpx57f0sj20u01hcqmd.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxoozjilyj20u01hcgt9.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxprigfw1j20u01hcam9.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxod70fcpj20u01hcajj.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpzb5p1tj20u01hcnca.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxozvry57j20u01hcgwo.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpv092lfj20u01hcx1o.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpdz6s0bj20u01hcaqj.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxoso79ayj20u01hcq9c.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpqjrtjhj20u01hcapi.jpg'); } else { $sp0aa15d = array('//ww1.sinaimg.cn/large/ac1a0c4agy1ftz78cfrj2j21hc0u0kio.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7qj6l3xj21hc0u0b29.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9tqa2fvpj21hc0u017a.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz71m76skj21hc0u0nnq.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz709py6fj21hc0u0wx2.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9sgqv33lj21hc0u04qp.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9s9soh4sj21hc0u01kx.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9s9r2vkzj21hc0u0x4e.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7etbcs8j21hc0u07p3.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9sgn1bluj21hc0u0kiy.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7r6tmv1j21hc0u0anj.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7c4h0xzj21hc0u01kx.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9tq7uypvj21hc0u01be.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1fwr4pjgbncj21hc0u0kjl.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7i6u1gxj21hc0u0tyk.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1fwr4s0fb2tj21hc0u01ky.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz72wkr9dj21hc0u0h1r.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7tj5ohrj21hc0u0qnp.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9sgp23zbj21hc0u0txl.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7l9dcokj21hc0u0k9k.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1fwr4lvumu1j21hc0u0x6p.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7alxyhnj21hc0u0nkh.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz799gvb3j21hc0u0qdt.jpg'); } return $sp0aa15d[rand(0, count($sp0aa15d))]; } }
\ No newline at end of file
+namespace App\Library; use Hashids\Hashids; class Helper { public static function getMysqlDate($spb6cc34 = 0) { return date('Y-m-d', time() + $spb6cc34 * 24 * 3600); } public static function getIP() { if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $sped2854 = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { if (isset($_SERVER['HTTP_CLIENT_IP'])) { $sped2854 = $_SERVER['HTTP_CLIENT_IP']; } else { $sped2854 = @$_SERVER['REMOTE_ADDR']; } } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $sped2854 = getenv('HTTP_X_FORWARDED_FOR'); } else { if (getenv('HTTP_CLIENT_IP')) { $sped2854 = getenv('HTTP_CLIENT_IP'); } else { $sped2854 = getenv('REMOTE_ADDR'); } } } if (strpos($sped2854, ',') !== FALSE) { $sp133ccc = explode(',', $sped2854); return $sp133ccc[0]; } return $sped2854; } public static function getClientIP() { if (isset($_SERVER)) { $sped2854 = $_SERVER['REMOTE_ADDR']; } else { $sped2854 = getenv('REMOTE_ADDR'); } if (strpos($sped2854, ',') !== FALSE) { $sp133ccc = explode(',', $sped2854); return $sp133ccc[0]; } return $sped2854; } public static function filterWords($sp14800d, $spe817ab) { if (!$sp14800d) { return false; } if (!is_array($spe817ab)) { $spe817ab = explode('|', $spe817ab); } foreach ($spe817ab as $sp6b9ea7) { if ($sp6b9ea7 && strpos($sp14800d, $sp6b9ea7) !== FALSE) { return $sp6b9ea7; } } return false; } public static function is_idcard($sp71fb38) { if (strlen($sp71fb38) == 18) { return self::idcard_checksum18($sp71fb38); } elseif (strlen($sp71fb38) == 15) { $sp71fb38 = self::idcard_15to18($sp71fb38); return self::idcard_checksum18($sp71fb38); } else { return false; } } private static function idcard_verify_number($spad94b0) { if (strlen($spad94b0) != 17) { return false; } $spba8e69 = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); $sp592d04 = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); $spca74c3 = 0; for ($sp6b283c = 0; $sp6b283c < strlen($spad94b0); $sp6b283c++) { $spca74c3 += substr($spad94b0, $sp6b283c, 1) * $spba8e69[$sp6b283c]; } $spd8b895 = $spca74c3 % 11; $spabadfa = $sp592d04[$spd8b895]; return $spabadfa; } private static function idcard_15to18($sp6d4e81) { if (strlen($sp6d4e81) != 15) { return false; } else { if (array_search(substr($sp6d4e81, 12, 3), array('996', '997', '998', '999')) !== false) { $sp6d4e81 = substr($sp6d4e81, 0, 6) . '18' . substr($sp6d4e81, 6, 9); } else { $sp6d4e81 = substr($sp6d4e81, 0, 6) . '19' . substr($sp6d4e81, 6, 9); } } $sp6d4e81 = $sp6d4e81 . self::idcard_verify_number($sp6d4e81); return $sp6d4e81; } private static function idcard_checksum18($sp6d4e81) { if (strlen($sp6d4e81) != 18) { return false; } $spad94b0 = substr($sp6d4e81, 0, 17); if (self::idcard_verify_number($spad94b0) != strtoupper(substr($sp6d4e81, 17, 1))) { return false; } else { return true; } } public static function str_between($sp14800d, $sp974326, $sp0480e1) { $spe3a4eb = strpos($sp14800d, $sp974326); if ($spe3a4eb === false) { return ''; } $sp368574 = strpos($sp14800d, $sp0480e1, $spe3a4eb + strlen($sp974326)); if ($sp368574 === false || $spe3a4eb >= $sp368574) { return ''; } $spc24183 = strlen($sp974326); $sp9b52fe = substr($sp14800d, $spe3a4eb + $spc24183, $sp368574 - $spe3a4eb - $spc24183); return $sp9b52fe; } public static function str_between_longest($sp14800d, $sp974326, $sp0480e1) { $spe3a4eb = strpos($sp14800d, $sp974326); if ($spe3a4eb === false) { return ''; } $sp368574 = strrpos($sp14800d, $sp0480e1, $spe3a4eb + strlen($sp974326)); if ($sp368574 === false || $spe3a4eb >= $sp368574) { return ''; } $spc24183 = strlen($sp974326); $sp9b52fe = substr($sp14800d, $spe3a4eb + $spc24183, $sp368574 - $spe3a4eb - $spc24183); return $sp9b52fe; } public static function format_url($spd2457c) { if (!strlen($spd2457c)) { return $spd2457c; } if (!starts_with($spd2457c, 'http://') && !starts_with($spd2457c, 'https://')) { $spd2457c = 'http://' . $spd2457c; } while (ends_with($spd2457c, '/')) { $spd2457c = substr($spd2457c, 0, -1); } return $spd2457c; } public static function lite_hash($sp14800d) { $spa1389c = crc32((string) $sp14800d); if ($spa1389c < 0) { $spa1389c &= 1 << 7; } return $spa1389c; } const ID_TYPE_USER = 0; const ID_TYPE_CATEGORY = 1; const ID_TYPE_PRODUCT = 2; public static function id_encode($sp3c46ab, $sp4f56c1) { $sp96a32f = new Hashids(config('app.key'), 8, 'abcdefghijklmnopqrstuvwxyz1234567890'); return @$sp96a32f->encode(self::lite_hash($sp3c46ab), $sp3c46ab, self::lite_hash($sp4f56c1), $sp4f56c1); } public static function id_decode($sp8aa1e1, $sp4f56c1) { if (strlen($sp8aa1e1) < 8) { $sp96a32f = new Hashids(config('app.key')); if ($sp4f56c1 === self::ID_TYPE_USER) { return intval(@$sp96a32f->decodeHex($sp8aa1e1)); } else { return intval(@$sp96a32f->decode($sp8aa1e1)[0]); } } $sp96a32f = new Hashids(config('app.key'), 8, 'abcdefghijklmnopqrstuvwxyz1234567890'); return intval(@$sp96a32f->decode($sp8aa1e1)[1]); } public static function is_mobile() { if (isset($_SERVER['HTTP_USER_AGENT'])) { if (preg_match('/(iPhone|iPod|Android|ios|SymbianOS|Windows Phone)/i', $_SERVER['HTTP_USER_AGENT'])) { return true; } } return false; } public static function b1_rand_background() { if (self::is_mobile()) { $sp96d357 = array('//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpgyq8n5j20u01hcne2.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpfyjbd0j20u01hcte2.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpw3b5mkj20u01hcnfh.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxoybkicbj20u01hc7de.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpes8rmmj20u01hctn7.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxp8ond6gj20u01hctji.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxp4ljhhvj20u01hck0r.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpstrwnsj20u01hc7he.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxq2a1vthj20u01hc4gs.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpiebjztj20u01hcaom.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxow4b14kj20u01hc43x.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxohtyvgfj20u01hc7gk.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxp6vexa3j20u01hcdj3.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxqa0zhc6j20u01hc14e.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxomnbr0gj20u01hc79r.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpx57f0sj20u01hcqmd.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxoozjilyj20u01hcgt9.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxprigfw1j20u01hcam9.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxod70fcpj20u01hcajj.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpzb5p1tj20u01hcnca.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxozvry57j20u01hcgwo.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpv092lfj20u01hcx1o.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpdz6s0bj20u01hcaqj.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxoso79ayj20u01hcq9c.jpg', '//ww2.sinaimg.cn/large/ac1a0c4agy1ftxpqjrtjhj20u01hcapi.jpg'); } else { $sp96d357 = array('//ww1.sinaimg.cn/large/ac1a0c4agy1ftz78cfrj2j21hc0u0kio.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7qj6l3xj21hc0u0b29.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9tqa2fvpj21hc0u017a.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz71m76skj21hc0u0nnq.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz709py6fj21hc0u0wx2.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9sgqv33lj21hc0u04qp.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9s9soh4sj21hc0u01kx.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9s9r2vkzj21hc0u0x4e.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7etbcs8j21hc0u07p3.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9sgn1bluj21hc0u0kiy.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7r6tmv1j21hc0u0anj.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7c4h0xzj21hc0u01kx.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9tq7uypvj21hc0u01be.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1fwr4pjgbncj21hc0u0kjl.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7i6u1gxj21hc0u0tyk.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1fwr4s0fb2tj21hc0u01ky.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz72wkr9dj21hc0u0h1r.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7tj5ohrj21hc0u0qnp.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ft9sgp23zbj21hc0u0txl.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7l9dcokj21hc0u0k9k.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1fwr4lvumu1j21hc0u0x6p.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz7alxyhnj21hc0u0nkh.jpg', '//ww1.sinaimg.cn/large/ac1a0c4agy1ftz799gvb3j21hc0u0qdt.jpg'); } return $sp96d357[rand(0, count($sp96d357))]; } }
\ No newline at end of file
diff --git a/app/Library/LogHelper.php b/app/Library/LogHelper.php
index 7948052e4..179ab0b1e 100644
--- a/app/Library/LogHelper.php
+++ b/app/Library/LogHelper.php
@@ -1,2 +1,2 @@
setHandlers(array()); \Log::useDailyFiles(storage_path() . '/logs/' . $sp7c04ba . '.log', 0, config('app.log_level')); } }
\ No newline at end of file
+namespace App\Library; class LogHelper { public static function setLogFile($sp7819f2) { \Log::getMonolog()->setHandlers(array()); \Log::useDailyFiles(storage_path() . '/logs/' . $sp7819f2 . '.log', 0, config('app.log_level')); } }
\ No newline at end of file
diff --git a/app/Library/Pay/AliAop/Api.php b/app/Library/Pay/AliAop/Api.php
index e67aa0de7..7c2861a29 100644
--- a/app/Library/Pay/AliAop/Api.php
+++ b/app/Library/Pay/AliAop/Api.php
@@ -1,8 +1,8 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } private function aop($spbe80b7) { if ($this->aop === null) { $sp9758bb = \Alipay\Key\AlipayKeyPair::create('-----BEGIN RSA PRIVATE KEY-----
-' . wordwrap($spbe80b7['merchant_private_key'], 64, '
+namespace App\Library\Pay\AliAop; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; private $aop = null; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } private function aop($sp9d4382) { if ($this->aop === null) { $spcaeab0 = \Alipay\Key\AlipayKeyPair::create('-----BEGIN RSA PRIVATE KEY-----
+' . wordwrap($sp9d4382['merchant_private_key'], 64, '
', true) . '
-----END RSA PRIVATE KEY-----', '-----BEGIN PUBLIC KEY-----
-' . wordwrap($spbe80b7['alipay_public_key'], 64, '
+' . wordwrap($sp9d4382['alipay_public_key'], 64, '
', true) . '
------END PUBLIC KEY-----'); $this->aop = new \Alipay\AopClient($spbe80b7['app_id'], $sp9758bb); } return $this->aop; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp429fcc = sprintf('%.2f', $sp5213ee / 100); if ($spbe80b7['payway'] === 'f2f') { $spfeab54 = \Alipay\AlipayRequestFactory::create('alipay.trade.precreate', array('notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $spa3e681, 'total_amount' => $sp429fcc, 'subject' => $sp45f07e))); $spbbda25 = $this->aop($spbe80b7)->execute($spfeab54)->getData(); header('location: /qrcode/pay/' . $spa3e681 . '/aliqr?url=' . urlencode($spbbda25['qr_code'])); } elseif ($spbe80b7['payway'] === 'pc') { $spfeab54 = \Alipay\AlipayRequestFactory::create('alipay.trade.page.pay', array('return_url' => $this->url_return, 'notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $spa3e681, 'product_code' => 'FAST_INSTANT_TRADE_PAY', 'total_amount' => $sp429fcc, 'subject' => $sp45f07e))); $spbbda25 = $this->aop($spbe80b7)->pageExecuteUrl($spfeab54); header('location: ' . $spbbda25); } elseif ($spbe80b7['payway'] === 'mobile') { $spfeab54 = \Alipay\AlipayRequestFactory::create('alipay.trade.wap.pay', array('return_url' => $this->url_return, 'notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $spa3e681, 'product_code' => 'QUICK_WAP_WAY', 'total_amount' => $sp429fcc, 'subject' => $sp45f07e))); $spbbda25 = $this->aop($spbe80b7)->pageExecuteUrl($spfeab54); header('location: ' . $spbbda25); } die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { if ($this->aop($spbe80b7)->verify($_POST)) { if ($_POST['trade_status'] === 'TRADE_SUCCESS') { $sp4d48a7 = $_POST['trade_no']; $sp9624ba = (int) round($_POST['total_amount'] * 100); $sp04f0f8($_POST['out_trade_no'], $sp9624ba, $sp4d48a7); } } else { Log::error('Pay.AliAop.goPay.verify Error: ' . json_encode($_POST)); } echo 'success'; die; } if (!empty($spbe80b7['out_trade_no'])) { $spa3e681 = $spbe80b7['out_trade_no']; $spfeab54 = \Alipay\AlipayRequestFactory::create('alipay.trade.query', array('notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $spa3e681))); try { $spbbda25 = $this->aop($spbe80b7)->execute($spfeab54)->getData(); } catch (\Throwable $sp81eee8) { return false; } if ($spbbda25['trade_status'] === 'TRADE_SUCCESS') { $sp4d48a7 = $spbbda25['trade_no']; $sp9624ba = (int) round($spbbda25['total_amount'] * 100); $sp04f0f8($spbbda25['out_trade_no'], $sp9624ba, $sp4d48a7); return true; } } else { if (!isset($_GET['out_trade_no']) || !isset($_GET['total_amount'])) { return false; } $spc9c65f = $this->aop($spbe80b7)->verify($_GET); if (!$spc9c65f) { Log::error('Pay.AliAop.verify Error: 支付宝签名校验失败', array('$_GET' => $_GET)); return false; } $sp4d48a7 = $_GET['trade_no']; $sp9624ba = (int) round($_GET['total_amount'] * 100); $sp04f0f8($_GET['out_trade_no'], $sp9624ba, $sp4d48a7); return true; } return false; } }
\ No newline at end of file
+-----END PUBLIC KEY-----'); $this->aop = new \Alipay\AopClient($sp9d4382['app_id'], $spcaeab0); } return $this->aop; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); if ($sp9d4382['payway'] === 'f2f') { $spf066f3 = \Alipay\AlipayRequestFactory::create('alipay.trade.precreate', array('notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $sp2e47fc, 'total_amount' => $spf59c91, 'subject' => $spd4e90d))); $spb72f32 = $this->aop($sp9d4382)->execute($spf066f3)->getData(); header('location: /qrcode/pay/' . $sp2e47fc . '/aliqr?url=' . urlencode($spb72f32['qr_code'])); } elseif ($sp9d4382['payway'] === 'pc') { $spf066f3 = \Alipay\AlipayRequestFactory::create('alipay.trade.page.pay', array('return_url' => $this->url_return, 'notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $sp2e47fc, 'product_code' => 'FAST_INSTANT_TRADE_PAY', 'total_amount' => $spf59c91, 'subject' => $spd4e90d))); $spb72f32 = $this->aop($sp9d4382)->pageExecuteUrl($spf066f3); header('location: ' . $spb72f32); } elseif ($sp9d4382['payway'] === 'mobile') { $spf066f3 = \Alipay\AlipayRequestFactory::create('alipay.trade.wap.pay', array('return_url' => $this->url_return, 'notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $sp2e47fc, 'product_code' => 'QUICK_WAP_WAY', 'total_amount' => $spf59c91, 'subject' => $spd4e90d))); $spb72f32 = $this->aop($sp9d4382)->pageExecuteUrl($spf066f3); header('location: ' . $spb72f32); } die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { if ($this->aop($sp9d4382)->verify($_POST)) { if ($_POST['trade_status'] === 'TRADE_SUCCESS') { $sp565d18 = $_POST['trade_no']; $spc686cf = (int) round($_POST['total_amount'] * 100); $sp9a4d97($_POST['out_trade_no'], $spc686cf, $sp565d18); } } else { Log::error('Pay.AliAop.goPay.verify Error: ' . json_encode($_POST)); } echo 'success'; die; } if (!empty($sp9d4382['out_trade_no'])) { $sp2e47fc = $sp9d4382['out_trade_no']; $spf066f3 = \Alipay\AlipayRequestFactory::create('alipay.trade.query', array('notify_url' => $this->url_notify, 'biz_content' => array('out_trade_no' => $sp2e47fc))); try { $spb72f32 = $this->aop($sp9d4382)->execute($spf066f3)->getData(); } catch (\Throwable $sp3f4aab) { return false; } if ($spb72f32['trade_status'] === 'TRADE_SUCCESS') { $sp565d18 = $spb72f32['trade_no']; $spc686cf = (int) round($spb72f32['total_amount'] * 100); $sp9a4d97($spb72f32['out_trade_no'], $spc686cf, $sp565d18); return true; } } else { if (!isset($_GET['out_trade_no']) || !isset($_GET['total_amount'])) { return false; } $sp4ded60 = $this->aop($sp9d4382)->verify($_GET); if (!$sp4ded60) { Log::error('Pay.AliAop.verify Error: 支付宝签名校验失败', array('$_GET' => $_GET)); return false; } $sp565d18 = $_GET['trade_no']; $spc686cf = (int) round($_GET['total_amount'] * 100); $sp9a4d97($_GET['out_trade_no'], $spc686cf, $sp565d18); return true; } return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Alipay/Api.php b/app/Library/Pay/Alipay/Api.php
index c13b7b613..014711861 100644
--- a/app/Library/Pay/Alipay/Api.php
+++ b/app/Library/Pay/Alipay/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; $this->pay_id = $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp429fcc = sprintf('%.2f', $sp5213ee / 100); $sp487939 = $this->buildAliConfig($spbe80b7); require_once __DIR__ . '/sdk/alipay_submit.class.php'; $sp487939['notify_url'] = $this->url_notify; $sp487939['return_url'] = $this->url_return . '/' . $spa3e681; $spfdb5ba = array('service' => $sp487939['service'], 'partner' => $sp487939['partner'], 'seller_id' => $sp487939['seller_id'], 'payment_type' => $sp487939['payment_type'], 'notify_url' => $sp487939['notify_url'], 'return_url' => $sp487939['return_url'], 'out_trade_no' => $spa3e681, 'total_fee' => $sp429fcc, 'subject' => $sp45f07e, 'body' => $sp873488, 'show_url' => config('app.url'), 'app_pay' => 'Y', '_input_charset' => 'utf-8'); $sp7c05ed = new \AlipaySubmit($sp487939); $sp38ec28 = $sp7c05ed->buildRequestForm($spfdb5ba, 'get', '确认'); echo '正在跳转到支付渠道...正在跳转到支付渠道...
'; echo $sp38ec28; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; $sp487939 = $this->buildAliConfig($spbe80b7); require __DIR__ . '/sdk/alipay_notify.class.php'; $sp9cfc59 = new \AlipayNotify($sp487939); if ($sp3bce01) { $spbbda25 = $sp9cfc59->verifyNotify(); } else { $spbbda25 = $sp9cfc59->verifyReturn(); } if ($spbbda25) { $spa3e681 = $_REQUEST['out_trade_no']; $sp4d48a7 = $_REQUEST['trade_no']; $sp681dde = $_REQUEST['trade_status']; $sp9624ba = (int) round($_REQUEST['total_fee'] * 100); if ($sp681dde == 'TRADE_FINISHED' || $sp681dde == 'TRADE_SUCCESS') { $sp04f0f8($spa3e681, $sp9624ba, $sp4d48a7); } if ($sp3bce01) { echo 'success'; } return true; } else { if ($sp3bce01) { echo 'fail'; $sp9df21a = 'payNotify pay_id: ' . $this->pay_id . ',Alipay'; } else { $sp9df21a = 'payReturn pay_id: ' . $this->pay_id . ',Alipay'; } \Log::error($sp9df21a . ' Alipay.Api.verify failed'); return false; } } private function buildAliConfig($spbe80b7) { return array('partner' => $spbe80b7['partner'], 'seller_id' => $spbe80b7['partner'], 'key' => $spbe80b7['key'], 'sign_type' => 'MD5', 'input_charset' => 'utf-8', 'cacert' => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem', 'transport' => 'https', 'payment_type' => '1', 'service' => $spbe80b7['payway'] === 'wap' ? 'alipay.wap.create.direct.pay.by.user' : 'create_direct_pay_by_user'); } }
\ No newline at end of file
+namespace App\Library\Pay\Alipay; use App\Library\Pay\ApiInterface; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; private $pay_id; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; $this->pay_id = $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); $spaad359 = $this->buildAliConfig($sp9d4382); require_once __DIR__ . '/sdk/alipay_submit.class.php'; $spaad359['notify_url'] = $this->url_notify; $spaad359['return_url'] = $this->url_return . '/' . $sp2e47fc; $spc29576 = array('service' => $spaad359['service'], 'partner' => $spaad359['partner'], 'seller_id' => $spaad359['seller_id'], 'payment_type' => $spaad359['payment_type'], 'notify_url' => $spaad359['notify_url'], 'return_url' => $spaad359['return_url'], 'out_trade_no' => $sp2e47fc, 'total_fee' => $spf59c91, 'subject' => $spd4e90d, 'body' => $spd0789a, 'show_url' => config('app.url'), 'app_pay' => 'Y', '_input_charset' => 'utf-8'); $sp13552b = new \AlipaySubmit($spaad359); $sp1ed6b6 = $sp13552b->buildRequestForm($spc29576, 'get', '确认'); echo '正在跳转到支付渠道...正在跳转到支付渠道...
'; echo $sp1ed6b6; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; $spaad359 = $this->buildAliConfig($sp9d4382); require __DIR__ . '/sdk/alipay_notify.class.php'; $spcf717f = new \AlipayNotify($spaad359); if ($sp7b2182) { $spb72f32 = $spcf717f->verifyNotify(); } else { $spb72f32 = $spcf717f->verifyReturn(); } if ($spb72f32) { $sp2e47fc = $_REQUEST['out_trade_no']; $sp565d18 = $_REQUEST['trade_no']; $spdaad0a = $_REQUEST['trade_status']; $spc686cf = (int) round($_REQUEST['total_fee'] * 100); if ($spdaad0a == 'TRADE_FINISHED' || $spdaad0a == 'TRADE_SUCCESS') { $sp9a4d97($sp2e47fc, $spc686cf, $sp565d18); } if ($sp7b2182) { echo 'success'; } return true; } else { if ($sp7b2182) { echo 'fail'; $sp5d5f28 = 'payNotify pay_id: ' . $this->pay_id . ',Alipay'; } else { $sp5d5f28 = 'payReturn pay_id: ' . $this->pay_id . ',Alipay'; } \Log::error($sp5d5f28 . ' Alipay.Api.verify failed'); return false; } } private function buildAliConfig($sp9d4382) { return array('partner' => $sp9d4382['partner'], 'seller_id' => $sp9d4382['partner'], 'key' => $sp9d4382['key'], 'sign_type' => 'MD5', 'input_charset' => 'utf-8', 'cacert' => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem', 'transport' => 'https', 'payment_type' => '1', 'service' => $sp9d4382['payway'] === 'wap' ? 'alipay.wap.create.direct.pay.by.user' : 'create_direct_pay_by_user'); } }
\ No newline at end of file
diff --git a/app/Library/Pay/Alipay/sdk/alipay_core.function.php b/app/Library/Pay/Alipay/sdk/alipay_core.function.php
index 087a9b1bb..f3a939031 100644
--- a/app/Library/Pay/Alipay/sdk/alipay_core.function.php
+++ b/app/Library/Pay/Alipay/sdk/alipay_core.function.php
@@ -1,4 +1,4 @@
$sp36ecf9) { $spc05966 .= $sp1ed429 . '=' . $sp36ecf9 . '&'; } $spc05966 = substr($spc05966, 0, strlen($spc05966) - 1); if (get_magic_quotes_gpc()) { $spc05966 = stripslashes($spc05966); } return $spc05966; } function createLinkStringUrlEncode($sp4b405d) { $spc05966 = ''; foreach ($sp4b405d as $sp1ed429 => $sp36ecf9) { $spc05966 .= $sp1ed429 . '=' . urlencode($sp36ecf9) . '&'; } $spc05966 = substr($spc05966, 0, strlen($spc05966) - 1); if (get_magic_quotes_gpc()) { $spc05966 = stripslashes($spc05966); } return $spc05966; } function paraFilter($sp4b405d) { $sp67f981 = array(); foreach ($sp4b405d as $sp1ed429 => $sp36ecf9) { if ($sp1ed429 == 'sign' || $sp1ed429 == 'sign_type' || $sp36ecf9 == '') { continue; } else { $sp67f981[$sp1ed429] = $sp4b405d[$sp1ed429]; } } return $sp67f981; } function argSort($sp4b405d) { ksort($sp4b405d); reset($sp4b405d); return $sp4b405d; } function logResult($sp2411ef = '') { $sp8cc2df = fopen('log.txt', 'a'); flock($sp8cc2df, LOCK_EX); fwrite($sp8cc2df, '执行日期:' . strftime('%Y%m%d%H%M%S', time()) . '
-' . $sp2411ef . '
-'); flock($sp8cc2df, LOCK_UN); fclose($sp8cc2df); } function getHttpResponsePOST($sp3db1b2, $spf113cd, $sp4b405d, $sp4928c3 = '') { if (trim($sp4928c3) != '') { $sp3db1b2 = $sp3db1b2 . '_input_charset=' . $sp4928c3; } $spf94a8f = curl_init($sp3db1b2); curl_setopt($spf94a8f, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($spf94a8f, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($spf94a8f, CURLOPT_CAINFO, $spf113cd); curl_setopt($spf94a8f, CURLOPT_HEADER, 0); curl_setopt($spf94a8f, CURLOPT_RETURNTRANSFER, 1); curl_setopt($spf94a8f, CURLOPT_POST, true); curl_setopt($spf94a8f, CURLOPT_POSTFIELDS, $sp4b405d); $sp775c00 = curl_exec($spf94a8f); curl_close($spf94a8f); return $sp775c00; } function getHttpResponseGET($sp3db1b2, $speb40bf) { $spf94a8f = curl_init($sp3db1b2); curl_setopt($spf94a8f, CURLOPT_HEADER, 0); curl_setopt($spf94a8f, CURLOPT_RETURNTRANSFER, 1); curl_setopt($spf94a8f, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($spf94a8f, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($spf94a8f, CURLOPT_CAINFO, $speb40bf); $sp775c00 = curl_exec($spf94a8f); curl_close($spf94a8f); return $sp775c00; } function charsetEncode($sp134454, $spf087f4, $spb9c355) { $sp6c7862 = ''; if (!isset($spf087f4)) { $spf087f4 = $spb9c355; } if ($spb9c355 == $spf087f4 || $sp134454 == null) { $sp6c7862 = $sp134454; } elseif (function_exists('mb_convert_encoding')) { $sp6c7862 = mb_convert_encoding($sp134454, $spf087f4, $spb9c355); } elseif (function_exists('iconv')) { $sp6c7862 = iconv($spb9c355, $spf087f4, $sp134454); } else { die('sorry, you have no libs support for charset change.'); } return $sp6c7862; } function charsetDecode($sp134454, $spb9c355, $spf087f4) { if (!isset($spb9c355)) { $spf087f4 = $spb9c355; } if ($spb9c355 == $spf087f4 || $sp134454 == null) { $sp6c7862 = $sp134454; } elseif (function_exists('mb_convert_encoding')) { $sp6c7862 = mb_convert_encoding($sp134454, $spf087f4, $spb9c355); } elseif (function_exists('iconv')) { $sp6c7862 = iconv($spb9c355, $spf087f4, $sp134454); } else { die('sorry, you have no libs support for charset changes.'); } return $sp6c7862; } function md5Sign($sp4a09c0, $sp1ed429) { $sp4a09c0 = $sp4a09c0 . $sp1ed429; return md5($sp4a09c0); } function md5Verify($sp4a09c0, $spa109d2, $sp1ed429) { $sp4a09c0 = $sp4a09c0 . $sp1ed429; $spea060c = md5($sp4a09c0); if ($spea060c == $spa109d2) { return true; } else { return false; } }
\ No newline at end of file
+function createLinkString($sp7a655e) { $sp57c72a = ''; foreach ($sp7a655e as $spf1241f => $sp91e29b) { $sp57c72a .= $spf1241f . '=' . $sp91e29b . '&'; } $sp57c72a = substr($sp57c72a, 0, strlen($sp57c72a) - 1); if (get_magic_quotes_gpc()) { $sp57c72a = stripslashes($sp57c72a); } return $sp57c72a; } function createLinkStringUrlEncode($sp7a655e) { $sp57c72a = ''; foreach ($sp7a655e as $spf1241f => $sp91e29b) { $sp57c72a .= $spf1241f . '=' . urlencode($sp91e29b) . '&'; } $sp57c72a = substr($sp57c72a, 0, strlen($sp57c72a) - 1); if (get_magic_quotes_gpc()) { $sp57c72a = stripslashes($sp57c72a); } return $sp57c72a; } function paraFilter($sp7a655e) { $sp959d7d = array(); foreach ($sp7a655e as $spf1241f => $sp91e29b) { if ($spf1241f == 'sign' || $spf1241f == 'sign_type' || $sp91e29b == '') { continue; } else { $sp959d7d[$spf1241f] = $sp7a655e[$spf1241f]; } } return $sp959d7d; } function argSort($sp7a655e) { ksort($sp7a655e); reset($sp7a655e); return $sp7a655e; } function logResult($sp6b9ea7 = '') { $sp26c226 = fopen('log.txt', 'a'); flock($sp26c226, LOCK_EX); fwrite($sp26c226, '执行日期:' . strftime('%Y%m%d%H%M%S', time()) . '
+' . $sp6b9ea7 . '
+'); flock($sp26c226, LOCK_UN); fclose($sp26c226); } function getHttpResponsePOST($spd2457c, $spb20fc5, $sp7a655e, $sp100d5e = '') { if (trim($sp100d5e) != '') { $spd2457c = $spd2457c . '_input_charset=' . $sp100d5e; } $sp4f6936 = curl_init($spd2457c); curl_setopt($sp4f6936, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($sp4f6936, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp4f6936, CURLOPT_CAINFO, $spb20fc5); curl_setopt($sp4f6936, CURLOPT_HEADER, 0); curl_setopt($sp4f6936, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp4f6936, CURLOPT_POST, true); curl_setopt($sp4f6936, CURLOPT_POSTFIELDS, $sp7a655e); $spd71532 = curl_exec($sp4f6936); curl_close($sp4f6936); return $spd71532; } function getHttpResponseGET($spd2457c, $spbaf24b) { $sp4f6936 = curl_init($spd2457c); curl_setopt($sp4f6936, CURLOPT_HEADER, 0); curl_setopt($sp4f6936, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp4f6936, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($sp4f6936, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp4f6936, CURLOPT_CAINFO, $spbaf24b); $spd71532 = curl_exec($sp4f6936); curl_close($sp4f6936); return $spd71532; } function charsetEncode($spfaaf1d, $sp86132c, $sp968514) { $spc30c34 = ''; if (!isset($sp86132c)) { $sp86132c = $sp968514; } if ($sp968514 == $sp86132c || $spfaaf1d == null) { $spc30c34 = $spfaaf1d; } elseif (function_exists('mb_convert_encoding')) { $spc30c34 = mb_convert_encoding($spfaaf1d, $sp86132c, $sp968514); } elseif (function_exists('iconv')) { $spc30c34 = iconv($sp968514, $sp86132c, $spfaaf1d); } else { die('sorry, you have no libs support for charset change.'); } return $spc30c34; } function charsetDecode($spfaaf1d, $sp968514, $sp86132c) { if (!isset($sp968514)) { $sp86132c = $sp968514; } if ($sp968514 == $sp86132c || $spfaaf1d == null) { $spc30c34 = $spfaaf1d; } elseif (function_exists('mb_convert_encoding')) { $spc30c34 = mb_convert_encoding($spfaaf1d, $sp86132c, $sp968514); } elseif (function_exists('iconv')) { $spc30c34 = iconv($sp968514, $sp86132c, $spfaaf1d); } else { die('sorry, you have no libs support for charset changes.'); } return $spc30c34; } function md5Sign($sp753e95, $spf1241f) { $sp753e95 = $sp753e95 . $spf1241f; return md5($sp753e95); } function md5Verify($sp753e95, $sp964415, $spf1241f) { $sp753e95 = $sp753e95 . $spf1241f; $sped9e7f = md5($sp753e95); if ($sped9e7f == $sp964415) { return true; } else { return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Alipay/sdk/alipay_notify.class.php b/app/Library/Pay/Alipay/sdk/alipay_notify.class.php
index df4eaea5a..e255c35f7 100644
--- a/app/Library/Pay/Alipay/sdk/alipay_notify.class.php
+++ b/app/Library/Pay/Alipay/sdk/alipay_notify.class.php
@@ -1,2 +1,2 @@
alipay_config = $sp487939; } function AlipayNotify($sp487939) { $this->__construct($sp487939); } function verifyNotify() { if (empty($_POST)) { return false; } else { $sp5777f3 = $this->getSignVeryfy($_POST, $_POST['sign']); $spa46c15 = 'false'; if (!empty($_POST['notify_id'])) { $spa46c15 = $this->getResponse($_POST['notify_id']); } if (preg_match('/true$/i', $spa46c15) && $sp5777f3) { return true; } else { return false; } } } function verifyReturn() { if (empty($_GET)) { return false; } else { $sp5777f3 = $this->getSignVeryfy($_GET, $_GET['sign']); $spa46c15 = 'false'; if (!empty($_GET['notify_id'])) { $spa46c15 = $this->getResponse($_GET['notify_id']); } if (preg_match('/true$/i', $spa46c15) && $sp5777f3) { return true; } else { return false; } } } function getSignVeryfy($sp5f0fbc, $spa109d2) { $sp67f981 = paraFilter($sp5f0fbc); $sp012af7 = argSort($sp67f981); $sp4a09c0 = createLinkString($sp012af7); switch (strtoupper(trim($this->alipay_config['sign_type']))) { case 'MD5': $spb8f336 = md5Verify($sp4a09c0, $spa109d2, $this->alipay_config['key']); break; default: $spb8f336 = false; } return $spb8f336; } function getResponse($sp1d3c7b) { $sp69068f = strtolower(trim($this->alipay_config['transport'])); $sp669101 = trim($this->alipay_config['partner']); if ($sp69068f == 'https') { $sp2ad67c = $this->https_verify_url; } else { $sp2ad67c = $this->http_verify_url; } $sp2ad67c = $sp2ad67c . 'partner=' . $sp669101 . '¬ify_id=' . $sp1d3c7b; $spa46c15 = getHttpResponseGET($sp2ad67c, $this->alipay_config['cacert']); return $spa46c15; } }
\ No newline at end of file
+require_once 'alipay_core.function.php'; class AlipayNotify { var $https_verify_url = 'https://mapi.alipay.com/gateway.do?service=notify_verify&'; var $http_verify_url = 'http://notify.alipay.com/trade/notify_query.do?'; var $alipay_config; function __construct($spaad359) { $this->alipay_config = $spaad359; } function AlipayNotify($spaad359) { $this->__construct($spaad359); } function verifyNotify() { if (empty($_POST)) { return false; } else { $spab6bdb = $this->getSignVeryfy($_POST, $_POST['sign']); $sp772499 = 'false'; if (!empty($_POST['notify_id'])) { $sp772499 = $this->getResponse($_POST['notify_id']); } if (preg_match('/true$/i', $sp772499) && $spab6bdb) { return true; } else { return false; } } } function verifyReturn() { if (empty($_GET)) { return false; } else { $spab6bdb = $this->getSignVeryfy($_GET, $_GET['sign']); $sp772499 = 'false'; if (!empty($_GET['notify_id'])) { $sp772499 = $this->getResponse($_GET['notify_id']); } if (preg_match('/true$/i', $sp772499) && $spab6bdb) { return true; } else { return false; } } } function getSignVeryfy($spd8d832, $sp964415) { $sp959d7d = paraFilter($spd8d832); $spb86c77 = argSort($sp959d7d); $sp753e95 = createLinkString($spb86c77); switch (strtoupper(trim($this->alipay_config['sign_type']))) { case 'MD5': $sp679ba6 = md5Verify($sp753e95, $sp964415, $this->alipay_config['key']); break; default: $sp679ba6 = false; } return $sp679ba6; } function getResponse($sp983f78) { $sp713fc3 = strtolower(trim($this->alipay_config['transport'])); $sp5c99e7 = trim($this->alipay_config['partner']); if ($sp713fc3 == 'https') { $spf6507d = $this->https_verify_url; } else { $spf6507d = $this->http_verify_url; } $spf6507d = $spf6507d . 'partner=' . $sp5c99e7 . '¬ify_id=' . $sp983f78; $sp772499 = getHttpResponseGET($spf6507d, $this->alipay_config['cacert']); return $sp772499; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Alipay/sdk/alipay_submit.class.php b/app/Library/Pay/Alipay/sdk/alipay_submit.class.php
index 1c8c10f47..f336a2195 100644
--- a/app/Library/Pay/Alipay/sdk/alipay_submit.class.php
+++ b/app/Library/Pay/Alipay/sdk/alipay_submit.class.php
@@ -1,2 +1,2 @@
alipay_config = $sp487939; } function AlipaySubmit($sp487939) { $this->__construct($sp487939); } function buildRequestMysign($sp012af7) { $sp4a09c0 = createLinkString($sp012af7); switch (strtoupper(trim($this->alipay_config['sign_type']))) { case 'MD5': $spa0547c = md5Sign($sp4a09c0, $this->alipay_config['key']); break; default: $spa0547c = ''; } return $spa0547c; } function buildRequestPara($sp5f0fbc) { $sp67f981 = paraFilter($sp5f0fbc); $sp012af7 = argSort($sp67f981); $spa0547c = $this->buildRequestMysign($sp012af7); $sp012af7['sign'] = $spa0547c; $sp012af7['sign_type'] = strtoupper(trim($this->alipay_config['sign_type'])); return $sp012af7; } function buildRequestParaToString($sp5f0fbc) { $sp4b405d = $this->buildRequestPara($sp5f0fbc); $sp204ba0 = createLinkStringUrlEncode($sp4b405d); return $sp204ba0; } function buildRequestForm($sp5f0fbc, $sp2e8ea8, $spcc9c3f) { $sp4b405d = $this->buildRequestPara($sp5f0fbc); $spb6abed = ''; $spb6abed = $spb6abed . ''; return $spb6abed; } function query_timestamp() { $sp3db1b2 = $this->alipay_gateway_new . 'service=query_timestamp&partner=' . trim(strtolower($this->alipay_config['partner'])) . '&_input_charset=' . trim(strtolower($this->alipay_config['input_charset'])); $sp536dbf = new DOMDocument(); $sp536dbf->load($sp3db1b2); $spdf5caa = $sp536dbf->getElementsByTagName('encrypt_key'); $sp2e1d1f = $spdf5caa->item(0)->nodeValue; return $sp2e1d1f; } }
\ No newline at end of file
+require_once 'alipay_core.function.php'; class AlipaySubmit { var $alipay_config; var $alipay_gateway_new = 'https://mapi.alipay.com/gateway.do?'; function __construct($spaad359) { $this->alipay_config = $spaad359; } function AlipaySubmit($spaad359) { $this->__construct($spaad359); } function buildRequestMysign($spb86c77) { $sp753e95 = createLinkString($spb86c77); switch (strtoupper(trim($this->alipay_config['sign_type']))) { case 'MD5': $spc5fb95 = md5Sign($sp753e95, $this->alipay_config['key']); break; default: $spc5fb95 = ''; } return $spc5fb95; } function buildRequestPara($spd8d832) { $sp959d7d = paraFilter($spd8d832); $spb86c77 = argSort($sp959d7d); $spc5fb95 = $this->buildRequestMysign($spb86c77); $spb86c77['sign'] = $spc5fb95; $spb86c77['sign_type'] = strtoupper(trim($this->alipay_config['sign_type'])); return $spb86c77; } function buildRequestParaToString($spd8d832) { $sp7a655e = $this->buildRequestPara($spd8d832); $sp125bdd = createLinkStringUrlEncode($sp7a655e); return $sp125bdd; } function buildRequestForm($spd8d832, $spd0c59e, $sp1fd655) { $sp7a655e = $this->buildRequestPara($spd8d832); $spd9728a = ''; $spd9728a = $spd9728a . ''; return $spd9728a; } function query_timestamp() { $spd2457c = $this->alipay_gateway_new . 'service=query_timestamp&partner=' . trim(strtolower($this->alipay_config['partner'])) . '&_input_charset=' . trim(strtolower($this->alipay_config['input_charset'])); $spa82def = new DOMDocument(); $spa82def->load($spd2457c); $sp30aaef = $spa82def->getElementsByTagName('encrypt_key'); $sp42a4d2 = $sp30aaef->item(0)->nodeValue; return $sp42a4d2; } }
\ No newline at end of file
diff --git a/app/Library/Pay/ApiInterface.php b/app/Library/Pay/ApiInterface.php
index 7a939e13c..0fdc817aa 100644
--- a/app/Library/Pay/ApiInterface.php
+++ b/app/Library/Pay/ApiInterface.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp2687cc = CurlRequest::get('https://api.blockchain.info/tobtc?currency=CNY&value=' . sprintf('%.2f', $sp5213ee / 100)); if (!$sp2687cc) { Log::error('Pay.BTC.goPay, get price error:' . @$sp2687cc); throw new \Exception('获取BTC价格失败,请联系客服'); } $spa4228a = CurlRequest::get('https://api.blockchain.info/v2/receive?xpub=' . $spbe80b7['xpub'] . '&callback=' . urlencode($this->url_notify . '?secret=' . $spbe80b7['secret']) . '&key=' . $spbe80b7['key']); $spaeabb7 = @json_decode($spa4228a, true); if (!$spaeabb7 || !isset($spaeabb7['address'])) { if ($spaeabb7['description'] === 'Gap between last used address and next address too large. This might make funds inaccessible.') { throw new \Exception('钱包地址到达限制, 请等待之前的用户完成付款'); } Log::error('Pay.BTC.goPay, get address error:' . @$spa4228a); throw new \Exception('获取BTC地址失败,请联系客服'); } $spe174e3 = 'bitcoin:' . $spaeabb7['address'] . '?amount=' . $sp2687cc; if (\App\Order::wherePayTradeNo($spe174e3)->exists()) { throw new \Exception('支付失败, 当前钱包地址重复'); } \App\Order::whereOrderNo($spa3e681)->update(array('pay_trade_no' => $spe174e3)); header('location: /qrcode/pay/' . $spa3e681 . '/btc?url=' . urlencode(json_encode(array('address' => $spaeabb7['address'], 'amount' => $sp2687cc)))); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { if (@$_GET['secret'] !== $spbe80b7['secret']) { echo 'error'; return false; } if (isset($_GET['confirmations'])) { $sp890c5b = $_GET['address']; $spe174e3 = 'bitcoin:' . $sp890c5b . '?amount=' . rtrim(rtrim(sprintf('%.8f', $_GET['value'] / 100000000.0), '0'), '.'); $sp4f4c0d = \App\Order::wherePayTradeNo($spe174e3)->first(); if (!$sp4f4c0d) { echo 'error'; Log::error('Pay.BTC.verify, cannot find order:' . json_encode(array('url' => $spe174e3, 'params' => $_GET))); return false; } $spd63ffb = $spe174e3; $sp04f0f8($sp4f4c0d->order_no, $sp4f4c0d->paid, $spd63ffb); } echo '*ok*'; return true; } else { return false; } } }
\ No newline at end of file
+namespace App\Library\Pay\BTC; use App\Library\CurlRequest; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spad9396 = CurlRequest::get('https://api.blockchain.info/tobtc?currency=CNY&value=' . sprintf('%.2f', $sp076ec7 / 100)); if (!$spad9396) { Log::error('Pay.BTC.goPay, get price error:' . @$spad9396); throw new \Exception('获取BTC价格失败,请联系客服'); } $sp102d6e = CurlRequest::get('https://api.blockchain.info/v2/receive?xpub=' . $sp9d4382['xpub'] . '&callback=' . urlencode($this->url_notify . '?secret=' . $sp9d4382['secret']) . '&key=' . $sp9d4382['key']); $spfb87eb = @json_decode($sp102d6e, true); if (!$spfb87eb || !isset($spfb87eb['address'])) { if ($spfb87eb['description'] === 'Gap between last used address and next address too large. This might make funds inaccessible.') { throw new \Exception('钱包地址到达限制, 请等待之前的用户完成付款'); } Log::error('Pay.BTC.goPay, get address error:' . @$sp102d6e); throw new \Exception('获取BTC地址失败,请联系客服'); } $spa8175a = 'bitcoin:' . $spfb87eb['address'] . '?amount=' . $spad9396; if (\App\Order::wherePayTradeNo($spa8175a)->exists()) { throw new \Exception('支付失败, 当前钱包地址重复'); } \App\Order::whereOrderNo($sp2e47fc)->update(array('pay_trade_no' => $spa8175a)); header('location: /qrcode/pay/' . $sp2e47fc . '/btc?url=' . urlencode(json_encode(array('address' => $spfb87eb['address'], 'amount' => $spad9396)))); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { if (@$_GET['secret'] !== $sp9d4382['secret']) { echo 'error'; return false; } if (isset($_GET['confirmations'])) { $sp123af1 = $_GET['address']; $spa8175a = 'bitcoin:' . $sp123af1 . '?amount=' . rtrim(rtrim(sprintf('%.8f', $_GET['value'] / 100000000.0), '0'), '.'); $spe0613f = \App\Order::wherePayTradeNo($spa8175a)->first(); if (!$spe0613f) { echo 'error'; Log::error('Pay.BTC.verify, cannot find order:' . json_encode(array('url' => $spa8175a, 'params' => $_GET))); return false; } $spca4fc7 = $spa8175a; $sp9a4d97($spe0613f->order_no, $spe0613f->paid, $spca4fc7); } echo '*ok*'; return true; } else { return false; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/CodePay/Api.php b/app/Library/Pay/CodePay/Api.php
index fb682f42b..36e6a6c7f 100644
--- a/app/Library/Pay/CodePay/Api.php
+++ b/app/Library/Pay/CodePay/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp429fcc = sprintf('%.2f', $sp5213ee / 100); $sp2f8f8a = $spbe80b7['id']; $spd436e0 = $spbe80b7['key']; switch ($spbe80b7['payway']) { case 'alipay': $sp8f5ac7 = 1; break; case 'qq': $sp8f5ac7 = 2; break; case 'weixin': $sp8f5ac7 = 3; break; default: throw new \Exception('支付方式填写错误, alipay/qq/weixin'); } $sp5aa598 = array('id' => $sp2f8f8a, 'pay_id' => $spa3e681, 'type' => $sp8f5ac7, 'price' => $sp429fcc, 'param' => '', 'notify_url' => $this->url_notify, 'return_url' => $this->url_return); ksort($sp5aa598); $spa109d2 = ''; $sp17d1a7 = ''; foreach ($sp5aa598 as $sp1ed429 => $sp36ecf9) { if ($sp36ecf9 == '' || $sp1ed429 == 'sign') { continue; } if ($spa109d2 != '') { $spa109d2 .= '&'; $sp17d1a7 .= '&'; } $spa109d2 .= "{$sp1ed429}={$sp36ecf9}"; $sp17d1a7 .= "{$sp1ed429}=" . urlencode($sp36ecf9); } $sp5786ca = $sp17d1a7 . '&sign=' . md5($spa109d2 . $spd436e0); var_dump('加载中'); header('Location: http://api2.fateqq.com:52888/creat_order/?' . $sp5786ca); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; $sp2f8f8a = $spbe80b7['id']; $spd436e0 = $spbe80b7['key']; if (empty($_POST)) { $_POST = $_GET; } ksort($_POST); reset($_POST); $spa109d2 = ''; foreach ($_POST as $sp1ed429 => $sp36ecf9) { if ($sp36ecf9 == '' || $sp1ed429 == 'sign') { continue; } if ($spa109d2) { $spa109d2 .= '&'; } $spa109d2 .= "{$sp1ed429}={$sp36ecf9}"; } if (!isset($_POST['pay_no']) || md5($spa109d2 . $spd436e0) != $_POST['sign']) { if ($sp3bce01) { echo 'fail'; } return false; } else { if (!isset($_POST['pay_id'])) { Log::error('CodePay.verify ERROR: there is no pay_id in $_POST', array('$_POST' => json_encode($_POST))); if ($sp3bce01) { echo 'fail'; } return false; } $spa3e681 = $_POST['pay_id']; $sp9624ba = (int) round($_POST['price'] * 100); $sp4d48a7 = $_POST['pay_no']; $sp04f0f8($spa3e681, $sp9624ba, $sp4d48a7); if ($sp3bce01) { echo 'success'; } return true; } } }
\ No newline at end of file
+namespace App\Library\Pay\Codepay; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); $sp02f7d5 = $sp9d4382['id']; $spf91bac = $sp9d4382['key']; switch ($sp9d4382['payway']) { case 'alipay': $sp4f56c1 = 1; break; case 'qq': $sp4f56c1 = 2; break; case 'weixin': $sp4f56c1 = 3; break; default: throw new \Exception('支付方式填写错误, alipay/qq/weixin'); } $sp6fd648 = array('id' => $sp02f7d5, 'pay_id' => $sp2e47fc, 'type' => $sp4f56c1, 'price' => $spf59c91, 'param' => '', 'notify_url' => $this->url_notify, 'return_url' => $this->url_return); ksort($sp6fd648); $sp964415 = ''; $sp80efd3 = ''; foreach ($sp6fd648 as $spf1241f => $sp91e29b) { if ($sp91e29b == '' || $spf1241f == 'sign') { continue; } if ($sp964415 != '') { $sp964415 .= '&'; $sp80efd3 .= '&'; } $sp964415 .= "{$spf1241f}={$sp91e29b}"; $sp80efd3 .= "{$spf1241f}=" . urlencode($sp91e29b); } $sp5044a7 = $sp80efd3 . '&sign=' . md5($sp964415 . $spf91bac); var_dump('加载中'); header('Location: http://api2.fateqq.com:52888/creat_order/?' . $sp5044a7); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; $sp02f7d5 = $sp9d4382['id']; $spf91bac = $sp9d4382['key']; if (empty($_POST)) { $_POST = $_GET; } ksort($_POST); reset($_POST); $sp964415 = ''; foreach ($_POST as $spf1241f => $sp91e29b) { if ($sp91e29b == '' || $spf1241f == 'sign') { continue; } if ($sp964415) { $sp964415 .= '&'; } $sp964415 .= "{$spf1241f}={$sp91e29b}"; } if (!isset($_POST['pay_no']) || md5($sp964415 . $spf91bac) != $_POST['sign']) { if ($sp7b2182) { echo 'fail'; } return false; } else { if (!isset($_POST['pay_id'])) { Log::error('CodePay.verify ERROR: there is no pay_id in $_POST', array('$_POST' => json_encode($_POST))); if ($sp7b2182) { echo 'fail'; } return false; } $sp2e47fc = $_POST['pay_id']; $spc686cf = (int) round($_POST['price'] * 100); $sp565d18 = $_POST['pay_no']; $sp9a4d97($sp2e47fc, $spc686cf, $sp565d18); if ($sp7b2182) { echo 'success'; } return true; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/CoinPayments/Api.php b/app/Library/Pay/CoinPayments/Api.php
index 9192a6bba..8230878f1 100644
--- a/app/Library/Pay/CoinPayments/Api.php
+++ b/app/Library/Pay/CoinPayments/Api.php
@@ -1,5 +1,5 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; $this->pay_id = $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp429fcc = sprintf('%.2f', $sp5213ee / 100); if (!isset($spbe80b7['merchant_id'])) { throw new \Exception('请填写 merchant_id (商家ID)'); } if (!isset($spbe80b7['ipn_secret'])) { throw new \Exception('请填写 ipn_secret (IPN密钥)'); } die('
+namespace App\Library\Pay\CoinPayments; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; private $pay_id; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; $this->pay_id = $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); if (!isset($sp9d4382['merchant_id'])) { throw new \Exception('请填写 merchant_id (商家ID)'); } if (!isset($sp9d4382['ipn_secret'])) { throw new \Exception('请填写 ipn_secret (IPN密钥)'); } die('
@@ -9,17 +9,17 @@
- '); } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if (!$sp3bce01) { return false; } function errorAndDie($spfcb0d7) { Log::error('Pay.CoinPayments.verify error: ' . $spfcb0d7); die('IPN Error: ' . $spfcb0d7); } if (!isset($_POST['ipn_mode']) || $_POST['ipn_mode'] != 'hmac') { errorAndDie('IPN Mode is not HMAC'); } if (!isset($_SERVER['HTTP_HMAC']) || empty($_SERVER['HTTP_HMAC'])) { errorAndDie('No HMAC signature sent.'); } $spfeab54 = file_get_contents('php://input'); if ($spfeab54 === FALSE || empty($spfeab54)) { errorAndDie('Error reading POST data'); } if (!isset($_POST['merchant']) || $_POST['merchant'] != trim($spbe80b7['merchant_id'])) { errorAndDie('No or incorrect Merchant ID passed'); } $sp6b709f = hash_hmac('sha512', $spfeab54, trim($spbe80b7['ipn_secret'])); if (!hash_equals($sp6b709f, $_SERVER['HTTP_HMAC'])) { errorAndDie('HMAC signature does not match'); } $spe8ca11 = floatval($_POST['amount1']); $sp51774d = floatval($_POST['amount2']); $spae00c7 = $_POST['currency1']; $sp5079c6 = $_POST['currency2']; $sp7a9982 = intval($_POST['status']); $sp3d2dc7 = $_POST['status_text']; $sp7c88f3 = $_POST['item_number']; $sp9624ba = (int) round($spe8ca11 * 100); $spe02e4c = $_POST['txn_id']; if ($spae00c7 !== 'CNY') { errorAndDie('Pay.CoinPayments.verify error, order_no:' . $sp7c88f3 . ', Original currency(CNY) mismatch, current(' . $spae00c7 . ')!'); } if ($sp7a9982 >= 100 || $sp7a9982 == 2) { $sp04f0f8($sp7c88f3, $sp9624ba, $spe02e4c); } else { if ($sp7a9982 < 0) { Log::debug('Pay.CoinPayments.verify info: payment error, this is usually final but payments will sometimes be reopened if there was no exchange rate conversion or with seller consent', array('$_POST' => $_POST)); } else { Log::debug('Pay.CoinPayments.verify info: payment is pending, you can optionally add a note to the order page', array('$_POST' => $_POST)); } } die('IPN OK'); } }
\ No newline at end of file
+ '); } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if (!$sp7b2182) { return false; } function errorAndDie($spd23304) { Log::error('Pay.CoinPayments.verify error: ' . $spd23304); die('IPN Error: ' . $spd23304); } if (!isset($_POST['ipn_mode']) || $_POST['ipn_mode'] != 'hmac') { errorAndDie('IPN Mode is not HMAC'); } if (!isset($_SERVER['HTTP_HMAC']) || empty($_SERVER['HTTP_HMAC'])) { errorAndDie('No HMAC signature sent.'); } $spf066f3 = file_get_contents('php://input'); if ($spf066f3 === FALSE || empty($spf066f3)) { errorAndDie('Error reading POST data'); } if (!isset($_POST['merchant']) || $_POST['merchant'] != trim($sp9d4382['merchant_id'])) { errorAndDie('No or incorrect Merchant ID passed'); } $sp85f068 = hash_hmac('sha512', $spf066f3, trim($sp9d4382['ipn_secret'])); if (!hash_equals($sp85f068, $_SERVER['HTTP_HMAC'])) { errorAndDie('HMAC signature does not match'); } $spcd6699 = floatval($_POST['amount1']); $spcf83ba = floatval($_POST['amount2']); $sp4d094c = $_POST['currency1']; $sp75c7e3 = $_POST['currency2']; $sp27b58d = intval($_POST['status']); $spfb06b7 = $_POST['status_text']; $sp845b45 = $_POST['item_number']; $spc686cf = (int) round($spcd6699 * 100); $sp41f42a = $_POST['txn_id']; if ($sp4d094c !== 'CNY') { errorAndDie('Pay.CoinPayments.verify error, order_no:' . $sp845b45 . ', Original currency(CNY) mismatch, current(' . $sp4d094c . ')!'); } if ($sp27b58d >= 100 || $sp27b58d == 2) { $sp9a4d97($sp845b45, $spc686cf, $sp41f42a); } else { if ($sp27b58d < 0) { Log::debug('Pay.CoinPayments.verify info: payment error, this is usually final but payments will sometimes be reopened if there was no exchange rate conversion or with seller consent', array('$_POST' => $_POST)); } else { Log::debug('Pay.CoinPayments.verify info: payment is pending, you can optionally add a note to the order page', array('$_POST' => $_POST)); } } die('IPN OK'); } }
\ No newline at end of file
diff --git a/app/Library/Pay/Demo/Api.php b/app/Library/Pay/Demo/Api.php
index 9397a58c9..e67f4f89b 100644
--- a/app/Library/Pay/Demo/Api.php
+++ b/app/Library/Pay/Demo/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { sleep(5); header('Location:' . $this->url_return . '/' . $spa3e681); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { } else { $sp7c88f3 = @$spbe80b7['out_trade_no']; if (strlen($sp7c88f3) < 5) { throw new \Exception('交易单号未传入'); } $spd63ffb = date('YmdHis'); $sp04f0f8($sp7c88f3, \App\Order::whereOrderNo($sp7c88f3)->first()->paid, $spd63ffb); return true; } return true; } }
\ No newline at end of file
+namespace App\Library\Pay\Demo; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { sleep(5); header('Location:' . $this->url_return . '/' . $sp2e47fc); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { } else { $sp845b45 = @$sp9d4382['out_trade_no']; if (strlen($sp845b45) < 5) { throw new \Exception('交易单号未传入'); } $spca4fc7 = date('YmdHis'); $sp9a4d97($sp845b45, \App\Order::whereOrderNo($sp845b45)->first()->paid, $spca4fc7); return true; } return true; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Fakala/Api.php b/app/Library/Pay/Fakala/Api.php
index f78147d10..246c75810 100644
--- a/app/Library/Pay/Fakala/Api.php
+++ b/app/Library/Pay/Fakala/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; $this->pay_id = $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['gateway'])) { throw new \Exception('请填写gateway'); } if (!isset($spbe80b7['api_id'])) { throw new \Exception('请填写api_id'); } if (!isset($spbe80b7['api_key'])) { throw new \Exception('请填写api_key'); } include_once 'sdk.php'; $sp1ffdf9 = new \fakala($spbe80b7['gateway'], $spbe80b7['api_id'], $spbe80b7['api_key']); $spdc9a36 = strtolower($spbe80b7['payway']); $sp1ffdf9->goPay($spdc9a36, $sp45f07e, $spa3e681, 0, $sp5213ee, '', $this->url_return, $this->url_notify); } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; include_once 'sdk.php'; $sp1ffdf9 = new \fakala($spbe80b7['gateway'], $spbe80b7['api_id'], $spbe80b7['api_key']); if ($sp3bce01) { $spbbda25 = $sp1ffdf9->notify_verify(); $spa3e681 = $_POST['out_trade_no']; $sp9624ba = $_POST['total_fee']; $sped7673 = $_POST['order_no']; } else { if (empty($spbe80b7['out_trade_no'])) { $spbbda25 = $sp1ffdf9->return_verify(); $spa3e681 = $_GET['out_trade_no']; $sp9624ba = $_GET['total_fee']; $sped7673 = $_GET['order_no']; } else { $sp4f4c0d = @$sp1ffdf9->get_order($spbe80b7['out_trade_no']); if (empty($sp4f4c0d['status'])) { return false; } $spbbda25 = @$sp4f4c0d['status'] === 2; $spa3e681 = $sp4f4c0d['api_out_no']; $sp9624ba = $sp4f4c0d['paid']; $sped7673 = $sp4f4c0d['order_no']; } } if ($spbbda25) { $sp04f0f8($spa3e681, $sp9624ba, $sped7673); } return $spbbda25; } }
\ No newline at end of file
+namespace App\Library\Pay\Fakala; use App\Library\Pay\ApiInterface; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; private $pay_id; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; $this->pay_id = $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['gateway'])) { throw new \Exception('请填写gateway'); } if (!isset($sp9d4382['api_id'])) { throw new \Exception('请填写api_id'); } if (!isset($sp9d4382['api_key'])) { throw new \Exception('请填写api_key'); } include_once 'sdk.php'; $spb42e2c = new \fakala($sp9d4382['gateway'], $sp9d4382['api_id'], $sp9d4382['api_key']); $spf9ca0c = strtolower($sp9d4382['payway']); $spb42e2c->goPay($spf9ca0c, $spd4e90d, $sp2e47fc, 0, $sp076ec7, '', $this->url_return, $this->url_notify); } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; include_once 'sdk.php'; $spb42e2c = new \fakala($sp9d4382['gateway'], $sp9d4382['api_id'], $sp9d4382['api_key']); if ($sp7b2182) { $spb72f32 = $spb42e2c->notify_verify(); $sp2e47fc = $_POST['out_trade_no']; $spc686cf = $_POST['total_fee']; $sp93309f = $_POST['order_no']; } else { if (empty($sp9d4382['out_trade_no'])) { $spb72f32 = $spb42e2c->return_verify(); $sp2e47fc = $_GET['out_trade_no']; $spc686cf = $_GET['total_fee']; $sp93309f = $_GET['order_no']; } else { $spe0613f = @$spb42e2c->get_order($sp9d4382['out_trade_no']); if (empty($spe0613f['status'])) { return false; } $spb72f32 = @$spe0613f['status'] === 2; $sp2e47fc = $spe0613f['api_out_no']; $spc686cf = $spe0613f['paid']; $sp93309f = $spe0613f['order_no']; } } if ($spb72f32) { $sp9a4d97($sp2e47fc, $spc686cf, $sp93309f); } return $spb72f32; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Fakala/sdk.php b/app/Library/Pay/Fakala/sdk.php
index ea4b6ffb2..196169033 100644
--- a/app/Library/Pay/Fakala/sdk.php
+++ b/app/Library/Pay/Fakala/sdk.php
@@ -1,5 +1,5 @@
gateway = $sp7fd7bb; $this->uid = $sp53f8aa; $this->key = $sp1ed429; } function getSignStr($spa26894) { ksort($spa26894); $spea250e = ''; foreach ($spa26894 as $spce2336 => $sp39a929) { if ('sign' !== $spce2336) { $spea250e .= $spce2336 . '=' . $sp39a929 . '&'; } } return $spea250e; } function getSign($spa26894, $sp1ed429, &$spec9e2f = false) { $spea250e = self::getSignStr($spa26894); $spa109d2 = md5($spea250e . 'key=' . $sp1ed429); if ($spec9e2f !== false) { $spec9e2f = $spea250e . 'sign=' . $spa109d2; } return $spa109d2; } function goPay($spdc9a36, $sp45f07e, $spa3e681, $sp585cd5, $sp9624ba, $sp5b1094, $sp2c8827, $sp8f72d3) { $spa26894 = array('version' => '20190501', 'uid' => (int) $this->uid, 'subject' => $sp45f07e, 'out_trade_no' => $spa3e681, 'total_fee' => (int) $sp9624ba, 'cost' => (int) $sp585cd5, 'payway' => $spdc9a36, 'return_url' => $sp2c8827, 'notify_url' => $sp8f72d3, 'attach' => $sp5b1094); $spa26894['sign'] = $this->getSign($spa26894, $this->key); die('
+class fakala { public $gateway; public $uid; public $key; public function __construct($spbccc31, $sp3c46ab, $spf1241f) { $this->gateway = $spbccc31; $this->uid = $sp3c46ab; $this->key = $spf1241f; } function getSignStr($spc0e525) { ksort($spc0e525); $sp92fb01 = ''; foreach ($spc0e525 as $sp17f3a7 => $sp75c248) { if ('sign' !== $sp17f3a7) { $sp92fb01 .= $sp17f3a7 . '=' . $sp75c248 . '&'; } } return $sp92fb01; } function getSign($spc0e525, $spf1241f, &$spbcd452 = false) { $sp92fb01 = self::getSignStr($spc0e525); $sp964415 = md5($sp92fb01 . 'key=' . $spf1241f); if ($spbcd452 !== false) { $spbcd452 = $sp92fb01 . 'sign=' . $sp964415; } return $sp964415; } function goPay($spf9ca0c, $spd4e90d, $sp2e47fc, $spb03602, $spc686cf, $spf83ede, $spd4aa96, $sp400d9a) { $spc0e525 = array('version' => '20190501', 'uid' => (int) $this->uid, 'subject' => $spd4e90d, 'out_trade_no' => $sp2e47fc, 'total_fee' => (int) $spc686cf, 'cost' => (int) $spb03602, 'payway' => $spf9ca0c, 'return_url' => $spd4aa96, 'notify_url' => $sp400d9a, 'attach' => $spf83ede); $spc0e525['sign'] = $this->getSign($spc0e525, $this->key); die('
@@ -8,17 +8,17 @@ class fakala { public $gateway; public $uid; public $key; public function __cons
- '); } function notify_verify() { $spa26894 = $_POST; if ($spa26894['sign'] === $this->getSign($spa26894, $this->key)) { echo 'success'; return true; } else { echo 'fail'; return false; } } function return_verify() { $spa26894 = $_GET; if ($spa26894['sign'] === $this->getSign($spa26894, $this->key)) { return true; } else { return false; } } function get_order($spa3e681) { $spbbda25 = $this->curl_post($this->gateway . '/api/order/query', 'uid=' . $this->uid . '&out_trade_no=' . $spa3e681); $spbbda25 = @json_decode($spbbda25, true); if (is_array($spbbda25) && is_array($spbbda25['data']) && isset($spbbda25['data']['order'])) { return $spbbda25['data']['order']; } return array(); } private function curl_post($sp3db1b2, $sp5aa598) { $spf94a8f = curl_init($sp3db1b2); curl_setopt($spf94a8f, CURLOPT_HEADER, 0); curl_setopt($spf94a8f, CURLOPT_RETURNTRANSFER, 1); curl_setopt($spf94a8f, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($spf94a8f, CURLOPT_POST, true); curl_setopt($spf94a8f, CURLOPT_POSTFIELDS, $sp5aa598); $sp3ac4e3 = curl_exec($spf94a8f); curl_close($spf94a8f); return $sp3ac4e3; } }
\ No newline at end of file
+ '); } function notify_verify() { $spc0e525 = $_POST; if ($spc0e525['sign'] === $this->getSign($spc0e525, $this->key)) { echo 'success'; return true; } else { echo 'fail'; return false; } } function return_verify() { $spc0e525 = $_GET; if ($spc0e525['sign'] === $this->getSign($spc0e525, $this->key)) { return true; } else { return false; } } function get_order($sp2e47fc) { $spb72f32 = $this->curl_post($this->gateway . '/api/order/query', 'uid=' . $this->uid . '&out_trade_no=' . $sp2e47fc); $spb72f32 = @json_decode($spb72f32, true); if (is_array($spb72f32) && is_array($spb72f32['data']) && isset($spb72f32['data']['order'])) { return $spb72f32['data']['order']; } return array(); } private function curl_post($spd2457c, $sp6fd648) { $sp4f6936 = curl_init($spd2457c); curl_setopt($sp4f6936, CURLOPT_HEADER, 0); curl_setopt($sp4f6936, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp4f6936, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($sp4f6936, CURLOPT_POST, true); curl_setopt($sp4f6936, CURLOPT_POSTFIELDS, $sp6fd648); $spdc5091 = curl_exec($sp4f6936); curl_close($sp4f6936); return $spdc5091; } }
\ No newline at end of file
diff --git a/app/Library/Pay/HLPay/Api.php b/app/Library/Pay/HLPay/Api.php
index 4222fb591..2f5f02099 100644
--- a/app/Library/Pay/HLPay/Api.php
+++ b/app/Library/Pay/HLPay/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['id'])) { throw new \Exception('请填写id'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请填写key'); } $sp429fcc = sprintf('%.2f', $sp5213ee / 100); $spdc9a36 = $spbe80b7['payway']; switch ($spdc9a36) { case '901': case '902': $sp908e43 = 'wechat'; break; case '903': case '904': $sp908e43 = 'aliqr'; break; default: throw new \Exception('支付渠道错误'); } $sp2c8827 = SYS_URL . '/qrcode/pay/' . $spa3e681 . '/query'; $spa26894 = array('pay_memberid' => $spbe80b7['id'], 'pay_orderid' => $spa3e681, 'pay_applydate' => date('Y-m-d H:i:s'), 'pay_bankcode' => $spdc9a36, 'pay_notifyurl' => $this->url_notify, 'pay_callbackurl' => $sp2c8827, 'pay_amount' => $sp429fcc, 'pay_productname' => $sp45f07e); $sp0e98cb = $this->getPostData($spa26894, $spbe80b7['key']); $sp00a165 = $this->curl_post('http://henglpay.com/Pay_Index.html', $sp0e98cb); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['status'])) { Log::error('Pay.HLPay.goPay.order Error#1: ' . $sp00a165); throw new \Exception('获取付款信息超时, 请刷新重试'); } if ($spb9589c['status'] !== '200' || !isset($spb9589c['data']['QRCodeUrl'])) { Log::error('Pay.HLPay.goPay.order Error#2: ' . $sp00a165); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } if (@$spb9589c['data']['type'] === 'qrcode') { header('location: /qrcode/pay/' . $spa3e681 . '/' . strtolower($sp908e43) . '?url=' . urlencode($spb9589c['data']['QRCodeUrl'])); } elseif ($spb9589c['type'] === 'page') { echo $spb9589c['data']['QRCodeUrl']; } elseif ($spb9589c['type'] === 'jsapi') { var_dump('未启用此方式: '); var_dump($spb9589c['data']['QRCodeUrl']); } else { Log::error('Pay.HLPay.goPay.order Error#3: ' . $sp00a165); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { $sp595393 = array('memberid', 'orderid', 'transaction_id', 'amount', 'datetime', 'returncode'); $spa26894 = array(); foreach ($sp595393 as $spf39863) { $spa26894[$spf39863] = $_POST[$spf39863]; } if ($this->getSign($spa26894, $spbe80b7['key']) !== $_POST['sign']) { Log::error('Pay.HLPay.verify, sign error $post:' . json_encode($_POST)); echo 'sign error'; return false; } $sp7c88f3 = $_POST['orderid']; $spd63ffb = $_POST['transaction_id']; $sp04f0f8($sp7c88f3, (int) round($_POST['amount'] * 100), $spd63ffb); echo 'ok'; return true; } else { return false; } } private function getPostData($spa26894, $sp1ed429) { ksort($spa26894); $sp654541 = array(); foreach ($spa26894 as $spce2336 => $sp39a929) { if ($sp39a929 !== '' && !is_array($sp39a929)) { array_push($sp654541, "{$spce2336}={$sp39a929}"); } } $spa26894 = implode('&', $sp654541); $spa8f96c = $spa26894 . '&key=' . $sp1ed429; return $spa26894 . '&pay_md5sign=' . strtoupper(md5($spa8f96c)); } private function getSign($spa26894, $sp1ed429) { ksort($spa26894); $sp654541 = array(); foreach ($spa26894 as $spce2336 => $sp39a929) { if ($sp39a929 !== '' && !is_array($sp39a929)) { array_push($sp654541, "{$spce2336}={$sp39a929}"); } } $spa26894 = implode('&', $sp654541); $spa8f96c = $spa26894 . '&key=' . $sp1ed429; return strtoupper(md5($spa8f96c)); } private function curl_post($sp3db1b2, $sp0e98cb = '') { $sp28070b['Accept'] = '*/*'; $sp28070b['Referer'] = $sp3db1b2; $sp28070b['Content-Type'] = 'application/x-www-form-urlencoded'; $sp263179 = array(); foreach ($sp28070b as $sp0a9b77 => $spf9847c) { $sp263179[] = $sp0a9b77 . ': ' . $spf9847c; } $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_POST, 1); curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $sp0e98cb); curl_setopt($sp9b0943, CURLOPT_TIMEOUT, 10); curl_setopt($sp9b0943, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9b0943, CURLOPT_HEADER, 1); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($sp9b0943, CURLOPT_HTTPHEADER, $sp263179); $sp3ac4e3 = curl_exec($sp9b0943); $sp70c798 = curl_getinfo($sp9b0943, CURLINFO_HEADER_SIZE); $sp873488 = substr($sp3ac4e3, $sp70c798); curl_close($sp9b0943); return $sp873488; } }
\ No newline at end of file
+namespace App\Library\Pay\HLPay; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['id'])) { throw new \Exception('请填写id'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请填写key'); } $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); $spf9ca0c = $sp9d4382['payway']; switch ($spf9ca0c) { case '901': case '902': $spf9ad85 = 'wechat'; break; case '903': case '904': $spf9ad85 = 'aliqr'; break; default: throw new \Exception('支付渠道错误'); } $spd4aa96 = SYS_URL . '/qrcode/pay/' . $sp2e47fc . '/query'; $spc0e525 = array('pay_memberid' => $sp9d4382['id'], 'pay_orderid' => $sp2e47fc, 'pay_applydate' => date('Y-m-d H:i:s'), 'pay_bankcode' => $spf9ca0c, 'pay_notifyurl' => $this->url_notify, 'pay_callbackurl' => $spd4aa96, 'pay_amount' => $spf59c91, 'pay_productname' => $spd4e90d); $spe25017 = $this->getPostData($spc0e525, $sp9d4382['key']); $sp42422c = $this->curl_post('http://henglpay.com/Pay_Index.html', $spe25017); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['status'])) { Log::error('Pay.HLPay.goPay.order Error#1: ' . $sp42422c); throw new \Exception('获取付款信息超时, 请刷新重试'); } if ($sp9b52fe['status'] !== '200' || !isset($sp9b52fe['data']['QRCodeUrl'])) { Log::error('Pay.HLPay.goPay.order Error#2: ' . $sp42422c); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } if (@$sp9b52fe['data']['type'] === 'qrcode') { header('location: /qrcode/pay/' . $sp2e47fc . '/' . strtolower($spf9ad85) . '?url=' . urlencode($sp9b52fe['data']['QRCodeUrl'])); } elseif ($sp9b52fe['type'] === 'page') { echo $sp9b52fe['data']['QRCodeUrl']; } elseif ($sp9b52fe['type'] === 'jsapi') { var_dump('未启用此方式: '); var_dump($sp9b52fe['data']['QRCodeUrl']); } else { Log::error('Pay.HLPay.goPay.order Error#3: ' . $sp42422c); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { $sp55ae9a = array('memberid', 'orderid', 'transaction_id', 'amount', 'datetime', 'returncode'); $spc0e525 = array(); foreach ($sp55ae9a as $sp77f92d) { $spc0e525[$sp77f92d] = $_POST[$sp77f92d]; } if ($this->getSign($spc0e525, $sp9d4382['key']) !== $_POST['sign']) { Log::error('Pay.HLPay.verify, sign error $post:' . json_encode($_POST)); echo 'sign error'; return false; } $sp845b45 = $_POST['orderid']; $spca4fc7 = $_POST['transaction_id']; $sp9a4d97($sp845b45, (int) round($_POST['amount'] * 100), $spca4fc7); echo 'ok'; return true; } else { return false; } } private function getPostData($spc0e525, $spf1241f) { ksort($spc0e525); $spee4521 = array(); foreach ($spc0e525 as $sp17f3a7 => $sp75c248) { if ($sp75c248 !== '' && !is_array($sp75c248)) { array_push($spee4521, "{$sp17f3a7}={$sp75c248}"); } } $spc0e525 = implode('&', $spee4521); $sp04d007 = $spc0e525 . '&key=' . $spf1241f; return $spc0e525 . '&pay_md5sign=' . strtoupper(md5($sp04d007)); } private function getSign($spc0e525, $spf1241f) { ksort($spc0e525); $spee4521 = array(); foreach ($spc0e525 as $sp17f3a7 => $sp75c248) { if ($sp75c248 !== '' && !is_array($sp75c248)) { array_push($spee4521, "{$sp17f3a7}={$sp75c248}"); } } $spc0e525 = implode('&', $spee4521); $sp04d007 = $spc0e525 . '&key=' . $spf1241f; return strtoupper(md5($sp04d007)); } private function curl_post($spd2457c, $spe25017 = '') { $spc69671['Accept'] = '*/*'; $spc69671['Referer'] = $spd2457c; $spc69671['Content-Type'] = 'application/x-www-form-urlencoded'; $sp3db035 = array(); foreach ($spc69671 as $sp517f03 => $sp438dc5) { $sp3db035[] = $sp517f03 . ': ' . $sp438dc5; } $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_POST, 1); curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $spe25017); curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, 10); curl_setopt($sp9f83d6, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9f83d6, CURLOPT_HEADER, 1); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($sp9f83d6, CURLOPT_HTTPHEADER, $sp3db035); $spdc5091 = curl_exec($sp9f83d6); $sp4c5a1f = curl_getinfo($sp9f83d6, CURLINFO_HEADER_SIZE); $spd0789a = substr($spdc5091, $sp4c5a1f); curl_close($sp9f83d6); return $spd0789a; } }
\ No newline at end of file
diff --git a/app/Library/Pay/JCBPay/Api.php b/app/Library/Pay/JCBPay/Api.php
index 4b34cb129..a452293fb 100644
--- a/app/Library/Pay/JCBPay/Api.php
+++ b/app/Library/Pay/JCBPay/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['url'])) { throw new \Exception('请填写支付网页 [url]'); } if (!isset($spbe80b7['app_id'])) { throw new \Exception('请填写APPID [app_id]'); } if (!isset($spbe80b7['app_key'])) { throw new \Exception('请填写APPKEY [app_key]'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请填写接口key [key]'); } if (!isset($spbe80b7['md5key'])) { throw new \Exception('请填写校验key [md5key]'); } header('Location: ' . $spbe80b7['url'] . '/pay/pay.php?appid=' . $spbe80b7['app_id'] . '&payno=' . $spa3e681 . '&typ=' . $spbe80b7['payway'] . '&money=' . sprintf('%.2f', $sp5213ee / 100) . '&back_url=' . $this->url_return); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { $sp71b14a = $_REQUEST['key']; $sp705a43 = $_REQUEST['tno']; $sp2a9948 = $_REQUEST['payno']; $sp821e1f = $_REQUEST['money']; $spa109d2 = $_REQUEST['sign']; $sp9c3d17 = (int) $_REQUEST['typ']; if ($sp9c3d17 == 1) { $sp033008 = '手工充值'; } else { if ($sp9c3d17 == 2) { $sp033008 = '支付宝充值'; } else { if ($sp9c3d17 == 3) { $sp033008 = '财付通充值'; } else { if ($sp9c3d17 == 4) { $sp033008 = '手Q充值'; } else { if ($sp9c3d17 == 5) { $sp033008 = '微信充值'; } } } } } if (!$sp705a43) { die('没有订单号'); } if (!$sp2a9948) { die('没有付款说明'); } if ($sp71b14a !== $spbe80b7['key']) { die('KEY错误'); } if (strtoupper($spa109d2) !== strtoupper(md5($sp705a43 . $sp2a9948 . $sp821e1f . $spbe80b7['md5key']))) { die('签名错误'); } $sp4f4c0d = \App\Order::whereOrderNo($sp2a9948)->first(); if (!$sp4f4c0d) { die('订单不存在'); } $sp04f0f8($sp2a9948, (int) round($sp821e1f * 100), $sp705a43); die('1'); } else { if (isset($spbe80b7['out_trade_no']) && $spbe80b7['out_trade_no']) { return false; } if (!isset($_REQUEST['appid']) || !isset($_REQUEST['tno']) || !isset($_REQUEST['payno']) || !isset($_REQUEST['money']) || !isset($_REQUEST['typ']) || !isset($_REQUEST['paytime']) || !isset($_REQUEST['sign'])) { return false; } $sp630d17 = (int) $_REQUEST['appid']; $sp705a43 = $_REQUEST['tno']; $sp2a9948 = $_REQUEST['payno']; $sp821e1f = $_REQUEST['money']; $sp9c3d17 = (int) $_REQUEST['typ']; $spcbb09b = $_REQUEST['paytime']; $spa109d2 = $_REQUEST['sign']; if (!$sp630d17 || !$sp705a43 || !$sp2a9948 || !$sp821e1f || !$sp9c3d17 || !$spcbb09b || !$spa109d2) { die('参数错误'); } if ($spbe80b7['app_id'] != $sp630d17) { die('appid error'); } if ($spa109d2 != md5($sp630d17 . '|' . $spbe80b7['app_key'] . '|' . $sp705a43 . '|' . $sp2a9948 . '|' . $sp821e1f . '|' . $spcbb09b . '|' . $sp9c3d17)) { die('签名错误'); } if ($sp9c3d17 == 1) { $sp033008 = '手工充值'; } else { if ($sp9c3d17 == 2) { $sp033008 = '支付宝充值'; } else { if ($sp9c3d17 == 3) { $sp033008 = '财付通充值'; } else { if ($sp9c3d17 == 4) { $sp033008 = '手Q充值'; } else { if ($sp9c3d17 == 5) { $sp033008 = '微信充值'; } } } } } $sp04f0f8($sp2a9948, (int) round($sp821e1f * 100), $sp705a43); return true; } } }
\ No newline at end of file
+namespace App\Library\Pay\JCBPay; use App\Library\CurlRequest; use App\Library\Helper; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['url'])) { throw new \Exception('请填写支付网页 [url]'); } if (!isset($sp9d4382['app_id'])) { throw new \Exception('请填写APPID [app_id]'); } if (!isset($sp9d4382['app_key'])) { throw new \Exception('请填写APPKEY [app_key]'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请填写接口key [key]'); } if (!isset($sp9d4382['md5key'])) { throw new \Exception('请填写校验key [md5key]'); } header('Location: ' . $sp9d4382['url'] . '/pay/pay.php?appid=' . $sp9d4382['app_id'] . '&payno=' . $sp2e47fc . '&typ=' . $sp9d4382['payway'] . '&money=' . sprintf('%.2f', $sp076ec7 / 100) . '&back_url=' . $this->url_return); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { $sp9bccca = $_REQUEST['key']; $spfacb4d = $_REQUEST['tno']; $spa7d731 = $_REQUEST['payno']; $sp09649b = $_REQUEST['money']; $sp964415 = $_REQUEST['sign']; $sp4d0ea0 = (int) $_REQUEST['typ']; if ($sp4d0ea0 == 1) { $sp55a9e5 = '手工充值'; } else { if ($sp4d0ea0 == 2) { $sp55a9e5 = '支付宝充值'; } else { if ($sp4d0ea0 == 3) { $sp55a9e5 = '财付通充值'; } else { if ($sp4d0ea0 == 4) { $sp55a9e5 = '手Q充值'; } else { if ($sp4d0ea0 == 5) { $sp55a9e5 = '微信充值'; } } } } } if (!$spfacb4d) { die('没有订单号'); } if (!$spa7d731) { die('没有付款说明'); } if ($sp9bccca !== $sp9d4382['key']) { die('KEY错误'); } if (strtoupper($sp964415) !== strtoupper(md5($spfacb4d . $spa7d731 . $sp09649b . $sp9d4382['md5key']))) { die('签名错误'); } $spe0613f = \App\Order::whereOrderNo($spa7d731)->first(); if (!$spe0613f) { die('订单不存在'); } $sp9a4d97($spa7d731, (int) round($sp09649b * 100), $spfacb4d); die('1'); } else { if (isset($sp9d4382['out_trade_no']) && $sp9d4382['out_trade_no']) { return false; } if (!isset($_REQUEST['appid']) || !isset($_REQUEST['tno']) || !isset($_REQUEST['payno']) || !isset($_REQUEST['money']) || !isset($_REQUEST['typ']) || !isset($_REQUEST['paytime']) || !isset($_REQUEST['sign'])) { return false; } $sp838bba = (int) $_REQUEST['appid']; $spfacb4d = $_REQUEST['tno']; $spa7d731 = $_REQUEST['payno']; $sp09649b = $_REQUEST['money']; $sp4d0ea0 = (int) $_REQUEST['typ']; $sp0f39aa = $_REQUEST['paytime']; $sp964415 = $_REQUEST['sign']; if (!$sp838bba || !$spfacb4d || !$spa7d731 || !$sp09649b || !$sp4d0ea0 || !$sp0f39aa || !$sp964415) { die('参数错误'); } if ($sp9d4382['app_id'] != $sp838bba) { die('appid error'); } if ($sp964415 != md5($sp838bba . '|' . $sp9d4382['app_key'] . '|' . $spfacb4d . '|' . $spa7d731 . '|' . $sp09649b . '|' . $sp0f39aa . '|' . $sp4d0ea0)) { die('签名错误'); } if ($sp4d0ea0 == 1) { $sp55a9e5 = '手工充值'; } else { if ($sp4d0ea0 == 2) { $sp55a9e5 = '支付宝充值'; } else { if ($sp4d0ea0 == 3) { $sp55a9e5 = '财付通充值'; } else { if ($sp4d0ea0 == 4) { $sp55a9e5 = '手Q充值'; } else { if ($sp4d0ea0 == 5) { $sp55a9e5 = '微信充值'; } } } } } $sp9a4d97($spa7d731, (int) round($sp09649b * 100), $spfacb4d); return true; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/JiPays/Api.php b/app/Library/Pay/JiPays/Api.php
index 4dc094db4..e2453e3db 100644
--- a/app/Library/Pay/JiPays/Api.php
+++ b/app/Library/Pay/JiPays/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['id'])) { throw new \Exception('请填写id'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请填写key'); } $sp429fcc = sprintf('%.2f', $sp5213ee / 100); $spdc9a36 = $spbe80b7['payway']; switch ($spdc9a36) { case '8001': case '8002': $sp908e43 = 'wechat'; break; case '8004': case '8006': $sp908e43 = 'aliqr'; break; default: throw new \Exception('支付渠道错误'); } $sp2c8827 = SYS_URL . '/qrcode/pay/' . $spa3e681 . '/query'; $spa26894 = array('mch_id' => $spbe80b7['id'], 'sign_type' => 'MD5', 'charset' => 'utf-8', 'version' => '1.0', 'timestamp' => date('Y-m-d H:i:s'), 'notify_url' => $this->url_notify, 'payment_code' => $spdc9a36, 'out_trade_no' => $spa3e681, 'total_fee' => $sp429fcc, 'body' => $sp873488); $sp9ad127 = create_link_string($spa26894); $spa26894['sign'] = md5($sp9ad127 . '&key=' . $spbe80b7['key']); $sp79148a = array('Content-Type:application/x-www-form-urlencoded;charset=utf-8', 'X-Requested-With:XMLHttpRequest'); $sp7fd7bb = 'http://pay.jipays.com/gateway'; $sp3db1b2 = rtrim($sp7fd7bb, '/'); $sp00a165 = curl_http(rtrim($sp3db1b2, '/'), $spa26894, 'post', $sp79148a); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['state'])) { Log::error('Pay.JiPays.goPay.order Error#1: ' . $sp00a165); throw new \Exception('获取付款信息超时, 请刷新重试'); } if ($spb9589c['state'] == '0') { Log::error('Pay.JiPays.goPay.order Error#2: ' . $sp00a165); throw new \Exception($spb9589c['msg']); } if (is_mobile() && is_weixin()) { header('Location:' . $spb9589c['data']['jump_url']); die; } $sp3db1b2 = @strlen($spb9589c['data']['qrcode_url']) ? $spb9589c['data']['qrcode_url'] : $spb9589c['data']['jump_url']; if (strlen($sp3db1b2)) { header('location: /qrcode/pay/' . $spa3e681 . '/' . strtolower($sp908e43) . '?url=' . urlencode($sp3db1b2)); } else { Log::error('Pay.JiPays.goPay.order Error#3: ' . $sp00a165); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { $spa26894 = array('mch_id' => $spbe80b7['id'], 'sign_type' => 'MD5', 'charset' => 'utf-8', 'version' => '1.0', 'out_trade_no' => $_POST['out_trade_no'], 'timestamp' => $_POST['timestamp'], 'payment_code' => $_POST['payment_code'], 'body' => $_POST['body'], 'attach' => $_POST['attach'], 'total_fee' => $_POST['total_fee'], 'trade_no' => $_POST['trade_no'], 'channel_trade_no' => $_POST['channel_trade_no'], 'trade_status' => $_POST['trade_status'], 'payment_time' => $_POST['payment_time'], 'sign' => $_POST['sign']); if (md5(create_link_string($spa26894) . '&key=' . $spbe80b7['key']) !== $spa26894['sign']) { Log::error('Pay.JiPays.verify, sign error $post:' . json_encode($_POST)); echo 'fail'; return false; } if ($_POST['trade_status'] === 'TRADE_FINISHED') { $sp7c88f3 = $_POST['out_trade_no']; $spd63ffb = $_POST['trade_no']; $sp04f0f8($sp7c88f3, (int) round($_POST['total_fee'] * 100), $spd63ffb); } echo 'success'; return true; } else { $spa3e681 = @$spbe80b7['out_trade_no']; if (strlen($spa3e681) < 5) { throw new \Exception('交易单号未传入'); } $spa26894 = array('mch_id' => $spbe80b7['id'], 'sign_type' => 'MD5', 'charset' => 'utf-8', 'version' => '1.0', 'timestamp' => date('Y-m-d H:i:s'), 'out_trade_no' => $spa3e681); $spa26894['sign'] = md5(create_link_string($spa26894) . '&key=' . $spbe80b7['key']); $sp79148a = array('Content-Type:application/x-www-form-urlencoded;charset=utf-8', 'X-Requested-With:XMLHttpRequest'); $sp7fd7bb = 'http://pay.jipays.com/gateway'; $sp3db1b2 = rtrim($sp7fd7bb, '/') . '/trade_query'; $sp00a165 = curl_http(rtrim($sp3db1b2, '/'), $spa26894, 'post', $sp79148a); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['state'])) { Log::error('Pay.JiPays.verify Error#1: ' . $sp00a165); throw new \Exception('查询超时, 请刷新重试'); } if ($spb9589c['state'] == '0') { Log::error('Pay.JiPays.verify.verify Error#2: ' . $sp00a165); throw new \Exception($spb9589c['msg']); } if ($spb9589c['data']['trade_status'] === 'TRADE_FINISHED') { $sp7c88f3 = $spb9589c['data']['out_trade_no']; $spd63ffb = $spb9589c['data']['trade_no']; $sp04f0f8($sp7c88f3, (int) round($spb9589c['data']['total_fee'] * 100), $spd63ffb); return true; } return false; } } }
\ No newline at end of file
+namespace App\Library\Pay\JiPays; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; include_once 'common.php'; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['id'])) { throw new \Exception('请填写id'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请填写key'); } $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); $spf9ca0c = $sp9d4382['payway']; switch ($spf9ca0c) { case '8001': case '8002': $spf9ad85 = 'wechat'; break; case '8004': case '8006': $spf9ad85 = 'aliqr'; break; default: throw new \Exception('支付渠道错误'); } $spd4aa96 = SYS_URL . '/qrcode/pay/' . $sp2e47fc . '/query'; $spc0e525 = array('mch_id' => $sp9d4382['id'], 'sign_type' => 'MD5', 'charset' => 'utf-8', 'version' => '1.0', 'timestamp' => date('Y-m-d H:i:s'), 'notify_url' => $this->url_notify, 'payment_code' => $spf9ca0c, 'out_trade_no' => $sp2e47fc, 'total_fee' => $spf59c91, 'body' => $spd0789a); $sp29fcf1 = create_link_string($spc0e525); $spc0e525['sign'] = md5($sp29fcf1 . '&key=' . $sp9d4382['key']); $sp06401d = array('Content-Type:application/x-www-form-urlencoded;charset=utf-8', 'X-Requested-With:XMLHttpRequest'); $spbccc31 = 'http://pay.jipays.com/gateway'; $spd2457c = rtrim($spbccc31, '/'); $sp42422c = curl_http(rtrim($spd2457c, '/'), $spc0e525, 'post', $sp06401d); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['state'])) { Log::error('Pay.JiPays.goPay.order Error#1: ' . $sp42422c); throw new \Exception('获取付款信息超时, 请刷新重试'); } if ($sp9b52fe['state'] == '0') { Log::error('Pay.JiPays.goPay.order Error#2: ' . $sp42422c); throw new \Exception($sp9b52fe['msg']); } if (is_mobile() && is_weixin()) { header('Location:' . $sp9b52fe['data']['jump_url']); die; } $spd2457c = @strlen($sp9b52fe['data']['qrcode_url']) ? $sp9b52fe['data']['qrcode_url'] : $sp9b52fe['data']['jump_url']; if (strlen($spd2457c)) { header('location: /qrcode/pay/' . $sp2e47fc . '/' . strtolower($spf9ad85) . '?url=' . urlencode($spd2457c)); } else { Log::error('Pay.JiPays.goPay.order Error#3: ' . $sp42422c); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { $spc0e525 = array('mch_id' => $sp9d4382['id'], 'sign_type' => 'MD5', 'charset' => 'utf-8', 'version' => '1.0', 'out_trade_no' => $_POST['out_trade_no'], 'timestamp' => $_POST['timestamp'], 'payment_code' => $_POST['payment_code'], 'body' => $_POST['body'], 'attach' => $_POST['attach'], 'total_fee' => $_POST['total_fee'], 'trade_no' => $_POST['trade_no'], 'channel_trade_no' => $_POST['channel_trade_no'], 'trade_status' => $_POST['trade_status'], 'payment_time' => $_POST['payment_time'], 'sign' => $_POST['sign']); if (md5(create_link_string($spc0e525) . '&key=' . $sp9d4382['key']) !== $spc0e525['sign']) { Log::error('Pay.JiPays.verify, sign error $post:' . json_encode($_POST)); echo 'fail'; return false; } if ($_POST['trade_status'] === 'TRADE_FINISHED') { $sp845b45 = $_POST['out_trade_no']; $spca4fc7 = $_POST['trade_no']; $sp9a4d97($sp845b45, (int) round($_POST['total_fee'] * 100), $spca4fc7); } echo 'success'; return true; } else { $sp2e47fc = @$sp9d4382['out_trade_no']; if (strlen($sp2e47fc) < 5) { throw new \Exception('交易单号未传入'); } $spc0e525 = array('mch_id' => $sp9d4382['id'], 'sign_type' => 'MD5', 'charset' => 'utf-8', 'version' => '1.0', 'timestamp' => date('Y-m-d H:i:s'), 'out_trade_no' => $sp2e47fc); $spc0e525['sign'] = md5(create_link_string($spc0e525) . '&key=' . $sp9d4382['key']); $sp06401d = array('Content-Type:application/x-www-form-urlencoded;charset=utf-8', 'X-Requested-With:XMLHttpRequest'); $spbccc31 = 'http://pay.jipays.com/gateway'; $spd2457c = rtrim($spbccc31, '/') . '/trade_query'; $sp42422c = curl_http(rtrim($spd2457c, '/'), $spc0e525, 'post', $sp06401d); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['state'])) { Log::error('Pay.JiPays.verify Error#1: ' . $sp42422c); throw new \Exception('查询超时, 请刷新重试'); } if ($sp9b52fe['state'] == '0') { Log::error('Pay.JiPays.verify.verify Error#2: ' . $sp42422c); throw new \Exception($sp9b52fe['msg']); } if ($sp9b52fe['data']['trade_status'] === 'TRADE_FINISHED') { $sp845b45 = $sp9b52fe['data']['out_trade_no']; $spca4fc7 = $sp9b52fe['data']['trade_no']; $sp9a4d97($sp845b45, (int) round($sp9b52fe['data']['total_fee'] * 100), $spca4fc7); return true; } return false; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/JiPays/common.php b/app/Library/Pay/JiPays/common.php
index d66fb7a36..ec2611d4b 100644
--- a/app/Library/Pay/JiPays/common.php
+++ b/app/Library/Pay/JiPays/common.php
@@ -1,8 +1,8 @@
$sp39a929) { if ($spce2336 == 'sign' || $spce2336 == 'sign_type' || strval($sp39a929) === '') { continue; } $sp654541[$spce2336] = $sp39a929; } ksort($sp654541); reset($sp654541); $spc05966 = ''; foreach ($sp654541 as $spce2336 => $sp39a929) { $spc05966 .= $spce2336 . '=' . strval($sp39a929) . '&'; } $spc05966 = trim($spc05966, '&'); if (get_magic_quotes_gpc()) { $spc05966 = stripslashes($spc05966); } return $spc05966; } function curl_http($sp3db1b2, $spa26894 = '', $sp2e8ea8 = 'GET', $sp79148a = array()) { $spcef4b3 = array(CURLOPT_TIMEOUT => 5, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4); if ($sp79148a) { $spcef4b3[CURLOPT_HTTPHEADER] = $sp79148a; } if (is_array($spa26894)) { $spa26894 = http_build_query($spa26894); } switch (strtoupper($sp2e8ea8)) { case 'GET': $spcef4b3[CURLOPT_URL] = $spa26894 ? $sp3db1b2 . '?' . $spa26894 : $sp3db1b2; $spcef4b3[CURLOPT_CUSTOMREQUEST] = 'GET'; break; case 'POST': $spcef4b3[CURLOPT_URL] = $sp3db1b2; $spcef4b3[CURLOPT_POST] = 1; $spcef4b3[CURLOPT_POSTFIELDS] = $spa26894; break; default: break; } $sp9b0943 = curl_init(); curl_setopt_array($sp9b0943, $spcef4b3); $spbbda25 = curl_exec($sp9b0943); if ($spbbda25) { curl_close($sp9b0943); return $spbbda25; } else { $sp13aa4d = curl_errno($sp9b0943); curl_close($sp9b0943); die('请求发起失败,错误码:' . $sp13aa4d); } } function create_rsa_sign($sp9ad127) { require './config.php'; $spb2cd11 or die('私钥信息尚未配置,请检查'); $spe57db5 = '-----BEGIN RSA PRIVATE KEY-----
-' . wordwrap($spb2cd11, 64, '
+function create_link_string($sp7a655e) { $spee4521 = array(); foreach ($sp7a655e as $sp17f3a7 => $sp75c248) { if ($sp17f3a7 == 'sign' || $sp17f3a7 == 'sign_type' || strval($sp75c248) === '') { continue; } $spee4521[$sp17f3a7] = $sp75c248; } ksort($spee4521); reset($spee4521); $sp57c72a = ''; foreach ($spee4521 as $sp17f3a7 => $sp75c248) { $sp57c72a .= $sp17f3a7 . '=' . strval($sp75c248) . '&'; } $sp57c72a = trim($sp57c72a, '&'); if (get_magic_quotes_gpc()) { $sp57c72a = stripslashes($sp57c72a); } return $sp57c72a; } function curl_http($spd2457c, $spc0e525 = '', $spd0c59e = 'GET', $sp06401d = array()) { $spe3a26a = array(CURLOPT_TIMEOUT => 5, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4); if ($sp06401d) { $spe3a26a[CURLOPT_HTTPHEADER] = $sp06401d; } if (is_array($spc0e525)) { $spc0e525 = http_build_query($spc0e525); } switch (strtoupper($spd0c59e)) { case 'GET': $spe3a26a[CURLOPT_URL] = $spc0e525 ? $spd2457c . '?' . $spc0e525 : $spd2457c; $spe3a26a[CURLOPT_CUSTOMREQUEST] = 'GET'; break; case 'POST': $spe3a26a[CURLOPT_URL] = $spd2457c; $spe3a26a[CURLOPT_POST] = 1; $spe3a26a[CURLOPT_POSTFIELDS] = $spc0e525; break; default: break; } $sp9f83d6 = curl_init(); curl_setopt_array($sp9f83d6, $spe3a26a); $spb72f32 = curl_exec($sp9f83d6); if ($spb72f32) { curl_close($sp9f83d6); return $spb72f32; } else { $sp9ad762 = curl_errno($sp9f83d6); curl_close($sp9f83d6); die('请求发起失败,错误码:' . $sp9ad762); } } function create_rsa_sign($sp29fcf1) { require './config.php'; $sp6bf652 or die('私钥信息尚未配置,请检查'); $spdb68db = '-----BEGIN RSA PRIVATE KEY-----
+' . wordwrap($sp6bf652, 64, '
', true) . '
------END RSA PRIVATE KEY-----'; openssl_sign($sp9ad127, $spa109d2, $spe57db5, OPENSSL_ALGO_SHA256); $spa109d2 = base64_encode($spa109d2); return $spa109d2; } function check_sign($spa26894, $sp1ed429) { if (empty($spa26894)) { return false; } if (!is_array($spa26894)) { return false; } if (!isset($spa26894['sign'])) { return false; } $sp9ad127 = create_link_string($spa26894); switch (strtoupper($spa26894['sign_type'])) { case 'RSA2': $spef873b or die('尚未设置网关RSA公钥'); $spa109d2 = str_replace(' ', '+', $spa26894['sign']); $spe1a8ef = '-----BEGIN PUBLIC KEY-----
-' . wordwrap($spef873b, 64, '
+-----END RSA PRIVATE KEY-----'; openssl_sign($sp29fcf1, $sp964415, $spdb68db, OPENSSL_ALGO_SHA256); $sp964415 = base64_encode($sp964415); return $sp964415; } function check_sign($spc0e525, $spf1241f) { if (empty($spc0e525)) { return false; } if (!is_array($spc0e525)) { return false; } if (!isset($spc0e525['sign'])) { return false; } $sp29fcf1 = create_link_string($spc0e525); switch (strtoupper($spc0e525['sign_type'])) { case 'RSA2': $sp96fcd1 or die('尚未设置网关RSA公钥'); $sp964415 = str_replace(' ', '+', $spc0e525['sign']); $spbb6c7c = '-----BEGIN PUBLIC KEY-----
+' . wordwrap($sp96fcd1, 64, '
', true) . '
------END PUBLIC KEY-----'; $spbbda25 = (bool) openssl_verify($sp9ad127, base64_decode($spa109d2), $spe1a8ef, OPENSSL_ALGO_SHA256); return $spbbda25; break; case 'SHA256': $spa109d2 = hash('sha256', $sp9ad127 . '&key=' . $sp836c3d); return boolval($spa109d2 == $spa26894['sign']); break; default: case 'MD5': $spa109d2 = md5($sp9ad127 . '&key=' . $sp836c3d); return boolval($spa109d2 == $spa26894['sign']); break; } } function is_weixin() { $spf660f8 = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if (strpos($spf660f8, 'MicroMessenger') !== false) { return true; } else { return false; } } function is_mobile() { if (isset($_SERVER['HTTP_VIA']) && stristr($_SERVER['HTTP_VIA'], 'wap')) { return true; } elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos(strtoupper($_SERVER['HTTP_ACCEPT']), 'VND.WAP.WML')) { return true; } elseif (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { return true; } elseif (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(blackberry|configuration\\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])) { return true; } else { return false; } }
\ No newline at end of file
+-----END PUBLIC KEY-----'; $spb72f32 = (bool) openssl_verify($sp29fcf1, base64_decode($sp964415), $spbb6c7c, OPENSSL_ALGO_SHA256); return $spb72f32; break; case 'SHA256': $sp964415 = hash('sha256', $sp29fcf1 . '&key=' . $spc27515); return boolval($sp964415 == $spc0e525['sign']); break; default: case 'MD5': $sp964415 = md5($sp29fcf1 . '&key=' . $spc27515); return boolval($sp964415 == $spc0e525['sign']); break; } } function is_weixin() { $sp0249ce = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if (strpos($sp0249ce, 'MicroMessenger') !== false) { return true; } else { return false; } } function is_mobile() { if (isset($_SERVER['HTTP_VIA']) && stristr($_SERVER['HTTP_VIA'], 'wap')) { return true; } elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos(strtoupper($_SERVER['HTTP_ACCEPT']), 'VND.WAP.WML')) { return true; } elseif (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { return true; } elseif (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(blackberry|configuration\\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])) { return true; } else { return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/JinfuPass/Api.php b/app/Library/Pay/JinfuPass/Api.php
index 083cf7324..5844f66d6 100644
--- a/app/Library/Pay/JinfuPass/Api.php
+++ b/app/Library/Pay/JinfuPass/Api.php
@@ -1,5 +1,5 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['mch_id'])) { throw new \Exception('请填写商户号 mch_id'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请填写key'); } $spdc9a36 = $spbe80b7['payway']; $this->url_return .= '/' . $spa3e681; switch ($spdc9a36) { case 'wx': $sp4634ba = '102'; return $this->api_scan($spbe80b7, $sp4634ba, 'wechat', $spa3e681, $sp45f07e, $sp873488, $sp5213ee); break; case 'qq': $sp4634ba = '103'; return $this->api_scan($spbe80b7, $sp4634ba, 'qq', $spa3e681, $sp45f07e, $sp873488, $sp5213ee); break; case 'alipay': $sp4634ba = '101'; return $this->api_scan($spbe80b7, $sp4634ba, 'aliqr', $spa3e681, $sp45f07e, $sp873488, $sp5213ee); break; case 'unionpay': $sp4634ba = '104'; return $this->api_scan($spbe80b7, $sp4634ba, 'unionpay', $spa3e681, $sp45f07e, $sp873488, $sp5213ee); break; case 'jd': $sp4634ba = '105'; return $this->api_scan($spbe80b7, $sp4634ba, 'jd', $spa3e681, $sp45f07e, $sp873488, $sp5213ee); break; case 'wxwap': if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { $sp4634ba = '3030'; return $this->api_pay_in_app($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee); } else { $sp4634ba = '206'; return $this->api_wap($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee); } break; case 'qqwap': if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MQQBrowser') !== false) { $sp4634ba = '304'; return $this->api_pay_in_app($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee); } else { $sp4634ba = '203'; return $this->api_h5($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee); } break; case 'alipaywap': if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'AlipayClient') !== false) { $sp4634ba = '302'; return $this->api_pay_in_app($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee); } else { $sp4634ba = '205'; return $this->api_h5($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee); } break; default: throw new \Exception('支付渠道错误'); } } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { $sp773cac = $spbe80b7['mch_id']; $spe19aed = $spbe80b7['key']; $spa3e681 = $_POST['out_trade_no']; $sp00f559 = $_POST['trade_state']; $spf2a22c = 'CNY'; $sp9b380a = $_POST['pay_type']; $sp378160 = (int) $_POST['total_amount']; $sp26f1a8 = $_POST['receipt_amount']; $spacb468 = $_POST['sys_trade_no']; $spe02e4c = $_POST['txn_id']; $sp3927f2 = $_POST['device_info']; $sp5b1094 = $_POST['attach']; $sp1ea6f4 = $_POST['time_end']; $spa109d2 = $_POST['sign']; $spe78a33 = sprintf('mch_id=%s&fee_type=%s&pay_type=%s&total_amount=%s&device_info=%s&coupon_amount=%s&key=%s', $sp773cac, $spa3e681, $spf2a22c, $sp9b380a, $sp378160, $sp3927f2, $spe19aed); if ($spa109d2 == md5($spe78a33)) { $sp04f0f8($spa3e681, $sp378160, $spacb468); echo 'success'; return true; } else { echo 'FAIL'; return false; } } else { $spa3e681 = @$spbe80b7['out_trade_no']; if (strlen($spa3e681) < 5) { throw new \Exception('交易单号未传入'); } $spa109d2 = md5('version=1.0&mch_id=' . $spbe80b7['mch_id'] . '&out_trade_no=' . $spa3e681 . '&sys_trade_no=&key=' . $spbe80b7['key']); $sp0e98cb = array('version' => '1.0', 'mch_id' => $spbe80b7['mch_id'], 'out_trade_no' => $spa3e681, 'sys_trade_no' => '', 'sign' => $spa109d2); $sp00a165 = CurlRequest::post('https://pay.jinfupass.com/gateway/query', http_build_query($sp0e98cb)); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['result_code']) || $spb9589c['result_code'] !== '1') { Log::error('Pay.JinfuPass.verify.order Error#1: ' . $sp00a165); throw new \Exception('获取付款信息超时, 请刷新重试'); } if ($spb9589c['trade_state'] === '1') { $sp04f0f8($spb9589c['out_trade_no'], (int) $spb9589c['total_amount'], $spb9589c['sys_trade_no']); return true; } return false; } } private function api_scan($spbe80b7, $sp4634ba, $sp28fede, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp773cac = $spbe80b7['mch_id']; $sp1ed429 = $spbe80b7['key']; $sp8f72d3 = $this->url_notify; $spe78a33 = sprintf("version=1.0&mch_id={$sp773cac}&pay_type={$sp4634ba}&total_amount={$sp5213ee}&out_trade_no={$spa3e681}¬ify_url={$sp8f72d3}&key={$sp1ed429}"); $spa109d2 = md5($spe78a33); $sp5aa598 = array('version' => '1.0', 'mch_id' => $sp773cac, 'pay_type' => $sp4634ba, 'fee_type' => 'CNY', 'total_amount' => $sp5213ee, 'out_trade_no' => $spa3e681, 'device_info' => date('YmdHis'), 'notify_url' => $sp8f72d3, 'body' => $sp45f07e, 'attach' => '', 'time_start' => '', 'time_expire' => '', 'limit_credit_pay' => '0', 'hb_fq_num' => '', 'hb_fq_percent' => '', 'sign' => $spa109d2); $sp0e98cb = $sp5aa598; $sp00a165 = CurlRequest::post('http://pay.jinfupass.com/gateway/pay', http_build_query($sp0e98cb)); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['result_code']) || $spb9589c['result_code'] !== '1') { Log::error('Pay.JinfuPass.api_scan Error#1: ' . $sp00a165); throw new \Exception('获取付款信息超时, 请刷新重试'); } if (empty($spb9589c['code_url'])) { Log::error('Pay.JinfuPass.api_scan Error#2: ' . $sp00a165); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } header('location: /qrcode/pay/' . $spa3e681 . '/' . strtolower($sp28fede) . '?url=' . urlencode($spb9589c['code_url'])); die; } private function api_pay_in_app($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp773cac = $spbe80b7['mch_id']; $sp1ed429 = $spbe80b7['key']; $sp8f72d3 = $this->url_notify; $spe78a33 = sprintf("version=1.0&mch_id={$sp773cac}&pay_type={$sp4634ba}&total_amount={$sp5213ee}&out_trade_no={$spa3e681}¬ify_url={$sp8f72d3}&key={$sp1ed429}"); $spa109d2 = md5($spe78a33); die('
+namespace App\Library\Pay\JinfuPass; use App\Library\CurlRequest; use App\Library\Helper; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['mch_id'])) { throw new \Exception('请填写商户号 mch_id'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请填写key'); } $spf9ca0c = $sp9d4382['payway']; $this->url_return .= '/' . $sp2e47fc; switch ($spf9ca0c) { case 'wx': $spd26c0a = '102'; return $this->api_scan($sp9d4382, $spd26c0a, 'wechat', $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); break; case 'qq': $spd26c0a = '103'; return $this->api_scan($sp9d4382, $spd26c0a, 'qq', $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); break; case 'alipay': $spd26c0a = '101'; return $this->api_scan($sp9d4382, $spd26c0a, 'aliqr', $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); break; case 'unionpay': $spd26c0a = '104'; return $this->api_scan($sp9d4382, $spd26c0a, 'unionpay', $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); break; case 'jd': $spd26c0a = '105'; return $this->api_scan($sp9d4382, $spd26c0a, 'jd', $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); break; case 'wxwap': if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { $spd26c0a = '3030'; return $this->api_pay_in_app($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); } else { $spd26c0a = '206'; return $this->api_wap($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); } break; case 'qqwap': if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MQQBrowser') !== false) { $spd26c0a = '304'; return $this->api_pay_in_app($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); } else { $spd26c0a = '203'; return $this->api_h5($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); } break; case 'alipaywap': if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'AlipayClient') !== false) { $spd26c0a = '302'; return $this->api_pay_in_app($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); } else { $spd26c0a = '205'; return $this->api_h5($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7); } break; default: throw new \Exception('支付渠道错误'); } } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { $spaac434 = $sp9d4382['mch_id']; $sp08ccfa = $sp9d4382['key']; $sp2e47fc = $_POST['out_trade_no']; $spbc414e = $_POST['trade_state']; $spa809c7 = 'CNY'; $sp73afba = $_POST['pay_type']; $spfcbd75 = (int) $_POST['total_amount']; $sp3dd39c = $_POST['receipt_amount']; $spaa1aea = $_POST['sys_trade_no']; $sp41f42a = $_POST['txn_id']; $spc3064a = $_POST['device_info']; $spf83ede = $_POST['attach']; $sp25ec17 = $_POST['time_end']; $sp964415 = $_POST['sign']; $spa9bc6a = sprintf('mch_id=%s&fee_type=%s&pay_type=%s&total_amount=%s&device_info=%s&coupon_amount=%s&key=%s', $spaac434, $sp2e47fc, $spa809c7, $sp73afba, $spfcbd75, $spc3064a, $sp08ccfa); if ($sp964415 == md5($spa9bc6a)) { $sp9a4d97($sp2e47fc, $spfcbd75, $spaa1aea); echo 'success'; return true; } else { echo 'FAIL'; return false; } } else { $sp2e47fc = @$sp9d4382['out_trade_no']; if (strlen($sp2e47fc) < 5) { throw new \Exception('交易单号未传入'); } $sp964415 = md5('version=1.0&mch_id=' . $sp9d4382['mch_id'] . '&out_trade_no=' . $sp2e47fc . '&sys_trade_no=&key=' . $sp9d4382['key']); $spe25017 = array('version' => '1.0', 'mch_id' => $sp9d4382['mch_id'], 'out_trade_no' => $sp2e47fc, 'sys_trade_no' => '', 'sign' => $sp964415); $sp42422c = CurlRequest::post('https://pay.jinfupass.com/gateway/query', http_build_query($spe25017)); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['result_code']) || $sp9b52fe['result_code'] !== '1') { Log::error('Pay.JinfuPass.verify.order Error#1: ' . $sp42422c); throw new \Exception('获取付款信息超时, 请刷新重试'); } if ($sp9b52fe['trade_state'] === '1') { $sp9a4d97($sp9b52fe['out_trade_no'], (int) $sp9b52fe['total_amount'], $sp9b52fe['sys_trade_no']); return true; } return false; } } private function api_scan($sp9d4382, $spd26c0a, $spabdeda, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spaac434 = $sp9d4382['mch_id']; $spf1241f = $sp9d4382['key']; $sp400d9a = $this->url_notify; $spa9bc6a = sprintf("version=1.0&mch_id={$spaac434}&pay_type={$spd26c0a}&total_amount={$sp076ec7}&out_trade_no={$sp2e47fc}¬ify_url={$sp400d9a}&key={$spf1241f}"); $sp964415 = md5($spa9bc6a); $sp6fd648 = array('version' => '1.0', 'mch_id' => $spaac434, 'pay_type' => $spd26c0a, 'fee_type' => 'CNY', 'total_amount' => $sp076ec7, 'out_trade_no' => $sp2e47fc, 'device_info' => date('YmdHis'), 'notify_url' => $sp400d9a, 'body' => $spd4e90d, 'attach' => '', 'time_start' => '', 'time_expire' => '', 'limit_credit_pay' => '0', 'hb_fq_num' => '', 'hb_fq_percent' => '', 'sign' => $sp964415); $spe25017 = $sp6fd648; $sp42422c = CurlRequest::post('http://pay.jinfupass.com/gateway/pay', http_build_query($spe25017)); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['result_code']) || $sp9b52fe['result_code'] !== '1') { Log::error('Pay.JinfuPass.api_scan Error#1: ' . $sp42422c); throw new \Exception('获取付款信息超时, 请刷新重试'); } if (empty($sp9b52fe['code_url'])) { Log::error('Pay.JinfuPass.api_scan Error#2: ' . $sp42422c); throw new \Exception('获取付款信息失败, 请联系客服反馈'); } header('location: /qrcode/pay/' . $sp2e47fc . '/' . strtolower($spabdeda) . '?url=' . urlencode($sp9b52fe['code_url'])); die; } private function api_pay_in_app($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spaac434 = $sp9d4382['mch_id']; $spf1241f = $sp9d4382['key']; $sp400d9a = $this->url_notify; $spa9bc6a = sprintf("version=1.0&mch_id={$spaac434}&pay_type={$spd26c0a}&total_amount={$sp076ec7}&out_trade_no={$sp2e47fc}¬ify_url={$sp400d9a}&key={$spf1241f}"); $sp964415 = md5($spa9bc6a); die('
@@ -9,20 +9,20 @@
- '); } private function api_h5($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp773cac = $spbe80b7['mch_id']; $sp1ed429 = $spbe80b7['key']; $sp8f72d3 = $this->url_notify; $spe78a33 = sprintf("version=1.0&mch_id={$sp773cac}&pay_type={$sp4634ba}&total_amount={$sp5213ee}&out_trade_no={$spa3e681}¬ify_url={$sp8f72d3}&key={$sp1ed429}"); $spa109d2 = md5($spe78a33); die('
+ '); } private function api_h5($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spaac434 = $sp9d4382['mch_id']; $spf1241f = $sp9d4382['key']; $sp400d9a = $this->url_notify; $spa9bc6a = sprintf("version=1.0&mch_id={$spaac434}&pay_type={$spd26c0a}&total_amount={$sp076ec7}&out_trade_no={$sp2e47fc}¬ify_url={$sp400d9a}&key={$spf1241f}"); $sp964415 = md5($spa9bc6a); die('
@@ -32,20 +32,20 @@
- '); } private function api_wap($spbe80b7, $sp4634ba, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp773cac = $spbe80b7['mch_id']; $sp1ed429 = $spbe80b7['key']; $sp8f72d3 = $this->url_notify; $spe78a33 = sprintf("version=1.0&mch_id={$sp773cac}&pay_type={$sp4634ba}&total_amount={$sp5213ee}&out_trade_no={$spa3e681}¬ify_url={$sp8f72d3}&key={$sp1ed429}"); $spa109d2 = md5($spe78a33); $sp501a23 = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}"; die('
+ '); } private function api_wap($sp9d4382, $spd26c0a, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spaac434 = $sp9d4382['mch_id']; $spf1241f = $sp9d4382['key']; $sp400d9a = $this->url_notify; $spa9bc6a = sprintf("version=1.0&mch_id={$spaac434}&pay_type={$spd26c0a}&total_amount={$sp076ec7}&out_trade_no={$sp2e47fc}¬ify_url={$sp400d9a}&key={$spf1241f}"); $sp964415 = md5($spa9bc6a); $spa9e20d = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}"; die('
@@ -55,19 +55,19 @@
'); } }
\ No newline at end of file
diff --git a/app/Library/Pay/Meeol/Api.php b/app/Library/Pay/Meeol/Api.php
index cb26cfcc8..a03bac56a 100644
--- a/app/Library/Pay/Meeol/Api.php
+++ b/app/Library/Pay/Meeol/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp9624ba = sprintf('%.2f', $sp5213ee / 100); if (!isset($spbe80b7['appId'])) { throw new \Exception('请设置appId'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请设置key'); } $spdc9a36 = $spbe80b7['payway']; $spe28521 = array('amount' => $sp9624ba, 'appId' => $spbe80b7['appId'], 'orderId' => $spa3e681, 'random' => md5(random_bytes(16)), 'tradeType' => $spdc9a36); $spe28521['sign'] = strtoupper(md5('amount=' . $spe28521['amount'] . '&appId=' . $spbe80b7['appId'] . '&key=' . $spbe80b7['key'] . '&orderId=' . $spe28521['orderId'] . '&random=' . $spe28521['random'] . '&tradeType=' . $spe28521['tradeType'])); $sp00a165 = CurlRequest::post('http://api.meeol.cn/rest/mall/payment/order', json_encode($spe28521)); $spb9589c = json_decode($sp00a165, true); if (!isset($spb9589c['status']) || $spb9589c['status'] !== '0') { Log::error('Pay.Meeol.goPay.order Error: ' . $sp00a165); throw new \Exception('支付请求失败, 请刷新重试'); } if (substr($spdc9a36, 0, 1) === 'W') { header('Location: /qrcode/pay/' . $spa3e681 . '/wechat?url=' . urlencode($spb9589c['qrcode'])); } elseif (substr($spdc9a36, 0, 1) === 'A') { header('Location: /qrcode/pay/' . $spa3e681 . '/aliqr?url=' . urlencode($spb9589c['qrcode'])); } die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { $sp8e4af8 = json_decode(file_get_contents('php://input'), true); $spa109d2 = strtoupper(md5('amount=' . $sp8e4af8['amount'] . '&appid=' . $sp8e4af8['appid'] . '&key=' . $spbe80b7['key'] . '&orderId=' . $sp8e4af8['orderId'] . '&tradeTime=' . $sp8e4af8['tradeTime'] . '&tradeType=' . $sp8e4af8['tradeType'])); if ($spa109d2 === $sp8e4af8['sign']) { $sp9624ba = (int) round($sp8e4af8['amount'] * 100); $sp04f0f8($sp8e4af8['orderId'], $sp9624ba, $sp8e4af8['passTradeNo']); echo 'success'; return true; } else { Log::error('Pay.Meeol.verify notify sign error, post: ' . file_get_contents('php://input')); echo 'error'; } } else { if (!empty($spbe80b7['out_trade_no'])) { $spe28521 = array('appId' => $spbe80b7['appId'], 'orderId' => $spbe80b7['out_trade_no'], 'random' => md5(random_bytes(16))); $spe28521['sign'] = strtoupper(md5('appId=' . $spbe80b7['appId'] . '&key=' . $spbe80b7['key'] . '&orderId=' . $spe28521['orderId'] . '&random=' . $spe28521['random'])); $spe28521 = json_encode($spe28521); $sp00a165 = CurlRequest::post('http://api.meeol.cn/rest/mall/payment/query', $spe28521); $spb9589c = json_decode($sp00a165, true); if (!isset($spb9589c['status'])) { Log::error('Pay.Meeol.verify Error: ' . $sp00a165); } if ($spb9589c['status'] === '0') { $sp9624ba = (int) round($spb9589c['amount'] * 100); $sp04f0f8($spb9589c['orderId'], $sp9624ba, $spb9589c['passTradeNo']); return true; } Log::debug('Pay.Meeol.verify debug, req:' . $spe28521 . 'ret:' . $sp00a165); return false; } else { throw new \Exception('请传递订单编号'); } } return false; } }
\ No newline at end of file
+namespace App\Library\Pay\Meeol; use App\Library\CurlRequest; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spc686cf = sprintf('%.2f', $sp076ec7 / 100); if (!isset($sp9d4382['appId'])) { throw new \Exception('请设置appId'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请设置key'); } $spf9ca0c = $sp9d4382['payway']; $sp8d5928 = array('amount' => $spc686cf, 'appId' => $sp9d4382['appId'], 'orderId' => $sp2e47fc, 'random' => md5(random_bytes(16)), 'tradeType' => $spf9ca0c); $sp8d5928['sign'] = strtoupper(md5('amount=' . $sp8d5928['amount'] . '&appId=' . $sp9d4382['appId'] . '&key=' . $sp9d4382['key'] . '&orderId=' . $sp8d5928['orderId'] . '&random=' . $sp8d5928['random'] . '&tradeType=' . $sp8d5928['tradeType'])); $sp42422c = CurlRequest::post('http://api.meeol.cn/rest/mall/payment/order', json_encode($sp8d5928)); $sp9b52fe = json_decode($sp42422c, true); if (!isset($sp9b52fe['status']) || $sp9b52fe['status'] !== '0') { Log::error('Pay.Meeol.goPay.order Error: ' . $sp42422c); throw new \Exception('支付请求失败, 请刷新重试'); } if (substr($spf9ca0c, 0, 1) === 'W') { header('Location: /qrcode/pay/' . $sp2e47fc . '/wechat?url=' . urlencode($sp9b52fe['qrcode'])); } elseif (substr($spf9ca0c, 0, 1) === 'A') { header('Location: /qrcode/pay/' . $sp2e47fc . '/aliqr?url=' . urlencode($sp9b52fe['qrcode'])); } die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { $spe5cbac = json_decode(file_get_contents('php://input'), true); $sp964415 = strtoupper(md5('amount=' . $spe5cbac['amount'] . '&appid=' . $spe5cbac['appid'] . '&key=' . $sp9d4382['key'] . '&orderId=' . $spe5cbac['orderId'] . '&tradeTime=' . $spe5cbac['tradeTime'] . '&tradeType=' . $spe5cbac['tradeType'])); if ($sp964415 === $spe5cbac['sign']) { $spc686cf = (int) round($spe5cbac['amount'] * 100); $sp9a4d97($spe5cbac['orderId'], $spc686cf, $spe5cbac['passTradeNo']); echo 'success'; return true; } else { Log::error('Pay.Meeol.verify notify sign error, post: ' . file_get_contents('php://input')); echo 'error'; } } else { if (!empty($sp9d4382['out_trade_no'])) { $sp8d5928 = array('appId' => $sp9d4382['appId'], 'orderId' => $sp9d4382['out_trade_no'], 'random' => md5(random_bytes(16))); $sp8d5928['sign'] = strtoupper(md5('appId=' . $sp9d4382['appId'] . '&key=' . $sp9d4382['key'] . '&orderId=' . $sp8d5928['orderId'] . '&random=' . $sp8d5928['random'])); $sp8d5928 = json_encode($sp8d5928); $sp42422c = CurlRequest::post('http://api.meeol.cn/rest/mall/payment/query', $sp8d5928); $sp9b52fe = json_decode($sp42422c, true); if (!isset($sp9b52fe['status'])) { Log::error('Pay.Meeol.verify Error: ' . $sp42422c); } if ($sp9b52fe['status'] === '0') { $spc686cf = (int) round($sp9b52fe['amount'] * 100); $sp9a4d97($sp9b52fe['orderId'], $spc686cf, $sp9b52fe['passTradeNo']); return true; } Log::debug('Pay.Meeol.verify debug, req:' . $sp8d5928 . 'ret:' . $sp42422c); return false; } else { throw new \Exception('请传递订单编号'); } } return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/MoTonePay/Api.php b/app/Library/Pay/MoTonePay/Api.php
index 92864ffdf..f653d7946 100644
--- a/app/Library/Pay/MoTonePay/Api.php
+++ b/app/Library/Pay/MoTonePay/Api.php
@@ -1,5 +1,5 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp9624ba = sprintf('%.2f', $sp5213ee / 100); $sp631694 = '1.0'; $spa216ff = $spbe80b7['payway']; $spcd67c1 = '0'; $spa109d2 = md5('version=' . $sp631694 . '&customerid=' . $spbe80b7['id'] . '&total_fee=' . $sp9624ba . '&sdorderno=' . $spa3e681 . '¬ifyurl=' . $this->url_notify . '&returnurl=' . $this->url_return . '&' . $spbe80b7['key']); ?>
+namespace App\Library\Pay\MoTonePay; use App\Library\Pay\ApiInterface; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spc686cf = sprintf('%.2f', $sp076ec7 / 100); $sp4d0456 = '1.0'; $sp64758d = $sp9d4382['payway']; $sp67f8ec = '0'; $sp964415 = md5('version=' . $sp4d0456 . '&customerid=' . $sp9d4382['id'] . '&total_fee=' . $spc686cf . '&sdorderno=' . $sp2e47fc . '¬ifyurl=' . $this->url_notify . '&returnurl=' . $this->url_return . '&' . $sp9d4382['key']); ?>
@@ -8,25 +8,25 @@
- url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['app_secret'])) { throw new \Exception('请填写[app_secret] (后台应用密钥)'); } $this->url_return .= '/' . $spa3e681; $spa26894 = array('merchant_order_id' => $spa3e681, 'price_amount' => sprintf('%.2f', $sp5213ee / 100), 'price_currency' => 'CNY', 'pay_currency' => $spbe80b7['payway'] !== 'COIN' ? $spbe80b7['payway'] : '', 'title' => $sp45f07e, 'description' => $sp873488, 'callback_url' => $this->url_notify, 'cancel_url' => $this->url_return, 'success_url' => $this->url_return, 'token' => md5($spbe80b7['app_secret'] . $spa3e681 . config('app.key'))); $sp00a165 = CurlRequest::post('https://api.mugglepay.com/v1/orders', json_encode($spa26894), array('Content-Type' => 'application/json', 'token' => $spbe80b7['app_secret'])); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['status']) || $spb9589c['status'] !== 201) { Log::error('Pay.MugglePay.goPay.order, request failed', array('response' => $sp00a165)); throw new \Exception('获取付款信息超时, 请刷新重试'); } \App\Order::whereOrderNo($spa3e681)->update(array('pay_trade_no' => $spb9589c['order']['order_id'])); header('Location: ' . $spb9589c['payment_url']); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if ($sp3bce01) { if (!isset($_POST['merchant_order_id']) || !isset($_POST['token'])) { Log::error('Pay.MugglePay.verify, request invalid', array('$_POST' => $_POST)); echo json_encode(array('status' => 400)); return false; } $spa3e681 = $_POST['merchant_order_id']; if ($_POST['token'] !== md5($spbe80b7['app_secret'] . $spa3e681 . config('app.key'))) { Log::error('Pay.MugglePay.verify, token illegal', array('$_POST' => $_POST)); echo json_encode(array('status' => 403)); return false; } if ($_POST['pay_currency'] !== 'CNY') { Log::error('Pay.MugglePay.verify, currency illegal', array('$_POST' => $_POST)); echo json_encode(array('status' => 415)); return false; } if ($_POST['status'] === 'PAID') { $spd63ffb = $_POST['order_id']; $sp0201cf = (int) round($_POST['pay_amount'] * 100); $sp04f0f8($spa3e681, $sp0201cf, $spd63ffb); echo json_encode(array('status' => 200)); return true; } else { Log::error('Pay.MugglePay.verify, status illegal', array('$_POST' => $_POST)); } echo json_encode(array('status' => 406)); return false; } else { $spa3e681 = @$spbe80b7['out_trade_no']; if (strlen($spa3e681) < 5) { throw new \Exception('交易单号未传入'); } $spd63ffb = \App\Order::whereOrderNo($spa3e681)->firstOrFail()->pay_trade_no; $sp00a165 = CurlRequest::get('https://api.mugglepay.com/v1/orders/' . $spd63ffb, array('token' => $spbe80b7['app_secret'])); $spb9589c = @json_decode($sp00a165, true); if (!$spb9589c || !isset($spb9589c['status'])) { Log::error('Pay.MugglePay.verify, request failed', array('response' => $sp00a165)); return false; } if ($spb9589c['order']['pay_currency'] === 'CNY') { if ($spb9589c['order']['status'] === 'PAID') { $spd63ffb = $spb9589c['order']['order_id']; $sp0201cf = (int) round($spb9589c['order']['pay_amount'] * 100); $sp04f0f8($spa3e681, $sp0201cf, $spd63ffb); return true; } else { Log::error('Pay.MugglePay.verify, status illegal', array('response' => $sp00a165)); } } else { Log::error('Pay.MugglePay.verify, currency illegal', array('response' => $sp00a165)); } return false; } } }
\ No newline at end of file
+namespace App\Library\Pay\MugglePay; use App\Library\CurlRequest; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['app_secret'])) { throw new \Exception('请填写[app_secret] (后台应用密钥)'); } $this->url_return .= '/' . $sp2e47fc; $spc0e525 = array('merchant_order_id' => $sp2e47fc, 'price_amount' => sprintf('%.2f', $sp076ec7 / 100), 'price_currency' => 'CNY', 'pay_currency' => $sp9d4382['payway'] !== 'COIN' ? $sp9d4382['payway'] : '', 'title' => $spd4e90d, 'description' => $spd0789a, 'callback_url' => $this->url_notify, 'cancel_url' => $this->url_return, 'success_url' => $this->url_return, 'token' => md5($sp9d4382['app_secret'] . $sp2e47fc . config('app.key'))); $sp42422c = CurlRequest::post('https://api.mugglepay.com/v1/orders', json_encode($spc0e525), array('Content-Type' => 'application/json', 'token' => $sp9d4382['app_secret'])); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['status']) || $sp9b52fe['status'] !== 201) { Log::error('Pay.MugglePay.goPay.order, request failed', array('response' => $sp42422c)); throw new \Exception('获取付款信息超时, 请刷新重试'); } \App\Order::whereOrderNo($sp2e47fc)->update(array('pay_trade_no' => $sp9b52fe['order']['order_id'])); header('Location: ' . $sp9b52fe['payment_url']); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if ($sp7b2182) { if (!isset($_POST['merchant_order_id']) || !isset($_POST['token'])) { Log::error('Pay.MugglePay.verify, request invalid', array('$_POST' => $_POST)); echo json_encode(array('status' => 400)); return false; } $sp2e47fc = $_POST['merchant_order_id']; if ($_POST['token'] !== md5($sp9d4382['app_secret'] . $sp2e47fc . config('app.key'))) { Log::error('Pay.MugglePay.verify, token illegal', array('$_POST' => $_POST)); echo json_encode(array('status' => 403)); return false; } if ($_POST['pay_currency'] !== 'CNY') { Log::error('Pay.MugglePay.verify, currency illegal', array('$_POST' => $_POST)); echo json_encode(array('status' => 415)); return false; } if ($_POST['status'] === 'PAID') { $spca4fc7 = $_POST['order_id']; $spa7b5ad = (int) round($_POST['pay_amount'] * 100); $sp9a4d97($sp2e47fc, $spa7b5ad, $spca4fc7); echo json_encode(array('status' => 200)); return true; } else { Log::error('Pay.MugglePay.verify, status illegal', array('$_POST' => $_POST)); } echo json_encode(array('status' => 406)); return false; } else { $sp2e47fc = @$sp9d4382['out_trade_no']; if (strlen($sp2e47fc) < 5) { throw new \Exception('交易单号未传入'); } $spca4fc7 = \App\Order::whereOrderNo($sp2e47fc)->firstOrFail()->pay_trade_no; $sp42422c = CurlRequest::get('https://api.mugglepay.com/v1/orders/' . $spca4fc7, array('token' => $sp9d4382['app_secret'])); $sp9b52fe = @json_decode($sp42422c, true); if (!$sp9b52fe || !isset($sp9b52fe['status'])) { Log::error('Pay.MugglePay.verify, request failed', array('response' => $sp42422c)); return false; } if ($sp9b52fe['order']['pay_currency'] === 'CNY') { if ($sp9b52fe['order']['status'] === 'PAID') { $spca4fc7 = $sp9b52fe['order']['order_id']; $spa7b5ad = (int) round($sp9b52fe['order']['pay_amount'] * 100); $sp9a4d97($sp2e47fc, $spa7b5ad, $spca4fc7); return true; } else { Log::error('Pay.MugglePay.verify, status illegal', array('response' => $sp42422c)); } } else { Log::error('Pay.MugglePay.verify, currency illegal', array('response' => $sp42422c)); } return false; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/Pay.php b/app/Library/Pay/Pay.php
index 9391d743f..79f917f1f 100644
--- a/app/Library/Pay/Pay.php
+++ b/app/Library/Pay/Pay.php
@@ -1,2 +1,2 @@
driver = static::getDriver($spdc9a36->id, $spdc9a36->driver); $spbe80b7 = json_decode($spdc9a36->config, true); $spbe80b7['payway'] = $spdc9a36->way; $this->driver->goPay($spbe80b7, $sp7c88f3, $sp45f07e, $sp873488, $sp429fcc); return true; } public static function getDriver($sp15a8b5, $sp33ee9e) { $sp892626 = 'App\\Library\\Pay\\' . ucfirst($sp33ee9e) . '\\Api'; if (!class_exists($sp892626)) { throw new \Exception('支付驱动未找到'); } return new $sp892626($sp15a8b5); } }
\ No newline at end of file
+namespace App\Library\Pay; class Pay { private $driver = null; public function goPay($spf9ca0c, $sp845b45, $spd4e90d, $spd0789a, $spf59c91) { $this->driver = static::getDriver($spf9ca0c->id, $spf9ca0c->driver); $sp9d4382 = json_decode($spf9ca0c->config, true); $sp9d4382['payway'] = $spf9ca0c->way; $this->driver->goPay($sp9d4382, $sp845b45, $spd4e90d, $spd0789a, $spf59c91); return true; } public static function getDriver($spc035b6, $spd1dcf7) { $spbc523d = 'App\\Library\\Pay\\' . ucfirst($spd1dcf7) . '\\Api'; if (!class_exists($spbc523d)) { throw new \Exception('支付驱动未找到'); } return new $spbc523d($spc035b6); } }
\ No newline at end of file
diff --git a/app/Library/Pay/PayPal/Api.php b/app/Library/Pay/PayPal/Api.php
index be9234386..3e96cf2f8 100644
--- a/app/Library/Pay/PayPal/Api.php
+++ b/app/Library/Pay/PayPal/Api.php
@@ -1,5 +1,5 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; $this->pay_id = $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp0b8280 = self::getUsd($sp5213ee); $sp429fcc = sprintf('%.2f', $sp0b8280 / 100); \App\Order::where('order_no', $spa3e681)->update(array('pay_trade_no' => $sp429fcc)); if (!isset($spbe80b7['business'])) { throw new \Exception('请填写 business (商家邮箱)'); } die('
+namespace App\Library\Pay\PayPal; use App\Library\CurlRequest; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; private $pay_id; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; $this->pay_id = $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spea10b9 = self::getUsd($sp076ec7); $spf59c91 = sprintf('%.2f', $spea10b9 / 100); \App\Order::where('order_no', $sp2e47fc)->update(array('pay_trade_no' => $spf59c91)); if (!isset($sp9d4382['business'])) { throw new \Exception('请填写 business (商家邮箱)'); } die('
@@ -9,11 +9,11 @@
- '); } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; if (!$sp3bce01 && @(!isset($_POST['business']))) { return false; } $sp093e69 = file_get_contents('php://input'); $spbb525b = explode('&', $sp093e69); $sp2cd174 = array(); foreach ($spbb525b as $sp687d3e) { $sp687d3e = explode('=', $sp687d3e); if (count($sp687d3e) == 2) { $sp2cd174[$sp687d3e[0]] = urldecode($sp687d3e[1]); } } $spe28521 = 'cmd=_notify-validate'; if (function_exists('get_magic_quotes_gpc')) { $spa78d55 = true; } foreach ($sp2cd174 as $sp1ed429 => $spb914e6) { if ($spa78d55 == true && get_magic_quotes_gpc() == 1) { $spb914e6 = urlencode(stripslashes($spb914e6)); } else { $spb914e6 = urlencode($spb914e6); } $spe28521 .= "&{$sp1ed429}={$spb914e6}"; } $sp9b0943 = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr'); curl_setopt($sp9b0943, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($sp9b0943, CURLOPT_POST, 1); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $spe28521); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp9b0943, CURLOPT_FORBID_REUSE, 1); curl_setopt($sp9b0943, CURLOPT_HTTPHEADER, array('Connection: Close')); if (!($sp32d1c7 = curl_exec($sp9b0943))) { Log::error('Pay.PayPal.verify notify fail, Got ' . curl_error($sp9b0943) . ' when processing IPN data'); curl_close($sp9b0943); die; } curl_close($sp9b0943); if (strcmp($sp32d1c7, 'VERIFIED') == 0) { if ($sp3bce01) { echo 'IPN OK'; } $sp7c88f3 = $_POST['item_number']; $sp4c3b05 = $_POST['payment_status']; $sp9883b6 = $_POST['mc_gross']; $sp33d34e = $_POST['mc_currency']; $spe02e4c = $_POST['txn_id']; $spae5f1c = $sp3bce01 ? $_POST['receiver_email'] : $_POST['business']; if ($sp4c3b05 !== 'Completed') { Log::debug('Pay.PayPal.verify fail, order_no:' . $sp7c88f3 . ', Payment status is not Completed, current(' . $sp4c3b05 . ')', array('$_POST' => $_POST)); return false; } if ($sp33d34e !== 'USD') { Log::error('Pay.PayPal.verify fail, order_no:' . $sp7c88f3 . ', Payment currency is not USD, current(' . $sp33d34e . ')', array('$_POST' => $_POST)); return false; } $sp4f4c0d = \App\Order::where('order_no', $sp7c88f3)->firstOrFail(); if ($sp4f4c0d->status === \App\Order::STATUS_PAID || $sp4f4c0d->status === \App\Order::STATUS_SUCCESS) { return true; } if ($sp4f4c0d->pay_trade_no !== $sp9883b6) { Log::error('Pay.PayPal.verify fail, order_no:' . $sp7c88f3 . ', Payment amount error (' . $sp4f4c0d->pay_trade_no . '), current(' . $sp9883b6 . ')', array('$_POST' => $_POST)); } if ($spae5f1c !== $spbe80b7['business']) { Log::error('Pay.PayPal.verify fail, order_no:' . $sp7c88f3 . ', payment account is not yours(' . $spbe80b7['business'] . '), current(' . $spae5f1c . ')', array('$_POST' => $_POST)); return false; } $sp04f0f8($sp7c88f3, $sp4f4c0d->paid, $spe02e4c); return true; } else { if (strcmp($sp32d1c7, 'INVALID') == 0) { if ($sp3bce01) { echo 'IPN OK'; } Log::debug('Pay.PayPal.verify notify fail, IPN INVALID', array('$res' => $sp32d1c7, '$_POST' => $_POST)); } else { Log::debug('Pay.PayPal.verify notify fail, Unknown IPN error', array('$res' => $sp32d1c7, '$_POST' => $_POST)); } } return false; } function getUsd($sp7a741d) { $sp5aa598 = @json_decode(CurlRequest::get('https://m.cmbchina.com/api/rate/getfxrate'), true); if (!isset($sp5aa598['data'])) { throw new \Exception('获取汇率失败'); } $sp324446 = 0.2; foreach ($sp5aa598['data'] as $sp4a9ec3) { if ($sp4a9ec3['ZCcyNbr'] === '美元') { $sp324446 = 100 / $sp4a9ec3['ZRtcOfr']; break; } } return $sp7a741d * $sp324446; } }
\ No newline at end of file
+ '); } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; if (!$sp7b2182 && @(!isset($_POST['business']))) { return false; } $spd89333 = file_get_contents('php://input'); $sp634dd2 = explode('&', $spd89333); $sp49235d = array(); foreach ($sp634dd2 as $spfa4044) { $spfa4044 = explode('=', $spfa4044); if (count($spfa4044) == 2) { $sp49235d[$spfa4044[0]] = urldecode($spfa4044[1]); } } $sp8d5928 = 'cmd=_notify-validate'; if (function_exists('get_magic_quotes_gpc')) { $spff1c09 = true; } foreach ($sp49235d as $spf1241f => $sp8b9401) { if ($spff1c09 == true && get_magic_quotes_gpc() == 1) { $sp8b9401 = urlencode(stripslashes($sp8b9401)); } else { $sp8b9401 = urlencode($sp8b9401); } $sp8d5928 .= "&{$spf1241f}={$sp8b9401}"; } $sp9f83d6 = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr'); curl_setopt($sp9f83d6, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($sp9f83d6, CURLOPT_POST, 1); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $sp8d5928); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp9f83d6, CURLOPT_FORBID_REUSE, 1); curl_setopt($sp9f83d6, CURLOPT_HTTPHEADER, array('Connection: Close')); if (!($spab3a3a = curl_exec($sp9f83d6))) { Log::error('Pay.PayPal.verify notify fail, Got ' . curl_error($sp9f83d6) . ' when processing IPN data'); curl_close($sp9f83d6); die; } curl_close($sp9f83d6); if (strcmp($spab3a3a, 'VERIFIED') == 0) { if ($sp7b2182) { echo 'IPN OK'; } $sp845b45 = $_POST['item_number']; $spb70361 = $_POST['payment_status']; $spf62d13 = $_POST['mc_gross']; $spb79b9f = $_POST['mc_currency']; $sp41f42a = $_POST['txn_id']; $spe826cf = $sp7b2182 ? $_POST['receiver_email'] : $_POST['business']; if ($spb70361 !== 'Completed') { Log::debug('Pay.PayPal.verify fail, order_no:' . $sp845b45 . ', Payment status is not Completed, current(' . $spb70361 . ')', array('$_POST' => $_POST)); return false; } if ($spb79b9f !== 'USD') { Log::error('Pay.PayPal.verify fail, order_no:' . $sp845b45 . ', Payment currency is not USD, current(' . $spb79b9f . ')', array('$_POST' => $_POST)); return false; } $spe0613f = \App\Order::where('order_no', $sp845b45)->firstOrFail(); if ($spe0613f->status === \App\Order::STATUS_PAID || $spe0613f->status === \App\Order::STATUS_SUCCESS) { return true; } if ($spe0613f->pay_trade_no !== $spf62d13) { Log::error('Pay.PayPal.verify fail, order_no:' . $sp845b45 . ', Payment amount error (' . $spe0613f->pay_trade_no . '), current(' . $spf62d13 . ')', array('$_POST' => $_POST)); } if ($spe826cf !== $sp9d4382['business']) { Log::error('Pay.PayPal.verify fail, order_no:' . $sp845b45 . ', payment account is not yours(' . $sp9d4382['business'] . '), current(' . $spe826cf . ')', array('$_POST' => $_POST)); return false; } $sp9a4d97($sp845b45, $spe0613f->paid, $sp41f42a); return true; } else { if (strcmp($spab3a3a, 'INVALID') == 0) { if ($sp7b2182) { echo 'IPN OK'; } Log::debug('Pay.PayPal.verify notify fail, IPN INVALID', array('$res' => $spab3a3a, '$_POST' => $_POST)); } else { Log::debug('Pay.PayPal.verify notify fail, Unknown IPN error', array('$res' => $spab3a3a, '$_POST' => $_POST)); } } return false; } function getUsd($sp33cdce) { $sp6fd648 = @json_decode(CurlRequest::get('https://m.cmbchina.com/api/rate/getfxrate'), true); if (!isset($sp6fd648['data'])) { throw new \Exception('获取汇率失败'); } $sp420f4b = 0.2; foreach ($sp6fd648['data'] as $sp10eb73) { if ($sp10eb73['ZCcyNbr'] === '美元') { $sp420f4b = 100 / $sp10eb73['ZRtcOfr']; break; } } return $sp33cdce * $sp420f4b; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Payjs/Api.php b/app/Library/Pay/Payjs/Api.php
index 7939ad376..b90ee2735 100644
--- a/app/Library/Pay/Payjs/Api.php
+++ b/app/Library/Pay/Payjs/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['mchid'])) { throw new \Exception('请填写mchid'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请填写key'); } $sp48c9c5 = new Payjs($spbe80b7); $spdc9a36 = strtolower($spbe80b7['payway']); $sp5aa598 = array('total_fee' => $sp5213ee, 'out_trade_no' => $spa3e681, 'body' => $spa3e681, 'notify_url' => $this->url_notify, 'callback_url' => SYS_URL . '/pay/result/' . $spa3e681); if ($spdc9a36 === 'native') { $spec03eb = $sp48c9c5->native($sp5aa598); if (@(int) $spec03eb['return_code'] !== 1) { die('支付渠道出错: ' . $spec03eb['msg'] . '
'); } header('location: /qrcode/pay/' . $spa3e681 . '/payjs/' . base64_encode($spec03eb['code_url'])); } elseif ($spdc9a36 === 'cashier') { $spec03eb = $sp48c9c5->cashier($sp5aa598); header('Location: ' . $spec03eb); } else { die('请填写支付方式
'); } echo '正在跳转到支付渠道...正在跳转到支付渠道...
'; die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; $sp48c9c5 = new Payjs($spbe80b7); if ($sp3bce01) { $spbbda25 = $sp48c9c5->checkSign($_POST); echo $spbbda25 ? 'success' : 'fail'; } else { $spbbda25 = false; } if ($spbbda25) { $spa3e681 = $_REQUEST['out_trade_no']; $sp9624ba = $_REQUEST['total_fee']; $spcd94ca = $_REQUEST['payjs_order_id']; $sp04f0f8($spa3e681, $sp9624ba, $spcd94ca); return true; } return false; } }
\ No newline at end of file
+namespace App\Library\Pay\Payjs; use App\Library\Pay\ApiInterface; require_once __DIR__ . '/sdk/Payjs.php'; use Xhat\Payjs\Payjs; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['mchid'])) { throw new \Exception('请填写mchid'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请填写key'); } $sp352639 = new Payjs($sp9d4382); $spf9ca0c = strtolower($sp9d4382['payway']); $sp6fd648 = array('total_fee' => $sp076ec7, 'out_trade_no' => $sp2e47fc, 'body' => $sp2e47fc, 'notify_url' => $this->url_notify, 'callback_url' => SYS_URL . '/pay/result/' . $sp2e47fc); if ($spf9ca0c === 'native') { $sp1da1ef = $sp352639->native($sp6fd648); if (@(int) $sp1da1ef['return_code'] !== 1) { die('支付渠道出错: ' . $sp1da1ef['msg'] . '
'); } header('location: /qrcode/pay/' . $sp2e47fc . '/payjs/' . base64_encode($sp1da1ef['code_url'])); } elseif ($spf9ca0c === 'cashier') { $sp1da1ef = $sp352639->cashier($sp6fd648); header('Location: ' . $sp1da1ef); } else { die('请填写支付方式
'); } echo '正在跳转到支付渠道...正在跳转到支付渠道...
'; die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; $sp352639 = new Payjs($sp9d4382); if ($sp7b2182) { $spb72f32 = $sp352639->checkSign($_POST); echo $spb72f32 ? 'success' : 'fail'; } else { $spb72f32 = false; } if ($spb72f32) { $sp2e47fc = $_REQUEST['out_trade_no']; $spc686cf = $_REQUEST['total_fee']; $spb41935 = $_REQUEST['payjs_order_id']; $sp9a4d97($sp2e47fc, $spc686cf, $spb41935); return true; } return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Payjs/sdk/Payjs.php b/app/Library/Pay/Payjs/sdk/Payjs.php
index 72556fba8..1818ca1d9 100644
--- a/app/Library/Pay/Payjs/sdk/Payjs.php
+++ b/app/Library/Pay/Payjs/sdk/Payjs.php
@@ -1,2 +1,2 @@
mchid = $spbe80b7['mchid']; $this->key = $spbe80b7['key']; $sp45a89e = isset($spbe80b7['api_url']) ? $spbe80b7['api_url'] : 'https://payjs.cn/api/'; $this->api_url_native = $sp45a89e . 'native'; $this->api_url_cashier = $sp45a89e . 'cashier'; $this->api_url_refund = $sp45a89e . 'refund'; $this->api_url_close = $sp45a89e . 'close'; $this->api_url_check = $sp45a89e . 'check'; $this->api_url_user = $sp45a89e . 'user'; $this->api_url_info = $sp45a89e . 'info'; $this->api_url_bank = $sp45a89e . 'bank'; } public function native(array $sp5aa598) { $this->url = $this->api_url_native; return $this->post($sp5aa598); } public function cashier(array $sp5aa598) { $this->url = $this->api_url_cashier; $sp5aa598 = $this->sign($sp5aa598); $sp3db1b2 = $this->url . '?' . http_build_query($sp5aa598); return $sp3db1b2; } public function refund($spcd94ca) { $this->url = $this->api_url_refund; $sp5aa598 = array('payjs_order_id' => $spcd94ca); return $this->post($sp5aa598); } public function close($spcd94ca) { $this->url = $this->api_url_close; $sp5aa598 = array('payjs_order_id' => $spcd94ca); return $this->post($sp5aa598); } public function check($spcd94ca) { $this->url = $this->api_url_check; $sp5aa598 = array('payjs_order_id' => $spcd94ca); return $this->post($sp5aa598); } public function user($sp0b37ee) { $this->url = $this->api_url_user; $sp5aa598 = array('openid' => $sp0b37ee); return $this->post($sp5aa598); } public function info() { $this->url = $this->api_url_info; $sp5aa598 = array(); return $this->post($sp5aa598); } public function bank($sp505b52) { $this->url = $this->api_url_bank; $sp5aa598 = array('bank' => $sp505b52); return $this->post($sp5aa598); } public function notify() { $sp5aa598 = $_POST; if ($this->checkSign($sp5aa598) === true) { return $sp5aa598; } else { return '验签失败'; } } public function sign(array $sp5aa598) { $sp5aa598['mchid'] = $this->mchid; array_filter($sp5aa598); ksort($sp5aa598); $sp5aa598['sign'] = strtoupper(md5(urldecode(http_build_query($sp5aa598) . '&key=' . $this->key))); return $sp5aa598; } public function checkSign($sp5aa598) { $sp2a2c6e = $sp5aa598['sign']; unset($sp5aa598['sign']); array_filter($sp5aa598); ksort($sp5aa598); $spa109d2 = strtoupper(md5(urldecode(http_build_query($sp5aa598) . '&key=' . $this->key))); return $sp2a2c6e == $spa109d2 ? true : false; } private static function curl_post($sp3db1b2, $sp0e98cb = '') { $sp28070b['Accept'] = '*/*'; $sp28070b['Referer'] = $sp3db1b2; $sp28070b['Content-Type'] = 'application/x-www-form-urlencoded'; $sp28070b['User-Agent'] = 'ni shi sha bi ba, yi ge sdk hai you di san fang ku'; $sp263179 = array(); foreach ($sp28070b as $sp0a9b77 => $spf9847c) { $sp263179[] = $sp0a9b77 . ': ' . $spf9847c; } $sp263179[] = 'Expect:'; $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_POST, 1); curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $sp0e98cb); curl_setopt($sp9b0943, CURLOPT_TIMEOUT, 10); curl_setopt($sp9b0943, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9b0943, CURLOPT_HEADER, 1); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($sp9b0943, CURLOPT_HTTPHEADER, $sp263179); $sp3ac4e3 = curl_exec($sp9b0943); $sp70c798 = curl_getinfo($sp9b0943, CURLINFO_HEADER_SIZE); $sp873488 = substr($sp3ac4e3, $sp70c798); curl_close($sp9b0943); return $sp873488; } public function post($sp5aa598) { $sp5aa598 = $this->sign($sp5aa598); return json_decode(self::curl_post($this->url, http_build_query($sp5aa598)), true); } }
\ No newline at end of file
+namespace Xhat\Payjs; class Payjs { private $mchid; private $key; private $api_url_native; private $api_url_cashier; private $api_url_refund; private $api_url_close; private $api_url_check; private $api_url_user; private $api_url_info; private $api_url_bank; public function __construct($sp9d4382 = null) { if (!$sp9d4382) { die('config needed'); } $this->mchid = $sp9d4382['mchid']; $this->key = $sp9d4382['key']; $spd839cb = isset($sp9d4382['api_url']) ? $sp9d4382['api_url'] : 'https://payjs.cn/api/'; $this->api_url_native = $spd839cb . 'native'; $this->api_url_cashier = $spd839cb . 'cashier'; $this->api_url_refund = $spd839cb . 'refund'; $this->api_url_close = $spd839cb . 'close'; $this->api_url_check = $spd839cb . 'check'; $this->api_url_user = $spd839cb . 'user'; $this->api_url_info = $spd839cb . 'info'; $this->api_url_bank = $spd839cb . 'bank'; } public function native(array $sp6fd648) { $this->url = $this->api_url_native; return $this->post($sp6fd648); } public function cashier(array $sp6fd648) { $this->url = $this->api_url_cashier; $sp6fd648 = $this->sign($sp6fd648); $spd2457c = $this->url . '?' . http_build_query($sp6fd648); return $spd2457c; } public function refund($spb41935) { $this->url = $this->api_url_refund; $sp6fd648 = array('payjs_order_id' => $spb41935); return $this->post($sp6fd648); } public function close($spb41935) { $this->url = $this->api_url_close; $sp6fd648 = array('payjs_order_id' => $spb41935); return $this->post($sp6fd648); } public function check($spb41935) { $this->url = $this->api_url_check; $sp6fd648 = array('payjs_order_id' => $spb41935); return $this->post($sp6fd648); } public function user($sp549d4c) { $this->url = $this->api_url_user; $sp6fd648 = array('openid' => $sp549d4c); return $this->post($sp6fd648); } public function info() { $this->url = $this->api_url_info; $sp6fd648 = array(); return $this->post($sp6fd648); } public function bank($sp34e4b5) { $this->url = $this->api_url_bank; $sp6fd648 = array('bank' => $sp34e4b5); return $this->post($sp6fd648); } public function notify() { $sp6fd648 = $_POST; if ($this->checkSign($sp6fd648) === true) { return $sp6fd648; } else { return '验签失败'; } } public function sign(array $sp6fd648) { $sp6fd648['mchid'] = $this->mchid; array_filter($sp6fd648); ksort($sp6fd648); $sp6fd648['sign'] = strtoupper(md5(urldecode(http_build_query($sp6fd648) . '&key=' . $this->key))); return $sp6fd648; } public function checkSign($sp6fd648) { $spf65d7c = $sp6fd648['sign']; unset($sp6fd648['sign']); array_filter($sp6fd648); ksort($sp6fd648); $sp964415 = strtoupper(md5(urldecode(http_build_query($sp6fd648) . '&key=' . $this->key))); return $spf65d7c == $sp964415 ? true : false; } private static function curl_post($spd2457c, $spe25017 = '') { $spc69671['Accept'] = '*/*'; $spc69671['Referer'] = $spd2457c; $spc69671['Content-Type'] = 'application/x-www-form-urlencoded'; $spc69671['User-Agent'] = 'ni shi sha bi ba, yi ge sdk hai you di san fang ku'; $sp3db035 = array(); foreach ($spc69671 as $sp517f03 => $sp438dc5) { $sp3db035[] = $sp517f03 . ': ' . $sp438dc5; } $sp3db035[] = 'Expect:'; $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_POST, 1); curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $spe25017); curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, 10); curl_setopt($sp9f83d6, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, 1); curl_setopt($sp9f83d6, CURLOPT_HEADER, 1); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($sp9f83d6, CURLOPT_HTTPHEADER, $sp3db035); $spdc5091 = curl_exec($sp9f83d6); $sp4c5a1f = curl_getinfo($sp9f83d6, CURLINFO_HEADER_SIZE); $spd0789a = substr($spdc5091, $sp4c5a1f); curl_close($sp9f83d6); return $spd0789a; } public function post($sp6fd648) { $sp6fd648 = $this->sign($sp6fd648); return json_decode(self::curl_post($this->url, http_build_query($sp6fd648)), true); } }
\ No newline at end of file
diff --git a/app/Library/Pay/QPay/Api.php b/app/Library/Pay/QPay/Api.php
index c99ddc28b..d15e5cb75 100644
--- a/app/Library/Pay/QPay/Api.php
+++ b/app/Library/Pay/QPay/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['mch_id']) || !isset($spbe80b7['mch_key'])) { throw new \Exception('请设置 mch_id 和 mch_key'); } $spa26894 = array('out_trade_no' => $spa3e681, 'body' => $sp45f07e, 'device_info' => 'qq_19060', 'fee_type' => 'CNY', 'notify_url' => $this->url_notify, 'spbill_create_ip' => Helper::getIP(), 'total_fee' => $sp5213ee, 'trade_type' => 'NATIVE'); $sp2e3a1b = new \QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi', null, 10); $spf089a0 = $sp2e3a1b->req($spa26894, $spbe80b7); $spbbda25 = \QpayMchUtil::xmlToArray($spf089a0); if (!isset($spbbda25['code_url'])) { Log::error('Pay.QPay.goPay, order_no:' . $spa3e681 . ', error:' . json_encode($spbbda25)); if (isset($spbbda25['err_code_des'])) { throw new \Exception($spbbda25['err_code_des']); } if (isset($spbbda25['return_msg'])) { throw new \Exception($spbbda25['return_msg']); } throw new \Exception('获取支付数据失败'); } header('location: /qrcode/pay/' . $spa3e681 . '/qq?url=' . urlencode($spbbda25['code_url'])); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; $sp2e3a1b = new \QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi', null, 10); if ($sp3bce01) { $spa26894 = $sp2e3a1b->notify_params(); if (!$sp2e3a1b->notify_verify($spa26894, $spbe80b7)) { echo 'FAIL'; return false; } call_user_func_array($sp04f0f8, array($spa26894['out_trade_no'], $spa26894['total_fee'], $spa26894['transaction_id'])); echo 'SUCCESS'; return true; } else { $spa3e681 = @$spbe80b7['out_trade_no']; $spa26894 = array('out_trade_no' => $spa3e681); $spf089a0 = $sp2e3a1b->req($spa26894, $spbe80b7); $spbbda25 = \QpayMchUtil::xmlToArray($spf089a0); if (!is_array($spbbda25)) { Log::error('Pay.QPay.verify Error, $retXml' . $spf089a0); return false; } if (array_key_exists('trade_state', $spbbda25) && $spbbda25['trade_state'] == 'SUCCESS') { call_user_func_array($sp04f0f8, array($spbbda25['out_trade_no'], $spbbda25['total_fee'], $spbbda25['transaction_id'])); return true; } else { return false; } } } }
\ No newline at end of file
+namespace App\Library\Pay\QPay; use App\Library\Helper; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; require_once __DIR__ . '/qpay_mch_sp/qpayMchAPI.class.php'; class Api implements ApiInterface { private $url_notify = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['mch_id']) || !isset($sp9d4382['mch_key'])) { throw new \Exception('请设置 mch_id 和 mch_key'); } $spc0e525 = array('out_trade_no' => $sp2e47fc, 'body' => $spd4e90d, 'device_info' => 'qq_19060', 'fee_type' => 'CNY', 'notify_url' => $this->url_notify, 'spbill_create_ip' => Helper::getIP(), 'total_fee' => $sp076ec7, 'trade_type' => 'NATIVE'); $sp685b1b = new \QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi', null, 10); $sp80a639 = $sp685b1b->req($spc0e525, $sp9d4382); $spb72f32 = \QpayMchUtil::xmlToArray($sp80a639); if (!isset($spb72f32['code_url'])) { Log::error('Pay.QPay.goPay, order_no:' . $sp2e47fc . ', error:' . json_encode($spb72f32)); if (isset($spb72f32['err_code_des'])) { throw new \Exception($spb72f32['err_code_des']); } if (isset($spb72f32['return_msg'])) { throw new \Exception($spb72f32['return_msg']); } throw new \Exception('获取支付数据失败'); } header('location: /qrcode/pay/' . $sp2e47fc . '/qq?url=' . urlencode($spb72f32['code_url'])); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; $sp685b1b = new \QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi', null, 10); if ($sp7b2182) { $spc0e525 = $sp685b1b->notify_params(); if (!$sp685b1b->notify_verify($spc0e525, $sp9d4382)) { echo 'FAIL'; return false; } call_user_func_array($sp9a4d97, array($spc0e525['out_trade_no'], $spc0e525['total_fee'], $spc0e525['transaction_id'])); echo 'SUCCESS'; return true; } else { $sp2e47fc = @$sp9d4382['out_trade_no']; $spc0e525 = array('out_trade_no' => $sp2e47fc); $sp80a639 = $sp685b1b->req($spc0e525, $sp9d4382); $spb72f32 = \QpayMchUtil::xmlToArray($sp80a639); if (!is_array($spb72f32)) { Log::error('Pay.QPay.verify Error, $retXml' . $sp80a639); return false; } if (array_key_exists('trade_state', $spb72f32) && $spb72f32['trade_state'] == 'SUCCESS') { call_user_func_array($sp9a4d97, array($spb72f32['out_trade_no'], $spb72f32['total_fee'], $spb72f32['transaction_id'])); return true; } else { return false; } } } }
\ No newline at end of file
diff --git a/app/Library/Pay/QPay/qpay_mch_sp/qpayMchAPI.class.php b/app/Library/Pay/QPay/qpay_mch_sp/qpayMchAPI.class.php
index 895dc7383..dd37cd042 100644
--- a/app/Library/Pay/QPay/qpay_mch_sp/qpayMchAPI.class.php
+++ b/app/Library/Pay/QPay/qpay_mch_sp/qpayMchAPI.class.php
@@ -1,2 +1,2 @@
url = $sp3db1b2; $this->isSSL = $spc4f70b; $this->timeout = $sp39139f; } public function notify_params() { $sp377bc6 = file_get_contents('php://input'); return QpayMchUtil::xmlToArray($sp377bc6); } public function notify_verify($spa26894, $spbe80b7) { if (!isset($spa26894['sign'])) { return false; } $spa109d2 = QpayMchUtil::getSign($spa26894, $spbe80b7['mch_key']); return $spa109d2 === $spa26894['sign']; } public function req($spa26894, $spbe80b7) { $spb9589c = array(); $spa26894['mch_id'] = $spbe80b7['mch_id']; $spa26894['nonce_str'] = QpayMchUtil::createNoncestr(); $spa26894['sign'] = QpayMchUtil::getSign($spa26894, $spbe80b7['mch_key']); $sp377bc6 = QpayMchUtil::arrayToXml($spa26894); if (isset($this->isSSL)) { $spb9589c = QpayMchUtil::reqByCurlSSLPost($sp377bc6, $this->url, $this->timeout); } else { $spb9589c = QpayMchUtil::reqByCurlNormalPost($sp377bc6, $this->url, $this->timeout); } return $spb9589c; } }
\ No newline at end of file
+require_once 'qpayMchUtil.class.php'; class QpayMchAPI { protected $url; protected $isSSL; protected $timeout; public function __construct($spd2457c, $sp813fc1, $spdecb3f = 5) { $this->url = $spd2457c; $this->isSSL = $sp813fc1; $this->timeout = $spdecb3f; } public function notify_params() { $sp87287d = file_get_contents('php://input'); return QpayMchUtil::xmlToArray($sp87287d); } public function notify_verify($spc0e525, $sp9d4382) { if (!isset($spc0e525['sign'])) { return false; } $sp964415 = QpayMchUtil::getSign($spc0e525, $sp9d4382['mch_key']); return $sp964415 === $spc0e525['sign']; } public function req($spc0e525, $sp9d4382) { $sp9b52fe = array(); $spc0e525['mch_id'] = $sp9d4382['mch_id']; $spc0e525['nonce_str'] = QpayMchUtil::createNoncestr(); $spc0e525['sign'] = QpayMchUtil::getSign($spc0e525, $sp9d4382['mch_key']); $sp87287d = QpayMchUtil::arrayToXml($spc0e525); if (isset($this->isSSL)) { $sp9b52fe = QpayMchUtil::reqByCurlSSLPost($sp87287d, $this->url, $this->timeout); } else { $sp9b52fe = QpayMchUtil::reqByCurlNormalPost($sp87287d, $this->url, $this->timeout); } return $sp9b52fe; } }
\ No newline at end of file
diff --git a/app/Library/Pay/QPay/qpay_mch_sp/qpayMchUtil.class.php b/app/Library/Pay/QPay/qpay_mch_sp/qpayMchUtil.class.php
index e9cf29913..66dcc89d0 100644
--- a/app/Library/Pay/QPay/qpay_mch_sp/qpayMchUtil.class.php
+++ b/app/Library/Pay/QPay/qpay_mch_sp/qpayMchUtil.class.php
@@ -1,2 +1,2 @@
$sp39a929) { if ($spce2336 != 'sign' && $sp39a929 != '' && !is_array($sp39a929)) { array_push($sp337530, "{$spce2336}={$sp39a929}"); } } return implode('&', $sp337530); } public static function getSign($spa26894, $sp93e106) { ksort($spa26894); $sp066544 = QpayMchUtil::buildQueryStr($spa26894); $sp066544 = $sp066544 . '&key=' . $sp93e106; $sp066544 = md5($sp066544); $spa109d2 = strtoupper($sp066544); return $spa109d2; } public static function arrayToXml($sp0aa15d) { $sp377bc6 = ''; foreach ($sp0aa15d as $sp1ed429 => $sp36ecf9) { if (is_numeric($sp36ecf9)) { $sp377bc6 .= "<{$sp1ed429}>{$sp36ecf9}{$sp1ed429}>"; } else { $sp377bc6 .= "<{$sp1ed429}>{$sp1ed429}>"; } } $sp377bc6 .= ''; return $sp377bc6; } public static function xmlToArray($sp377bc6) { $sp0aa15d = json_decode(json_encode(simplexml_load_string($sp377bc6, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $sp0aa15d; } public static function reqByCurlNormalPost($spa26894, $sp3db1b2, $sp39139f = 10) { return QpayMchUtil::_reqByCurl($spa26894, $sp3db1b2, $sp39139f, false); } public static function reqByCurlSSLPost($spa26894, $sp3db1b2, $sp39139f = 10) { return QpayMchUtil::_reqByCurl($spa26894, $sp3db1b2, $sp39139f, true); } private static function _reqByCurl($spa26894, $sp3db1b2, $sp39139f = 10, $spfb2c54 = false) { $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_TIMEOUT, $sp39139f); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($sp9b0943, CURLOPT_HEADER, FALSE); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, TRUE); if (isset($spfb2c54) && $spfb2c54 != false) { curl_setopt($sp9b0943, CURLOPT_SSLCERTTYPE, 'PEM'); curl_setopt($sp9b0943, CURLOPT_SSLCERT, QpayMchConf::CERT_FILE_PATH); curl_setopt($sp9b0943, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($sp9b0943, CURLOPT_SSLKEY, QpayMchConf::KEY_FILE_PATH); } curl_setopt($sp9b0943, CURLOPT_POST, true); curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $spa26894); $spb9589c = curl_exec($sp9b0943); if ($spb9589c) { curl_close($sp9b0943); return $spb9589c; } else { $sp13aa4d = curl_errno($sp9b0943); print_r($sp13aa4d); curl_close($sp9b0943); return false; } } }
\ No newline at end of file
+require_once 'qpayMch.config.php'; class QpayMchUtil { public static function createNoncestr($sp8dab90 = 32) { $sp1650b8 = 'abcdefghijklmnopqrstuvwxyz0123456789'; $sp14800d = ''; for ($sp6b283c = 0; $sp6b283c < $sp8dab90; $sp6b283c++) { $sp14800d .= substr($sp1650b8, mt_rand(0, strlen($sp1650b8) - 1), 1); } return $sp14800d; } public static function buildQueryStr($spc0e525) { $spbe702c = array(); foreach ($spc0e525 as $sp17f3a7 => $sp75c248) { if ($sp17f3a7 != 'sign' && $sp75c248 != '' && !is_array($sp75c248)) { array_push($spbe702c, "{$sp17f3a7}={$sp75c248}"); } } return implode('&', $spbe702c); } public static function getSign($spc0e525, $sp52ca97) { ksort($spc0e525); $sp54d1de = QpayMchUtil::buildQueryStr($spc0e525); $sp54d1de = $sp54d1de . '&key=' . $sp52ca97; $sp54d1de = md5($sp54d1de); $sp964415 = strtoupper($sp54d1de); return $sp964415; } public static function arrayToXml($sp96d357) { $sp87287d = ''; foreach ($sp96d357 as $spf1241f => $sp91e29b) { if (is_numeric($sp91e29b)) { $sp87287d .= "<{$spf1241f}>{$sp91e29b}{$spf1241f}>"; } else { $sp87287d .= "<{$spf1241f}>{$spf1241f}>"; } } $sp87287d .= ''; return $sp87287d; } public static function xmlToArray($sp87287d) { $sp96d357 = json_decode(json_encode(simplexml_load_string($sp87287d, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $sp96d357; } public static function reqByCurlNormalPost($spc0e525, $spd2457c, $spdecb3f = 10) { return QpayMchUtil::_reqByCurl($spc0e525, $spd2457c, $spdecb3f, false); } public static function reqByCurlSSLPost($spc0e525, $spd2457c, $spdecb3f = 10) { return QpayMchUtil::_reqByCurl($spc0e525, $spd2457c, $spdecb3f, true); } private static function _reqByCurl($spc0e525, $spd2457c, $spdecb3f = 10, $spfa47fc = false) { $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, $spdecb3f); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($sp9f83d6, CURLOPT_HEADER, FALSE); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, TRUE); if (isset($spfa47fc) && $spfa47fc != false) { curl_setopt($sp9f83d6, CURLOPT_SSLCERTTYPE, 'PEM'); curl_setopt($sp9f83d6, CURLOPT_SSLCERT, QpayMchConf::CERT_FILE_PATH); curl_setopt($sp9f83d6, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($sp9f83d6, CURLOPT_SSLKEY, QpayMchConf::KEY_FILE_PATH); } curl_setopt($sp9f83d6, CURLOPT_POST, true); curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $spc0e525); $sp9b52fe = curl_exec($sp9f83d6); if ($sp9b52fe) { curl_close($sp9f83d6); return $sp9b52fe; } else { $sp9ad762 = curl_errno($sp9f83d6); print_r($sp9ad762); curl_close($sp9f83d6); return false; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/Qf/Api.php b/app/Library/Pay/Qf/Api.php
index b9ef4a481..2daa07540 100644
--- a/app/Library/Pay/Qf/Api.php
+++ b/app/Library/Pay/Qf/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp908e43 = strtolower($spbe80b7['payway']); if (!isset($spbe80b7['id'])) { throw new \Exception('请设置 id'); } $sp28070b = array(); if ($sp908e43 == 'qq') { $sp28070b = array('User-Agent' => 'Mozilla/5.0 Mobile MQQBrowser/6.2 QQ/7.2.5.3305'); } elseif ($sp908e43 == 'alipay') { $sp28070b = array('User-Agent' => 'Mozilla/5.0 AlipayChannelId/5136 AlipayDefined(nt:WIFI,ws:411|0|2.625) AliApp(AP/10.1.10.1226101) AlipayClient/10.1.10.1226101'); } $spba2d44 = Request::get('https://o2.qfpay.com/q/info?code=&huid=' . $spbe80b7['id'] . '&opuid=&reqid=' . $spa3e681, $sp28070b); $sp49dccd = static::str_between($spba2d44, 'reqid":"', '"'); $sp77e39b = static::str_between($spba2d44, 'currency":"', '"'); if ($sp49dccd == '' || $sp77e39b == '') { Log::error('qfpay pay, 获取支付金额失败 - ' . $spba2d44); throw new \Exception('获取支付请求id失败'); } $sp5c64ef = Request::post('https://o2.qfpay.com/q/payment', 'txamt=' . $sp5213ee . '&openid=&appid=&huid=' . $spbe80b7['id'] . '&opuid=&reqid=' . $sp49dccd . '&balance=0¤cy=' . $sp77e39b, $sp28070b); $spbbda25 = json_decode($sp5c64ef, true); $sp9bcaff = static::str_between($sp5c64ef, 'syssn":"', '"'); if (!$spbbda25 || $sp9bcaff == '') { Log::error('qfpay pay, 生成支付单号失败#1 - ' . $sp5c64ef); throw new \Exception('生成支付单号失败#1'); } if ($spbbda25['respcd'] !== '0000') { if (isset($spbbda25['respmsg']) && $spbbda25['respmsg'] !== '') { throw new \Exception($spbbda25['respmsg']); } Log::error('qfpay pay, 生成支付单号失败#2 - ' . $sp5c64ef); throw new \Exception('生成支付单号失败#2'); } \App\Order::whereOrderNo($spa3e681)->update(array('pay_trade_no' => $sp9bcaff)); header('location: /qrcode/pay/' . $spa3e681 . '/qf_' . $sp908e43 . '?url=' . urlencode(json_encode($spbbda25['data']['pay_params']))); } function verify($spbe80b7, $sp04f0f8) { $sp4f4c0d = \App\Order::whereOrderNo($spbe80b7['out_trade_no'])->firstOrFail(); $sp9bcaff = $sp4f4c0d->pay_trade_no; $spc21b90 = Request::get('https://marketing.qfpay.com/v1/mkw/activity?syssn=' . $sp9bcaff); $sp8abb03 = json_decode($spc21b90, true); if (!$spc21b90) { throw new \Exception('query error'); } if (!isset($sp8abb03['respcd'])) { Log::error('qfpay query, 获取支付结果失败 - ' . $spc21b90); throw new \Exception('获取支付结果失败'); } if ($sp8abb03['respcd'] !== '0000') { return false; } $sp1953fc = (int) static::str_between($spc21b90, 'trade_amt":', ','); if ($sp1953fc === 0) { $sp1953fc = (int) static::str_between($spc21b90, 'txamt":', ','); if ($sp1953fc === 0) { Log::error('qfpay query, 获取支付金额失败 - ' . $spc21b90); throw new \Exception('获取支付金额失败'); } } if ($sp8abb03['respcd'] === '0000') { $sp04f0f8($spbe80b7['out_trade_no'], $sp1953fc, $sp9bcaff); return true; } return false; } public static function str_between($sp72201b, $sp518d68, $sp966620) { $spae03e3 = stripos($sp72201b, $sp518d68); if ($spae03e3 === false) { return ''; } $sp70b0e5 = stripos($sp72201b, $sp966620, $spae03e3 + strlen($sp518d68)); if ($sp70b0e5 === false || $spae03e3 >= $sp70b0e5) { return ''; } $sp19f67c = strlen($sp518d68); $spb9589c = substr($sp72201b, $spae03e3 + $sp19f67c, $sp70b0e5 - $spae03e3 - $sp19f67c); return $spb9589c; } }
\ No newline at end of file
+namespace App\Library\Pay\Qf; use App\Library\CurlRequest as Request; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf9ad85 = strtolower($sp9d4382['payway']); if (!isset($sp9d4382['id'])) { throw new \Exception('请设置 id'); } $spc69671 = array(); if ($spf9ad85 == 'qq') { $spc69671 = array('User-Agent' => 'Mozilla/5.0 Mobile MQQBrowser/6.2 QQ/7.2.5.3305'); } elseif ($spf9ad85 == 'alipay') { $spc69671 = array('User-Agent' => 'Mozilla/5.0 AlipayChannelId/5136 AlipayDefined(nt:WIFI,ws:411|0|2.625) AliApp(AP/10.1.10.1226101) AlipayClient/10.1.10.1226101'); } $sp63b8fa = Request::get('https://o2.qfpay.com/q/info?code=&huid=' . $sp9d4382['id'] . '&opuid=&reqid=' . $sp2e47fc, $spc69671); $sp099e22 = static::str_between($sp63b8fa, 'reqid":"', '"'); $sp74cf99 = static::str_between($sp63b8fa, 'currency":"', '"'); if ($sp099e22 == '' || $sp74cf99 == '') { Log::error('qfpay pay, 获取支付金额失败 - ' . $sp63b8fa); throw new \Exception('获取支付请求id失败'); } $sp1ad0f6 = Request::post('https://o2.qfpay.com/q/payment', 'txamt=' . $sp076ec7 . '&openid=&appid=&huid=' . $sp9d4382['id'] . '&opuid=&reqid=' . $sp099e22 . '&balance=0¤cy=' . $sp74cf99, $spc69671); $spb72f32 = json_decode($sp1ad0f6, true); $spccd6e0 = static::str_between($sp1ad0f6, 'syssn":"', '"'); if (!$spb72f32 || $spccd6e0 == '') { Log::error('qfpay pay, 生成支付单号失败#1 - ' . $sp1ad0f6); throw new \Exception('生成支付单号失败#1'); } if ($spb72f32['respcd'] !== '0000') { if (isset($spb72f32['respmsg']) && $spb72f32['respmsg'] !== '') { throw new \Exception($spb72f32['respmsg']); } Log::error('qfpay pay, 生成支付单号失败#2 - ' . $sp1ad0f6); throw new \Exception('生成支付单号失败#2'); } \App\Order::whereOrderNo($sp2e47fc)->update(array('pay_trade_no' => $spccd6e0)); header('location: /qrcode/pay/' . $sp2e47fc . '/qf_' . $spf9ad85 . '?url=' . urlencode(json_encode($spb72f32['data']['pay_params']))); } function verify($sp9d4382, $sp9a4d97) { $spe0613f = \App\Order::whereOrderNo($sp9d4382['out_trade_no'])->firstOrFail(); $spccd6e0 = $spe0613f->pay_trade_no; $sp68346c = Request::get('https://marketing.qfpay.com/v1/mkw/activity?syssn=' . $spccd6e0); $sp3fb247 = json_decode($sp68346c, true); if (!$sp68346c) { throw new \Exception('query error'); } if (!isset($sp3fb247['respcd'])) { Log::error('qfpay query, 获取支付结果失败 - ' . $sp68346c); throw new \Exception('获取支付结果失败'); } if ($sp3fb247['respcd'] !== '0000') { return false; } $sp68a03b = (int) static::str_between($sp68346c, 'trade_amt":', ','); if ($sp68a03b === 0) { $sp68a03b = (int) static::str_between($sp68346c, 'txamt":', ','); if ($sp68a03b === 0) { Log::error('qfpay query, 获取支付金额失败 - ' . $sp68346c); throw new \Exception('获取支付金额失败'); } } if ($sp3fb247['respcd'] === '0000') { $sp9a4d97($sp9d4382['out_trade_no'], $sp68a03b, $spccd6e0); return true; } return false; } public static function str_between($sp14800d, $sp974326, $sp0480e1) { $spe3a4eb = stripos($sp14800d, $sp974326); if ($spe3a4eb === false) { return ''; } $sp368574 = stripos($sp14800d, $sp0480e1, $spe3a4eb + strlen($sp974326)); if ($sp368574 === false || $spe3a4eb >= $sp368574) { return ''; } $spc24183 = strlen($sp974326); $sp9b52fe = substr($sp14800d, $spe3a4eb + $spc24183, $sp368574 - $spe3a4eb - $spc24183); return $sp9b52fe; } }
\ No newline at end of file
diff --git a/app/Library/Pay/QweBank/Api.php b/app/Library/Pay/QweBank/Api.php
index b15521b7c..44d5a774b 100644
--- a/app/Library/Pay/QweBank/Api.php
+++ b/app/Library/Pay/QweBank/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function getAccessToken($spbe80b7) { $sp89b050 = str_random(5); $spd60ac6 = time() . '00'; $spa109d2 = strtoupper(md5('merchantNo=' . $spbe80b7['mchid'] . '&nonce=' . $sp89b050 . '×tamp=' . $spd60ac6 . '&key=' . $spbe80b7['key'])); $spa26894 = json_encode(array('merchantNo' => $spbe80b7['mchid'], 'key' => $spbe80b7['key'], 'nonce' => $sp89b050, 'timestamp' => $spd60ac6, 'sign' => $spa109d2), JSON_FORCE_OBJECT); $sp00a165 = CurlRequest::post('http://api.qwebank.top/open/v1/getAccessToken/merchant', $spa26894, array('Content-Type' => 'application/json')); $spb9589c = @json_decode($sp00a165, true); if (!is_array($spb9589c) || !isset($spb9589c['value']) || !isset($spb9589c['value']['accessToken'])) { Log::error('Pay.QweBank.getAccessToken Error: ' . $sp00a165); throw new \Exception('获取支付渠道失败,请联系客服反馈'); } return $spb9589c['value']['accessToken']; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { if (!isset($spbe80b7['mchid'])) { throw new \Exception('请填写 mchid'); } if (!isset($spbe80b7['key'])) { throw new \Exception('请填写 key'); } $spdc9a36 = $spbe80b7['payway']; $spa26894 = array('accessToken' => $this->getAccessToken($spbe80b7), 'param' => array('outTradeNo' => $spa3e681, 'money' => $sp5213ee, 'type' => 'T0', 'body' => $sp45f07e, 'detail' => $sp45f07e, 'notifyUrl' => $this->url_notify, 'successUrl' => $this->url_return, 'productId' => '12313', 'timestamp' => strval(time()), 'sign' => '1')); if ($spdc9a36 === 'wechatWapPay') { $spa26894['param']['merchantIp'] = Helper::getIP(); } if ($spdc9a36 === 'bankPay') { if (!isset($spbe80b7['bankName'])) { throw new \Exception('请填写 bankName'); } $spa26894['param']['bankName'] = $spbe80b7['bankName']; } $sp00a165 = CurlRequest::post('http://api.qwebank.top/open/v1/order/' . $spdc9a36, json_encode($spa26894, JSON_FORCE_OBJECT), array('Content-Type' => 'application/json')); $spb9589c = @json_decode($sp00a165, true); if (!is_array($spb9589c) || !isset($spb9589c['success']) || !isset($spb9589c['value'])) { Log::error('Pay.QweBank.goPay Error: ' . $sp00a165); throw new \Exception('提交订单到支付渠道失败,请联系客服反馈'); } header('Location: ' . $spb9589c['value']); die; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; $spbbda25 = false; if ($sp3bce01) { $sp72201b = 'merchantNo=' . $_REQUEST['merchantNo'] . '&no=' . $_REQUEST['no'] . '&nonce=' . $_REQUEST['nonce'] . '×tamp=' . $_REQUEST['timestamp'] . '&key=' . $spbe80b7['key']; if (md5($sp72201b) !== $_REQUEST['sign']) { $spbbda25 = true; } echo $spbbda25 ? 'SUCCESS' : 'fail'; } else { $spa3e681 = $_REQUEST['outTradeNo']; $spa26894 = array('accessToken' => $this->getAccessToken($spbe80b7), 'param' => $spa3e681); $sp00a165 = CurlRequest::post('http://api.qwebank.top/open/v1/order/getByCustomerNo', json_encode($spa26894, JSON_FORCE_OBJECT), array('Content-Type' => 'application/json')); $spb9589c = @json_decode($sp00a165, true); if (!is_array($spb9589c) || !isset($spb9589c['success']) || !isset($spb9589c['value'])) { Log::error('Pay.QweBank.verify.getByCustomerNo Error: ' . $sp00a165); return false; } $spbbda25 = $spb9589c['value']['done'] === true; } if ($spbbda25) { $spa3e681 = $_REQUEST['outTradeNo']; $sp9624ba = $_REQUEST['money']; $spf71d25 = $_REQUEST['no']; $sp04f0f8($spa3e681, $sp9624ba, $spf71d25); return true; } return false; } }
\ No newline at end of file
+namespace App\Library\Pay\QweBank; use App\Library\CurlRequest; use App\Library\Helper; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function getAccessToken($sp9d4382) { $spd551e5 = str_random(5); $sp72c5f0 = time() . '00'; $sp964415 = strtoupper(md5('merchantNo=' . $sp9d4382['mchid'] . '&nonce=' . $spd551e5 . '×tamp=' . $sp72c5f0 . '&key=' . $sp9d4382['key'])); $spc0e525 = json_encode(array('merchantNo' => $sp9d4382['mchid'], 'key' => $sp9d4382['key'], 'nonce' => $spd551e5, 'timestamp' => $sp72c5f0, 'sign' => $sp964415), JSON_FORCE_OBJECT); $sp42422c = CurlRequest::post('http://api.qwebank.top/open/v1/getAccessToken/merchant', $spc0e525, array('Content-Type' => 'application/json')); $sp9b52fe = @json_decode($sp42422c, true); if (!is_array($sp9b52fe) || !isset($sp9b52fe['value']) || !isset($sp9b52fe['value']['accessToken'])) { Log::error('Pay.QweBank.getAccessToken Error: ' . $sp42422c); throw new \Exception('获取支付渠道失败,请联系客服反馈'); } return $sp9b52fe['value']['accessToken']; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { if (!isset($sp9d4382['mchid'])) { throw new \Exception('请填写 mchid'); } if (!isset($sp9d4382['key'])) { throw new \Exception('请填写 key'); } $spf9ca0c = $sp9d4382['payway']; $spc0e525 = array('accessToken' => $this->getAccessToken($sp9d4382), 'param' => array('outTradeNo' => $sp2e47fc, 'money' => $sp076ec7, 'type' => 'T0', 'body' => $spd4e90d, 'detail' => $spd4e90d, 'notifyUrl' => $this->url_notify, 'successUrl' => $this->url_return, 'productId' => '12313', 'timestamp' => strval(time()), 'sign' => '1')); if ($spf9ca0c === 'wechatWapPay') { $spc0e525['param']['merchantIp'] = Helper::getIP(); } if ($spf9ca0c === 'bankPay') { if (!isset($sp9d4382['bankName'])) { throw new \Exception('请填写 bankName'); } $spc0e525['param']['bankName'] = $sp9d4382['bankName']; } $sp42422c = CurlRequest::post('http://api.qwebank.top/open/v1/order/' . $spf9ca0c, json_encode($spc0e525, JSON_FORCE_OBJECT), array('Content-Type' => 'application/json')); $sp9b52fe = @json_decode($sp42422c, true); if (!is_array($sp9b52fe) || !isset($sp9b52fe['success']) || !isset($sp9b52fe['value'])) { Log::error('Pay.QweBank.goPay Error: ' . $sp42422c); throw new \Exception('提交订单到支付渠道失败,请联系客服反馈'); } header('Location: ' . $sp9b52fe['value']); die; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; $spb72f32 = false; if ($sp7b2182) { $sp14800d = 'merchantNo=' . $_REQUEST['merchantNo'] . '&no=' . $_REQUEST['no'] . '&nonce=' . $_REQUEST['nonce'] . '×tamp=' . $_REQUEST['timestamp'] . '&key=' . $sp9d4382['key']; if (md5($sp14800d) !== $_REQUEST['sign']) { $spb72f32 = true; } echo $spb72f32 ? 'SUCCESS' : 'fail'; } else { $sp2e47fc = $_REQUEST['outTradeNo']; $spc0e525 = array('accessToken' => $this->getAccessToken($sp9d4382), 'param' => $sp2e47fc); $sp42422c = CurlRequest::post('http://api.qwebank.top/open/v1/order/getByCustomerNo', json_encode($spc0e525, JSON_FORCE_OBJECT), array('Content-Type' => 'application/json')); $sp9b52fe = @json_decode($sp42422c, true); if (!is_array($sp9b52fe) || !isset($sp9b52fe['success']) || !isset($sp9b52fe['value'])) { Log::error('Pay.QweBank.verify.getByCustomerNo Error: ' . $sp42422c); return false; } $spb72f32 = $sp9b52fe['value']['done'] === true; } if ($spb72f32) { $sp2e47fc = $_REQUEST['outTradeNo']; $spc686cf = $_REQUEST['money']; $sp02e5fb = $_REQUEST['no']; $sp9a4d97($sp2e47fc, $spc686cf, $sp02e5fb); return true; } return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/Api.php b/app/Library/Pay/WeChat/Api.php
index 6d5209b52..e96be85d5 100644
--- a/app/Library/Pay/WeChat/Api.php
+++ b/app/Library/Pay/WeChat/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp429fcc = $sp5213ee; $spdc9a36 = strtoupper($spbe80b7['payway']); if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { $spdc9a36 = 'JSAPI'; $spa8234d = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}" . '/pay/' . $spa3e681; $sp136fa6 = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $spbe80b7['APPID'] . '&redirect_uri=' . urlencode($spa8234d) . '&response_type=code&scope=snsapi_base#wechat_redirect'; if (!isset($_GET['code'])) { header('Location: ' . $sp136fa6); die; } $sp8e5de6 = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $spbe80b7['APPID'] . '&secret=' . $spbe80b7['APPSECRET'] . '&code=' . $_GET['code'] . '&grant_type=authorization_code'; $spb9589c = @json_decode(CurlRequest::get($sp8e5de6), true); if (!is_array($spb9589c) || empty($spb9589c['openid'])) { if (isset($spb9589c['errcode']) && $spb9589c['errcode'] === 40163) { header('Location: ' . $sp136fa6); die; } die('获取微信OPENID
错误信息: ' . (isset($spb9589c['errcode']) ? $spb9589c['errcode'] : $spb9589c) . '
' . (isset($spb9589c['errmsg']) ? $spb9589c['errmsg'] : $spb9589c) . '
请返回重试
'); } $sp0b37ee = $spb9589c['openid']; } else { if ($spdc9a36 === 'JSAPI') { $spa8234d = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}" . '/pay/' . $spa3e681; header('Location: /qrcode/pay/' . $spa3e681 . '/wechat?url=' . urlencode($spa8234d)); die; } } $this->defineWxConfig($spbe80b7); require_once __DIR__ . '/lib/WxPay.Api.php'; require_once 'WxPay.NativePay.php'; require_once 'WxLog.php'; $sp80ce90 = new \NativePay(); $sp134454 = new \WxPayUnifiedOrder(); $sp134454->SetBody($sp45f07e); $sp134454->SetAttach($spa3e681); $sp134454->SetOut_trade_no($spa3e681); $sp134454->SetTotal_fee($sp429fcc); $sp134454->SetTime_start(date('YmdHis')); $sp134454->SetTime_expire(date('YmdHis', time() + 600)); $sp134454->SetGoods_tag('pay'); $sp134454->SetTrade_type($spdc9a36); if ($spdc9a36 === 'MWEB') { $sp134454->SetScene_info('{"h5_info": {"type":"Wap","wap_url": "' . SYS_URL . '","wap_name": "发卡平台"}}'); } if ($spdc9a36 === 'JSAPI') { $sp134454->SetOpenid($sp0b37ee); } $sp134454->SetProduct_id($spa3e681); $sp134454->SetSpbill_create_ip(Helper::getIP()); $sp134454->SetNotify_url($this->url_notify); $spbbda25 = $sp80ce90->unifiedOrder($sp134454); function getValue($spa3e681, $spbbda25, $sp1ed429) { if (!isset($spbbda25[$sp1ed429])) { Log::error('Pay.WeChat.goPay, order_no:' . $spa3e681 . ', error:' . json_encode($spbbda25)); if (isset($spbbda25['err_code_des'])) { throw new \Exception($spbbda25['err_code_des']); } if (isset($spbbda25['return_msg'])) { throw new \Exception($spbbda25['return_msg']); } throw new \Exception('获取支付数据失败'); } return $spbbda25[$sp1ed429]; } if ($spdc9a36 === 'NATIVE') { $sp3db1b2 = getValue($spa3e681, $spbbda25, 'code_url'); header('Location: /qrcode/pay/' . $spa3e681 . '/wechat?url=' . urlencode($sp3db1b2)); } elseif ($spdc9a36 === 'JSAPI') { $spa26894 = array('appId' => $spbe80b7['APPID'], 'timeStamp' => strval(time()), 'nonceStr' => md5(time() . 'nonceStr'), 'package' => 'prepay_id=' . getValue($spa3e681, $spbbda25, 'prepay_id'), 'signType' => 'MD5'); $sp5aa598 = new \WxPayJsApiPay(); $sp5aa598->FromArray($spa26894); $spa26894['paySign'] = $sp5aa598->MakeSign(); header('Location: /qrcode/pay/' . $spa3e681 . '/wechat?url=' . urlencode(json_encode($spa26894))); } elseif ($spdc9a36 === 'MWEB') { $sp3db1b2 = getValue($spa3e681, $spbbda25, 'mweb_url'); $sp978358 = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}" . '/qrcode/pay/' . $spa3e681 . '/wechat?url=query'; echo view('utils.redirect', array('url' => $sp3db1b2 . '&redirect_url=' . urlencode($sp978358))); } die; } private function defineWxConfig($spbe80b7) { if (!defined('wx_APPID')) { define('wx_APPID', $spbe80b7['APPID']); } if (!defined('wx_MCHID')) { define('wx_MCHID', $spbe80b7['MCHID']); } if (!defined('wx_SUBAPPID')) { define('wx_SUBAPPID', @$spbe80b7['sub_appid']); } if (!defined('wx_SUBMCHID')) { define('wx_SUBMCHID', @$spbe80b7['sub_mch_id']); } if (!defined('wx_KEY')) { define('wx_KEY', $spbe80b7['KEY']); } if (!defined('wx_APPSECRET')) { define('wx_APPSECRET', $spbe80b7['APPSECRET']); } } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; $this->defineWxConfig($spbe80b7); require_once __DIR__ . '/lib/WxPay.Api.php'; require_once 'WxLog.php'; if ($sp3bce01) { return (new PayNotifyCallBack($sp04f0f8))->Handle(false); } else { $spa3e681 = @$spbe80b7['out_trade_no']; $sp134454 = new \WxPayOrderQuery(); $sp134454->SetOut_trade_no($spa3e681); if (isset($spbe80b7['sub_mch_id'])) { $sp134454->SetSub_mch_id($spa3e681); } try { $spbbda25 = \WxPayApi::orderQuery($sp134454); if (array_key_exists('trade_state', $spbbda25) && $spbbda25['trade_state'] == 'SUCCESS') { call_user_func_array($sp04f0f8, array($spbbda25['out_trade_no'], $spbbda25['total_fee'], $spbbda25['transaction_id'])); return true; } else { Log::debug('Pay.WeChat.verify, orderQuery failed. ' . json_encode($spbbda25)); return false; } } catch (\Throwable $sp81eee8) { Log::error('Pay.WeChat.verify, orderQuery exception:. ' . $sp81eee8->getMessage(), array('exception' => $sp81eee8)); return false; } } } }
\ No newline at end of file
+namespace App\Library\Pay\WeChat; use App\Library\CurlRequest; use App\Library\Helper; use App\Library\Pay\ApiInterface; use Illuminate\Support\Facades\Log; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf59c91 = $sp076ec7; $spf9ca0c = strtoupper($sp9d4382['payway']); if (strpos(@$_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { $spf9ca0c = 'JSAPI'; $spaa5fe3 = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}" . '/pay/' . $sp2e47fc; $sp9faa2b = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $sp9d4382['APPID'] . '&redirect_uri=' . urlencode($spaa5fe3) . '&response_type=code&scope=snsapi_base#wechat_redirect'; if (!isset($_GET['code'])) { header('Location: ' . $sp9faa2b); die; } $sp653463 = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $sp9d4382['APPID'] . '&secret=' . $sp9d4382['APPSECRET'] . '&code=' . $_GET['code'] . '&grant_type=authorization_code'; $sp9b52fe = @json_decode(CurlRequest::get($sp653463), true); if (!is_array($sp9b52fe) || empty($sp9b52fe['openid'])) { if (isset($sp9b52fe['errcode']) && $sp9b52fe['errcode'] === 40163) { header('Location: ' . $sp9faa2b); die; } die('获取微信OPENID
错误信息: ' . (isset($sp9b52fe['errcode']) ? $sp9b52fe['errcode'] : $sp9b52fe) . '
' . (isset($sp9b52fe['errmsg']) ? $sp9b52fe['errmsg'] : $sp9b52fe) . '
请返回重试
'); } $sp549d4c = $sp9b52fe['openid']; } else { if ($spf9ca0c === 'JSAPI') { $spaa5fe3 = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}" . '/pay/' . $sp2e47fc; header('Location: /qrcode/pay/' . $sp2e47fc . '/wechat?url=' . urlencode($spaa5fe3)); die; } } $this->defineWxConfig($sp9d4382); require_once __DIR__ . '/lib/WxPay.Api.php'; require_once 'WxPay.NativePay.php'; require_once 'WxLog.php'; $sp10223c = new \NativePay(); $spfaaf1d = new \WxPayUnifiedOrder(); $spfaaf1d->SetBody($spd4e90d); $spfaaf1d->SetAttach($sp2e47fc); $spfaaf1d->SetOut_trade_no($sp2e47fc); $spfaaf1d->SetTotal_fee($spf59c91); $spfaaf1d->SetTime_start(date('YmdHis')); $spfaaf1d->SetTime_expire(date('YmdHis', time() + 600)); $spfaaf1d->SetGoods_tag('pay'); $spfaaf1d->SetTrade_type($spf9ca0c); if ($spf9ca0c === 'MWEB') { $spfaaf1d->SetScene_info('{"h5_info": {"type":"Wap","wap_url": "' . SYS_URL . '","wap_name": "发卡平台"}}'); } if ($spf9ca0c === 'JSAPI') { $spfaaf1d->SetOpenid($sp549d4c); } $spfaaf1d->SetProduct_id($sp2e47fc); $spfaaf1d->SetSpbill_create_ip(Helper::getIP()); $spfaaf1d->SetNotify_url($this->url_notify); $spb72f32 = $sp10223c->unifiedOrder($spfaaf1d); function getValue($sp2e47fc, $spb72f32, $spf1241f) { if (!isset($spb72f32[$spf1241f])) { Log::error('Pay.WeChat.goPay, order_no:' . $sp2e47fc . ', error:' . json_encode($spb72f32)); if (isset($spb72f32['err_code_des'])) { throw new \Exception($spb72f32['err_code_des']); } if (isset($spb72f32['return_msg'])) { throw new \Exception($spb72f32['return_msg']); } throw new \Exception('获取支付数据失败'); } return $spb72f32[$spf1241f]; } if ($spf9ca0c === 'NATIVE') { $spd2457c = getValue($sp2e47fc, $spb72f32, 'code_url'); header('Location: /qrcode/pay/' . $sp2e47fc . '/wechat?url=' . urlencode($spd2457c)); } elseif ($spf9ca0c === 'JSAPI') { $spc0e525 = array('appId' => $sp9d4382['APPID'], 'timeStamp' => strval(time()), 'nonceStr' => md5(time() . 'nonceStr'), 'package' => 'prepay_id=' . getValue($sp2e47fc, $spb72f32, 'prepay_id'), 'signType' => 'MD5'); $sp6fd648 = new \WxPayJsApiPay(); $sp6fd648->FromArray($spc0e525); $spc0e525['paySign'] = $sp6fd648->MakeSign(); header('Location: /qrcode/pay/' . $sp2e47fc . '/wechat?url=' . urlencode(json_encode($spc0e525))); } elseif ($spf9ca0c === 'MWEB') { $spd2457c = getValue($sp2e47fc, $spb72f32, 'mweb_url'); $sp499c52 = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}" . '/qrcode/pay/' . $sp2e47fc . '/wechat?url=query'; echo view('utils.redirect', array('url' => $spd2457c . '&redirect_url=' . urlencode($sp499c52))); } die; } private function defineWxConfig($sp9d4382) { if (!defined('wx_APPID')) { define('wx_APPID', $sp9d4382['APPID']); } if (!defined('wx_MCHID')) { define('wx_MCHID', $sp9d4382['MCHID']); } if (!defined('wx_SUBAPPID')) { define('wx_SUBAPPID', @$sp9d4382['sub_appid']); } if (!defined('wx_SUBMCHID')) { define('wx_SUBMCHID', @$sp9d4382['sub_mch_id']); } if (!defined('wx_KEY')) { define('wx_KEY', $sp9d4382['KEY']); } if (!defined('wx_APPSECRET')) { define('wx_APPSECRET', $sp9d4382['APPSECRET']); } } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; $this->defineWxConfig($sp9d4382); require_once __DIR__ . '/lib/WxPay.Api.php'; require_once 'WxLog.php'; if ($sp7b2182) { return (new PayNotifyCallBack($sp9a4d97))->Handle(false); } else { $sp2e47fc = @$sp9d4382['out_trade_no']; $spfaaf1d = new \WxPayOrderQuery(); $spfaaf1d->SetOut_trade_no($sp2e47fc); if (isset($sp9d4382['sub_mch_id'])) { $spfaaf1d->SetSub_mch_id($sp2e47fc); } try { $spb72f32 = \WxPayApi::orderQuery($spfaaf1d); if (array_key_exists('trade_state', $spb72f32) && $spb72f32['trade_state'] == 'SUCCESS') { call_user_func_array($sp9a4d97, array($spb72f32['out_trade_no'], $spb72f32['total_fee'], $spb72f32['transaction_id'])); return true; } else { Log::debug('Pay.WeChat.verify, orderQuery failed. ' . json_encode($spb72f32)); return false; } } catch (\Throwable $sp3f4aab) { Log::error('Pay.WeChat.verify, orderQuery exception:. ' . $sp3f4aab->getMessage(), array('exception' => $sp3f4aab)); return false; } } } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/PayNotifyCallBack.php b/app/Library/Pay/WeChat/PayNotifyCallBack.php
index aee3cf07f..035a46c72 100644
--- a/app/Library/Pay/WeChat/PayNotifyCallBack.php
+++ b/app/Library/Pay/WeChat/PayNotifyCallBack.php
@@ -1,2 +1,2 @@
successCallback = $sp04f0f8; } public function QueryOrder($sp8606bd) { $sp134454 = new \WxPayOrderQuery(); $sp134454->SetTransaction_id($sp8606bd); $spbbda25 = \WxPayApi::orderQuery($sp134454); \WxLog::DEBUG('query:' . json_encode($spbbda25)); if (array_key_exists('return_code', $spbbda25) && array_key_exists('result_code', $spbbda25) && $spbbda25['return_code'] == 'SUCCESS' && $spbbda25['result_code'] == 'SUCCESS') { return true; } return false; } public function NotifyProcess($sp5aa598, &$sp093e23) { \WxLog::DEBUG('call back:' . json_encode($sp5aa598)); if (!array_key_exists('transaction_id', $sp5aa598)) { $sp093e23 = '输入参数不正确'; \WxLog::DEBUG('begin process 输入参数不正确'); return false; } if (!$this->QueryOrder($sp5aa598['transaction_id'])) { $sp093e23 = '订单查询失败'; \WxLog::DEBUG('begin process 订单查询失败'); return false; } if ($this->successCallback) { call_user_func_array($this->successCallback, array($sp5aa598['out_trade_no'], $sp5aa598['total_fee'], $sp5aa598['transaction_id'])); } return true; } }
\ No newline at end of file
+namespace App\Library\Pay\WeChat; require_once __DIR__ . '/lib/WxPay.Api.php'; require_once __DIR__ . '/lib/WxPay.Notify.php'; require_once 'WxLog.php'; class PayNotifyCallBack extends \WxPayNotify { private $successCallback = null; public function __construct($sp9a4d97) { $this->successCallback = $sp9a4d97; } public function QueryOrder($sp1e858e) { $spfaaf1d = new \WxPayOrderQuery(); $spfaaf1d->SetTransaction_id($sp1e858e); $spb72f32 = \WxPayApi::orderQuery($spfaaf1d); \WxLog::DEBUG('query:' . json_encode($spb72f32)); if (array_key_exists('return_code', $spb72f32) && array_key_exists('result_code', $spb72f32) && $spb72f32['return_code'] == 'SUCCESS' && $spb72f32['result_code'] == 'SUCCESS') { return true; } return false; } public function NotifyProcess($sp6fd648, &$sp417133) { \WxLog::DEBUG('call back:' . json_encode($sp6fd648)); if (!array_key_exists('transaction_id', $sp6fd648)) { $sp417133 = '输入参数不正确'; \WxLog::DEBUG('begin process 输入参数不正确'); return false; } if (!$this->QueryOrder($sp6fd648['transaction_id'])) { $sp417133 = '订单查询失败'; \WxLog::DEBUG('begin process 订单查询失败'); return false; } if ($this->successCallback) { call_user_func_array($this->successCallback, array($sp6fd648['out_trade_no'], $sp6fd648['total_fee'], $sp6fd648['transaction_id'])); } return true; } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/WxLog.php b/app/Library/Pay/WeChat/WxLog.php
index 7efab9c89..2bbd43a5a 100644
--- a/app/Library/Pay/WeChat/WxLog.php
+++ b/app/Library/Pay/WeChat/WxLog.php
@@ -1,2 +1,2 @@
$sp36ecf9) { if (array_key_exists('file', $sp36ecf9)) { $sp0ea010 .= ',file:' . $sp36ecf9['file']; } if (array_key_exists('line', $sp36ecf9)) { $sp0ea010 .= ',line:' . $sp36ecf9['line']; } if (array_key_exists('function', $sp36ecf9)) { $sp0ea010 .= ',function:' . $sp36ecf9['function']; } } $sp0ea010 .= ']'; \Illuminate\Support\Facades\Log::error($sp0ea010 . $sp093e23); } public static function INFO($sp093e23) { \Illuminate\Support\Facades\Log::info($sp093e23); } }
\ No newline at end of file
+class WxLog { public static function DEBUG($sp417133) { \Illuminate\Support\Facades\Log::debug($sp417133); } public static function WARN($sp417133) { \Illuminate\Support\Facades\Log::warning($sp417133); } public static function ERROR($sp417133) { $sp5a4fe5 = debug_backtrace(); $sp37ba41 = '['; foreach ($sp5a4fe5 as $spf1241f => $sp91e29b) { if (array_key_exists('file', $sp91e29b)) { $sp37ba41 .= ',file:' . $sp91e29b['file']; } if (array_key_exists('line', $sp91e29b)) { $sp37ba41 .= ',line:' . $sp91e29b['line']; } if (array_key_exists('function', $sp91e29b)) { $sp37ba41 .= ',function:' . $sp91e29b['function']; } } $sp37ba41 .= ']'; \Illuminate\Support\Facades\Log::error($sp37ba41 . $sp417133); } public static function INFO($sp417133) { \Illuminate\Support\Facades\Log::info($sp417133); } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/WxPay.NativePay.php b/app/Library/Pay/WeChat/WxPay.NativePay.php
index bc3118f57..aedcb3869 100644
--- a/app/Library/Pay/WeChat/WxPay.NativePay.php
+++ b/app/Library/Pay/WeChat/WxPay.NativePay.php
@@ -1,2 +1,2 @@
SetProduct_id($sp428e31); $sp80e709 = WxpayApi::bizpayurl($sp47b2a8); $sp3db1b2 = 'weixin://wxpay/bizpayurl?' . $this->ToUrlParams($sp80e709); return $sp3db1b2; } private function ToUrlParams($sp41b696) { $spfe4a9e = ''; foreach ($sp41b696 as $spce2336 => $sp39a929) { $spfe4a9e .= $spce2336 . '=' . $sp39a929 . '&'; } $spfe4a9e = trim($spfe4a9e, '&'); return $spfe4a9e; } public function unifiedOrder($sp134454) { return WxPayApi::unifiedOrder($sp134454); } }
\ No newline at end of file
+require_once __DIR__ . '/lib/WxPay.Api.php'; class NativePay { public function GetPrePayUrl($sp427bbc) { $sp969f86 = new WxPayBizPayUrl(); $sp969f86->SetProduct_id($sp427bbc); $spdd7a68 = WxpayApi::bizpayurl($sp969f86); $spd2457c = 'weixin://wxpay/bizpayurl?' . $this->ToUrlParams($spdd7a68); return $spd2457c; } private function ToUrlParams($sp795036) { $sp37ee7b = ''; foreach ($sp795036 as $sp17f3a7 => $sp75c248) { $sp37ee7b .= $sp17f3a7 . '=' . $sp75c248 . '&'; } $sp37ee7b = trim($sp37ee7b, '&'); return $sp37ee7b; } public function unifiedOrder($spfaaf1d) { return WxPayApi::unifiedOrder($spfaaf1d); } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/lib/WxPay.Api.php b/app/Library/Pay/WeChat/lib/WxPay.Api.php
index c857c5fff..59ced4ac8 100644
--- a/app/Library/Pay/WeChat/lib/WxPay.Api.php
+++ b/app/Library/Pay/WeChat/lib/WxPay.Api.php
@@ -1,2 +1,2 @@
IsOut_trade_noSet()) { throw new WxPayException('缺少统一支付接口必填参数out_trade_no!'); } else { if (!$spe4b05c->IsBodySet()) { throw new WxPayException('缺少统一支付接口必填参数body!'); } else { if (!$spe4b05c->IsTotal_feeSet()) { throw new WxPayException('缺少统一支付接口必填参数total_fee!'); } else { if (!$spe4b05c->IsTrade_typeSet()) { throw new WxPayException('缺少统一支付接口必填参数trade_type!'); } } } } if ($spe4b05c->GetTrade_type() == 'JSAPI' && !$spe4b05c->IsOpenidSet()) { throw new WxPayException('统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!'); } if ($spe4b05c->GetTrade_type() == 'NATIVE' && !$spe4b05c->IsProduct_idSet()) { throw new WxPayException('统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); if (@WxPayConfig::SUBAPPID) { $spe4b05c->SetSub_appid(WxPayConfig::SUBAPPID); } if (@WxPayConfig::SUBMCHID) { $spe4b05c->SetSub_mch_id(WxPayConfig::SUBMCHID); } $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function orderQuery($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/pay/orderquery'; if (!$spe4b05c->IsOut_trade_noSet() && !$spe4b05c->IsTransaction_idSet()) { throw new WxPayException('订单查询接口中,out_trade_no、transaction_id至少填一个!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); if (@WxPayConfig::SUBMCHID) { $spe4b05c->SetSub_mch_id(WxPayConfig::SUBMCHID); } $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function closeOrder($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/pay/closeorder'; if (!$spe4b05c->IsOut_trade_noSet()) { throw new WxPayException('订单查询接口中,out_trade_no必填!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function refund($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/secapi/pay/refund'; if (!$spe4b05c->IsOut_trade_noSet() && !$spe4b05c->IsTransaction_idSet()) { throw new WxPayException('退款申请接口中,out_trade_no、transaction_id至少填一个!'); } else { if (!$spe4b05c->IsOut_refund_noSet()) { throw new WxPayException('退款申请接口中,缺少必填参数out_refund_no!'); } else { if (!$spe4b05c->IsTotal_feeSet()) { throw new WxPayException('退款申请接口中,缺少必填参数total_fee!'); } else { if (!$spe4b05c->IsRefund_feeSet()) { throw new WxPayException('退款申请接口中,缺少必填参数refund_fee!'); } else { if (!$spe4b05c->IsOp_user_idSet()) { throw new WxPayException('退款申请接口中,缺少必填参数op_user_id!'); } } } } } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, true, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function refundQuery($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/pay/refundquery'; if (!$spe4b05c->IsOut_refund_noSet() && !$spe4b05c->IsOut_trade_noSet() && !$spe4b05c->IsTransaction_idSet() && !$spe4b05c->IsRefund_idSet()) { throw new WxPayException('退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function downloadBill($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/pay/downloadbill'; if (!$spe4b05c->IsBill_dateSet()) { throw new WxPayException('对账单接口中,缺少必填参数bill_date!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); if (substr($sp3ac4e3, 0, 5) == '') { return ''; } return $sp3ac4e3; } public static function micropay($spe4b05c, $sp0fc8f7 = 10) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/pay/micropay'; if (!$spe4b05c->IsBodySet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数body!'); } else { if (!$spe4b05c->IsOut_trade_noSet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数out_trade_no!'); } else { if (!$spe4b05c->IsTotal_feeSet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数total_fee!'); } else { if (!$spe4b05c->IsAuth_codeSet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数auth_code!'); } } } } $spe4b05c->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']); $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function reverse($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/secapi/pay/reverse'; if (!$spe4b05c->IsOut_trade_noSet() && !$spe4b05c->IsTransaction_idSet()) { throw new WxPayException('撤销订单API接口中,参数out_trade_no和transaction_id必须填写一个!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, true, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function report($spe4b05c, $sp0fc8f7 = 1) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/payitil/report'; if (!$spe4b05c->IsInterface_urlSet()) { throw new WxPayException('接口URL,缺少必填参数interface_url!'); } if (!$spe4b05c->IsReturn_codeSet()) { throw new WxPayException('返回状态码,缺少必填参数return_code!'); } if (!$spe4b05c->IsResult_codeSet()) { throw new WxPayException('业务结果,缺少必填参数result_code!'); } if (!$spe4b05c->IsUser_ipSet()) { throw new WxPayException('访问接口IP,缺少必填参数user_ip!'); } if (!$spe4b05c->IsExecute_time_Set()) { throw new WxPayException('接口耗时,缺少必填参数execute_time_!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetUser_ip($_SERVER['REMOTE_ADDR']); $spe4b05c->SetTime(date('YmdHis')); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); return $sp3ac4e3; } public static function bizpayurl($spe4b05c, $sp0fc8f7 = 6) { if (!$spe4b05c->IsProduct_idSet()) { throw new WxPayException('生成二维码,缺少必填参数product_id!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetTime_stamp(time()); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); return $spe4b05c->GetValues(); } public static function shorturl($spe4b05c, $sp0fc8f7 = 6) { $sp3db1b2 = 'https://api.mch.weixin.qq.com/tools/shorturl'; if (!$spe4b05c->IsLong_urlSet()) { throw new WxPayException('需要转换的URL,签名用原串,传输需URL encode!'); } $spe4b05c->SetAppid(WxPayConfig::APPID); $spe4b05c->SetMch_id(WxPayConfig::MCHID); $spe4b05c->SetNonce_str(self::getNonceStr()); $spe4b05c->SetSign(); $sp377bc6 = $spe4b05c->ToXml(); $sp3fbfb2 = self::getMillisecond(); $sp3ac4e3 = self::postXmlCurl($sp377bc6, $sp3db1b2, false, $sp0fc8f7); $spbbda25 = WxPayResults::Init($sp3ac4e3); self::reportCostTime($sp3db1b2, $sp3fbfb2, $spbbda25); return $spbbda25; } public static function notify($sp1bf529, &$sp093e23) { $sp377bc6 = file_get_contents('php://input'); try { $spbbda25 = WxPayResults::Init($sp377bc6); } catch (WxPayException $sp81eee8) { $sp093e23 = $sp81eee8->errorMessage(); return false; } return call_user_func($sp1bf529, $spbbda25); } public static function getNonceStr($sp17d4b4 = 32) { $spb32c39 = 'abcdefghijklmnopqrstuvwxyz0123456789'; $sp72201b = ''; for ($spea591f = 0; $spea591f < $sp17d4b4; $spea591f++) { $sp72201b .= substr($spb32c39, mt_rand(0, strlen($spb32c39) - 1), 1); } return $sp72201b; } public static function replyNotify($sp377bc6) { echo $sp377bc6; } private static function reportCostTime($sp3db1b2, $sp3fbfb2, $sp5aa598) { if (WxPayConfig::REPORT_LEVENL == 0) { return; } if (WxPayConfig::REPORT_LEVENL == 1 && array_key_exists('return_code', $sp5aa598) && $sp5aa598['return_code'] == 'SUCCESS' && array_key_exists('result_code', $sp5aa598) && $sp5aa598['result_code'] == 'SUCCESS') { return; } $sp61d9d8 = self::getMillisecond(); $sp266aba = new WxPayReport(); $sp266aba->SetInterface_url($sp3db1b2); $sp266aba->SetExecute_time_($sp61d9d8 - $sp3fbfb2); if (array_key_exists('return_code', $sp5aa598)) { $sp266aba->SetReturn_code($sp5aa598['return_code']); } if (array_key_exists('return_msg', $sp5aa598)) { $sp266aba->SetReturn_msg($sp5aa598['return_msg']); } if (array_key_exists('result_code', $sp5aa598)) { $sp266aba->SetResult_code($sp5aa598['result_code']); } if (array_key_exists('err_code', $sp5aa598)) { $sp266aba->SetErr_code($sp5aa598['err_code']); } if (array_key_exists('err_code_des', $sp5aa598)) { $sp266aba->SetErr_code_des($sp5aa598['err_code_des']); } if (array_key_exists('out_trade_no', $sp5aa598)) { $sp266aba->SetOut_trade_no($sp5aa598['out_trade_no']); } if (array_key_exists('device_info', $sp5aa598)) { $sp266aba->SetDevice_info($sp5aa598['device_info']); } try { self::report($sp266aba); } catch (WxPayException $sp81eee8) { } } private static function postXmlCurl($sp377bc6, $sp3db1b2, $sp437a89 = false, $spdffe48 = 30) { $sp9b0943 = curl_init(); curl_setopt($sp9b0943, CURLOPT_TIMEOUT, $spdffe48); if (WxPayConfig::CURL_PROXY_HOST != '0.0.0.0' && WxPayConfig::CURL_PROXY_PORT != 0) { curl_setopt($sp9b0943, CURLOPT_PROXY, WxPayConfig::CURL_PROXY_HOST); curl_setopt($sp9b0943, CURLOPT_PROXYPORT, WxPayConfig::CURL_PROXY_PORT); } curl_setopt($sp9b0943, CURLOPT_URL, $sp3db1b2); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp9b0943, CURLOPT_HEADER, FALSE); curl_setopt($sp9b0943, CURLOPT_RETURNTRANSFER, TRUE); if ($sp437a89 == true) { curl_setopt($sp9b0943, CURLOPT_SSLCERTTYPE, 'PEM'); curl_setopt($sp9b0943, CURLOPT_SSLCERT, WxPayConfig::SSLCERT_PATH); curl_setopt($sp9b0943, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($sp9b0943, CURLOPT_SSLKEY, WxPayConfig::SSLKEY_PATH); } else { curl_setopt($sp9b0943, CURLOPT_SSL_VERIFYPEER, false); } curl_setopt($sp9b0943, CURLOPT_POST, TRUE); curl_setopt($sp9b0943, CURLOPT_POSTFIELDS, $sp377bc6); $sp5aa598 = curl_exec($sp9b0943); if ($sp5aa598) { curl_close($sp9b0943); return $sp5aa598; } else { $sp13aa4d = curl_errno($sp9b0943); \WxLog::error('WxPat.Api.postXmlCurl Error: ' . curl_error($sp9b0943)); curl_close($sp9b0943); throw new WxPayException("curl出错,错误码: {$sp13aa4d}"); } } private static function getMillisecond() { $sp1e10f1 = explode(' ', microtime()); $sp1e10f1 = $sp1e10f1[1] . $sp1e10f1[0] * 1000; $sp8eda8f = explode('.', $sp1e10f1); $sp1e10f1 = $sp8eda8f[0]; return $sp1e10f1; } }
\ No newline at end of file
+require_once 'WxPay.Exception.php'; require_once 'WxPay.Config.php'; require_once 'WxPay.Data.php'; class WxPayApi { public static function unifiedOrder($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/pay/unifiedorder'; if (!$spb74b43->IsOut_trade_noSet()) { throw new WxPayException('缺少统一支付接口必填参数out_trade_no!'); } else { if (!$spb74b43->IsBodySet()) { throw new WxPayException('缺少统一支付接口必填参数body!'); } else { if (!$spb74b43->IsTotal_feeSet()) { throw new WxPayException('缺少统一支付接口必填参数total_fee!'); } else { if (!$spb74b43->IsTrade_typeSet()) { throw new WxPayException('缺少统一支付接口必填参数trade_type!'); } } } } if ($spb74b43->GetTrade_type() == 'JSAPI' && !$spb74b43->IsOpenidSet()) { throw new WxPayException('统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!'); } if ($spb74b43->GetTrade_type() == 'NATIVE' && !$spb74b43->IsProduct_idSet()) { throw new WxPayException('统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); if (@WxPayConfig::SUBAPPID) { $spb74b43->SetSub_appid(WxPayConfig::SUBAPPID); } if (@WxPayConfig::SUBMCHID) { $spb74b43->SetSub_mch_id(WxPayConfig::SUBMCHID); } $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function orderQuery($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/pay/orderquery'; if (!$spb74b43->IsOut_trade_noSet() && !$spb74b43->IsTransaction_idSet()) { throw new WxPayException('订单查询接口中,out_trade_no、transaction_id至少填一个!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); if (@WxPayConfig::SUBMCHID) { $spb74b43->SetSub_mch_id(WxPayConfig::SUBMCHID); } $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function closeOrder($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/pay/closeorder'; if (!$spb74b43->IsOut_trade_noSet()) { throw new WxPayException('订单查询接口中,out_trade_no必填!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function refund($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/secapi/pay/refund'; if (!$spb74b43->IsOut_trade_noSet() && !$spb74b43->IsTransaction_idSet()) { throw new WxPayException('退款申请接口中,out_trade_no、transaction_id至少填一个!'); } else { if (!$spb74b43->IsOut_refund_noSet()) { throw new WxPayException('退款申请接口中,缺少必填参数out_refund_no!'); } else { if (!$spb74b43->IsTotal_feeSet()) { throw new WxPayException('退款申请接口中,缺少必填参数total_fee!'); } else { if (!$spb74b43->IsRefund_feeSet()) { throw new WxPayException('退款申请接口中,缺少必填参数refund_fee!'); } else { if (!$spb74b43->IsOp_user_idSet()) { throw new WxPayException('退款申请接口中,缺少必填参数op_user_id!'); } } } } } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, true, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function refundQuery($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/pay/refundquery'; if (!$spb74b43->IsOut_refund_noSet() && !$spb74b43->IsOut_trade_noSet() && !$spb74b43->IsTransaction_idSet() && !$spb74b43->IsRefund_idSet()) { throw new WxPayException('退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function downloadBill($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/pay/downloadbill'; if (!$spb74b43->IsBill_dateSet()) { throw new WxPayException('对账单接口中,缺少必填参数bill_date!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); if (substr($spdc5091, 0, 5) == '') { return ''; } return $spdc5091; } public static function micropay($spb74b43, $sp144767 = 10) { $spd2457c = 'https://api.mch.weixin.qq.com/pay/micropay'; if (!$spb74b43->IsBodySet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数body!'); } else { if (!$spb74b43->IsOut_trade_noSet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数out_trade_no!'); } else { if (!$spb74b43->IsTotal_feeSet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数total_fee!'); } else { if (!$spb74b43->IsAuth_codeSet()) { throw new WxPayException('提交被扫支付API接口中,缺少必填参数auth_code!'); } } } } $spb74b43->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']); $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function reverse($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/secapi/pay/reverse'; if (!$spb74b43->IsOut_trade_noSet() && !$spb74b43->IsTransaction_idSet()) { throw new WxPayException('撤销订单API接口中,参数out_trade_no和transaction_id必须填写一个!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, true, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function report($spb74b43, $sp144767 = 1) { $spd2457c = 'https://api.mch.weixin.qq.com/payitil/report'; if (!$spb74b43->IsInterface_urlSet()) { throw new WxPayException('接口URL,缺少必填参数interface_url!'); } if (!$spb74b43->IsReturn_codeSet()) { throw new WxPayException('返回状态码,缺少必填参数return_code!'); } if (!$spb74b43->IsResult_codeSet()) { throw new WxPayException('业务结果,缺少必填参数result_code!'); } if (!$spb74b43->IsUser_ipSet()) { throw new WxPayException('访问接口IP,缺少必填参数user_ip!'); } if (!$spb74b43->IsExecute_time_Set()) { throw new WxPayException('接口耗时,缺少必填参数execute_time_!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetUser_ip($_SERVER['REMOTE_ADDR']); $spb74b43->SetTime(date('YmdHis')); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); return $spdc5091; } public static function bizpayurl($spb74b43, $sp144767 = 6) { if (!$spb74b43->IsProduct_idSet()) { throw new WxPayException('生成二维码,缺少必填参数product_id!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetTime_stamp(time()); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); return $spb74b43->GetValues(); } public static function shorturl($spb74b43, $sp144767 = 6) { $spd2457c = 'https://api.mch.weixin.qq.com/tools/shorturl'; if (!$spb74b43->IsLong_urlSet()) { throw new WxPayException('需要转换的URL,签名用原串,传输需URL encode!'); } $spb74b43->SetAppid(WxPayConfig::APPID); $spb74b43->SetMch_id(WxPayConfig::MCHID); $spb74b43->SetNonce_str(self::getNonceStr()); $spb74b43->SetSign(); $sp87287d = $spb74b43->ToXml(); $sp9e0386 = self::getMillisecond(); $spdc5091 = self::postXmlCurl($sp87287d, $spd2457c, false, $sp144767); $spb72f32 = WxPayResults::Init($spdc5091); self::reportCostTime($spd2457c, $sp9e0386, $spb72f32); return $spb72f32; } public static function notify($sp84097e, &$sp417133) { $sp87287d = file_get_contents('php://input'); try { $spb72f32 = WxPayResults::Init($sp87287d); } catch (WxPayException $sp3f4aab) { $sp417133 = $sp3f4aab->errorMessage(); return false; } return call_user_func($sp84097e, $spb72f32); } public static function getNonceStr($sp8dab90 = 32) { $sp1650b8 = 'abcdefghijklmnopqrstuvwxyz0123456789'; $sp14800d = ''; for ($sp6b283c = 0; $sp6b283c < $sp8dab90; $sp6b283c++) { $sp14800d .= substr($sp1650b8, mt_rand(0, strlen($sp1650b8) - 1), 1); } return $sp14800d; } public static function replyNotify($sp87287d) { echo $sp87287d; } private static function reportCostTime($spd2457c, $sp9e0386, $sp6fd648) { if (WxPayConfig::REPORT_LEVENL == 0) { return; } if (WxPayConfig::REPORT_LEVENL == 1 && array_key_exists('return_code', $sp6fd648) && $sp6fd648['return_code'] == 'SUCCESS' && array_key_exists('result_code', $sp6fd648) && $sp6fd648['result_code'] == 'SUCCESS') { return; } $spef4af2 = self::getMillisecond(); $spa0189f = new WxPayReport(); $spa0189f->SetInterface_url($spd2457c); $spa0189f->SetExecute_time_($spef4af2 - $sp9e0386); if (array_key_exists('return_code', $sp6fd648)) { $spa0189f->SetReturn_code($sp6fd648['return_code']); } if (array_key_exists('return_msg', $sp6fd648)) { $spa0189f->SetReturn_msg($sp6fd648['return_msg']); } if (array_key_exists('result_code', $sp6fd648)) { $spa0189f->SetResult_code($sp6fd648['result_code']); } if (array_key_exists('err_code', $sp6fd648)) { $spa0189f->SetErr_code($sp6fd648['err_code']); } if (array_key_exists('err_code_des', $sp6fd648)) { $spa0189f->SetErr_code_des($sp6fd648['err_code_des']); } if (array_key_exists('out_trade_no', $sp6fd648)) { $spa0189f->SetOut_trade_no($sp6fd648['out_trade_no']); } if (array_key_exists('device_info', $sp6fd648)) { $spa0189f->SetDevice_info($sp6fd648['device_info']); } try { self::report($spa0189f); } catch (WxPayException $sp3f4aab) { } } private static function postXmlCurl($sp87287d, $spd2457c, $spede4ee = false, $sp2bbc73 = 30) { $sp9f83d6 = curl_init(); curl_setopt($sp9f83d6, CURLOPT_TIMEOUT, $sp2bbc73); if (WxPayConfig::CURL_PROXY_HOST != '0.0.0.0' && WxPayConfig::CURL_PROXY_PORT != 0) { curl_setopt($sp9f83d6, CURLOPT_PROXY, WxPayConfig::CURL_PROXY_HOST); curl_setopt($sp9f83d6, CURLOPT_PROXYPORT, WxPayConfig::CURL_PROXY_PORT); } curl_setopt($sp9f83d6, CURLOPT_URL, $spd2457c); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($sp9f83d6, CURLOPT_HEADER, FALSE); curl_setopt($sp9f83d6, CURLOPT_RETURNTRANSFER, TRUE); if ($spede4ee == true) { curl_setopt($sp9f83d6, CURLOPT_SSLCERTTYPE, 'PEM'); curl_setopt($sp9f83d6, CURLOPT_SSLCERT, WxPayConfig::SSLCERT_PATH); curl_setopt($sp9f83d6, CURLOPT_SSLKEYTYPE, 'PEM'); curl_setopt($sp9f83d6, CURLOPT_SSLKEY, WxPayConfig::SSLKEY_PATH); } else { curl_setopt($sp9f83d6, CURLOPT_SSL_VERIFYPEER, false); } curl_setopt($sp9f83d6, CURLOPT_POST, TRUE); curl_setopt($sp9f83d6, CURLOPT_POSTFIELDS, $sp87287d); $sp6fd648 = curl_exec($sp9f83d6); if ($sp6fd648) { curl_close($sp9f83d6); return $sp6fd648; } else { $sp9ad762 = curl_errno($sp9f83d6); \WxLog::error('WxPat.Api.postXmlCurl Error: ' . curl_error($sp9f83d6)); curl_close($sp9f83d6); throw new WxPayException("curl出错,错误码: {$sp9ad762}"); } } private static function getMillisecond() { $spe66dbc = explode(' ', microtime()); $spe66dbc = $spe66dbc[1] . $spe66dbc[0] * 1000; $sp24794b = explode('.', $spe66dbc); $spe66dbc = $sp24794b[0]; return $spe66dbc; } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/lib/WxPay.Data.php b/app/Library/Pay/WeChat/lib/WxPay.Data.php
index 818c608bb..8ae1801e8 100644
--- a/app/Library/Pay/WeChat/lib/WxPay.Data.php
+++ b/app/Library/Pay/WeChat/lib/WxPay.Data.php
@@ -1,2 +1,2 @@
MakeSign(); $this->values['sign'] = $spa109d2; return $spa109d2; } public function GetSign() { return $this->values['sign']; } public function IsSignSet() { return array_key_exists('sign', $this->values); } public function ToXml() { if (!is_array($this->values) || count($this->values) <= 0) { throw new WxPayException('数组数据异常!'); } $sp377bc6 = ''; foreach ($this->values as $sp1ed429 => $sp36ecf9) { if (is_numeric($sp36ecf9)) { $sp377bc6 .= '<' . $sp1ed429 . '>' . $sp36ecf9 . '' . $sp1ed429 . '>'; } else { $sp377bc6 .= '<' . $sp1ed429 . '>' . $sp1ed429 . '>'; } } $sp377bc6 .= ''; return $sp377bc6; } public function FromXml($sp377bc6) { if (!$sp377bc6) { throw new WxPayException('xml数据异常!'); } libxml_disable_entity_loader(true); $this->values = json_decode(json_encode(simplexml_load_string($sp377bc6, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $this->values; } public function ToUrlParams() { $spfe4a9e = ''; foreach ($this->values as $spce2336 => $sp39a929) { if ($spce2336 != 'sign' && $sp39a929 != '' && !is_array($sp39a929)) { $spfe4a9e .= $spce2336 . '=' . $sp39a929 . '&'; } } $spfe4a9e = trim($spfe4a9e, '&'); return $spfe4a9e; } public function MakeSign() { ksort($this->values); $sp9ad127 = $this->ToUrlParams(); $sp9ad127 = $sp9ad127 . '&key=' . WxPayConfig::KEY; $sp9ad127 = md5($sp9ad127); $spbbda25 = strtoupper($sp9ad127); return $spbbda25; } public function GetValues() { return $this->values; } } class WxPayResults extends WxPayDataBase { public function CheckSign() { if (!$this->IsSignSet()) { throw new WxPayException('签名错误!'); } $spa109d2 = $this->MakeSign(); if ($this->GetSign() == $spa109d2) { return true; } throw new WxPayException('签名错误!'); } public function FromArray($spab2619) { $this->values = $spab2619; } public static function InitFromArray($spab2619, $sp826051 = false) { $spd217ee = new self(); $spd217ee->FromArray($spab2619); if ($sp826051 == false) { $spd217ee->CheckSign(); } return $spd217ee; } public function SetData($sp1ed429, $spb914e6) { $this->values[$sp1ed429] = $spb914e6; } public static function Init($sp377bc6) { $spd217ee = new self(); $spd217ee->FromXml($sp377bc6); if ($spd217ee->values['return_code'] != 'SUCCESS') { return $spd217ee->GetValues(); } $spd217ee->CheckSign(); return $spd217ee->GetValues(); } } class WxPayNotifyReply extends WxPayDataBase { public function SetReturn_code($spa9742a) { $this->values['return_code'] = $spa9742a; } public function GetReturn_code() { return $this->values['return_code']; } public function SetReturn_msg($spaff00f) { $this->values['return_msg'] = $spaff00f; } public function GetReturn_msg() { return $this->values['return_msg']; } public function SetData($sp1ed429, $spb914e6) { $this->values[$sp1ed429] = $spb914e6; } } class WxPayUnifiedOrder extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function SetSub_appid($spb914e6) { $this->values['sub_appid'] = $spb914e6; } public function GetSub_appid() { return $this->values['sub_appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetSub_mch_id($spb914e6) { $this->values['sub_mch_id'] = $spb914e6; } public function GetSub_mch_id() { return $this->values['sub_mch_id']; } public function SetDevice_info($spb914e6) { $this->values['device_info'] = $spb914e6; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetBody($spb914e6) { $this->values['body'] = $spb914e6; } public function GetBody() { return $this->values['body']; } public function IsBodySet() { return array_key_exists('body', $this->values); } public function SetDetail($spb914e6) { $this->values['detail'] = $spb914e6; } public function GetDetail() { return $this->values['detail']; } public function IsDetailSet() { return array_key_exists('detail', $this->values); } public function SetAttach($spb914e6) { $this->values['attach'] = $spb914e6; } public function GetAttach() { return $this->values['attach']; } public function IsAttachSet() { return array_key_exists('attach', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetFee_type($spb914e6) { $this->values['fee_type'] = $spb914e6; } public function GetFee_type() { return $this->values['fee_type']; } public function IsFee_typeSet() { return array_key_exists('fee_type', $this->values); } public function SetTotal_fee($spb914e6) { $this->values['total_fee'] = $spb914e6; } public function GetTotal_fee() { return $this->values['total_fee']; } public function IsTotal_feeSet() { return array_key_exists('total_fee', $this->values); } public function SetSpbill_create_ip($spb914e6) { $this->values['spbill_create_ip'] = $spb914e6; } public function GetSpbill_create_ip() { return $this->values['spbill_create_ip']; } public function IsSpbill_create_ipSet() { return array_key_exists('spbill_create_ip', $this->values); } public function SetTime_start($spb914e6) { $this->values['time_start'] = $spb914e6; } public function GetTime_start() { return $this->values['time_start']; } public function IsTime_startSet() { return array_key_exists('time_start', $this->values); } public function SetTime_expire($spb914e6) { $this->values['time_expire'] = $spb914e6; } public function GetTime_expire() { return $this->values['time_expire']; } public function IsTime_expireSet() { return array_key_exists('time_expire', $this->values); } public function SetGoods_tag($spb914e6) { $this->values['goods_tag'] = $spb914e6; } public function GetGoods_tag() { return $this->values['goods_tag']; } public function IsGoods_tagSet() { return array_key_exists('goods_tag', $this->values); } public function SetNotify_url($spb914e6) { $this->values['notify_url'] = $spb914e6; } public function GetNotify_url() { return $this->values['notify_url']; } public function SetTrade_type($spb914e6) { $this->values['trade_type'] = $spb914e6; } public function GetTrade_type() { return $this->values['trade_type']; } public function IsTrade_typeSet() { return array_key_exists('trade_type', $this->values); } public function SetProduct_id($spb914e6) { $this->values['product_id'] = $spb914e6; } public function GetProduct_id() { return $this->values['product_id']; } public function IsProduct_idSet() { return array_key_exists('product_id', $this->values); } public function SetOpenid($spb914e6) { $this->values['openid'] = $spb914e6; } public function GetOpenid() { return $this->values['openid']; } public function IsOpenidSet() { return array_key_exists('openid', $this->values); } public function SetScene_info($spb914e6) { $this->values['scene_info'] = $spb914e6; } public function IsScene_info() { return array_key_exists('scene_info', $this->values); } } class WxPayOrderQuery extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetSub_mch_id($spb914e6) { $this->values['sub_mch_id'] = $spb914e6; } public function GetSub_mch_id() { return $this->values['sub_mch_id']; } public function SetTransaction_id($spb914e6) { $this->values['transaction_id'] = $spb914e6; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayCloseOrder extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayRefund extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($spb914e6) { $this->values['device_info'] = $spb914e6; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetTransaction_id($spb914e6) { $this->values['transaction_id'] = $spb914e6; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetOut_refund_no($spb914e6) { $this->values['out_refund_no'] = $spb914e6; } public function GetOut_refund_no() { return $this->values['out_refund_no']; } public function IsOut_refund_noSet() { return array_key_exists('out_refund_no', $this->values); } public function SetTotal_fee($spb914e6) { $this->values['total_fee'] = $spb914e6; } public function GetTotal_fee() { return $this->values['total_fee']; } public function IsTotal_feeSet() { return array_key_exists('total_fee', $this->values); } public function SetRefund_fee($spb914e6) { $this->values['refund_fee'] = $spb914e6; } public function GetRefund_fee() { return $this->values['refund_fee']; } public function IsRefund_feeSet() { return array_key_exists('refund_fee', $this->values); } public function SetRefund_fee_type($spb914e6) { $this->values['refund_fee_type'] = $spb914e6; } public function GetRefund_fee_type() { return $this->values['refund_fee_type']; } public function IsRefund_fee_typeSet() { return array_key_exists('refund_fee_type', $this->values); } public function SetOp_user_id($spb914e6) { $this->values['op_user_id'] = $spb914e6; } public function GetOp_user_id() { return $this->values['op_user_id']; } public function IsOp_user_idSet() { return array_key_exists('op_user_id', $this->values); } } class WxPayRefundQuery extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($spb914e6) { $this->values['device_info'] = $spb914e6; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetTransaction_id($spb914e6) { $this->values['transaction_id'] = $spb914e6; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetOut_refund_no($spb914e6) { $this->values['out_refund_no'] = $spb914e6; } public function GetOut_refund_no() { return $this->values['out_refund_no']; } public function IsOut_refund_noSet() { return array_key_exists('out_refund_no', $this->values); } public function SetRefund_id($spb914e6) { $this->values['refund_id'] = $spb914e6; } public function GetRefund_id() { return $this->values['refund_id']; } public function IsRefund_idSet() { return array_key_exists('refund_id', $this->values); } } class WxPayDownloadBill extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($spb914e6) { $this->values['device_info'] = $spb914e6; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetBill_date($spb914e6) { $this->values['bill_date'] = $spb914e6; } public function GetBill_date() { return $this->values['bill_date']; } public function IsBill_dateSet() { return array_key_exists('bill_date', $this->values); } public function SetBill_type($spb914e6) { $this->values['bill_type'] = $spb914e6; } public function GetBill_type() { return $this->values['bill_type']; } public function IsBill_typeSet() { return array_key_exists('bill_type', $this->values); } } class WxPayReport extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($spb914e6) { $this->values['device_info'] = $spb914e6; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetInterface_url($spb914e6) { $this->values['interface_url'] = $spb914e6; } public function GetInterface_url() { return $this->values['interface_url']; } public function IsInterface_urlSet() { return array_key_exists('interface_url', $this->values); } public function SetExecute_time_($spb914e6) { $this->values['execute_time_'] = $spb914e6; } public function GetExecute_time_() { return $this->values['execute_time_']; } public function IsExecute_time_Set() { return array_key_exists('execute_time_', $this->values); } public function SetReturn_code($spb914e6) { $this->values['return_code'] = $spb914e6; } public function GetReturn_code() { return $this->values['return_code']; } public function IsReturn_codeSet() { return array_key_exists('return_code', $this->values); } public function SetReturn_msg($spb914e6) { $this->values['return_msg'] = $spb914e6; } public function GetReturn_msg() { return $this->values['return_msg']; } public function IsReturn_msgSet() { return array_key_exists('return_msg', $this->values); } public function SetResult_code($spb914e6) { $this->values['result_code'] = $spb914e6; } public function GetResult_code() { return $this->values['result_code']; } public function IsResult_codeSet() { return array_key_exists('result_code', $this->values); } public function SetErr_code($spb914e6) { $this->values['err_code'] = $spb914e6; } public function GetErr_code() { return $this->values['err_code']; } public function IsErr_codeSet() { return array_key_exists('err_code', $this->values); } public function SetErr_code_des($spb914e6) { $this->values['err_code_des'] = $spb914e6; } public function GetErr_code_des() { return $this->values['err_code_des']; } public function IsErr_code_desSet() { return array_key_exists('err_code_des', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetUser_ip($spb914e6) { $this->values['user_ip'] = $spb914e6; } public function GetUser_ip() { return $this->values['user_ip']; } public function IsUser_ipSet() { return array_key_exists('user_ip', $this->values); } public function SetTime($spb914e6) { $this->values['time'] = $spb914e6; } public function GetTime() { return $this->values['time']; } public function IsTimeSet() { return array_key_exists('time', $this->values); } } class WxPayShortUrl extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetLong_url($spb914e6) { $this->values['long_url'] = $spb914e6; } public function GetLong_url() { return $this->values['long_url']; } public function IsLong_urlSet() { return array_key_exists('long_url', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayMicroPay extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($spb914e6) { $this->values['device_info'] = $spb914e6; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetBody($spb914e6) { $this->values['body'] = $spb914e6; } public function GetBody() { return $this->values['body']; } public function IsBodySet() { return array_key_exists('body', $this->values); } public function SetDetail($spb914e6) { $this->values['detail'] = $spb914e6; } public function GetDetail() { return $this->values['detail']; } public function IsDetailSet() { return array_key_exists('detail', $this->values); } public function SetAttach($spb914e6) { $this->values['attach'] = $spb914e6; } public function GetAttach() { return $this->values['attach']; } public function IsAttachSet() { return array_key_exists('attach', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetTotal_fee($spb914e6) { $this->values['total_fee'] = $spb914e6; } public function GetTotal_fee() { return $this->values['total_fee']; } public function IsTotal_feeSet() { return array_key_exists('total_fee', $this->values); } public function SetFee_type($spb914e6) { $this->values['fee_type'] = $spb914e6; } public function GetFee_type() { return $this->values['fee_type']; } public function IsFee_typeSet() { return array_key_exists('fee_type', $this->values); } public function SetSpbill_create_ip($spb914e6) { $this->values['spbill_create_ip'] = $spb914e6; } public function GetSpbill_create_ip() { return $this->values['spbill_create_ip']; } public function IsSpbill_create_ipSet() { return array_key_exists('spbill_create_ip', $this->values); } public function SetTime_start($spb914e6) { $this->values['time_start'] = $spb914e6; } public function GetTime_start() { return $this->values['time_start']; } public function IsTime_startSet() { return array_key_exists('time_start', $this->values); } public function SetTime_expire($spb914e6) { $this->values['time_expire'] = $spb914e6; } public function GetTime_expire() { return $this->values['time_expire']; } public function IsTime_expireSet() { return array_key_exists('time_expire', $this->values); } public function SetGoods_tag($spb914e6) { $this->values['goods_tag'] = $spb914e6; } public function GetGoods_tag() { return $this->values['goods_tag']; } public function IsGoods_tagSet() { return array_key_exists('goods_tag', $this->values); } public function SetAuth_code($spb914e6) { $this->values['auth_code'] = $spb914e6; } public function GetAuth_code() { return $this->values['auth_code']; } public function IsAuth_codeSet() { return array_key_exists('auth_code', $this->values); } } class WxPayReverse extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetTransaction_id($spb914e6) { $this->values['transaction_id'] = $spb914e6; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($spb914e6) { $this->values['out_trade_no'] = $spb914e6; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayJsApiPay extends WxPayDataBase { public function FromArray($spab2619) { $this->values = $spab2619; } public function SetAppid($spb914e6) { $this->values['appId'] = $spb914e6; } public function GetAppid() { return $this->values['appId']; } public function IsAppidSet() { return array_key_exists('appId', $this->values); } public function SetTimeStamp($spb914e6) { $this->values['timeStamp'] = $spb914e6; } public function GetTimeStamp() { return $this->values['timeStamp']; } public function IsTimeStampSet() { return array_key_exists('timeStamp', $this->values); } public function SetNonceStr($spb914e6) { $this->values['nonceStr'] = $spb914e6; } public function GetReturn_code() { return $this->values['nonceStr']; } public function IsReturn_codeSet() { return array_key_exists('nonceStr', $this->values); } public function SetPackage($spb914e6) { $this->values['package'] = $spb914e6; } public function GetPackage() { return $this->values['package']; } public function IsPackageSet() { return array_key_exists('package', $this->values); } public function SetSignType($spb914e6) { $this->values['signType'] = $spb914e6; } public function GetSignType() { return $this->values['signType']; } public function IsSignTypeSet() { return array_key_exists('signType', $this->values); } public function SetPaySign($spb914e6) { $this->values['paySign'] = $spb914e6; } public function GetPaySign() { return $this->values['paySign']; } public function IsPaySignSet() { return array_key_exists('paySign', $this->values); } } class WxPayBizPayUrl extends WxPayDataBase { public function SetAppid($spb914e6) { $this->values['appid'] = $spb914e6; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($spb914e6) { $this->values['mch_id'] = $spb914e6; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetTime_stamp($spb914e6) { $this->values['time_stamp'] = $spb914e6; } public function GetTime_stamp() { return $this->values['time_stamp']; } public function IsTime_stampSet() { return array_key_exists('time_stamp', $this->values); } public function SetNonce_str($spb914e6) { $this->values['nonce_str'] = $spb914e6; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetProduct_id($spb914e6) { $this->values['product_id'] = $spb914e6; } public function GetProduct_id() { return $this->values['product_id']; } public function IsProduct_idSet() { return array_key_exists('product_id', $this->values); } }
\ No newline at end of file
+require_once 'WxPay.Config.php'; require_once 'WxPay.Exception.php'; class WxPayDataBase { protected $values = array(); public function SetSign() { $sp964415 = $this->MakeSign(); $this->values['sign'] = $sp964415; return $sp964415; } public function GetSign() { return $this->values['sign']; } public function IsSignSet() { return array_key_exists('sign', $this->values); } public function ToXml() { if (!is_array($this->values) || count($this->values) <= 0) { throw new WxPayException('数组数据异常!'); } $sp87287d = ''; foreach ($this->values as $spf1241f => $sp91e29b) { if (is_numeric($sp91e29b)) { $sp87287d .= '<' . $spf1241f . '>' . $sp91e29b . '' . $spf1241f . '>'; } else { $sp87287d .= '<' . $spf1241f . '>' . $spf1241f . '>'; } } $sp87287d .= ''; return $sp87287d; } public function FromXml($sp87287d) { if (!$sp87287d) { throw new WxPayException('xml数据异常!'); } libxml_disable_entity_loader(true); $this->values = json_decode(json_encode(simplexml_load_string($sp87287d, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $this->values; } public function ToUrlParams() { $sp37ee7b = ''; foreach ($this->values as $sp17f3a7 => $sp75c248) { if ($sp17f3a7 != 'sign' && $sp75c248 != '' && !is_array($sp75c248)) { $sp37ee7b .= $sp17f3a7 . '=' . $sp75c248 . '&'; } } $sp37ee7b = trim($sp37ee7b, '&'); return $sp37ee7b; } public function MakeSign() { ksort($this->values); $sp29fcf1 = $this->ToUrlParams(); $sp29fcf1 = $sp29fcf1 . '&key=' . WxPayConfig::KEY; $sp29fcf1 = md5($sp29fcf1); $spb72f32 = strtoupper($sp29fcf1); return $spb72f32; } public function GetValues() { return $this->values; } } class WxPayResults extends WxPayDataBase { public function CheckSign() { if (!$this->IsSignSet()) { throw new WxPayException('签名错误!'); } $sp964415 = $this->MakeSign(); if ($this->GetSign() == $sp964415) { return true; } throw new WxPayException('签名错误!'); } public function FromArray($spdc17ed) { $this->values = $spdc17ed; } public static function InitFromArray($spdc17ed, $sp5cdd11 = false) { $sp6dc73d = new self(); $sp6dc73d->FromArray($spdc17ed); if ($sp5cdd11 == false) { $sp6dc73d->CheckSign(); } return $sp6dc73d; } public function SetData($spf1241f, $sp8b9401) { $this->values[$spf1241f] = $sp8b9401; } public static function Init($sp87287d) { $sp6dc73d = new self(); $sp6dc73d->FromXml($sp87287d); if ($sp6dc73d->values['return_code'] != 'SUCCESS') { return $sp6dc73d->GetValues(); } $sp6dc73d->CheckSign(); return $sp6dc73d->GetValues(); } } class WxPayNotifyReply extends WxPayDataBase { public function SetReturn_code($sp008c10) { $this->values['return_code'] = $sp008c10; } public function GetReturn_code() { return $this->values['return_code']; } public function SetReturn_msg($sp929a80) { $this->values['return_msg'] = $sp929a80; } public function GetReturn_msg() { return $this->values['return_msg']; } public function SetData($spf1241f, $sp8b9401) { $this->values[$spf1241f] = $sp8b9401; } } class WxPayUnifiedOrder extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function SetSub_appid($sp8b9401) { $this->values['sub_appid'] = $sp8b9401; } public function GetSub_appid() { return $this->values['sub_appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetSub_mch_id($sp8b9401) { $this->values['sub_mch_id'] = $sp8b9401; } public function GetSub_mch_id() { return $this->values['sub_mch_id']; } public function SetDevice_info($sp8b9401) { $this->values['device_info'] = $sp8b9401; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetBody($sp8b9401) { $this->values['body'] = $sp8b9401; } public function GetBody() { return $this->values['body']; } public function IsBodySet() { return array_key_exists('body', $this->values); } public function SetDetail($sp8b9401) { $this->values['detail'] = $sp8b9401; } public function GetDetail() { return $this->values['detail']; } public function IsDetailSet() { return array_key_exists('detail', $this->values); } public function SetAttach($sp8b9401) { $this->values['attach'] = $sp8b9401; } public function GetAttach() { return $this->values['attach']; } public function IsAttachSet() { return array_key_exists('attach', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetFee_type($sp8b9401) { $this->values['fee_type'] = $sp8b9401; } public function GetFee_type() { return $this->values['fee_type']; } public function IsFee_typeSet() { return array_key_exists('fee_type', $this->values); } public function SetTotal_fee($sp8b9401) { $this->values['total_fee'] = $sp8b9401; } public function GetTotal_fee() { return $this->values['total_fee']; } public function IsTotal_feeSet() { return array_key_exists('total_fee', $this->values); } public function SetSpbill_create_ip($sp8b9401) { $this->values['spbill_create_ip'] = $sp8b9401; } public function GetSpbill_create_ip() { return $this->values['spbill_create_ip']; } public function IsSpbill_create_ipSet() { return array_key_exists('spbill_create_ip', $this->values); } public function SetTime_start($sp8b9401) { $this->values['time_start'] = $sp8b9401; } public function GetTime_start() { return $this->values['time_start']; } public function IsTime_startSet() { return array_key_exists('time_start', $this->values); } public function SetTime_expire($sp8b9401) { $this->values['time_expire'] = $sp8b9401; } public function GetTime_expire() { return $this->values['time_expire']; } public function IsTime_expireSet() { return array_key_exists('time_expire', $this->values); } public function SetGoods_tag($sp8b9401) { $this->values['goods_tag'] = $sp8b9401; } public function GetGoods_tag() { return $this->values['goods_tag']; } public function IsGoods_tagSet() { return array_key_exists('goods_tag', $this->values); } public function SetNotify_url($sp8b9401) { $this->values['notify_url'] = $sp8b9401; } public function GetNotify_url() { return $this->values['notify_url']; } public function SetTrade_type($sp8b9401) { $this->values['trade_type'] = $sp8b9401; } public function GetTrade_type() { return $this->values['trade_type']; } public function IsTrade_typeSet() { return array_key_exists('trade_type', $this->values); } public function SetProduct_id($sp8b9401) { $this->values['product_id'] = $sp8b9401; } public function GetProduct_id() { return $this->values['product_id']; } public function IsProduct_idSet() { return array_key_exists('product_id', $this->values); } public function SetOpenid($sp8b9401) { $this->values['openid'] = $sp8b9401; } public function GetOpenid() { return $this->values['openid']; } public function IsOpenidSet() { return array_key_exists('openid', $this->values); } public function SetScene_info($sp8b9401) { $this->values['scene_info'] = $sp8b9401; } public function IsScene_info() { return array_key_exists('scene_info', $this->values); } } class WxPayOrderQuery extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetSub_mch_id($sp8b9401) { $this->values['sub_mch_id'] = $sp8b9401; } public function GetSub_mch_id() { return $this->values['sub_mch_id']; } public function SetTransaction_id($sp8b9401) { $this->values['transaction_id'] = $sp8b9401; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayCloseOrder extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayRefund extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($sp8b9401) { $this->values['device_info'] = $sp8b9401; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetTransaction_id($sp8b9401) { $this->values['transaction_id'] = $sp8b9401; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetOut_refund_no($sp8b9401) { $this->values['out_refund_no'] = $sp8b9401; } public function GetOut_refund_no() { return $this->values['out_refund_no']; } public function IsOut_refund_noSet() { return array_key_exists('out_refund_no', $this->values); } public function SetTotal_fee($sp8b9401) { $this->values['total_fee'] = $sp8b9401; } public function GetTotal_fee() { return $this->values['total_fee']; } public function IsTotal_feeSet() { return array_key_exists('total_fee', $this->values); } public function SetRefund_fee($sp8b9401) { $this->values['refund_fee'] = $sp8b9401; } public function GetRefund_fee() { return $this->values['refund_fee']; } public function IsRefund_feeSet() { return array_key_exists('refund_fee', $this->values); } public function SetRefund_fee_type($sp8b9401) { $this->values['refund_fee_type'] = $sp8b9401; } public function GetRefund_fee_type() { return $this->values['refund_fee_type']; } public function IsRefund_fee_typeSet() { return array_key_exists('refund_fee_type', $this->values); } public function SetOp_user_id($sp8b9401) { $this->values['op_user_id'] = $sp8b9401; } public function GetOp_user_id() { return $this->values['op_user_id']; } public function IsOp_user_idSet() { return array_key_exists('op_user_id', $this->values); } } class WxPayRefundQuery extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($sp8b9401) { $this->values['device_info'] = $sp8b9401; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetTransaction_id($sp8b9401) { $this->values['transaction_id'] = $sp8b9401; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetOut_refund_no($sp8b9401) { $this->values['out_refund_no'] = $sp8b9401; } public function GetOut_refund_no() { return $this->values['out_refund_no']; } public function IsOut_refund_noSet() { return array_key_exists('out_refund_no', $this->values); } public function SetRefund_id($sp8b9401) { $this->values['refund_id'] = $sp8b9401; } public function GetRefund_id() { return $this->values['refund_id']; } public function IsRefund_idSet() { return array_key_exists('refund_id', $this->values); } } class WxPayDownloadBill extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($sp8b9401) { $this->values['device_info'] = $sp8b9401; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetBill_date($sp8b9401) { $this->values['bill_date'] = $sp8b9401; } public function GetBill_date() { return $this->values['bill_date']; } public function IsBill_dateSet() { return array_key_exists('bill_date', $this->values); } public function SetBill_type($sp8b9401) { $this->values['bill_type'] = $sp8b9401; } public function GetBill_type() { return $this->values['bill_type']; } public function IsBill_typeSet() { return array_key_exists('bill_type', $this->values); } } class WxPayReport extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($sp8b9401) { $this->values['device_info'] = $sp8b9401; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetInterface_url($sp8b9401) { $this->values['interface_url'] = $sp8b9401; } public function GetInterface_url() { return $this->values['interface_url']; } public function IsInterface_urlSet() { return array_key_exists('interface_url', $this->values); } public function SetExecute_time_($sp8b9401) { $this->values['execute_time_'] = $sp8b9401; } public function GetExecute_time_() { return $this->values['execute_time_']; } public function IsExecute_time_Set() { return array_key_exists('execute_time_', $this->values); } public function SetReturn_code($sp8b9401) { $this->values['return_code'] = $sp8b9401; } public function GetReturn_code() { return $this->values['return_code']; } public function IsReturn_codeSet() { return array_key_exists('return_code', $this->values); } public function SetReturn_msg($sp8b9401) { $this->values['return_msg'] = $sp8b9401; } public function GetReturn_msg() { return $this->values['return_msg']; } public function IsReturn_msgSet() { return array_key_exists('return_msg', $this->values); } public function SetResult_code($sp8b9401) { $this->values['result_code'] = $sp8b9401; } public function GetResult_code() { return $this->values['result_code']; } public function IsResult_codeSet() { return array_key_exists('result_code', $this->values); } public function SetErr_code($sp8b9401) { $this->values['err_code'] = $sp8b9401; } public function GetErr_code() { return $this->values['err_code']; } public function IsErr_codeSet() { return array_key_exists('err_code', $this->values); } public function SetErr_code_des($sp8b9401) { $this->values['err_code_des'] = $sp8b9401; } public function GetErr_code_des() { return $this->values['err_code_des']; } public function IsErr_code_desSet() { return array_key_exists('err_code_des', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetUser_ip($sp8b9401) { $this->values['user_ip'] = $sp8b9401; } public function GetUser_ip() { return $this->values['user_ip']; } public function IsUser_ipSet() { return array_key_exists('user_ip', $this->values); } public function SetTime($sp8b9401) { $this->values['time'] = $sp8b9401; } public function GetTime() { return $this->values['time']; } public function IsTimeSet() { return array_key_exists('time', $this->values); } } class WxPayShortUrl extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetLong_url($sp8b9401) { $this->values['long_url'] = $sp8b9401; } public function GetLong_url() { return $this->values['long_url']; } public function IsLong_urlSet() { return array_key_exists('long_url', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayMicroPay extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetDevice_info($sp8b9401) { $this->values['device_info'] = $sp8b9401; } public function GetDevice_info() { return $this->values['device_info']; } public function IsDevice_infoSet() { return array_key_exists('device_info', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetBody($sp8b9401) { $this->values['body'] = $sp8b9401; } public function GetBody() { return $this->values['body']; } public function IsBodySet() { return array_key_exists('body', $this->values); } public function SetDetail($sp8b9401) { $this->values['detail'] = $sp8b9401; } public function GetDetail() { return $this->values['detail']; } public function IsDetailSet() { return array_key_exists('detail', $this->values); } public function SetAttach($sp8b9401) { $this->values['attach'] = $sp8b9401; } public function GetAttach() { return $this->values['attach']; } public function IsAttachSet() { return array_key_exists('attach', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetTotal_fee($sp8b9401) { $this->values['total_fee'] = $sp8b9401; } public function GetTotal_fee() { return $this->values['total_fee']; } public function IsTotal_feeSet() { return array_key_exists('total_fee', $this->values); } public function SetFee_type($sp8b9401) { $this->values['fee_type'] = $sp8b9401; } public function GetFee_type() { return $this->values['fee_type']; } public function IsFee_typeSet() { return array_key_exists('fee_type', $this->values); } public function SetSpbill_create_ip($sp8b9401) { $this->values['spbill_create_ip'] = $sp8b9401; } public function GetSpbill_create_ip() { return $this->values['spbill_create_ip']; } public function IsSpbill_create_ipSet() { return array_key_exists('spbill_create_ip', $this->values); } public function SetTime_start($sp8b9401) { $this->values['time_start'] = $sp8b9401; } public function GetTime_start() { return $this->values['time_start']; } public function IsTime_startSet() { return array_key_exists('time_start', $this->values); } public function SetTime_expire($sp8b9401) { $this->values['time_expire'] = $sp8b9401; } public function GetTime_expire() { return $this->values['time_expire']; } public function IsTime_expireSet() { return array_key_exists('time_expire', $this->values); } public function SetGoods_tag($sp8b9401) { $this->values['goods_tag'] = $sp8b9401; } public function GetGoods_tag() { return $this->values['goods_tag']; } public function IsGoods_tagSet() { return array_key_exists('goods_tag', $this->values); } public function SetAuth_code($sp8b9401) { $this->values['auth_code'] = $sp8b9401; } public function GetAuth_code() { return $this->values['auth_code']; } public function IsAuth_codeSet() { return array_key_exists('auth_code', $this->values); } } class WxPayReverse extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetTransaction_id($sp8b9401) { $this->values['transaction_id'] = $sp8b9401; } public function GetTransaction_id() { return $this->values['transaction_id']; } public function IsTransaction_idSet() { return array_key_exists('transaction_id', $this->values); } public function SetOut_trade_no($sp8b9401) { $this->values['out_trade_no'] = $sp8b9401; } public function GetOut_trade_no() { return $this->values['out_trade_no']; } public function IsOut_trade_noSet() { return array_key_exists('out_trade_no', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } } class WxPayJsApiPay extends WxPayDataBase { public function FromArray($spdc17ed) { $this->values = $spdc17ed; } public function SetAppid($sp8b9401) { $this->values['appId'] = $sp8b9401; } public function GetAppid() { return $this->values['appId']; } public function IsAppidSet() { return array_key_exists('appId', $this->values); } public function SetTimeStamp($sp8b9401) { $this->values['timeStamp'] = $sp8b9401; } public function GetTimeStamp() { return $this->values['timeStamp']; } public function IsTimeStampSet() { return array_key_exists('timeStamp', $this->values); } public function SetNonceStr($sp8b9401) { $this->values['nonceStr'] = $sp8b9401; } public function GetReturn_code() { return $this->values['nonceStr']; } public function IsReturn_codeSet() { return array_key_exists('nonceStr', $this->values); } public function SetPackage($sp8b9401) { $this->values['package'] = $sp8b9401; } public function GetPackage() { return $this->values['package']; } public function IsPackageSet() { return array_key_exists('package', $this->values); } public function SetSignType($sp8b9401) { $this->values['signType'] = $sp8b9401; } public function GetSignType() { return $this->values['signType']; } public function IsSignTypeSet() { return array_key_exists('signType', $this->values); } public function SetPaySign($sp8b9401) { $this->values['paySign'] = $sp8b9401; } public function GetPaySign() { return $this->values['paySign']; } public function IsPaySignSet() { return array_key_exists('paySign', $this->values); } } class WxPayBizPayUrl extends WxPayDataBase { public function SetAppid($sp8b9401) { $this->values['appid'] = $sp8b9401; } public function GetAppid() { return $this->values['appid']; } public function IsAppidSet() { return array_key_exists('appid', $this->values); } public function SetMch_id($sp8b9401) { $this->values['mch_id'] = $sp8b9401; } public function GetMch_id() { return $this->values['mch_id']; } public function IsMch_idSet() { return array_key_exists('mch_id', $this->values); } public function SetTime_stamp($sp8b9401) { $this->values['time_stamp'] = $sp8b9401; } public function GetTime_stamp() { return $this->values['time_stamp']; } public function IsTime_stampSet() { return array_key_exists('time_stamp', $this->values); } public function SetNonce_str($sp8b9401) { $this->values['nonce_str'] = $sp8b9401; } public function GetNonce_str() { return $this->values['nonce_str']; } public function IsNonce_strSet() { return array_key_exists('nonce_str', $this->values); } public function SetProduct_id($sp8b9401) { $this->values['product_id'] = $sp8b9401; } public function GetProduct_id() { return $this->values['product_id']; } public function IsProduct_idSet() { return array_key_exists('product_id', $this->values); } }
\ No newline at end of file
diff --git a/app/Library/Pay/WeChat/lib/WxPay.Notify.php b/app/Library/Pay/WeChat/lib/WxPay.Notify.php
index d32190517..cd0d301bd 100644
--- a/app/Library/Pay/WeChat/lib/WxPay.Notify.php
+++ b/app/Library/Pay/WeChat/lib/WxPay.Notify.php
@@ -1,2 +1,2 @@
SetReturn_code('FAIL'); $this->SetReturn_msg($sp093e23); $this->ReplyNotify(false); return; } else { $this->SetReturn_code('SUCCESS'); $this->SetReturn_msg('OK'); } $this->ReplyNotify($spd879ed); } public function NotifyProcess($sp5aa598, &$sp093e23) { return true; } public final function NotifyCallBack($sp5aa598) { $sp093e23 = 'OK'; $spbbda25 = $this->NotifyProcess($sp5aa598, $sp093e23); if ($spbbda25 == true) { $this->SetReturn_code('SUCCESS'); $this->SetReturn_msg('OK'); } else { $this->SetReturn_code('FAIL'); $this->SetReturn_msg($sp093e23); } return $spbbda25; } private final function ReplyNotify($spd879ed = true) { if ($spd879ed == true && $this->GetReturn_code() == 'SUCCESS') { $this->SetSign(); } WxpayApi::replyNotify($this->ToXml()); } }
\ No newline at end of file
+class WxPayNotify extends WxPayNotifyReply { public final function Handle($spad580d = true) { $spb72f32 = WxpayApi::notify(array($this, 'NotifyCallBack'), $sp417133); if ($spb72f32 == false) { $this->SetReturn_code('FAIL'); $this->SetReturn_msg($sp417133); $this->ReplyNotify(false); return; } else { $this->SetReturn_code('SUCCESS'); $this->SetReturn_msg('OK'); } $this->ReplyNotify($spad580d); } public function NotifyProcess($sp6fd648, &$sp417133) { return true; } public final function NotifyCallBack($sp6fd648) { $sp417133 = 'OK'; $spb72f32 = $this->NotifyProcess($sp6fd648, $sp417133); if ($spb72f32 == true) { $this->SetReturn_code('SUCCESS'); $this->SetReturn_msg('OK'); } else { $this->SetReturn_code('FAIL'); $this->SetReturn_msg($sp417133); } return $spb72f32; } private final function ReplyNotify($spad580d = true) { if ($spad580d == true && $this->GetReturn_code() == 'SUCCESS') { $this->SetSign(); } WxpayApi::replyNotify($this->ToXml()); } }
\ No newline at end of file
diff --git a/app/Library/Pay/Yeke/Api.php b/app/Library/Pay/Yeke/Api.php
index 955899d15..1aa9c6066 100644
--- a/app/Library/Pay/Yeke/Api.php
+++ b/app/Library/Pay/Yeke/Api.php
@@ -1,2 +1,2 @@
url_notify = SYS_URL_API . '/pay/notify/' . $sp53f8aa; $this->url_return = SYS_URL . '/pay/return/' . $sp53f8aa; } function goPay($spbe80b7, $spa3e681, $sp45f07e, $sp873488, $sp5213ee) { $sp429fcc = sprintf('%.2f', $sp5213ee / 100); define('yeke_USER_ID', $spbe80b7['id']); define('yeke_USER_KEY', $spbe80b7['key']); define('yeke_USER_LOG_PREFIX', 'log'); define('yeke_API_GATE', 'http://www.yekepay.com/api/ApiGo.php'); $sp908e43 = strtolower($spbe80b7['payway']); $sp08d91e = ''; $sp3ab55a = ''; if ($sp908e43 == 'alipay' || $sp908e43 == 'alipay_wap') { $sp08d91e = 'alipay'; $sp3ab55a = 'ALIPAY'; } elseif ($sp908e43 == 'tenpay' || $sp908e43 == 'tenpay_wap') { $sp08d91e = 'tenpay'; $sp3ab55a = 'TENPAY'; } elseif ($sp908e43 == 'weixin') { $sp08d91e = 'weixin'; $sp3ab55a = 'WEIXIN'; } elseif ($sp908e43 == 'weixin_wap') { $sp08d91e = 'wxwap'; $sp3ab55a = 'wxwap'; } elseif ($sp908e43 == 'qq' || $sp908e43 == 'qq_wap') { $sp08d91e = 'sqzf'; $sp3ab55a = 'sqzf'; } elseif ($sp908e43 == 'qq_wap') { $sp08d91e = 'sqzfqb'; $sp3ab55a = 'sqzfqb'; } require 'yekeApiLib.php'; require 'HttpClient.php'; $sp45f07e = mb_substr($sp45f07e, 0, 50, 'UTF-8'); $sp873488 = mb_substr($sp873488, 0, 100, 'UTF-8'); $spa26894 = array('P_orderid' => $spa3e681, 'P_paymoney' => $sp429fcc, 'P_productname' => urlencode($sp45f07e), 'P_productinfo' => urlencode($sp873488), 'P_remark' => urlencode($spa3e681), 'P_custom_1' => urlencode($sp3ab55a), 'P_custom_2' => '', 'P_contact' => urlencode(SYS_NAME), 'P_paytype' => $sp08d91e, 'P_gateway' => $sp3ab55a, 'P_cardnum' => '', 'P_cardpwd' => '', 'P_cardvalue' => '', 'P_notify_url' => $this->url_notify, 'P_return_url' => $this->url_return . '/' . $spa3e681); $spb06608 = new \yekeAPI(); $spbbda25 = $spb06608->payGate($spa26894); echo $spbbda25; } function verify($spbe80b7, $sp04f0f8) { $sp3bce01 = isset($spbe80b7['isNotify']) && $spbe80b7['isNotify']; define('yeke_USER_ID', $spbe80b7['id']); define('yeke_USER_KEY', $spbe80b7['key']); define('yeke_USER_LOG_PREFIX', 'log'); define('yeke_API_GATE', 'http://www.yekepay.com/api/ApiGo.php'); require 'HttpClient.php'; require 'yekeApiLib.php'; $spb06608 = new \yekeAPI(); if ($sp3bce01) { $spbbda25 = $spb06608->verifyNotify(); } else { $spbbda25 = $spb06608->verifyReturn(); } if ($spbbda25) { $spe908b7 = $_REQUEST['P_orderid']; $spea6909 = $_REQUEST['P_api_orderid']; $sp6a858b = $_REQUEST['P_money']; if ($_REQUEST['P_status'] == 'SUCCESS') { $sp04f0f8($spea6909, (int) round($sp6a858b * 100), $spe908b7); if ($sp3bce01) { echo 'success'; } return true; } else { if ($sp3bce01) { echo '失败订单'; } } } else { if ($sp3bce01) { echo '验证失败'; } } return false; } }
\ No newline at end of file
+namespace App\Library\Pay\Yeke; use App\Library\Pay\ApiInterface; class Api implements ApiInterface { private $url_notify = ''; private $url_return = ''; public function __construct($sp3c46ab) { $this->url_notify = SYS_URL_API . '/pay/notify/' . $sp3c46ab; $this->url_return = SYS_URL . '/pay/return/' . $sp3c46ab; } function goPay($sp9d4382, $sp2e47fc, $spd4e90d, $spd0789a, $sp076ec7) { $spf59c91 = sprintf('%.2f', $sp076ec7 / 100); define('yeke_USER_ID', $sp9d4382['id']); define('yeke_USER_KEY', $sp9d4382['key']); define('yeke_USER_LOG_PREFIX', 'log'); define('yeke_API_GATE', 'http://www.yekepay.com/api/ApiGo.php'); $spf9ad85 = strtolower($sp9d4382['payway']); $sp257b4f = ''; $spcb9ea8 = ''; if ($spf9ad85 == 'alipay' || $spf9ad85 == 'alipay_wap') { $sp257b4f = 'alipay'; $spcb9ea8 = 'ALIPAY'; } elseif ($spf9ad85 == 'tenpay' || $spf9ad85 == 'tenpay_wap') { $sp257b4f = 'tenpay'; $spcb9ea8 = 'TENPAY'; } elseif ($spf9ad85 == 'weixin') { $sp257b4f = 'weixin'; $spcb9ea8 = 'WEIXIN'; } elseif ($spf9ad85 == 'weixin_wap') { $sp257b4f = 'wxwap'; $spcb9ea8 = 'wxwap'; } elseif ($spf9ad85 == 'qq' || $spf9ad85 == 'qq_wap') { $sp257b4f = 'sqzf'; $spcb9ea8 = 'sqzf'; } elseif ($spf9ad85 == 'qq_wap') { $sp257b4f = 'sqzfqb'; $spcb9ea8 = 'sqzfqb'; } require 'yekeApiLib.php'; require 'HttpClient.php'; $spd4e90d = mb_substr($spd4e90d, 0, 50, 'UTF-8'); $spd0789a = mb_substr($spd0789a, 0, 100, 'UTF-8'); $spc0e525 = array('P_orderid' => $sp2e47fc, 'P_paymoney' => $spf59c91, 'P_productname' => urlencode($spd4e90d), 'P_productinfo' => urlencode($spd0789a), 'P_remark' => urlencode($sp2e47fc), 'P_custom_1' => urlencode($spcb9ea8), 'P_custom_2' => '', 'P_contact' => urlencode(SYS_NAME), 'P_paytype' => $sp257b4f, 'P_gateway' => $spcb9ea8, 'P_cardnum' => '', 'P_cardpwd' => '', 'P_cardvalue' => '', 'P_notify_url' => $this->url_notify, 'P_return_url' => $this->url_return . '/' . $sp2e47fc); $sp618c34 = new \yekeAPI(); $spb72f32 = $sp618c34->payGate($spc0e525); echo $spb72f32; } function verify($sp9d4382, $sp9a4d97) { $sp7b2182 = isset($sp9d4382['isNotify']) && $sp9d4382['isNotify']; define('yeke_USER_ID', $sp9d4382['id']); define('yeke_USER_KEY', $sp9d4382['key']); define('yeke_USER_LOG_PREFIX', 'log'); define('yeke_API_GATE', 'http://www.yekepay.com/api/ApiGo.php'); require 'HttpClient.php'; require 'yekeApiLib.php'; $sp618c34 = new \yekeAPI(); if ($sp7b2182) { $spb72f32 = $sp618c34->verifyNotify(); } else { $spb72f32 = $sp618c34->verifyReturn(); } if ($spb72f32) { $spc48a4d = $_REQUEST['P_orderid']; $spd194fa = $_REQUEST['P_api_orderid']; $sp5a0851 = $_REQUEST['P_money']; if ($_REQUEST['P_status'] == 'SUCCESS') { $sp9a4d97($spd194fa, (int) round($sp5a0851 * 100), $spc48a4d); if ($sp7b2182) { echo 'success'; } return true; } else { if ($sp7b2182) { echo '失败订单'; } } } else { if ($sp7b2182) { echo '验证失败'; } } return false; } }
\ No newline at end of file
diff --git a/app/Library/Pay/Yeke/HttpClient.php b/app/Library/Pay/Yeke/HttpClient.php
index ceec74626..4a4295470 100644
--- a/app/Library/Pay/Yeke/HttpClient.php
+++ b/app/Library/Pay/Yeke/HttpClient.php
@@ -1,5 +1,5 @@
host = $sp4e8324; $this->port = $spa2fa23; } function get($sp61aa55, $sp5aa598 = false) { $this->path = $sp61aa55; $this->method = 'GET'; if ($sp5aa598) { $this->path .= '?' . $this->buildQueryString($sp5aa598); } return $this->doRequest(); } function post($sp61aa55, $sp5aa598) { $this->path = $sp61aa55; $this->method = 'POST'; $this->postdata = $this->buildQueryString($sp5aa598); return $this->doRequest(); } function buildQueryString($sp5aa598) { $sp5b503e = ''; if (is_array($sp5aa598)) { foreach ($sp5aa598 as $sp1ed429 => $sp36ecf9) { if (is_array($sp36ecf9)) { foreach ($sp36ecf9 as $sp25c5d6) { $sp5b503e .= urlencode($sp1ed429) . '=' . $sp25c5d6 . '&'; } } else { $sp5b503e .= urlencode($sp1ed429) . '=' . $sp36ecf9 . '&'; } } $sp5b503e = substr($sp5b503e, 0, -1); } else { $sp5b503e = $sp5aa598; } return $sp5b503e; } function doRequest() { if (!($sp8cc2df = @fsockopen($this->host, $this->port, $sp90ecdf, $sp3c0949, $this->timeout))) { switch ($sp90ecdf) { case -3: $this->errormsg = 'Socket creation failed (-3)'; break; case -4: $this->errormsg = 'DNS lookup failure (-4)'; break; case -5: $this->errormsg = 'Connection refused or timed out (-5)'; break; default: $this->errormsg = 'Connection failed (' . $sp90ecdf . ')'; $this->errormsg .= ' ' . $sp3c0949; $this->debug($this->errormsg); } return false; } socket_set_timeout($sp8cc2df, $this->timeout); $spfeab54 = $this->buildRequest(); $this->debug('Request', $spfeab54); fwrite($sp8cc2df, $spfeab54); $this->headers = array(); $this->content = ''; $this->errormsg = ''; $spa68b2c = true; $spd092d1 = true; while (!feof($sp8cc2df)) { $sp6e92a4 = fgets($sp8cc2df, 4096); if ($spd092d1) { $spd092d1 = false; if (!preg_match('/HTTP\\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $sp6e92a4, $sp57a158)) { $this->errormsg = 'Status code line invalid: ' . htmlentities($sp6e92a4); $this->debug($this->errormsg); return false; } $this->status = $sp57a158[2]; $this->debug(trim($sp6e92a4)); continue; } if ($spa68b2c) { if (trim($sp6e92a4) == '') { $spa68b2c = false; $this->debug('Received Headers', $this->headers); if ($this->headers_only) { break; } continue; } if (!preg_match('/([^:]+):\\s*(.*)/', $sp6e92a4, $sp57a158)) { continue; } $sp1ed429 = strtolower(trim($sp57a158[1])); $sp36ecf9 = trim($sp57a158[2]); if (isset($this->headers[$sp1ed429])) { if (is_array($this->headers[$sp1ed429])) { $this->headers[$sp1ed429][] = $sp36ecf9; } else { $this->headers[$sp1ed429] = array($this->headers[$sp1ed429], $sp36ecf9); } } else { $this->headers[$sp1ed429] = $sp36ecf9; } continue; } $this->content .= $sp6e92a4; } fclose($sp8cc2df); if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') { $this->debug('Content is gzip encoded, unzipping it'); $this->content = substr($this->content, 10); $this->content = gzinflate($this->content); } if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) { $spd8b08b = $this->headers['set-cookie']; if (!is_array($spd8b08b)) { $spd8b08b = array($spd8b08b); } foreach ($spd8b08b as $spe0ae41) { if (preg_match('/([^=]+)=([^;]+);/', $spe0ae41, $sp57a158)) { $this->cookies[$sp57a158[1]] = $sp57a158[2]; } } $this->cookie_host = $this->host; } if ($this->persist_referers) { $this->debug('Persisting referer: ' . $this->getRequestURL()); $this->referer = $this->getRequestURL(); } if ($this->handle_redirects) { if (++$this->redirect_count >= $this->max_redirects) { $this->errormsg = 'Number of redirects exceeded maximum (' . $this->max_redirects . ')'; $this->debug($this->errormsg); $this->redirect_count = 0; return false; } $sp39a027 = isset($this->headers['location']) ? $this->headers['location'] : ''; $spf616f4 = isset($this->headers['uri']) ? $this->headers['uri'] : ''; if ($sp39a027 || $spf616f4) { $sp3db1b2 = parse_url($sp39a027 . $spf616f4); return $this->get($sp3db1b2['path']); } } return true; } function buildRequest() { $sp28070b = array(); $sp28070b[] = "{$this->method} {$this->path} HTTP/1.0"; $sp28070b[] = "Host: {$this->host}"; $sp28070b[] = "User-Agent: {$this->user_agent}"; $sp28070b[] = "Accept: {$this->accept}"; if ($this->use_gzip) { $sp28070b[] = "Accept-encoding: {$this->accept_encoding}"; } $sp28070b[] = "Accept-language: {$this->accept_language}"; if ($this->referer) { $sp28070b[] = "Referer: {$this->referer}"; } if ($this->cookies) { $spe0ae41 = 'Cookie: '; foreach ($this->cookies as $sp1ed429 => $spb914e6) { $spe0ae41 .= "{$sp1ed429}={$spb914e6}; "; } $sp28070b[] = $spe0ae41; } if ($this->username && $this->password) { $sp28070b[] = 'Authorization: BASIC ' . base64_encode($this->username . ':' . $this->password); } if ($this->postdata) { $sp28070b[] = 'Content-Type: application/x-www-form-urlencoded'; $sp28070b[] = 'Content-Length: ' . strlen($this->postdata); } $spfeab54 = implode('
-', $sp28070b) . '
+class HttpClient { var $host; var $port; var $path; var $method; var $postdata = ''; var $cookies = array(); var $referer; var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*'; var $accept_encoding = 'gzip'; var $accept_language = 'en-us'; var $user_agent = 'Incutio HttpClient v0.9'; var $timeout = 20; var $use_gzip = true; var $persist_cookies = true; var $persist_referers = true; var $debug = false; var $handle_redirects = true; var $max_redirects = 5; var $headers_only = false; var $username; var $password; var $status; var $headers = array(); var $content = ''; var $errormsg; var $redirect_count = 0; var $cookie_host = ''; function __construct($spff6fbd, $sp02c9dd = 80) { $this->host = $spff6fbd; $this->port = $sp02c9dd; } function get($sp14400e, $sp6fd648 = false) { $this->path = $sp14400e; $this->method = 'GET'; if ($sp6fd648) { $this->path .= '?' . $this->buildQueryString($sp6fd648); } return $this->doRequest(); } function post($sp14400e, $sp6fd648) { $this->path = $sp14400e; $this->method = 'POST'; $this->postdata = $this->buildQueryString($sp6fd648); return $this->doRequest(); } function buildQueryString($sp6fd648) { $sp1526a7 = ''; if (is_array($sp6fd648)) { foreach ($sp6fd648 as $spf1241f => $sp91e29b) { if (is_array($sp91e29b)) { foreach ($sp91e29b as $sp385ee0) { $sp1526a7 .= urlencode($spf1241f) . '=' . $sp385ee0 . '&'; } } else { $sp1526a7 .= urlencode($spf1241f) . '=' . $sp91e29b . '&'; } } $sp1526a7 = substr($sp1526a7, 0, -1); } else { $sp1526a7 = $sp6fd648; } return $sp1526a7; } function doRequest() { if (!($sp26c226 = @fsockopen($this->host, $this->port, $spdef632, $sp89adb6, $this->timeout))) { switch ($spdef632) { case -3: $this->errormsg = 'Socket creation failed (-3)'; break; case -4: $this->errormsg = 'DNS lookup failure (-4)'; break; case -5: $this->errormsg = 'Connection refused or timed out (-5)'; break; default: $this->errormsg = 'Connection failed (' . $spdef632 . ')'; $this->errormsg .= ' ' . $sp89adb6; $this->debug($this->errormsg); } return false; } socket_set_timeout($sp26c226, $this->timeout); $spf066f3 = $this->buildRequest(); $this->debug('Request', $spf066f3); fwrite($sp26c226, $spf066f3); $this->headers = array(); $this->content = ''; $this->errormsg = ''; $spc7561e = true; $sp02667e = true; while (!feof($sp26c226)) { $spb0a0bf = fgets($sp26c226, 4096); if ($sp02667e) { $sp02667e = false; if (!preg_match('/HTTP\\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $spb0a0bf, $spb4e455)) { $this->errormsg = 'Status code line invalid: ' . htmlentities($spb0a0bf); $this->debug($this->errormsg); return false; } $this->status = $spb4e455[2]; $this->debug(trim($spb0a0bf)); continue; } if ($spc7561e) { if (trim($spb0a0bf) == '') { $spc7561e = false; $this->debug('Received Headers', $this->headers); if ($this->headers_only) { break; } continue; } if (!preg_match('/([^:]+):\\s*(.*)/', $spb0a0bf, $spb4e455)) { continue; } $spf1241f = strtolower(trim($spb4e455[1])); $sp91e29b = trim($spb4e455[2]); if (isset($this->headers[$spf1241f])) { if (is_array($this->headers[$spf1241f])) { $this->headers[$spf1241f][] = $sp91e29b; } else { $this->headers[$spf1241f] = array($this->headers[$spf1241f], $sp91e29b); } } else { $this->headers[$spf1241f] = $sp91e29b; } continue; } $this->content .= $spb0a0bf; } fclose($sp26c226); if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') { $this->debug('Content is gzip encoded, unzipping it'); $this->content = substr($this->content, 10); $this->content = gzinflate($this->content); } if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) { $spaa0a5d = $this->headers['set-cookie']; if (!is_array($spaa0a5d)) { $spaa0a5d = array($spaa0a5d); } foreach ($spaa0a5d as $sp5ee4b6) { if (preg_match('/([^=]+)=([^;]+);/', $sp5ee4b6, $spb4e455)) { $this->cookies[$spb4e455[1]] = $spb4e455[2]; } } $this->cookie_host = $this->host; } if ($this->persist_referers) { $this->debug('Persisting referer: ' . $this->getRequestURL()); $this->referer = $this->getRequestURL(); } if ($this->handle_redirects) { if (++$this->redirect_count >= $this->max_redirects) { $this->errormsg = 'Number of redirects exceeded maximum (' . $this->max_redirects . ')'; $this->debug($this->errormsg); $this->redirect_count = 0; return false; } $spb06b4e = isset($this->headers['location']) ? $this->headers['location'] : ''; $spe663fc = isset($this->headers['uri']) ? $this->headers['uri'] : ''; if ($spb06b4e || $spe663fc) { $spd2457c = parse_url($spb06b4e . $spe663fc); return $this->get($spd2457c['path']); } } return true; } function buildRequest() { $spc69671 = array(); $spc69671[] = "{$this->method} {$this->path} HTTP/1.0"; $spc69671[] = "Host: {$this->host}"; $spc69671[] = "User-Agent: {$this->user_agent}"; $spc69671[] = "Accept: {$this->accept}"; if ($this->use_gzip) { $spc69671[] = "Accept-encoding: {$this->accept_encoding}"; } $spc69671[] = "Accept-language: {$this->accept_language}"; if ($this->referer) { $spc69671[] = "Referer: {$this->referer}"; } if ($this->cookies) { $sp5ee4b6 = 'Cookie: '; foreach ($this->cookies as $spf1241f => $sp8b9401) { $sp5ee4b6 .= "{$spf1241f}={$sp8b9401}; "; } $spc69671[] = $sp5ee4b6; } if ($this->username && $this->password) { $spc69671[] = 'Authorization: BASIC ' . base64_encode($this->username . ':' . $this->password); } if ($this->postdata) { $spc69671[] = 'Content-Type: application/x-www-form-urlencoded'; $spc69671[] = 'Content-Length: ' . strlen($this->postdata); } $spf066f3 = implode('
+', $spc69671) . '
-' . $this->postdata; return $spfeab54; } function getStatus() { return $this->status; } function getContent() { return $this->content; } function getHeaders() { return $this->headers; } function getHeader($sp79148a) { $sp79148a = strtolower($sp79148a); if (isset($this->headers[$sp79148a])) { return $this->headers[$sp79148a]; } else { return false; } } function getError() { return $this->errormsg; } function getCookies() { return $this->cookies; } function getRequestURL() { $sp3db1b2 = 'http://' . $this->host; if ($this->port != 80) { $sp3db1b2 .= ':' . $this->port; } $sp3db1b2 .= $this->path; return $sp3db1b2; } function setUserAgent($sp9ad127) { $this->user_agent = $sp9ad127; } function setAuthorization($sp925add, $spb6833a) { $this->username = $sp925add; $this->password = $spb6833a; } function setCookies($spab2619) { $this->cookies = $spab2619; } function useGzip($sp458394) { $this->use_gzip = $sp458394; } function setPersistCookies($sp458394) { $this->persist_cookies = $sp458394; } function setPersistReferers($sp458394) { $this->persist_referers = $sp458394; } function setHandleRedirects($sp458394) { $this->handle_redirects = $sp458394; } function setMaxRedirects($spa11dee) { $this->max_redirects = $spa11dee; } function setHeadersOnly($sp458394) { $this->headers_only = $sp458394; } function setDebug($sp458394) { $this->debug = $sp458394; } function quickGet($sp3db1b2) { $sp7dc449 = parse_url($sp3db1b2); $sp4e8324 = $sp7dc449['host']; $spa2fa23 = isset($sp7dc449['port']) ? $sp7dc449['port'] : 80; $sp61aa55 = isset($sp7dc449['path']) ? $sp7dc449['path'] : '/'; if (isset($sp7dc449['query'])) { $sp61aa55 .= '?' . $sp7dc449['query']; } $spb0d603 = new HttpClient($sp4e8324, $spa2fa23); if (!$spb0d603->get($sp61aa55)) { return false; } else { return $spb0d603->getContent(); } } static function quickPost($sp3db1b2, $sp5aa598) { $sp7dc449 = parse_url($sp3db1b2); $sp4e8324 = $sp7dc449['host']; $spa2fa23 = isset($sp7dc449['port']) ? $sp7dc449['port'] : 80; $sp61aa55 = isset($sp7dc449['path']) ? $sp7dc449['path'] : '/'; $spb0d603 = new HttpClient($sp4e8324, $spa2fa23); if (!$spb0d603->post($sp61aa55, $sp5aa598)) { return false; } else { return $spb0d603->getContent(); } } function debug($sp093e23, $spc7294d = false) { if ($this->debug) { print 'HttpClient Debug: ' . $sp093e23; if ($spc7294d) { ob_start(); print_r($spc7294d); $spc1a72e = htmlentities(ob_get_contents()); ob_end_clean(); print '
' . $spc1a72e . '
'; } print '
'; } } }
\ No newline at end of file
+' . $this->postdata; return $spf066f3; } function getStatus() { return $this->status; } function getContent() { return $this->content; } function getHeaders() { return $this->headers; } function getHeader($sp06401d) { $sp06401d = strtolower($sp06401d); if (isset($this->headers[$sp06401d])) { return $this->headers[$sp06401d]; } else { return false; } } function getError() { return $this->errormsg; } function getCookies() { return $this->cookies; } function getRequestURL() { $spd2457c = 'http://' . $this->host; if ($this->port != 80) { $spd2457c .= ':' . $this->port; } $spd2457c .= $this->path; return $spd2457c; } function setUserAgent($sp29fcf1) { $this->user_agent = $sp29fcf1; } function setAuthorization($sp507ab9, $sp8f68ce) { $this->username = $sp507ab9; $this->password = $sp8f68ce; } function setCookies($spdc17ed) { $this->cookies = $spdc17ed; } function useGzip($spf647c5) { $this->use_gzip = $spf647c5; } function setPersistCookies($spf647c5) { $this->persist_cookies = $spf647c5; } function setPersistReferers($spf647c5) { $this->persist_referers = $spf647c5; } function setHandleRedirects($spf647c5) { $this->handle_redirects = $spf647c5; } function setMaxRedirects($sp8a4503) { $this->max_redirects = $sp8a4503; } function setHeadersOnly($spf647c5) { $this->headers_only = $spf647c5; } function setDebug($spf647c5) { $this->debug = $spf647c5; } function quickGet($spd2457c) { $sp9860c8 = parse_url($spd2457c); $spff6fbd = $sp9860c8['host']; $sp02c9dd = isset($sp9860c8['port']) ? $sp9860c8['port'] : 80; $sp14400e = isset($sp9860c8['path']) ? $sp9860c8['path'] : '/'; if (isset($sp9860c8['query'])) { $sp14400e .= '?' . $sp9860c8['query']; } $sp7854df = new HttpClient($spff6fbd, $sp02c9dd); if (!$sp7854df->get($sp14400e)) { return false; } else { return $sp7854df->getContent(); } } static function quickPost($spd2457c, $sp6fd648) { $sp9860c8 = parse_url($spd2457c); $spff6fbd = $sp9860c8['host']; $sp02c9dd = isset($sp9860c8['port']) ? $sp9860c8['port'] : 80; $sp14400e = isset($sp9860c8['path']) ? $sp9860c8['path'] : '/'; $sp7854df = new HttpClient($spff6fbd, $sp02c9dd); if (!$sp7854df->post($sp14400e, $sp6fd648)) { return false; } else { return $sp7854df->getContent(); } } function debug($sp417133, $sp6d2e44 = false) { if ($this->debug) { print 'HttpClient Debug: ' . $sp417133; if ($sp6d2e44) { ob_start(); print_r($sp6d2e44); $sp91a581 = htmlentities(ob_get_contents()); ob_end_clean(); print '
' . $sp91a581 . '
'; } print '
'; } } }
\ No newline at end of file
diff --git a/app/Library/Pay/Yeke/yekeApiLib.php b/app/Library/Pay/Yeke/yekeApiLib.php
index 92e6c25c2..a0aa82d05 100644
--- a/app/Library/Pay/Yeke/yekeApiLib.php
+++ b/app/Library/Pay/Yeke/yekeApiLib.php
@@ -1,9 +1,9 @@
'getPayType', 'userid' => yeke_USER_ID, 'sign' => md5(yeke_USER_ID . yeke_USER_KEY)); $spbbda25 = HttpClient::quickPost(yeke_API_GATE, $spa26894); return $spbbda25; } public static function getPayType() { $spaff91c = json_decode(self::getPayGate(), true); $sp5aa598 = array(); if ($spaff91c['status']) { foreach ($spaff91c['list'] as $sp1ed429 => $sp36ecf9) { $sp5aa598[] = array('paytype' => $sp36ecf9['paytype'], 'channelname' => $sp36ecf9['channelname']); } } return $sp5aa598; } public static function getChannel($spa5cb9b) { $spaff91c = json_decode(self::getPayGate(), true); $sp5aa598 = array(); if ($spa5cb9b == 'card') { if ($spaff91c['status'] && $spaff91c['list']) { foreach ($spaff91c['list'] as $sp36ecf9) { if ($sp36ecf9['paytype'] == $spa5cb9b) { foreach ($sp36ecf9['datalist'] as $sp1ed429 => $sp25c5d6) { $sp5aa598[] = array('channelid' => $sp25c5d6['channelid'], 'channelname' => $sp25c5d6['channelname'], 'imgurl' => $sp25c5d6['imgurl']); } } } } } else { if ($spaff91c['status'] && $spaff91c['list']) { foreach ($spaff91c['list'] as $sp36ecf9) { if ($sp36ecf9['paytype'] == $spa5cb9b) { foreach ($sp36ecf9['datalist'] as $sp1ed429 => $sp25c5d6) { $sp5aa598[] = array('bankcode' => $sp25c5d6['bankcode'], 'bankname' => $sp25c5d6['bankname'], 'imgurl' => $sp25c5d6['imgurl']); } } } } } return $sp5aa598; } public static function getCardValue() { $spaff91c = json_decode(self::getPayGate(), true); $sp5aa598 = array(); if ($spaff91c['status'] && $spaff91c['list']) { foreach ($spaff91c['list'] as $sp36ecf9) { if ($sp36ecf9['paytype'] == 'card') { foreach ($sp36ecf9['datalist'] as $sp1ed429 => $sp36ecf9) { $sp5aa598[] = array('channelid' => $sp36ecf9['channelid'], 'channelname' => $sp36ecf9['channelname'], 'cardvalue' => $sp36ecf9['cardvalue'], 'cardlength' => $sp36ecf9['cardlength']); } } } } return $sp5aa598; } public static function getOrderID() { return date('Y') . date('m') . date('d') . date('H') . date('i') . date('s') . rand(100000, 999999); } public function payGate($spa26894) { $spa26894 = array_merge(array('P_userid' => yeke_USER_ID), $spa26894); $spa109d2 = $this->makeSign($spa26894); $spa26894 = array_merge($spa26894, array('P_sign' => $spa109d2, 'action' => 'payGate')); switch ($spa26894['P_paytype']) { case 'bank': case 'alipay': case 'tenpay': case 'weixin': case 'wxwap': case 'sqzf': return $this->payGateBank($spa26894); break; case 'card': return $this->payGateCard($spa26894); break; default: return 'error,支付方式错误'; } } public function payGateBank($spa26894) { $sp72201b = '请稍候,正在跳转...'; $sp72201b .= ''; $sp72201b .= '请稍候,正在跳转...'; $sp72201b .= '
- json($sp5aa598, $sp7a9982, $sp28070b, $speb78ca); } public static function success($sp5aa598 = array()) { return self::json(array('message' => 'success', 'data' => $sp5aa598)); } public static function fail($sp093e23 = 'fail', $sp5aa598 = array()) { return self::json(array('message' => $sp093e23, 'data' => $sp5aa598), 500); } public static function forbidden($sp093e23 = 'forbidden', $sp5aa598 = array()) { return self::json(array('message' => $sp093e23, 'data' => $sp5aa598), 403); } }
\ No newline at end of file
+namespace App\Library; class Response { public static function json($sp6fd648 = array(), $sp27b58d = 200, array $spc69671 = array(), $spcdfd37 = 0) { return response()->json($sp6fd648, $sp27b58d, $spc69671, $spcdfd37); } public static function success($sp6fd648 = array()) { return self::json(array('message' => 'success', 'data' => $sp6fd648)); } public static function fail($sp417133 = 'fail', $sp6fd648 = array()) { return self::json(array('message' => $sp417133, 'data' => $sp6fd648), 500); } public static function forbidden($sp417133 = 'forbidden', $sp6fd648 = array()) { return self::json(array('message' => $sp417133, 'data' => $sp6fd648), 403); } }
\ No newline at end of file
diff --git a/app/Mail/OrderShipped.php b/app/Mail/OrderShipped.php
index 92e5b7231..80d6b57e3 100644
--- a/app/Mail/OrderShipped.php
+++ b/app/Mail/OrderShipped.php
@@ -1,2 +1,2 @@
order = $sp4f4c0d; $this->card_msg = $spb4f37e; $this->cards_txt = $spc33f6c; } public function build() { return $this->subject('订单提醒(#' . $this->order->order_no . ')-' . config('app.name'))->view('emails.order'); } }
\ No newline at end of file
+namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; class OrderShipped extends Mailable { use Queueable, SerializesModels; public $order; public $card_msg; public $cards_txt; public function __construct($spe0613f, $sp57c88f, $sp6eb06a) { $this->order = $spe0613f; $this->card_msg = $sp57c88f; $this->cards_txt = $sp6eb06a; } public function build() { return $this->subject('订单提醒(#' . $this->order->order_no . ')-' . config('app.name'))->view('emails.order'); } }
\ No newline at end of file
diff --git a/app/Mail/ProductCountWarn.php b/app/Mail/ProductCountWarn.php
index 92297c220..af46269e9 100644
--- a/app/Mail/ProductCountWarn.php
+++ b/app/Mail/ProductCountWarn.php
@@ -1,2 +1,2 @@
product = $sp71cb0c; $this->product_count = $sp62be09; } public function build() { return $this->subject('您的商品库存不足-' . config('app.name'))->view('emails.product_count_warn'); } }
\ No newline at end of file
+namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; class ProductCountWarn extends Mailable { use Queueable, SerializesModels; public $product = null; public $product_count = null; public function __construct($sp2cf004, $spbbe5dc) { $this->product = $sp2cf004; $this->product_count = $spbbe5dc; } public function build() { return $this->subject('您的商品库存不足-' . config('app.name'))->view('emails.product_count_warn'); } }
\ No newline at end of file
diff --git a/app/Order.php b/app/Order.php
index 4396bf3bd..f5d4a43fd 100644
--- a/app/Order.php
+++ b/app/Order.php
@@ -1,2 +1,2 @@
'未支付', 1 => '未发货', 2 => '已发货', 3 => '已冻结', 4 => '已退款'); const SEND_STATUS_UN = 0; const SEND_STATUS_EMAIL_SUCCESS = 1; const SEND_STATUS_EMAIL_FAILED = 2; const SEND_STATUS_MOBILE_SUCCESS = 3; const SEND_STATUS_MOBILE_FAILED = 4; const SEND_STATUS_CARD_UN = 100; const SEND_STATUS_CARD_PROCESSING = 101; const SEND_STATUS_CARD_SUCCESS = 102; const SEND_STATUS_CARD_FAILED = 103; protected $casts = array('api_info' => 'array'); public static function unique_no() { $sp7c88f3 = date('YmdHis') . str_random(5); while (\App\Order::where('order_no', $sp7c88f3)->exists()) { $sp7c88f3 = date('YmdHis') . str_random(5); } return $sp7c88f3; } function user() { return $this->belongsTo(User::class); } function product() { return $this->belongsTo(Product::class); } function pay() { return $this->belongsTo(Pay::class); } function cards() { $spaace56 = $this->belongsToMany(Card::class); return $spaace56->withTrashed(); } function card_orders() { return $this->hasMany(CardOrder::class); } function fundRecord() { return $this->hasMany(FundRecord::class); } function getCardsArray() { $sp33f345 = array(); $this->cards->each(function ($sp0f75bb) use(&$sp33f345) { $sp33f345[] = $sp0f75bb->card; }); return $sp33f345; } function getSendMessage() { if (count($this->cards) < $this->count && @$this->product->delivery !== \App\Product::DELIVERY_MANUAL) { if (count($this->cards)) { $spb4f37e = '订单#' . $this->order_no . ' 已支付,目前库存不足,您还有' . ($this->count - count($this->cards)) . '件未发货,请联系商家客服发货
已发货商品见下方:
'; } else { $spb4f37e = '订单#' . $this->order_no . ' 已支付,目前库存不足,您购买的' . ($this->count - count($this->cards)) . '件未发货,请联系商家客服发货
'; } $sp18d561 = $this->user->qq; if ($sp18d561) { $spb4f37e .= '商家客服QQ:' . $sp18d561 . '
'; } } else { $spb4f37e = '订单#' . $this->order_no . ' 已支付,您购买的内容如下:'; } return $spb4f37e; } function sendEmail($sp4c999d = false) { if ($sp4c999d === false) { $sp4c999d = @json_decode($this->contact_ext)['_mail']; } if (!$sp4c999d || !@filter_var($sp4c999d, FILTER_VALIDATE_EMAIL)) { return; } $sp33f345 = $this->getCardsArray(); try { Mail::to($sp4c999d)->Queue(new OrderShipped($this, $this->getSendMessage(), join('
', $sp33f345))); $this->send_status = \App\Order::SEND_STATUS_EMAIL_SUCCESS; $this->saveOrFail(); } catch (\Throwable $sp81eee8) { $this->send_status = \App\Order::SEND_STATUS_EMAIL_FAILED; $this->saveOrFail(); LogHelper::setLogFile('mail'); Log::error('Order.sendEmail error', array('order_no' => $this->order_no, 'email' => $sp4c999d, 'cards' => $sp33f345, 'exception' => $sp81eee8->getMessage())); LogHelper::setLogFile('card'); } } function sendSms($sp6566f0 = false) { if ($sp6566f0 === false) { $sp6566f0 = @json_decode($this->contact_ext)['_mobile']; } if (!$sp6566f0 || strlen($sp6566f0) !== 11) { return; } OrderSms::dispatch($sp6566f0, $this); } }
\ No newline at end of file
+namespace App; use App\Jobs\OrderSms; use App\Library\LogHelper; use App\Mail\OrderShipped; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Mail; class Order extends Model { protected $guarded = array(); const STATUS_UNPAY = 0; const STATUS_PAID = 1; const STATUS_SUCCESS = 2; const STATUS_FROZEN = 3; const STATUS_REFUND = 4; const STATUS = array(0 => '未支付', 1 => '未发货', 2 => '已发货', 3 => '已冻结', 4 => '已退款'); const SEND_STATUS_UN = 0; const SEND_STATUS_EMAIL_SUCCESS = 1; const SEND_STATUS_EMAIL_FAILED = 2; const SEND_STATUS_MOBILE_SUCCESS = 3; const SEND_STATUS_MOBILE_FAILED = 4; const SEND_STATUS_CARD_UN = 100; const SEND_STATUS_CARD_PROCESSING = 101; const SEND_STATUS_CARD_SUCCESS = 102; const SEND_STATUS_CARD_FAILED = 103; protected $casts = array('api_info' => 'array'); public static function unique_no() { $sp845b45 = date('YmdHis') . str_random(5); while (\App\Order::where('order_no', $sp845b45)->exists()) { $sp845b45 = date('YmdHis') . str_random(5); } return $sp845b45; } function user() { return $this->belongsTo(User::class); } function product() { return $this->belongsTo(Product::class); } function pay() { return $this->belongsTo(Pay::class); } function cards() { $sp49bf0a = $this->belongsToMany(Card::class); return $sp49bf0a->withTrashed(); } function card_orders() { return $this->hasMany(CardOrder::class); } function fundRecord() { return $this->hasMany(FundRecord::class); } function getCardsArray() { $sp54decd = array(); $this->cards->each(function ($spc3a8a6) use(&$sp54decd) { $sp54decd[] = $spc3a8a6->card; }); return $sp54decd; } function getSendMessage() { if (count($this->cards) < $this->count && @$this->product->delivery !== \App\Product::DELIVERY_MANUAL) { if (count($this->cards)) { $sp57c88f = '订单#' . $this->order_no . ' 已支付,目前库存不足,您还有' . ($this->count - count($this->cards)) . '件未发货,请联系商家客服发货
已发货商品见下方:
'; } else { $sp57c88f = '订单#' . $this->order_no . ' 已支付,目前库存不足,您购买的' . ($this->count - count($this->cards)) . '件未发货,请联系商家客服发货
'; } $sp0e815c = $this->user->qq; if ($sp0e815c) { $sp57c88f .= '商家客服QQ:' . $sp0e815c . '
'; } } else { $sp57c88f = '订单#' . $this->order_no . ' 已支付,您购买的内容如下:'; } return $sp57c88f; } function sendEmail($spa7590c = false) { if ($spa7590c === false) { $spa7590c = @json_decode($this->contact_ext)['_mail']; } if (!$spa7590c || !@filter_var($spa7590c, FILTER_VALIDATE_EMAIL)) { return; } $sp54decd = $this->getCardsArray(); try { Mail::to($spa7590c)->Queue(new OrderShipped($this, $this->getSendMessage(), join('
', $sp54decd))); $this->send_status = \App\Order::SEND_STATUS_EMAIL_SUCCESS; $this->saveOrFail(); } catch (\Throwable $sp3f4aab) { $this->send_status = \App\Order::SEND_STATUS_EMAIL_FAILED; $this->saveOrFail(); LogHelper::setLogFile('mail'); Log::error('Order.sendEmail error', array('order_no' => $this->order_no, 'email' => $spa7590c, 'cards' => $sp54decd, 'exception' => $sp3f4aab->getMessage())); LogHelper::setLogFile('card'); } } function sendSms($spc7e576 = false) { if ($spc7e576 === false) { $spc7e576 = @json_decode($this->contact_ext)['_mobile']; } if (!$spc7e576 || strlen($spc7e576) !== 11) { return; } OrderSms::dispatch($spc7e576, $this); } }
\ No newline at end of file
diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php
index 372ecfa33..4ffff05eb 100644
--- a/app/Policies/UserPolicy.php
+++ b/app/Policies/UserPolicy.php
@@ -1,2 +1,2 @@
id, Helper::ID_TYPE_PRODUCT); } function getCountAttribute() { return $this->count_all - $this->count_sold; } function category() { return $this->belongsTo(Category::class); } function cards() { return $this->hasMany(Card::class); } function coupons() { return $this->hasMany(Coupon::class); } function orders() { return $this->hasMany(Order::class); } function user() { return $this->belongsTo(User::class); } public static function refreshCount($spafa70b) { \App\Card::where('user_id', $spafa70b->id)->selectRaw('`product_id`,SUM(`count_sold`) as `count_sold`,SUM(`count_all`) as `count_all`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(1000, function ($sp2300d6) { foreach ($sp2300d6 as $sp2fe3cd) { $sp71cb0c = \App\Product::where('id', $sp2fe3cd->product_id)->first(); if ($sp71cb0c->delivery === \App\Product::DELIVERY_AUTO) { $sp71cb0c->update(array('count_sold' => $sp2fe3cd->count_sold, 'count_all' => $sp2fe3cd->count_all)); } else { $sp71cb0c->update(array('count_sold' => $sp2fe3cd->count_sold)); } } }); } function setForShop($spafa70b = null) { $sp71cb0c = $this; $spfdb02a = $sp71cb0c->count; $sp26eea7 = $sp71cb0c->inventory; if ($sp26eea7 == User::INVENTORY_AUTO) { $sp26eea7 = System::_getInt('shop_inventory'); } if ($sp26eea7 == User::INVENTORY_RANGE) { if ($spfdb02a <= 0) { $sp56ae97 = '不足'; } elseif ($spfdb02a <= 10) { $sp56ae97 = '少量'; } elseif ($spfdb02a <= 20) { $sp56ae97 = '一般'; } else { $sp56ae97 = '大量'; } $sp71cb0c->setAttribute('count2', $sp56ae97); } else { $sp71cb0c->setAttribute('count2', $spfdb02a); } $sp71cb0c->setAttribute('count', $spfdb02a); $sp71cb0c->setVisible(array('id', 'name', 'description', 'fields', 'delivery', 'count', 'count2', 'buy_min', 'buy_max', 'support_coupon', 'password_open', 'price', 'price_whole')); } }
\ No newline at end of file
+namespace App; use App\Library\Helper; use Illuminate\Database\Eloquent\Model; class Product extends Model { protected $guarded = array(); protected $hidden = array(); const ID_API = -1001; const DELIVERY_AUTO = 0; const DELIVERY_MANUAL = 1; function getUrlAttribute() { return config('app.url') . '/p/' . Helper::id_encode($this->id, Helper::ID_TYPE_PRODUCT); } function getCountAttribute() { return $this->count_all - $this->count_sold; } function category() { return $this->belongsTo(Category::class); } function cards() { return $this->hasMany(Card::class); } function coupons() { return $this->hasMany(Coupon::class); } function orders() { return $this->hasMany(Order::class); } function user() { return $this->belongsTo(User::class); } public static function refreshCount($spbbb773) { \App\Card::where('user_id', $spbbb773->id)->selectRaw('`product_id`,SUM(`count_sold`) as `count_sold`,SUM(`count_all`) as `count_all`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(1000, function ($sp2e1960) { foreach ($sp2e1960 as $sp87990b) { $sp2cf004 = \App\Product::where('id', $sp87990b->product_id)->first(); if ($sp2cf004->delivery === \App\Product::DELIVERY_AUTO) { $sp2cf004->update(array('count_sold' => $sp87990b->count_sold, 'count_all' => $sp87990b->count_all)); } else { $sp2cf004->update(array('count_sold' => $sp87990b->count_sold)); } } }); } function setForShop($spbbb773 = null) { $sp2cf004 = $this; $spdd51cd = $sp2cf004->count; $spa1570b = $sp2cf004->inventory; if ($spa1570b == User::INVENTORY_AUTO) { $spa1570b = System::_getInt('shop_inventory'); } if ($spa1570b == User::INVENTORY_RANGE) { if ($spdd51cd <= 0) { $spfa1b63 = '不足'; } elseif ($spdd51cd <= 10) { $spfa1b63 = '少量'; } elseif ($spdd51cd <= 20) { $spfa1b63 = '一般'; } else { $spfa1b63 = '大量'; } $sp2cf004->setAttribute('count2', $spfa1b63); } else { $sp2cf004->setAttribute('count2', $spdd51cd); } $sp2cf004->setAttribute('count', $spdd51cd); $sp2cf004->setVisible(array('id', 'name', 'description', 'fields', 'delivery', 'count', 'count2', 'buy_min', 'buy_max', 'support_coupon', 'password_open', 'price', 'price_whole')); } }
\ No newline at end of file
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
index c9a7272b6..6b4b80779 100644
--- a/app/Providers/ConfigServiceProvider.php
+++ b/app/Providers/ConfigServiceProvider.php
@@ -1,2 +1,2 @@
set(array('app.project' => 'card_free', 'app.version' => '2.9', 'app.name' => System::_get('app_name'), 'app.title' => System::_get('app_title'), 'app.url' => System::_get('app_url'), 'app.url_api' => System::_get('app_url_api'), 'app.logo' => System::_get('logo'), 'app.description' => System::_get('description'), 'app.keywords' => System::_get('keywords'), 'app.company' => System::_get('company'), 'app.icp' => System::_get('icp'), 'services.geetest.id' => System::_get('vcode_geetest_id'), 'services.geetest.key' => System::_get('vcode_geetest_key'), 'mail.driver' => System::_get('mail_driver'), 'mail.host' => System::_get('mail_smtp_host'), 'mail.port' => System::_get('mail_smtp_port'), 'mail.username' => System::_get('mail_smtp_username'), 'mail.password' => System::_get('mail_smtp_password'), 'mail.from.address' => System::_get('mail_smtp_from_address'), 'mail.from.name' => System::_get('mail_smtp_from_name'), 'mail.encryption' => System::_get('mail_smtp_encryption') === 'null' ? null : System::_get('mail_smtp_encryption'), 'services.sendcloud.api_user' => System::_get('sendcloud_user'), 'services.sendcloud.api_key' => System::_get('sendcloud_key'), 'filesystems.default' => System::_get('storage_driver'), 'filesystems.disks.s3.key' => System::_get('storage_s3_access_key'), 'filesystems.disks.s3.secret' => System::_get('storage_s3_secret_key'), 'filesystems.disks.s3.region' => System::_get('storage_s3_region'), 'filesystems.disks.s3.bucket' => System::_get('storage_s3_bucket'), 'filesystems.disks.oss.access_id' => System::_get('storage_oss_access_key'), 'filesystems.disks.oss.access_key' => System::_get('storage_oss_secret_key'), 'filesystems.disks.oss.bucket' => System::_get('storage_oss_bucket'), 'filesystems.disks.oss.endpoint' => System::_get('storage_oss_endpoint'), 'filesystems.disks.oss.cdnDomain' => System::_get('storage_oss_cdn_domain'), 'filesystems.disks.oss.ssl' => (int) System::_get('storage_oss_is_ssl') === 1, 'filesystems.disks.oss.isCName' => (int) System::_get('storage_oss_is_cname') === 1, 'filesystems.disks.qiniu.access_key' => System::_get('storage_qiniu_access_key'), 'filesystems.disks.qiniu.secret_key' => System::_get('storage_qiniu_secret_key'), 'filesystems.disks.qiniu.bucket' => System::_get('storage_qiniu_bucket'), 'filesystems.disks.qiniu.domains.default' => System::_get('storage_qiniu_domains_default'), 'filesystems.disks.qiniu.domains.https' => System::_get('storage_qiniu_domains_https'))); } catch (\Exception $sp81eee8) { \Log::error('Config init failed: ' . $sp81eee8->getMessage(), array('exception' => $sp81eee8)); } } public function register() { } }
\ No newline at end of file
+namespace App\Providers; use App\System; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; class ConfigServiceProvider extends ServiceProvider { public function boot() { try { config()->set(array('app.project' => 'card_free', 'app.version' => '2.9', 'app.name' => System::_get('app_name'), 'app.title' => System::_get('app_title'), 'app.url' => System::_get('app_url'), 'app.url_api' => System::_get('app_url_api'), 'app.logo' => System::_get('logo'), 'app.description' => System::_get('description'), 'app.keywords' => System::_get('keywords'), 'app.company' => System::_get('company'), 'app.icp' => System::_get('icp'), 'services.geetest.id' => System::_get('vcode_geetest_id'), 'services.geetest.key' => System::_get('vcode_geetest_key'), 'mail.driver' => System::_get('mail_driver'), 'mail.host' => System::_get('mail_smtp_host'), 'mail.port' => System::_get('mail_smtp_port'), 'mail.username' => System::_get('mail_smtp_username'), 'mail.password' => System::_get('mail_smtp_password'), 'mail.from.address' => System::_get('mail_smtp_from_address'), 'mail.from.name' => System::_get('mail_smtp_from_name'), 'mail.encryption' => System::_get('mail_smtp_encryption') === 'null' ? null : System::_get('mail_smtp_encryption'), 'services.sendcloud.api_user' => System::_get('sendcloud_user'), 'services.sendcloud.api_key' => System::_get('sendcloud_key'), 'filesystems.default' => System::_get('storage_driver'), 'filesystems.disks.s3.key' => System::_get('storage_s3_access_key'), 'filesystems.disks.s3.secret' => System::_get('storage_s3_secret_key'), 'filesystems.disks.s3.region' => System::_get('storage_s3_region'), 'filesystems.disks.s3.bucket' => System::_get('storage_s3_bucket'), 'filesystems.disks.oss.access_id' => System::_get('storage_oss_access_key'), 'filesystems.disks.oss.access_key' => System::_get('storage_oss_secret_key'), 'filesystems.disks.oss.bucket' => System::_get('storage_oss_bucket'), 'filesystems.disks.oss.endpoint' => System::_get('storage_oss_endpoint'), 'filesystems.disks.oss.cdnDomain' => System::_get('storage_oss_cdn_domain'), 'filesystems.disks.oss.ssl' => (int) System::_get('storage_oss_is_ssl') === 1, 'filesystems.disks.oss.isCName' => (int) System::_get('storage_oss_is_cname') === 1, 'filesystems.disks.qiniu.access_key' => System::_get('storage_qiniu_access_key'), 'filesystems.disks.qiniu.secret_key' => System::_get('storage_qiniu_secret_key'), 'filesystems.disks.qiniu.bucket' => System::_get('storage_qiniu_bucket'), 'filesystems.disks.qiniu.domains.default' => System::_get('storage_qiniu_domains_default'), 'filesystems.disks.qiniu.domains.https' => System::_get('storage_qiniu_domains_https'))); } catch (\Exception $sp3f4aab) { \Log::error('Config init failed: ' . $sp3f4aab->getMessage(), array('exception' => $sp3f4aab)); } } public function register() { } }
\ No newline at end of file
diff --git a/app/ShopTheme.php b/app/ShopTheme.php
index 0e031c018..392f7d087 100644
--- a/app/ShopTheme.php
+++ b/app/ShopTheme.php
@@ -1,2 +1,2 @@
'array', 'config' => 'array'); private static $default_theme; public static function defaultTheme() { if (!static::$default_theme) { static::$default_theme = ShopTheme::query()->where('name', \App\System::_get('shop_theme_default', 'Material'))->first(); if (!static::$default_theme) { static::$default_theme = ShopTheme::query()->firstOrFail(); } } return static::$default_theme; } public static function freshList() { $sp61aa55 = realpath(app_path('..' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'shop_theme')); \App\ShopTheme::query()->get()->each(function ($sp30cc84) use($sp61aa55) { if (!file_exists($sp61aa55 . DIRECTORY_SEPARATOR . $sp30cc84->name . DIRECTORY_SEPARATOR . 'config.php')) { $sp30cc84->delete(); } }); foreach (scandir($sp61aa55) as $sp57f1ab) { if ($sp57f1ab === '.' || $sp57f1ab === '..') { continue; } try { @($sp30cc84 = (include $sp61aa55 . DIRECTORY_SEPARATOR . $sp57f1ab . DIRECTORY_SEPARATOR . 'config.php')); } catch (\Exception $sp81eee8) { continue; } $sp30cc84['config'] = array_map(function ($sp4a9ec3) { return $sp4a9ec3['value']; }, @$sp30cc84['options'] ?? array()); $sp50470d = \App\ShopTheme::query()->where('name', $sp57f1ab)->first(); if ($sp50470d) { $sp50470d->description = $sp30cc84['description']; $sp50470d->options = @$sp30cc84['options'] ?? array(); $sp50470d->config = ($sp50470d->config ?? array()) + $sp30cc84['config']; $sp50470d->saveOrFail(); } else { if ($sp30cc84 && isset($sp30cc84['description'])) { \App\ShopTheme::query()->create(array('name' => $sp57f1ab, 'description' => $sp30cc84['description'], 'options' => @$sp30cc84['options'] ?? array(), 'config' => $sp30cc84['config'])); } } } } }
\ No newline at end of file
+namespace App; use Illuminate\Database\Eloquent\Model; class ShopTheme extends Model { protected $guarded = array(); public $timestamps = false; protected $casts = array('options' => 'array', 'config' => 'array'); private static $default_theme; public static function defaultTheme() { if (!static::$default_theme) { static::$default_theme = ShopTheme::query()->where('name', \App\System::_get('shop_theme_default', 'Material'))->first(); if (!static::$default_theme) { static::$default_theme = ShopTheme::query()->firstOrFail(); } } return static::$default_theme; } public static function freshList() { $sp14400e = realpath(app_path('..' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'shop_theme')); \App\ShopTheme::query()->get()->each(function ($spf6c194) use($sp14400e) { if (!file_exists($sp14400e . DIRECTORY_SEPARATOR . $spf6c194->name . DIRECTORY_SEPARATOR . 'config.php')) { $spf6c194->delete(); } }); foreach (scandir($sp14400e) as $spa755c2) { if ($spa755c2 === '.' || $spa755c2 === '..') { continue; } try { @($spf6c194 = (include $sp14400e . DIRECTORY_SEPARATOR . $spa755c2 . DIRECTORY_SEPARATOR . 'config.php')); } catch (\Exception $sp3f4aab) { continue; } $spf6c194['config'] = array_map(function ($sp10eb73) { return $sp10eb73['value']; }, @$spf6c194['options'] ?? array()); $sp7c77cf = \App\ShopTheme::query()->where('name', $spa755c2)->first(); if ($sp7c77cf) { $sp7c77cf->description = $spf6c194['description']; $sp7c77cf->options = @$spf6c194['options'] ?? array(); $sp7c77cf->config = ($sp7c77cf->config ?? array()) + $spf6c194['config']; $sp7c77cf->saveOrFail(); } else { if ($spf6c194 && isset($spf6c194['description'])) { \App\ShopTheme::query()->create(array('name' => $spa755c2, 'description' => $spf6c194['description'], 'options' => @$spf6c194['options'] ?? array(), 'config' => $spf6c194['config'])); } } } } }
\ No newline at end of file
diff --git a/app/System.php b/app/System.php
index 8ba4e0bf3..35327978d 100644
--- a/app/System.php
+++ b/app/System.php
@@ -1,2 +1,2 @@
get()->toArray(); foreach ($spc1bbc8 as $sp387439) { static::$systems[$sp387439['name']] = $sp387439['value']; } return static::$systems; }); static::$systems['_initialized'] = true; } public static function _get($sp505b52, $sp63cb73 = NULL) { if (!isset(static::$systems['_initialized'])) { static::_init(); } if (isset(static::$systems[$sp505b52])) { return static::$systems[$sp505b52]; } return $sp63cb73; } public static function _getInt($sp505b52, $sp63cb73 = NULL) { return (int) static::_get($sp505b52, $sp63cb73); } public static function _set($sp505b52, $spb914e6) { static::$systems[$sp505b52] = $spb914e6; $sp39a929 = System::query()->where('name', $sp505b52)->first(); if ($sp39a929) { $sp39a929->value = $spb914e6; $sp39a929->save(); } else { try { System::query()->insert(array('name' => $sp505b52, 'value' => $spb914e6)); } catch (\Exception $sp81eee8) { } } self::flushCache(); } public static function flushCache() { Log::debug('SystemSetting.flushCache'); Cache::forget('settings.all'); } protected static function boot() { parent::boot(); static::updated(function () { self::flushCache(); }); static::created(function () { self::flushCache(); }); } }
\ No newline at end of file
+namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Log; class System extends Model { protected $guarded = array(); private static $systems = array(); public static function _init() { static::$systems = Cache::remember('settings.all', 1, function () { $spf8034b = System::query()->get()->toArray(); foreach ($spf8034b as $sp823ca4) { static::$systems[$sp823ca4['name']] = $sp823ca4['value']; } return static::$systems; }); static::$systems['_initialized'] = true; } public static function _get($sp34e4b5, $sp183e9a = NULL) { if (!isset(static::$systems['_initialized'])) { static::_init(); } if (isset(static::$systems[$sp34e4b5])) { return static::$systems[$sp34e4b5]; } return $sp183e9a; } public static function _getInt($sp34e4b5, $sp183e9a = NULL) { return (int) static::_get($sp34e4b5, $sp183e9a); } public static function _set($sp34e4b5, $sp8b9401) { static::$systems[$sp34e4b5] = $sp8b9401; $sp75c248 = System::query()->where('name', $sp34e4b5)->first(); if ($sp75c248) { $sp75c248->value = $sp8b9401; $sp75c248->save(); } else { try { System::query()->insert(array('name' => $sp34e4b5, 'value' => $sp8b9401)); } catch (\Exception $sp3f4aab) { } } self::flushCache(); } public static function flushCache() { Log::debug('SystemSetting.flushCache'); Cache::forget('settings.all'); } protected static function boot() { parent::boot(); static::updated(function () { self::flushCache(); }); static::created(function () { self::flushCache(); }); } }
\ No newline at end of file
diff --git a/app/User.php b/app/User.php
index e754049d2..5eecc10c1 100644
--- a/app/User.php
+++ b/app/User.php
@@ -1,2 +1,2 @@
'array'); const ID_CUSTOMER = -1; const INVENTORY_RANGE = 0; const INVENTORY_REAL = 1; const INVENTORY_AUTO = 2; const FEE_TYPE_MERCHANT = 0; const FEE_TYPE_CUSTOMER = 1; const FEE_TYPE_AUTO = 2; const STATUS_OK = 0; const STATUS_FROZEN = 1; function getMBalanceAttribute() { return $this->m_all - $this->m_paid - $this->m_frozen; } function getRoleAttribute() { return 'admin'; } function getMBalanceWithoutTodayAttribute() { $spb969bd = (int) \App\Order::where('user_id', $this->user_id)->where('status', \App\Order::STATUS_SUCCESS)->whereDate('paid_at', Carbon::today())->sum('income'); return $this->m_all - $this->m_paid - $this->m_frozen - $spb969bd; } function getShopThemeAttribute() { if ($this->theme_config) { $spb9589c = \App\ShopTheme::whereName($this->theme_config['theme'])->first(); if ($spb9589c) { return $spb9589c; } } return \App\ShopTheme::defaultTheme(); } function categories() { return $this->hasMany(Category::class); } function products() { return $this->hasMany(Product::class); } function cards() { return $this->hasMany(Card::class); } function orders() { return $this->hasMany(Order::class); } function coupons() { return $this->hasMany(Coupon::class); } function logs() { return $this->hasMany(Log::class); } function shop_theme() { return $this->belongsTo(ShopTheme::class); } }
\ No newline at end of file
+namespace App; use Carbon\Carbon; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use Notifiable; protected $guarded = array(); protected $hidden = array('password', 'remember_token'); protected $appends = array('m_balance', 'role'); protected $casts = array('theme_config' => 'array'); const ID_CUSTOMER = -1; const INVENTORY_RANGE = 0; const INVENTORY_REAL = 1; const INVENTORY_AUTO = 2; const FEE_TYPE_MERCHANT = 0; const FEE_TYPE_CUSTOMER = 1; const FEE_TYPE_AUTO = 2; const STATUS_OK = 0; const STATUS_FROZEN = 1; function getMBalanceAttribute() { return $this->m_all - $this->m_paid - $this->m_frozen; } function getRoleAttribute() { return 'admin'; } function getMBalanceWithoutTodayAttribute() { $sp9c65cc = (int) \App\Order::where('user_id', $this->user_id)->where('status', \App\Order::STATUS_SUCCESS)->whereDate('paid_at', Carbon::today())->sum('income'); return $this->m_all - $this->m_paid - $this->m_frozen - $sp9c65cc; } function getShopThemeAttribute() { if ($this->theme_config) { $sp9b52fe = \App\ShopTheme::whereName($this->theme_config['theme'])->first(); if ($sp9b52fe) { return $sp9b52fe; } } return \App\ShopTheme::defaultTheme(); } function categories() { return $this->hasMany(Category::class); } function products() { return $this->hasMany(Product::class); } function cards() { return $this->hasMany(Card::class); } function orders() { return $this->hasMany(Order::class); } function coupons() { return $this->hasMany(Coupon::class); } function logs() { return $this->hasMany(Log::class); } function shop_theme() { return $this->belongsTo(ShopTheme::class); } }
\ No newline at end of file
diff --git a/bootstrap/app.php b/bootstrap/app.php
index fa89e092e..d9363c160 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -1,2 +1,2 @@
singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $sp08ba99->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $sp08ba99->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); return $sp08ba99;
\ No newline at end of file
+$spaaf7a6 = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../')); $spaaf7a6->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $spaaf7a6->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $spaaf7a6->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); return $spaaf7a6;
\ No newline at end of file
diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php
index 76e397301..4854a7fb8 100644
--- a/database/factories/OrderFactory.php
+++ b/database/factories/OrderFactory.php
@@ -1,2 +1,2 @@
define(App\Order::class, function (Faker $sp94d1bb) { $sp7c88f3 = date('YmdHis') . mt_rand(10000, 99999); while (\App\Order::whereOrderNo($sp7c88f3)->exists()) { $sp7c88f3 = date('YmdHis') . mt_rand(10000, 99999); } $sp807378 = random_int(0, 1) ? $sp94d1bb->email : 'user01@qq.com'; $sp62b824 = 1000; $sp53326e = random_int(0, 1) * 100; $sp0201cf = $sp62b824 - $sp53326e; return array('user_id' => 2, 'order_no' => $sp7c88f3, 'product_id' => 1, 'count' => 1); });
\ No newline at end of file
+use Faker\Generator as Faker; $sp56c0d3->define(App\Order::class, function (Faker $spd7707a) { $sp845b45 = date('YmdHis') . mt_rand(10000, 99999); while (\App\Order::whereOrderNo($sp845b45)->exists()) { $sp845b45 = date('YmdHis') . mt_rand(10000, 99999); } $sp0fa228 = random_int(0, 1) ? $spd7707a->email : 'user01@qq.com'; $sp45d662 = 1000; $sp0d07b1 = random_int(0, 1) * 100; $spa7b5ad = $sp45d662 - $sp0d07b1; return array('user_id' => 2, 'order_no' => $sp845b45, 'product_id' => 1, 'count' => 1); });
\ No newline at end of file
diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php
index 798735bb4..4adf34248 100644
--- a/database/migrations/2014_10_12_000000_create_users_table.php
+++ b/database/migrations/2014_10_12_000000_create_users_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->string('email', 100)->unique(); $sp6ab302->string('mobile')->nullable(); $sp6ab302->string('password', 100); $sp6ab302->integer('m_paid')->default(0); $sp6ab302->integer('m_frozen')->default(0); $sp6ab302->integer('m_all')->default(0); $sp6ab302->rememberToken(); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('users'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { public function up() { Schema::create('users', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->string('email', 100)->unique(); $sp390b4b->string('mobile')->nullable(); $sp390b4b->string('password', 100); $sp390b4b->integer('m_paid')->default(0); $sp390b4b->integer('m_frozen')->default(0); $sp390b4b->integer('m_all')->default(0); $sp390b4b->rememberToken(); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('users'); } }
\ No newline at end of file
diff --git a/database/migrations/2017_12_23_223031_create_categories_table.php b/database/migrations/2017_12_23_223031_create_categories_table.php
index 271985b29..a53d07c44 100644
--- a/database/migrations/2017_12_23_223031_create_categories_table.php
+++ b/database/migrations/2017_12_23_223031_create_categories_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->text('name'); $sp6ab302->integer('sort')->default(1000); $sp6ab302->string('password')->nullable(); $sp6ab302->boolean('password_open')->default(false); $sp6ab302->boolean('enabled'); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('groups'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCategoriesTable extends Migration { public function up() { Schema::create('categories', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->text('name'); $sp390b4b->integer('sort')->default(1000); $sp390b4b->string('password')->nullable(); $sp390b4b->boolean('password_open')->default(false); $sp390b4b->boolean('enabled'); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('groups'); } }
\ No newline at end of file
diff --git a/database/migrations/2017_12_23_223124_create_products_table.php b/database/migrations/2017_12_23_223124_create_products_table.php
index 135096f03..2e1e5c47e 100644
--- a/database/migrations/2017_12_23_223124_create_products_table.php
+++ b/database/migrations/2017_12_23_223124_create_products_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->integer('category_id')->index(); $sp6ab302->string('name'); $sp6ab302->longText('description'); $sp6ab302->integer('sort')->default(1000); $sp6ab302->integer('buy_min')->default(1); $sp6ab302->integer('buy_max')->default(10); $sp6ab302->integer('count_sold')->default(0); $sp6ab302->integer('count_all')->default(0); $sp6ab302->integer('count_warn')->default(0); $sp6ab302->boolean('support_coupon')->default(false); $sp6ab302->string('password')->nullable(); $sp6ab302->boolean('password_open')->default(false); $sp6ab302->integer('cost')->default(0); $sp6ab302->integer('price'); $sp6ab302->text('price_whole')->nullable(); $sp6ab302->text('instructions')->nullable(); $sp6ab302->text('fields')->nullable(); $sp6ab302->boolean('enabled'); $sp6ab302->tinyInteger('inventory')->default(\App\User::INVENTORY_AUTO); $sp6ab302->tinyInteger('fee_type')->default(\App\User::FEE_TYPE_AUTO); $sp6ab302->tinyInteger('delivery')->default(\App\Product::DELIVERY_AUTO); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('goods'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; class CreateProductsTable extends Migration { public function up() { Schema::create('products', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->integer('category_id')->index(); $sp390b4b->string('name'); $sp390b4b->longText('description'); $sp390b4b->integer('sort')->default(1000); $sp390b4b->integer('buy_min')->default(1); $sp390b4b->integer('buy_max')->default(10); $sp390b4b->integer('count_sold')->default(0); $sp390b4b->integer('count_all')->default(0); $sp390b4b->integer('count_warn')->default(0); $sp390b4b->boolean('support_coupon')->default(false); $sp390b4b->string('password')->nullable(); $sp390b4b->boolean('password_open')->default(false); $sp390b4b->integer('cost')->default(0); $sp390b4b->integer('price'); $sp390b4b->text('price_whole')->nullable(); $sp390b4b->text('instructions')->nullable(); $sp390b4b->text('fields')->nullable(); $sp390b4b->boolean('enabled'); $sp390b4b->tinyInteger('inventory')->default(\App\User::INVENTORY_AUTO); $sp390b4b->tinyInteger('fee_type')->default(\App\User::FEE_TYPE_AUTO); $sp390b4b->tinyInteger('delivery')->default(\App\Product::DELIVERY_AUTO); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('goods'); } }
\ No newline at end of file
diff --git a/database/migrations/2017_12_23_223252_create_cards_table.php b/database/migrations/2017_12_23_223252_create_cards_table.php
index 760637318..2fa922cdb 100644
--- a/database/migrations/2017_12_23_223252_create_cards_table.php
+++ b/database/migrations/2017_12_23_223252_create_cards_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->integer('product_id')->index(); $sp6ab302->text('card'); $sp6ab302->integer('type'); $sp6ab302->integer('status')->default(\App\Card::STATUS_NORMAL); $sp6ab302->integer('count_sold')->default(0); $sp6ab302->integer('count_all')->default(1); $sp6ab302->timestamps(); $sp6ab302->softDeletes(); }); DB::unprepared('ALTER TABLE `cards` CHANGE COLUMN `created_at` `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP;'); } public function down() { Schema::dropIfExists('cards'); try { DB::unprepared('DROP PROCEDURE `add_cards`;'); } catch (\Exception $sp81eee8) { } } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCardsTable extends Migration { public function up() { Schema::create('cards', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->integer('product_id')->index(); $sp390b4b->text('card'); $sp390b4b->integer('type'); $sp390b4b->integer('status')->default(\App\Card::STATUS_NORMAL); $sp390b4b->integer('count_sold')->default(0); $sp390b4b->integer('count_all')->default(1); $sp390b4b->timestamps(); $sp390b4b->softDeletes(); }); DB::unprepared('ALTER TABLE `cards` CHANGE COLUMN `created_at` `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP;'); } public function down() { Schema::dropIfExists('cards'); try { DB::unprepared('DROP PROCEDURE `add_cards`;'); } catch (\Exception $sp3f4aab) { } } }
\ No newline at end of file
diff --git a/database/migrations/2017_12_23_223508_create_orders_table.php b/database/migrations/2017_12_23_223508_create_orders_table.php
index 4e67e72da..38b865095 100644
--- a/database/migrations/2017_12_23_223508_create_orders_table.php
+++ b/database/migrations/2017_12_23_223508_create_orders_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->string('order_no', 128)->index(); $sp6ab302->integer('product_id'); $sp6ab302->string('product_name')->nullable(); $sp6ab302->integer('count'); $sp6ab302->string('ip')->nullable(); $sp6ab302->string('customer', 32)->nullable(); $sp6ab302->string('contact')->nullable(); $sp6ab302->text('contact_ext')->nullable(); $sp6ab302->tinyInteger('send_status')->default(App\Order::SEND_STATUS_UN); $sp6ab302->text('remark')->nullable(); $sp6ab302->integer('cost')->default(0); $sp6ab302->integer('price')->default(0); $sp6ab302->integer('discount')->default(0); $sp6ab302->integer('paid')->default(0); $sp6ab302->integer('fee')->default(0); $sp6ab302->integer('system_fee')->default(0); $sp6ab302->integer('income')->default(0); $sp6ab302->integer('pay_id'); $sp6ab302->string('pay_trade_no')->nullable(); $sp6ab302->integer('status')->default(\App\Order::STATUS_UNPAY); $sp6ab302->string('frozen_reason')->nullable(); $sp6ab302->string('api_out_no', 128)->nullable(); $sp6ab302->text('api_info')->nullable(); $sp6ab302->dateTime('paid_at')->nullable(); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('orders'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateOrdersTable extends Migration { public function up() { Schema::create('orders', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->string('order_no', 128)->index(); $sp390b4b->integer('product_id'); $sp390b4b->string('product_name')->nullable(); $sp390b4b->integer('count'); $sp390b4b->string('ip')->nullable(); $sp390b4b->string('customer', 32)->nullable(); $sp390b4b->string('contact')->nullable(); $sp390b4b->text('contact_ext')->nullable(); $sp390b4b->tinyInteger('send_status')->default(App\Order::SEND_STATUS_UN); $sp390b4b->text('remark')->nullable(); $sp390b4b->integer('cost')->default(0); $sp390b4b->integer('price')->default(0); $sp390b4b->integer('discount')->default(0); $sp390b4b->integer('paid')->default(0); $sp390b4b->integer('fee')->default(0); $sp390b4b->integer('system_fee')->default(0); $sp390b4b->integer('income')->default(0); $sp390b4b->integer('pay_id'); $sp390b4b->string('pay_trade_no')->nullable(); $sp390b4b->integer('status')->default(\App\Order::STATUS_UNPAY); $sp390b4b->string('frozen_reason')->nullable(); $sp390b4b->string('api_out_no', 128)->nullable(); $sp390b4b->text('api_info')->nullable(); $sp390b4b->dateTime('paid_at')->nullable(); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('orders'); } }
\ No newline at end of file
diff --git a/database/migrations/2017_12_23_223755_create_pays_table.php b/database/migrations/2017_12_23_223755_create_pays_table.php
index 99e1fe8e5..bd29759a6 100644
--- a/database/migrations/2017_12_23_223755_create_pays_table.php
+++ b/database/migrations/2017_12_23_223755_create_pays_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->string('name'); $sp6ab302->integer('sort')->default(1000); $sp6ab302->string('img'); $sp6ab302->string('driver'); $sp6ab302->string('way'); $sp6ab302->text('config'); $sp6ab302->text('comment')->nullable(); $sp6ab302->float('fee_system', 8, 4)->default(0.01); $sp6ab302->boolean('enabled'); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('pays'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePaysTable extends Migration { public function up() { Schema::create('pays', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->string('name'); $sp390b4b->integer('sort')->default(1000); $sp390b4b->string('img'); $sp390b4b->string('driver'); $sp390b4b->string('way'); $sp390b4b->text('config'); $sp390b4b->text('comment')->nullable(); $sp390b4b->float('fee_system', 8, 4)->default(0.01); $sp390b4b->boolean('enabled'); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('pays'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_01_02_142012_create_card_order_table.php b/database/migrations/2018_01_02_142012_create_card_order_table.php
index 02b198d6d..87ccf3ade 100644
--- a/database/migrations/2018_01_02_142012_create_card_order_table.php
+++ b/database/migrations/2018_01_02_142012_create_card_order_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('order_id')->index(); $sp6ab302->integer('card_id'); }); } public function down() { Schema::dropIfExists('card_order'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCardOrderTable extends Migration { public function up() { Schema::create('card_order', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('order_id')->index(); $sp390b4b->integer('card_id'); }); } public function down() { Schema::dropIfExists('card_order'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_01_28_183143_create_coupons_table.php b/database/migrations/2018_01_28_183143_create_coupons_table.php
index f2e4f14e4..98c6c009d 100644
--- a/database/migrations/2018_01_28_183143_create_coupons_table.php
+++ b/database/migrations/2018_01_28_183143_create_coupons_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->integer('category_id')->default(-1); $sp6ab302->integer('product_id')->default(-1); $sp6ab302->integer('type')->default(\App\Coupon::TYPE_REPEAT); $sp6ab302->integer('status')->default(\App\Coupon::STATUS_NORMAL); $sp6ab302->string('coupon', 100)->index(); $sp6ab302->integer('discount_type'); $sp6ab302->integer('discount_val'); $sp6ab302->integer('count_used')->default(0); $sp6ab302->integer('count_all')->default(1); $sp6ab302->string('remark')->nullable(); $sp6ab302->dateTime('expire_at')->nullable(); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('coupons'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCouponsTable extends Migration { public function up() { Schema::create('coupons', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->integer('category_id')->default(-1); $sp390b4b->integer('product_id')->default(-1); $sp390b4b->integer('type')->default(\App\Coupon::TYPE_REPEAT); $sp390b4b->integer('status')->default(\App\Coupon::STATUS_NORMAL); $sp390b4b->string('coupon', 100)->index(); $sp390b4b->integer('discount_type'); $sp390b4b->integer('discount_val'); $sp390b4b->integer('count_used')->default(0); $sp390b4b->integer('count_all')->default(1); $sp390b4b->string('remark')->nullable(); $sp390b4b->dateTime('expire_at')->nullable(); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('coupons'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_01_29_195459_create_logs_table.php b/database/migrations/2018_01_29_195459_create_logs_table.php
index 98c342c21..c0e6f1d5d 100644
--- a/database/migrations/2018_01_29_195459_create_logs_table.php
+++ b/database/migrations/2018_01_29_195459_create_logs_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->string('ip'); $sp6ab302->integer('action')->default(\App\Log::ACTION_LOGIN); $sp6ab302->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); }); } public function down() { Schema::dropIfExists('logs'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; class CreateLogsTable extends Migration { public function up() { Schema::create('logs', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->string('ip'); $sp390b4b->integer('action')->default(\App\Log::ACTION_LOGIN); $sp390b4b->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); }); } public function down() { Schema::dropIfExists('logs'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_01_29_205026_create_systems_table.php b/database/migrations/2018_01_29_205026_create_systems_table.php
index 32cc8966f..00cb89f6b 100644
--- a/database/migrations/2018_01_29_205026_create_systems_table.php
+++ b/database/migrations/2018_01_29_205026_create_systems_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->string('name', 100)->unique(); $sp6ab302->longText('value')->nullable(); $sp6ab302->timestamps(); }); } public function down() { Schema::dropIfExists('systems'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateSystemsTable extends Migration { public function up() { Schema::create('systems', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->string('name', 100)->unique(); $sp390b4b->longText('value')->nullable(); $sp390b4b->timestamps(); }); } public function down() { Schema::dropIfExists('systems'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_02_01_174100_create_fund_records_table.php b/database/migrations/2018_02_01_174100_create_fund_records_table.php
index 159697d7a..adf8f221f 100644
--- a/database/migrations/2018_02_01_174100_create_fund_records_table.php
+++ b/database/migrations/2018_02_01_174100_create_fund_records_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id')->index(); $sp6ab302->integer('type')->default(\App\FundRecord::TYPE_OUT); $sp6ab302->integer('amount'); $sp6ab302->integer('balance')->default(0); $sp6ab302->integer('order_id')->nullable(); $sp6ab302->string('withdraw_id')->nullable(); $sp6ab302->string('remark')->nullable(); $sp6ab302->timestamps(); }); DB::unprepared('ALTER TABLE `fund_records` CHANGE COLUMN `created_at` `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP;'); } public function down() { Schema::dropIfExists('fund_records'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateFundRecordsTable extends Migration { public function up() { Schema::create('fund_records', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id')->index(); $sp390b4b->integer('type')->default(\App\FundRecord::TYPE_OUT); $sp390b4b->integer('amount'); $sp390b4b->integer('balance')->default(0); $sp390b4b->integer('order_id')->nullable(); $sp390b4b->string('withdraw_id')->nullable(); $sp390b4b->string('remark')->nullable(); $sp390b4b->timestamps(); }); DB::unprepared('ALTER TABLE `fund_records` CHANGE COLUMN `created_at` `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP;'); } public function down() { Schema::dropIfExists('fund_records'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_02_01_202439_create_jobs_table.php b/database/migrations/2018_02_01_202439_create_jobs_table.php
index 5d37fd6ef..cfe91df8d 100644
--- a/database/migrations/2018_02_01_202439_create_jobs_table.php
+++ b/database/migrations/2018_02_01_202439_create_jobs_table.php
@@ -1,2 +1,2 @@
bigIncrements('id'); $sp6ab302->string('queue', 128)->index(); $sp6ab302->longText('payload'); $sp6ab302->unsignedTinyInteger('attempts'); $sp6ab302->unsignedInteger('reserved_at')->nullable(); $sp6ab302->unsignedInteger('available_at'); $sp6ab302->unsignedInteger('created_at'); }); } public function down() { Schema::dropIfExists('jobs'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateJobsTable extends Migration { public function up() { Schema::create('jobs', function (Blueprint $sp390b4b) { $sp390b4b->bigIncrements('id'); $sp390b4b->string('queue', 128)->index(); $sp390b4b->longText('payload'); $sp390b4b->unsignedTinyInteger('attempts'); $sp390b4b->unsignedInteger('reserved_at')->nullable(); $sp390b4b->unsignedInteger('available_at'); $sp390b4b->unsignedInteger('created_at'); }); } public function down() { Schema::dropIfExists('jobs'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_02_01_234941_create_files_table.php b/database/migrations/2018_02_01_234941_create_files_table.php
index fc26e4a76..8d246e21e 100644
--- a/database/migrations/2018_02_01_234941_create_files_table.php
+++ b/database/migrations/2018_02_01_234941_create_files_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->integer('user_id'); $sp6ab302->string('driver'); $sp6ab302->string('path'); $sp6ab302->string('url'); $sp6ab302->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); }); } public function down() { Schema::dropIfExists('files'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; class CreateFilesTable extends Migration { public function up() { Schema::create('files', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->integer('user_id'); $sp390b4b->string('driver'); $sp390b4b->string('path'); $sp390b4b->string('url'); $sp390b4b->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); }); } public function down() { Schema::dropIfExists('files'); } }
\ No newline at end of file
diff --git a/database/migrations/2018_05_17_112228_create_shop_themes_table.php b/database/migrations/2018_05_17_112228_create_shop_themes_table.php
index 28f266b95..134cbcf36 100644
--- a/database/migrations/2018_05_17_112228_create_shop_themes_table.php
+++ b/database/migrations/2018_05_17_112228_create_shop_themes_table.php
@@ -1,2 +1,2 @@
increments('id'); $sp6ab302->string('name', 128)->unique(); $sp6ab302->string('description')->nullable(); $sp6ab302->text('options')->nullable(); $sp6ab302->text('config')->nullable(); $sp6ab302->boolean('enabled')->default(true); }); \App\ShopTheme::freshList(); } public function down() { Schema::dropIfExists('shop_themes'); } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateShopThemesTable extends Migration { public function up() { Schema::create('shop_themes', function (Blueprint $sp390b4b) { $sp390b4b->increments('id'); $sp390b4b->string('name', 128)->unique(); $sp390b4b->string('description')->nullable(); $sp390b4b->text('options')->nullable(); $sp390b4b->text('config')->nullable(); $sp390b4b->boolean('enabled')->default(true); }); \App\ShopTheme::freshList(); } public function down() { Schema::dropIfExists('shop_themes'); } }
\ No newline at end of file
diff --git a/database/migrations/2019_02_07_195259_add_count_to_products.php b/database/migrations/2019_02_07_195259_add_count_to_products.php
index 567969cc2..c74cadc9b 100644
--- a/database/migrations/2019_02_07_195259_add_count_to_products.php
+++ b/database/migrations/2019_02_07_195259_add_count_to_products.php
@@ -1,2 +1,2 @@
integer('count_all')->default(0)->after('count_sold'); }); App\Product::whereRaw('1')->update(array('count_sold' => 0, 'count_all' => 0)); \App\Card::selectRaw('`product_id`,SUM(`count_sold`) as `count_sold`,SUM(`count_all`) as `count_all`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp2300d6) { foreach ($sp2300d6 as $sp2fe3cd) { \App\Product::where('id', $sp2fe3cd->product_id)->update(array('count_sold' => $sp2fe3cd->count_sold, 'count_all' => $sp2fe3cd->count_all)); } }); } } public function down() { if (Schema::hasColumn('products', 'count_all')) { Schema::table('products', function (Blueprint $sp6ab302) { $sp6ab302->dropColumn(array('count_all')); }); } } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddCountToProducts extends Migration { public function up() { if (!Schema::hasColumn('products', 'count_all')) { Schema::table('products', function (Blueprint $sp390b4b) { $sp390b4b->integer('count_all')->default(0)->after('count_sold'); }); App\Product::whereRaw('1')->update(array('count_sold' => 0, 'count_all' => 0)); \App\Card::selectRaw('`product_id`,SUM(`count_sold`) as `count_sold`,SUM(`count_all`) as `count_all`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp2e1960) { foreach ($sp2e1960 as $sp87990b) { \App\Product::where('id', $sp87990b->product_id)->update(array('count_sold' => $sp87990b->count_sold, 'count_all' => $sp87990b->count_all)); } }); } } public function down() { if (Schema::hasColumn('products', 'count_all')) { Schema::table('products', function (Blueprint $sp390b4b) { $sp390b4b->dropColumn(array('count_all')); }); } } }
\ No newline at end of file
diff --git a/database/migrations/2019_02_14_203213_add_name_to_orders.php b/database/migrations/2019_02_14_203213_add_name_to_orders.php
index c427e8103..901eb9243 100644
--- a/database/migrations/2019_02_14_203213_add_name_to_orders.php
+++ b/database/migrations/2019_02_14_203213_add_name_to_orders.php
@@ -1,2 +1,2 @@
string('product_name')->nullable()->after('product_id'); }); } } public function down() { } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddNameToOrders extends Migration { public function up() { if (!Schema::hasColumn('orders', 'product_name')) { Schema::table('orders', function (Blueprint $sp390b4b) { $sp390b4b->string('product_name')->nullable()->after('product_id'); }); } } public function down() { } }
\ No newline at end of file
diff --git a/database/migrations/2019_04_28_230220_add_inventory_to_products.php b/database/migrations/2019_04_28_230220_add_inventory_to_products.php
index 017d8aec7..49e0fb736 100644
--- a/database/migrations/2019_04_28_230220_add_inventory_to_products.php
+++ b/database/migrations/2019_04_28_230220_add_inventory_to_products.php
@@ -1,2 +1,2 @@
tinyInteger('inventory')->default(\App\User::INVENTORY_AUTO)->after('enabled'); $sp6ab302->tinyInteger('fee_type')->default(\App\User::FEE_TYPE_AUTO)->after('inventory'); }); } } public function down() { foreach (array('inventory', 'fee_type') as $spf39863) { try { Schema::table('products', function (Blueprint $sp6ab302) use($spf39863) { $sp6ab302->dropColumn($spf39863); }); } catch (\Throwable $sp81eee8) { } } } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddInventoryToProducts extends Migration { public function up() { if (!Schema::hasColumn('products', 'inventory')) { Schema::table('products', function (Blueprint $sp390b4b) { $sp390b4b->tinyInteger('inventory')->default(\App\User::INVENTORY_AUTO)->after('enabled'); $sp390b4b->tinyInteger('fee_type')->default(\App\User::FEE_TYPE_AUTO)->after('inventory'); }); } } public function down() { foreach (array('inventory', 'fee_type') as $sp77f92d) { try { Schema::table('products', function (Blueprint $sp390b4b) use($sp77f92d) { $sp390b4b->dropColumn($sp77f92d); }); } catch (\Throwable $sp3f4aab) { } } } }
\ No newline at end of file
diff --git a/database/migrations/2019_05_18_131719_add_all_to_fund_records.php b/database/migrations/2019_05_18_131719_add_all_to_fund_records.php
index 933e95556..89f69ec3b 100644
--- a/database/migrations/2019_05_18_131719_add_all_to_fund_records.php
+++ b/database/migrations/2019_05_18_131719_add_all_to_fund_records.php
@@ -1,2 +1,2 @@
integer('all')->nullable()->after('amount'); $sp6ab302->integer('frozen')->nullable()->after('all'); $sp6ab302->integer('paid')->nullable()->after('frozen'); }); } } public function down() { foreach (array('all', 'frozen', 'paid') as $spf39863) { try { Schema::table('fund_records', function (Blueprint $sp6ab302) use($spf39863) { $sp6ab302->dropColumn($spf39863); }); } catch (\Throwable $sp81eee8) { } } } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddAllToFundRecords extends Migration { public function up() { if (!Schema::hasColumn('fund_records', 'all')) { Schema::table('fund_records', function (Blueprint $sp390b4b) { $sp390b4b->integer('all')->nullable()->after('amount'); $sp390b4b->integer('frozen')->nullable()->after('all'); $sp390b4b->integer('paid')->nullable()->after('frozen'); }); } } public function down() { foreach (array('all', 'frozen', 'paid') as $sp77f92d) { try { Schema::table('fund_records', function (Blueprint $sp390b4b) use($sp77f92d) { $sp390b4b->dropColumn($sp77f92d); }); } catch (\Throwable $sp3f4aab) { } } } }
\ No newline at end of file
diff --git a/database/migrations/2019_06_17_185712_add_options_to_shop_theme.php b/database/migrations/2019_06_17_185712_add_options_to_shop_theme.php
index 2c96539c6..dcfc3fea2 100644
--- a/database/migrations/2019_06_17_185712_add_options_to_shop_theme.php
+++ b/database/migrations/2019_06_17_185712_add_options_to_shop_theme.php
@@ -1,2 +1,2 @@
text('options')->nullable()->after('description'); }); } } public function down() { } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddOptionsToShopTheme extends Migration { public function up() { if (!Schema::hasColumn('shop_themes', 'options')) { Schema::table('shop_themes', function (Blueprint $sp390b4b) { $sp390b4b->text('options')->nullable()->after('description'); }); } } public function down() { } }
\ No newline at end of file
diff --git a/database/migrations/2019_06_18_112211_add_manual_products.php b/database/migrations/2019_06_18_112211_add_manual_products.php
index f50fa3c18..7a568563e 100644
--- a/database/migrations/2019_06_18_112211_add_manual_products.php
+++ b/database/migrations/2019_06_18_112211_add_manual_products.php
@@ -1,6 +1,6 @@
text('fields')->nullable()->after('instructions'); $sp6ab302->tinyInteger('delivery')->default(\App\Product::DELIVERY_AUTO)->after('fee_type'); }); } if (!Schema::hasColumn('orders', 'contact_ext')) { DB::unprepared('
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddManualProducts extends Migration { public function up() { if (!Schema::hasColumn('products', 'fields')) { Schema::table('products', function (Blueprint $sp390b4b) { $sp390b4b->text('fields')->nullable()->after('instructions'); $sp390b4b->tinyInteger('delivery')->default(\App\Product::DELIVERY_AUTO)->after('fee_type'); }); } if (!Schema::hasColumn('orders', 'contact_ext')) { DB::unprepared('
ALTER TABLE `orders`
CHANGE COLUMN `email` `contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `customer`,
CHANGE COLUMN `email_sent` `send_status` tinyint(4) NOT NULL DEFAULT 0 AFTER `contact`;
- '); Schema::table('orders', function (Blueprint $sp6ab302) { $sp6ab302->text('contact_ext')->nullable()->after('contact'); }); } } public function down() { } }
\ No newline at end of file
+ '); Schema::table('orders', function (Blueprint $sp390b4b) { $sp390b4b->text('contact_ext')->nullable()->after('contact'); }); } } public function down() { } }
\ No newline at end of file
diff --git a/database/migrations/2019_07_03_213426_add_sms_price_to_orders.php b/database/migrations/2019_07_03_213426_add_sms_price_to_orders.php
index a70340027..1fe94dd87 100644
--- a/database/migrations/2019_07_03_213426_add_sms_price_to_orders.php
+++ b/database/migrations/2019_07_03_213426_add_sms_price_to_orders.php
@@ -1,2 +1,2 @@
integer('sms_price')->default(0)->after('discount'); }); } } public function down() { } }
\ No newline at end of file
+use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddSmsPriceToOrders extends Migration { public function up() { if (!Schema::hasColumn('orders', 'sms_price')) { Schema::table('orders', function (Blueprint $sp390b4b) { $sp390b4b->integer('sms_price')->default(0)->after('discount'); }); } } public function down() { } }
\ No newline at end of file
diff --git a/database/seeds/CardsSeeder.php b/database/seeds/CardsSeeder.php
index 721ce587f..867942ee0 100644
--- a/database/seeds/CardsSeeder.php
+++ b/database/seeds/CardsSeeder.php
@@ -1,2 +1,2 @@
id; \App\Card::insert(array(array('user_id' => $spfa021e, 'product_id' => 1, 'card' => '11111', 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_NORMAL, 'count_sold' => 0, 'count_all' => 1), array('user_id' => $spfa021e, 'product_id' => 1, 'card' => '11112', 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_SOLD, 'count_sold' => 1, 'count_all' => 1), array('user_id' => $spfa021e, 'product_id' => 1, 'card' => '11113', 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_NORMAL, 'count_sold' => 0, 'count_all' => 1), array('user_id' => $spfa021e, 'product_id' => 2, 'card' => '123456', 'type' => \App\Card::TYPE_REPEAT, 'status' => \App\Card::STATUS_SOLD, 'count_sold' => 2, 'count_all' => 100))); } }
\ No newline at end of file
+use Illuminate\Database\Seeder; class CardsSeeder extends Seeder { public function run() { $sp15a746 = \App\User::first()->id; \App\Card::insert(array(array('user_id' => $sp15a746, 'product_id' => 1, 'card' => '11111', 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_NORMAL, 'count_sold' => 0, 'count_all' => 1), array('user_id' => $sp15a746, 'product_id' => 1, 'card' => '11112', 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_SOLD, 'count_sold' => 1, 'count_all' => 1), array('user_id' => $sp15a746, 'product_id' => 1, 'card' => '11113', 'type' => \App\Card::TYPE_ONETIME, 'status' => \App\Card::STATUS_NORMAL, 'count_sold' => 0, 'count_all' => 1), array('user_id' => $sp15a746, 'product_id' => 2, 'card' => '123456', 'type' => \App\Card::TYPE_REPEAT, 'status' => \App\Card::STATUS_SOLD, 'count_sold' => 2, 'count_all' => 100))); } }
\ No newline at end of file
diff --git a/database/seeds/OrdersSeeder.php b/database/seeds/OrdersSeeder.php
index 86dff2382..01eceab1f 100644
--- a/database/seeds/OrdersSeeder.php
+++ b/database/seeds/OrdersSeeder.php
@@ -1,2 +1,2 @@
1000, 'user_id' => 0, 'order_no' => '123456', 'product_id' => \App\Product::first()->id, 'count' => 0, 'contact' => '', 'pay_id' => 0, 'status' => \App\Order::STATUS_UNPAY)); try { \App\Order::where('id', 1000)->delete(); } catch (Exception $sp81eee8) { } } public function run() { self::increaseId(); } }
\ No newline at end of file
+use Illuminate\Database\Seeder; class OrdersSeeder extends Seeder { private function increaseId() { \App\Order::insert(array('id' => 1000, 'user_id' => 0, 'order_no' => '123456', 'product_id' => \App\Product::first()->id, 'count' => 0, 'contact' => '', 'pay_id' => 0, 'status' => \App\Order::STATUS_UNPAY)); try { \App\Order::where('id', 1000)->delete(); } catch (Exception $sp3f4aab) { } } public function run() { self::increaseId(); } }
\ No newline at end of file
diff --git a/database/seeds/PayTableSeeder.php b/database/seeds/PayTableSeeder.php
index accc751d1..de6114c98 100644
--- a/database/seeds/PayTableSeeder.php
+++ b/database/seeds/PayTableSeeder.php
@@ -1,70 +1,70 @@
name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'Fakala'; $spd46fd8->way = 'alipay'; $spd46fd8->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $spd46fd8->config = '{
+use Illuminate\Database\Seeder; class PayTableSeeder extends Seeder { private function initPay() { $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'Fakala'; $sp5de949->way = 'alipay'; $sp5de949->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $sp5de949->config = '{
"gateway": "https://www.327ka.com",
"api_id": "your api_id",
"api_key": "your api_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_PC; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'Fakala'; $spd46fd8->way = 'alipaywap'; $spd46fd8->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_PC; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'Fakala'; $sp5de949->way = 'alipaywap'; $sp5de949->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $sp5de949->config = '{
"gateway": "https://www.327ka.com",
"api_id": "your api_id",
"api_key": "your api_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_MOBILE; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '微信'; $spd46fd8->img = '/plugins/images/wx.png'; $spd46fd8->driver = 'Fakala'; $spd46fd8->way = 'wx'; $spd46fd8->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_MOBILE; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '微信'; $sp5de949->img = '/plugins/images/wx.png'; $sp5de949->driver = 'Fakala'; $sp5de949->way = 'wx'; $sp5de949->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $sp5de949->config = '{
"gateway": "https://www.327ka.com",
"api_id": "your api_id",
"api_key": "your api_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_PC; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '微信'; $spd46fd8->img = '/plugins/images/wx.png'; $spd46fd8->driver = 'Fakala'; $spd46fd8->way = 'wxwap'; $spd46fd8->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_PC; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '微信'; $sp5de949->img = '/plugins/images/wx.png'; $sp5de949->driver = 'Fakala'; $sp5de949->way = 'wxwap'; $sp5de949->comment = 'alipay、alipaywap、wx、wxwap、qq、qqwap'; $sp5de949->config = '{
"gateway": "https://www.327ka.com",
"api_id": "your api_id",
"api_key": "your api_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_MOBILE; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'Alipay'; $spd46fd8->way = 'pc'; $spd46fd8->comment = '支付宝 - 即时到账套餐(企业)V2'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_MOBILE; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'Alipay'; $sp5de949->way = 'pc'; $sp5de949->comment = '支付宝 - 即时到账套餐(企业)V2'; $sp5de949->config = '{
"partner": "partner",
"key": "key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'Aliwap'; $spd46fd8->way = 'wap'; $spd46fd8->comment = '支付宝 - 高级手机网站支付V4'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'Aliwap'; $sp5de949->way = 'wap'; $sp5de949->comment = '支付宝 - 高级手机网站支付V4'; $sp5de949->config = '{
"partner": "partner",
"key": "key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝扫码'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'AliAop'; $spd46fd8->way = 'f2f'; $spd46fd8->comment = '支付宝 - 当面付'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝扫码'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'AliAop'; $sp5de949->way = 'f2f'; $sp5de949->comment = '支付宝 - 当面付'; $sp5de949->config = '{
"app_id": "app_id",
"alipay_public_key": "alipay_public_key",
"merchant_private_key": "merchant_private_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'AliAop'; $spd46fd8->way = 'pc'; $spd46fd8->comment = '支付宝 - 电脑网站支付 (新)'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'AliAop'; $sp5de949->way = 'pc'; $sp5de949->comment = '支付宝 - 电脑网站支付 (新)'; $sp5de949->config = '{
"app_id": "app_id",
"alipay_public_key": "alipay_public_key",
"merchant_private_key": "merchant_private_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '手机支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'AliAop'; $spd46fd8->way = 'mobile'; $spd46fd8->comment = '支付宝 - 手机网站支付 (新)'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '手机支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'AliAop'; $sp5de949->way = 'mobile'; $sp5de949->comment = '支付宝 - 手机网站支付 (新)'; $sp5de949->config = '{
"app_id": "app_id",
"alipay_public_key": "alipay_public_key",
"merchant_private_key": "merchant_private_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '微信扫码'; $spd46fd8->img = '/plugins/images/wx.png'; $spd46fd8->driver = 'WeChat'; $spd46fd8->way = 'NATIVE'; $spd46fd8->comment = '微信支付 - 扫码'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '微信扫码'; $sp5de949->img = '/plugins/images/wx.png'; $sp5de949->driver = 'WeChat'; $sp5de949->way = 'NATIVE'; $sp5de949->comment = '微信支付 - 扫码'; $sp5de949->config = '{
"APPID": "APPID",
"APPSECRET": "APPSECRET",
"MCHID": "商户ID",
"KEY": "KEY"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '微信H5'; $spd46fd8->img = '/plugins/images/wx.png'; $spd46fd8->driver = 'WeChat'; $spd46fd8->way = 'MWEB'; $spd46fd8->comment = '微信支付 - H5 (需要开通权限)'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '微信H5'; $sp5de949->img = '/plugins/images/wx.png'; $sp5de949->driver = 'WeChat'; $sp5de949->way = 'MWEB'; $sp5de949->comment = '微信支付 - H5 (需要开通权限)'; $sp5de949->config = '{
"APPID": "APPID",
"APPSECRET": "APPSECRET",
"MCHID": "商户ID",
"KEY": "KEY"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '手机QQ'; $spd46fd8->img = '/plugins/images/qq.png'; $spd46fd8->driver = 'QPay'; $spd46fd8->way = 'NATIVE'; $spd46fd8->comment = '手机QQ - 扫码'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '手机QQ'; $sp5de949->img = '/plugins/images/qq.png'; $sp5de949->driver = 'QPay'; $sp5de949->way = 'NATIVE'; $sp5de949->comment = '手机QQ - 扫码'; $sp5de949->config = '{
"mch_id": "mch_id",
"mch_key": "mch_key"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'Youzan'; $spd46fd8->way = 'alipay'; $spd46fd8->comment = '有赞支付 - 支付宝'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'Youzan'; $sp5de949->way = 'alipay'; $sp5de949->comment = '有赞支付 - 支付宝'; $sp5de949->config = '{
"client_id": "client_id",
"client_secret": "client_secret",
"kdt_id": "kdt_id"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '微信'; $spd46fd8->img = '/plugins/images/wx.png'; $spd46fd8->driver = 'Youzan'; $spd46fd8->way = 'wechat'; $spd46fd8->comment = '有赞支付 - 微信'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '微信'; $sp5de949->img = '/plugins/images/wx.png'; $sp5de949->driver = 'Youzan'; $sp5de949->way = 'wechat'; $sp5de949->comment = '有赞支付 - 微信'; $sp5de949->config = '{
"client_id": "client_id",
"client_secret": "client_secret",
"kdt_id": "kdt_id"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '手机QQ'; $spd46fd8->img = '/plugins/images/qq.png'; $spd46fd8->driver = 'Youzan'; $spd46fd8->way = 'qq'; $spd46fd8->comment = '有赞支付 - 手机QQ'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '手机QQ'; $sp5de949->img = '/plugins/images/qq.png'; $sp5de949->driver = 'Youzan'; $sp5de949->way = 'qq'; $sp5de949->comment = '有赞支付 - 手机QQ'; $sp5de949->config = '{
"client_id": "client_id",
"client_secret": "client_secret",
"kdt_id": "kdt_id"
-}'; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '支付宝'; $spd46fd8->img = '/plugins/images/ali.png'; $spd46fd8->driver = 'CodePay'; $spd46fd8->way = 'alipay'; $spd46fd8->comment = '码支付 - 支付宝'; $spd46fd8->config = '{
+}'; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '支付宝'; $sp5de949->img = '/plugins/images/ali.png'; $sp5de949->driver = 'CodePay'; $sp5de949->way = 'alipay'; $sp5de949->comment = '码支付 - 支付宝'; $sp5de949->config = '{
"id": "id",
"key": "key"
-}'; $spd46fd8->fee_system = 0; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '微信'; $spd46fd8->img = '/plugins/images/wx.png'; $spd46fd8->driver = 'CodePay'; $spd46fd8->way = 'weixin'; $spd46fd8->comment = '码支付 - 微信'; $spd46fd8->config = '{
+}'; $sp5de949->fee_system = 0; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '微信'; $sp5de949->img = '/plugins/images/wx.png'; $sp5de949->driver = 'CodePay'; $sp5de949->way = 'weixin'; $sp5de949->comment = '码支付 - 微信'; $sp5de949->config = '{
"id": "id",
"key": "key"
-}'; $spd46fd8->fee_system = 0; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); $spd46fd8 = new \App\Pay(); $spd46fd8->name = '手机QQ'; $spd46fd8->img = '/plugins/images/qq.png'; $spd46fd8->driver = 'CodePay'; $spd46fd8->way = 'qq'; $spd46fd8->comment = '码支付 - 手机QQ'; $spd46fd8->config = '{
+}'; $sp5de949->fee_system = 0; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); $sp5de949 = new \App\Pay(); $sp5de949->name = '手机QQ'; $sp5de949->img = '/plugins/images/qq.png'; $sp5de949->driver = 'CodePay'; $sp5de949->way = 'qq'; $sp5de949->comment = '码支付 - 手机QQ'; $sp5de949->config = '{
"id": "id",
"key": "key"
-}'; $spd46fd8->fee_system = 0; $spd46fd8->enabled = \App\Pay::ENABLED_DISABLED; $spd46fd8->save(); } public function run() { self::initPay(); } }
\ No newline at end of file
+}'; $sp5de949->fee_system = 0; $sp5de949->enabled = \App\Pay::ENABLED_DISABLED; $sp5de949->save(); } public function run() { self::initPay(); } }
\ No newline at end of file
diff --git a/database/seeds/ProductsSeeder.php b/database/seeds/ProductsSeeder.php
index 0860f7ec4..439630912 100644
--- a/database/seeds/ProductsSeeder.php
+++ b/database/seeds/ProductsSeeder.php
@@ -1,2 +1,2 @@
id; $spb7fea4 = new \App\Category(); $spb7fea4->user_id = $spfa021e; $spb7fea4->name = '测试分组'; $spb7fea4->enabled = true; $spb7fea4->save(); $spb7fea4 = new \App\Category(); $spb7fea4->user_id = $spfa021e; $spb7fea4->name = '这里是一个啦啦啦啦啦啦超级无敌爆炸螺旋长的商品类别标题'; $spb7fea4->enabled = true; $spb7fea4->save(); $spb7fea4 = new \App\Category(); $spb7fea4->user_id = $spfa021e; $spb7fea4->name = '密码123456'; $spb7fea4->enabled = true; $spb7fea4->password = '123456'; $spb7fea4->password_open = true; $spb7fea4->save(); $sp71cb0c = new \App\Product(); $sp71cb0c->id = 1; $sp71cb0c->user_id = $spfa021e; $sp71cb0c->category_id = 1; $sp71cb0c->name = '测试商品'; $sp71cb0c->description = '这里是测试商品的一段简短的描述'; $sp71cb0c->price = 1; $sp71cb0c->enabled = true; $sp71cb0c->support_coupon = true; $sp71cb0c->count_sold = 1; $sp71cb0c->count_all = 3; $sp71cb0c->instructions = '充值网址: XXXXX'; $sp71cb0c->save(); $sp71cb0c = new \App\Product(); $sp71cb0c->id = 2; $sp71cb0c->user_id = $spfa021e; $sp71cb0c->category_id = 1; $sp71cb0c->name = '重复测试密码123456'; $sp71cb0c->description = '商品描述
所十二星座运势查询,提前预测2016年十二星座运势内容,让你能够占卜吉凶;2016年生肖运势测算,生肖开运,周易风水。'; $sp71cb0c->instructions = '充值网址: XXXXX'; $sp71cb0c->password = '123456'; $sp71cb0c->password_open = true; $sp71cb0c->support_coupon = true; $sp71cb0c->price = 10; $sp71cb0c->price_whole = '[["2","8"],["10","5"]]'; $sp71cb0c->enabled = true; $sp71cb0c->count_sold = 2; $sp71cb0c->count_all = 100; $sp71cb0c->count_warn = 10; $sp71cb0c->save(); $sp71cb0c = new \App\Product(); $sp71cb0c->user_id = $spfa021e; $sp71cb0c->category_id = 2; $sp71cb0c->name = '测试商品_2'; $sp71cb0c->description = '这里是测试商品的一段简短的描述, 可以插入多媒体文本'; $sp71cb0c->price = 1; $sp71cb0c->enabled = true; $sp71cb0c->save(); $sp71cb0c = new \App\Product(); $sp71cb0c->user_id = $spfa021e; $sp71cb0c->category_id = 3; $sp71cb0c->name = '测试商品_3'; $sp71cb0c->description = '这里是测试商品的一段简短的描述, 可以插入多媒体文本'; $sp71cb0c->price = 1; $sp71cb0c->enabled = true; $sp71cb0c->save(); } }
\ No newline at end of file
+use Illuminate\Database\Seeder; class ProductsSeeder extends Seeder { public function run() { $sp15a746 = \App\User::first()->id; $sped57d9 = new \App\Category(); $sped57d9->user_id = $sp15a746; $sped57d9->name = '测试分组'; $sped57d9->enabled = true; $sped57d9->save(); $sped57d9 = new \App\Category(); $sped57d9->user_id = $sp15a746; $sped57d9->name = '这里是一个啦啦啦啦啦啦超级无敌爆炸螺旋长的商品类别标题'; $sped57d9->enabled = true; $sped57d9->save(); $sped57d9 = new \App\Category(); $sped57d9->user_id = $sp15a746; $sped57d9->name = '密码123456'; $sped57d9->enabled = true; $sped57d9->password = '123456'; $sped57d9->password_open = true; $sped57d9->save(); $sp2cf004 = new \App\Product(); $sp2cf004->id = 1; $sp2cf004->user_id = $sp15a746; $sp2cf004->category_id = 1; $sp2cf004->name = '测试商品'; $sp2cf004->description = '这里是测试商品的一段简短的描述'; $sp2cf004->price = 1; $sp2cf004->enabled = true; $sp2cf004->support_coupon = true; $sp2cf004->count_sold = 1; $sp2cf004->count_all = 3; $sp2cf004->instructions = '充值网址: XXXXX'; $sp2cf004->save(); $sp2cf004 = new \App\Product(); $sp2cf004->id = 2; $sp2cf004->user_id = $sp15a746; $sp2cf004->category_id = 1; $sp2cf004->name = '重复测试密码123456'; $sp2cf004->description = '商品描述
所十二星座运势查询,提前预测2016年十二星座运势内容,让你能够占卜吉凶;2016年生肖运势测算,生肖开运,周易风水。'; $sp2cf004->instructions = '充值网址: XXXXX'; $sp2cf004->password = '123456'; $sp2cf004->password_open = true; $sp2cf004->support_coupon = true; $sp2cf004->price = 10; $sp2cf004->price_whole = '[["2","8"],["10","5"]]'; $sp2cf004->enabled = true; $sp2cf004->count_sold = 2; $sp2cf004->count_all = 100; $sp2cf004->count_warn = 10; $sp2cf004->save(); $sp2cf004 = new \App\Product(); $sp2cf004->user_id = $sp15a746; $sp2cf004->category_id = 2; $sp2cf004->name = '测试商品_2'; $sp2cf004->description = '这里是测试商品的一段简短的描述, 可以插入多媒体文本'; $sp2cf004->price = 1; $sp2cf004->enabled = true; $sp2cf004->save(); $sp2cf004 = new \App\Product(); $sp2cf004->user_id = $sp15a746; $sp2cf004->category_id = 3; $sp2cf004->name = '测试商品_3'; $sp2cf004->description = '这里是测试商品的一段简短的描述, 可以插入多媒体文本'; $sp2cf004->price = 1; $sp2cf004->enabled = true; $sp2cf004->save(); } }
\ No newline at end of file
diff --git a/database/seeds/SystemSeeder.php b/database/seeds/SystemSeeder.php
index 79b589fb7..eced5eb93 100644
--- a/database/seeds/SystemSeeder.php
+++ b/database/seeds/SystemSeeder.php
@@ -1,2 +1,2 @@
'XX小店', 'app_title' => '自动发卡, 自动发货', 'app_url' => 'http://www.example.com', 'app_url_api' => 'http://www.example.com', 'company' => '©2019 Windy', 'keywords' => '在线发卡系统', 'description' => '我是一个发卡系统, 这里填写描述', 'shop_bkg' => 'http://api.izhao.me/img', 'shop_ann' => '欢迎来到XXX小店', 'shop_ann_pop' => '', 'shop_inventory' => 1, 'js_tj' => '', 'js_kf' => '', 'vcode_driver' => 'geetest', 'vcode_login' => '0', 'vcode_shop_buy' => '0', 'vcode_shop_search' => '0', 'storage_driver' => 'local', 'order_clean_unpay_open' => '0', 'order_clean_unpay_day' => '7', 'mail_driver' => 'smtp', 'mail_smtp_host' => 'smtp.mailtrap.io', 'mail_smtp_port' => '25', 'mail_smtp_username' => 'xxx', 'mail_smtp_password' => 'xxx', 'mail_smtp_from_address' => 'hello@example.com', 'mail_smtp_from_name' => 'test', 'mail_smtp_encryption' => 'null'); $spc1bbc8 = array(); foreach ($sp85409e as $spce2336 => $sp39a929) { $spc1bbc8[] = array('name' => $spce2336, 'value' => $sp39a929); } DB::table('systems')->insert($spc1bbc8); } }
\ No newline at end of file
+use Illuminate\Database\Seeder; class SystemSeeder extends Seeder { public function run() { $sp942269 = array('app_name' => 'XX小店', 'app_title' => '自动发卡, 自动发货', 'app_url' => 'http://www.example.com', 'app_url_api' => 'http://www.example.com', 'company' => '©2019 Windy', 'keywords' => '在线发卡系统', 'description' => '我是一个发卡系统, 这里填写描述', 'shop_bkg' => 'http://api.izhao.me/img', 'shop_ann' => '欢迎来到XXX小店', 'shop_ann_pop' => '', 'shop_inventory' => 1, 'js_tj' => '', 'js_kf' => '', 'vcode_driver' => 'geetest', 'vcode_login' => '0', 'vcode_shop_buy' => '0', 'vcode_shop_search' => '0', 'storage_driver' => 'local', 'order_clean_unpay_open' => '0', 'order_clean_unpay_day' => '7', 'mail_driver' => 'smtp', 'mail_smtp_host' => 'smtp.mailtrap.io', 'mail_smtp_port' => '25', 'mail_smtp_username' => 'xxx', 'mail_smtp_password' => 'xxx', 'mail_smtp_from_address' => 'hello@example.com', 'mail_smtp_from_name' => 'test', 'mail_smtp_encryption' => 'null'); $spf8034b = array(); foreach ($sp942269 as $sp17f3a7 => $sp75c248) { $spf8034b[] = array('name' => $sp17f3a7, 'value' => $sp75c248); } DB::table('systems')->insert($spf8034b); } }
\ No newline at end of file
diff --git a/public/index.php b/public/index.php
index 2b0a32ff7..4254c72b1 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,2 +1,2 @@
make(Illuminate\Contracts\Http\Kernel::class); $sp3ac4e3 = $sp0830f3->handle($spfeab54 = Illuminate\Http\Request::capture()); $sp3ac4e3->send(); $sp0830f3->terminate($spfeab54, $sp3ac4e3);
\ No newline at end of file
+if (isset($_SERVER['HTTP_ALI_SWIFT_STAT_HOST'])) { $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_ALI_SWIFT_STAT_HOST']; $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_ALI_SWIFT_STAT_HOST']; } define('LARAVEL_START', microtime(true)); require __DIR__ . '/../vendor/autoload.php'; $spaaf7a6 = (require_once __DIR__ . '/../bootstrap/app.php'); $spaaeb39 = $spaaf7a6->make(Illuminate\Contracts\Http\Kernel::class); $spdc5091 = $spaaeb39->handle($spf066f3 = Illuminate\Http\Request::capture()); $spdc5091->send(); $spaaeb39->terminate($spf066f3, $spdc5091);
\ No newline at end of file
diff --git a/routes/channels.php b/routes/channels.php
index fa031aaff..1d2fcd27b 100644
--- a/routes/channels.php
+++ b/routes/channels.php
@@ -1,2 +1,2 @@
id === (int) $sp53f8aa; });
\ No newline at end of file
+Broadcast::channel('App.User.{id}', function ($spbbb773, $sp3c46ab) { return (int) $spbbb773->id === (int) $sp3c46ab; });
\ No newline at end of file