Commit 6ccea13d by 赵增煜

去除类型判断

parent 2b7f87e0
...@@ -40,19 +40,19 @@ public function prescriptionList(Request $request) ...@@ -40,19 +40,19 @@ public function prescriptionList(Request $request)
// TODO 判断当前登录的用户角色 // TODO 判断当前登录的用户角色
// $userInfo = User::with(['doctor', 'pharmacist'])->find($authInfo->id); // $userInfo = User::with(['doctor', 'pharmacist'])->find($authInfo->id);
if ($authInfo->last_login_type == User::LOGIN_TYPE_USER) { 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) { // 医师 } elseif ($authInfo->last_login_type == User::LOGIN_TYPE_DOCTOR) { // 医师
$doctor = DoctorModel::query()->where('user_id', $authInfo->id)->first(); $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) { // 药店 } elseif ($authInfo->last_login_type == User::LOGIN_TYPE_PHARMACY) { // 药店
$pharmacy = PharmacyModel::query()->where('user_id', $authInfo->id)->first(); $pharmacy = PharmacyModel::query()->where('user_id', $authInfo->id)->first();
$query->where('pharmacy_id', $pharmacy->id); $query = $query->where('pharmacy_id', $pharmacy->id);
} }
// 客开 0 店开 1 // 客开 0 店开 1
$open_source = $request->input('open_source'); $open_source = $request->input('open_source');
if (in_array($open_source, [0, 1], true)) { if (in_array($open_source, [0, 1])) {
$query->where('open_source', $open_source); $query = $query->where('open_source', $open_source);
} }
// 时间段 // 时间段
...@@ -67,7 +67,7 @@ public function prescriptionList(Request $request) ...@@ -67,7 +67,7 @@ public function prescriptionList(Request $request)
// 状态 // 状态
$status = $request->input('status'); $status = $request->input('status');
if (in_array($status, [0, 1, 2], true)) { if (in_array($status, [0, 1, 2])) {
$query->where('status', $status); $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