|
@@ -1,5 +1,6 @@
|
|
<?php namespace App\Http\Controllers\Api;
|
|
<?php namespace App\Http\Controllers\Api;
|
|
|
|
|
|
|
|
+use App\Facades\Servers\WeiBan\OpenApi;
|
|
use App\Http\Controllers\Api\Api;
|
|
use App\Http\Controllers\Api\Api;
|
|
use App\Models\Custom as Model;
|
|
use App\Models\Custom as Model;
|
|
use App\Models\WeiBan\Qrcode as WeiBanQrcode;
|
|
use App\Models\WeiBan\Qrcode as WeiBanQrcode;
|
|
@@ -36,8 +37,20 @@ class Custom extends Api{
|
|
if( !$custom['weiban_extid'] ) {
|
|
if( !$custom['weiban_extid'] ) {
|
|
// 通过手机号查询注册的账号
|
|
// 通过手机号查询注册的账号
|
|
$custom['weiban_extid'] = (string) $WeiBanFollow->query()->where([['phone_number','=',$custom['phone']]])->value('weiban_extid');
|
|
$custom['weiban_extid'] = (string) $WeiBanFollow->query()->where([['phone_number','=',$custom['phone']]])->value('weiban_extid');
|
|
- // 如果存在的话,修正
|
|
|
|
- if( $custom['weiban_extid'] ) $Model->edit($custom['uid'],['weiban_extid'=>$custom['weiban_extid']]);
|
|
|
|
|
|
+ // 不存在,通过接口获取数据
|
|
|
|
+ if( !$custom['weiban_extid'] ) {
|
|
|
|
+ // 获取用户列表
|
|
|
|
+ $userList = OpenApi::getUserListByPhone($custom['phone']);
|
|
|
|
+ // 如果有的话
|
|
|
|
+ if( $userList ) {
|
|
|
|
+ // 获取第一个
|
|
|
|
+ $extUser = array_shift($userList);
|
|
|
|
+ // 获取对应的ID
|
|
|
|
+ $custom['weiban_extid'] = empty($extUser['id']) ? '' : $extUser['id'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 存在则修正
|
|
|
|
+ if( $custom['weiban_extid'] ) $Model->edit($custom['uid'],['weiban_extid'=>$custom['weiban_extid']]);
|
|
}
|
|
}
|
|
// 头像
|
|
// 头像
|
|
$custom['uid'] = Hashids::encodeHex($custom['uid']);
|
|
$custom['uid'] = Hashids::encodeHex($custom['uid']);
|
|
@@ -45,6 +58,8 @@ class Custom extends Api{
|
|
$custom['userpic'] = $custom['userpic'] ? path_compat($custom['userpic']) : '';
|
|
$custom['userpic'] = $custom['userpic'] ? path_compat($custom['userpic']) : '';
|
|
// 手机号
|
|
// 手机号
|
|
$custom['phone'] = hide_phone($custom['phone']);
|
|
$custom['phone'] = hide_phone($custom['phone']);
|
|
|
|
+ // 二维码
|
|
|
|
+ $followQrcode = $WeiBanQrcode->getFollowQrcode();
|
|
// 所需数组组合,如果没有关联企微,获取二维码,已添加好友的不验证
|
|
// 所需数组组合,如果没有关联企微,获取二维码,已添加好友的不验证
|
|
$custom = [
|
|
$custom = [
|
|
'uid'=>$custom['uid'],
|
|
'uid'=>$custom['uid'],
|
|
@@ -52,9 +67,9 @@ class Custom extends Api{
|
|
'userpic'=>$custom['userpic'],
|
|
'userpic'=>$custom['userpic'],
|
|
'phone'=>$custom['phone'],
|
|
'phone'=>$custom['phone'],
|
|
'company_id'=>1, // 无需验证资质
|
|
'company_id'=>1, // 无需验证资质
|
|
- 'show_price'=>($custom['weiban_extid']?1:0), // 用于判断是否显示价格
|
|
|
|
|
|
+ 'show_price'=>$custom['city_id']?1:0, // 是否选择了城市处理
|
|
'city_id'=>(string)$City->getOne($custom['city_id'],'name'),
|
|
'city_id'=>(string)$City->getOne($custom['city_id'],'name'),
|
|
- 'follow_qrcode'=>($custom['weiban_extid'] ? '' : $WeiBanQrcode->getFollowQrcode())
|
|
|
|
|
|
+ 'follow_qrcode'=>$followQrcode,
|
|
];
|
|
];
|
|
// 返回结果
|
|
// 返回结果
|
|
return json_send(['code'=>'success','msg'=>'获取成功','data'=>$custom]);
|
|
return json_send(['code'=>'success','msg'=>'获取成功','data'=>$custom]);
|