feat:兼容开发

main
gzydong 2022-01-21 22:19:42 +08:00
parent 976bc1ef14
commit afcf456d60
15 changed files with 54 additions and 45 deletions

View File

@ -38,6 +38,7 @@ class AuthController extends CController
public function login(): ResponseInterface public function login(): ResponseInterface
{ {
$params = $this->request->inputs(['mobile', 'password', 'platform']); $params = $this->request->inputs(['mobile', 'password', 'platform']);
$this->validate($params, [ $this->validate($params, [
'mobile' => "required|phone", 'mobile' => "required|phone",
'password' => 'required', 'password' => 'required',
@ -61,7 +62,7 @@ class AuthController extends CController
'type' => 'Bearer', 'type' => 'Bearer',
'access_token' => $token, 'access_token' => $token,
'expires_in' => $this->guard()->getJwtManager()->getTtl(), 'expires_in' => $this->guard()->getJwtManager()->getTtl(),
], '账号登录成功...'); ]);
} }
/** /**
@ -73,7 +74,7 @@ class AuthController extends CController
{ {
$this->guard()->check() && $this->guard()->logout(); $this->guard()->check() && $this->guard()->logout();
return $this->response->success([], '退出登录成功...'); return $this->response->success();
} }
/** /**
@ -120,6 +121,7 @@ class AuthController extends CController
public function forget(): ResponseInterface public function forget(): ResponseInterface
{ {
$params = $this->request->inputs(['mobile', 'password', 'sms_code']); $params = $this->request->inputs(['mobile', 'password', 'sms_code']);
$this->validate($params, [ $this->validate($params, [
'mobile' => "required|phone", 'mobile' => "required|phone",
'password' => 'required|max:16', 'password' => 'required|max:16',
@ -135,10 +137,9 @@ class AuthController extends CController
return $this->response->fail('重置密码失败!'); return $this->response->fail('重置密码失败!');
} }
// 删除验证码缓存
$this->sms->delCode(SmsConstant::SmsForgetAccountChannel, $params['mobile']); $this->sms->delCode(SmsConstant::SmsForgetAccountChannel, $params['mobile']);
return $this->response->success([], '账号注册成功...'); return $this->response->success();
} }
/** /**

View File

@ -38,7 +38,6 @@ class UserService extends BaseService
*/ */
public function login(string $mobile, string $password) public function login(string $mobile, string $password)
{ {
$user = User::where('mobile', $mobile)->first();
if (!$user = User::where('mobile', $mobile)->first()) { if (!$user = User::where('mobile', $mobile)->first()) {
return false; return false;
} }

View File

@ -21,7 +21,7 @@ class CreateUsersTable extends Migration
$table->string('motto', 100)->default('')->comment('用户座右铭'); $table->string('motto', 100)->default('')->comment('用户座右铭');
$table->string('email', 30)->default('')->comment('用户邮箱'); $table->string('email', 30)->default('')->comment('用户邮箱');
$table->unsignedTinyInteger('is_robot')->default(0)->comment('是否机器人[0:否;1:是;]'); $table->unsignedTinyInteger('is_robot')->default(0)->comment('是否机器人[0:否;1:是;]');
$table->dateTime('created_at')->nullable()->comment('注册时间'); $table->dateTime('created_at')->nullable()->comment('创建时间');
$table->dateTime('updated_at')->nullable()->comment('更新时间'); $table->dateTime('updated_at')->nullable()->comment('更新时间');
$table->charset = 'utf8'; $table->charset = 'utf8';

View File

@ -15,13 +15,14 @@ class CreateArticleAnnexTable extends Migration
$table->unsignedBigInteger('id', true)->comment('文件ID'); $table->unsignedBigInteger('id', true)->comment('文件ID');
$table->unsignedInteger('user_id')->unsigned()->comment('上传文件的用户ID'); $table->unsignedInteger('user_id')->unsigned()->comment('上传文件的用户ID');
$table->unsignedInteger('article_id')->default(0)->comment('笔记ID'); $table->unsignedInteger('article_id')->default(0)->comment('笔记ID');
$table->string('file_suffix', 10)->default('')->comment('文件后缀名'); $table->string('suffix', 10)->default('')->comment('文件后缀名');
$table->unsignedBigInteger('file_size')->default(0)->comment('文件大小(单位字节)'); $table->unsignedBigInteger('size')->default(0)->comment('文件大小(单位字节)');
$table->string('save_dir', 500)->nullable(false)->default('')->comment('文件保存地址(相对地址)'); $table->string('path', 500)->nullable(false)->default('')->comment('文件保存地址(相对地址)');
$table->string('original_name', 100)->nullable(false)->default('')->comment('原文件名'); $table->string('original_name', 100)->nullable(false)->default('')->comment('原文件名');
$table->unsignedTinyInteger('status')->default(1)->comment('附件状态[1:正常;2:已删除]'); $table->unsignedTinyInteger('status')->default(1)->comment('附件状态[1:正常;2:已删除]');
$table->dateTime('created_at')->nullable(true)->comment('附件上传时间'); $table->dateTime('created_at')->nullable(true)->comment('创建时间');
$table->dateTime('deleted_at')->nullable(true)->comment('附件删除时间'); $table->dateTime('updated_at')->nullable(true)->comment('更新时间');
$table->dateTime('deleted_at')->nullable(true)->comment('删除时间');
$table->charset = 'utf8'; $table->charset = 'utf8';
$table->collation = 'utf8_general_ci'; $table->collation = 'utf8_general_ci';

View File

@ -17,7 +17,8 @@ class CreateArticleClassTable extends Migration
$table->string('class_name', 20)->default('')->comment('分类名'); $table->string('class_name', 20)->default('')->comment('分类名');
$table->unsignedTinyInteger('sort')->default(0)->comment('排序'); $table->unsignedTinyInteger('sort')->default(0)->comment('排序');
$table->unsignedTinyInteger('is_default')->default(0)->comment('默认分类[1:是;0:不是]'); $table->unsignedTinyInteger('is_default')->default(0)->comment('默认分类[1:是;0:不是]');
$table->unsignedInteger('created_at')->nullable(true)->default(0)->comment('创建时间'); $table->dateTime('created_at')->nullable(true)->comment('创建时间');
$table->dateTime('updated_at')->nullable(true)->comment('更新时间');
$table->charset = 'utf8'; $table->charset = 'utf8';
$table->collation = 'utf8_general_ci'; $table->collation = 'utf8_general_ci';

View File

@ -12,7 +12,7 @@ class CreateArticleDetailTable extends Migration
public function up(): void public function up(): void
{ {
Schema::create('article_detail', function (Blueprint $table) { Schema::create('article_detail', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('笔记详情ID'); $table->unsignedInteger('id', true)->comment('自增ID');
$table->unsignedInteger('article_id')->nullable(false)->comment('笔记ID'); $table->unsignedInteger('article_id')->nullable(false)->comment('笔记ID');
$table->longtext('md_content')->charset('utf8mb4')->comment('Markdown 内容'); $table->longtext('md_content')->charset('utf8mb4')->comment('Markdown 内容');
$table->longtext('content')->charset('utf8mb4')->comment('Markdown 解析HTML内容'); $table->longtext('content')->charset('utf8mb4')->comment('Markdown 解析HTML内容');
@ -21,7 +21,7 @@ class CreateArticleDetailTable extends Migration
$table->collation = 'utf8_general_ci'; $table->collation = 'utf8_general_ci';
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
$table->unique('article_id', 'unique_article_id'); $table->unique('article_id', 'uk_article_id');
$table->comment('笔记详情表'); $table->comment('笔记详情表');
}); });

View File

@ -11,17 +11,20 @@ class CreateArticleTagsTable extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('article_tags', function (Blueprint $table) { Schema::create('article_tag', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('笔记标签ID'); $table->unsignedInteger('id', true)->comment('笔记标签ID');
$table->unsignedInteger('user_id')->default(0)->comment('用户ID'); $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
$table->string('tag_name', 20)->default('')->comment('标签名'); $table->string('tag_name', 20)->default('')->comment('标签名');
$table->unsignedTinyInteger('sort')->default(0)->comment('排序'); $table->unsignedTinyInteger('sort')->default(0)->comment('排序');
$table->unsignedInteger('created_at')->nullable(true)->default(0)->comment('创建时间'); $table->dateTime('created_at')->nullable(true)->comment('创建时间');
$table->dateTime('updated_at')->nullable(true)->comment('更新时间');
$table->charset = 'utf8'; $table->charset = 'utf8';
$table->collation = 'utf8_general_ci'; $table->collation = 'utf8_general_ci';
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
$table->index(['user_id'], 'idx_user_id'); $table->index(['user_id'], 'idx_user_id');
$table->comment('笔记标签表'); $table->comment('笔记标签表');
}); });
} }
@ -31,6 +34,6 @@ class CreateArticleTagsTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('article_tags'); Schema::dropIfExists('article_tag');
} }
} }

