正在显示
3 个修改的文件
包含
50 行增加
和
10 行删除
| @@ -39,13 +39,6 @@ yYLxCJT7DN8dOK/VU6AVL1Luj3qNP+k2tB2GgNBzAWHK8ou9t2/3HU8DtofuikUe | @@ -39,13 +39,6 @@ yYLxCJT7DN8dOK/VU6AVL1Luj3qNP+k2tB2GgNBzAWHK8ou9t2/3HU8DtofuikUe | ||
| 39 | yx8Cccca9B4OF8nBAkAgIUZKGmVNFcGnFFo55vSJInNXFo4HCJ2o4DunBORVtQ/j | 39 | yx8Cccca9B4OF8nBAkAgIUZKGmVNFcGnFFo55vSJInNXFo4HCJ2o4DunBORVtQ/j |
| 40 | zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | 40 | zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K |
| 41 | -----END RSA PRIVATE KEY-----"; | 41 | -----END RSA PRIVATE KEY-----"; |
| 42 | - /** | ||
| 43 | - * @name :参数构建 | ||
| 44 | - */ | ||
| 45 | - public function __construct() | ||
| 46 | - { | ||
| 47 | - $this->headers['Authorization'] = $this->headers['Authorization'].$this->api_key; | ||
| 48 | - } | ||
| 49 | 42 | ||
| 50 | /** | 43 | /** |
| 51 | * @name :(创建子账户配置文件)post_create_profiles | 44 | * @name :(创建子账户配置文件)post_create_profiles |
| @@ -99,7 +92,20 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | @@ -99,7 +92,20 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | ||
| 99 | * @time :2023/5/6 16:01 | 92 | * @time :2023/5/6 16:01 |
| 100 | */ | 93 | */ |
| 101 | public function get_profiles(){ | 94 | public function get_profiles(){ |
| 95 | + $url = $this->path.'/api/profiles'; | ||
| 96 | + return $this->http_click('get',$url,[]); | ||
| 97 | + } | ||
| 102 | 98 | ||
| 99 | + /** | ||
| 100 | + * @name :(获取所有用户的配置文件)get_profiles_users | ||
| 101 | + * @author :lyh | ||
| 102 | + * @method :post | ||
| 103 | + * @time :2023/5/6 16:44 | ||
| 104 | + */ | ||
| 105 | + public function get_profiles_users($api_key){ | ||
| 106 | + $this->headers['Authorization'] = $this->headers['Authorization'].$api_key; | ||
| 107 | + $url = $this->path.'/api/user'; | ||
| 108 | + return $this->http_click('get',$url,[],$this->headers); | ||
| 103 | } | 109 | } |
| 104 | /** | 110 | /** |
| 105 | * @name :(通过用户名获取社交账号)get_brand_user | 111 | * @name :(通过用户名获取社交账号)get_brand_user |
| @@ -223,6 +229,9 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | @@ -223,6 +229,9 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | ||
| 223 | if(!empty($param)){ | 229 | if(!empty($param)){ |
| 224 | $post_data['json'] = $param; | 230 | $post_data['json'] = $param; |
| 225 | } | 231 | } |
| 232 | + if(empty($header)){ | ||
| 233 | + $this->headers['Authorization'] = $this->headers['Authorization'].$this->api_key; | ||
| 234 | + } | ||
| 226 | $post_data['headers'] = !empty($header) ? $header : $this->headers; | 235 | $post_data['headers'] = !empty($header) ? $header : $this->headers; |
| 227 | $client = new Client(); | 236 | $client = new Client(); |
| 228 | try { | 237 | try { |
| @@ -21,6 +21,10 @@ class AyrShareController extends BaseController | @@ -21,6 +21,10 @@ class AyrShareController extends BaseController | ||
| 21 | */ | 21 | */ |
| 22 | public function lists(AyrShareModel $ayrShareModel){ | 22 | public function lists(AyrShareModel $ayrShareModel){ |
| 23 | $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['*']); | 23 | $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['*']); |
| 24 | + $ayrShareHelper = new AyrShareHelper(); | ||
| 25 | + foreach ($lists['list'] as $k=>$v){ | ||
| 26 | + $lists['list'][$k]['ayr'] = $ayrShareHelper->get_profiles_users($v['profile_key']); | ||
| 27 | + } | ||
| 24 | $this->response('列表',Code::SUCCESS,$lists); | 28 | $this->response('列表',Code::SUCCESS,$lists); |
| 25 | } | 29 | } |
| 26 | 30 | ||
| @@ -88,7 +92,6 @@ class AyrShareController extends BaseController | @@ -88,7 +92,6 @@ class AyrShareController extends BaseController | ||
| 88 | //发送请求注册社交用户 | 92 | //发送请求注册社交用户 |
| 89 | $ayrShareHelper = new AyrShareHelper(); | 93 | $ayrShareHelper = new AyrShareHelper(); |
| 90 | $data = [ | 94 | $data = [ |
| 91 | - 'domain'=>'develop.globalso.com', | ||
| 92 | 'profileKey'=>$info['profile_key'] | 95 | 'profileKey'=>$info['profile_key'] |
| 93 | ]; | 96 | ]; |
| 94 | $res = $ayrShareHelper->post_generate_jwt($data); | 97 | $res = $ayrShareHelper->post_generate_jwt($data); |
| @@ -97,4 +100,31 @@ class AyrShareController extends BaseController | @@ -97,4 +100,31 @@ class AyrShareController extends BaseController | ||
| 97 | } | 100 | } |
| 98 | $this->response('success',Code::SUCCESS,$res); | 101 | $this->response('success',Code::SUCCESS,$res); |
| 99 | } | 102 | } |
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * @name :(获取当前用户的配置文件)get_profiles | ||
| 106 | + * @author :lyh | ||
| 107 | + * @method :post | ||
| 108 | + * @time :2023/5/6 16:39 | ||
| 109 | + */ | ||
| 110 | + public function get_profiles(AyrShareLogic $ayrShareLogic){ | ||
| 111 | + $this->request->validate([ | ||
| 112 | + 'id'=>['required'] | ||
| 113 | + ],[ | ||
| 114 | + 'id.required' => 'ID不能为空' | ||
| 115 | + ]); | ||
| 116 | + $info = $ayrShareLogic->ayr_share_info(); | ||
| 117 | + //发送请求注册社交用户 | ||
| 118 | + $ayrShareHelper = new AyrShareHelper(); | ||
| 119 | + $data = [ | ||
| 120 | + 'title'=>$info['title'], | ||
| 121 | + 'refId'=>$info['ref_id'], | ||
| 122 | + 'profileKeys'=>$info['profile_keys'] | ||
| 123 | + ]; | ||
| 124 | + $res = $ayrShareHelper->post_generate_jwt($data); | ||
| 125 | + if($res['status'] == 'fail'){ | ||
| 126 | + $this->response($res['message'],Code::USER_ERROR); | ||
| 127 | + } | ||
| 128 | + $this->response('success',Code::SUCCESS,$res); | ||
| 129 | + } | ||
| 100 | } | 130 | } |
| @@ -24,14 +24,15 @@ class AyrShareLogic extends BaseLogic | @@ -24,14 +24,15 @@ class AyrShareLogic extends BaseLogic | ||
| 24 | */ | 24 | */ |
| 25 | public function ayr_share_add($res){ | 25 | public function ayr_share_add($res){ |
| 26 | //插入数据库 | 26 | //插入数据库 |
| 27 | - $this->param = [ | 27 | + $param = [ |
| 28 | 'title'=>$res['title'], | 28 | 'title'=>$res['title'], |
| 29 | 'ref_id'=>$res['refId'], | 29 | 'ref_id'=>$res['refId'], |
| 30 | 'profile_key'=>$res['profileKey'], | 30 | 'profile_key'=>$res['profileKey'], |
| 31 | 'user_id'=>$this->user['id'], | 31 | 'user_id'=>$this->user['id'], |
| 32 | 'project_id'=>$this->user['project_id'], | 32 | 'project_id'=>$this->user['project_id'], |
| 33 | + 'name'=>$this->param['name'], | ||
| 33 | ]; | 34 | ]; |
| 34 | - $rs = $this->model->add($this->param); | 35 | + $rs = $this->model->add($param); |
| 35 | if($rs === false){ | 36 | if($rs === false){ |
| 36 | $this->fail('error'); | 37 | $this->fail('error'); |
| 37 | } | 38 | } |
-
请 注册 或 登录 后发表评论