You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
163
hyhproject/admin/model/EctDay.php
Executable file
163
hyhproject/admin/model/EctDay.php
Executable file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
namespace wstmart\admin\model;
|
||||
use think\Db;
|
||||
use think\Loader;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现分类业务处理
|
||||
*/
|
||||
class EctDay extends Base{
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$startDate = input('startDate');
|
||||
$endDate = input('endDate');
|
||||
$loginName = input('loginName');
|
||||
$where = [];
|
||||
if($loginName!='')$where['b.loginName'] = ['like','%'.$loginName.'%'];
|
||||
if($startDate && $endDate){
|
||||
$where['a.giveTime'] =['between',[strtotime($startDate.' 00:00:00'),strtotime($endDate.' 23:59:59')]];
|
||||
}elseif($startDate){
|
||||
$where['a.giveTime'] = [">=",strtotime($startDate)];
|
||||
}elseif($endDate){
|
||||
$where['a.giveTime'] = ["<=",strtotime($endDate)];
|
||||
}
|
||||
//mark by cheng 只显示超过一天的提现数据
|
||||
$page = Db::name('user_everyday_ect_log')->alias('a')
|
||||
->join('users b','b.userId=a.userId','left')
|
||||
->where($where)
|
||||
->order('a.giveTime desc')
|
||||
->field('a.ectNum,giveTime,b.loginName')
|
||||
->paginate(input('limit/d'))->toArray();
|
||||
return $page;
|
||||
}
|
||||
/**
|
||||
* 获取提现详情
|
||||
*/
|
||||
public function getById(){
|
||||
$id = (int)input('id');
|
||||
$rs = $this->get($id);
|
||||
$user = [];
|
||||
if($rs['targetType']==1){
|
||||
$user = Db::name('shops')->alias('s')
|
||||
->join('__USERS__ u','u.userId=s.userId')
|
||||
->where('shopId',$rs['targetId'])
|
||||
->field('s.shopId,u.loginName,s.shopName as userName')
|
||||
->find();
|
||||
|
||||
}else{
|
||||
$user = Db::name('users')->where('userId',$rs['targetId'])->field('userId,loginName,userName')->find();
|
||||
}
|
||||
$rs['userName'] = $user['userName'];
|
||||
$rs['loginName'] = $user['loginName'];
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 导出提现申请
|
||||
*/
|
||||
public function toExport(){
|
||||
$name='ECT提现管理表';
|
||||
$startDate = input('startDate');
|
||||
$endDate = input('endDate');
|
||||
$ectNo = input('ectNo');
|
||||
$where = [];
|
||||
if($ectNo!='')$where['ectNum'] = ['like','%'.$ectNo.'%'];
|
||||
if($startDate && $endDate){
|
||||
$where['a.giveTime'] =['between',[strtotime($startDate.' 00:00:00'),strtotime($endDate.' 23:59:59')]];
|
||||
}elseif($startDate){
|
||||
$where['a.giveTime'] = [">=",strtotime($startDate)];
|
||||
}elseif($endDate){
|
||||
$where['a.giveTime'] = ["<=",strtotime($endDate)];
|
||||
}
|
||||
//mark by cheng 只显示超过一天的提现数据
|
||||
$page = Db::name('user_ect_cash_log')->alias('a')
|
||||
->join('users b','b.userId=a.userId','left')
|
||||
->where($where)
|
||||
->order('a.giveTime desc')
|
||||
->field('a.giveTime,ectNum,b.loginName')
|
||||
->select();
|
||||
|
||||
Loader::import('phpexcel.PHPExcel.IOFactory');
|
||||
$objPHPExcel = new \PHPExcel();
|
||||
// 设置excel文档的属性
|
||||
$objPHPExcel->getProperties()->setCreator("WSTMart")//创建人
|
||||
->setLastModifiedBy("WSTMart")//最后修改人
|
||||
->setTitle($name)//标题
|
||||
->setSubject($name)//题目
|
||||
->setDescription($name)//描述
|
||||
->setKeywords("提现")//关键字
|
||||
->setCategory("Test result file");//种类
|
||||
|
||||
// 开始操作excel表
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
// 设置工作薄名称
|
||||
$objPHPExcel->getActiveSheet()->setTitle(iconv('gbk', 'utf-8', 'Sheet'));
|
||||
// 设置默认字体和大小
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setName(iconv('gbk', 'utf-8', ''));
|
||||
$objPHPExcel->getDefaultStyle()->getFont()->setSize(11);
|
||||
$styleArray = array(
|
||||
'font' => array(
|
||||
'bold' => true,
|
||||
'color'=>array(
|
||||
'argb' => 'ffffffff',
|
||||
)
|
||||
),
|
||||
'borders' => array (
|
||||
'outline' => array (
|
||||
'style' => \PHPExcel_Style_Border::BORDER_THIN, //设置border样式
|
||||
'color' => array ('argb' => 'FF000000'), //设置border颜色
|
||||
)
|
||||
)
|
||||
);
|
||||
//设置宽
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(12);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(25);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(12);
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFill()->getStartColor()->setARGB('333399');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'ECT交易ID')
|
||||
->setCellValue('B1', '会员名称')
|
||||
->setCellValue('C1', 'ECT发送方')
|
||||
->setCellValue('D1', 'ECT接收方')
|
||||
->setCellValue('E1', '备注')
|
||||
->setCellValue('F1', 'ECT提现数量')
|
||||
->setCellValue('G1', '创建时间');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->applyFromArray($styleArray);
|
||||
|
||||
for ($row = 0; $row < count($page); $row++){
|
||||
$i = $row+2;
|
||||
$objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $page[$row]['transactionId'])
|
||||
->setCellValue('B'.$i, $page[$row]['loginName'])
|
||||
->setCellValue('C'.$i, $page[$row]['fromAccount'])
|
||||
->setCellValue('D'.$i, $page[$row]['toAccount'])
|
||||
->setCellValue('E'.$i, $page[$row]['dataRemarks'])
|
||||
->setCellValue('F'.$i, $page[$row]['ectNum'])
|
||||
->setCellValue('G'.$i, $page[$row]['createTime']);
|
||||
}
|
||||
|
||||
//输出EXCEL格式
|
||||
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
// 从浏览器直接输出$filename
|
||||
header('Content-Type:application/csv;charset=UTF-8');
|
||||
header("Pragma: public");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Type:application/vnd.ms-excel;");
|
||||
header("Content-Type:application/octet-stream");
|
||||
header("Content-Type:application/download");
|
||||
header('Content-Disposition: attachment;filename="'.$name.'.xls"');
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
$objWriter->save('php://output');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user