123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace App\Http\Controllers\Api\V1;
- use Illuminate\Http\Request;
- use App\Facades\MentalityDrillFacade;
- use App\Facades\ScaleFacade;
- use App\Facades\SpecialistInfoFacade;
- class CommendController extends BaseController
- {
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function index()
- {
- $commentTag = request('comment_tag');
- if ($commentTag){
- $commentTag = explode(',', $commentTag);
- }
- $conditions = [
- 'comment_tag' => $commentTag
- ];
- $fields = ['*'];
- $page = request('page', 1);
- $limit = request('limit', 20);
- switch (request('type')){
- case 1: //训练
- $sort = '`number_of_studies` desc, `id` desc';
- return MentalityDrillFacade::getList($conditions, $fields, $sort, $page, $limit);
- break;
- case 2: //量表
- $sort = '`number_of_test` desc, `id` desc';
- return ScaleFacade::getList($conditions, $fields, $sort, $page, $limit);
- break;
- case 3: //文章(专家来了)
- $sort = '`number_of_studies` desc, `id` desc';
- return SpecialistInfoFacade::getList($conditions, $fields, $sort, $page, $limit);
- break;
- }
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\Response
- */
- public function store(Request $request)
- {
- //
- }
- /**
- * Display the specified resource.
- *
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function show($id)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, $id)
- {
- //
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function destroy($id)
- {
- //
- }
- }
|