ContactController.php 1.8 KB
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace api\home\controller;

use cmf\controller\RestBaseController;

/**
 * @title 联系我们
 */
class ContactController extends RestBaseController
{

    /**
     * @title 联系我们详情
     * @description 接口说明
     * @author 开发者
     * @url /api/home/contact/contactDetail
     * @method GET
     *
     * @param name:language type:string require:0 default: other desc:语言切换(英文传递此字段(en),中文无需传递)
     *
     * @return id:联系我们id
     * @return company_name:公司名称
     * @return address:地址
     * @return mobile:电话
     * @return phone:手机
     * @return wx:微信
     * @return email:邮箱
     */
    public function contactDetail(){
        $language = $this->request->param('language');
        if(isset($language) && !empty($language)){
            //英文
            $field_contact = 'id,company_name_en company_name,address_en address,mobile,phone,wx,email';
        }else{
            //中文
            $field_contact = 'id,company_name,address,mobile,phone,wx,email';
        }
        $res = CommonController::findData('contact',['id'=>1],$field_contact);
        $this->success('成功',$res);
    }
}