优化患者端首页

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\UserDoctor as UserDoctorModel;
use App\Model\UserPharmacist;
use Hyperf\Utils\Parallel;
use Hyperf\Utils\WaitGroup;
/**
* 首页模块
@ -129,7 +131,12 @@ class IndexService extends BaseService
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$wg = new WaitGroup();
$wg->add(4);
// 获取banner
$banner = [];
co(function () use ($wg, &$banner) {
$params = array();
$params["app_type"] = 1;
$params["client_type"] = 1;
@ -142,7 +149,13 @@ class IndexService extends BaseService
}
}
// 计数器减一
$wg->done();
});
// 获取模块
$module = [];
co(function () use ($wg, &$module) {
$params = array();
$params["app_type"] = 1;
$params["client_type"] = 1;
@ -150,16 +163,33 @@ class IndexService extends BaseService
$params["module_status"] = 1;
$module = ModuleModel::getList($params);
$PatientDoctorService = new PatientDoctorService();
// 计数器减一
$wg->done();
});
// 我的医生
$my_doctor = [];
co(function () use ($wg, &$my_doctor,$user_info) {
$PatientDoctorService = new PatientDoctorService();
if (!empty($user_info)) {
$my_doctor = $PatientDoctorService->getIndexPatientDoctorLimit($user_info['client_user_id']);
}
// 计数器减一
$wg->done();
});
// 推荐医生
$recommend_doctor = [];
co(function () use ($wg, &$recommend_doctor) {
$PatientDoctorService = new PatientDoctorService();
$recommend_doctor = $PatientDoctorService->getIndexRecommendDoctorLimit();
// 计数器减一
$wg->done();
});
$wg->wait();
$result = array();
$result["banner"] = $banner ?? [];// banner