Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dcbe82f398 | ||
![]() |
afe70d39b9 | ||
![]() |
9118e07d7b | ||
![]() |
c0f05fcf8f | ||
![]() |
35445f37e1 | ||
![]() |
94c430f491 | ||
![]() |
97efb82971 | ||
![]() |
5f49a22a5e | ||
![]() |
85f4fc0df8 | ||
![]() |
04a7818608 |
@@ -141,7 +141,7 @@ composer create-project jaguarjack/catchadmin:dev-master
|
|||||||
|
|
||||||
### Donate
|
### Donate
|
||||||
如果你觉得项目对你有帮助,可以请作者喝杯咖啡☕️!鼓励下
|
如果你觉得项目对你有帮助,可以请作者喝杯咖啡☕️!鼓励下
|
||||||
<img src="https://cdn.learnku.com/uploads/images/202008/11/18206/e6qAAM8Bod.jpg!large">
|
<!--<img src="https://cdn.learnku.com/uploads/images/202008/11/18206/e6qAAM8Bod.jpg!large">-->
|
||||||
|
|
||||||
### Talking
|
### Talking
|
||||||
- [论坛讨论](http://bbs.catchadmin.com)
|
- [论坛讨论](http://bbs.catchadmin.com)
|
||||||
|
@@ -29,7 +29,7 @@ class Index extends CatchController
|
|||||||
|
|
||||||
$user = $auth->user();
|
$user = $auth->user();
|
||||||
|
|
||||||
$this->afterLoginSuccess($user);
|
$this->afterLoginSuccess($user, $token);
|
||||||
// 登录事件
|
// 登录事件
|
||||||
$this->loginEvent($user->username);
|
$this->loginEvent($user->username);
|
||||||
|
|
||||||
@@ -70,12 +70,16 @@ class Index extends CatchController
|
|||||||
*
|
*
|
||||||
* @time 2020年09月09日
|
* @time 2020年09月09日
|
||||||
* @param $user
|
* @param $user
|
||||||
|
* @param $token
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function afterLoginSuccess($user)
|
protected function afterLoginSuccess($user, $token)
|
||||||
{
|
{
|
||||||
$user->last_login_ip = request()->ip();
|
$user->last_login_ip = request()->ip();
|
||||||
$user->last_login_time = time();
|
$user->last_login_time = time();
|
||||||
|
if ($user->hasField('remember_token')) {
|
||||||
|
$user->remember_token = $token;
|
||||||
|
}
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@ use catchAdmin\permissions\model\Roles;
|
|||||||
use catchAdmin\permissions\model\Users;
|
use catchAdmin\permissions\model\Users;
|
||||||
use catchAdmin\permissions\request\CreateRequest;
|
use catchAdmin\permissions\request\CreateRequest;
|
||||||
use catchAdmin\permissions\request\UpdateRequest;
|
use catchAdmin\permissions\request\UpdateRequest;
|
||||||
|
use catchAdmin\permissions\request\ProfileRequest;
|
||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchAuth;
|
use catcher\CatchAuth;
|
||||||
use catcher\CatchCacheKeys;
|
use catcher\CatchCacheKeys;
|
||||||
@@ -67,15 +68,6 @@ class User extends CatchController
|
|||||||
return CatchResponse::success($user);
|
return CatchResponse::success($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @time 2019年12月06日
|
|
||||||
* @throws \Exception
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param CreateRequest $request
|
* @param CreateRequest $request
|
||||||
@@ -109,12 +101,6 @@ class User extends CatchController
|
|||||||
return CatchResponse::success($user);
|
return CatchResponse::success($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $id
|
|
||||||
* @return string
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public function edit($id){}
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2019年12月04日
|
* @time 2019年12月04日
|
||||||
@@ -248,10 +234,10 @@ class User extends CatchController
|
|||||||
* 更新个人信息
|
* 更新个人信息
|
||||||
*
|
*
|
||||||
* @time 2020年09月20日
|
* @time 2020年09月20日
|
||||||
* @param Request $request
|
* @param ProfileRequest $request
|
||||||
* @return \think\response\Json
|
* @return \think\response\Json
|
||||||
*/
|
*/
|
||||||
public function profile(Request $request)
|
public function profile(ProfileRequest $request)
|
||||||
{
|
{
|
||||||
return CatchResponse::success($this->user->updateBy($request->user()->id, $request->param()));
|
return CatchResponse::success($this->user->updateBy($request->user()->id, $request->param()));
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CatchAdmin [Just Like ~ ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: JaguarJack [ njphper@gmail.com ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use think\migration\Migrator;
|
||||||
|
use think\migration\db\Column;
|
||||||
|
|
||||||
|
class AddUserRememberToken extends Migrator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Change Method.
|
||||||
|
*
|
||||||
|
* Write your reversible migrations using this method.
|
||||||
|
*
|
||||||
|
* More information on writing migrations is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||||
|
*
|
||||||
|
* The following commands can be used in this method and Phinx will
|
||||||
|
* automatically reverse them when rolling back:
|
||||||
|
*
|
||||||
|
* createTable
|
||||||
|
* renameTable
|
||||||
|
* addColumn
|
||||||
|
* renameColumn
|
||||||
|
* addIndex
|
||||||
|
* addForeignKey
|
||||||
|
*
|
||||||
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||||
|
* with the Table class.
|
||||||
|
*/
|
||||||
|
public function change()
|
||||||
|
{
|
||||||
|
if ($this->hasTable('users')) {
|
||||||
|
$table = $this->table('users');
|
||||||
|
|
||||||
|
$table->addColumn('remember_token', 'string', [
|
||||||
|
'limit' => 512,
|
||||||
|
'default' => '',
|
||||||
|
'comment' => '用户token',
|
||||||
|
'after' => 'avatar'])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -20,6 +20,7 @@ class Users extends CatchModel
|
|||||||
'password', // 用户密码
|
'password', // 用户密码
|
||||||
'email', // 邮箱 登录
|
'email', // 邮箱 登录
|
||||||
'avatar', // 头像
|
'avatar', // 头像
|
||||||
|
'remember_token',
|
||||||
'creator_id', // 创建者ID
|
'creator_id', // 创建者ID
|
||||||
'department_id', // 部门ID
|
'department_id', // 部门ID
|
||||||
'status', // 用户状态 1 正常 2 禁用
|
'status', // 用户状态 1 正常 2 禁用
|
||||||
@@ -28,7 +29,6 @@ class Users extends CatchModel
|
|||||||
'created_at', // 创建时间
|
'created_at', // 创建时间
|
||||||
'updated_at', // 更新时间
|
'updated_at', // 更新时间
|
||||||
'deleted_at', // 删除状态,0未删除 >0 已删除
|
'deleted_at', // 删除状态,0未删除 >0 已删除
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
17
catch/permissions/request/ProfileRequest.php
Normal file
17
catch/permissions/request/ProfileRequest.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\permissions\request;
|
||||||
|
|
||||||
|
use catchAdmin\permissions\model\Users;
|
||||||
|
use catcher\base\CatchRequest;
|
||||||
|
|
||||||
|
class ProfileRequest extends CatchRequest
|
||||||
|
{
|
||||||
|
protected function rules(): array
|
||||||
|
{
|
||||||
|
// TODO: Implement rules() method.
|
||||||
|
return [
|
||||||
|
'username|用户名' => 'require|max:20',
|
||||||
|
'email|邮箱' => 'require|email|unique:'.Users::class . ',email,' . $this->user()->id,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@@ -15,9 +15,4 @@ class UpdateRequest extends CatchRequest
|
|||||||
'email|邮箱' => 'require|email|unique:'.Users::class,
|
'email|邮箱' => 'require|email|unique:'.Users::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function message()
|
|
||||||
{
|
|
||||||
// TODO: Implement message() method.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,8 @@
|
|||||||
"symfony/finder": "^4.4",
|
"symfony/finder": "^4.4",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"overtrue/easy-sms": "^1.1",
|
"overtrue/easy-sms": "^1.1",
|
||||||
"jaguarjack/migration-generator": "dev-master"
|
"jaguarjack/migration-generator": "dev-master",
|
||||||
|
"lcobucci/jwt": "3.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"topthink/think-trace": "^1.0",
|
"topthink/think-trace": "^1.0",
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use think\helper\Arr;
|
use think\helper\Arr;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catcher\event\LoadModuleRoutes;
|
use catcher\event\LoadModuleRoutes;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Users;
|
use catchAdmin\permissions\model\Users;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename CacheKeys.php
|
* @filename CacheKeys.php
|
||||||
* @createdAt 2020/1/17
|
* @createdAt 2020/1/17
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
@@ -12,6 +14,7 @@ namespace catcher;
|
|||||||
|
|
||||||
use catcher\library\Composer;
|
use catcher\library\Composer;
|
||||||
use catcher\facade\FileSystem;
|
use catcher\facade\FileSystem;
|
||||||
|
use Symfony\Component\Finder\SplFileInfo;
|
||||||
use think\App;
|
use think\App;
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
|
|
||||||
@@ -43,9 +46,9 @@ class CatchConsole
|
|||||||
/* \Symfony\Component\Finder\SplFileInfo $command */
|
/* \Symfony\Component\Finder\SplFileInfo $command */
|
||||||
foreach ($commandFiles as $command) {
|
foreach ($commandFiles as $command) {
|
||||||
if ($command->getExtension() === 'php') {
|
if ($command->getExtension() === 'php') {
|
||||||
$lastPath = str_replace($this->parseNamespace(), '',pathinfo($command, PATHINFO_DIRNAME));
|
$lastPath = str_replace($this->parseNamespace(), '', pathinfo($command->getPathname(), PATHINFO_DIRNAME));
|
||||||
$namespace = $this->namespace . str_replace(DIRECTORY_SEPARATOR, '\\', $lastPath) . '\\';
|
$namespace = $this->namespace . str_replace(DIRECTORY_SEPARATOR, '\\', $lastPath) . '\\';
|
||||||
$commandClass = $namespace . pathinfo($command, PATHINFO_FILENAME);
|
$commandClass = $namespace . pathinfo($command->getPathname(), PATHINFO_FILENAME);
|
||||||
$commands[] = $commandClass;
|
$commands[] = $commandClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use app\ExceptionHandle;
|
use app\ExceptionHandle;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catcher\library\excel\Excel;
|
use catcher\library\excel\Excel;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catcher\base\CatchModel;
|
use catcher\base\CatchModel;
|
||||||
@@ -11,7 +13,7 @@ class CatchQuery extends Query
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2020年01月13日
|
* @time 2020年01月13日
|
||||||
* @param string $model
|
* @param mixed $model
|
||||||
* @param string $joinField
|
* @param string $joinField
|
||||||
* @param string $currentJoinField
|
* @param string $currentJoinField
|
||||||
* @param array $field
|
* @param array $field
|
||||||
@@ -19,29 +21,38 @@ class CatchQuery extends Query
|
|||||||
* @param array $bind
|
* @param array $bind
|
||||||
* @return CatchQuery
|
* @return CatchQuery
|
||||||
*/
|
*/
|
||||||
public function catchJoin(string $model, string $joinField, string $currentJoinField, array $field = [], string $type = 'INNER', array $bind = []): CatchQuery
|
public function catchJoin($model, string $joinField, string $currentJoinField, array $field = [], string $type = 'INNER', array $bind = []): CatchQuery
|
||||||
{
|
{
|
||||||
|
$tableAlias = null;
|
||||||
|
|
||||||
|
if (is_string($model)) {
|
||||||
$table = app($model)->getTable();
|
$table = app($model)->getTable();
|
||||||
|
} else {
|
||||||
|
list($model, $tableAlias) = $model;
|
||||||
|
$table = app($model)->getTable();
|
||||||
|
}
|
||||||
|
|
||||||
// 合并字段
|
// 合并字段
|
||||||
$this->options['field'] = array_merge($this->options['field'] ?? [], array_map(function ($value) use ($table) {
|
$this->options['field'] = array_merge($this->options['field'] ?? [], array_map(function ($value) use ($table, $tableAlias) {
|
||||||
return $table . '.' . $value;
|
return ($tableAlias ? : $table) . '.' . $value;
|
||||||
}, $field));
|
}, $field));
|
||||||
|
|
||||||
return $this->join($table, sprintf('%s.%s=%s.%s', $table, $joinField, $this->getAlias(), $currentJoinField), $type, $bind);
|
return $this->join($tableAlias ? sprintf('%s %s', $table, $tableAlias) : $table
|
||||||
|
|
||||||
|
, sprintf('%s.%s=%s.%s', $tableAlias ? $tableAlias : $table, $joinField, $this->getAlias(), $currentJoinField), $type, $bind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2020年01月13日
|
* @time 2020年01月13日
|
||||||
* @param string $model
|
* @param mixed $model
|
||||||
* @param string $joinField
|
* @param string $joinField
|
||||||
* @param string $currentJoinField
|
* @param string $currentJoinField
|
||||||
* @param array $field
|
* @param array $field
|
||||||
* @param array $bind
|
* @param array $bind
|
||||||
* @return CatchQuery
|
* @return CatchQuery
|
||||||
*/
|
*/
|
||||||
public function catchLeftJoin(string $model, string $joinField, string $currentJoinField, array $field = [], array $bind = []): CatchQuery
|
public function catchLeftJoin($model, string $joinField, string $currentJoinField, array $field = [], array $bind = []): CatchQuery
|
||||||
{
|
{
|
||||||
return $this->catchJoin($model, $joinField, $currentJoinField, $field,'LEFT', $bind);
|
return $this->catchJoin($model, $joinField, $currentJoinField, $field,'LEFT', $bind);
|
||||||
}
|
}
|
||||||
@@ -49,14 +60,14 @@ class CatchQuery extends Query
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2020年01月13日
|
* @time 2020年01月13日
|
||||||
* @param string $model
|
* @param mixed $model
|
||||||
* @param string $joinField
|
* @param string $joinField
|
||||||
* @param string $currentJoinField
|
* @param string $currentJoinField
|
||||||
* @param array $field
|
* @param array $field
|
||||||
* @param array $bind
|
* @param array $bind
|
||||||
* @return CatchQuery
|
* @return CatchQuery
|
||||||
*/
|
*/
|
||||||
public function catchRightJoin(string $model, string $joinField, string $currentJoinField, array $field = [], array $bind = []): CatchQuery
|
public function catchRightJoin($model, string $joinField, string $currentJoinField, array $field = [], array $bind = []): CatchQuery
|
||||||
{
|
{
|
||||||
return $this->catchJoin($model, $joinField, $currentJoinField, $field,'RIGHT', $bind);
|
return $this->catchJoin($model, $joinField, $currentJoinField, $field,'RIGHT', $bind);
|
||||||
}
|
}
|
||||||
@@ -118,7 +129,8 @@ class CatchQuery extends Query
|
|||||||
|
|
||||||
foreach ($params as $field => $value) {
|
foreach ($params as $field => $value) {
|
||||||
$method = 'search' . Str::studly($field) . 'Attr';
|
$method = 'search' . Str::studly($field) . 'Attr';
|
||||||
if ($value !== null && method_exists($this->model, $method)) {
|
// value in [null, '']
|
||||||
|
if ($value !== null && $value !== '' && method_exists($this->model, $method)) {
|
||||||
$this->model->$method($this, $value, $params);
|
$this->model->$method($this, $value, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use think\Paginator;
|
use think\Paginator;
|
||||||
use think\Response;
|
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
|
|
||||||
class CatchResponse
|
class CatchResponse
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catchAdmin\system\model\Attachments;
|
use catchAdmin\system\model\Attachments;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
class Code
|
class Code
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
class Tree
|
class Tree
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
use catchAdmin\system\model\Config;
|
use catchAdmin\system\model\Config;
|
||||||
@@ -149,6 +151,18 @@ class Utils
|
|||||||
return \config('database.connections.mysql.prefix');
|
return \config('database.connections.mysql.prefix');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除前缀
|
||||||
|
*
|
||||||
|
* @time 2020年12月01日
|
||||||
|
* @param string $table
|
||||||
|
* @return string|string[]
|
||||||
|
*/
|
||||||
|
public static function tableWithoutPrefix(string $table)
|
||||||
|
{
|
||||||
|
return str_replace(self::tablePrefix(), '', $table);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是超级管理员
|
* 是否是超级管理员
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\base;
|
namespace catcher\base;
|
||||||
|
|
||||||
abstract class CatchController
|
abstract class CatchController
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\base;
|
namespace catcher\base;
|
||||||
|
|
||||||
use catcher\CatchQuery;
|
use catcher\CatchQuery;
|
||||||
@@ -33,4 +35,16 @@ abstract class CatchModel extends \think\Model
|
|||||||
public const ENABLE = 1;
|
public const ENABLE = 1;
|
||||||
// 禁用
|
// 禁用
|
||||||
public const DISABLE = 2;
|
public const DISABLE = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有 field
|
||||||
|
*
|
||||||
|
* @time 2020年11月23日
|
||||||
|
* @param string $field
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasField(string $field)
|
||||||
|
{
|
||||||
|
return property_exists($this, 'field') ? in_array($field, $this->field) : false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename CatchRepository.php
|
* @filename CatchRepository.php
|
||||||
* @createdAt 2020/6/21
|
* @createdAt 2020/6/21
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\base;
|
namespace catcher\base;
|
||||||
|
|
||||||
use app\Request;
|
use app\Request;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\base;
|
namespace catcher\base;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
@@ -178,9 +178,14 @@ class CreateModuleCommand extends Command
|
|||||||
{
|
{
|
||||||
$moduleJson = FileSystem::sharedGet(__DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'module.stub');
|
$moduleJson = FileSystem::sharedGet(__DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'module.stub');
|
||||||
|
|
||||||
$content = str_replace(['{NAME}','{DESCRIPTION}','{MODULE}', '{SERVICE}'],
|
$content = str_replace(['{NAME}','{DESCRIPTION}','{MODULE}', '{SERVICE}', '{KEYWORDS}'],
|
||||||
[$this->name, $this->description,
|
[
|
||||||
$this->module, '\\\\'. str_replace('\\', '\\\\',$this->namespaces . ucfirst($this->module) . 'Service')], $moduleJson);
|
$this->name, $this->description,
|
||||||
|
$this->module,
|
||||||
|
'\\\\'. str_replace('\\', '\\\\',
|
||||||
|
$this->namespaces . ucfirst($this->module) . 'Service'),
|
||||||
|
''
|
||||||
|
], $moduleJson);
|
||||||
|
|
||||||
FileSystem::put($this->moduleDir . 'module.json', $content);
|
FileSystem::put($this->moduleDir . 'module.json', $content);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\exceptions;
|
namespace catcher\exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\exceptions;
|
namespace catcher\exceptions;
|
||||||
|
|
||||||
use catcher\Code;
|
use catcher\Code;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\exceptions;
|
namespace catcher\exceptions;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\exceptions;
|
namespace catcher\exceptions;
|
||||||
|
|
||||||
use catcher\Code;
|
use catcher\Code;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\exceptions;
|
namespace catcher\exceptions;
|
||||||
|
|
||||||
use catcher\Code;
|
use catcher\Code;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\exceptions;
|
namespace catcher\exceptions;
|
||||||
|
|
||||||
use catcher\Code;
|
use catcher\Code;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename WechatResponseException.php
|
* @filename WechatResponseException.php
|
||||||
* @createdAt 2020/6/21
|
* @createdAt 2020/6/21
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\facade;
|
namespace catcher\facade;
|
||||||
|
|
||||||
use think\Facade;
|
use think\Facade;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\facade;
|
namespace catcher\facade;
|
||||||
|
|
||||||
use think\Facade;
|
use think\Facade;
|
||||||
|
@@ -11,6 +11,7 @@ use catcher\generate\build\classes\Uses;
|
|||||||
use catcher\generate\build\types\Arr;
|
use catcher\generate\build\types\Arr;
|
||||||
use catcher\traits\db\BaseOptionsTrait;
|
use catcher\traits\db\BaseOptionsTrait;
|
||||||
use catcher\traits\db\ScopeTrait;
|
use catcher\traits\db\ScopeTrait;
|
||||||
|
use catcher\Utils;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\helper\Str;
|
use think\helper\Str;
|
||||||
|
|
||||||
@@ -80,14 +81,16 @@ class Model extends Factory
|
|||||||
}
|
}
|
||||||
|
|
||||||
$class->addProperty(
|
$class->addProperty(
|
||||||
(new Property('name'))->default($table)->docComment('// 表名')
|
(new Property('name'))->default(
|
||||||
|
Utils::tableWithoutPrefix($table)
|
||||||
|
)->docComment('// 表名')
|
||||||
);
|
);
|
||||||
|
|
||||||
$class->when($this->hasTableExists($table), function ($class) use ($table){
|
$class->when($this->hasTableExists($table), function ($class) use ($table){
|
||||||
$class->addProperty(
|
$class->addProperty(
|
||||||
(new Property('field'))->default(
|
(new Property('field'))->default(
|
||||||
(new Arr)->build(Db::getFields($table))
|
(new Arr)->build(Db::getFields($table))
|
||||||
))->docComment('// 数据库字段映射');
|
)->docComment('// 数据库字段映射'));
|
||||||
});
|
});
|
||||||
|
|
||||||
})->getContent();
|
})->getContent();
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library;
|
namespace catcher\library;
|
||||||
|
|
||||||
use catcher\CatchAdmin;
|
use catcher\CatchAdmin;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename Errors.php
|
* @filename Errors.php
|
||||||
* @createdAt 2020/6/21
|
* @createdAt 2020/6/21
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catcher\library;
|
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace catcher\library;
|
||||||
|
|
||||||
use think\exception\ClassNotFoundException;
|
use think\exception\ClassNotFoundException;
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename ProgressBar.php
|
* @filename ProgressBar.php
|
||||||
* @createdAt 2020/6/20
|
* @createdAt 2020/6/20
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library;
|
namespace catcher\library;
|
||||||
|
|
||||||
use catcher\CatchCacheKeys;
|
use catcher\CatchCacheKeys;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename WeChat.php
|
* @filename WeChat.php
|
||||||
* @date 2020/6/7
|
* @date 2020/6/7
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\client;
|
namespace catcher\library\client;
|
||||||
|
|
||||||
use catcher\exceptions\FailedException;
|
use catcher\exceptions\FailedException;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\client;
|
namespace catcher\library\client;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\excel;
|
namespace catcher\library\excel;
|
||||||
|
|
||||||
use catcher\CatchUpload;
|
use catcher\CatchUpload;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\excel;
|
namespace catcher\library\excel;
|
||||||
|
|
||||||
interface ExcelContract
|
interface ExcelContract
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\excel;
|
namespace catcher\library\excel;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\excel;
|
namespace catcher\library\excel;
|
||||||
|
|
||||||
trait MacroExcel
|
trait MacroExcel
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\library\excel;
|
namespace catcher\library\excel;
|
||||||
|
|
||||||
interface ShouldTaskContract
|
interface ShouldTaskContract
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | CatchAdmin [Just Like ~ ]
|
// | CatchAdmin [Just Like ~ ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\traits\db;
|
namespace catcher\traits\db;
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @filename ScopeTrait.php
|
* @filename ScopeTrait.php
|
||||||
* @createdAt 2020/6/21
|
* @createdAt 2020/6/21
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\traits\db;
|
namespace catcher\traits\db;
|
||||||
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\validates;
|
namespace catcher\validates;
|
||||||
|
|
||||||
use catcher\library\Trie;
|
use catcher\library\Trie;
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\validates;
|
namespace catcher\validates;
|
||||||
|
|
||||||
class Sometimes implements ValidateInterface
|
class Sometimes implements ValidateInterface
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace catcher\validates;
|
namespace catcher\validates;
|
||||||
|
|
||||||
interface ValidateInterface
|
interface ValidateInterface
|
||||||
|
Reference in New Issue
Block a user