This commit is contained in:
wucongxing 2023-03-16 10:17:44 +08:00
parent d19a1271d3
commit 21fe6be452
18 changed files with 297 additions and 132 deletions

View File

@ -197,7 +197,6 @@ class AssignDoctorConsumer extends ConsumerMessage
}catch (\Exception $e) {
// 验证失败
Log::getInstance()->error("分配医生成功,发送系统问诊消息失败:" . $e->getMessage());
// 加入消息通知队列
return Result::ACK;
}

View File

@ -34,7 +34,7 @@ function dump(...$vars)
* @param string $message 返回提示信息
* @return array
*/
function success(array $data = [], int $code = HttpEnumCode::HTTP_SUCCESS, string $message = ""): array
function success(array|string $data = [], int $code = HttpEnumCode::HTTP_SUCCESS, string $message = ""): array
{
if (empty($message)) {
$message = HttpEnumCode::getMessage($code);

View File

@ -25,4 +25,17 @@ class SafeController extends AbstractController
$data = $SafeService->getOssSign();
return $this->response->json($data);
}
/**
* 获取im签名数据
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getImSign(): ResponseInterface
{
$SafeService = new SafeService();
$data = $SafeService->getImSign();
return $this->response->json($data);
}
}

View File

@ -239,5 +239,20 @@ class UserController extends AbstractController
// $Prescription = new Prescription();
// $token = $Prescription->getProd();
// dump($token);
// 创建im账号
// $account = new Account();
// 创建单个账号
// $account->createAccount("111295","测试患者1","");
// $profile = new Profile();
// $result = $profile->getOneAccountPortraitList("111295");
// dump($result);
// $arg = array();
// $arg['Tag_Profile_IM_Image'] = "https://img.applets.igandanyiyuan.com/applet/doctor/avatar/03dc8df2-e7c0-4ad9-b87e-5133e40e0f76.jpg";
// $profile->setProfile("111295",$arg);
// $ImService = new ImService();
// $ImService->setUserProfile("491925054435950592");
}
}

View File

@ -9,10 +9,12 @@ use Hyperf\Database\Model\Builder;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $user_id 主键
* @property string $user_id 主键
* @property string $user_name 用户名称
* @property string $user_account 账号
* @property string $mobile 手机号
* @property int $sex 性别0:未知 1: 2:女)
* @property string $avatar 头像
* @property string $wx_mobile 微信手机号
* @property string $user_password 密码
* @property string $salt 密码混淆码
@ -36,12 +38,12 @@ class User extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'login_ip', 'last_login_at', 'created_at', 'updated_at'];
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'sex', 'avatar', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'login_ip', 'last_login_at', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['user_id' => 'string', 'user_type' => 'integer', 'user_status' => 'integer', 'register_method' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected array $casts = ['user_id' => 'string', 'user_type' => 'integer', 'user_status' => 'integer', 'register_method' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'sex' => 'integer'];
protected string $primaryKey = "user_id";

View File

@ -15,8 +15,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
use Hyperf\Utils\Arr;
/**
* @property string $doctor_id 主键
* @property string $user_id 用户id
* @property int $doctor_id 主键
* @property int $user_id 用户id
* @property string $user_name 用户名称
* @property string $open_id 微信open_id
* @property string $union_id 微信开放平台唯一标识
@ -29,15 +29,12 @@ use Hyperf\Utils\Arr;
* @property string $multi_point_fail_reason 多点执业认证失败原因
* @property int $is_bind_bank 是否已绑定结算银行卡0: 1:是)
* @property int $is_recommend 是否首页推荐0: 1:是)
* @property string $mobile 电话
* @property int $sex 性别0:未知 1: 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property int $doctor_title 医生职称1:执业医师 2:主治医师 3:副主任医师 4:主任医师)
* @property string $department_custom_id 科室id-自定义
* @property int $department_custom_id 科室id-自定义
* @property string $department_custom_name 科室名称(如未自己输入,填入标准科室名称)
* @property string $department_custom_mobile 科室电话
* @property string $hospital_id 所属医院id
* @property int $hospital_id 所属医院id
* @property int $served_patients_num 服务患者数量
* @property string $praise_rate 好评率百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5
* @property string $avg_response_time 平均响应时间(分钟制)
@ -53,10 +50,10 @@ use Hyperf\Utils\Arr;
* @property string $brief_introduction 医生简介
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[] $DoctorExpertise
* @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[] $DoctorInquiryConfig
* @property-read Hospital $Hospital
* @property-read \Hyperf\Database\Model\Collection|OrderInquiry[] $OrderInquiry
* @property-read \Hyperf\Database\Model\Collection|DoctorExpertise[] $DoctorExpertise
* @property-read \Hyperf\Database\Model\Collection|DoctorInquiryConfig[] $DoctorInquiryConfig
* @property-read Hospital $Hospital
* @property-read \Hyperf\Database\Model\Collection|OrderInquiry[] $OrderInquiry
*/
class UserDoctor extends Model
{
@ -70,7 +67,7 @@ class UserDoctor extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'mobile', 'sex', 'age', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_online', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
protected array $fillable = ['doctor_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'iden_auth_status', 'iden_auth_fail_reason', 'multi_point_status', 'multi_point_fail_reason', 'is_bind_bank', 'is_recommend', 'avatar', 'doctor_title', 'department_custom_id', 'department_custom_name', 'department_custom_mobile', 'hospital_id', 'served_patients_num', 'praise_rate', 'avg_response_time', 'number_of_fans', 'is_online', 'is_img_expert_reception', 'is_img_welfare_reception', 'is_img_quick_reception', 'is_platform_deep_cooperation', 'is_enterprise_deep_cooperation', 'qr_code', 'be_good_at', 'brief_introduction', 'created_at', 'updated_at'];
protected string $primaryKey = "doctor_id";

View File

@ -9,17 +9,14 @@ namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $patient_id 主键id
* @property int $user_id 用户id
* @property string $patient_id 主键id
* @property string $user_id 用户id
* @property string $user_name 用户名称
* @property string $open_id 微信open_id
* @property string $union_id 微信开放平台唯一标识
* @property string $wx_session_key 微信会话密钥
* @property int $status 状态0:禁用 1:正常 2:删除)
* @property int $idcard_status 实名认证状态0:未认证 1:认证通过 2:认证失败)
* @property string $mobile 手机号
* @property int $sex 性别0:未知 1: 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
@ -36,7 +33,7 @@ class UserPatient extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['patient_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'mobile', 'sex', 'age', 'avatar', 'created_at', 'updated_at'];
protected array $fillable = ['patient_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'idcard_status', 'avatar', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.

View File

@ -16,11 +16,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
* @property string $union_id 微信开放平台唯一标识
* @property string $wx_session_key 微信会话密钥
* @property int $status 状态0:禁用 1:正常 2:删除)
* @property string $mobile 电话
* @property int $sex 性别0:未知 1: 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property int $is_online 是否在线0:不在线 1:在线)
* @property string $avatar 头像
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
@ -36,7 +33,7 @@ class UserPharmacist extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['pharmacist_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'mobile', 'sex', 'age', 'avatar', 'is_online', 'created_at', 'updated_at'];
protected array $fillable = ['pharmacist_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'is_online', 'avatar', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.

View File

@ -36,55 +36,40 @@ class ImService extends BaseService
throw new BusinessException("用户数据错误");
}
if ($user['user_type'] == 1){
// 患者
$params = array();
$params['user_id'] = $user['user_id'];
$user_patient = UserPatient::getOne($params);
if (empty($user_patient)){
throw new BusinessException("患者数据错误");
}
$avatar = addAliyunOssWebsite($user_patient['avatar']);
$user_name = $user_patient['user_name'];
}elseif ($user['user_type'] == 2){
// 医生
$params = array();
$params['user_id'] = $user['user_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("医生数据错误");
}
$avatar = addAliyunOssWebsite($user_doctor['avatar']);
$user_name = $user_doctor['user_name'];
}elseif ($user['user_type'] == 3){
// 药师
$params = array();
$params['user_id'] = $user['user_id'];
$user_pharmacist = UserPharmacist::getOne($params);
if (empty($user_pharmacist)){
throw new BusinessException("药师数据错误");
}
$avatar = addAliyunOssWebsite($user_pharmacist['avatar']);
$user_name = $user_pharmacist['user_name'];
}
$avatar = addAliyunOssWebsite($user['avatar']);
$account = new Account();
// 查询账号导入状态
$res = $account->checkAccountStatus($user['user_id']);
if (!$res){
// 创建单个账号
$account->createAccount($user_id,$user_name,$avatar);
$account->createAccount($user_id,$user['user_name'],$avatar);
}
// 医生检测并设置资料
if ($user['user_type'] == 2){
// 检测用户资料
$profile = new Profile();
$result = $profile->getOneAccountPortraitList($user['user_id']);
if (!empty($result)){
// 检测用户资料
$profile = new Profile();
$result = $profile->getOneAccountPortraitList($user['user_id']);
if (!empty($result)){
$arg = array();
// 头像
if (in_array('Tag_Profile_IM_Image',$result)){
$arg['Tag_Profile_IM_Image'] = $avatar;
}
// 性别
if (in_array('Tag_Profile_IM_Gender',$result)){
$arg['Tag_Profile_IM_Gender'] = sexToImSex($user['sex']);
}
if ($user['user_type'] == 2){
$params = array();
$params['user_id'] = $user['user_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("医生数据错误");
}
// 获取订单医生医院
$params = array();
$params['hospital_id'] = $user_doctor['hospital_id'];
@ -93,11 +78,77 @@ class ImService extends BaseService
throw new BusinessException("医生医院数据错误");
}
// 设置用户资料
$arg = array();
// 性别
if (in_array('Tag_Profile_IM_Gender',$result)){
$arg['Tag_Profile_IM_Gender'] = sexToImSex($user_doctor['sex']);
// 医院
if (in_array('Tag_Profile_Custom_Hname',$result)){
$arg['Tag_Profile_Custom_Hname'] = $hospital['hospital_name'];
}
// 职称
if (in_array('Tag_Profile_Custom_Title',$result)){
$arg['Tag_Profile_Custom_Title'] = $user_doctor['doctor_title'] ?? DoctorTitleCode::getMessage($user_doctor['doctor_title']);
}
}
if (!empty($arg)){
$profile->setProfile($user['user_id'],$arg);
}
}
return true;
} catch (\Exception $e) {
throw new BusinessException($e->getMessage());
}
}
/**
* 设置用户资料
* @param string $user_id
* @return bool
* @throws GuzzleException
*/
public function setUserProfile(string $user_id): bool
{
try {
$params = array();
$params['user_id'] = $user_id;
$user = User::getOne($params);
if (empty($user)){
throw new BusinessException("用户数据错误");
}
$avatar = addAliyunOssWebsite($user['avatar']);
// 检测用户资料
$profile = new Profile();
$result = $profile->getOneAccountPortraitList($user['user_id']);
if (!empty($result)){
$arg = array();
// 头像
if (in_array('Tag_Profile_IM_Image',$result)){
$arg['Tag_Profile_IM_Image'] = $avatar;
}
// 性别
if (in_array('Tag_Profile_IM_Gender',$result)){
$arg['Tag_Profile_IM_Gender'] = sexToImSex($user['sex']);
}
if ($user['user_type'] == 2){
$params = array();
$params['user_id'] = $user['user_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
throw new BusinessException("医生数据错误");
}
// 获取订单医生医院
$params = array();
$params['hospital_id'] = $user_doctor['hospital_id'];
$hospital = Hospital::getOne($params);
if (empty($hospital)){
throw new BusinessException("医生医院数据错误");
}
// 医院
@ -106,13 +157,13 @@ class ImService extends BaseService
}
// 职称
if (in_array('Tag_Profile_Custom_Hname',$result)){
if (in_array('Tag_Profile_Custom_Title',$result)){
$arg['Tag_Profile_Custom_Title'] = $user_doctor['doctor_title'] ?? DoctorTitleCode::getMessage($user_doctor['doctor_title']);
}
}
if (!empty($arg)){
$profile->setProfile($user_doctor['user_id'],$arg);
}
if (!empty($arg)){
$profile->setProfile($user['user_id'],$arg);
}
}
@ -120,7 +171,6 @@ class ImService extends BaseService
} catch (\Exception $e) {
throw new BusinessException($e->getMessage());
}
}
/**
@ -178,12 +228,12 @@ class ImService extends BaseService
public function sendTextMessage(string $from_user_id,string $to_user_id,string $content,string $order_inquiry_id,int $inquiry_type): void
{
if (!empty($from_user_id)){
// 检测并创建发送者账号
$this->createAccount($from_user_id);
// 检测并创建发送者资料
$this->setUserProfile($from_user_id);
}
// 检测并创建接收者账号
$this->createAccount($to_user_id);
// 检测并创建接收者资料
$this->setUserProfile($to_user_id);
// 医生给患者发送消息
$message = new Message();

View File

@ -9,6 +9,7 @@ use App\Model\DoctorInquiryConfig as DoctorInquiryConfigModel;
use App\Model\Module as ModuleModel;
use App\Model\PatientHistoryInquiry as PatientHistoryInquiryModel;
use App\Model\PharmacistAuditStatistic;
use App\Model\User;
use App\Model\UserDoctor as UserDoctorModel;
use App\Model\UserPharmacist;
@ -40,8 +41,6 @@ class IndexService extends BaseService
"iden_auth_fail_reason",
"multi_point_status",
"is_bind_bank",
"mobile",
"avatar",
"praise_rate",
"avg_response_time",
"number_of_fans",

View File

@ -9,6 +9,7 @@ use App\Model\UserPatient as UserPatientModel;
use App\Model\UserPharmacist as UserPharmacistModel;
use App\Utils\Http;
use App\Utils\Jwt;
use Extend\TencentIm\Account;
use Extend\Wechat\Wechat;
use Hyperf\DbConnection\Db;
use Hyperf\Redis\Redis;
@ -85,7 +86,6 @@ class LoginService extends BaseService
$data['union_id'] = $wx_info_data['unionid'] ?? "";
$data['wx_session_key'] = $wx_info_data['session_key'];
$data['status'] = 1;
$data['mobile'] = $phone_info['phone_info']['purePhoneNumber'];
if ($user['user_type'] == 1) {
// 患者
@ -114,6 +114,11 @@ class LoginService extends BaseService
$client_user_id = $user_doctor['doctor_id'];
}
// 创建im账号
$account = new Account();
// 创建单个账号
$account->createAccount($user->user_id,$user->user_name,"");
} else {
// 已注册用户
// 重复注册不同端
@ -272,7 +277,6 @@ class LoginService extends BaseService
$data['user_id'] = $user->user_id;
$data['user_name'] = $user['user_name'];
$data['status'] = 1;
$data['mobile'] = $phone;
if ($user['user_type'] == 1) {
// 患者

View File

@ -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);
}
}

View File

@ -1509,7 +1509,7 @@ class UserDoctorService extends BaseService
* @param string $inquiry_type
* @return string
*/
public function getInquiryAssignDoctor(string $inquiry_type,): string
public function getInquiryAssignDoctor(string $inquiry_type): string
{
// 获取问诊配置
$params = array();

View File

@ -10,6 +10,7 @@ use App\Model\UserDoctor;
use App\Model\UserDoctorInfo;
use App\Model\UserPatient;
use App\Utils\PcreMatch;
use Extend\TencentIm\Profile;
use Extend\Wechat\Wechat;
use Hyperf\Amqp\Result;
use Hyperf\DbConnection\Db;
@ -91,58 +92,83 @@ class UserService extends BaseService
// 匹配去除oss网址
$avatar = PcreMatch::pregRemoveOssWebsite($avatar);
// 获取对应用户信息
if ($user['user_type'] == 1){
// 患者
Db::beginTransaction();
try {
// 修改用户表
$data = array();
$data['avatar'] = $avatar;
$params = array();
$params['user_id'] = $user_info['user_id'];
$user_patient = UserPatient::getOne($params);
if (empty($user_patient)){
return fail();
}
if ($user_patient['avatar'] != $avatar) {
$data = array();
$data['avatar'] = $avatar;
User::editUser($params,$data);
// 获取对应用户信息
if ($user['user_type'] == 1){
// 患者
$params = array();
$params['patient_id'] = $user_patient['patient_id'];
UserPatient::editUserPatient($params,$data);
}
}elseif ($user['user_type'] == 2){
// 医生
$params = array();
$params['user_id'] = $user_info['user_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
return fail();
}
$params['user_id'] = $user_info['user_id'];
$user_patient = UserPatient::getOne($params);
if (empty($user_patient)){
Db::rollBack();
return fail();
}
if ($user_doctor['avatar'] != $avatar) {
$data = array();
$data['avatar'] = $avatar;
if ($user_patient['avatar'] != $avatar) {
$data = array();
$data['avatar'] = $avatar;
$params = array();
$params['patient_id'] = $user_patient['patient_id'];
UserPatient::editUserPatient($params,$data);
}
}elseif ($user['user_type'] == 2){
// 医生
$params = array();
$params['doctor_id'] = $user_doctor['doctor_id'];
UserDoctor::editUserDoctor($params,$data);
}
}elseif ($user['user_type'] == 3){
// 药师
$params = array();
$params['user_id'] = $user_info['user_id'];
$user_pharmacist = UserPatient::getOne($params);
if (empty($user_pharmacist)){
return fail();
}
$params['user_id'] = $user_info['user_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
Db::rollBack();
return fail();
}
if ($user_pharmacist['avatar'] != $avatar) {
$data = array();
$data['avatar'] = $avatar;
if ($user_doctor['avatar'] != $avatar) {
$data = array();
$data['avatar'] = $avatar;
$params = array();
$params['doctor_id'] = $user_doctor['doctor_id'];
UserDoctor::editUserDoctor($params,$data);
}
}elseif ($user['user_type'] == 3){
// 药师
$params = array();
$params['pharmacist_id'] = $user_pharmacist['pharmacist_id'];
UserPatient::editUserPatient($params,$data);
$params['user_id'] = $user_info['user_id'];
$user_pharmacist = UserPatient::getOne($params);
if (empty($user_pharmacist)){
Db::rollBack();
return fail();
}
if ($user_pharmacist['avatar'] != $avatar) {
$data = array();
$data['avatar'] = $avatar;
$params = array();
$params['pharmacist_id'] = $user_pharmacist['pharmacist_id'];
UserPatient::editUserPatient($params,$data);
}
}
// 修改im头像
$profile = new Profile();
$arg = array();
$arg['Tag_Profile_IM_Image'] = addAliyunOssWebsite($avatar);
$profile->setProfile($user_info['user_id'],$arg);
Db::commit();
} catch (\Exception $e) {
Db::rollBack();
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
}
return success();

View File

@ -381,6 +381,9 @@ Router::addGroup('/area', function () {
Router::addGroup('/sign', function () {
// 获取oss签名数据
Router::get('/oss', [SafeController::class, 'getOssSign']);
// 获取im签名数据
Router::get('/im', [SafeController::class, 'getImSign']);
});
// 基础数据

View File

@ -23,7 +23,7 @@ class Account extends Base
* @return array
* @throws GuzzleException
*/
public function createAccount(string $user_id,string $nick_name,string $avatar): array
public function createAccount(string $user_id,string $nick_name = "",string $avatar = ""): array
{
try {
$options = [

View File

@ -53,12 +53,13 @@ class Profile extends Base
/**
* 拉取一个账户的多个资料
* 返回未设置的字段
* @param string $user_id
* @param array $arg
* @return array|string[]
* @throws GuzzleException
*/
public function getOneAccountPortraitList(string $user_id,array $arg = ['Tag_Profile_IM_Gender','Tag_Profile_Custom_Hname','Tag_Profile_Custom_Title']): array
public function getOneAccountPortraitList(string $user_id,array $arg = ['Tag_Profile_IM_Gender','Tag_Profile_Custom_Hname','Tag_Profile_Custom_Title',"Tag_Profile_IM_Image"]): array
{
try {
$options = [
@ -70,10 +71,20 @@ class Profile extends Base
$path = $this->config['base_url'] . $this->version . "/profile/portrait_get?" . $this->buildRequestParams();
$result = $this->postRequest($path,$options);
$result_arg = [];
if (!empty($result['UserProfileItem'])){
foreach ($result['UserProfileItem'] as $user_profile_item){
if(!empty($user_profile_item['ProfileItem'])){
$result_arg = array_column($user_profile_item['ProfileItem'],"Tag");
foreach ($user_profile_item['ProfileItem'] as $profile_item){
if (!empty($profile_item['Value'])){
// 性别为未知时跳过
if ($profile_item['Tag'] == "Tag_Profile_IM_Gender" && $profile_item['Value'] == "Gender_Type_Unknown"){
continue;
}
$result_arg[] = $profile_item['Tag'];
}
}
}
}
}

16
extend/TencentIm/Safe.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace Extend\TencentIm;
class Safe extends Base
{
/**
* 获取用户签名
* @param string $user_id
* @return string
*/
public function getUserSign(string $user_id = ""): string
{
return parent::getUserSign($user_id); // TODO: Change the autogenerated stub
}
}