Ejemplo n.º 1
0
<?php

$model = new Model_ApplistHptShopOrder();
$m = new Model_ApplistHptShopOdetail();
//订单地址
if ($_REQUEST['a'] == 'delivery') {
    if (empty($_SESSION['trolley'])) {
        header("Location:index.php?m=goods&a=index");
        die;
    }
    //收货人信息
    if ($_COOKIE['tyuid'] && !$_SESSION['tyuser']['id']) {
        $_SESSION['tyuser']['id'] = $_COOKIE['tyuid'];
    }
    if (empty($_SESSION['tyuser'])) {
        header("Location:./login.php");
        die;
    }
    $userModel = D('sub_user');
    $userRow = $userModel->find($_SESSION['tyuser']['id']);
    //省市区
    $pRow = D('s_province')->where("ProvinceID='" . $userRow['pid'] . "'")->dataRow();
    $userRow['pname'] = $pRow['ProvinceName'];
    $cRow = D('s_city')->where("CityID='" . $userRow['cid'] . "'")->dataRow();
    $userRow['cname'] = $cRow['CityName'];
    $dRow = D('s_district')->where("DistrictID='" . $userRow['did'] . "'")->dataRow();
    $userRow['dname'] = $dRow['DistrictName'];
    $smarty->assign('userRow', $userRow);
    $smarty->setLayout('')->setTpl('mobile/templates/delivery.html')->display();
    die;
}
Ejemplo n.º 2
0
<?php

include_once "../../../includes/config.inc.php";
check_login();
//验证是否登录
$model = new Model_ApplistHptShopOrder();
$smarty->assign('cateName', '订单');
//数据保存
if ($_REQUEST['a'] == 'add') {
    $data = $_POST;
    $res = $model->add($data);
    echo json_encode($res);
    die;
}
//详情
if ($_REQUEST['a'] == 'detail') {
    $odetailModel = new Model_ApplistHptShopOdetail();
    $id = (int) $_GET['id'];
    if ($id) {
        $smarty->assign('vo', $model->find($id));
        $smarty->assign('detailList', $odetailModel->findAll(" oid={$id} "));
    }
    $smarty->setTpl('app/hptshop/templates/order_add.html')->display();
    die;
}
//数据删除
if ($_REQUEST['a'] == 'del') {
    $res = $model->del($_POST['id']);
    echo json_encode($res);
    die;
}