Skip to content

Commit

Permalink
Snapshot 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai7sy committed Jul 14, 2020
1 parent cb5a8f9 commit a401349
Show file tree
Hide file tree
Showing 56 changed files with 98 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"3.1","md5":"2eb40f6eaea951255fe3cd0e189608f1","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.1\/card_release.tar.gz"}
{"version":"3.11","md5":"073c62cb66606bd3ab5d7eccc085234d","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.11\/card_release.tar.gz"}
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.1-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.11-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://travis-ci.org/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($spa27b73, $sp52cac1, $sp4ad441, $sp415e3d, $spa504de, $sp24ed58) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spa27b73, $sp52cac1, $sp4ad441, $sp415e3d, $spa504de, (int) $sp24ed58)); } public static function _trash($spd10097) { DB::transaction(function () use($spd10097) { $sp6161c4 = clone $spd10097; $sp6161c4->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp389a95) { foreach ($sp389a95 as $sp29413f) { $sp4aad76 = \App\Product::where('id', $sp29413f->product_id)->lockForUpdate()->first(); if ($sp4aad76) { $sp4aad76->count_all -= $sp29413f->count_left; $sp4aad76->saveOrFail(); } } }); $spd10097->delete(); return true; }); } public static function _restore($spd10097) { DB::transaction(function () use($spd10097) { $sp6161c4 = clone $spd10097; $sp6161c4->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp389a95) { foreach ($sp389a95 as $sp29413f) { $sp4aad76 = \App\Product::where('id', $sp29413f->product_id)->lockForUpdate()->first(); if ($sp4aad76) { $sp4aad76->count_all += $sp29413f->count_left; $sp4aad76->saveOrFail(); } } }); $spd10097->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($sp699450, $sp517398, $spa0789d, $sp0f5dbe, $sp107491, $sp736e02) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp699450, $sp517398, $spa0789d, $sp0f5dbe, $sp107491, (int) $sp736e02)); } public static function _trash($spcfdf85) { DB::transaction(function () use($spcfdf85) { $spe137eb = clone $spcfdf85; $spe137eb->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp06abef) { foreach ($sp06abef as $sp66d858) { $sp222f58 = \App\Product::where('id', $sp66d858->product_id)->lockForUpdate()->first(); if ($sp222f58) { $sp222f58->count_all -= $sp66d858->count_left; $sp222f58->saveOrFail(); } } }); $spcfdf85->delete(); return true; }); } public static function _restore($spcfdf85) { DB::transaction(function () use($spcfdf85) { $spe137eb = clone $spcfdf85; $spe137eb->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($sp06abef) { foreach ($sp06abef as $sp66d858) { $sp222f58 = \App\Product::where('id', $sp66d858->product_id)->lockForUpdate()->first(); if ($sp222f58) { $sp222f58->count_all += $sp66d858->count_left; $sp222f58->saveOrFail(); } } }); $spcfdf85->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() { $sp0f92be = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp0f92be as $sp4aad76) { $sp4aad76->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp0f92be); return $sp0f92be; } }
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() { $sp19cd84 = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($sp19cd84 as $sp222f58) { $sp222f58->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $sp19cd84); return $sp19cd84; } }
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() { $sp72ada4 = $this->argument('email'); if (!$sp72ada4) { $this->warn('please input the user\'s email
'); return false; } $spe2c9ac = \App\User::where('email', $sp72ada4)->first(); if (!$spe2c9ac) { $this->warn("can't find the user: {$sp72ada4} \nplease input the user's email\n"); return false; } $sp27b440 = $this->argument('password'); $spe2c9ac->password = bcrypt($sp27b440); $spe2c9ac->save(); $this->info("the password of '{$sp72ada4}' has been set to {$sp27b440}\n"); return true; } }
Usage: php artisan reset:password [email protected]'; public function __construct() { parent::__construct(); } public function handle() { $sp3d0720 = $this->argument('email'); if (!$sp3d0720) { $this->warn('please input the user\'s email
'); return false; } $sp590011 = \App\User::where('email', $sp3d0720)->first(); if (!$sp590011) { $this->warn("can't find the user: {$sp3d0720} \nplease input the user's email\n"); return false; } $sp4b3985 = $this->argument('password'); $sp590011->password = bcrypt($sp4b3985); $sp590011->save(); $this->info("the password of '{$sp3d0720}' has been set to {$sp4b3985}\n"); return true; } }
Loading

0 comments on commit a401349

Please sign in to comment.