1 Star 0 Fork 4

craboy1/myb2c

forked from carlton/myb2c 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
order.php 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
carlton 提交于 2014-02-09 12:57 . init
<?php
include './include/common.inc.php';
if (!$U['uid']) {
$help->showmessage("请先登陆");
}
if(!$_POST['paysubmit']){
if(!is_numeric($id)){
$help->showmessage("非法参数");
}
$q=$db->fetch_first("select * from `order` where id = {$id}");
if(!$q){
$help->showmessage("订单不存在");
}
if($q['uid']!=$U['uid']){
$help->showmessage("订单不属于你,无权操作");
}
$orderinfo=array();
$items = unserialize($q['item']);
foreach($items as $v){
$q1=$db->fetch_first("select id,name from commo where id = {$v['id']}");
$orderinfo['item'].='<a href='.$C['SITE_URL'].'/commo.php?id='.$q1['id'].'><b>'.$q1['name'].'</b></a> <font color=green>x '.$v['count'].'件</font><br>';
unset($q1);
}
$orderinfo['id']=$q['id'];
$orderinfo['price']=$q['price'];
$orderinfo['status']=$q['status'];
$orderinfo['time']=$q['time'];
$orderinfo['paytime']=$q['paytime'];
$orderinfo['address']=$q['address'];
$tpl->assign("orderinfo",$orderinfo);
$tpl->display("order.html");
}else{
if(!$orderid){
$help->showmessage("未捕获到订单");
}
if(!is_numeric($tel)){
$help->showmessage("请输入合法的联系电话",-1);
}
if(strlen($address)<5){
$help->showmessage("未填写收货地址或太短,请返回认真填写",-1);
}
$address="联系电话:".$tel." 收货地址:".$address;
$q=$db->fetch_first("select price from `order` where id = {$orderid}");
if(!$q){
$help->showmessage("订单不存在,或被删除",-1);
}
$q1=$db->fetch_first("select money from member where uid = {$U['uid']}");
if(!$q1){
$help->showmessage("请先登陆合法账户");
}
if(($q1['money']-$q['price'])<0){
$help->showmessage("账户余额不足,请先充值");
}
$nowtime=time();
$db->query("update member set money=money-{$q['price']} where uid = {$U['uid']}");
$db->query("update `order` set address='{$address}',status=1,paytime={$nowtime} where id = {$orderid}");
header('Location:'.$C['SITE_URL'].'/order.php?id='.$orderid);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/craboy1/myb2c.git
git@gitee.com:craboy1/myb2c.git
craboy1
myb2c
myb2c
master

搜索帮助