View File

@ -4,31 +4,33 @@ use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration; use Hyperf\Database\Migrations\Migration;
class CreateFileSplitUploadTable extends Migration class CreateSplitUploadTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up(): void public function up(): void
{ {
Schema::create('file_split_upload', function (Blueprint $table) { Schema::create('split_upload', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('临时文件ID'); $table->unsignedInteger('id', true)->comment('临时文件ID');
$table->unsignedTinyInteger('file_type')->default(2)->comment('数据类型[1:合并文件;2:拆分文件]'); $table->unsignedTinyInteger('type')->default(2)->comment('数据类型[1:合并文件;2:拆分文件]');
$table->unsignedInteger('user_id')->default(0)->comment('上传的用户ID'); $table->unsignedInteger('user_id')->default(0)->comment('上传的用户ID');
$table->string('hash_name', 32)->default('')->comment('临时文件hash名'); $table->string('upload_id', 32)->default('')->comment('上传文件ID');
$table->string('original_name', 100)->default('')->comment('原文件名'); $table->string('original_name', 100)->default('')->comment('原文件名');
$table->unsignedTinyInteger('split_index')->default(0)->comment('当前索引块'); $table->unsignedTinyInteger('split_index')->default(0)->comment('当前索引块');
$table->unsignedTinyInteger('split_num')->default(0)->comment('总上传索引块'); $table->unsignedTinyInteger('split_num')->default(0)->comment('总上传索引块');
$table->string('save_dir', 255)->default('')->comment('文件的临时保存路径'); $table->string('path', 255)->default('')->comment('保存路径');
$table->string('file_ext', 10)->default('')->comment('文件后缀名'); $table->string('file_ext', 10)->default('')->comment('文件后缀名');
$table->unsignedInteger('file_size')->default(0)->comment('临时文件大小'); $table->unsignedInteger('file_size')->default(0)->comment('临时文件大小');
$table->unsignedTinyInteger('is_delete')->default(0)->comment('文件是否已被删除[0:否;1:是]'); $table->unsignedTinyInteger('is_delete')->default(0)->comment('文件是否已被删除[0:否;1:是]');
$table->unsignedInteger('upload_at')->nullable(true)->comment('文件上传时间'); $table->unsignedInteger('created_at')->nullable(true)->comment('创建时间');
$table->unsignedInteger('updated_at')->nullable(true)->comment('更新时间');
$table->charset = 'utf8'; $table->charset = 'utf8';
$table->collation = 'utf8_general_ci'; $table->collation = 'utf8_general_ci';
$table->index(['user_id', 'hash_name'], 'idx_user_id_hash_name'); $table->index(['user_id', 'upload_id'], 'idx_user_id_upload_id');
$table->comment('文件拆分上传'); $table->comment('文件拆分上传');
}); });
} }
@ -38,6 +40,6 @@ class CreateFileSplitUploadTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('file_split_upload'); Schema::dropIfExists('split_upload');
} }
} }

