$listArr[info]['oid'] = $res; $listArr[info]['gid'] = $key; $listArr[info]['num'] = $value['num']; //获取商品信息 $vo = $goodsModel->find($key); $listArr[info]['one_code'] = $vo['one_code']; $listArr[info]['name'] = $vo['name']; $listArr[info]['pic'] = $vo['pic']; $listArr[info]['ori_price'] = $vo['ori_price']; $listArr[info]['price'] = $vo['fact_price']; $listArr[info]['discount'] = $discount; $listArr[info]['money'] = round($vo['fact_price'] * $discount, 2) * $value['num']; $result = $m->add($listArr); //保存订单详情 //增加售出量 $goodsModel->query("update applist_hpt_shop_goods set outnum=outnum+{$value[num]} where id={$key}"); } } unset($_SESSION["trolley"]); if ($data['num']['pay_type'] == 1) { echo json_encode('yezf'); die; } else { echo json_encode($res); die; } } if ($_REQUEST['a'] == 'add_lb') { $data = $_POST; $goodsModel = D('applist_hpt_shop_goods'); //订单信息
$agent_user_row = $userModel->field("id,code,agent_num")->where("agent_num='" . $userRow['my_num'] . "'")->dataRow(); $smarty->assign('shop_name', $agent_user_row['code']); //登录之后,若有代理商编号,显示折扣价 if ($agent_user_row) { $kvRow = D('sub_kv')->where("k='discount'")->dataRow(); $discount = $kvRow['v']; } } } $smarty->assign('discount', $discount); if ($_REQUEST['a'] == 'detail') { $id = (int) $_GET['id']; $vo = $model->find($id); $vo['fact_price'] = round($vo['fact_price'] * $discount, 2); $smarty->assign('vo', $vo); $model->query("update applist_hpt_shop_goods set clicknum=clicknum+1 where id='{$id}'"); //人气加一 if ($vo['id'] == 1) { //今日剩礼包数量 $current_time = time(); $lbModel = D('sub_lb'); $lb_count_row = $lbModel->field('count(*) as count_num')->where("left(addtime,10)='" . date('Y-m-d') . "'")->dataRow(); if ($lb_count_row['count_num'] >= 10) { $smarty->assign('lb_man', 1); $time_12 = strtotime(date('Y-m-d', $current_time + 24 * 3600) . ' 12:00:00'); } else { $time_12 = strtotime(date('Y-m-d', $current_time) . ' 12:00:00'); } $time_cha = $time_12 - $current_time; $smarty->assign('time_cha', $time_cha); $smarty->setLayout('')->setTpl('mobile/templates/detail_lb.html')->display();