-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tai7sy-Mac
committed
Jul 9, 2019
0 parents
commit f498cb1
Showing
347 changed files
with
15,241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=数据库地址 | ||
DB_PORT=数据库端口 | ||
DB_DATABASE=数据库名称 | ||
DB_USERNAME=用户名 | ||
DB_PASSWORD=密码 | ||
|
||
|
||
# 下面配置无需修改 | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=false | ||
APP_LOG_LEVEL=error | ||
APP_LOG=daily | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
SESSION_LIFETIME=120 | ||
QUEUE_DRIVER=sync | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
/.idea | ||
/.vagrant | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
/.env | ||
/database/seeds/MyPayTableSeeder.php | ||
.phpstorm.meta.php | ||
_ide_helper* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"2.8","md5":"734c79b5b39f298efbc7fba546e6c0fa","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/2.8\/card_release.tar.gz"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
### 关于 | ||
|
||
> 当前版本: 2.8 | ||
> [安装教程 V2.X](https://github.com/Tai7sy/card-system/wiki/BT%E9%9D%A2%E6%9D%BF%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B---V2.X) | ||
> [更新教程 V2.X](https://github.com/Tai7sy/card-system/wiki/V2.X-%E6%9B%B4%E6%96%B0%E6%95%99%E7%A8%8B) | ||
> 广告: 商业版 [http://demo.fakaxitong.com/](http://demo.fakaxitong.com/) | ||
### 常见问题 | ||
- 修改 `.env` 文件无效 / 修改网站设置无效 | ||
``` | ||
cd /www/wwwroot/example.com #进入网站目录 | ||
php artisan config:clear | ||
php artisan cache:clear | ||
``` | ||
- 忘记密码后重置 | ||
``` | ||
cd /www/wwwroot/example.com #进入网站目录 | ||
php artisan reset:password [email protected] 123456 | ||
``` | ||
- 500错误 | ||
``` | ||
storage/logs 里面有错误详细内容, 可以自行参考解决, 或者附录log文件提交issue/mail | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
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($spfaef2f, $spad8100, $spdc3fe5, $spc3ee59, $sp28982f, $sp425ca9) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spfaef2f, $spad8100, $spdc3fe5, $spc3ee59, $sp28982f, (int) $sp425ca9)); } public static function _trash($spe440a8) { DB::transaction(function () use($spe440a8) { $sp822fce = clone $spe440a8; $sp822fce->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($speab77e) { foreach ($speab77e as $sp9bfdd7) { $spaeec37 = \App\Product::where('id', $sp9bfdd7->product_id)->lockForUpdate()->first(); if ($spaeec37) { $spaeec37->count_all -= $sp9bfdd7->count_left; $spaeec37->saveOrFail(); } } }); $spe440a8->delete(); return true; }); } public static function _restore($spe440a8) { DB::transaction(function () use($spe440a8) { $sp822fce = clone $spe440a8; $sp822fce->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($speab77e) { foreach ($speab77e as $sp9bfdd7) { $spaeec37 = \App\Product::where('id', $sp9bfdd7->product_id)->lockForUpdate()->first(); if ($spaeec37) { $spaeec37->count_all += $sp9bfdd7->count_left; $spaeec37->saveOrFail(); } } }); $spe440a8->restore(); return true; }); } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
namespace App; use Illuminate\Database\Eloquent\Model; class CardOrder extends Model { protected $table = 'card_order'; public $timestamps = false; function order() { return $this->belongsTo(Order::class); } function card() { return $this->belongsTo(Card::class)->withTrashed(); } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
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() { $sp1cba4d = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp1cba4d as $spaeec37) { $spaeec37->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp1cba4d); return $sp1cba4d; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
namespace App\Console\Commands; use Illuminate\Console\Command; class ResetPassword extends Command { protected $signature = 'reset:password {email} {password}'; protected $description = 'Reset the password of user | ||
Usage: php artisan reset:password [email protected]'; public function __construct() { parent::__construct(); } public function handle() { $spd6b98d = $this->argument('email'); if (!$spd6b98d) { $this->warn('please input the user\'s email | ||
'); return false; } $sp694bd2 = \App\User::where('email', $spd6b98d)->first(); if (!$sp694bd2) { $this->warn("can't find the user: {$spd6b98d} \nplease input the user's email\n"); return false; } $spb07b5d = $this->argument('password'); $sp694bd2->password = bcrypt($spb07b5d); $sp694bd2->save(); $this->info("the password of '{$spd6b98d}' has been set to {$spb07b5d}\n"); return true; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
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 $spba8a1c) { if (!app()->runningInConsole()) { return; } if (System::_getInt('order_clean_unpay_open') === 1) { $sp135b94 = System::_getInt('order_clean_unpay_day', 7); $spba8a1c->call(function () use($sp135b94) { echo '[' . date('Y-m-d H:i:s') . "] cleaning unpaid orders({$sp135b94} days ago)...\n"; \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$sp135b94))->delete(); $sp06fc7d = '[' . date('Y-m-d H:i:s') . '] unpaid-orders cleaned | ||
'; echo $sp06fc7d; })->dailyAt('01:00'); } $spba8a1c->call(function () { $sp135b94 = 7; echo '[' . date('Y-m-d H:i:s') . "] cleaning deleted cards({$sp135b94} days ago)...\n"; \App\Card::onlyTrashed()->where('deleted_at', '<', (new Carbon())->addDays(-$sp135b94))->forceDelete(); $sp06fc7d = '[' . date('Y-m-d H:i:s') . '] deleted-cards cleaned | ||
'; echo $sp06fc7d; })->dailyAt('02:00'); } protected function commands() { $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
namespace App; use Illuminate\Database\Eloquent\Model; class Coupon extends Model { protected $guarded = array(); const STATUS_NORMAL = 0; const STATUS_USED = 2; const TYPE_ONETIME = 0; const TYPE_REPEAT = 1; const DISCOUNT_TYPE_AMOUNT = 0; const DISCOUNT_TYPE_PERCENT = 1; function product() { return $this->belongsTo(Product::class); } function category() { return $this->belongsTo(Category::class); } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
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 $sp8f27c2) { parent::report($sp8f27c2); } private function msg($spd5cc4d, $sp06fc7d, $spc3ee59) { return $spd5cc4d->isXmlHttpRequest() ? response()->json(array('message' => $sp06fc7d), $spc3ee59) : response()->view('errors._', array('code' => $spc3ee59, 'message' => $sp06fc7d), $spc3ee59); } public function render($spd5cc4d, Exception $spece20f) { if ($spece20f instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) { return $this->msg($spd5cc4d, '记录未找到', 404); } elseif ($spece20f instanceof \Illuminate\Auth\AuthenticationException) { return $this->msg($spd5cc4d, '您需要登录您的账户再进行此操作', 401); } elseif ($spece20f instanceof \Illuminate\Auth\Access\AuthorizationException) { return $this->msg($spd5cc4d, '未授权的操作', 403); } elseif ($spece20f instanceof \Illuminate\Validation\ValidationException) { return parent::render($spd5cc4d, $spece20f); } elseif ($spece20f instanceof \Illuminate\Session\TokenMismatchException) { return $this->msg($spd5cc4d, '请刷新页面后重试', 403); } elseif ($spece20f instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { return $this->msg($spd5cc4d, '页面未找到', 404); } elseif ($spece20f instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException) { return $this->msg($spd5cc4d, '请求方法不允许', 405); } elseif ($spece20f instanceof \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException) { Log::error('Caught a ServiceUnavailableHttpException', array('Exception' => $spece20f)); return $this->msg($spd5cc4d, '当前服务不可用,请稍后重试', 503); } elseif ($spece20f instanceof \Symfony\Component\HttpKernel\Exception\HttpException) { $sp6f36ad = $spd5cc4d->isXmlHttpRequest(); switch ($sp6f36ad) { case 429: return $this->msg($spd5cc4d, '您的请求过于频繁,请稍后重试', $sp6f36ad); break; default: Log::error('Caught a UnknownHttpException', array('Exception' => $spece20f)); return $this->msg($spd5cc4d, '当前服务不可用,请稍后重试', $sp6f36ad); } } Log::error('Uncaught Exception', array('Exception' => $spece20f)); if (config('app.debug')) { return parent::render($spd5cc4d, $spece20f); } else { return $this->msg($spd5cc4d, '未知错误,请查看错误日志(storage/logs)', 500); } } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
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 $spece20f) { \Log::error('File.deleteFile Error: ' . $spece20f->getMessage(), array('exception' => $spece20f)); } } public static function getProductFolder() { return 'images/product'; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
namespace App; use Illuminate\Database\Eloquent\Model; class FundRecord extends Model { protected $guarded = array(); const TYPE_IN = 1; const TYPE_OUT = 2; function order() { return $this->belongsTo(Order::class); } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
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 $spd5cc4d) { $sp5bd36e = array('today' => array('count' => 0, 'paid' => 0, 'profit' => 0), 'yesterday' => array('count' => 0, 'paid' => 0, 'profit' => 0)); $spf69415 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::now()->toDateString())->where(function ($spe440a8) { $spe440a8->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(); $spb33a22 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::yesterday()->toDateString())->where(function ($spe440a8) { $spe440a8->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($spf69415[0]) && isset($spf69415[0]['count'])) { $sp5bd36e['today'] = array('count' => (int) $spf69415[0]['count'], 'paid' => (int) $spf69415[0]['paid'], 'profit' => (int) $spf69415[0]['profit']); } if (isset($spb33a22[0]) && isset($spb33a22[0]['count'])) { $sp5bd36e['yesterday'] = array('count' => (int) $spb33a22[0]['count'], 'paid' => (int) $spb33a22[0]['paid'], 'profit' => (int) $spb33a22[0]['profit']); } $sp5bd36e['need_ship_count'] = Order::whereUserId(\Auth::Id())->where('status', Order::STATUS_PAID)->count(); $sp5bd36e['login'] = \App\Log::where('action', \App\Log::ACTION_LOGIN)->latest()->firstOrFail(); return Response::success($sp5bd36e); } function clearCache() { if (function_exists('opcache_reset')) { opcache_reset(); } try { \Artisan::call('cache:clear'); \Artisan::call('route:cache'); \Artisan::call('config:cache'); } catch (\Throwable $spece20f) { return Response::fail($spece20f->getMessage()); } return Response::success(); } function version() { return Response::success(array('version' => config('app.version'))); } function checkUpdate() { return Response::success(@json_decode(CurlRequest::get('https://github.com/Tai7sy/card-system/blob/master/.version'), true)); } } |
Oops, something went wrong.