function outjuan() { $this->checkadminlogin(); $outtype = IReq::get('outtype'); if (!in_array($outtype, array('query', 'ids'))) { header("Content-Type: text/html; charset=UTF-8"); echo '查询条件错误'; exit; } $where = ''; if ($outtype == 'ids') { $id = trim(IReq::get('id')); if (empty($id)) { header("Content-Type: text/html; charset=UTF-8"); echo '查询条件不能为空'; exit; } $doid = explode('-', $id); $id = join(',', $doid); $where .= ' and id in(' . $id . ') '; } else { $searchvalue = intval(IReq::get('searchvalue')); $where .= $searchvalue > 0 ? ' and limitcost = \'' . $searchvalue . '\' ' : ''; $orderstatus = intval(IReq::get('orderstatus')); $where .= $orderstatus > 0 ? ' and status = \'' . ($orderstatus - 1) . '\' ' : ''; $starttime = trim(IReq::get('starttime')); $where .= !empty($starttime) ? ' and creattime > ' . strtotime($starttime . ' 00:00:01') . ' ' : ''; $endtime = trim(IReq::get('endtime')); $where .= !empty($endtime) ? ' and creattime > ' . strtotime($endtime . ' 23:59:59') . ' ' : ''; } $outexcel = new phptoexcel(); $titledata = array('卡号', '密码', '购物车限制金额', '优惠金'); $titlelabel = array('card', 'card_password', 'limitcost', 'cost'); $datalist = $this->mysql->getarr("select card,card_password,limitcost,cost from " . Mysite::$app->config['tablepre'] . "juan where id > 0 " . $where . " order by id desc limit 0,2000 "); $outexcel->out($titledata, $titlelabel, $datalist, '', '消费卷导出结果'); }
function outdetail() { // 订单号 时间 订单内容 配送费用 总价 $shopid = intval(IReq::get('shopid')); if (empty($shopid)) { header("Content-Type: text/html; charset=UTF-8"); echo '店铺获取失败'; exit; } $shoplist = $this->mysql->select_one("select id,shopname,yjin,shoptype from " . Mysite::$app->config['tablepre'] . "shop where id='" . $shopid . "' order by id asc limit 0,2000"); if (empty($shoplist)) { header("Content-Type: text/html; charset=UTF-8"); echo '店铺获取失败'; exit; } //dno $where = ''; $where2 = ''; $starttime = trim(IReq::get('starttime')); $where2 .= !empty($starttime) ? ' and posttime > ' . strtotime($starttime . ' 00:00:01') . ' ' : ''; $endtime = trim(IReq::get('endtime')); $where2 .= !empty($endtime) ? ' and posttime < ' . strtotime($endtime . ' 23:59:59') . ' ' : ''; $orderlist = $this->mysql->getarr("select id,dno,allcost,bagcost,shopps,shopcost,addtime,posttime,pstype ,paytype,paystatus from " . Mysite::$app->config['tablepre'] . "order where shopid = '" . $shopid . "' and status = 3 " . $where2 . " order by id asc limit 0,2000"); $list = array(); if (is_array($orderlist)) { foreach ($orderlist as $key => $value) { $detlist = $this->mysql->getarr("select goodsname,goodscount as shuliang from " . Mysite::$app->config['tablepre'] . "orderdet where order_id = '" . $value['id'] . "' and shopid > 0 order by id asc limit 0,5"); $detinfo = ''; if (is_array($detlist)) { foreach ($detlist as $keys => $val) { $detinfo .= $val['goodsname'] . '/' . $val['shuliang'] . '份,'; } } $value['content'] = $detinfo; $value['payname'] = $value['paytype'] == 'outpay' ? '货到支付' : '在线支付'; $value['dotime'] = date('Y-m-d H:i:s', $value['addtime']); $value['posttime'] = date('Y-m-d H:i:s', $value['posttime']); $value['pstype'] = $value['pstype'] == 0 ? '平台' : '自送'; $list[] = $value; } } // 超市商品总价 marketps 超市配送配送 店铺商品总价 shopps 店铺配送费 pstype 配送方式 0:平台1:个人 $outexcel = new phptoexcel(); $titledata = array('订单编号', '订单总价', '配送类型', '店铺商品总价', '店铺配送费', '打包费', '订单详情', '支付方式', '下单时间', '配送时间'); $titlelabel = array('dno', 'allcost', 'pstype', 'shopcost', 'shopps', 'bagcost', 'content', 'payname', 'dotime', 'posttime'); $outexcel->out($titledata, $titlelabel, $list, '', '商家结算详情' . $shoplist['shopname']); }
function outgiftlog() { $outtype = IReq::get('outtype'); if (!in_array($outtype, array('query', 'ids'))) { header("Content-Type: text/html; charset=UTF-8"); echo '查询条件错误'; exit; } $where = ''; if ($outtype == 'ids') { $id = trim(IReq::get('id')); if (empty($id)) { header("Content-Type: text/html; charset=UTF-8"); echo '查询条件不能为空'; exit; } $doid = explode('-', $id); $id = join(',', $doid); $where .= ' and gg.id in(' . $id . ') '; } else { $orderstatus = intval(IReq::get('orderstatus')); $where .= $orderstatus > 0 ? ' and gg.status = \'' . ($orderstatus - 1) . '\' ' : ''; $starttime = trim(IReq::get('starttime')); $where .= !empty($starttime) ? ' and gg.addtime > ' . strtotime($starttime . ' 00:00:01') . ' ' : ''; $endtime = trim(IReq::get('endtime')); $where .= !empty($endtime) ? ' and gg.addtime > ' . strtotime($endtime . ' 23:59:59') . ' ' : ''; } $outexcel = new phptoexcel(); $titledata = array('礼品名称', '用户名', '用户地址', '联系电话', '联系人'); $titlelabel = array('title', 'username', 'address', 'telphone', 'contactman'); $datalist = $this->mysql->getarr("select gf.title,mb.username,gg.address,gg.telphone,gg.contactman from " . Mysite::$app->config['tablepre'] . "giftlog as gg left join " . Mysite::$app->config['tablepre'] . "gift as gf on gf.id = gg.giftid left join " . Mysite::$app->config['tablepre'] . "member as mb on mb.uid=gg.uid where gg.id > 0 " . $where . " order by gg.id desc limit 0,2000"); $outexcel->out($titledata, $titlelabel, $datalist, '', '积分兑换导出结果'); }