feat:兼容开发
parent
34523c1c5f
commit
5f3c9d4ca7
|
@ -41,13 +41,5 @@ class TestCommand extends HyperfCommand
|
||||||
{
|
{
|
||||||
// $repository = di()->get(ExampleRepository::class);
|
// $repository = di()->get(ExampleRepository::class);
|
||||||
// $repository->where_case2();
|
// $repository->where_case2();
|
||||||
|
|
||||||
// di()->get(RobotService::class)->create([
|
|
||||||
// 'robot_name' => "登录助手",
|
|
||||||
// 'describe' => "异地登录助手",
|
|
||||||
// 'logo' => '',
|
|
||||||
// 'is_talk' => 0,
|
|
||||||
// 'type' => 1,
|
|
||||||
// ]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ class CommonController extends CController
|
||||||
public function EmailCode(SendEmailCode $sendEmailCode)
|
public function EmailCode(SendEmailCode $sendEmailCode)
|
||||||
{
|
{
|
||||||
$params = $this->request->inputs(['email']);
|
$params = $this->request->inputs(['email']);
|
||||||
|
|
||||||
$this->validate($params, [
|
$this->validate($params, [
|
||||||
'email' => "required|email"
|
'email' => "required|email"
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -109,6 +109,10 @@ class ContactController extends CController
|
||||||
'id', 'nickname', 'mobile', 'avatar', 'gender'
|
'id', 'nickname', 'mobile', 'avatar', 'gender'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (empty($result)) {
|
||||||
|
return $this->response->fail("手机号不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
return $this->response->success($result);
|
return $this->response->success($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class EmoticonController
|
* Class EmoticonController
|
||||||
|
*
|
||||||
* @Controller(prefix="/api/v1/emoticon")
|
* @Controller(prefix="/api/v1/emoticon")
|
||||||
* @Middleware(JWTAuthMiddleware::class)
|
* @Middleware(JWTAuthMiddleware::class)
|
||||||
*
|
*
|
||||||
|
|
|
@ -176,12 +176,12 @@ class MessageController extends CController
|
||||||
*/
|
*/
|
||||||
public function file(Filesystem $filesystem): ResponseInterface
|
public function file(Filesystem $filesystem): ResponseInterface
|
||||||
{
|
{
|
||||||
$params = $this->request->inputs(['talk_type', 'receiver_id', 'hash_name']);
|
$params = $this->request->inputs(['talk_type', 'receiver_id', 'upload_id']);
|
||||||
|
|
||||||
$this->validate($params, [
|
$this->validate($params, [
|
||||||
'talk_type' => 'required|in:1,2',
|
'talk_type' => 'required|in:1,2',
|
||||||
'receiver_id' => 'required|integer|min:1',
|
'receiver_id' => 'required|integer|min:1',
|
||||||
'hash_name' => 'required',
|
'upload_id' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user_id = $this->uid();
|
$user_id = $this->uid();
|
||||||
|
@ -189,7 +189,7 @@ class MessageController extends CController
|
||||||
return $this->response->fail('暂不属于好友关系或群聊成员,无法发送聊天消息!');
|
return $this->response->fail('暂不属于好友关系或群聊成员,无法发送聊天消息!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = SplitUpload::where('user_id', $user_id)->where('upload_id', $params['hash_name'])->where('type', 1)->first();
|
$file = SplitUpload::where('user_id', $user_id)->where('upload_id', $params['upload_id'])->where('type', 1)->first();
|
||||||
if (!$file || empty($file->path)) {
|
if (!$file || empty($file->path)) {
|
||||||
return $this->response->fail('文件不存在...');
|
return $this->response->fail('文件不存在...');
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ class RecordsController extends CController
|
||||||
*/
|
*/
|
||||||
private $talkService;
|
private $talkService;
|
||||||
|
|
||||||
|
|
||||||
public function __construct(TalkService $talkService)
|
public function __construct(TalkService $talkService)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
|
@ -72,10 +72,14 @@ class UploadController extends CController
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = $this->splitUploadService->create($this->uid(), $params['file_name'], $params['file_size']);
|
$data = $this->splitUploadService->create($this->uid(), $params['file_name'], $params['file_size']);
|
||||||
|
if (empty($data)) {
|
||||||
|
return $this->response->fail('获取文件拆分信息失败!');
|
||||||
|
}
|
||||||
|
|
||||||
$data['hash_name'] = $data["upload_id"];
|
return $this->response->success([
|
||||||
|
"upload_id" => $data["upload_id"],
|
||||||
return $data ? $this->response->success($data) : $this->response->fail('获取文件拆分信息失败!');
|
"split_size" => $data["split_size"],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,11 +115,11 @@ class UploadController extends CController
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->response->success([
|
return $this->response->success([
|
||||||
'is_file_merge' => true,
|
'is_merge' => true,
|
||||||
'hash' => $params['upload_id']
|
'upload_id' => $params['upload_id']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->response->success(['is_file_merge' => false]);
|
return $this->response->success(['is_merge' => false]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace App\Exception\Handler;
|
||||||
|
|
||||||
use App\Cache\Repository\LockRedis;
|
use App\Cache\Repository\LockRedis;
|
||||||
use App\Constant\ResponseCode;
|
use App\Constant\ResponseCode;
|
||||||
use App\Templates\MailerTemplate;
|
use App\Template\MailerTemplate;
|
||||||
use Hyperf\Contract\StdoutLoggerInterface;
|
use Hyperf\Contract\StdoutLoggerInterface;
|
||||||
use Hyperf\ExceptionHandler\ExceptionHandler;
|
use Hyperf\ExceptionHandler\ExceptionHandler;
|
||||||
use Hyperf\HttpMessage\Stream\SwooleStream;
|
use Hyperf\HttpMessage\Stream\SwooleStream;
|
||||||
|
|
|
@ -28,6 +28,8 @@ class SplitUpload extends BaseModel
|
||||||
{
|
{
|
||||||
protected $table = 'split_upload';
|
protected $table = 'split_upload';
|
||||||
|
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'type',
|
'type',
|
||||||
'drive',
|
'drive',
|
||||||
|
|
|
@ -498,7 +498,7 @@ class ArticleService extends BaseService
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$annex_files = $info->annexs()->get(['id', 'article_id', 'save_dir'])->toArray();
|
$annex_files = $info->annexs()->get(['id', 'article_id', 'path'])->toArray();
|
||||||
|
|
||||||
//判断笔记是否存在附件,不存在直接删除
|
//判断笔记是否存在附件,不存在直接删除
|
||||||
if (count($annex_files) == 0) {
|
if (count($annex_files) == 0) {
|
||||||
|
|
|
@ -12,7 +12,6 @@ use App\Model\User;
|
||||||
use App\Model\Contact\ContactApply;
|
use App\Model\Contact\ContactApply;
|
||||||
use App\Repository\Contact\ContactRepository;
|
use App\Repository\Contact\ContactRepository;
|
||||||
use App\Service\SocketClientService;
|
use App\Service\SocketClientService;
|
||||||
use App\Service\UserService;
|
|
||||||
|
|
||||||
class SubscribeHandleService
|
class SubscribeHandleService
|
||||||
{
|
{
|
||||||
|
@ -49,15 +48,7 @@ class SubscribeHandleService
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data 数据
|
* @param array $data 数据 ['uuid' => '','event' => '','data' => '','options' => ''];
|
||||||
* <pre>
|
|
||||||
* [
|
|
||||||
* 'uuid' => '',
|
|
||||||
* 'event' => '',
|
|
||||||
* 'data' => '',
|
|
||||||
* 'options' => ''
|
|
||||||
* ];
|
|
||||||
* </pre>
|
|
||||||
*/
|
*/
|
||||||
public function handle(array $data)
|
public function handle(array $data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ class RobotService
|
||||||
try {
|
try {
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'mobile' => '100' . mt_rand(1000, 9999) . mt_rand(1000, 9999),
|
'mobile' => '100' . mt_rand(1000, 9999) . mt_rand(1000, 9999),
|
||||||
|
"nickname" => "登录助手",
|
||||||
'password' => HashHelper::make(Str::random(10)),
|
'password' => HashHelper::make(Str::random(10)),
|
||||||
'is_robot' => 1
|
'is_robot' => 1
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Support;
|
namespace App\Support;
|
||||||
|
|
||||||
use App\Templates\MailerTemplate;
|
use App\Template\MailerTemplate;
|
||||||
|
|
||||||
class SendEmailCode
|
class SendEmailCode
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Templates;
|
namespace App\Template;
|
||||||
|
|
||||||
abstract class BaseTemplate
|
abstract class BaseTemplate
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Templates;
|
namespace App\Template;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
|
@ -15,6 +15,7 @@ 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->unsignedInteger('drive')->unsigned()->default(1)->comment('文件驱动[1:local;2:cos;]');
|
||||||
$table->string('suffix', 10)->default('')->comment('文件后缀名');
|
$table->string('suffix', 10)->default('')->comment('文件后缀名');
|
||||||
$table->unsignedBigInteger('size')->default(0)->comment('文件大小(单位字节)');
|
$table->unsignedBigInteger('size')->default(0)->comment('文件大小(单位字节)');
|
||||||
$table->string('path', 500)->nullable(false)->default('')->comment('文件保存地址(相对地址)');
|
$table->string('path', 500)->nullable(false)->default('')->comment('文件保存地址(相对地址)');
|
||||||
|
|
|
@ -14,6 +14,7 @@ class CreateSplitUploadTable extends Migration
|
||||||
Schema::create('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('type')->default(2)->comment('数据类型[1:合并文件;2:拆分文件]');
|
$table->unsignedTinyInteger('type')->default(2)->comment('数据类型[1:合并文件;2:拆分文件]');
|
||||||
|
$table->unsignedInteger('drive')->unsigned()->default(1)->comment('文件驱动[1:local;2:cos;]');
|
||||||
$table->unsignedInteger('user_id')->default(0)->comment('上传的用户ID');
|
$table->unsignedInteger('user_id')->default(0)->comment('上传的用户ID');
|
||||||
$table->string('upload_id', 32)->default('')->comment('上传文件ID');
|
$table->string('upload_id', 32)->default('')->comment('上传文件ID');
|
||||||
$table->string('original_name', 100)->default('')->comment('原文件名');
|
$table->string('original_name', 100)->default('')->comment('原文件名');
|
||||||
|
@ -23,8 +24,9 @@ class CreateSplitUploadTable extends Migration
|
||||||
$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('created_at')->nullable(true)->comment('创建时间');
|
$table->json('attr')->nullable(false)->comment('额外参数Json');
|
||||||
$table->unsignedInteger('updated_at')->nullable(true)->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';
|
||||||
|
|
|
@ -20,6 +20,7 @@ class CreateGroupMemberTable extends Migration
|
||||||
$table->tinyInteger('is_quit')->default(0)->comment('是否退群[0:否;1:是;]');
|
$table->tinyInteger('is_quit')->default(0)->comment('是否退群[0:否;1:是;]');
|
||||||
$table->string('user_card', 20)->default('')->comment('群名片');
|
$table->string('user_card', 20)->default('')->comment('群名片');
|
||||||
$table->dateTime('created_at')->nullable()->comment('入群时间');
|
$table->dateTime('created_at')->nullable()->comment('入群时间');
|
||||||
|
$table->dateTime('updated_at')->nullable()->comment('更新时间');
|
||||||
$table->dateTime('deleted_at')->nullable()->comment('退群时间');
|
$table->dateTime('deleted_at')->nullable()->comment('退群时间');
|
||||||
|
|
||||||
$table->charset = 'utf8';
|
$table->charset = 'utf8';
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Initialize extends Seeder
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
if (User::count() > 0) {
|
if (User::count() > 1) {
|
||||||
echo "数据库已存在数据,不能执行初始化数据脚本...\n";
|
echo "数据库已存在数据,不能执行初始化数据脚本...\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -37,14 +37,14 @@ class Initialize extends Seeder
|
||||||
User::insert($users);
|
User::insert($users);
|
||||||
|
|
||||||
$defaultArticleClass = [];
|
$defaultArticleClass = [];
|
||||||
$usersFriends = [];
|
|
||||||
foreach (User::all() as $user) {
|
foreach (User::all() as $user) {
|
||||||
$defaultArticleClass[] = [
|
$defaultArticleClass[] = [
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'class_name' => '我的笔记',
|
'class_name' => '我的笔记',
|
||||||
'sort' => 1,
|
'sort' => 1,
|
||||||
'is_default' => 1,
|
'is_default' => 1,
|
||||||
'created_at' => time(),
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class Initialize extends Seeder
|
||||||
|
|
||||||
Contact::insert($friends);
|
Contact::insert($friends);
|
||||||
|
|
||||||
$service = new \App\Service\TalkSessionService();
|
$service = di()->get(\App\Service\TalkSessionService::class);
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
$service->create($item->user_id, $item->friend_id, \App\Constant\TalkModeConstant::PRIVATE_CHAT);
|
$service->create($item->user_id, $item->friend_id, \App\Constant\TalkModeConstant::PRIVATE_CHAT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue