Exemplo n.º 1
0
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: notify_trade.php 34252 2013-11-25 03:12:09Z nemohou $
 */
define('IN_API', true);
define('CURSCRIPT', 'api');
define('DISABLEXSSCHECK', true);
require '../../source/class/class_core.php';
require '../../source/function/function_forum.php';
$discuz = C::app();
$discuz->init();
$apitype = empty($_GET['attach']) || !preg_match('/^[a-z0-9]+$/i', $_GET['attach']) ? 'alipay' : $_GET['attach'];
require_once DISCUZ_ROOT . './api/trade/api_' . $apitype . '.php';
$PHP_SELF = $_SERVER['PHP_SELF'];
$_G['siteurl'] = dhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api\\/trade)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/');
$notifydata = trade_notifycheck('trade');
if ($notifydata['validator']) {
    $orderid = $notifydata['order_no'];
    if ($orderid) {
        $tradelog = C::t('forum_tradelog')->fetch($orderid);
        if ($tradelog && $tradelog['status'] != STATUS_TRADE_SUCCESS && $tradelog['status'] != STATUS_REFUND_CLOSE && ($apitype == 'tenpay' || $tradelog['selleraccount'] == $_REQUEST['seller_email'])) {
            $status = $notifydata['status'];
            C::t('forum_tradelog')->update($orderid, array('status' => $status, 'lastupdate' => $_G['timestamp'], 'tradeno' => $notifydata['trade_no']));
            if ($status != $tradelog['status']) {
                if ($status == STATUS_SELLER_SEND) {
                    notification_add($tradelog['sellerid'], 'goods', 'trade_seller_send', array('buyerid' => $tradelog['buyerid'], 'buyer' => $tradelog['buyer'], 'orderid' => $orderid, 'subject' => $tradelog['subject']));
                } elseif ($status == STATUS_WAIT_BUYER) {
                    notification_add($tradelog['buyerid'], 'goods', 'trade_buyer_confirm', array('sellerid' => $tradelog['sellerid'], 'seller' => $tradelog['seller'], 'orderid' => $orderid, 'subject' => $tradelog['subject']));
                } elseif ($status == STATUS_TRADE_SUCCESS) {
                    if ($_G['setting']['creditstransextra'][5] != -1 && $tradelog['basecredit']) {
                        $netcredit = round($tradelog['number'] * $tradelog['basecredit'] * (1 - $_G['setting']['creditstax']));
Exemplo n.º 2
0
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: notify_credit.php 34251 2013-11-25 03:10:11Z nemohou $
 */
define('IN_API', true);
define('CURSCRIPT', 'api');
define('DISABLEXSSCHECK', true);
require '../../source/class/class_core.php';
require '../../source/function/function_forum.php';
$discuz = C::app();
$discuz->init();
$apitype = empty($_GET['attach']) || !preg_match('/^[a-z0-9]+$/i', $_GET['attach']) ? 'alipay' : $_GET['attach'];
require_once DISCUZ_ROOT . './api/trade/api_' . $apitype . '.php';
$PHP_SELF = $_SERVER['PHP_SELF'];
$_G['siteurl'] = dhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api\\/trade)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/');
$notifydata = trade_notifycheck('credit');
if ($notifydata['validator']) {
    $orderid = $notifydata['order_no'];
    $postprice = $notifydata['price'];
    $order = C::t('forum_order')->fetch($orderid);
    $order = array_merge($order, C::t('common_member')->fetch_by_username($order['uid']));
    if ($order && floatval($postprice) == floatval($order['price']) && ($apitype == 'tenpay' || strtolower($_G['setting']['ec_account']) == strtolower($_REQUEST['seller_email']))) {
        if ($order['status'] == 1) {
            C::t('forum_order')->update($orderid, array('status' => '2', 'buyer' => "{$notifydata['trade_no']}\t{$apitype}", 'confirmdate' => $_G['timestamp']));
            updatemembercount($order['uid'], array($_G['setting']['creditstrans'] => $order['amount']), 1, 'AFD', $order['uid']);
            updatecreditbyaction($action, $uid = 0, $extrasql = array(), $needle = '', $coef = 1, $update = 1, $fid = 0);
            C::t('forum_order')->delete_by_submitdate($_G['timestamp'] - 60 * 86400);
            $submitdate = dgmdate($order['submitdate']);
            $confirmdate = dgmdate(TIMESTAMP);
            notification_add($order['uid'], 'credit', 'addfunds', array('orderid' => $order['orderid'], 'price' => $order['price'], 'value' => $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title'] . ' ' . $order['amount'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit']), 1);
        }
Exemplo n.º 3
0
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: notify_invite.php 34251 2013-11-25 03:10:11Z nemohou $
 */
define('IN_API', true);
define('CURSCRIPT', 'api');
define('DISABLEXSSCHECK', true);
require '../../source/class/class_core.php';
require '../../source/function/function_forum.php';
$discuz = C::app();
$discuz->init();
$apitype = empty($_GET['attach']) || !preg_match('/^[a-z0-9]+$/i', $_GET['attach']) ? 'alipay' : $_GET['attach'];
require_once DISCUZ_ROOT . './api/trade/api_' . $apitype . '.php';
$PHP_SELF = $_SERVER['PHP_SELF'];
$_G['siteurl'] = dhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api\\/trade)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/');
$notifydata = trade_notifycheck('invite');
if ($notifydata['validator']) {
    $orderid = $notifydata['order_no'];
    $postprice = $notifydata['price'];
    $order = C::t('forum_order')->fetch($orderid);
    if ($order && floatval($postprice) == floatval($order['price']) && ($apitype == 'tenpay' || $_G['setting']['ec_account'] == $_REQUEST['seller_email'])) {
        if ($order['status'] == 1) {
            C::t('forum_order')->update($orderid, array('status' => '2', 'buyer' => "{$notifydata['trade_no']}\t{$apitype}", 'confirmdate' => $_G['timestamp']));
            $codes = $codetext = array();
            $dateline = TIMESTAMP;
            for ($i = 0; $i < $order['amount']; $i++) {
                $code = strtolower(random(6));
                $codetext[] = $code;
                $codes[] = "('0', '{$code}', '{$dateline}', '" . ($_G['group']['maxinviteday'] ? $_G['timestamp'] + $_G['group']['maxinviteday'] * 24 * 3600 : $_G['timestamp'] + 86400 * 10) . "', '{$order['email']}', '{$_G['clientip']}', '{$orderid}')";
                $invitedata = array('uid' => 0, 'code' => $code, 'dateline' => $dateline, 'endtime' => $_G['group']['maxinviteday'] ? $_G['timestamp'] + $_G['group']['maxinviteday'] * 24 * 3600 : $_G['timestamp'] + 86400 * 10, 'email' => $order['email'], 'inviteip' => $_G['clientip'], 'orderid' => $orderid);
                C::t('common_invite')->insert($invitedata);