Files
zzp-server/app/api/controller/IndexController.php
2026-01-19 14:19:22 +08:00

125 lines
2.9 KiB
PHP

<?php
namespace app\api\controller;
use app\api\logic\IndexLogic;
use think\response\Json;
/**
* index
* Class IndexController
* @package app\api\controller
*/
class IndexController extends BaseApiController
{
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'countryCode', 'getKefuLists', 'market'];
/**
* @notes 首页数据
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2023/9/21 19:15
*/
public function index()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = IndexLogic::getIndexData($params);
return $this->data($result);
}
/**
* @notes 全局配置
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2023/9/21 19:41
*/
public function config()
{
$lang = $this->request->get('lang/s');
$result = IndexLogic::getConfigData($lang);
return $this->data($result);
}
/**
* @notes 国家区号
* @return Json
* @author BD
* @date 2023/9/21 18:37
*/
public function countryCode()
{
$result = IndexLogic::getCountryCode();
return $this->data($result);
}
/**
* @notes 装修信息
* @return Json
* @author BD
* @date 2023/9/21 18:37
*/
public function decorate()
{
$id = $this->request->get('id/d');
$result = IndexLogic::getDecorate($id);
return $this->data($result);
}
/**
* @notes 获取所有语言
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2023/10/13 10:54
*/
public function getKefuLists()
{
$params = $this->request->get();
$result = IndexLogic::getKefuLists($params);
return $this->data($result);
}
// /**
// * @notes 政策协议
// * @return Json
// * @author BD
// * @date 2023/9/20 20:00
// */
// public function policy()
// {
// $type = $this->request->get('type/s', '');
// $result = IndexLogic::getPolicyByType($type);
// return $this->data($result);
// }
/**
* @notes 行情数据
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2023/10/13 10:54
*/
public function market()
{
$result = IndexLogic::getMarketData();
return $this->data($result);
}
}