Skip to content

Commit a401349

Browse files
committed
Snapshot 3.11
1 parent cb5a8f9 commit a401349

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+98
-91
lines changed

.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"3.1","md5":"2eb40f6eaea951255fe3cd0e189608f1","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.1\/card_release.tar.gz"}
1+
{"version":"3.11","md5":"073c62cb66606bd3ab5d7eccc085234d","url":"https:\/\/github.com\/Tai7sy\/card-system\/releases\/download\/3.11\/card_release.tar.gz"}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h1 align="center">CardSystem</h1>
22
<p align="center">
3-
<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>
3+
<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>
44
<img alt="PHP from Packagist badge" src="https://img.shields.io/badge/php-%3E%3D7.0.0-brightgreen.svg?style=flat-square">
55
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square" alt="License"></a>
66
<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>

app/Card.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php
2-
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; }); } }
2+
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; }); } }

app/Category.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php
2-
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; } }
2+
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; } }
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22
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
3-
Usage: php artisan reset:password user@email.com'; public function __construct() { parent::__construct(); } public function handle() { $sp72ada4 = $this->argument('email'); if (!$sp72ada4) { $this->warn('please input the user\'s email
4-
'); 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; } }
3+
Usage: php artisan reset:password user@email.com'; public function __construct() { parent::__construct(); } public function handle() { $sp3d0720 = $this->argument('email'); if (!$sp3d0720) { $this->warn('please input the user\'s email
4+
'); 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; } }

0 commit comments

Comments
 (0)