Commit 0f144f3d by 赵增煜

限购bug修复

parent d0f5de83
......@@ -109,11 +109,14 @@ public function drugLimit(Request $request)
if ($prescriptions->count() > 0) {
foreach ($prescriptions as $prescription) {
// $drugs = json_decode($prescription->drug_info, true); // Parse JSON data
$drugs = $prescription->drugInfo;
foreach ($drugs as $drug) {
$drugId = $drug['drug_id'];
$drugCounts[$drugId] = ($drugCounts[$drugId] ?? 0) + $drug['num'];
$drugs = $prescription->drug_info;
if (count($drugs) > 0) {
foreach ($drugs as $drug) {
$drugId = $drug['drug_id'];
$drugCounts[$drugId] = ($drugCounts[$drugId] ?? 0) + $drug['num'];
}
}
}
}
......
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