优化患者端首页

This commit is contained in:
wucongxing 2023-04-17 15:03:24 +08:00
parent bccffc7601
commit ecea390f9b

View File

@ -12,6 +12,8 @@ use App\Model\PharmacistAuditStatistic;
use App\Model\User; use App\Model\User;
use App\Model\UserDoctor as UserDoctorModel; use App\Model\UserDoctor as UserDoctorModel;
use App\Model\UserPharmacist; use App\Model\UserPharmacist;
use Hyperf\Utils\Parallel;
use Hyperf\Utils\WaitGroup;
/** /**
* 首页模块 * 首页模块
@ -129,37 +131,65 @@ class IndexService extends BaseService
{ {
$user_info = $this->request->getAttribute("userInfo") ?? []; $user_info = $this->request->getAttribute("userInfo") ?? [];
$wg = new WaitGroup();
$wg->add(4);
// 获取banner // 获取banner
$params = array(); $banner = [];
$params["app_type"] = 1; co(function () use ($wg, &$banner) {
$params["client_type"] = 1; $params = array();
$params["banner_place"] = 1; $params["app_type"] = 1;
$params["banner_status"] = 1; $params["client_type"] = 1;
$banner = BannerModel::getList($params); $params["banner_place"] = 1;
if (!empty($banner)){ $params["banner_status"] = 1;
foreach ($banner as &$item){ $banner = BannerModel::getList($params);
$item['banner_path'] = addAliyunOssWebsite($item['banner_path']); if (!empty($banner)){
foreach ($banner as &$item){
$item['banner_path'] = addAliyunOssWebsite($item['banner_path']);
}
} }
}
// 计数器减一
$wg->done();
});
// 获取模块 // 获取模块
$params = array(); $module = [];
$params["app_type"] = 1; co(function () use ($wg, &$module) {
$params["client_type"] = 1; $params = array();
$params["module_place"] = 1; $params["app_type"] = 1;
$params["module_status"] = 1; $params["client_type"] = 1;
$module = ModuleModel::getList($params); $params["module_place"] = 1;
$params["module_status"] = 1;
$module = ModuleModel::getList($params);
$PatientDoctorService = new PatientDoctorService(); // 计数器减一
$wg->done();
});
// 我的医生 // 我的医生
$my_doctor = []; $my_doctor = [];
if (!empty($user_info)) { co(function () use ($wg, &$my_doctor,$user_info) {
$my_doctor = $PatientDoctorService->getIndexPatientDoctorLimit($user_info['client_user_id']); $PatientDoctorService = new PatientDoctorService();
}
if (!empty($user_info)) {
$my_doctor = $PatientDoctorService->getIndexPatientDoctorLimit($user_info['client_user_id']);
}
// 计数器减一
$wg->done();
});
// 推荐医生 // 推荐医生
$recommend_doctor = $PatientDoctorService->getIndexRecommendDoctorLimit(); $recommend_doctor = [];
co(function () use ($wg, &$recommend_doctor) {
$PatientDoctorService = new PatientDoctorService();
$recommend_doctor = $PatientDoctorService->getIndexRecommendDoctorLimit();
// 计数器减一
$wg->done();
});
$wg->wait();
$result = array(); $result = array();
$result["banner"] = $banner ?? [];// banner $result["banner"] = $banner ?? [];// banner