<?php
namespace app\appapi\controller;

use app\appapi\BaseController;
use support\Request;
use think\facade\Db;

class AboutController extends BaseController
{
    public function getAbout(Request $request)
    {
        $param = $request->get();
        // $where[] = ['lang', $param['lang']];

        $article = Db::name('article')
            ->where('cat_id',$param['id'])
            ->where('lang',$param['lang'])
            ->value('content');

        $result = $article;

        return $this->Success($result);
    }

    public function getBannerList(Request $request)
    {
        $param = $request->get();
        // $where[] = ['lang', $param['lang']];

        $list = Db::name('banner')
            // ->where('lang',$param['lang'])
            ->order('id', 'desc')
            ->select()
            ->toArray();


        foreach($list as $key => $val){
            $list[$key]['imageurl1'] = getUrl().$val['imageurl1'];
            $list[$key]['imageurl2'] = getUrl().$val['imageurl2'];
        }

        $result = $list;

        return $this->Success($result);
    }

    public function getSupplierList(Request $request)
    {
        $param = $request->get();
        // $where[] = ['lang', $param['lang']];

        $list = Db::name('supplier')
            // ->where('lang',$param['lang'])
            ->order('id', 'desc')
            ->select()
            ->toArray();


        foreach($list as $key => $val){
            $list[$key]['imageurl'] = getUrl().$val['imageurl'];
        }

        $result = $list;

        return $this->Success($result);
    }

}
