Commit 0f144f3d by 赵增煜

限购bug修复

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