Exemplo n.º 1
0
function log_pay_info($pay_inf = "")
{
    $today_str = date("Ymd");
    $log_fname = log_pay_path("log_pay_{$today_str}.txt");
    $handle_file = fopen($log_fname, "a") or die("ERROR TO OPEN {$log_fname}!");
    if (!lock_file_until_ms($handle_file, 300)) {
        fclose($handle_file);
        return false;
    }
    fwrite($handle_file, "[PAY-INFO-BEGIN]\n");
    fwrite($handle_file, $pay_inf);
    fwrite($handle_file, "[PAY-INFO-END]\n\n");
    fclose($handle_file);
    return true;
}
Exemplo n.º 2
0
function impl_book_lock_timeslot($vdate, $timeslot)
{
    $path = __impl_book_lock_timeslot_setting_path($vdate, $timeslot);
    if (file_exists($path)) {
        return BOOK_CODE_OK;
    }
    $json_str = json_encode(array());
    $handle_f = fopen($path, "w") or die("ERROR to open {$path}!");
    $wouldLock = 1;
    if (!lock_file_until_ms($handle_f, 100)) {
        fclose($handle_f);
        return BOOK_CODE_ERR_UNKNOWN;
    }
    fwrite($handle_f, $json_str);
    fclose($handle_f);
    return BOOK_CODE_OK;
}