Skip to content

Commit

Permalink
Snapshot 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai7sy committed Jan 11, 2020
1 parent 7d38ee0 commit 3150524
Show file tree
Hide file tree
Showing 86 changed files with 132 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"3.0","md5":"80cb1a87e02e47933f8cad53b3b2cb2e","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.0\/card_release.tar.gz","description":"-\n-\n--------- \u6ce8\u610f ---------\n\u672c\u6b21\u66f4\u65b0\u53ef\u80fd\u4f1a\u66f4\u65b0\u5931\u8d25\n\u66f4\u65b0\u5931\u8d25\u540e\u518d\u6b21\u66f4\u65b0\u5373\u53ef!!!\n\u66f4\u65b0\u5931\u8d25\u540e\u518d\u6b21\u66f4\u65b0\u5373\u53ef!!!\n-\n-"}
{"version":"3.0","md5":"9f275497eaa3fd95d3f52ecaa98c0584","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.0\/card_release.tar.gz","description":"-\n-\n--------- \u6ce8\u610f ---------\n\u672c\u6b21\u66f4\u65b0\u53ef\u80fd\u4f1a\u66f4\u65b0\u5931\u8d25\n\u66f4\u65b0\u5931\u8d25\u540e\u518d\u6b21\u66f4\u65b0\u5373\u53ef!!!\n\u66f4\u65b0\u5931\u8d25\u540e\u518d\u6b21\u66f4\u65b0\u5373\u53ef!!!\n-\n-"}
2 changes: 1 addition & 1 deletion app/Card.php
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); } function getCountAttribute() { return $this->count_all - $this->count_sold; } public static function add_cards($sp6fe8b9, $sp17d280, $spf46b4f, $sp59ae99, $spad1f18, $sp3afcf8) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp6fe8b9, $sp17d280, $spf46b4f, $sp59ae99, $spad1f18, (int) $sp3afcf8)); } public static function _trash($sp6c3275) { DB::transaction(function () use($sp6c3275) { $sp52c4e7 = clone $sp6c3275; $sp52c4e7->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp1150d0) { foreach ($sp1150d0 as $sp06865f) { $sp0a72f9 = \App\Product::where('id', $sp06865f->product_id)->lockForUpdate()->first(); if ($sp0a72f9) { $sp0a72f9->count_all -= $sp06865f->count_left; $sp0a72f9->saveOrFail(); } } }); $sp6c3275->delete(); return true; }); } public static function _restore($sp6c3275) { DB::transaction(function () use($sp6c3275) { $sp52c4e7 = clone $sp6c3275; $sp52c4e7->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp1150d0) { foreach ($sp1150d0 as $sp06865f) { $sp0a72f9 = \App\Product::where('id', $sp06865f->product_id)->lockForUpdate()->first(); if ($sp0a72f9) { $sp0a72f9->count_all += $sp06865f->count_left; $sp0a72f9->saveOrFail(); } } }); $sp6c3275->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); } function getCountAttribute() { return $this->count_all - $this->count_sold; } public static function add_cards($spc2f05b, $sp138ddb, $sp2d4d5b, $spfc8a83, $sp1318bc, $spa79ada) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spc2f05b, $sp138ddb, $sp2d4d5b, $spfc8a83, $sp1318bc, (int) $spa79ada)); } public static function _trash($sped9569) { DB::transaction(function () use($sped9569) { $sp58ab93 = clone $sped9569; $sp58ab93->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($spa9e8db) { foreach ($spa9e8db as $sp097637) { $sp6018c8 = \App\Product::where('id', $sp097637->product_id)->lockForUpdate()->first(); if ($sp6018c8) { $sp6018c8->count_all -= $sp097637->count_left; $sp6018c8->saveOrFail(); } } }); $sped9569->delete(); return true; }); } public static function _restore($sped9569) { DB::transaction(function () use($sped9569) { $sp58ab93 = clone $sped9569; $sp58ab93->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($spa9e8db) { foreach ($spa9e8db as $sp097637) { $sp6018c8 = \App\Product::where('id', $sp097637->product_id)->lockForUpdate()->first(); if ($sp6018c8) { $sp6018c8->count_all += $sp097637->count_left; $sp6018c8->saveOrFail(); } } }); $sped9569->restore(); return true; }); } }
2 changes: 1 addition & 1 deletion app/Category.php
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() { $sp0d1474 = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp0d1474 as $sp0a72f9) { $sp0a72f9->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp0d1474); return $sp0d1474; } }
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() { $sp5ee5ce = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp5ee5ce as $sp6018c8) { $sp6018c8->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp5ee5ce); return $sp5ee5ce; } }
4 changes: 2 additions & 2 deletions app/Console/Commands/ResetPassword.php
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() { $sp4f0d65 = $this->argument('email'); if (!$sp4f0d65) { $this->warn('please input the user\'s email
'); return false; } $spf3d3c9 = \App\User::where('email', $sp4f0d65)->first(); if (!$spf3d3c9) { $this->warn("can't find the user: {$sp4f0d65} \nplease input the user's email\n"); return false; } $sp4c9d0a = $this->argument('password'); $spf3d3c9->password = bcrypt($sp4c9d0a); $spf3d3c9->save(); $this->info("the password of '{$sp4f0d65}' has been set to {$sp4c9d0a}\n"); return true; } }
Usage: php artisan reset:password [email protected]'; public function __construct() { parent::__construct(); } public function handle() { $sp9fbdc0 = $this->argument('email'); if (!$sp9fbdc0) { $this->warn('please input the user\'s email
'); return false; } $sp264a55 = \App\User::where('email', $sp9fbdc0)->first(); if (!$sp264a55) { $this->warn("can't find the user: {$sp9fbdc0} \nplease input the user's email\n"); return false; } $sp22c05f = $this->argument('password'); $sp264a55->password = bcrypt($sp22c05f); $sp264a55->save(); $this->info("the password of '{$sp9fbdc0}' has been set to {$sp22c05f}\n"); return true; } }
Loading

0 comments on commit 3150524

Please sign in to comment.