Example #1
0
<?php

//弹出一键填单相关ajax数据处理
include "../common.inc.php";
InitGP(array("action", "url", "refuname", "referer", "aid", "cityid"));
//初始化变量全局返回
include_once INC_PATH . "/coupon.class.php";
$coupon = CouponClass::init();
AjaxHead();
if ($action == 'active') {
    $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input')));
    $code = Char_cv($jsondata->code);
    $info = $coupon->active($code, $_USERS['uname']);
    echo json_encode($info);
    exit;
} else {
    if ($action == 'present') {
        $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input')));
        $uname = Char_cv($jsondata->name);
        $sn = Char_cv($jsondata->code);
        $info = $coupon->present($sn, $uname, $_USERS['uname']);
        echo json_encode($info);
        exit;
    } else {
        if ($action == 'sell') {
            $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input')));
            $price = GetNum($jsondata->price);
            $sn = Char_cv($jsondata->code);
            $info = $coupon->sellcoupon($sn, $price, $_USERS['uname']);
            echo json_encode($info);
            exit;
        $countweight += $value['orderweight'];
    }
    $ids = getdotstring($tempoids, 'int');
    $auth = $ids . "\t" . $countmoney . "\t" . $countweight;
    $LOCKDATA = cookie_authcode($auth, 'ENCODE');
    //加密数据
    //print_r($dataarray);
    //获取地区信息
    $areaobj = new TableClass('area', 'aid');
    $areaarray = $areaobj->getdata('', 'state=1');
    //获取用户地址
    $addressobj = new TableClass('address', 'aid');
    $addressarray = $addressobj->getdata('', "uname='" . $_USERS['uname'] . "'", "def desc,aid desc");
    //获取优惠卷
    include_once INC_PATH . "/coupon.class.php";
    $couponobj = CouponClass::init();
    $wherestrc[] = "uname='" . $_USERS['uname'] . "'";
    $wherestrc[] = "endtime >= " . time();
    $wherestrc[] = "state = 1";
    if (!empty($wherestrc)) {
        $wheresqlc = implode(' AND ', $wherestrc);
    }
    //条件汇总
    $couponarray = $couponobj->getdata("", $wheresqlc, "");
    //获取数据
    include template('member_tosendorder');
    //包含输出指定模板
} elseif ($action == "save") {
    InitGP(array("action", "LOCKDATA", "consignee", "tel", "country", "city", "address", "zip", "area", "remark", "did", "usecoupon", "couponid"));
    //初始化变量全局返回
    //创建运送方式对象