|
|
|
|
@ -5,6 +5,7 @@ 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
|
|
|
|
|
{
|
|
|
|
|
@ -20,16 +21,23 @@ class HomeController extends Controller
|
|
|
|
|
// 获取配置更新时间
|
|
|
|
|
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' => [[
|
|
|
|
|
'id' => 1,
|
|
|
|
|
'name' => '秀英院区',
|
|
|
|
|
'latitude' => '39.867671',
|
|
|
|
|
'longitude' => '119.514223',
|
|
|
|
|
]],
|
|
|
|
|
'tip' => '海南现代妇女儿童医院体检中心欢迎您',
|
|
|
|
|
'logo' => '/assets/h5/logo.png',
|
|
|
|
|
'banner' => '/assets/h5/banner.png',
|
|
|
|
|
'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' => '个人体检预约',
|
|
|
|
|
@ -81,4 +89,13 @@ class HomeController extends Controller
|
|
|
|
|
'config' => $config
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getValueByLabel($items, $label) {
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
if ($item->label === $label) {
|
|
|
|
|
return $item->value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null; // 如果没有找到匹配的 label,则返回 null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|