-
Notifications
You must be signed in to change notification settings - Fork 902
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
Showing
55 changed files
with
89 additions
and
96 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":"3.14","md5":"66a12d9772ff13377cdd7ea38c9c5b6d","url":"http:\/\/p.qpic.cn\/qqshihua\/0\/103f2857ed71bb93049e9005a8532996\/0\/1.png","description":"","data":{"version":"3.14","description":""}} | ||
{"version":"3.14","md5":"5752cb0b79e64506e4865ff01aaefda8","url":"http:\/\/p.qpic.cn\/qqshihua\/0\/9cbb21b47a96c6c2abdd134f8ee6966b\/0\/1.png","description":"","data":{"version":"3.14","description":""}} |
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); } function getCountAttribute() { return $this->count_all - $this->count_sold; } public static function add_cards($sp3546ff, $sp2f9632, $spb2a0bb, $sp671ce9, $sp114fae, $sp4b22b4) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp3546ff, $sp2f9632, $spb2a0bb, $sp671ce9, $sp114fae, (int) $sp4b22b4)); } public static function _trash($sp90af04) { DB::transaction(function () use($sp90af04) { $sp31ddba = clone $sp90af04; $sp31ddba->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp4f3a9b) { foreach ($sp4f3a9b as $sp9f8d97) { $spd39704 = \App\Product::where('id', $sp9f8d97->product_id)->lockForUpdate()->first(); if ($spd39704) { $spd39704->count_all -= $sp9f8d97->count_left; $spd39704->saveOrFail(); } } }); $sp90af04->delete(); return true; }); } public static function _restore($sp90af04) { DB::transaction(function () use($sp90af04) { $sp31ddba = clone $sp90af04; $sp31ddba->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp4f3a9b) { foreach ($sp4f3a9b as $sp9f8d97) { $spd39704 = \App\Product::where('id', $sp9f8d97->product_id)->lockForUpdate()->first(); if ($spd39704) { $spd39704->count_all += $sp9f8d97->count_left; $spd39704->saveOrFail(); } } }); $sp90af04->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($sp7aa9af, $sp89bb44, $sp22f15e, $spaa7124, $sp30a549, $sp4c59e7) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp7aa9af, $sp89bb44, $sp22f15e, $spaa7124, $sp30a549, (int) $sp4c59e7)); } public static function _trash($spa8a4ff) { DB::transaction(function () use($spa8a4ff) { $sp103198 = clone $spa8a4ff; $sp103198->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp860952) { foreach ($sp860952 as $spe9100b) { $spb395ca = \App\Product::where('id', $spe9100b->product_id)->lockForUpdate()->first(); if ($spb395ca) { $spb395ca->count_all -= $spe9100b->count_left; $spb395ca->saveOrFail(); } } }); $spa8a4ff->delete(); return true; }); } public static function _restore($spa8a4ff) { DB::transaction(function () use($spa8a4ff) { $sp103198 = clone $spa8a4ff; $sp103198->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp860952) { foreach ($sp860952 as $spe9100b) { $spb395ca = \App\Product::where('id', $spe9100b->product_id)->lockForUpdate()->first(); if ($spb395ca) { $spb395ca->count_all += $spe9100b->count_left; $spb395ca->saveOrFail(); } } }); $spa8a4ff->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() { $spf9727f = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($spf9727f as $spd39704) { $spd39704->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $spf9727f); return $spf9727f; } } | ||
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() { $spec356e = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($spec356e as $spb395ca) { $spb395ca->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $spec356e); return $spec356e; } } |
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() { $spbc6ccc = $this->argument('email'); if (!$spbc6ccc) { $this->warn('please input the user\'s email | ||
'); return false; } $sp24cedd = \App\User::where('email', $spbc6ccc)->first(); if (!$sp24cedd) { $this->warn("can't find the user: {$spbc6ccc} \nplease input the user's email\n"); return false; } $sp7a8ba8 = $this->argument('password'); $sp24cedd->password = bcrypt($sp7a8ba8); $sp24cedd->save(); $this->info("the password of '{$spbc6ccc}' has been set to {$sp7a8ba8}\n"); return true; } } | ||
Usage: php artisan reset:password [email protected]'; public function __construct() { parent::__construct(); } public function handle() { $sp82cba2 = $this->argument('email'); if (!$sp82cba2) { $this->warn('please input the user\'s email | ||
'); return false; } $sp766bcc = \App\User::where('email', $sp82cba2)->first(); if (!$sp766bcc) { $this->warn("can't find the user: {$sp82cba2} \nplease input the user's email\n"); return false; } $spc3374e = $this->argument('password'); $sp766bcc->password = bcrypt($spc3374e); $sp766bcc->save(); $this->info("the password of '{$sp82cba2}' has been set to {$spc3374e}\n"); return true; } } |
Oops, something went wrong.