forked from Tai7sy/card-system
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 01afa20
Showing
6,513 changed files
with
123,745 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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,25 @@ | ||
|
||
### 关于 | ||
> 商业版预览: [http://demo.fakaxitong.com/](http://demo.fakaxitong.com/) | ||
> 开源版当前版本: 2.6 | ||
> [安装教程 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) | ||
### 常见问题 | ||
- 修改 `.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($sp7652a3, $spa20daf, $sp4c5fa8, $sp73477e, $spf3d7a8, $sp09343a) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp7652a3, $spa20daf, $sp4c5fa8, $sp73477e, $spf3d7a8, (int) $sp09343a)); } } |
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 Hashids\Hashids; use Illuminate\Database\Eloquent\Model; class Category extends Model { protected $guarded = array(); public static function id_encode($spcbbf66) { $spec2454 = new Hashids(config('app.key')); return @$spec2454->encode($spcbbf66, 1); } public static function id_decode($sp808d0e) { $spec2454 = new Hashids(config('app.key')); return @$spec2454->decode($sp808d0e)[0]; } function getUrlAttribute() { return config('app.url') . '/c/' . self::id_encode($this->id); } function products() { return $this->hasMany(Product::class); } function user() { return $this->belongsTo(User::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,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() { $spe366e9 = $this->argument('email'); if (!$spe366e9) { $this->warn('please input the user\'s email | ||
'); return false; } $sp5b5487 = \App\User::where('email', $spe366e9)->first(); if (!$sp5b5487) { $this->warn("can't find the user: {$spe366e9} \nplease input the user's email\n"); return false; } $spc5d82e = $this->argument('password'); $sp5b5487->password = bcrypt($spc5d82e); $sp5b5487->save(); $this->info("the password of '{$spe366e9}' has been set to {$spc5d82e}\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
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; class Kernel extends ConsoleKernel { protected $commands = array(); protected function schedule(Schedule $spec3653) { try { \DB::connection()->getPdo(); if (\DB::table('migrations')->count() === 0) { throw new \Exception('No migration table'); } if (!\Schema::hasTable('systems')) { throw new \Exception('No system table'); } } catch (\Exception $sp019ea9) { if (config('database.connections.mysql.host') === '数据库地址') { echo ' * Please config your database info in \'.env\' | ||
'; } else { echo ' * Database connection error: ' . $sp019ea9->getMessage() . ' | ||
'; } return; } if (System::_getInt('order_clean_unpay_open') === 1) { $spe6a0a5 = System::_getInt('order_clean_unpay_day', 7); $spec3653->call(function () use($spe6a0a5) { \App\Order::where('status', \App\Order::STATUS_UNPAY)->where('created_at', '<', (new Carbon())->addDays(-$spe6a0a5))->delete(); })->dailyAt('01: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; class Handler extends ExceptionHandler { protected $dontReport = array(); protected $dontFlash = array('password', 'password_confirmation'); public function report(Exception $spc5ec7d) { parent::report($spc5ec7d); } public function render($spf631e6, Exception $sp019ea9) { if ($sp019ea9 instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) { return $spf631e6->expectsJson() ? response()->json(array('message' => '记录未找到'), 404) : response()->view('errors._', array('code' => 404, 'message' => '记录未找到'), 404); } elseif ($sp019ea9 instanceof \Illuminate\Auth\AuthenticationException) { return $spf631e6->expectsJson() ? response()->json(array('message' => '请先登录'), 401) : response()->view('errors._', array('code' => 401, 'message' => '请先登录'), 401); } elseif ($sp019ea9 instanceof \Illuminate\Auth\Access\AuthorizationException) { return $spf631e6->expectsJson() ? response()->json(array('message' => '未授权的操作'), 403) : response()->view('errors._', array('code' => 403, 'message' => '未授权的操作'), 403); } elseif ($sp019ea9 instanceof \Illuminate\Validation\ValidationException) { return parent::render($spf631e6, $sp019ea9); } elseif ($sp019ea9 instanceof \Illuminate\Session\TokenMismatchException) { return $spf631e6->expectsJson() ? response()->json(array('message' => '请刷新页面后重试'), 403) : response()->view('errors._', array('code' => 403, 'message' => '请刷新页面后重试'), 403); } elseif ($sp019ea9 instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { return $spf631e6->expectsJson() ? response()->json(array('message' => '页面未找到'), 404) : response()->view('errors._', array('code' => 404, 'message' => '页面未找到'), 404); } elseif ($sp019ea9 instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException) { return $spf631e6->expectsJson() ? response()->json(array('message' => '请求方法不允许'), 405) : response()->view('errors._', array('code' => 405, 'message' => '请求方法不允许'), 405); } elseif ($sp019ea9 instanceof \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException) { \Log::error('Uncaught a ServiceUnavailableHttpException', array('Exception' => $sp019ea9)); return $spf631e6->expectsJson() ? response()->json(array('message' => '当前服务不可用,请稍后重试'), 503) : response()->view('errors._', array('code' => 503, 'message' => '当前服务不可用,请稍后重试'), 503); } \Log::error('Uncaught Exception', array('Exception' => $sp019ea9)); if (config('app.debug')) { return parent::render($spf631e6, $sp019ea9); } else { return $spf631e6->expectsJson() ? response()->json(array('message' => '未知错误,请联系客服'), 500) : response()->view('errors._', array('code' => 500, 'message' => '未知错误,请联系客服'), 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 $sp019ea9) { \Log::error('File.deleteFile Error: ' . $sp019ea9->getMessage(), array('exception' => $sp019ea9)); } } 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\Response; use App\Order; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class Dashboard extends Controller { function index(Request $spf631e6) { $spd3955d = array('today' => array('count' => 0, 'income' => 0, 'profit' => 0), 'yesterday' => array('count' => 0, 'income' => 0, 'profit' => 0)); $sp0bc988 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::now()->toDateString())->where(function ($spe8afa9) { $spe8afa9->where('status', Order::STATUS_PAID)->orWhere('status', Order::STATUS_SUCCESS); })->selectRaw('COUNT(*) as `count`,SUM(`income`) as `income`,SUM(`income`-`cost`) as `profit`')->get()->toArray(); $sp09e5a7 = Order::whereUserId(\Auth::Id())->whereDate('paid_at', \Carbon\Carbon::yesterday()->toDateString())->where(function ($spe8afa9) { $spe8afa9->where('status', Order::STATUS_PAID)->orWhere('status', Order::STATUS_SUCCESS); })->selectRaw('COUNT(*) as `count`,SUM(`income`) as `income`,SUM(`income`-`cost`) as `profit`')->get()->toArray(); if (isset($sp0bc988[0]) && isset($sp0bc988[0]['count'])) { $spd3955d['today'] = array('count' => (int) $sp0bc988[0]['count'], 'income' => (int) $sp0bc988[0]['income'], 'profit' => (int) $sp0bc988[0]['profit']); } if (isset($sp09e5a7[0]) && isset($sp09e5a7[0]['count'])) { $spd3955d['yesterday'] = array('count' => (int) $sp09e5a7[0]['count'], 'income' => (int) $sp09e5a7[0]['income'], 'profit' => (int) $sp09e5a7[0]['profit']); } $spd3955d['need_ship_count'] = Order::whereUserId(\Auth::Id())->where('status', Order::STATUS_PAID)->count(); return Response::success($spd3955d); } function clearCache() { if (function_exists('opcache_reset')) { opcache_reset(); } return Response::success(); } } |
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\Helper; use Auth; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Library\Response; use Illuminate\Support\Facades\Hash; class Login extends Controller { public function login(Request $spf631e6) { $spbf5aff = $spf631e6->input('remember') == 'true'; if (!Auth::attempt(array('email' => $spf631e6->input('email'), 'password' => $spf631e6->input('password')), $spbf5aff) || Auth::getUser()->role !== 'admin') { return Response::fail('邮箱或密码错误, 请检查'); } else { $sp63838a = new \App\Log(); $sp63838a->user_id = Auth::Id(); $sp63838a->ip = Helper::getIP(); $sp63838a->action = \App\Log::ACTION_LOGIN; $sp63838a->save(); $sp5b5487 = Auth::getUser(); $sp5b5487->addHidden(array('created_at', 'updated_at')); return Response::success(array('token' => 'login', 'user' => $sp5b5487->toArray())); } } function info() { $sp5b5487 = Auth::getUser(); $sp5b5487->addHidden(array('created_at', 'updated_at')); return Response::success(array('token' => 'login', 'user' => $sp5b5487->toArray())); } function logout(Request $spf631e6) { Auth::logout(); return Response::success(); } function changePassword(Request $spf631e6) { $sp5b5487 = Auth::getUser(); $sp20a6e5 = $spf631e6->post('old', null); $spc5d82e = $spf631e6->post('password', null); if (strlen($spc5d82e) < 6 || strlen($spc5d82e) > 32) { return Response::fail('请输入6-32位密码'); } if (!Hash::check($sp20a6e5, $sp5b5487->password)) { return Response::fail('旧密码错误,请检查'); } $sp5b5487->password = bcrypt($spc5d82e); $sp5b5487->saveOrFail(); return Response::success(); } } |
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\FundHelper; use App\Library\Helper; 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 { function stat(Request $spf631e6) { $spe6a0a5 = (int) $spf631e6->input('day', 7); $spb58893 = $spf631e6->post('profit') === 'true'; $spe8afa9 = \App\Order::where(function ($spe8afa9) { $spe8afa9->where('status', \App\Order::STATUS_PAID)->orWhere('status', \App\Order::STATUS_SUCCESS); })->where('paid_at', '>=', Helper::getMysqlDate(-$spe6a0a5 + 1))->groupBy('date')->orderBy('date', 'DESC'); if ($spb58893) { $spe8afa9->selectRaw('DATE(`paid_at`) as "date",COUNT(*) as "count",SUM(`fee`-`system_fee`) as "sum"'); } else { $spe8afa9->selectRaw('DATE(`paid_at`) as "date",COUNT(*) as "count",SUM(`paid`) as "sum"'); } $sp3562f5 = $spe8afa9->get()->toArray(); $sp567373 = array(); foreach ($sp3562f5 as $spe1403c) { $sp567373[$spe1403c['date']] = array((int) $spe1403c['count'], (int) $spe1403c['sum']); } return Response::success($sp567373); } public function delete(Request $spf631e6) { $sp398578 = $spf631e6->post('ids', ''); $spd6dd9f = (int) $spf631e6->post('income'); $spff2ffd = (int) $spf631e6->post('balance'); if (strlen($sp398578) < 1) { return Response::forbidden(); } \App\Order::whereIn('id', explode(',', $sp398578))->chunk(100, function ($sp0868db) use($spd6dd9f, $spff2ffd) { foreach ($sp0868db as $sp09599a) { $sp09599a->cards()->detach(); try { if ($spd6dd9f) { $sp09599a->fundRecord()->delete(); } if ($spff2ffd) { $sp5b5487 = \App\User::lockForUpdate()->firstOrFail(); $sp5b5487->m_all -= $sp09599a->income; $sp5b5487->saveOrFail(); } $sp09599a->delete(); } catch (\Exception $sp019ea9) { } } }); return Response::success(); } function freeze(Request $spf631e6) { $sp398578 = $spf631e6->post('ids', ''); if (strlen($sp398578) < 1) { return Response::forbidden(); } $sp73594d = $spf631e6->post('reason'); $sp0868db = \App\Order::whereIn('id', explode(',', $sp398578))->where('status', \App\Order::STATUS_SUCCESS)->get(); $sp7548f9 = 0; $spe95d32 = 0; foreach ($sp0868db as $sp09599a) { if (FundHelper::orderFreeze($sp09599a, $sp73594d)) { $spe95d32++; } $sp7548f9++; } return Response::success(array($sp7548f9, $spe95d32)); } function unfreeze(Request $spf631e6) { $sp398578 = $spf631e6->post('ids', ''); if (strlen($sp398578) < 1) { return Response::forbidden(); } $sp0868db = \App\Order::whereIn('id', explode(',', $sp398578))->where('status', \App\Order::STATUS_FROZEN)->get(); $sp7548f9 = 0; $spe95d32 = 0; $spcf8eb1 = \App\Order::STATUS_FROZEN; foreach ($sp0868db as $sp09599a) { if (FundHelper::orderUnfreeze($sp09599a, '后台操作', null, $spcf8eb1)) { $spe95d32++; } $sp7548f9++; } return Response::success(array($sp7548f9, $spe95d32, $spcf8eb1)); } function set_paid(Request $spf631e6) { $spcbbf66 = (int) $spf631e6->post('id', ''); if ($spcbbf66 < 1) { return Response::forbidden(); } $sp9fec61 = $spf631e6->post('trade_no', ''); if (strlen($sp9fec61) < 1) { return Response::forbidden('请输入支付系统内单号'); } $sp09599a = \App\Order::findOrFail($spcbbf66); if ($sp09599a->status !== \App\Order::STATUS_UNPAY) { return Response::forbidden('只能操作未支付订单'); } $spd7f781 = 'Admin.SetPaid'; $sp2346a9 = $sp09599a->order_no; $sp7ca622 = $sp09599a->paid; try { Log::debug($spd7f781 . " shipOrder start, order_no: {$sp2346a9}, amount: {$sp7ca622}, trade_no: {$sp9fec61}"); (new \App\Http\Controllers\Shop\Pay())->shipOrder($spf631e6, $sp2346a9, $sp7ca622, $sp9fec61, FALSE); Log::debug($spd7f781 . ' shipOrder end, order_no: ' . $sp2346a9); $spe95d32 = true; $spb18c75 = '发货成功'; } catch (\Exception $sp019ea9) { $spe95d32 = false; $spb18c75 = $sp019ea9->getMessage(); Log::error($spd7f781 . ' shipOrder Exception: ' . $sp019ea9->getMessage()); } $sp09599a = \App\Order::with(array('card_orders.card' => function (Relation $spe8afa9) { $spe8afa9->select(array('id', 'card')); }))->findOrFail($spcbbf66); if ($sp09599a->status === \App\Order::STATUS_PAID) { $spe95d32 = false; $spb18c75 = '已标记为付款成功, 但是买家库存不足, 发货失败, 请稍后尝试手动发货'; } return Response::success(array('code' => $spe95d32 ? 0 : -1, 'msg' => $spb18c75, 'order' => $sp09599a)); } } |
Oops, something went wrong.