|
|
@@ -3,12 +3,9 @@
|
|
|
namespace App\Http\Controllers\Api\v1;
|
|
|
|
|
|
use App\Http\Controllers\Api\BaseController;
|
|
|
-use App\Http\Validator\ArticleValidator;
|
|
|
-use App\Services\ArticleBooksService;
|
|
|
-use App\Services\ArticleCatesService;
|
|
|
-use App\Services\ArticleService;
|
|
|
use App\Services\ConfigService;
|
|
|
-use App\Services\GongdengFoxiangService;
|
|
|
+use App\Services\FoxiangCatesService;
|
|
|
+use App\Services\FoxiangService;
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
/**
|
|
|
@@ -30,8 +27,8 @@ class FoxiangController extends BaseController
|
|
|
{
|
|
|
parent::__construct();
|
|
|
|
|
|
- $this->service = new GongdengFoxiangService();
|
|
|
- $this->cateService = new Foxiangc();
|
|
|
+ $this->service = new FoxiangService();
|
|
|
+ $this->cateService = new FoxiangCatesService();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -44,36 +41,6 @@ class FoxiangController extends BaseController
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 详情
|
|
|
- * @return array|mixed
|
|
|
- */
|
|
|
- public function info(){
|
|
|
- $id = request()->get('id',0);
|
|
|
- if($id<=0){
|
|
|
- return message(1006, false);
|
|
|
- }
|
|
|
-
|
|
|
- $this->service->updateVisit($this->userId);
|
|
|
- $info = $this->service->getDetail($id, $this->userId);
|
|
|
- return message(1005, true, $info);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 报名
|
|
|
- * @param Request $request
|
|
|
- * @param ArticleValidator $validate
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function books(Request $request, ArticleValidator $validate){
|
|
|
- $params = $validate->check($request->all(),'books');
|
|
|
- if(!is_array($params)){
|
|
|
- return message($params, false);
|
|
|
- }
|
|
|
- $params['user_id'] = $this->userId;
|
|
|
- return $this->bookService->books($params);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 获取文章分类
|
|
|
* @return mixed
|
|
|
*/
|
|
|
@@ -81,27 +48,4 @@ class FoxiangController extends BaseController
|
|
|
return $this->cateService->getOptions();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 单页文章内容
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function page(){
|
|
|
- $code = request()->get('code', '');
|
|
|
- if(empty($code)){
|
|
|
- return message('参数错误', false);
|
|
|
- }
|
|
|
-
|
|
|
- $pageId = ConfigService::make()->getConfigByCode($code);
|
|
|
- if($pageId<=0){
|
|
|
- return message(1006, false);
|
|
|
- }
|
|
|
-
|
|
|
- $info = ArticleService::make()->getDetail($pageId);
|
|
|
- if($info){
|
|
|
- return message(1005, true, $info);
|
|
|
- }else{
|
|
|
- return message(1006, false);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
}
|