|
|
<?php
|
|
|
|
|
|
namespace App\Http\Controllers\API\H5;
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Services\ConfigService;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
{
|
|
|
// 获取配置更新时间
|
|
|
public function config_version()
|
|
|
{
|
|
|
$version= DB::table('configs')->where(['label'=>'H5配置版本'])->first();
|
|
|
$version = $version->value;
|
|
|
return \Yz::Return(true, '获取成功', [
|
|
|
'version' => $version
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
// 获取配置更新时间
|
|
|
public function config()
|
|
|
{
|
|
|
$hospitals=DB::table('hospitals')
|
|
|
->select("id","name","latitude","longitude","logo")
|
|
|
->where(['status'=>1,'is_del'=>0])->get();
|
|
|
if(count($hospitals)<1) return \Yz::echoError1('暂无可用医院信息');
|
|
|
$db_config=DB::table('configs')->whereIn('label',['首页欢迎词','首页banner'])->get();
|
|
|
$config = [
|
|
|
'hospital' => $hospitals
|
|
|
// [[
|
|
|
// 'id' => 1,
|
|
|
// 'name' => '秀英院区',
|
|
|
// 'latitude' => '39.867671',
|
|
|
// 'longitude' => '119.514223',
|
|
|
// ]]
|
|
|
,
|
|
|
'tip' => $this->getValueByLabel($db_config,'首页欢迎词'),
|
|
|
'logo' => $hospitals[0]->logo,
|
|
|
'banner' => $this->getValueByLabel($db_config,'首页banner'),
|
|
|
'order' => [[
|
|
|
'message' => '',
|
|
|
'name' => '个人体检预约',
|
|
|
'jump' => '/pages/main/order/order',
|
|
|
'icon' => '/assets/h5/gejianyuyue.png'
|
|
|
], [
|
|
|
'message' => '',
|
|
|
'name' => '单位体检预约',
|
|
|
'jump' => '/pages/main/combo/combo',
|
|
|
'icon' => '/assets/h5/tuanjianyuyue.png'
|
|
|
]],
|
|
|
'check' => [[
|
|
|
'message' => '暂未开放',
|
|
|
'name' => '报告查询',
|
|
|
'desc' => '查体检报告',
|
|
|
'jump' => '/pages/main/check/check',
|
|
|
'icon' => '/assets/h5/baogao.png'
|
|
|
], [
|
|
|
'message' => '暂未开放',
|
|
|
'name' => '体检中心简介',
|
|
|
'desc' => '健康体检中心',
|
|
|
'jump' => '/pages/main/desc/desc',
|
|
|
'icon' => '/assets/h5/jianjie.png'
|
|
|
]],
|
|
|
'ad' => [
|
|
|
'title' => '6大体检套餐 5折',
|
|
|
'combo' => ['123', '234'],
|
|
|
'button' => '点击购买'
|
|
|
],
|
|
|
'more' => [[
|
|
|
'message' => '暂未开放',
|
|
|
'name' => '满意度调查',
|
|
|
'jump' => '/pages/main/myddc/myddc',
|
|
|
'icon' => '/assets/h5/manyidudiaocha.png'
|
|
|
], [
|
|
|
'message' => '暂未开放',
|
|
|
'name' => '体检注意事项',
|
|
|
'jump' => '/pages/main/zysx/zysx',
|
|
|
'icon' => '/assets/h5/zhuyishixiang.png'
|
|
|
], [
|
|
|
'message' => '暂未开放',
|
|
|
'name' => '常见问题',
|
|
|
'jump' => '/pages/main/cjwt/cjwt',
|
|
|
'icon' => '/assets/h5/changjianwenti.png'
|
|
|
]],
|
|
|
'color' => true,
|
|
|
];
|
|
|
return \Yz::Return(true, '获取成功', [
|
|
|
'config' => $config
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
function getValueByLabel($items, $label) {
|
|
|
foreach ($items as $item) {
|
|
|
if ($item->label === $label) {
|
|
|
return $item->value;
|
|
|
}
|
|
|
}
|
|
|
return null; // 如果没有找到匹配的 label,则返回 null
|
|
|
}
|
|
|
}
|