Example #1
0
        if (empty($order_data)) {
            die('NO_' . $lang_module['payment_erorr']);
        } elseif ($point < $order_point) {
            die('NO_' . $lang_module['point_payment_error_money']);
        } else {
            $transaction_status = 4;
            $payment_id = 0;
            $payment_amount = 0;
            $payment_data = '';
            $payment = '';
            $userid = $user_info['userid'];
            $transaction_id = $db->insert_id("INSERT INTO " . $db_config['prefix'] . "_" . $module_data . "_transaction (transaction_id, transaction_time, transaction_status, order_id, userid, payment, payment_id, payment_time, payment_amount, payment_data) VALUES (NULL, " . NV_CURRENTTIME . ", '" . $transaction_status . "', '" . $order_id . "', '" . $userid . "', '" . $payment . "', '" . $payment_id . "', " . NV_CURRENTTIME . ", '" . $payment_amount . "', '" . $payment_data . "')");
            if ($transaction_id > 0) {
                $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $transaction_status . ", transaction_id=" . $transaction_id . ", transaction_count=transaction_count+1 WHERE order_id=" . $order_id);
                // Cap nhat diem tich luy
                UpdatePoint($order_data);
                $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_point SET point_total=point_total - " . $order_point . " WHERE userid=" . $userid);
                $db->query("INSERT INTO " . $db_config['prefix'] . "_" . $module_data . "_point_history(userid, order_id, point, time) VALUES (" . $userid . ", " . $order_id . ", -" . $order_point . ", " . NV_CURRENTTIME . ")");
            }
            nv_del_moduleCache($module_name);
            die('OK_' . $lang_module['payment_complete']);
        }
    }
}
$data_content['point'] = $point;
$data_content['money'] = $point * $pro_config['point_conversion'];
$data_content['money'] = nv_number_format($data_content['money'], nv_get_decimals($pro_config['money_unit']));
$data_content['money_unit'] = $pro_config['money_unit'];
// Lich su thuc hien
$db->sqlreset()->select('COUNT(*)')->from($db_config['prefix'] . '_' . $module_data . '_point_history t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $module_data . '_orders t2 ON t1.order_id = t2.order_id')->where('userid = ' . $user_info['userid']);
$all_page = $db->query($db->sql())->fetchColumn();
Example #2
0
     UpdatePoint($data_content, false);
     nv_insert_logs(NV_LANG_DATA, $module_name, 'Drop payment product', "Order code: " . $data_content['order_code'], $admin_info['userid']);
     $contents = $lang_module['order_submit_unpay_ok'];
     nv_del_moduleCache($module_name);
 } elseif ($action == 'pay') {
     $transaction_status = 4;
     $payment_id = 0;
     $payment_amount = $data_content['order_total'];
     $payment_data = '';
     $payment = '';
     $userid = $admin_info['userid'];
     $transaction_id = $db->insert_id("INSERT INTO " . $db_config['prefix'] . "_" . $module_data . "_transaction (transaction_id, transaction_time, transaction_status, order_id, userid, payment, payment_id, payment_time, payment_amount, payment_data) VALUES (NULL, " . NV_CURRENTTIME . ", '" . $transaction_status . "', '" . $order_id . "', '" . $userid . "', '" . $payment . "', '" . $payment_id . "', " . NV_CURRENTTIME . ", '" . $payment_amount . "', '" . $payment_data . "')");
     if ($transaction_id > 0) {
         $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $transaction_status . ", transaction_id=" . $transaction_id . ", transaction_count=transaction_count+1 WHERE order_id=" . $order_id);
         //Cap nhat diem tich luy
         UpdatePoint($data_content);
         nv_insert_logs(NV_LANG_DATA, $module_name, 'Log payment product', "Order code: " . $data_content['order_code'], $admin_info['userid']);
     }
     // Gửi mail xác nhận thanh toán
     $content = '';
     $email_contents_table = call_user_func('email_new_order_payment', $content, $data_content, $data_pro, true);
     $checkss = md5($order_id . $global_config['sitekey'] . session_id());
     $review_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=payment&order_id=' . $order_id . '&checkss=' . $checkss;
     $replace_data = array('order_code' => $data_content['order_code'], 'order_name' => $data_content['order_name'], 'order_email' => $data_content['order_email'], 'order_phone' => $data_content['order_phone'], 'order_address' => $data_content['order_address'], 'order_note' => $data_content['order_note'], 'order_total' => nv_number_format($data_content['order_total']), 'unit_total' => $data_content['unit_total'], 'dateup' => nv_date("d-m-Y", $data_content['order_time']), 'moment' => nv_date("H:i", $data_content['order_time']), 'review_url' => '<a href="' . $global_config['site_url'] . $review_url . '">' . $lang_module['here'] . '</a>', 'table_product' => $email_contents_table, 'site_url' => $global_config['site_url'], 'site_name' => $global_config['site_name']);
     $content_file = NV_ROOTDIR . '/' . NV_DATADIR . '/' . NV_LANG_DATA . '_' . $module_data . '_order_payment_content.txt';
     if (file_exists($content_file)) {
         $content = file_get_contents($content_file);
         if (empty($content)) {
             $content = $lang_module['order_email_payment'];
         }
         $content = nv_editor_br2nl($content);