修正无医生数据
This commit is contained in:
@@ -94,7 +94,7 @@ class Base
|
||||
}
|
||||
|
||||
$content = json_decode($response->getBody(),true);
|
||||
dump($content);
|
||||
|
||||
if (empty($content)){
|
||||
throw new BusinessException("请求失败");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Extend\TencentIm;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Snowflake\IdGeneratorInterface;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
|
||||
@@ -69,6 +70,7 @@ class Message extends Base
|
||||
* 如聊天类型。json格式
|
||||
* order_inquiry_id
|
||||
* inquiry_type
|
||||
* message_type 消息类型(1:系统发送 其余:用户发送)
|
||||
*/
|
||||
'CloudCustomData' => "",
|
||||
|
||||
@@ -76,7 +78,14 @@ class Message extends Base
|
||||
|
||||
}
|
||||
|
||||
public function sendMessage(array $arg){
|
||||
/**
|
||||
* 发送消息
|
||||
* @param array $arg
|
||||
* @return bool
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function sendMessage(array $arg): bool
|
||||
{
|
||||
|
||||
try {
|
||||
// 合并发送参数
|
||||
@@ -86,9 +95,9 @@ class Message extends Base
|
||||
"json"=> $arg
|
||||
];
|
||||
|
||||
dump($options);
|
||||
$path = $this->config['base_url'] . $this->version . "/openim/sendmsg?" . $this->buildRequestParams();
|
||||
return $this->postRequest($path,$options);
|
||||
$this->postRequest($path,$options);
|
||||
return true;
|
||||
}catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ class Profile extends Base
|
||||
* 自定义字段:控制台->应用配置>功能配置->新增
|
||||
* Tag_Profile_Custom_Hname:医院名称
|
||||
* Tag_Profile_Custom_Title:医生职称
|
||||
* @return array
|
||||
* @return bool
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function setProfile(string $user_id,array $arg): array
|
||||
public function setProfile(string $user_id,array $arg): bool
|
||||
{
|
||||
try {
|
||||
$profileItem = [];
|
||||
@@ -43,7 +43,46 @@ class Profile extends Base
|
||||
];
|
||||
|
||||
$path = $this->config['base_url'] . $this->version . "/profile/portrait_set?" . $this->buildRequestParams();
|
||||
return $this->postRequest($path,$options);
|
||||
$this->postRequest($path,$options);
|
||||
|
||||
return true;
|
||||
}catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取一个账户的多个资料
|
||||
* @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
|
||||
{
|
||||
try {
|
||||
$options = [
|
||||
"json"=> [
|
||||
"To_Account" => [$user_id],
|
||||
"TagList" => $arg,
|
||||
]
|
||||
];
|
||||
|
||||
$path = $this->config['base_url'] . $this->version . "/profile/portrait_get?" . $this->buildRequestParams();
|
||||
$result = $this->postRequest($path,$options);
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($result_arg)){
|
||||
return $arg;
|
||||
}
|
||||
|
||||
return array_diff($arg,$result_arg);
|
||||
}catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user