<?php

namespace App\Http\Controllers\API\Admin\YeWu;

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

class ArticleController extends Controller
{
  public function GetList()
  {
    $searchInfo=request('searchInfo');
    $list = DB::table('articles')->where(['type'=>$searchInfo['ArticleType'],'is_del'=>0,'status'=>1]);
    $count=$list->count();
    $list=$list->orderBy('order','asc')->get();
    return \Yz::Return(true,"查询完成",['list'=>$list,'count'=>$count]);
  }
  public function Save()
  {

  }

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

  }
}
