getAdminInfoAll($channel_id); // $wechat = new WeChatObject($adminConfig); // $officialAccount = $wechat->getOfficialAccount(); // $shortUrl = $officialAccount->url->shorten($source_url); // if (!isset($shortUrl['errcode']) || $shortUrl['errcode'] != 0) { // return false; // } // return $shortUrl['short_url']; // }catch (\Exception $e){ // Log::notice("腾讯短连接生成失败,SourceURL:{$source_url} Error:".$e->getMessage()); // return false; // } } /** * 生成sina短链 * @param $source_url string 原始链接 * @return bool|string */ public function sina($source_url){ return false; // try{ // $client = new Http; // $sinaAppIds = ['3167852394', '896597265', '627893179', '2536438578', '2449189067', '1254322903', '1631645512', '539676626', '985865594', '1630884126', '426002535', '36004745', '2869574319', '969499444', '3375473254', '3152384273', '811319594', '2996984438']; // shuffle($sinaAppIds); // $sinaAppId = array_pop($sinaAppIds); // $res = $client->request('GET','https://api.t.sina.com.cn/short_url/shorten.json?source=' . $sinaAppId . '&url_long=' . urlencode($source_url)); // if ($res->getStatusCode() != '200') { // Log::notice("微博短连接生成失败,SourceURL:{$source_url} Error:API返回状态错误!"); // return false; // } // $data = json_decode($res->getBody(), true); // if (!isset($data[0]['type']) || $data[0]['type'] != 0) { // Log::notice("微博短连接生成失败,SourceURL:{$source_url} Error:API返回内容错误!"); // return false; // }else { // return $data[0]['url_short']; // } // }catch (\GuzzleHttp\Exception\GuzzleException $e){ // Log::notice("微博短连接生成失败,SourceURL:{$source_url} Error:".$e->getMessage()); // return false; // }catch (\Exception $e){ // Log::notice("微博短连接生成失败,SourceURL:{$source_url} Error:".$e->getMessage()); // return false; // } } }