优化代码
parent
146a9c4993
commit
52410df8a6
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -32,11 +30,11 @@ use App\Service\SocketClientService;
|
|||
use App\Service\SocketRoomService;
|
||||
use App\Constants\SocketConstants;
|
||||
|
||||
/**
|
||||
* 消息推送消费者队列
|
||||
*
|
||||
* @Consumer(name="ConsumerChat",enable=true)
|
||||
*/
|
||||
///**
|
||||
// * 消息推送消费者队列
|
||||
// * @Consumer(name="ConsumerChat",enable=true)
|
||||
// */
|
||||
|
||||
class ChatMessageConsumer extends ConsumerMessage
|
||||
{
|
||||
/**
|
||||
|
@ -109,7 +107,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
|
||||
/**
|
||||
* 重写创建队列生成类
|
||||
*
|
||||
* 注释:设置自动删除队列
|
||||
*
|
||||
* @return QueueBuilder
|
||||
|
@ -124,7 +121,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
*
|
||||
* @param $data
|
||||
* @param AMQPMessage $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function consumeMessage($data, AMQPMessage $message): string
|
||||
|
@ -150,7 +146,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
*
|
||||
* @param array $data 队列消息
|
||||
* @param AMQPMessage $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onConsumeTalk(array $data, AMQPMessage $message): string
|
||||
|
@ -266,7 +261,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
*
|
||||
* @param array $data 队列消息
|
||||
* @param AMQPMessage $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onConsumeKeyboard(array $data, AMQPMessage $message): string
|
||||
|
@ -283,7 +277,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
*
|
||||
* @param array $data 队列消息
|
||||
* @param AMQPMessage $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onConsumeOnlineStatus(array $data, AMQPMessage $message): string
|
||||
|
@ -305,7 +298,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
*
|
||||
* @param array $data 队列消息
|
||||
* @param AMQPMessage $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onConsumeRevokeTalk(array $data, AMQPMessage $message): string
|
||||
|
@ -342,7 +334,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
*
|
||||
* @param array $data 队列消息
|
||||
* @param AMQPMessage $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function onConsumeFriendApply(array $data, AMQPMessage $message): string
|
||||
|
@ -372,7 +363,6 @@ class ChatMessageConsumer extends ConsumerMessage
|
|||
* 格式化对话的消息体
|
||||
*
|
||||
* @param array $data 对话的消息
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function formatTalkMessage(array $data): array
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -49,7 +47,7 @@ class ChatMessageProducer extends ProducerMessage
|
|||
public function __construct(string $event, array $data, array $options = [])
|
||||
{
|
||||
$message = [
|
||||
'uuid' => $this->uuid(),// 自定义消息ID
|
||||
'uuid' => $this->uuid(),
|
||||
'event' => $event,
|
||||
'data' => $data,
|
||||
'options' => $options
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -19,8 +17,6 @@ use Hyperf\Redis\Redis;
|
|||
/**
|
||||
* 自定义服务启动前回调事件
|
||||
*
|
||||
* Class ServerStart
|
||||
*
|
||||
* @package App\Bootstrap
|
||||
*/
|
||||
class ServerStart extends ServerStartCallback
|
||||
|
|
|
@ -9,14 +9,12 @@ namespace App\Cache;
|
|||
*/
|
||||
class ApplyNumCache
|
||||
{
|
||||
|
||||
const KEY = 'friend:apply:unread:num';
|
||||
|
||||
/**
|
||||
* 获取好友未读申请数
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get(int $user_id)
|
||||
|
@ -28,7 +26,6 @@ class ApplyNumCache
|
|||
* 设置未读好友申请数(自增加1)
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function setInc(int $user_id)
|
||||
|
|
|
@ -28,7 +28,6 @@ class FriendRemarkCache
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $friend_id 好友ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get(int $user_id, int $friend_id)
|
||||
|
|
|
@ -13,7 +13,6 @@ class LastMsgCache
|
|||
* 用户聊天或群聊的最后一条消息hash存储的hash名
|
||||
*
|
||||
* @param int $sender
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function _name($sender = 0)
|
||||
|
@ -26,7 +25,6 @@ class LastMsgCache
|
|||
*
|
||||
* @param int $receive 接收者
|
||||
* @param int $sender 发送者
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function _key(int $receive, int $sender)
|
||||
|
@ -51,7 +49,6 @@ class LastMsgCache
|
|||
*
|
||||
* @param int $receive 接收者
|
||||
* @param int $sender 发送者(注:若聊天消息类型为群聊消息 $sender 应设置为0)
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get(int $receive, $sender = 0)
|
||||
|
|
|
@ -16,7 +16,6 @@ class UnreadTalkCache
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $friend_id 好友ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setInc(int $user_id, string $friend_id)
|
||||
|
@ -31,7 +30,6 @@ class UnreadTalkCache
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $friend_id 好友ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get(int $user_id, string $friend_id)
|
||||
|
@ -43,7 +41,6 @@ class UnreadTalkCache
|
|||
* 获取用户未读消息列表
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAll(int $user_id)
|
||||
|
@ -56,7 +53,6 @@ class UnreadTalkCache
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $friend_id 好友ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function del(int $user_id, string $friend_id)
|
||||
|
@ -68,7 +64,6 @@ class UnreadTalkCache
|
|||
* 清除用户所有好友未读数
|
||||
*
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delAll(int $user_id)
|
||||
|
@ -80,7 +75,6 @@ class UnreadTalkCache
|
|||
* 获取缓存key
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _key(int $user_id)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
|
|
@ -1,22 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
* @author Yuandong<837215079@qq.com>
|
||||
* @link https://github.com/gzydong/hyperf-chat
|
||||
*/
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
/**
|
||||
* HTTP 响应状态码枚举
|
||||
*
|
||||
* Class ResponseCode
|
||||
*
|
||||
* @package App\Constants
|
||||
*/
|
||||
class ResponseCode
|
||||
|
|
|
@ -1,22 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
* @author Yuandong<837215079@qq.com>
|
||||
* @link https://github.com/gzydong/hyperf-chat
|
||||
*/
|
||||
|
||||
namespace App\Constants;
|
||||
|
||||
/**
|
||||
* WebSocket 消息事件枚举
|
||||
*
|
||||
* Class SocketConstants
|
||||
*
|
||||
* @package App\Constants
|
||||
*/
|
||||
class SocketConstants
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -21,10 +19,10 @@ use App\Service\ArticleService;
|
|||
use App\Service\UploadService;
|
||||
use App\Support\RedisLock;
|
||||
use Hyperf\Utils\Str;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class ArticleController
|
||||
*
|
||||
* @Controller(path="/api/v1/article")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -46,8 +44,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 获取笔记分类列表
|
||||
*
|
||||
* @RequestMapping(path="article-class", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getArticleClass()
|
||||
{
|
||||
|
@ -58,8 +57,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 获取笔记标签列表
|
||||
*
|
||||
* @RequestMapping(path="article-tags", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getArticleTags()
|
||||
{
|
||||
|
@ -70,8 +70,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 获取笔记列表
|
||||
*
|
||||
* @RequestMapping(path="article-list", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getArticleList()
|
||||
{
|
||||
|
@ -103,8 +104,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 获取笔记详情
|
||||
*
|
||||
* @RequestMapping(path="article-detail", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getArticleDetail()
|
||||
{
|
||||
|
@ -120,8 +122,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 添加或编辑笔记分类
|
||||
*
|
||||
* @RequestMapping(path="edit-article-class", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editArticleClass()
|
||||
{
|
||||
|
@ -141,8 +144,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 删除笔记分类
|
||||
*
|
||||
* @RequestMapping(path="del-article-class", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function delArticleClass()
|
||||
{
|
||||
|
@ -160,8 +164,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 笔记分类列表排序接口
|
||||
*
|
||||
* @RequestMapping(path="article-class-sort", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function articleClassSort()
|
||||
{
|
||||
|
@ -190,8 +195,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 笔记分类合并接口
|
||||
*
|
||||
* @RequestMapping(path="merge-article-class", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function mergeArticleClass()
|
||||
{
|
||||
|
@ -210,8 +216,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 添加或编辑笔记标签
|
||||
*
|
||||
* @RequestMapping(path="edit-article-tag", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editArticleTags()
|
||||
{
|
||||
|
@ -230,8 +237,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 删除笔记标签
|
||||
*
|
||||
* @RequestMapping(path="del-article-tag", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function delArticleTags()
|
||||
{
|
||||
|
@ -249,8 +257,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 添加或编辑笔记
|
||||
*
|
||||
* @RequestMapping(path="edit-article", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editArticle()
|
||||
{
|
||||
|
@ -279,8 +288,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 删除笔记
|
||||
*
|
||||
* @RequestMapping(path="delete-article", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deleteArticle()
|
||||
{
|
||||
|
@ -298,8 +308,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 恢复删除笔记
|
||||
*
|
||||
* @RequestMapping(path="recover-article", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function recoverArticle()
|
||||
{
|
||||
|
@ -317,8 +328,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 笔记图片上传接口
|
||||
*
|
||||
* @RequestMapping(path="upload-article-image", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function uploadArticleImage()
|
||||
{
|
||||
|
@ -347,8 +359,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 移动笔记至指定分类
|
||||
*
|
||||
* @RequestMapping(path="move-article", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function moveArticle()
|
||||
{
|
||||
|
@ -371,8 +384,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 笔记标记星号接口
|
||||
*
|
||||
* @RequestMapping(path="set-asterisk-article", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function setAsteriskArticle()
|
||||
{
|
||||
|
@ -395,8 +409,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 更新笔记关联标签ID
|
||||
*
|
||||
* @RequestMapping(path="update-article-tag", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function updateArticleTag()
|
||||
{
|
||||
|
@ -415,8 +430,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 永久删除笔记文章
|
||||
*
|
||||
* @RequestMapping(path="forever-delete-article", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function foreverDelArticle()
|
||||
{
|
||||
|
@ -434,8 +450,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 上传笔记附件
|
||||
*
|
||||
* @RequestMapping(path="upload-article-annex", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function uploadArticleAnnex()
|
||||
{
|
||||
|
@ -476,8 +493,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 删除笔记附件
|
||||
*
|
||||
* @RequestMapping(path="delete-article-annex", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deleteArticleAnnex()
|
||||
{
|
||||
|
@ -495,8 +513,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 恢复笔记附件
|
||||
*
|
||||
* @RequestMapping(path="recover-article-annex", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function recoverArticleAnnex()
|
||||
{
|
||||
|
@ -514,8 +533,9 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 获取附件回收站列表
|
||||
*
|
||||
* @RequestMapping(path="recover-annex-list", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function recoverAnnexList()
|
||||
{
|
||||
|
@ -538,8 +558,10 @@ class ArticleController extends CController
|
|||
|
||||
/**
|
||||
* 永久删除笔记附件(从已删除附件中永久删除)
|
||||
*
|
||||
* @RequestMapping(path="forever-delete-annex", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function foreverDelAnnex()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -25,7 +23,6 @@ use Phper666\JWTAuth\JWT;
|
|||
|
||||
/**
|
||||
* 授权相关控制器
|
||||
*
|
||||
* @Controller(path="/api/v1/auth")
|
||||
*/
|
||||
class AuthController extends CController
|
||||
|
@ -50,7 +47,6 @@ class AuthController extends CController
|
|||
|
||||
/**
|
||||
* 授权登录接口
|
||||
*
|
||||
* @RequestMapping(path="login", methods="post")
|
||||
*/
|
||||
public function login()
|
||||
|
@ -93,7 +89,6 @@ class AuthController extends CController
|
|||
|
||||
/**
|
||||
* 退出登录接口
|
||||
*
|
||||
* @RequestMapping(path="logout", methods="post")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*/
|
||||
|
@ -106,7 +101,6 @@ class AuthController extends CController
|
|||
|
||||
/**
|
||||
* 账号注册接口
|
||||
*
|
||||
* @RequestMapping(path="register", methods="post")
|
||||
*/
|
||||
public function register()
|
||||
|
@ -142,7 +136,6 @@ class AuthController extends CController
|
|||
|
||||
/**
|
||||
* 账号找回接口
|
||||
*
|
||||
* @RequestMapping(path="forget", methods="post")
|
||||
*/
|
||||
public function forget()
|
||||
|
@ -171,7 +164,6 @@ class AuthController extends CController
|
|||
|
||||
/**
|
||||
* 授权刷新接口
|
||||
*
|
||||
* @RequestMapping(path="refresh", methods="post")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*/
|
||||
|
@ -187,7 +179,6 @@ class AuthController extends CController
|
|||
|
||||
/**
|
||||
* 发送验证码
|
||||
*
|
||||
* @RequestMapping(path="send-verify-code", methods="post")
|
||||
*/
|
||||
public function sendVerifyCode()
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -19,8 +17,6 @@ use App\Support\Response;
|
|||
/**
|
||||
* 基类控制器
|
||||
*
|
||||
* Class CController
|
||||
*
|
||||
* @package App\Controller\Api\V1
|
||||
*/
|
||||
class CController extends AbstractController
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -13,7 +11,6 @@
|
|||
namespace App\Controller\Api\V1;
|
||||
|
||||
use App\Model\UsersFriendsApply;
|
||||
use Co\Context;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
|
@ -32,7 +29,6 @@ use App\Constants\SocketConstants;
|
|||
|
||||
/**
|
||||
* Class ContactsController
|
||||
*
|
||||
* @Controller(path="/api/v1/contacts")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -60,8 +56,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 获取用户联系人列表
|
||||
*
|
||||
* @RequestMapping(path="list", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getContacts()
|
||||
{
|
||||
|
@ -79,11 +76,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 添加联系人
|
||||
*
|
||||
* @RequestMapping(path="add", methods="post")
|
||||
*
|
||||
* @param UserService $userService
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function addContact(UserService $userService)
|
||||
|
@ -126,8 +121,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 删除联系人
|
||||
*
|
||||
* @RequestMapping(path="delete", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deleteContact()
|
||||
{
|
||||
|
@ -152,8 +148,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 同意添加联系人
|
||||
*
|
||||
* @RequestMapping(path="accept-invitation", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function acceptInvitation()
|
||||
{
|
||||
|
@ -192,8 +189,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 拒绝添加联系人(预留)
|
||||
*
|
||||
* @RequestMapping(path="decline-invitation", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function declineInvitation()
|
||||
{
|
||||
|
@ -212,8 +210,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 删除联系人申请记录
|
||||
*
|
||||
* @RequestMapping(path="delete-apply", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deleteContactApply()
|
||||
{
|
||||
|
@ -231,8 +230,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 获取联系人申请未读数
|
||||
*
|
||||
* @RequestMapping(path="apply-unread-num", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getContactApplyUnreadNum()
|
||||
{
|
||||
|
@ -244,8 +244,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 获取联系人申请未读数
|
||||
*
|
||||
* @RequestMapping(path="apply-records", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getContactApplyRecords()
|
||||
{
|
||||
|
@ -268,8 +269,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 搜索联系人
|
||||
*
|
||||
* @RequestMapping(path="search", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function searchContacts()
|
||||
{
|
||||
|
@ -284,8 +286,9 @@ class ContactsController extends CController
|
|||
|
||||
/**
|
||||
* 编辑联系人备注
|
||||
*
|
||||
* @RequestMapping(path="edit-remark", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editContactRemark()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -26,7 +24,6 @@ use Hyperf\HttpServer\Contract\ResponseInterface;
|
|||
|
||||
/**
|
||||
* Class DownloadController
|
||||
*
|
||||
* @Controller(path="/api/v1/download")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -36,12 +33,10 @@ class DownloadController extends CController
|
|||
{
|
||||
/**
|
||||
* 下载用户聊天文件
|
||||
*
|
||||
* @RequestMapping(path="user-chat-file", methods="get")
|
||||
*
|
||||
* @param ResponseInterface $response
|
||||
* @param UploadService $uploadService
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
public function userChatFile(ResponseInterface $response, UploadService $uploadService)
|
||||
|
@ -81,12 +76,10 @@ class DownloadController extends CController
|
|||
|
||||
/**
|
||||
* 下载笔记附件
|
||||
*
|
||||
* @RequestMapping(path="article-annex", methods="get")
|
||||
*
|
||||
* @param ResponseInterface $response
|
||||
* @param UploadService $uploadService
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
public function articleAnnex(ResponseInterface $response, UploadService $uploadService)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -26,7 +24,6 @@ use Psr\Http\Message\ResponseInterface;
|
|||
|
||||
/**
|
||||
* Class EmoticonController
|
||||
*
|
||||
* @Controller(path="/api/v1/emoticon")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -42,8 +39,9 @@ class EmoticonController extends CController
|
|||
|
||||
/**
|
||||
* 获取用户表情包列表
|
||||
*
|
||||
* @RequestMapping(path="user-emoticon", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getUserEmoticon()
|
||||
{
|
||||
|
@ -76,8 +74,9 @@ class EmoticonController extends CController
|
|||
|
||||
/**
|
||||
* 获取系统表情包
|
||||
*
|
||||
* @RequestMapping(path="system-emoticon", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getSystemEmoticon()
|
||||
{
|
||||
|
@ -95,8 +94,9 @@ class EmoticonController extends CController
|
|||
|
||||
/**
|
||||
* 安装或移除系统表情包
|
||||
*
|
||||
* @RequestMapping(path="set-user-emoticon", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function setUserEmoticon()
|
||||
{
|
||||
|
@ -141,11 +141,9 @@ class EmoticonController extends CController
|
|||
|
||||
/**
|
||||
* 自定义上传表情包
|
||||
*
|
||||
* @RequestMapping(path="upload-emoticon", methods="post")
|
||||
*
|
||||
* @param UploadService $uploadService
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function uploadEmoticon(UploadService $uploadService)
|
||||
|
@ -197,8 +195,9 @@ class EmoticonController extends CController
|
|||
|
||||
/**
|
||||
* 收藏聊天图片的我的表情包
|
||||
*
|
||||
* @RequestMapping(path="collect-emoticon", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function collectEmoticon()
|
||||
{
|
||||
|
@ -220,8 +219,9 @@ class EmoticonController extends CController
|
|||
|
||||
/**
|
||||
* 移除收藏的表情包
|
||||
*
|
||||
* @RequestMapping(path="del-collect-emoticon", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function delCollectEmoticon()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -27,10 +25,10 @@ use App\Amqp\Producer\ChatMessageProducer;
|
|||
use App\Service\SocketRoomService;
|
||||
use App\Service\GroupService;
|
||||
use App\Constants\SocketConstants;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class GroupController
|
||||
*
|
||||
* @Controller(path="/api/v1/group")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -58,10 +56,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 创建群组
|
||||
*
|
||||
* @RequestMapping(path="create", methods="post")
|
||||
*
|
||||
* @return mixed
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
@ -107,8 +104,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 解散群组接口
|
||||
*
|
||||
* @RequestMapping(path="dismiss", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function dismiss()
|
||||
{
|
||||
|
@ -131,8 +129,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 邀请好友加入群组接口
|
||||
*
|
||||
* @RequestMapping(path="invite", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function invite()
|
||||
{
|
||||
|
@ -170,8 +169,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 退出群组接口
|
||||
*
|
||||
* @RequestMapping(path="secede", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function secede()
|
||||
{
|
||||
|
@ -204,8 +204,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 编辑群组信息
|
||||
*
|
||||
* @RequestMapping(path="edit", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editDetail()
|
||||
{
|
||||
|
@ -232,8 +233,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 移除指定成员(管理员权限)
|
||||
*
|
||||
* @RequestMapping(path="remove-members", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function removeMembers()
|
||||
{
|
||||
|
@ -275,8 +277,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 获取群信息接口
|
||||
*
|
||||
* @RequestMapping(path="detail", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
|
@ -319,8 +322,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 设置群名片
|
||||
*
|
||||
* @RequestMapping(path="set-group-card", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editGroupCard()
|
||||
{
|
||||
|
@ -341,8 +345,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 获取可邀请加入群组的好友列表
|
||||
*
|
||||
* @RequestMapping(path="invite-friends", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getInviteFriends()
|
||||
{
|
||||
|
@ -363,8 +368,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 获取群组列表
|
||||
*
|
||||
* @RequestMapping(path="list", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
|
@ -375,8 +381,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 获取群组成员列表
|
||||
*
|
||||
* @RequestMapping(path="members", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getGroupMembers()
|
||||
{
|
||||
|
@ -409,8 +416,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 获取群组公告列表
|
||||
*
|
||||
* @RequestMapping(path="notices", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getGroupNotice()
|
||||
{
|
||||
|
@ -448,8 +456,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 创建/编辑群公告
|
||||
*
|
||||
* @RequestMapping(path="edit-notice", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editNotice()
|
||||
{
|
||||
|
@ -506,8 +515,9 @@ class GroupController extends CController
|
|||
|
||||
/**
|
||||
* 删除群公告(软删除)
|
||||
*
|
||||
* @RequestMapping(path="delete-notice", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deleteNotice()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -35,7 +33,6 @@ use App\Constants\SocketConstants;
|
|||
|
||||
/**
|
||||
* Class TalkController
|
||||
*
|
||||
* @Controller(path="/api/v1/talk")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -63,8 +60,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 获取用户对话列表
|
||||
*
|
||||
* @RequestMapping(path="list", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function list()
|
||||
{
|
||||
|
@ -85,8 +83,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 新增对话列表
|
||||
*
|
||||
* @RequestMapping(path="create", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
@ -152,8 +151,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 删除对话列表
|
||||
*
|
||||
* @RequestMapping(path="delete", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
|
@ -169,8 +169,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 对话列表置顶
|
||||
*
|
||||
* @RequestMapping(path="topping", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function topping()
|
||||
{
|
||||
|
@ -187,8 +188,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 设置消息免打扰状态
|
||||
*
|
||||
* @RequestMapping(path="set-not-disturb", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function setNotDisturb()
|
||||
{
|
||||
|
@ -208,8 +210,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 更新对话列表未读数
|
||||
*
|
||||
* @RequestMapping(path="update-unread-num", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function updateUnreadNum()
|
||||
{
|
||||
|
@ -229,8 +232,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 撤回聊天对话消息
|
||||
*
|
||||
* @RequestMapping(path="revoke-records", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function revokeChatRecords()
|
||||
{
|
||||
|
@ -255,8 +259,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 删除聊天记录
|
||||
*
|
||||
* @RequestMapping(path="remove-records", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function removeChatRecords()
|
||||
{
|
||||
|
@ -283,8 +288,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 转发聊天记录(待优化)
|
||||
*
|
||||
* @RequestMapping(path="forward-records", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function forwardChatRecords()
|
||||
{
|
||||
|
@ -353,8 +359,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 获取对话面板中的聊天记录
|
||||
*
|
||||
* @RequestMapping(path="records", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getChatRecords()
|
||||
{
|
||||
|
@ -394,8 +401,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 获取转发记录详情
|
||||
*
|
||||
* @RequestMapping(path="get-forward-records", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getForwardRecords()
|
||||
{
|
||||
|
@ -414,8 +422,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 查询聊天记录
|
||||
*
|
||||
* @RequestMapping(path="find-chat-records", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function findChatRecords()
|
||||
{
|
||||
|
@ -463,8 +472,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 搜索聊天记录(待开发)
|
||||
*
|
||||
* @RequestMapping(path="search-chat-records", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function searchChatRecords()
|
||||
{
|
||||
|
@ -473,8 +483,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 获取聊天记录上下文数据(待开发)
|
||||
*
|
||||
* @RequestMapping(path="get-records-context", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getRecordsContext()
|
||||
{
|
||||
|
@ -483,11 +494,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 上传聊天对话图片(待优化)
|
||||
*
|
||||
* @RequestMapping(path="send-image", methods="post")
|
||||
*
|
||||
* @param UploadService $uploadService
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendImage(UploadService $uploadService)
|
||||
|
@ -558,8 +567,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 发送代码块消息
|
||||
*
|
||||
* @RequestMapping(path="send-code-block", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendCodeBlock()
|
||||
{
|
||||
|
@ -608,11 +618,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 发送文件消息
|
||||
*
|
||||
* @RequestMapping(path="send-file", methods="post")
|
||||
*
|
||||
* @param UploadService $uploadService
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendFile(UploadService $uploadService)
|
||||
|
@ -679,8 +687,9 @@ class TalkController extends CController
|
|||
|
||||
/**
|
||||
* 发送表情包消息
|
||||
*
|
||||
* @RequestMapping(path="send-emoticon", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendEmoticon()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -24,9 +22,7 @@ use Psr\Http\Message\ResponseInterface;
|
|||
|
||||
/**
|
||||
* 上传控制器
|
||||
*
|
||||
* Class UploadController
|
||||
*
|
||||
* @Controller(path="/api/v1/upload")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -36,22 +32,21 @@ class UploadController extends CController
|
|||
{
|
||||
/**
|
||||
* @inject
|
||||
*
|
||||
* @var UploadService
|
||||
*/
|
||||
private $uploadService;
|
||||
|
||||
/**
|
||||
* @inject
|
||||
*
|
||||
* @var SplitUploadService
|
||||
*/
|
||||
private $splitUploadService;
|
||||
|
||||
/**
|
||||
* 图片文件流上传接口
|
||||
*
|
||||
* @RequestMapping(path="file-stream", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function fileStream()
|
||||
{
|
||||
|
@ -66,8 +61,9 @@ class UploadController extends CController
|
|||
|
||||
/**
|
||||
* 获取拆分文件信息
|
||||
*
|
||||
* @RequestMapping(path="get-file-split-info", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getFileSplitInfo()
|
||||
{
|
||||
|
@ -84,8 +80,9 @@ class UploadController extends CController
|
|||
|
||||
/**
|
||||
* 文件拆分上传接口
|
||||
*
|
||||
* @RequestMapping(path="file-subarea-upload", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function fileSubareaUpload()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -22,12 +20,10 @@ use App\Support\SendEmailCode;
|
|||
use App\Helper\Hash;
|
||||
use App\Service\UserService;
|
||||
use App\Service\SmsCodeService;
|
||||
use App\Constants\ResponseCode;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Class UsersController
|
||||
*
|
||||
* @Controller(path="/api/v1/users")
|
||||
* @Middleware(JWTAuthMiddleware::class)
|
||||
*
|
||||
|
@ -43,8 +39,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 获取我的信息
|
||||
*
|
||||
* @RequestMapping(path="detail", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getUserDetail()
|
||||
{
|
||||
|
@ -61,8 +58,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 用户相关设置
|
||||
*
|
||||
* @RequestMapping(path="setting", methods="get")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getUserSetting()
|
||||
{
|
||||
|
@ -87,8 +85,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 编辑我的信息
|
||||
*
|
||||
* @RequestMapping(path="edit-user-detail", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editUserDetail()
|
||||
{
|
||||
|
@ -109,8 +108,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @RequestMapping(path="edit-avatar", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editAvatar()
|
||||
{
|
||||
|
@ -128,8 +128,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 通过手机号查找用户
|
||||
*
|
||||
* @RequestMapping(path="search-user", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function searchUserInfo()
|
||||
{
|
||||
|
@ -145,8 +146,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 修改我的密码
|
||||
*
|
||||
* @RequestMapping(path="change-password", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editUserPassword()
|
||||
{
|
||||
|
@ -171,11 +173,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 更换用户手机号
|
||||
*
|
||||
* @RequestMapping(path="change-mobile", methods="post")
|
||||
*
|
||||
* @param SmsCodeService $smsCodeService
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editUserMobile(SmsCodeService $smsCodeService)
|
||||
|
@ -209,8 +209,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 修改用户邮箱接口
|
||||
*
|
||||
* @RequestMapping(path="change-email", methods="post")
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function editUserEmail()
|
||||
{
|
||||
|
@ -244,11 +245,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 修改手机号发送验证码
|
||||
*
|
||||
* @RequestMapping(path="send-mobile-code", methods="post")
|
||||
*
|
||||
* @param SmsCodeService $smsCodeService
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendMobileCode(SmsCodeService $smsCodeService)
|
||||
|
@ -282,11 +281,9 @@ class UsersController extends CController
|
|||
|
||||
/**
|
||||
* 发送绑定邮箱的验证码
|
||||
*
|
||||
* @RequestMapping(path="send-change-email-code", methods="post")
|
||||
*
|
||||
* @param SendEmailCode $sendEmailCode
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendChangeEmailCode(SendEmailCode $sendEmailCode)
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -13,12 +11,18 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Model\UsersEmoticon;
|
||||
use Hyperf\HttpServer\Contract\ResponseInterface;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function index(ResponseInterface $response)
|
||||
{
|
||||
|
||||
$res = (bool)UsersEmoticon::where('user_id', 9999999)->delete();
|
||||
|
||||
var_dump($res);
|
||||
|
||||
$user = $this->request->input('user', 'Hyperf');
|
||||
$method = $this->request->getMethod();
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
|
|
@ -38,7 +38,6 @@ class AppExceptionHandler extends ExceptionHandler
|
|||
|
||||
/**
|
||||
* @param Throwable $throwable
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid(Throwable $throwable): bool
|
||||
|
|
|
@ -39,7 +39,6 @@ class JwtAuthExceptionHandler extends ExceptionHandler
|
|||
* 判断该异常处理器是否要对该异常进行处理
|
||||
*
|
||||
* @param Throwable $throwable
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid(Throwable $throwable): bool
|
||||
|
|
|
@ -10,7 +10,6 @@ use Throwable;
|
|||
|
||||
/**
|
||||
* 验证器异常处理类
|
||||
*
|
||||
* Class ValidateExceptionHandler
|
||||
*
|
||||
* @package App\Exception\Handler
|
||||
|
@ -20,7 +19,6 @@ class ValidateExceptionHandler extends ExceptionHandler
|
|||
/**
|
||||
* @param Throwable $throwable
|
||||
* @param ResponseInterface $response
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function handle(Throwable $throwable, ResponseInterface $response)
|
||||
|
@ -47,7 +45,6 @@ class ValidateExceptionHandler extends ExceptionHandler
|
|||
* 判断该异常处理器是否要对该异常进行处理
|
||||
*
|
||||
* @param Throwable $throwable
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid(Throwable $throwable): bool
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -17,8 +15,6 @@ use Hyperf\Server\Exception\ServerException;
|
|||
/**
|
||||
* 验证器异常类
|
||||
*
|
||||
* Class ValidateException
|
||||
*
|
||||
* @package App\Exception
|
||||
*/
|
||||
class ValidateException extends ServerException
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -23,7 +21,6 @@ class Hash
|
|||
* Hash the given value.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function make(string $value)
|
||||
|
@ -36,7 +33,6 @@ class Hash
|
|||
*
|
||||
* @param string $value
|
||||
* @param string $hashedValue
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function check(string $value, string $hashedValue)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -44,7 +42,6 @@ class HashIdsHelper
|
|||
* 加密
|
||||
*
|
||||
* @param mixed ...$numbers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encode(...$numbers)
|
||||
|
@ -56,7 +53,6 @@ class HashIdsHelper
|
|||
* 解密
|
||||
*
|
||||
* @param string $hash
|
||||
*
|
||||
* @return array|mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -15,7 +13,6 @@ namespace App\Helper;
|
|||
|
||||
/**
|
||||
* 字符串助手类
|
||||
*
|
||||
* Class StringHelper
|
||||
*
|
||||
* @package App\Helper
|
||||
|
@ -26,7 +23,6 @@ class StringHelper
|
|||
* 将字符串转换成二进制
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function str2Bin(string $str): string
|
||||
|
@ -47,7 +43,6 @@ class StringHelper
|
|||
* 将二进制转换成字符串
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function bin2Str(string $str): string
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
|
|
@ -9,35 +9,24 @@ use App\Model\BaseModel;
|
|||
/**
|
||||
* 笔记数据表模型
|
||||
*
|
||||
* @property integer $id 笔记ID
|
||||
* @property integer $user_id 用户ID
|
||||
* @property integer $class_id 分类ID
|
||||
* @property string $tags_id 笔记标签ID
|
||||
* @property string $title 笔记标题
|
||||
* @property string $abstract 笔记摘要
|
||||
* @property string $image 笔记头图
|
||||
* @property integer $is_asterisk 是否标记星号
|
||||
* @property integer $status 笔记状态
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
* @property string $deleted_at 删除时间
|
||||
*
|
||||
* @property integer $id 笔记ID
|
||||
* @property integer $user_id 用户ID
|
||||
* @property integer $class_id 分类ID
|
||||
* @property string $tags_id 笔记标签ID
|
||||
* @property string $title 笔记标题
|
||||
* @property string $abstract 笔记摘要
|
||||
* @property string $image 笔记头图
|
||||
* @property integer $is_asterisk 是否标记星号
|
||||
* @property integer $status 笔记状态
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
* @property string $deleted_at 删除时间
|
||||
* @package App\Model\Article
|
||||
*/
|
||||
class Article extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'article';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'class_id',
|
||||
|
@ -50,11 +39,6 @@ class Article extends BaseModel
|
|||
'updated_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
|
|
@ -19,23 +19,12 @@ use App\Model\BaseModel;
|
|||
* @property integer $status 文件状态
|
||||
* @property string $created_at 上传时间
|
||||
* @property string $deleted_at 删除时间
|
||||
*
|
||||
* @package App\Model\Article
|
||||
*/
|
||||
class ArticleAnnex extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'article_annex';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'article_id',
|
||||
|
@ -48,11 +37,6 @@ class ArticleAnnex extends BaseModel
|
|||
'deleted_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
|
|
@ -15,23 +15,12 @@ use App\Model\BaseModel;
|
|||
* @property integer $sort 排序[值越小越靠前]
|
||||
* @property integer $is_default 默认分类[1:是;0:不是]
|
||||
* @property string $created_at 创建时间
|
||||
*
|
||||
* @package App\Model\Article
|
||||
*/
|
||||
class ArticleClass extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'article_class';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'class_name',
|
||||
|
@ -40,11 +29,6 @@ class ArticleClass extends BaseModel
|
|||
'created_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
|
|
@ -13,34 +13,18 @@ use App\Model\BaseModel;
|
|||
* @property integer $article_id 笔记ID
|
||||
* @property string $md_content 笔记MD格式内容
|
||||
* @property string $content 笔记html格式内容
|
||||
*
|
||||
* @package App\Model\Article
|
||||
*/
|
||||
class ArticleDetail extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'article_detail';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'article_id',
|
||||
'md_content',
|
||||
'content',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'article_id' => 'integer'
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace App\Model\Article;
|
|||
use App\Model\BaseModel;
|
||||
|
||||
/**
|
||||
* 笔记标签数据表模型
|
||||
*
|
||||
* @property integer $id 标签ID
|
||||
* @property integer $user_id 用户ID
|
||||
* @property string $tag_name 标签名称
|
||||
|
@ -15,27 +17,15 @@ use App\Model\BaseModel;
|
|||
*/
|
||||
class ArticleTag extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'article_tags';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id', 'tag_name', 'sort', 'created_at'
|
||||
'user_id',
|
||||
'tag_name',
|
||||
'sort',
|
||||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
|
|
@ -17,23 +17,12 @@ use App\Model\BaseModel;
|
|||
* @property string $content 文本消息
|
||||
* @property int $is_revoke 是否撤回消息[0:否;1:是]
|
||||
* @property string $created_at 创建时间
|
||||
*
|
||||
* @package App\Model\Chat
|
||||
*/
|
||||
class ChatRecord extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'chat_records';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'source',
|
||||
'msg_type',
|
||||
|
@ -44,11 +33,6 @@ class ChatRecord extends BaseModel
|
|||
'created_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'source' => 'integer',
|
||||
|
|
|
@ -15,23 +15,12 @@ use App\Model\BaseModel;
|
|||
* @property string $code_lang 代码语言
|
||||
* @property string $code 代码详情
|
||||
* @property string $created_at 创建时间
|
||||
*
|
||||
* @package App\Model\Chat
|
||||
*/
|
||||
class ChatRecordsCode extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'chat_records_code';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'record_id',
|
||||
'user_id',
|
||||
|
@ -40,11 +29,6 @@ class ChatRecordsCode extends BaseModel
|
|||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'record_id' => 'integer',
|
||||
|
|
|
@ -13,30 +13,14 @@ use App\Model\BaseModel;
|
|||
* @property int $record_id 聊天记录ID
|
||||
* @property int $user_id 用户ID
|
||||
* @property string $created_at 删除时间
|
||||
*
|
||||
* @package App\Model\Chat
|
||||
*/
|
||||
class ChatRecordsDelete extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'chat_records_delete';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'record_id' => 'integer',
|
||||
|
|
|
@ -21,23 +21,12 @@ use App\Model\BaseModel;
|
|||
* @property string $save_dir 文件保存路径
|
||||
* @property int $is_delete 是否已删除
|
||||
* @property string $created_at 上传时间
|
||||
*
|
||||
* @package App\Model\Chat
|
||||
*/
|
||||
class ChatRecordsFile extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'chat_records_file';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'record_id',
|
||||
'user_id',
|
||||
|
@ -52,11 +41,6 @@ class ChatRecordsFile extends BaseModel
|
|||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'record_id' => 'integer',
|
||||
|
|
|
@ -15,32 +15,20 @@ use App\Model\BaseModel;
|
|||
* @property string $records_id 聊天记录ID,多个用英文','拼接
|
||||
* @property string $text 缓存信息
|
||||
* @property int $created_at 转发时间
|
||||
*
|
||||
* @package App\Model\Chat
|
||||
*/
|
||||
class ChatRecordsForward extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'chat_records_forward';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'record_id', 'user_id', 'records_id', 'text', 'created_at'
|
||||
'record_id',
|
||||
'user_id',
|
||||
'records_id',
|
||||
'text',
|
||||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'record_id' => 'integer',
|
||||
|
|
|
@ -14,23 +14,12 @@ use App\Model\BaseModel;
|
|||
* @property int $type 通知类型[1:入群通知;2:自动退群;3:管理员踢群]
|
||||
* @property int $operate_user_id 操作人的用户ID[邀请人OR管理员ID]
|
||||
* @property string $user_ids 用户ID(多个用 , 分割)
|
||||
*
|
||||
* @package App\Model\Chat
|
||||
*/
|
||||
class ChatRecordsInvite extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'chat_records_invite';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'record_id',
|
||||
'type',
|
||||
|
@ -38,11 +27,6 @@ class ChatRecordsInvite extends BaseModel
|
|||
'user_ids',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'record_id' => 'integer',
|
||||
|
|
|
@ -11,30 +11,14 @@ namespace App\Model;
|
|||
* @property string $name 分组名称
|
||||
* @property string $url 默认表情
|
||||
* @property string $created_at 创建时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class Emoticon extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'emoticon';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'created_at' => 'datetime'
|
||||
|
|
|
@ -15,23 +15,12 @@ namespace App\Model;
|
|||
* @property string $file_suffix 文件前缀
|
||||
* @property int $file_size 表情包文件大小
|
||||
* @property string $created_at 创建时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class EmoticonDetail extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'emoticon_details';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'emoticon_id',
|
||||
'user_id',
|
||||
|
@ -42,11 +31,6 @@ class EmoticonDetail extends BaseModel
|
|||
'created_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'emoticon_id' => 'integer',
|
||||
|
|
|
@ -19,23 +19,12 @@ namespace App\Model;
|
|||
* @property int $file_size 临时文件大小
|
||||
* @property int $is_delete 文件是否已被删除[1:是;0:否;]
|
||||
* @property int $upload_at 文件上传时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class FileSplitUpload extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'file_split_upload';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'file_type',
|
||||
'user_id',
|
||||
|
@ -50,11 +39,6 @@ class FileSplitUpload extends BaseModel
|
|||
'upload_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'file_type' => 'integer',
|
||||
|
|
|
@ -19,26 +19,17 @@ use App\Model\BaseModel;
|
|||
* @property integer $is_dismiss 是否已解散[0:否;1:是;]
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $dismissed_at 解散时间
|
||||
*
|
||||
* @package App\Model\Group
|
||||
*/
|
||||
class Group extends BaseModel
|
||||
{
|
||||
// 最大成员数量
|
||||
/**
|
||||
* 最大成员数量
|
||||
*/
|
||||
const MAX_MEMBER_NUM = 200;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'group';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'creator_id',
|
||||
'group_name',
|
||||
|
@ -52,11 +43,6 @@ class Group extends BaseModel
|
|||
'dismissed_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'creator_id' => 'integer',
|
||||
'max_num' => 'integer',
|
||||
|
@ -80,7 +66,6 @@ class Group extends BaseModel
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $group_id 群ID
|
||||
* @param int|array $leader 管理员类型[0:普通成员;1:管理员;2:群主;]
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isManager(int $user_id, int $group_id, $leader = 2)
|
||||
|
@ -92,7 +77,6 @@ class Group extends BaseModel
|
|||
* 判断群组是否已解散
|
||||
*
|
||||
* @param int $group_id 群ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDismiss(int $group_id)
|
||||
|
@ -105,7 +89,6 @@ class Group extends BaseModel
|
|||
*
|
||||
* @param int $group_id 群ID
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isMember(int $group_id, int $user_id)
|
||||
|
|
|
@ -17,23 +17,12 @@ use App\Model\BaseModel;
|
|||
* @property string $user_card 群名片
|
||||
* @property string $created_at 入群时间
|
||||
* @property string $deleted_at 退群时间
|
||||
*
|
||||
* @package App\Model\Group
|
||||
*/
|
||||
class GroupMember extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'group_member';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'group_id',
|
||||
'user_id',
|
||||
|
@ -45,11 +34,6 @@ class GroupMember extends BaseModel
|
|||
'deleted_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'group_id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
@ -64,7 +48,6 @@ class GroupMember extends BaseModel
|
|||
* 获取聊天群成员ID
|
||||
*
|
||||
* @param int $group_id 群聊ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getGroupMemberIds(int $group_id)
|
||||
|
@ -77,7 +60,6 @@ class GroupMember extends BaseModel
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $group_id 群ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function visitCard(int $user_id, int $group_id)
|
||||
|
@ -89,7 +71,6 @@ class GroupMember extends BaseModel
|
|||
* 获取用户的所有群ID
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getUserGroupIds(int $user_id)
|
||||
|
|
|
@ -20,23 +20,12 @@ use App\Model\BaseModel;
|
|||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
* @property string $deleted_at 删除时间
|
||||
*
|
||||
* @package App\Model\Group
|
||||
*/
|
||||
class GroupNotice extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'group_notice';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'group_id',
|
||||
'creator_id',
|
||||
|
@ -51,11 +40,6 @@ class GroupNotice extends BaseModel
|
|||
'deleted_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'group_id' => 'integer',
|
||||
'creator_id' => 'integer',
|
||||
|
|
|
@ -14,31 +14,22 @@ namespace App\Model;
|
|||
* @property string $avatar 头像
|
||||
* @property integer $gender 性别
|
||||
* @property integer $created_at 注册时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class User extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'mobile', 'nickname', 'avatar', 'gender', 'password', 'motto', 'email', 'created_at'
|
||||
'mobile',
|
||||
'nickname',
|
||||
'avatar',
|
||||
'gender',
|
||||
'password',
|
||||
'motto',
|
||||
'email',
|
||||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [];
|
||||
}
|
||||
|
|
|
@ -17,23 +17,12 @@ namespace App\Model;
|
|||
* @property int $not_disturb 是否消息免打扰
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class UsersChatList extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users_chat_list';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'uid',
|
||||
|
@ -46,11 +35,6 @@ class UsersChatList extends BaseModel
|
|||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'type' => 'integer',
|
||||
|
@ -70,7 +54,6 @@ class UsersChatList extends BaseModel
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $receive_id 接收者ID
|
||||
* @param int $type 创建类型 1:私聊 2:群聊
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function addItem(int $user_id, int $receive_id, int $type)
|
||||
|
@ -115,7 +98,6 @@ class UsersChatList extends BaseModel
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $list_id 对话列表ID
|
||||
* @param bool $is_top 是否置顶(true:是 false:否)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function topItem(int $user_id, int $list_id, $is_top = true)
|
||||
|
@ -132,7 +114,6 @@ class UsersChatList extends BaseModel
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $id 聊天列表ID、好友ID或群聊ID
|
||||
* @param int $type ID类型 (1:聊天列表ID 2:好友ID 3:群聊ID)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function delItem(int $user_id, int $id, $type = 1)
|
||||
|
@ -154,7 +135,6 @@ class UsersChatList extends BaseModel
|
|||
* @param int $receive_id 接收者ID
|
||||
* @param int $type 接收者类型(1:好友 2:群组)
|
||||
* @param int $not_disturb 是否免打扰
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function notDisturbItem(int $user_id, int $receive_id, int $type, int $not_disturb)
|
||||
|
|
|
@ -10,42 +10,24 @@ namespace App\Model;
|
|||
* @property int $id 收藏ID
|
||||
* @property int $user_id 用户ID
|
||||
* @property string $emoticon_ids 表情包ID,多个用英文逗号拼接
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class UsersEmoticon extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users_emoticon';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'emoticon_ids'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer'
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmoticonIdsAttribute($value)
|
||||
|
|
|
@ -18,23 +18,12 @@ use Hyperf\DbConnection\Db;
|
|||
* @property int $status 好友状态[1:好友状态;0:已解除好友关系]
|
||||
* @property string $agree_time 成为好友时间
|
||||
* @property string $created_at 创建时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class UsersFriend extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users_friends';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user1',
|
||||
'user2',
|
||||
|
@ -46,11 +35,6 @@ class UsersFriend extends BaseModel
|
|||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user1' => 'integer',
|
||||
|
@ -64,7 +48,6 @@ class UsersFriend extends BaseModel
|
|||
* 获取用户所有好友
|
||||
*
|
||||
* @param int $uid 用户ID
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getUserFriends(int $uid)
|
||||
|
@ -95,7 +78,6 @@ SQL;
|
|||
* @param int $user_id1 用户1
|
||||
* @param int $user_id2 用户2
|
||||
* @param bool $cache 是否读取缓存
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFriend(int $user_id1, int $user_id2, bool $cache = false)
|
||||
|
@ -122,7 +104,6 @@ SQL;
|
|||
* 获取指定用户的所有朋友的用户ID
|
||||
*
|
||||
* @param int $user_id 指定用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getFriendIds(int $user_id)
|
||||
|
|
|
@ -14,23 +14,12 @@ namespace App\Model;
|
|||
* @property string $remarks 备注说明
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
*
|
||||
* @package App\Model
|
||||
*/
|
||||
class UsersFriendsApply extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users_friends_apply';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'friend_id',
|
||||
|
@ -40,11 +29,6 @@ class UsersFriendsApply extends BaseModel
|
|||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace App\Process;
|
||||
|
||||
use Hyperf\AsyncQueue\Process\ConsumerProcess;
|
||||
|
|
|
@ -24,7 +24,6 @@ class ArticleService extends BaseService
|
|||
* 获取用户文章分类列表
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUserClass(int $user_id)
|
||||
|
@ -43,15 +42,14 @@ class ArticleService extends BaseService
|
|||
* 获取用户文章标签列表
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function getUserTags(int $user_id)
|
||||
{
|
||||
$items = ArticleTag::where('user_id', $user_id)->orderBy('id', 'desc')->get(['id', 'tag_name', Db::raw('0 as count')])->toArray();
|
||||
array_walk($items, function ($item) use ($user_id) {
|
||||
$item['count'] = (int)Article::where('user_id', $user_id)->whereRaw("FIND_IN_SET({$item['id']},tags_id)")->count();
|
||||
});
|
||||
foreach ($items as $k => $item) {
|
||||
$items[$k]['count'] = (int)Article::where('user_id', $user_id)->whereRaw("FIND_IN_SET({$item['id']},tags_id)")->count();
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
@ -63,7 +61,6 @@ class ArticleService extends BaseService
|
|||
* @param int $page 分页
|
||||
* @param int $page_size 分页大小
|
||||
* @param array $params 查询参数
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUserArticleList(int $user_id, int $page, int $page_size, $params = [])
|
||||
|
@ -117,7 +114,6 @@ class ArticleService extends BaseService
|
|||
*
|
||||
* @param int $article_id 文章ID
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getArticleDetail(int $article_id, $user_id = 0)
|
||||
|
@ -158,7 +154,6 @@ class ArticleService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $article_id 笔记ID
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findArticleAnnexAll(int $user_id, int $article_id)
|
||||
|
@ -176,7 +171,6 @@ class ArticleService extends BaseService
|
|||
* @param int $uid 用户ID
|
||||
* @param int|string $class_id 分类ID
|
||||
* @param string $class_name 分类名
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function editArticleClass(int $uid, $class_id, string $class_name)
|
||||
|
@ -203,18 +197,14 @@ class ArticleService extends BaseService
|
|||
ArticleClass::where('id', $val['id'])->update(['sort' => $val['sort']]);
|
||||
}
|
||||
|
||||
$insRes = ArticleClass::create(['user_id' => $uid, 'class_name' => $class_name, 'sort' => 1, 'created_at' => time()]);
|
||||
if (!$insRes) {
|
||||
throw new Exception('笔记分类添加失败..,.');
|
||||
}
|
||||
$res = ArticleClass::create(['user_id' => $uid, 'class_name' => $class_name, 'sort' => 1, 'created_at' => time()]);
|
||||
|
||||
Db::commit();
|
||||
return $res->id;
|
||||
} catch (Exception $e) {
|
||||
Db::rollBack();
|
||||
return false;
|
||||
}
|
||||
|
||||
return $insRes->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,7 +212,6 @@ class ArticleService extends BaseService
|
|||
*
|
||||
* @param int $uid 用户ID
|
||||
* @param int $class_id 分类ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delArticleClass(int $uid, int $class_id)
|
||||
|
@ -245,7 +234,6 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $class_id 文集分类ID
|
||||
* @param int $sort_type 排序方式
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function articleClassSort(int $user_id, int $class_id, int $sort_type)
|
||||
|
@ -254,7 +242,7 @@ class ArticleService extends BaseService
|
|||
return false;
|
||||
}
|
||||
|
||||
//向下排序
|
||||
// 向下排序
|
||||
if ($sort_type == 1) {
|
||||
$maxSort = ArticleClass::where('user_id', $user_id)->max('sort');
|
||||
if ($maxSort == $info->sort) {
|
||||
|
@ -310,7 +298,6 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $class_id 笔记分类ID
|
||||
* @param int $to_class_id 笔记分类ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function mergeArticleClass(int $user_id, int $class_id, int $to_class_id)
|
||||
|
@ -320,7 +307,7 @@ class ArticleService extends BaseService
|
|||
return false;
|
||||
}
|
||||
|
||||
return (boolean)Article::where('class_id', $class_id)->where('user_id', $user_id)->update([
|
||||
return (bool)Article::where('class_id', $class_id)->where('user_id', $user_id)->update([
|
||||
'class_id' => $to_class_id
|
||||
]);
|
||||
}
|
||||
|
@ -331,7 +318,6 @@ class ArticleService extends BaseService
|
|||
* @param int $uid 用户ID
|
||||
* @param int $tag_id 标签ID
|
||||
* @param string $tag_name 标签名
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function editArticleTag(int $uid, int $tag_id, string $tag_name)
|
||||
|
@ -344,10 +330,8 @@ class ArticleService extends BaseService
|
|||
|
||||
return ArticleTag::where('id', $tag_id)->where('user_id', $uid)->update(['tag_name' => $tag_name]) ? $tag_id : false;
|
||||
} else {
|
||||
//判断新添加的标签名是否存在
|
||||
if ($id) {
|
||||
return false;
|
||||
}
|
||||
// 判断新添加的标签名是否存在
|
||||
if ($id) return false;
|
||||
|
||||
$insRes = ArticleTag::create(['user_id' => $uid, 'tag_name' => $tag_name, 'sort' => 1, 'created_at' => time()]);
|
||||
if (!$insRes) {
|
||||
|
@ -363,7 +347,6 @@ class ArticleService extends BaseService
|
|||
*
|
||||
* @param int $uid 用户ID
|
||||
* @param int $tag_id 标签ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delArticleTags(int $uid, int $tag_id)
|
||||
|
@ -373,11 +356,13 @@ class ArticleService extends BaseService
|
|||
}
|
||||
|
||||
$count = Article::where('user_id', $uid)->whereRaw("FIND_IN_SET({$tag_id},tags_id)")->count();
|
||||
if ($count > 0) {
|
||||
if ($count > 0) return false;
|
||||
|
||||
try {
|
||||
return (bool)ArticleTag::where('id', $tag_id)->where('user_id', $uid)->delete();
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool)ArticleTag::where('id', $tag_id)->where('user_id', $uid)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,13 +371,12 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $article_id 文章ID
|
||||
* @param array $data 文章数据
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function editArticle(int $user_id, int $article_id, $data = [])
|
||||
{
|
||||
if ($article_id) {
|
||||
if (!$info = Article::where('id', $article_id)->where('user_id', $user_id)->first()) {
|
||||
if (!Article::where('id', $article_id)->where('user_id', $user_id)->first()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -452,7 +436,6 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $article_id 笔记ID
|
||||
* @param int $status 笔记状态 1:正常 2:已删除
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function updateArticleStatus(int $user_id, int $article_id, int $status)
|
||||
|
@ -471,12 +454,11 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $article_id 笔记ID
|
||||
* @param int $class_id 笔记分类ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveArticle(int $user_id, int $article_id, int $class_id)
|
||||
{
|
||||
return (boolean)Article::where('id', $article_id)->where('user_id', $user_id)->update(['class_id' => $class_id]);
|
||||
return (bool)Article::where('id', $article_id)->where('user_id', $user_id)->update(['class_id' => $class_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -485,12 +467,11 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $article_id 笔记ID
|
||||
* @param int $type 1:标记星号 2:取消星号标记
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setAsteriskArticle(int $user_id, int $article_id, int $type)
|
||||
{
|
||||
return (boolean)Article::where('id', $article_id)->where('user_id', $user_id)->update([
|
||||
return (bool)Article::where('id', $article_id)->where('user_id', $user_id)->update([
|
||||
'is_asterisk' => $type == 1 ? 1 : 0
|
||||
]);
|
||||
}
|
||||
|
@ -501,7 +482,6 @@ class ArticleService extends BaseService
|
|||
* @param int $uid 用户ID
|
||||
* @param int $article_id 笔记ID
|
||||
* @param array $tags 关联标签ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function updateArticleTag(int $uid, int $article_id, array $tags)
|
||||
|
@ -514,7 +494,6 @@ class ArticleService extends BaseService
|
|||
*
|
||||
* @param int $uid 用户ID
|
||||
* @param int $article_id 笔记ID
|
||||
*
|
||||
* @return bool|int|mixed|null
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -551,9 +530,9 @@ class ArticleService extends BaseService
|
|||
}
|
||||
|
||||
// 从磁盘中永久删除文件附件
|
||||
foreach ($annex_files as $item) {
|
||||
//Storage::disk('uploads')->delete($item['save_dir']);
|
||||
}
|
||||
//foreach ($annex_files as $item) {
|
||||
//Storage::disk('uploads')->delete($item['save_dir']);
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -564,7 +543,6 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $annex_id 附件ID
|
||||
* @param int $status 附件状态 1:正常 2:已删除
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function updateArticleAnnexStatus(int $user_id, int $annex_id, int $status)
|
||||
|
@ -574,14 +552,13 @@ class ArticleService extends BaseService
|
|||
$data['deleted_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
return ArticleAnnex::where('id', $annex_id)->where('user_id', $user_id)->update($data) ? true : false;
|
||||
return (bool)ArticleAnnex::where('id', $annex_id)->where('user_id', $user_id)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收站附件列表
|
||||
*
|
||||
* @param int $uid 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function recoverAnnexList(int $uid)
|
||||
|
@ -603,15 +580,7 @@ class ArticleService extends BaseService
|
|||
*
|
||||
* @param int $uid 用户ID
|
||||
* @param int $annex_id 笔记附件ID
|
||||
*
|
||||
* @return bool|int|mixed|null
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param int $uid
|
||||
* @param int $annex_id
|
||||
*
|
||||
* @return bool|int|mixed|null
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function foreverDelAnnex(int $uid, int $annex_id)
|
||||
|
@ -622,9 +591,9 @@ class ArticleService extends BaseService
|
|||
}
|
||||
|
||||
// 将文件从磁盘中删除
|
||||
// if (!Storage::disk('uploads')->delete($info->save_dir)) {
|
||||
// return false;
|
||||
// }
|
||||
//if (!Storage::disk('uploads')->delete($info->save_dir)) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
return $info->delete();
|
||||
}
|
||||
|
@ -635,7 +604,6 @@ class ArticleService extends BaseService
|
|||
* @param int $user_id 用户id
|
||||
* @param int $article_id 笔记ID
|
||||
* @param array $annex 笔记附件信息
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function insertArticleAnnex(int $user_id, int $article_id, array $annex)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
|
@ -33,7 +31,6 @@ class ContactsService extends BaseService
|
|||
* 获取联系人列表
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getContacts(int $user_id): array
|
||||
|
@ -64,7 +61,6 @@ SQL;
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $friend_id 好友ID
|
||||
* @param string $remarks 申请备注
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addContact(int $user_id, int $friend_id, string $remarks): bool
|
||||
|
@ -92,7 +88,7 @@ SQL;
|
|||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
return $result ? true : false;
|
||||
return (bool)$result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +97,6 @@ SQL;
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $friend_id 好友ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteContact(int $user_id, int $friend_id): bool
|
||||
|
@ -126,7 +121,6 @@ SQL;
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $apply_id 联系人申请ID
|
||||
* @param string $remarks 联系人备注名称
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function acceptInvitation(int $user_id, int $apply_id, string $remarks = ''): bool
|
||||
|
@ -189,12 +183,11 @@ SQL;
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $apply_id 联系人申请ID
|
||||
* @param string $remarks 拒绝申请备注信息
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function declineInvitation(int $user_id, int $apply_id, string $remarks = ''): bool
|
||||
{
|
||||
$result = UsersFriendsApply::where([
|
||||
return (bool)UsersFriendsApply::where([
|
||||
['id', '=', $apply_id],
|
||||
['user_id', '=', $user_id],
|
||||
['status', '=', 2],
|
||||
|
@ -203,8 +196,6 @@ SQL;
|
|||
'remarks' => $remarks,
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
return $result ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,7 +204,6 @@ SQL;
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $friend_id 朋友ID
|
||||
* @param string $remarks 好友备注名称
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function editContactRemark(int $user_id, int $friend_id, string $remarks): bool
|
||||
|
@ -233,7 +223,6 @@ SQL;
|
|||
* 搜索联系人
|
||||
*
|
||||
* @param string $mobile 用户手机号/登录账号
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findContact(string $mobile): array
|
||||
|
@ -249,7 +238,6 @@ SQL;
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $page 当前分页
|
||||
* @param int $page_size 分页大小
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getContactApplyRecords(int $user_id, $page = 1, $page_size = 30): array
|
||||
|
@ -283,8 +271,8 @@ SQL;
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $apply_id 联系人好友申请ID
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delContactApplyRecord(int $user_id, int $apply_id): bool
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ use App\Model\UsersEmoticon;
|
|||
|
||||
/**
|
||||
* 表情服务层
|
||||
*
|
||||
* Class EmoticonService
|
||||
*
|
||||
* @package App\Services
|
||||
|
@ -22,14 +21,13 @@ class EmoticonService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $emoticon_id 表情包ID
|
||||
*
|
||||
* @return mixed
|
||||
* @return bool
|
||||
*/
|
||||
public function installSysEmoticon(int $user_id, int $emoticon_id)
|
||||
{
|
||||
$info = UsersEmoticon::select(['id', 'user_id', 'emoticon_ids'])->where('user_id', $user_id)->first();
|
||||
if (!$info) {
|
||||
return UsersEmoticon::create(['user_id' => $user_id, 'emoticon_ids' => $emoticon_id]) ? true : false;
|
||||
return (bool)UsersEmoticon::create(['user_id' => $user_id, 'emoticon_ids' => $emoticon_id]);
|
||||
}
|
||||
|
||||
$emoticon_ids = $info->emoticon_ids;
|
||||
|
@ -38,9 +36,10 @@ class EmoticonService extends BaseService
|
|||
}
|
||||
|
||||
$emoticon_ids[] = $emoticon_id;
|
||||
return UsersEmoticon::where('user_id', $user_id)->update([
|
||||
|
||||
return (bool)UsersEmoticon::where('user_id', $user_id)->update([
|
||||
'emoticon_ids' => implode(',', $emoticon_ids)
|
||||
]) ? true : false;
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +47,6 @@ class EmoticonService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $emoticon_id 表情包ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeSysEmoticon(int $user_id, int $emoticon_id)
|
||||
|
@ -60,25 +58,22 @@ class EmoticonService extends BaseService
|
|||
|
||||
$emoticon_ids = $info->emoticon_ids;
|
||||
foreach ($emoticon_ids as $k => $id) {
|
||||
if ($id == $emoticon_id) {
|
||||
unset($emoticon_ids[$k]);
|
||||
}
|
||||
if ($id == $emoticon_id) unset($emoticon_ids[$k]);
|
||||
}
|
||||
|
||||
if (count($info->emoticon_ids) == count($emoticon_ids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return UsersEmoticon::where('user_id', $user_id)->update([
|
||||
return (bool)UsersEmoticon::where('user_id', $user_id)->update([
|
||||
'emoticon_ids' => implode(',', $emoticon_ids)
|
||||
]) ? true : false;
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户安装的表情ID
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInstallIds(int $user_id)
|
||||
|
@ -92,7 +87,6 @@ class EmoticonService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $record_id 聊天消息ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function collect(int $user_id, int $record_id)
|
||||
|
@ -148,8 +142,8 @@ class EmoticonService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param array $ids 表情包详情ID
|
||||
*
|
||||
* @return
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteCollect(int $user_id, array $ids)
|
||||
{
|
||||
|
@ -160,17 +154,15 @@ class EmoticonService extends BaseService
|
|||
* 获取表情包列表
|
||||
*
|
||||
* @param array $where
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function getDetailsAll(array $where = [])
|
||||
{
|
||||
$list = EmoticonDetail::where($where)->get(['id as media_id', 'url as src'])->toArray();
|
||||
|
||||
foreach ($list as $k => $value) {
|
||||
$list[$k]['src'] = get_media_url($value['src']);
|
||||
$items = EmoticonDetail::where($where)->get(['id as media_id', 'url as src'])->toArray();
|
||||
foreach ($items as $k => $item) {
|
||||
$items[$k]['src'] = get_media_url($item['src']);
|
||||
}
|
||||
|
||||
return $list;
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ class GroupService extends BaseService
|
|||
* 获取用户所在的群聊
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGroups(int $user_id): array
|
||||
|
@ -60,7 +59,6 @@ class GroupService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param array $group_info 群聊名称
|
||||
* @param array $friend_ids 好友的用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create(int $user_id, array $group_info, $friend_ids = [])
|
||||
|
@ -146,7 +144,6 @@ class GroupService extends BaseService
|
|||
*
|
||||
* @param int $group_id 群ID
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function dismiss(int $group_id, int $user_id)
|
||||
|
@ -177,7 +174,6 @@ class GroupService extends BaseService
|
|||
* @param int $user_id 用户ID
|
||||
* @param int $group_id 聊天群ID
|
||||
* @param array $friend_ids 被邀请的用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invite(int $user_id, int $group_id, $friend_ids = [])
|
||||
|
@ -282,7 +278,6 @@ class GroupService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $group_id 群组ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function quit(int $user_id, int $group_id)
|
||||
|
@ -337,7 +332,6 @@ class GroupService extends BaseService
|
|||
* @param int $group_id 群ID
|
||||
* @param int $user_id 操作用户ID
|
||||
* @param array $member_ids 群成员ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function removeMember(int $group_id, int $user_id, array $member_ids)
|
||||
|
|
|
@ -25,7 +25,6 @@ class MailerService
|
|||
* @param string $email 邮箱
|
||||
* @param string $subject 标题
|
||||
* @param string $template 对应邮件模板
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function send($email, $subject, $template)
|
||||
|
@ -43,7 +42,6 @@ class MailerService
|
|||
* @param string $email 邮箱
|
||||
* @param string $subject 标题
|
||||
* @param string $template 对应邮件模板
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function realSend($email, $subject, $template)
|
||||
|
@ -61,7 +59,6 @@ class MailerService
|
|||
* @param string $address 收件人
|
||||
* @param string $subject 邮件标题
|
||||
* @param string $view 邮件内容
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -70,10 +67,10 @@ class MailerService
|
|||
$config = config('mail');
|
||||
$mail = new PHPMailer();
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail->IsSMTP(); // 设定使用SMTP服务
|
||||
$mail->SMTPDebug = 0; // 关闭SMTP调试功能
|
||||
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
|
||||
$mail->SMTPSecure = 'ssl'; // 使用安全协议
|
||||
$mail->IsSMTP(); // 设定使用SMTP服务
|
||||
$mail->SMTPDebug = 0; // 关闭SMTP调试功能
|
||||
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
|
||||
$mail->SMTPSecure = 'ssl'; // 使用安全协议
|
||||
$mail->Host = $config['host'];
|
||||
$mail->Port = $config['port'];
|
||||
$mail->Username = $config['username'];
|
||||
|
|
|
@ -40,8 +40,7 @@ class MessageHandleService
|
|||
* @param Response|Server $server
|
||||
* @param Frame $frame
|
||||
* @param array|string $data 解析后数据
|
||||
*
|
||||
* @return bool|void
|
||||
* @return void
|
||||
*/
|
||||
public function onTalk($server, Frame $frame, $data)
|
||||
{
|
||||
|
@ -109,8 +108,6 @@ class MessageHandleService
|
|||
* @param Response|Server $server
|
||||
* @param Frame $frame
|
||||
* @param array|string $data 解析后数据
|
||||
*
|
||||
* @return bool|void
|
||||
*/
|
||||
public function onKeyboard($server, Frame $frame, $data)
|
||||
{
|
||||
|
|
|
@ -5,8 +5,6 @@ namespace App\Service;
|
|||
/**
|
||||
* 短信发送服务
|
||||
*
|
||||
* Class SmsCodeService
|
||||
*
|
||||
* @package App\Services
|
||||
*/
|
||||
class SmsCodeService
|
||||
|
@ -35,7 +33,6 @@ class SmsCodeService
|
|||
*
|
||||
* @param string $type 短信用途
|
||||
* @param string $mobile 手机号
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getKey(string $type, string $mobile)
|
||||
|
@ -49,7 +46,6 @@ class SmsCodeService
|
|||
* @param string $type 发送类型
|
||||
* @param string $mobile 手机号
|
||||
* @param string $code 验证码
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check(string $type, string $mobile, string $code)
|
||||
|
@ -64,7 +60,6 @@ class SmsCodeService
|
|||
*
|
||||
* @param string $usage 验证码用途
|
||||
* @param string $mobile 手机号
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function send(string $usage, string $mobile)
|
||||
|
@ -103,7 +98,6 @@ class SmsCodeService
|
|||
* 获取缓存的验证码
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCode(string $key)
|
||||
|
@ -117,7 +111,6 @@ class SmsCodeService
|
|||
* @param string $key 缓存key
|
||||
* @param string $sms_code 验证码
|
||||
* @param float|int $exp 过期时间(默认15分钟)
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function setCode(string $key, string $sms_code, $exp = 60 * 15)
|
||||
|
@ -130,7 +123,6 @@ class SmsCodeService
|
|||
*
|
||||
* @param string $usage 验证码用途
|
||||
* @param string $mobile 手机号
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delCode(string $usage, string $mobile)
|
||||
|
@ -143,18 +135,17 @@ class SmsCodeService
|
|||
*
|
||||
* @param string $usage 验证码用途
|
||||
* @param string $mobile 手机号
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filter(string $usage, string $mobile)
|
||||
{
|
||||
// ... 省略处理
|
||||
if (false) {
|
||||
return [false, [
|
||||
'msg' => '过滤原因...',
|
||||
'data' => []
|
||||
]];
|
||||
}
|
||||
//if (false) {
|
||||
// return [false, [
|
||||
// 'msg' => '过滤原因...',
|
||||
// 'data' => []
|
||||
// ]];
|
||||
//}
|
||||
|
||||
return [true, [
|
||||
'msg' => 'ok',
|
||||
|
@ -166,7 +157,6 @@ class SmsCodeService
|
|||
* 判断验证码用途渠道是否注册
|
||||
*
|
||||
* @param string $usage
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isUsages(string $usage)
|
||||
|
|
|
@ -42,8 +42,6 @@ class SocketClientService
|
|||
* @param int $fd 客户端fd
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $run_id 服务运行ID(默认当前服务ID)
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function bindRelation(int $fd, int $user_id, $run_id = SERVER_RUN_ID)
|
||||
{
|
||||
|
@ -72,12 +70,11 @@ class SocketClientService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $run_id 服务运行ID(默认当前服务ID)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOnline(int $user_id, $run_id = SERVER_RUN_ID): bool
|
||||
{
|
||||
return $this->redis->scard(sprintf('%s:%s:%s', self::BIND_USER_TO_FDS, $run_id, $user_id)) ? true : false;
|
||||
return (bool)$this->redis->scard(sprintf('%s:%s:%s', self::BIND_USER_TO_FDS, $run_id, $user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,7 +82,6 @@ class SocketClientService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param array $run_ids 服务运行ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOnlineAll(int $user_id, array $run_ids = [])
|
||||
|
@ -104,7 +100,6 @@ class SocketClientService
|
|||
*
|
||||
* @param int $fd 客户端ID
|
||||
* @param string $run_id 服务运行ID(默认当前服务ID)
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function findFdUserId(int $fd, $run_id = SERVER_RUN_ID)
|
||||
|
@ -117,7 +112,6 @@ class SocketClientService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $run_id 服务运行ID(默认当前服务ID)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findUserFds(int $user_id, $run_id = SERVER_RUN_ID)
|
||||
|
@ -132,7 +126,6 @@ class SocketClientService
|
|||
* 获取服务ID列表
|
||||
*
|
||||
* @param int $type 获取类型[1:正在运行;2:已超时;3:所有]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getServerRunIdAll(int $type = 1)
|
||||
|
|
|
@ -5,8 +5,6 @@ namespace App\Service;
|
|||
/**
|
||||
* 聊天室房间服务
|
||||
*
|
||||
* Class SocketRoomService
|
||||
*
|
||||
* @package App\Service
|
||||
*/
|
||||
class SocketRoomService
|
||||
|
@ -17,7 +15,6 @@ class SocketRoomService
|
|||
* 获取房间名
|
||||
*
|
||||
* @param string|integer $room 房间名
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRoomName($room)
|
||||
|
@ -29,7 +26,6 @@ class SocketRoomService
|
|||
* 获取房间成员
|
||||
*
|
||||
* @param string $room 房间名
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRoomMembers(string $room)
|
||||
|
@ -42,7 +38,6 @@ class SocketRoomService
|
|||
*
|
||||
* @param int $usr_id 用户ID
|
||||
* @param string|array $room 房间名
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function addRoomMember(int $usr_id, $room)
|
||||
|
@ -55,7 +50,6 @@ class SocketRoomService
|
|||
*
|
||||
* @param string|array $room 房间名
|
||||
* @param string|array $members 用户ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function delRoomMember($room, $members)
|
||||
|
@ -67,7 +61,6 @@ class SocketRoomService
|
|||
* 删除房间
|
||||
*
|
||||
* @param string|int $room 房间名
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function delRoom($room)
|
||||
|
|
|
@ -9,8 +9,6 @@ use Hyperf\HttpMessage\Upload\UploadedFile;
|
|||
/**
|
||||
* 文件拆分上传服务
|
||||
*
|
||||
* Class SplitUploadService
|
||||
*
|
||||
* @package App\Service
|
||||
*/
|
||||
class SplitUploadService
|
||||
|
@ -26,7 +24,6 @@ class SplitUploadService
|
|||
* @param int $user_id 用户ID
|
||||
* @param string $fileName 上传的文件名
|
||||
* @param string $fileSize 上传文件大小
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function create(int $user_id, string $fileName, string $fileSize)
|
||||
|
@ -43,7 +40,7 @@ class SplitUploadService
|
|||
$data['file_size'] = $fileSize;
|
||||
$data['upload_at'] = time();
|
||||
|
||||
//文件拆分数量
|
||||
// 文件拆分数量
|
||||
$data['split_num'] = $split_num;
|
||||
$data['split_index'] = $split_num;
|
||||
|
||||
|
@ -58,7 +55,6 @@ class SplitUploadService
|
|||
* @param string $hashName 上传临时问价hash名
|
||||
* @param int $split_index 当前拆分文件索引
|
||||
* @param int $fileSize 文件大小
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function upload(int $user_id, UploadedFile $file, string $hashName, int $split_index, int $fileSize)
|
||||
|
@ -106,7 +102,6 @@ class SplitUploadService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $hash_name 上传临时问价hash名
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function merge(int $user_id, string $hash_name)
|
||||
|
|
|
@ -26,7 +26,6 @@ class TalkService extends BaseService
|
|||
* 获取用户的聊天列表
|
||||
*
|
||||
* @param int $user_id 用户ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function talks(int $user_id)
|
||||
|
@ -51,7 +50,7 @@ class TalkService extends BaseService
|
|||
$socketFDService = make(SocketClientService::class);
|
||||
$runIdAll = $socketFDService->getServerRunIdAll();
|
||||
|
||||
$rows = array_map(function ($item) use ($user_id, $socketFDService, $runIdAll) {
|
||||
return array_map(function ($item) use ($user_id, $socketFDService, $runIdAll) {
|
||||
$data['id'] = $item['id'];
|
||||
$data['type'] = $item['type'];
|
||||
$data['friend_id'] = $item['friend_id'];
|
||||
|
@ -98,8 +97,6 @@ class TalkService extends BaseService
|
|||
|
||||
return $data;
|
||||
}, $rows);
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +124,6 @@ class TalkService extends BaseService
|
|||
* 处理聊天记录信息
|
||||
*
|
||||
* @param array $rows 聊天记录
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function handleChatRecords(array $rows)
|
||||
|
@ -234,7 +230,6 @@ class TalkService extends BaseService
|
|||
* @param int $record_id 上一次查询的聊天记录ID
|
||||
* @param int $limit 查询数据长度
|
||||
* @param array $msg_type 消息类型
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getChatRecords(int $user_id, int $receive_id, int $source, int $record_id, $limit = 30, $msg_type = [])
|
||||
|
@ -295,7 +290,6 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $record_id 聊天记录ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getForwardRecords(int $user_id, int $record_id)
|
||||
|
@ -340,7 +334,6 @@ class TalkService extends BaseService
|
|||
* @param int $source 消息来源 1:好友消息 2:群聊消息
|
||||
* @param int $receive_id 好友ID或者群聊ID
|
||||
* @param array $record_ids 聊天记录ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function removeRecords(int $user_id, int $source, int $receive_id, array $record_ids)
|
||||
|
@ -379,7 +372,6 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param int $record_id 聊天记录ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function revokeRecord(int $user_id, int $record_id)
|
||||
|
@ -413,8 +405,8 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param int $user_id 转发的用户ID
|
||||
* @param int $record_id 转发消息的记录ID
|
||||
* @param array $receive_ids 接受者数组 例如:[['source' => 1,'id' => 3045],['source' => 1,'id' => 3046],['source' => 1,'id' => 1658]] 二维数组
|
||||
*
|
||||
* @param array $receive_ids 接受者数组 例如:[['source' => 1,'id' => 3045],['source' => 1,'id' => 3046],['source' =>
|
||||
* 1,'id' => 1658]] 二维数组
|
||||
* @return array
|
||||
*/
|
||||
public function forwardRecords(int $user_id, int $record_id, array $receive_ids)
|
||||
|
@ -506,8 +498,8 @@ class TalkService extends BaseService
|
|||
* @param int $receive_id 当前转发消息的所属者(好友ID或者群聊ID)
|
||||
* @param int $source 消息来源 1:好友消息 2:群聊消息
|
||||
* @param array $records_ids 转发消息的记录ID
|
||||
* @param array $receive_ids 接受者数组 例如:[['source' => 1,'id' => 3045],['source' => 1,'id' => 3046],['source' => 1,'id' => 1658]] 二维数组
|
||||
*
|
||||
* @param array $receive_ids 接受者数组 例如:[['source' => 1,'id' => 3045],['source' => 1,'id' => 3046],['source' =>
|
||||
* 1,'id' => 1658]] 二维数组
|
||||
* @return array|bool
|
||||
*/
|
||||
public function mergeForwardRecords(int $user_id, int $receive_id, int $source, $records_ids, array $receive_ids)
|
||||
|
@ -517,16 +509,16 @@ class TalkService extends BaseService
|
|||
|
||||
$sqlObj = ChatRecord::whereIn('id', $records_ids);
|
||||
|
||||
//验证是否有权限转发
|
||||
if ($source == 2) {//群聊消息
|
||||
//判断是否是群聊成员
|
||||
// 验证是否有权限转发
|
||||
if ($source == 2) {// 群聊消息
|
||||
// 判断是否是群聊成员
|
||||
if (!Group::isMember($receive_id, $user_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sqlObj = $sqlObj->where('receive_id', $receive_id)->whereIn('msg_type', $msg_type)->where('source', 2)->where('is_revoke', 0);
|
||||
} else {//私聊消息
|
||||
//判断是否存在好友关系
|
||||
} else {// 私聊消息
|
||||
// 判断是否存在好友关系
|
||||
if (!UsersFriend::isFriend($user_id, $receive_id)) {
|
||||
return [];
|
||||
}
|
||||
|
@ -544,7 +536,7 @@ class TalkService extends BaseService
|
|||
|
||||
$result = $sqlObj->get();
|
||||
|
||||
//判断消息记录是否存在
|
||||
// 判断消息记录是否存在
|
||||
if (count($result) != count($records_ids)) {
|
||||
return [];
|
||||
}
|
||||
|
@ -628,8 +620,7 @@ class TalkService extends BaseService
|
|||
* @param int $page 当前查询分页
|
||||
* @param int $page_size 分页大小
|
||||
* @param array $params 查询参数
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function searchRecords(int $user_id, int $receive_id, int $source, int $page, int $page_size, array $params)
|
||||
{
|
||||
|
@ -685,7 +676,6 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param $message
|
||||
* @param $fileInfo
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function createImgMessage($message, $fileInfo)
|
||||
|
@ -719,7 +709,6 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param array $message
|
||||
* @param array $codeBlock
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function createCodeMessage(array $message, array $codeBlock)
|
||||
|
@ -752,7 +741,6 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param array $message
|
||||
* @param array $emoticon
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function createEmoticonMessage(array $message, array $emoticon)
|
||||
|
@ -785,7 +773,6 @@ class TalkService extends BaseService
|
|||
*
|
||||
* @param array $message
|
||||
* @param array $emoticon
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function createFileMessage(array $message, array $emoticon)
|
||||
|
|
|
@ -7,8 +7,6 @@ use Hyperf\HttpMessage\Upload\UploadedFile;
|
|||
/**
|
||||
* 文件上传服务
|
||||
*
|
||||
* Class UploadService
|
||||
*
|
||||
* @package App\Service
|
||||
*/
|
||||
class UploadService extends BaseService
|
||||
|
@ -23,7 +21,7 @@ class UploadService extends BaseService
|
|||
*
|
||||
* @param string $dir 文件夹路径
|
||||
*/
|
||||
public function makeDirectory($dir)
|
||||
public function makeDirectory(string $dir)
|
||||
{
|
||||
if (!file_exists($dir)) @mkdir($dir, 0777, true);
|
||||
}
|
||||
|
@ -34,7 +32,6 @@ class UploadService extends BaseService
|
|||
* @param UploadedFile $file
|
||||
* @param string $dir 文件夹路径
|
||||
* @param string $filename 文件名称
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public function media(UploadedFile $file, string $dir, string $filename)
|
||||
|
@ -46,7 +43,6 @@ class UploadService extends BaseService
|
|||
$file->moveTo(sprintf('%s/%s', $save_dir, $filename));
|
||||
|
||||
if ($file->isMoved()) {
|
||||
// 修改文件权限
|
||||
@chmod(sprintf('%s/%s', $save_dir, $filename), 0644);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ class UserService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param array $field 查询字段
|
||||
*
|
||||
* @return mixed
|
||||
* @return User
|
||||
*/
|
||||
public function findById(int $user_id, $field = ['*'])
|
||||
{
|
||||
|
@ -29,7 +28,6 @@ class UserService extends BaseService
|
|||
*
|
||||
* @param string $mobile 手机号
|
||||
* @param string $password 登录密码
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function login(string $mobile, string $password)
|
||||
|
@ -49,7 +47,6 @@ class UserService extends BaseService
|
|||
* 账号注册逻辑
|
||||
*
|
||||
* @param array $data 用户数据
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function register(array $data)
|
||||
|
@ -71,12 +68,11 @@ class UserService extends BaseService
|
|||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
$result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,12 +80,11 @@ class UserService extends BaseService
|
|||
*
|
||||
* @param string $mobile 用户手机好
|
||||
* @param string $password 新密码
|
||||
*
|
||||
* @return mixed
|
||||
* @return bool
|
||||
*/
|
||||
public function resetPassword(string $mobile, string $password)
|
||||
{
|
||||
return User::where('mobile', $mobile)->update(['password' => Hash::make($password)]);
|
||||
return (bool)User::where('mobile', $mobile)->update(['password' => Hash::make($password)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,8 +92,7 @@ class UserService extends BaseService
|
|||
*
|
||||
* @param int $user_id 用户ID
|
||||
* @param string $mobile 换绑手机号
|
||||
*
|
||||
* @return array|bool
|
||||
* @return array
|
||||
*/
|
||||
public function changeMobile(int $user_id, string $mobile)
|
||||
{
|
||||
|
@ -115,7 +109,6 @@ class UserService extends BaseService
|
|||
*
|
||||
* @param int $friend_id 用户ID
|
||||
* @param int $me_user_id 当前登录用户的ID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUserCard(int $friend_id, int $me_user_id)
|
||||
|
|
|
@ -18,7 +18,6 @@ class Mail
|
|||
* @param string $email 邮箱地址
|
||||
* @param string $sms_code 验证码
|
||||
* @param string $title 邮件标题
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function sendEmailCode(string $email, string $sms_code, string $title)
|
||||
|
@ -40,24 +39,23 @@ class Mail
|
|||
* @param string $address
|
||||
* @param string $subject
|
||||
* @param string $view
|
||||
*
|
||||
* @return bool
|
||||
* @throws \PHPMailer\PHPMailer\Exception
|
||||
*/
|
||||
private function mail(string $address, string $subject, string $view): bool
|
||||
{
|
||||
$config = config('mail');
|
||||
$mail = new PHPMailer(); //PHPMailer对象
|
||||
$mail->CharSet = 'UTF-8'; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码
|
||||
$mail->IsSMTP(); // 设定使用SMTP服务
|
||||
$mail->SMTPDebug = 0; // 关闭SMTP调试功能
|
||||
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
|
||||
$mail->SMTPSecure = 'ssl'; // 使用安全协议
|
||||
$mail->Host = $config['host']; // SMTP 服务器
|
||||
$mail->Port = $config['port']; // SMTP服务器的端口号
|
||||
$mail->Username = $config['username']; // SMTP; // SMTP服务器用户名
|
||||
$mail->Password = $config['password']; // SMTP服务器密码
|
||||
$mail->SetFrom($config['from'], $config['name']); // 邮箱,昵称
|
||||
$mail = new PHPMailer(); // PHPMailer对象
|
||||
$mail->CharSet = 'UTF-8'; // 设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码
|
||||
$mail->IsSMTP(); // 设定使用SMTP服务
|
||||
$mail->SMTPDebug = 0; // 关闭SMTP调试功能
|
||||
$mail->SMTPAuth = true; // 启用 SMTP 验证功能
|
||||
$mail->SMTPSecure = 'ssl'; // 使用安全协议
|
||||
$mail->Host = $config['host']; // SMTP 服务器
|
||||
$mail->Port = $config['port']; // SMTP服务器的端口号
|
||||
$mail->Username = $config['username']; // SMTP服务器用户名
|
||||
$mail->Password = $config['password']; // SMTP服务器密码
|
||||
$mail->SetFrom($config['from'], $config['name']); // 邮箱,昵称
|
||||
$mail->Subject = $subject;
|
||||
$mail->MsgHTML($view);
|
||||
$mail->AddAddress($address); // 收件人
|
||||
|
@ -68,7 +66,6 @@ class Mail
|
|||
* @param string $engine
|
||||
* @param $template
|
||||
* @param array $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function view(string $engine, $template, $params = []): string
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Support;
|
|||
|
||||
/**
|
||||
* 邮件视图模板
|
||||
* Class MailerViewTemplate
|
||||
*
|
||||
* @package App\Support
|
||||
*/
|
||||
|
@ -16,7 +15,6 @@ class MailerTemplate
|
|||
* @param string $engine 模板引擎
|
||||
* @param string $template 模板名称
|
||||
* @param array $params 模板参数
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function view(string $engine, string $template, $params = []): string
|
||||
|
@ -29,7 +27,6 @@ class MailerTemplate
|
|||
*
|
||||
* @param string $sms_code 验证码
|
||||
* @param array $params 模板参数
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function emailCode(string $sms_code, array $params = [])
|
||||
|
|
|
@ -107,7 +107,6 @@ class Packet
|
|||
* Get socket packet type of a raw payload.
|
||||
*
|
||||
* @param string $packet
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public static function getSocketType(string $packet)
|
||||
|
@ -125,13 +124,12 @@ class Packet
|
|||
* Get data packet from a raw payload.
|
||||
*
|
||||
* @param string $packet
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public static function getPayload(string $packet)
|
||||
{
|
||||
$packet = trim($packet);
|
||||
$start = strpos($packet, '[');
|
||||
$start = strpos($packet, '[');
|
||||
|
||||
if ($start === false || substr($packet, -1) !== ']') {
|
||||
return null;
|
||||
|
@ -146,16 +144,15 @@ class Packet
|
|||
|
||||
return [
|
||||
'event' => $data[0],
|
||||
'data' => $data[1] ?? null,
|
||||
'data' => $data[1] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a socket packet belongs to specific type.
|
||||
*
|
||||
* @param $packet
|
||||
* @param $packet
|
||||
* @param string $typeName
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSocketType($packet, string $typeName)
|
||||
|
|
|
@ -35,7 +35,6 @@ class RedisLock
|
|||
* @param integer $lockSecond 锁定时间 单位(秒)
|
||||
* @param integer $timeout 取锁超时时间。单位(秒)。等于0,如果当前锁被占用,则立即返回失败。如果大于0,则反复尝试获取锁直到达到该超时时间。
|
||||
* @param integer|float $sleep 取锁间隔时间 单位(秒)。当锁为占用状态时。每隔多久尝试去取锁。默认 0.1 秒一次取锁。
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
@ -69,7 +68,6 @@ class RedisLock
|
|||
*
|
||||
* @param string $key 被加锁的KEY
|
||||
* @param string|int $requestId 客户端请求唯一ID
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function release(string $key, $requestId)
|
||||
|
@ -93,7 +91,6 @@ LAU;
|
|||
* 获取锁 Key
|
||||
*
|
||||
* @param string $key 需要加锁的KEY
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getLockKey(string $key)
|
||||
|
|
|
@ -16,8 +16,9 @@ class Response
|
|||
private $response;
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* 处理json数据
|
||||
*
|
||||
* @param $data
|
||||
* @return PsrResponseInterface
|
||||
*/
|
||||
public function json($data)
|
||||
|
@ -30,7 +31,6 @@ class Response
|
|||
*
|
||||
* @param array $data 响应数据
|
||||
* @param string $message 响应提示
|
||||
*
|
||||
* @return PsrResponseInterface
|
||||
*/
|
||||
public function success(array $data = [], $message = 'success')
|
||||
|
@ -45,7 +45,6 @@ class Response
|
|||
* @param array $data 响应数据
|
||||
* @param string $message 响应提示
|
||||
* @param int $code 错误码
|
||||
*
|
||||
* @return PsrResponseInterface
|
||||
*/
|
||||
public function fail($message = 'fail', $data = [], $code = ResponseCode::FAIL)
|
||||
|
@ -54,9 +53,10 @@ class Response
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* 处理错误信息返回
|
||||
*
|
||||
* @param string $message 响应提示
|
||||
* @param int $code 错误码
|
||||
* @return PsrResponseInterface
|
||||
*/
|
||||
public function error($message = '', $code = ResponseCode::SERVER_ERROR)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Support;
|
||||
|
||||
|
||||
class SendEmailCode
|
||||
{
|
||||
const FORGET_PASSWORD = 'forget_password';
|
||||
|
@ -15,7 +14,6 @@ class SendEmailCode
|
|||
*
|
||||
* @param string $type
|
||||
* @param string $mobile
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getKey(string $type, string $mobile)
|
||||
|
@ -29,7 +27,6 @@ class SendEmailCode
|
|||
* @param string $type 发送类型
|
||||
* @param string $email 手机号
|
||||
* @param string $code 验证码
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check(string $type, string $email, string $code)
|
||||
|
@ -48,8 +45,7 @@ class SendEmailCode
|
|||
* @param string $type 类型
|
||||
* @param string $title 邮件标题
|
||||
* @param string $email 邮箱地址
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function send(string $type, string $title, string $email)
|
||||
{
|
||||
|
@ -70,7 +66,6 @@ class SendEmailCode
|
|||
* 获取缓存的验证码
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCode(string $key)
|
||||
|
@ -84,8 +79,7 @@ class SendEmailCode
|
|||
* @param string $key 缓存key
|
||||
* @param string $sms_code 验证码
|
||||
* @param float|int $exp 过期时间
|
||||
*
|
||||
* @return mixed
|
||||
* @return bool
|
||||
*/
|
||||
public function setCode(string $key, string $sms_code, $exp = 60 * 15)
|
||||
{
|
||||
|
@ -97,8 +91,7 @@ class SendEmailCode
|
|||
*
|
||||
* @param string $type 类型
|
||||
* @param string $email 邮箱地址
|
||||
*
|
||||
* @return mixed
|
||||
* @return int
|
||||
*/
|
||||
public function delCode(string $type, string $email)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@ class SocketIOParser extends Packet
|
|||
*
|
||||
* @param string $event
|
||||
* @param mixed $data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function encode(string $event, $data)
|
||||
|
@ -26,7 +25,6 @@ class SocketIOParser extends Packet
|
|||
* Decode message from websocket client.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function decode($string)
|
||||
|
|
|
@ -14,7 +14,6 @@ trait PagingTrait
|
|||
*
|
||||
* @param int $total 总记录数
|
||||
* @param int $page_size 分页大小
|
||||
*
|
||||
* @return int 分页总数
|
||||
*/
|
||||
protected function getPagingTotal(int $total, int $page_size)
|
||||
|
@ -30,7 +29,6 @@ trait PagingTrait
|
|||
* @param int $page 当前分页
|
||||
* @param int $page_size 分页大小
|
||||
* @param array $params 额外参数
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getPagingRows(array $rows, int $total, int $page, int $page_size, array $params = [])
|
||||
|
|
|
@ -1,15 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This is my open source code, please do not use it for commercial applications.
|
||||
*
|
||||
* For the full copyright and license information,
|
||||
* please view the LICENSE file that was distributed with this source code
|
||||
*
|
||||
* @author Yuandong<837215079@qq.com>
|
||||
* @link https://github.com/gzydong/hyperf-chat
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Common function method
|
||||
|
@ -132,7 +121,6 @@ function response()
|
|||
* 从HTML文本中提取所有图片
|
||||
*
|
||||
* @param string $content HTML文本
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_html_images($content)
|
||||
|
@ -155,7 +143,6 @@ function get_html_images($content)
|
|||
*
|
||||
* @param string $day1 日期1
|
||||
* @param string $day2 日期2
|
||||
*
|
||||
* @return float|int
|
||||
*/
|
||||
function diff_date($day1, $day2)
|
||||
|
@ -174,21 +161,19 @@ function diff_date($day1, $day2)
|
|||
* 获取媒体文件url
|
||||
*
|
||||
* @param string $path 文件相对路径
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_media_url(string $path)
|
||||
{
|
||||
return sprintf('%s/%s', rtrim(config('domain.img_url'), '/'), ltrim($path,'/'));
|
||||
return sprintf('%s/%s', rtrim(config('domain.img_url'), '/'), ltrim($path, '/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机生成图片名
|
||||
*
|
||||
* @param string $ext 图片后缀名
|
||||
* @param int $width 图片宽度
|
||||
* @param int $height 图片高度
|
||||
*
|
||||
* @param string $ext 图片后缀名
|
||||
* @param int $width 图片宽度
|
||||
* @param int $height 图片高度
|
||||
* @return string
|
||||
*/
|
||||
function create_image_name(string $ext, int $width, int $height)
|
||||
|
@ -200,7 +185,6 @@ function create_image_name(string $ext, int $width, int $height)
|
|||
* 替换文本中的url 为 a标签
|
||||
*
|
||||
* @param string $str 字符串
|
||||
*
|
||||
* @return null|string|string[]
|
||||
*/
|
||||
function replace_url_link(string $str)
|
||||
|
@ -214,10 +198,9 @@ function replace_url_link(string $str)
|
|||
/**
|
||||
* 二维数组排序
|
||||
*
|
||||
* @param array $array 数组
|
||||
* @param array $array 数组
|
||||
* @param string $field 排序字段
|
||||
* @param int $sort 排序方式
|
||||
*
|
||||
* @param int $sort 排序方式
|
||||
* @return array
|
||||
*/
|
||||
function arraysSort(array $array, $field, $sort = SORT_DESC)
|
||||
|
@ -229,9 +212,8 @@ function arraysSort(array $array, $field, $sort = SORT_DESC)
|
|||
/**
|
||||
* 判断0或正整数
|
||||
*
|
||||
* @param string $int 验证字符串
|
||||
* @param bool $isZero 判断是否可为0
|
||||
*
|
||||
* @param string $int 验证字符串
|
||||
* @param bool $isZero 判断是否可为0
|
||||
* @return bool
|
||||
*/
|
||||
function check_int($int, $isZero = false)
|
||||
|
@ -244,7 +226,6 @@ function check_int($int, $isZero = false)
|
|||
* 解析英文逗号',' 拼接的 ID 字符串
|
||||
*
|
||||
* @param string $ids 字符串(例如; "1,2,3,4,5,6")
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function parse_ids($ids)
|
||||
|
|
|
@ -48,7 +48,7 @@ return [
|
|||
],
|
||||
'settings' => [
|
||||
'enable_coroutine' => true,
|
||||
'worker_num' => swoole_cpu_num(),
|
||||
'worker_num' => 1,
|
||||
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
|
||||
'open_tcp_nodelay' => true,
|
||||
'max_coroutine' => 100000,
|
||||
|
|
Loading…
Reference in New Issue