Skip to content

Commit

Permalink
Snapshot 3.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai7sy committed Dec 12, 2021
1 parent 6469c58 commit ac02609
Show file tree
Hide file tree
Showing 55 changed files with 86 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"3.14","md5":"5752cb0b79e64506e4865ff01aaefda8","url":"http:\/\/p.qpic.cn\/qqshihua\/0\/9cbb21b47a96c6c2abdd134f8ee6966b\/0\/1.png","description":"","data":{"version":"3.14","description":""}}
{"version":"3.15","md5":"214ff9b7b87323b169bc4e4cf09f4c7c","url":"https:\/\/ghproxy.com\/https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.15\/card_release.tar.gz","description":"","data":{"version":"3.15","description":""}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center">CardSystem</h1>
<p align="center">
<a href="https://github.com/Tai7sy/card-system/releases"><img src="https://img.shields.io/badge/version-3.14-blue.svg?style=flat-square" alt="License"></a>
<a href="https://github.com/Tai7sy/card-system/releases"><img src="https://img.shields.io/badge/version-3.15-blue.svg?style=flat-square" alt="License"></a>
<img alt="PHP from Packagist badge" src="https://img.shields.io/badge/php-%3E%3D7.0.0-brightgreen.svg?style=flat-square">
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square" alt="License"></a>
<a href="https://app.travis-ci.com/github/Tai7sy/card-system"><img src="https://img.shields.io/travis/Tai7sy/card-system.svg?style=flat-square" alt="Travis"></a>
Expand Down
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($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; }); } }
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($spacf00d, $spb429e3, $sp22c639, $sp0194a7, $sp84f9ba, $sp12232b) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spacf00d, $spb429e3, $sp22c639, $sp0194a7, $sp84f9ba, (int) $sp12232b)); } public static function _trash($sp30241a) { DB::transaction(function () use($sp30241a) { $sp005ad9 = clone $sp30241a; $sp005ad9->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp355056) { foreach ($sp355056 as $spe8264d) { $sp427eba = \App\Product::where('id', $spe8264d->product_id)->lockForUpdate()->first(); if ($sp427eba) { $sp427eba->count_all -= $spe8264d->count_left; $sp427eba->saveOrFail(); } } }); $sp30241a->delete(); return true; }); } public static function _restore($sp30241a) { DB::transaction(function () use($sp30241a) { $sp005ad9 = clone $sp30241a; $sp005ad9->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp355056) { foreach ($sp355056 as $spe8264d) { $sp427eba = \App\Product::where('id', $spe8264d->product_id)->lockForUpdate()->first(); if ($sp427eba) { $sp427eba->count_all += $spe8264d->count_left; $sp427eba->saveOrFail(); } } }); $sp30241a->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() { $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; } }
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() { $sp204e47 = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp204e47 as $sp427eba) { $sp427eba->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp204e47); return $sp204e47; } }
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() { $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; } }
Usage: php artisan reset:password [email protected]'; public function __construct() { parent::__construct(); } public function handle() { $sp4b6fe6 = $this->argument('email'); if (!$sp4b6fe6) { $this->warn('please input the user\'s email
'); return false; } $sp3db17d = \App\User::where('email', $sp4b6fe6)->first(); if (!$sp3db17d) { $this->warn("can't find the user: {$sp4b6fe6} \nplease input the user's email\n"); return false; } $spe46211 = $this->argument('password'); $sp3db17d->password = bcrypt($spe46211); $sp3db17d->save(); $this->info("the password of '{$sp4b6fe6}' has been set to {$spe46211}\n"); return true; } }
Loading

0 comments on commit ac02609

Please sign in to comment.