1
This commit is contained in:
@@ -2,8 +2,15 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\User;
|
||||
use App\Model\User as UserModel;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserPatient;
|
||||
use App\Model\UserPharmacist;
|
||||
use Extend\Alibaba\Oss;
|
||||
use Extend\TencentIm\Account;
|
||||
use Extend\TencentIm\Safe;
|
||||
|
||||
/**
|
||||
* 安全服务
|
||||
@@ -67,4 +74,33 @@ class SafeService extends BaseService
|
||||
|
||||
return success($oss->signature($dir));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取im签名数据
|
||||
* @return array
|
||||
*/
|
||||
public function getImSign(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
if (empty($user_info)){
|
||||
return success();
|
||||
}
|
||||
|
||||
// 验证用户数据
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$user = User::getOne($params);
|
||||
if (empty($user)){
|
||||
return success();
|
||||
}
|
||||
|
||||
$safe = new Safe();
|
||||
$sign = $safe->getUserSign($user['user_id']);
|
||||
if (empty($sign)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($sign);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user