<?php

namespace app\api\controller\ContactUs;

use app\BaseController;
use app\common\model\ContactUs\ContactInfo as ModelContactInfo;
use app\common\model\ContactUs\ConsultingHotline as ModelConsultingHotline;
use app\common\model\ContactUs\ContactScancode as ModelContactScancode;
use app\Request;
use think\Validate;
use think\exception\ValidateException;
use think\facade\Filesystem;
use app\common\exception\Tool;


class ContactInfo extends BaseController
{
    /**
     * 获取联系方式内容
     */
    public function getContactInfo(Request $request): array
    {
        $params = $request->param();

        // 联系热线
        $hoteline = ModelConsultingHotline::field([
            'consulting_hotline_user',
            'consulting_hotline_phone',
        ])
            ->order('consulting_hotline_order', 'asc')
            ->select();

        // 联系方式
        $info = ModelContactInfo::field([
            'contact_info_location',
            'longitude',
            'latitude',
            'contact_info_content',
        ])->where(1)->find();

        // 扫码
        $qrcode = ModelContactScancode::field([
            'contact_scancode_title',
            'contact_scancode_img',
            'contact_scancode_icon',
            'contact_scancode_order'
        ])
            ->order('contact_scancode_order', 'asc')
            ->select();


        return [
            'code' => 0,
            'data' => [
                'hoteline' => $hoteline,
                'info' => $info,
                'qrcode' => $qrcode,
            ],
            'msg' => 'ok'
        ];
    }
}
