public function index() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } if (IS_POST) { $id = I('post.id', 0, 'intval'); //获取id if (!is_numeric($id)) { $this->error('ID错误!'); } $info = M("shoplist")->find($id); $postnum = I('post.num'); if (!is_numeric($postnum)) { $this->error('数量错误!'); } if ($postnum < 1) { $this->error('无效数量!'); } $num = $info['num']; //获取num $price = $info['price']; //获取价格 $goodid = $info['goodid']; //获取goodid $parameters = $info['parameters']; $Exchange = D("Exchange"); $Exchange->create(); $Exchange->create_time = NOW_TIME; $Exchange->total = $num * $price; $Exchange->goodid = $goodid; $Exchange->status = 1; $Exchange->parameters = $parameters; $Exchange->add(); addUserLog('申请换货,商品名称' . get_good_name($goodid) . '参数' . $parameters, is_login()); $data['status'] = -4; //更改商品的售后信息 $shop = M("shoplist"); if ($shop->where("id='{$id}'")->save($data)) { $this->success('申请成功', U("center/index")); } else { $this->error('申请失败,或重复操作'); } } else { $id = I('get.id', 0, 'intval'); //获取id $msg = "Tips,提交换货单"; $this->meta_title = '填写换货单'; $detail = M("shoplist")->find($id); $this->assign('list', $detail); $this->assign('msg', $msg); $this->display(); } }
public function index() { // cookie自动登录 if (!is_login() && cookie('username') && cookie('password')) { $username = cookie('username'); $password = cookie('password'); $username = safe_replace($username); //过滤 $user = new UserApi(); $uid = $user->login($username, $password); if (0 < $uid) { //UC登录成功 /* 登录用户 */ $Member = D("Member"); if ($Member->login($uid)) { //登录用户,记录日志 addUserLog('cookie登陆成功', $uid); } } } if (1 == C('IP_TONGJI')) { $title = "index"; /**首页统计代码实现 status=1**/ $record = IpLookup("", 1, $title); } /** 幻灯片* */ $slide = D('slide')->get_slide(); $this->assign('slide', $slide); /** 顶级栏目* */ $tree = D('Category')->maketree(); $this->assign('tree', $tree); /** 公告分类**/ $notice = M('document')->order('id desc')->where("category_id='56'")->limit(8)->select(); $this->assign('notice', $notice); /** 活动分类**/ $activity = M('document')->order('id desc')->where("category_id='70'")->limit(8)->select(); $this->assign('activity', $activity); $this->meta_title = '首页'; $this->display(); }
public function index($cellphone = '') { $reserve = M('reserve'); $cellphone = I('post.phone', 0, 'intval'); $goodid = I('post.goodid', 0, 'intval'); $map['cellphone'] = $cellphone; $map['goodid'] = $goodid; addUserLog('预约商品,商品名称' . get_good_name($goodid), $uid); $info = $reserve->where($map)->find(); if (empty($info)) { $data['cellphone'] = $cellphone; $data['create_time'] = NOW_TIME; $data['status'] = 1; $data['goodid'] = $goodid; $data['title'] = get_good_name($goodid); $reserve->add($data); $data['info'] = '预约成功!'; } else { $data['status'] = -1; $data['info'] = '您已经预约过了!'; } $this->ajaxreturn($data); }
public function index() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } $this->meta_title = '取消订单'; if (IS_POST) { $id = I('post.id', '', 'strip_tags'); //获取orderid $id = safe_replace($id); //过滤 $order = M("order"); $status = $order->where("orderid='{$id}'")->getField("status"); $num = $order->where("orderid='{$id}'")->getField("ispay"); $shopid = $order->where("orderid='{$id}'")->getField("id"); $data = $order->where("id='{$shopid}'")->select(); foreach ($data as $k => $val) { $goodid = $val['goodid']; $price = get_good_price($goodid); /*取消的商品总额*/ $cash += $val['num'] * $price; /*退货中的商品件数*/ $num += $val['num']; /*退货中的商品种类数*/ $count += 1; } //订单已提交或未支付直接取消 if ($num == -1 && $status == 1 || $num == 1 && $status == -1) { //设置订单取消 //保存数据到取消表中后台调用 $cancel = D("cancel"); $cancel->create(); $cancel->create_time = NOW_TIME; $cancel->status = 3; $cancel->orderid = $id; $cancel->cash = $cash; //取消的金额 $cancel->num = $num; //取消的数量 $cancel->count = $count; //取消的种类 $cancel->info = "自助取消"; $cancel->add(); addUserLog('取消订单', $uid); //设置订单为订单已取消 $data = array('status' => '6', 'backinfo' => '订单已关闭'); //更新订单列表订单状态为已取消,清空取消订单操作 if ($order->where("orderid='{$id}'")->setField($data)) { $this->success('申请成功,订单已取消', U("center/index")); } else { $this->error('申请失败,请重试'); } } else { $cancel = D("cancel"); $cancel->create(); $cancel->time = NOW_TIME; $cancel->status = 1; $cancel->orderid = $id; $cancel->cash = $cash; //取消的金额 $cancel->num = $num; //取消的数量 $cancel->count = $count; //取消的种类 $cancel->add(); addUserLog('申请取消订单', $uid); $data = array('status' => '4'); //设置订单状态为已提交,发货等状态不变 if ($order->where("orderid='{$id}'")->setField($data)) { $this->success('申请成功', U("center/allorder")); } else { $this->error('申请失败,请重试'); } } } else { $id = I('get.id', '', 'strip_tags'); //获取orderid $msg = "申请取消订单:"; $id = safe_replace($id); //过滤 $order = M("order"); $detail = $order->where("orderid='{$id}'")->select(); $num = $order->where("orderid='{$id}'")->getField("status"); if ($num == "1") { $paynum = $order->where("orderid='{$id}'")->getField("ispay"); if ($paynum == "1") { $info = "当前订单状态为未完成支付"; } if (!$paynum) { $info = "当前订单已提交等待发货中"; } } if ($num == "2") { $info = "当前提交的订单已发货,需审核通过后取消"; } $list = M("shoplist"); foreach ($detail as $n => $val) { $detail[$n]['id'] = $list->where('orderid=\'' . $val['id'] . '\'')->select(); } $this->assign('info', $info); $this->assign('detaillist', $detail); $this->assign('id', $id); $this->assign('msg', $msg); $this->display(); $this->meta_title = '取消订单'; } }
public function index() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } if (IS_POST) { $id = I('post.id', 0, 'intval'); //获取id if (!is_numeric($id)) { $this->error('ID错误!'); } $info = M("shoplist")->find($id); $postnum = I('post.num'); if (!is_numeric($postnum)) { $this->error('数量错误!'); } if ($postnum < 1) { $this->error('无效数量!'); } $num = $info['num']; //获取num $price = $info['price']; //获取价格 $goodid = $info['goodid']; //获取goodid $parameters = $info['parameters']; if ($postnum > $num) { $this->error('超出购买数量'); } else { //保存信息到退货表 $back = D("backlist"); $back->create(); //Create方法创建的数据对象是保存在内存,并没有实际写入到数据库,直到使用add或者save 方法才会真正写入数据库 $back->create_time = NOW_TIME; $back->status = 1; $back->goodid = $goodid; $back->total = $num * $price; $back->parameters = $parameters; $result = $back->add(); addUserLog('申请退货,商品名称' . get_good_name($goodid) . '参数' . $parameters, is_login()); //更改商品的售后信息 $data['status'] = 4; $shop = M("shoplist"); $add = $shop->where("id='{$id}'")->save($data); if ($add) { $this->success('提交成功', U("center/index")); } else { $this->error('申请失败', U("center/index")); } } } else { $this->meta_title = '提交退货单'; $id = I('get.id', 0, 'intval'); //获取id if (!is_numeric($id)) { $this->error('ID错误!'); } $msg = "Tips,提交退货单"; $detail = M("shoplist")->find($id); //获取购物清单 $this->assign('list', $detail); //获取物品id $this->assign('id', $id); $this->assign('msg', $msg); $this->display(); } }
public function wuliu() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } $id = I('get.orderid', '', 'strip_tags'); //获取id $id = safe_replace($id); //过滤 $this->meta_title = '订单' . $id . '物流详情'; $typeCom = M("order")->where("orderid='{$id}'")->getField("tool"); $typeNu = M("order")->where("orderid='{$id}'")->getField("toolid"); if (isset($typeCom) && $typeNu) { $retData = $this->getkuaidi($typeCom, $typeNu); addUserLog('查询快递', is_login()); } else { $retData = ""; } $this->assign('kuaidata', $retData); $this->display(); }
Header("Location: billing.php?do=pay&id={$bill_id}"); exit; } } } if ($sub == "coupon" and $coupon and !$workWithoutAuth) { $coupon = GetCoupon("coupon", $coupon, '', '', ''); if (!$coupon->id) { $error = $_lang[FundsErrorCoupon]; } else { if (!IsCanUseCoupon($coupon->id, $_SESSION["userId"])) { $error = $_lang[FundsErrorCoupon]; } else { @mysql_query("update users set money=money+{$coupon->value} where id='" . $_SESSION["userId"] . "'") or die("File: " . __FILE__ . "<BR>Line: " . __LINE__ . "<BR>MySQL Error: " . mysql_error()); AddUsedByToCoupon($coupon->id, $_SESSION["userId"]); addUserLog($_SESSION['userId'], "moneyIn", $_lang[FundsTitle] . ", " . round($coupon->value * CURK, 2) . " " . CURS . ", coupon {$coupon->code}"); $success = $_lang[FundsCouponSuccess]; } } } head('utf-8', $_lang[FundsTitle]); print "<H1 class=pagetitle>" . $_lang[FundsTitle] . "</H1><hr class=hr>"; if ($error) { print "<font color=red>" . $_lang[Error] . ": {$error}</font><BR><BR>"; } if ($success) { print "{$success} " . round($coupon->value * CURK, 2) . " " . CURS . "<BR><BR>"; } print "<form method=post>"; print "<input type=hidden name=do value=addfunds>"; print "<input type=hidden name=sub value=pay>";
public function auto_express($uid) { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } if (empty($uid)) { $uid = is_login(); } //判断是否开启自动发货 if (1 == C('AUTO_SEND')) { $Express = M("Express"); $map['status'] = 1; $map['uid'] = $uid; $list = M("order")->where($map)->select(); //判断快递单号库存是否充足 $condition['status'] = 1; $data = $Express->where($condition)->order('id desc')->select(); if ($list && !$data) { addUserLog('快递单号库存不足,请尽快补充', $uid); } if ($list) { foreach ($list as $n => $v) { $data['status'] = 2; $condition2['status'] = 1; $id = $v['id']; $orderid = $v['orderid']; $info = $Express->where($condition2)->order('id desc')->limit(1)->find(); if ($info) { $data['express'] = $info['title']; $data['express_code'] = $info['code']; $data['send_name'] = C('SHOPNAME'); $data['send_contact'] = C('CONTACT'); $data['send_address'] = C('ADDRESS'); $data['create_time'] = NOW_TIME; M("order")->where("id='{$id}'")->save($data); M("Express")->where("id='{$info['id']}'")->setField('status', 2); addUserLog('自动发货成功,订单号' . $orderid, $uid); } } } } }
public function login($username = "", $password = "", $verify = "") { if (IS_POST) { //登录验证 $username = safe_replace($username); //过滤 /* 检测验证码 */ //if(!check_verify($verify)){ //$this->error("验证码输入错误!"); //} /* 调用UC登录接口登录 */ $user = new UserApi(); $uid = $user->login($username, $password); if (0 < $uid) { //UC登录成功 if (I('post.remember')) { cookie('username', $username, 2592000); // 指定cookie保存30天时间 cookie('password', $password, 2592000); // 指定cookie保存30天时间 addUserLog('保存cookie自动登录', $uid); } /* 登录用户 */ $Member = D("Member"); if ($Member->login($uid)) { //登录用户 //TODO:跳转到登录前页面 if ($_POST['email']) { $msg = "注册成功!"; } else { $msg = "登陆成功!"; } $this->success($msg, U('index/index')); } else { $this->error($Member->getError()); } } else { //登录失败 switch ($uid) { case -1: $error = "用户不存在或被禁用!"; break; //系统级别禁用 //系统级别禁用 case -2: $error = "密码错误!"; break; default: $error = "未知错误!"; break; // 0-接口参数错误(调试阶段使用) } $this->error($error); } } else { $this->meta_title = '会员登录'; //显示登录表单 $this->display(); } }
public function build() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } $address = M("address"); // 实例化address对象 $id = I('post.id'); // 用intval过滤$_POST['id'] $id = safe_replace($id); //过滤 $uid = D("member")->uid(); $province = I('post.province'); $province = safe_replace($province); //过滤 $city = I('post.city'); $city = safe_replace($city); //过滤 $area = I('post.area'); $area = safe_replace($area); //过滤 $data['province'] = $province; if ($province == $city) { $data['city'] = ''; } else { $data['city'] = $city; } if ($area == $city) { $data['area'] = ''; } else { $data['area'] = $area; } $data['address'] = safe_replace(I('post.posi')); $data['cellphone'] = safe_replace(I('post.pho')); $data['realname'] = safe_replace(I('post.rel')); if ($_POST["msg"] == "yes") { //地址库有默认地址,有则保存 if ($address->where("uid='{$uid}' and status='1'")->getField("id")) { $address->where("uid='{$uid}' and status='1'")->save($data); $addressid = $address->where("uid='{$uid}' and status='1'")->getField("id"); addUserLog('修改默认地址', $uid); } else { $data['status'] = 1; $data['create_time'] = NOW_TIME; $data['orderid'] = $id; $data['uid'] = $uid; $addressid = $address->add($data); addUserLog('新增默认地址', $uid); } $data['addressid'] = $addressid; $data['value'] = "default"; // 返回新增标识 $data['msg'] = 'yes'; } else { $data['status'] = 0; $data['time'] = NOW_TIME; $data['orderid'] = $id; $addressid = $address->add($data); // 根据条件保存修改的数据 addUserLog('新增非默认地址', $uid); $data['addressid'] = $addressid; $data['msg'] = 'no'; } $this->ajaxReturn($data); }