Skip to content

Commit

Permalink
Snapshot 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai7sy committed Feb 25, 2021
1 parent 39bf549 commit 763fb45
Show file tree
Hide file tree
Showing 86 changed files with 336 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"3.12","md5":"3a3ef7e38f07944989dc89f4125ab688","url":"http:\/\/p.qpic.cn\/qqshihua\/0\/dab4215b285c461b13e9498691685625\/0\/card_release.tar.gz","data":{"version":"3.12","description":""}}
{"version":"3.13","md5":"982a1be33466ebdf44cf333d76546ed7","url":"http:\/\/p.qpic.cn\/qqshihua\/0\/1e57d2e6d46b2ec44d39de6e86399640\/0\/card_release.tar.gz","description":"","data":{"version":"3.13","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.12-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.13-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($spc2138c, $spcaeba2, $sp797c94, $sp6002b5, $sp5aa60c, $sp864dfc) { DB::statement('call add_cards(?,?,?,?,?,?)', array($spc2138c, $spcaeba2, $sp797c94, $sp6002b5, $sp5aa60c, (int) $sp864dfc)); } public static function _trash($sp8e2ceb) { DB::transaction(function () use($sp8e2ceb) { $spb1c766 = clone $sp8e2ceb; $spb1c766->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($spdcf051) { foreach ($spdcf051 as $spf40cf3) { $sp863814 = \App\Product::where('id', $spf40cf3->product_id)->lockForUpdate()->first(); if ($sp863814) { $sp863814->count_all -= $spf40cf3->count_left; $sp863814->saveOrFail(); } } }); $sp8e2ceb->delete(); return true; }); } public static function _restore($sp8e2ceb) { DB::transaction(function () use($sp8e2ceb) { $spb1c766 = clone $sp8e2ceb; $spb1c766->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($spdcf051) { foreach ($spdcf051 as $spf40cf3) { $sp863814 = \App\Product::where('id', $spf40cf3->product_id)->lockForUpdate()->first(); if ($sp863814) { $sp863814->count_all += $spf40cf3->count_left; $sp863814->saveOrFail(); } } }); $sp8e2ceb->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($sp6738b1, $spb43b27, $sp2add78, $spef96f9, $spe78ea6, $sp644608) { DB::statement('call add_cards(?,?,?,?,?,?)', array($sp6738b1, $spb43b27, $sp2add78, $spef96f9, $spe78ea6, (int) $sp644608)); } public static function _trash($sp40bc20) { DB::transaction(function () use($sp40bc20) { $spb29864 = clone $sp40bc20; $spb29864->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($spce7b49) { foreach ($spce7b49 as $spb0ed4f) { $sp551a82 = \App\Product::where('id', $spb0ed4f->product_id)->lockForUpdate()->first(); if ($sp551a82) { $sp551a82->count_all -= $spb0ed4f->count_left; $sp551a82->saveOrFail(); } } }); $sp40bc20->delete(); return true; }); } public static function _restore($sp40bc20) { DB::transaction(function () use($sp40bc20) { $spb29864 = clone $sp40bc20; $spb29864->selectRaw('`product_id`,SUM(`count_all`-`count_sold`) as `count_left`')->groupBy('product_id')->orderByRaw('`product_id`')->chunk(100, function ($spce7b49) { foreach ($spce7b49 as $spb0ed4f) { $sp551a82 = \App\Product::where('id', $spb0ed4f->product_id)->lockForUpdate()->first(); if ($sp551a82) { $sp551a82->count_all += $spb0ed4f->count_left; $sp551a82->saveOrFail(); } } }); $sp40bc20->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() { $spa1cb90 = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($spa1cb90 as $sp863814) { $sp863814->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $spa1cb90); return $spa1cb90; } }
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() { $spfeb65c = Product::where('category_id', $this->id)->where('enabled', 1)->orderBy('sort')->get(); foreach ($spfeb65c as $sp551a82) { $sp551a82->setForShop($this->user); } $this->addVisible(array('products')); $this->setAttribute('products', $spfeb65c); return $spfeb65c; } }
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() { $sp94f974 = $this->argument('email'); if (!$sp94f974) { $this->warn('please input the user\'s email
'); return false; } $spc33961 = \App\User::where('email', $sp94f974)->first(); if (!$spc33961) { $this->warn("can't find the user: {$sp94f974} \nplease input the user's email\n"); return false; } $spf35053 = $this->argument('password'); $spc33961->password = bcrypt($spf35053); $spc33961->save(); $this->info("the password of '{$sp94f974}' has been set to {$spf35053}\n"); return true; } }
Usage: php artisan reset:password [email protected]'; public function __construct() { parent::__construct(); } public function handle() { $sp54f969 = $this->argument('email'); if (!$sp54f969) { $this->warn('please input the user\'s email
'); return false; } $sp586d7b = \App\User::where('email', $sp54f969)->first(); if (!$sp586d7b) { $this->warn("can't find the user: {$sp54f969} \nplease input the user's email\n"); return false; } $sp1f7a77 = $this->argument('password'); $sp586d7b->password = bcrypt($sp1f7a77); $sp586d7b->save(); $this->info("the password of '{$sp54f969}' has been set to {$sp1f7a77}\n"); return true; } }
Loading

0 comments on commit 763fb45

Please sign in to comment.