function updateAccount($score, $amt, $id) { $tblAccount = new DB_Pay_Account(); //首先更新账户信息 //更新账户信息,如果失败再重试三次 $retry = 0; $updateAccount = 0; while (!$updateAccount && $retry <= 3) { $updateAccount = $tblAccount->query("update account set amt = {$amt},score = {$score} where id = {$id['id']}"); //$updateAccount = $tblAccount->update($id['id'],array("amt"=>$id['amt']-$creditInfo['price'],"score"=>$id['score']+$creditInfo['amt'])); $retry++; } //账户更新失败返回失败信息 if (!$updateAccount) { return Common_Error::ERROR_UPDATE_BALANCE; } }