apiService = $apiService; $this->shorty = new Shorty(config("app.domain")); } /** * @param string url 生成短地址的url * @return array * @throws \App\Base\Exceptions\ApiException * @throws * @api get /api/short 获取短地址 * @group 短地址 * @successExample * {"ret":0,"msg":"success.","data":{"id":2,"name":"物性任光保","remark":"nisi nostrud velit culpa ad","sort":100}} */ public function getShortUrl(Request $request) { $this->validate($request, [ 'url' => 'required' ], [ 'url.required' => "url不能为空" ]); return $this->apiService->getShortUrl($request->input("url")); } /** * @param string url 生成短地址的url * @return array * @throws \App\Base\Exceptions\ApiException * @throws * @api get /api/short-hits 获取短地址访问量 * @group 短地址 * @successExample * {"ret":0,"msg":"success.","data":[]} */ public function getShortUrlHits(Request $request) { $this->validate($request, [ 'url' => 'required' ], [ 'url.required' => "url不能为空" ]); return $this->apiService->getShortUrlHits($request->input("url")); } }