-
Notifications
You must be signed in to change notification settings - Fork 905
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 22, 2019
1 parent
2adfff1
commit 27669f2
Showing
122 changed files
with
253 additions
and
253 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 |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"2.9","md5":"12be8c987fc6d46370b9de555236a28d","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/2.9\/card_release.tar.gz"} | ||
{"version":"2.9","md5":"9b0367de9ea5caf51669d612b61df9f7","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/2.9\/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 |
---|---|---|
@@ -1,2 +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($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; }); } } | ||
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; }); } } |
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 |
---|---|---|
@@ -1,2 +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() { $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; } } | ||
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; } } |
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 |
---|---|---|
@@ -1,4 +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() { $sp807378 = $this->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; } } | ||
Usage: php artisan reset:password [email protected]'; 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; } } |
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
Oops, something went wrong.