View File

@ -4,14 +4,14 @@ use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration; use Hyperf\Database\Migrations\Migration;
class CreateTalkListTable extends Migration class CreateTalkSessionTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up(): void public function up(): void
{ {
Schema::create('talk_list', function (Blueprint $table) { Schema::create('talk_session', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('聊天列表ID'); $table->unsignedInteger('id', true)->comment('聊天列表ID');
$table->unsignedTinyInteger('talk_type')->default(1)->comment('聊天类型[1:私信;2:群聊;]'); $table->unsignedTinyInteger('talk_type')->default(1)->comment('聊天类型[1:私信;2:群聊;]');
$table->unsignedInteger('user_id')->default(0)->comment('用户ID'); $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
@ -37,6 +37,6 @@ class CreateTalkListTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('talk_list'); Schema::dropIfExists('talk_session');
} }
} }

View File

@ -15,13 +15,14 @@ class CreateTalkRecordsFileTable extends Migration
$table->unsignedInteger('id', true)->comment('文件ID'); $table->unsignedInteger('id', true)->comment('文件ID');
$table->unsignedInteger('record_id')->default(0)->comment('消息记录ID'); $table->unsignedInteger('record_id')->default(0)->comment('消息记录ID');
$table->unsignedInteger('user_id')->default(0)->comment('上传文件的用户ID'); $table->unsignedInteger('user_id')->default(0)->comment('上传文件的用户ID');
$table->tinyInteger('file_source')->default(1)->unsigned()->comment('文件来源[1:用户上传;2:表情包]'); $table->tinyInteger('source')->default(1)->unsigned()->comment('文件来源[1:用户上传;2:表情包]');
$table->tinyInteger('file_type')->default(1)->unsigned()->comment('消息类型[1:图片;2:视频;3:文件]'); $table->tinyInteger('type')->default(1)->unsigned()->comment('消息类型[1:图片;2:视频;3:文件]');
$table->tinyInteger('save_type')->default(0)->unsigned()->comment('文件保存方式0:本地 1:第三方[阿里OOS、七牛云] '); $table->tinyInteger('drive')->default(1)->unsigned()->comment('驱动类型[1:local;2:cos;]');
$table->string('original_name', 100)->default('')->comment('原文件名'); $table->string('original_name', 100)->default('')->comment('原文件名');
$table->string('file_suffix', 10)->default('')->comment('文件后缀名'); $table->string('suffix', 10)->default('')->comment('文件后缀名');
$table->unsignedBigInteger('file_size')->default(0)->comment('文件大小(单位字节)'); $table->unsignedBigInteger('size')->default(0)->comment('文件大小(单位字节)');
$table->string('save_dir', 300)->default('')->comment('文件保存地址(相对地址/第三方网络地址)'); $table->string('path', 300)->default('')->comment('文件地址(相对地址)');
$table->string('url', 300)->default('')->comment('网络地址(公开文件地址)');
$table->tinyInteger('is_delete')->default(0)->unsigned()->comment('文件是否已删除[0:否;1:已删除]'); $table->tinyInteger('is_delete')->default(0)->unsigned()->comment('文件是否已删除[0:否;1:已删除]');
$table->dateTime('created_at')->nullable(true)->comment('创建时间'); $table->dateTime('created_at')->nullable(true)->comment('创建时间');

View File

@ -16,7 +16,7 @@ class CreateTalkRecordsCodeTable extends Migration
$table->unsignedInteger('id', true)->comment('入群或退群通知ID'); $table->unsignedInteger('id', true)->comment('入群或退群通知ID');
$table->unsignedInteger('record_id')->default(0)->comment('消息记录ID'); $table->unsignedInteger('record_id')->default(0)->comment('消息记录ID');
$table->unsignedInteger('user_id')->default(0)->comment('上传文件的用户ID'); $table->unsignedInteger('user_id')->default(0)->comment('上传文件的用户ID');
$table->string('code_lang', 20)->default('')->comment("代码片段类型(如php,java,python)"); $table->string('lang', 20)->default('')->comment("代码片段类型(如php,java,python)");
$table->text('code')->charset('utf8mb4')->comment('代码片段内容'); $table->text('code')->charset('utf8mb4')->comment('代码片段内容');
$table->dateTime('created_at')->nullable(true)->comment('创建时间'); $table->dateTime('created_at')->nullable(true)->comment('创建时间');

View File

@ -4,14 +4,14 @@ use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration; use Hyperf\Database\Migrations\Migration;
class CreateUsersFriendsTable extends Migration class CreateContactTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up(): void public function up(): void
{ {
Schema::create('users_friends', function (Blueprint $table) { Schema::create('contact', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('关系ID'); $table->unsignedInteger('id', true)->comment('关系ID');
$table->unsignedInteger('user_id')->default(0)->comment('用户ID'); $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
$table->unsignedInteger('friend_id')->default(0)->comment('好友ID'); $table->unsignedInteger('friend_id')->default(0)->comment('好友ID');
@ -34,6 +34,6 @@ class CreateUsersFriendsTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('users_friends'); Schema::dropIfExists('contact');
} }
} }

View File

@ -4,14 +4,14 @@ use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration; use Hyperf\Database\Migrations\Migration;
class CreateUsersFriendsApplyTable extends Migration class CreateContactApplyTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up(): void public function up(): void
{ {
Schema::create('users_friends_apply', function (Blueprint $table) { Schema::create('contact_apply', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('申请ID'); $table->unsignedInteger('id', true)->comment('申请ID');
$table->unsignedInteger('user_id')->default(0)->comment('申请人ID'); $table->unsignedInteger('user_id')->default(0)->comment('申请人ID');
$table->unsignedInteger('friend_id')->default(0)->comment('好友ID'); $table->unsignedInteger('friend_id')->default(0)->comment('好友ID');
@ -33,6 +33,6 @@ class CreateUsersFriendsApplyTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('users_friends_apply'); Schema::dropIfExists('contact_apply');
} }
} }

View File

@ -22,6 +22,7 @@ class CreateGroupTable extends Migration
$table->tinyInteger('is_mute')->default(0)->comment('是否全员禁言 [0:否;1:是;],提示:不包含群主或管理员'); $table->tinyInteger('is_mute')->default(0)->comment('是否全员禁言 [0:否;1:是;],提示:不包含群主或管理员');
$table->tinyInteger('is_dismiss')->default(0)->comment('是否已解散[0:否;1:是;]'); $table->tinyInteger('is_dismiss')->default(0)->comment('是否已解散[0:否;1:是;]');
$table->dateTime('created_at')->nullable()->comment('创建时间'); $table->dateTime('created_at')->nullable()->comment('创建时间');
$table->dateTime('updated_at')->nullable()->comment('更新时间');
$table->dateTime('dismissed_at')->nullable()->comment('解散时间'); $table->dateTime('dismissed_at')->nullable()->comment('解散时间');
$table->charset = 'utf8'; $table->charset = 'utf8';

View File

@ -4,14 +4,14 @@ use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint; use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration; use Hyperf\Database\Migrations\Migration;
class CreateRobotsTable extends Migration class CreateRobotTable extends Migration
{ {
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up(): void public function up(): void
{ {
Schema::create('robots', function (Blueprint $table) { Schema::create('robot', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('机器人ID'); $table->unsignedInteger('id', true)->comment('机器人ID');
$table->unsignedInteger('user_id')->comment('关联用户ID'); $table->unsignedInteger('user_id')->comment('关联用户ID');
$table->string('robot_name', 30)->default('')->comment('机器人名称'); $table->string('robot_name', 30)->default('')->comment('机器人名称');
@ -20,7 +20,7 @@ class CreateRobotsTable extends Migration
$table->unsignedTinyInteger('is_talk')->default(0)->unsigned()->comment('可发送消息[0:否;1:是;]'); $table->unsignedTinyInteger('is_talk')->default(0)->unsigned()->comment('可发送消息[0:否;1:是;]');
$table->unsignedTinyInteger('status')->default(0)->unsigned()->comment('状态[-1:已删除;0:正常;1:已禁用;]'); $table->unsignedTinyInteger('status')->default(0)->unsigned()->comment('状态[-1:已删除;0:正常;1:已禁用;]');
$table->unsignedTinyInteger('type')->default(0)->unsigned()->comment('机器人类型'); $table->unsignedTinyInteger('type')->default(0)->unsigned()->comment('机器人类型');
$table->dateTime('created_at')->nullable()->comment('注册时间'); $table->dateTime('created_at')->nullable()->comment('创建时间');
$table->dateTime('updated_at')->nullable()->comment('更新时间'); $table->dateTime('updated_at')->nullable()->comment('更新时间');
$table->charset = 'utf8'; $table->charset = 'utf8';
@ -36,6 +36,6 @@ class CreateRobotsTable extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('robots'); Schema::dropIfExists('robot');
} }
} }