假設有貨幣A 貨幣B
兌換比例 A : B = 500 : 1
妳去對換 250 的 A 到 B
結果會A 扣除 250 元 B 增加 1 元
兌換 0.5 的 B 到 A
結果會 B 沒有扣除 A 增加 250 元
修正辦法:
-----[開啟]-----
代碼: 選擇全部
cash.php代碼: 選擇全部
$converted_amount = (($convert_amount/$c_cur_from->data('cash_exchange'))*$c_cur_to->data('cash_exchange'));
$exchanger->remove_by_id_array(array($c_cur_from->id() => $convert_amount));
$exchanger->give_by_id_array(array($c_cur_to->id() => $converted_amount));代碼: 選擇全部
$convert_amount = floor( $convert_amount * pow(10,$c_cur_from->data('cash_decimals')) ) / pow(10,$c_cur_from->data('cash_decimals'));
$converted_amount_to = (($convert_amount/$c_cur_from->data('cash_exchange'))*$c_cur_to->data('cash_exchange'));
$converted_amount_to = floor( $converted_amount_to * pow(10,$c_cur_to->data('cash_decimals')) ) / pow(10,$c_cur_to->data('cash_decimals'));
$converted_amount_from = (($converted_amount_to/$c_cur_to->data('cash_exchange'))*$c_cur_from->data('cash_exchange'));
$converted_amount_from = floor( $converted_amount_from * pow(10,$c_cur_from->data('cash_decimals')) ) / pow(10,$c_cur_from->data('cash_decimals'));
$exchanger->remove_by_id_array(array($c_cur_from->id() => $converted_amount_from));
$exchanger->give_by_id_array(array($c_cur_to->id() => $converted_amount_to));*****
我的英文不好\r
並沒去看原作者有沒有比較好處理方法

