Example #1
0
function PayApiShopPay($ddid, $money, $paybz, $orderid, $userid, $username, $ecms_paytype)
{
    global $empire, $dbtbpre;
    $ddid = (int) $ddid;
    $userid = (int) $userid;
    $username = RepPostVar($username);
    $ecms_paytype = RepPostVar($ecms_paytype);
    //验证是否重复提交
    $orderid = RepPostVar($orderid);
    $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewspayrecord where orderid='{$orderid}' limit 1");
    if ($num) {
        printerror('您已成功购买此订单', '../../ShopSys/buycar/', 1, 0, 1);
    }
    $ddr = PayApiShopDdMoney($ddid);
    if ($money == $ddr['tmoney']) {
        include '../../ShopSys/class/ShopSysFun.php';
        $money = (double) $money;
        $sql = $empire->query("update {$dbtbpre}enewsshopdd set haveprice=1 where ddid='{$ddid}'");
        //减少库存
        $shoppr = ShopSys_ReturnSet();
        if ($shoppr['cutnumtype'] == 1) {
            $buycarr = $empire->fetch1("select buycar from {$dbtbpre}enewsshopdd_add where ddid='{$ddid}'");
            Shopsys_CutMaxnum($ddid, $buycarr['buycar'], $ddr['havecutnum'], $shoppr, 0);
        }
        $posttime = date("Y-m-d H:i:s");
        $payip = egetip();
        $userid = (int) $ddr[userid];
        $username = $ddr[username] ? $ddr[username] : $ddr[truename];
        $username = RepPostStr($username);
        $paybz = str_replace('[!--ddno--]', $ddr[ddno], $paybz);
        $paybz = RepPostStr($paybz);
        $empire->query("insert into {$dbtbpre}enewspayrecord(id,userid,username,orderid,money,posttime,paybz,type,payip) values(NULL,'{$userid}','{$username}','{$orderid}','{$money}','{$posttime}','{$paybz}','{$ecms_paytype}','{$payip}');");
    }
    printerror('您已成功购买此订单', '../../ShopSys/buycar/', 1, 0, 1);
}
Example #2
0
<?php

require "../../class/connect.php";
require "../../class/q_functions.php";
require "../../class/db_sql.php";
require "../../data/dbcache/class.php";
require "../../member/class/user.php";
require '../class/ShopSysFun.php';
eCheckCloseMods('shop');
//关闭模块
$link = db_connect();
$empire = new mysqlquery();
$editor = 1;
$shoppr = ShopSys_ReturnSet();
//验证权限
ShopCheckAddDdGroup($shoppr);
$r = $_POST;
if (!getcvar('mybuycar')) {
    printerror('你的购物车没有商品', '', 1, 0, 1);
}
//变量处理
$r['truename'] = ehtmlspecialchars($r['truename']);
$r['mycall'] = ehtmlspecialchars($r['mycall']);
$r['phone'] = ehtmlspecialchars($r['phone']);
$r['email'] = ehtmlspecialchars($r['email']);
$r['oicq'] = ehtmlspecialchars($r['oicq']);
$r['msn'] = ehtmlspecialchars($r['msn']);
$r['address'] = ehtmlspecialchars($r['address']);
$r['zip'] = ehtmlspecialchars($r['zip']);
$r['signbuild'] = ehtmlspecialchars($r['signbuild']);
$r['besttime'] = ehtmlspecialchars($r['besttime']);
Example #3
0
function ShopSys_qDelDd($add)
{
    global $empire, $dbtbpre, $public_r;
    $shoppr = ShopSys_ReturnSet();
    //是否登陆
    $user_r = islogin();
    $ddid = (int) $add['ddid'];
    if (!$ddid) {
        printerror("NotChangeShopDdid", "history.go(-1)", 1);
    }
    $r = $empire->fetch1("select ddid,outproduct,haveprice,checked,ddtime,havecutnum from {$dbtbpre}enewsshopdd where ddid='{$ddid}' and userid='{$user_r['userid']}' limit 1");
    if (!$r['ddid']) {
        printerror("NotChangeShopDdid", "history.go(-1)", 1);
    }
    //订单不能删除
    if ($r['checked'] || $r['outproduct'] || $r['haveprice']) {
        printerror("NotDelShopDd", "history.go(-1)", 1);
    }
    //超过时间不能删除
    $dddeltime = $shoppr['dddeltime'] * 60;
    if (time() - $dddeltime > to_time($r['ddtime'])) {
        printerror("OuttimeNotDelShopDd", "history.go(-1)", 1);
    }
    //还原库存
    if ($shoppr['cutnumtype'] == 0) {
        $buycarr = $empire->fetch1("select buycar from {$dbtbpre}enewsshopdd_add where ddid='{$ddid}'");
        Shopsys_CutMaxnum($ddid, $buycarr['buycar'], $r['havecutnum'], $shoppr, 1);
    }
    $sql = $empire->query("delete from {$dbtbpre}enewsshopdd where ddid='{$ddid}' and userid='{$user_r['userid']}'");
    $sqladd = $empire->query("delete from {$dbtbpre}enewsshopdd_add where ddid='{$ddid}'");
    if ($sql) {
        printerror('DelShopDdSuccess', 'ListDd/', 1);
    } else {
        printerror("DbError", "history.go(-1)", 1);
    }
}