@ -612,7 +612,69 @@ class DownloadController extends BaseController {
$this->success('添加下载成功',U('listsIndex'));
}
/**
* 平台币充值
* @author sunke
*/
public function orderlist_data_export() {
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
if(empty($rs)) {
$map['tab_coin_pay_order.promote_id'] = PID;
}else {
foreach ($rs as $rsKey => $rsValue) {
$id = $rsValue['id'];
$childPromoteIds .= $id.',';
}
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['tab_coin_pay_order.promote_id'] = ['in', $childPromoteIds];
}
$map['is_del'] = 0;
$start_time = strtotime(I('time_start'));
$end_time = strtotime(I('time_end'));
$order_number = I("order_number");
$order_status = I("order_status");
$pay_type = I("pay_type");
if (!empty($start_time) & & !empty($end_time)) {
$map['create_time'] = ['BETWEEN', [$start_time, $end_time + 24 * 60 * 60 - 1]];
} else if (!empty($start_time)) {
$map['create_time'] = array('gt', $start_time);
} else if (!empty($end_time)) {
$map['create_time'] = array('lt', $end_time + 24 * 60 * 60 - 1);
}
if(!empty($order_number)){
$map['order_number'] = $order_number;
}
if(!empty($order_status) || $order_status=='0'){
$map['order_status'] = $order_status;
}
if(!empty($pay_type)){
$map['pay_type'] = $pay_type;
}
$conditions = json_encode($map,TRUE);
$addtime = time();
$data = [
'logid' => 'orderlist_'.time(),
'admin_id' => PID,
'type' => '/Home/CoinOrder/order_list',
'dataname' => '平台币充值',
'status' => 0,
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' =>$conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
// $this->ajaxReturn(array("status" => -1, "msg" => "添加导出日志失败", 'ret' => $res));
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
/**
* arpu统计
* @author sunke
@ -1632,9 +1694,13 @@ class DownloadController extends BaseController {
case "汇款证明":
$this->remitCerDownLoad($id,$map);
break;
case "平台币充值":
$this->orderlistExcelInfo($id,$map);
break;
default:
break;
}
}
//注册明细excel信息
@ -2121,6 +2187,52 @@ class DownloadController extends BaseController {
}
public function orderlistExcelInfo($id,$map) {
$xlsName = "平台币充值";
$xlsCell = array(
array('order_number','充值订单号'),
array('pay_amount','充值金额'),
array('discount','优惠值'),
array('coin_num','平台币数量'),
array('pay_type','转账类型'),
array('order_status1','订单状态'),
array('time','申请时间'),
);
$model = M('coin_pay_order','tab_');
$data = $model->where($map)->order('id DESC')->select();
foreach ($data as $key => $value) {
if($value['pay_type'] == 1) {
$data[$key]['pay_type'] = "线上充值";
} else {
$data[$key]['pay_type'] = "线下充值";
}
if($value['order_status'] == 0) {
$data[$key]['order_status1'] = "待付款";
}
if($value['order_status'] == 1) {
$data[$key]['order_status1'] = "付款成功";
}
if($value['order_status'] == 2) {
$data[$key]['order_status1'] = "待审核";
}
if($value['order_status'] == 3) {
$data[$key]['order_status1'] = "待发币";
}
if($value['order_status'] == 4) {
$data[$key]['order_status1'] = "已发币";
}
if($value['order_status'] == 5) {
$data[$key]['order_status1'] = "审核不通过";
}
$data[$key]['time'] = date('Y-m-d H:i:s' ,$value['create_time']);
}
$xlsData = $data;
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
}
public function remitCerDownLoad($id,$map) {
$proof_id = $map['id'];
$file = new FileController();
@ -2526,15 +2638,47 @@ class DownloadController extends BaseController {
array('game_name','游戏名称'),
array('server_name','区服'),
array('game_player_name','角色名'),
array('p_p_proinfo','部门长'),
array('p_proinfo','组长'),
array('proinfo','推广员'),
array('pay_time','付款时间'),
);
$model = M('spend','tab_');
$data = $model->where($map)->select();
$data = $model
->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain')
->join('tab_game on tab_spend.game_id = tab_game.id')
->join('left join tab_promote on tab_spend.promote_id = tab_promote.id')
->where($map)
->order('tab_spend.id desc')
->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
$value1['pay_way'] = $this->payWay[$value1['pay_way']];
$value1['pay_time'] = date('Y-m-d H:i:s',$value1['pay_time']);
$value1['p_p_proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
$value1['p_proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
$value1['proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
if(!empty($value1['chain'])) {
$chain = trim($value1['chain'],'/');
$chainArr = explode('/', $chain);
if(!empty($chainArr[1])) {
$thisPromoteData1 = D('Promote')
->field('account,real_name')
->where(array('id' => $chainArr[1]))
->find();
$value1['p_p_proinfo'] = $thisPromoteData1['account'].'('.$thisPromoteData1['real_name'].')'; //部门长
}
if(!empty($chainArr[2])) {
$thisPromoteData2 = D('Promote')
->field('account,real_name')
->where(array('id' => $chainArr[2]))
->find();
$value1['p_proinfo'] = $thisPromoteData2['account'].'('.$thisPromoteData2['real_name'].')'; //组长
}
}
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);