<?php

namespace App\Http\Controllers\API\H5;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ArticleController extends Controller
{
  //获取列表
  public function GetList()
  {
    $type=request('type');
    $list = DB::table('articles')->where(['type'=>$type,'is_del'=>0])->get();
    return \Yz::Return(true,"查询完成",['list'=>$list]);
  }

  //获取详情
  public function GetDetail()
  {
    $id=request('id');
    $info = DB::table('articles')->where(['id'=>$id,'is_del'=>0])->first();
    if($info){
      return \Yz::Return(true,"查询完成",['info'=>$info]);
    }else{
      return \Yz::echoError1("文章内容查询失败");
    }

  }
}
