Commit 6ccea13d by 赵增煜

去除类型判断

parent 2b7f87e0
......@@ -40,19 +40,19 @@ public function prescriptionList(Request $request)
// TODO 判断当前登录的用户角色
// $userInfo = User::with(['doctor', 'pharmacist'])->find($authInfo->id);
if ($authInfo->last_login_type == User::LOGIN_TYPE_USER) {
$query->where('user_id', $authInfo->id);
$query = $query->where('user_id', $authInfo->id);
} elseif ($authInfo->last_login_type == User::LOGIN_TYPE_DOCTOR) { // 医师
$doctor = DoctorModel::query()->where('user_id', $authInfo->id)->first();
$query->where('doctor_id', $doctor->id);
$query = $query->where('doctor_id', $doctor->id);
} elseif ($authInfo->last_login_type == User::LOGIN_TYPE_PHARMACY) { // 药店
$pharmacy = PharmacyModel::query()->where('user_id', $authInfo->id)->first();
$query->where('pharmacy_id', $pharmacy->id);
$query = $query->where('pharmacy_id', $pharmacy->id);
}
// 客开 0 店开 1
$open_source = $request->input('open_source');
if (in_array($open_source, [0, 1], true)) {
$query->where('open_source', $open_source);
if (in_array($open_source, [0, 1])) {
$query = $query->where('open_source', $open_source);
}
// 时间段
......@@ -67,7 +67,7 @@ public function prescriptionList(Request $request)
// 状态
$status = $request->input('status');
if (in_array($status, [0, 1, 2], true)) {
if (in_array($status, [0, 1, 2])) {
$query->where('status', $status);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment