load(); // $content = "{\"gross\": {\"10131\": [157690, 54, 157636, 0.34, 24.19, 0.005973]}, \"detail\": {\"10131-5-30\": [143, 5, 138, 0.03497, 1.44, 0.0096], \"10131-6-100\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-5-100\": [13, 2, 11, 0.15385, 1.0, 0.005], \"10131-6-50\": [0, 0, 0, 0.0, 0.0, 0.0], \"10131-4-50\": [52224, 20, 52204, 0.00038, 9.25, 0.00925], \"10131-4-100\": [105233, 27, 105206, 0.00026, 12.5, 0.00463], \"10131-5-50\": [6, 0, 6, 0.0, 0.0, 0.0], \"10131-4-30\": [6, 0, 6, 0.0, 0.0, 0.0]}, \"types\": {\"10131-5\": [162, 7, 155, 0.04321, 2.44, 0.006971], \"10131-6\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-4\": [157463, 47, 157416, 0.000298, 21.75, 0.005878]}}"; $content = "{\"gross\": {\"10131\": [157690, 54, 157636, 0.21, 24.19, 0.005973]}, \"detail\": {\"10131-5-30\": [143, 5, 138, 0.03497, 1.44, 0.0096], \"10131-6-100\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-5-100\": [13, 2, 11, 0.15385, 1.0, 0.005], \"10131-6-50\": [0, 0, 0, 0.0, 0.0, 0.0], \"10131-4-50\": [52224, 20, 52204, 0.00038, 9.25, 0.00925], \"10131-4-100\": [105233, 27, 105206, 0.00026, 12.5, 0.00463], \"10131-5-50\": [6, 0, 6, 0.0, 0.0, 0.0], \"10131-4-30\": [6, 0, 6, 0.0, 0.0, 0.0]}, \"types\": {\"10131-5\": [162, 7, 155, 0.21321, 2.44, 0.006971], \"10131-6\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-4\": [157463, 47, 157416, 0.208, 21.75, 0.005878]}}"; $counts = json_decode($content,true); $gross = $counts['gross']; $detail = $counts['detail']; $types = $counts['types']; $imate->update($gross, $detail, $types); [$match,$can_last] = $imate->ratio_match(10131, 14, 5, 30, [1, 2]); Log::record("match={$match},can_last={$can_last}",Log::DEBUG); } public function testFactory() { $content = "{\"gross\": {\"10131\": [157690, 54, 157636, 0.21, 24.19, 0.005973]}, \"detail\": {\"10131-5-30\": [143, 5, 138, 0.03497, 1.44, 0.0096], \"10131-6-100\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-5-100\": [13, 2, 11, 0.15385, 1.0, 0.005], \"10131-6-50\": [0, 0, 0, 0.0, 0.0, 0.0], \"10131-4-50\": [52224, 20, 52204, 0.00038, 9.25, 0.00925], \"10131-4-100\": [105233, 27, 105206, 0.00026, 12.5, 0.00463], \"10131-5-50\": [6, 0, 6, 0.0, 0.0, 0.0], \"10131-4-30\": [6, 0, 6, 0.0, 0.0, 0.0]}, \"types\": {\"10131-5\": [162, 7, 155, 0.21321, 2.44, 0.006971], \"10131-6\": [65, 0, 65, 0.0, 0.0, 0.0], \"10131-4\": [157463, 47, 157416, 0.208, 21.75, 0.005878]}}"; $counts = json_decode($content,true); $gross = $counts['gross']; $detail = $counts['detail']; $types = $counts['types']; refill\RefillFactory::instance()->UpdateMchRatios($gross,$detail,$types); } }