merchants(); $order_list = $model_refill_order->getMerchantOrderList($condition, 50,0, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc','',true); $order_list = $this->OrderDataFormat($order_list, $merchant_list); } Tpl::output('order_list', $order_list); Tpl::showpage('refill.order.manual.index'); } public function notify_manual_merchantOp() { $order_id = $_GET['order_id']; $type = $_GET['type']; $mod_order = Model('vr_order'); $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]); $mod_refill = Model('refill_order'); $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]); if(empty($refill_info) || empty($order_info)) { showMessage('订单不存在,或不符合条件', ''); } $fetch_order_ids = $this->check_fetch_order($order_id); if (in_array($order_id, $fetch_order_ids)) { showMessage('此订单不可手动操作,请联系抢单人员操作!'); } $logic_vr_order = Logic("vr_order"); if ($type == 'success') { $logic_vr_order->changeOrderStateSuccess($order_id,true); } elseif ($type == 'cancel') { $logic_vr_order->changeOrderStateCancel($order_info, '', "充值失败", true, true); } else { showMessage('手动操作类型错误', 'index.php?act=refill_order&op=index'); } $this->manual_record([$refill_info], $type, $order_id, '手动强制处理'); $this->log("手动强制处理,订单号:{$order_info['order_sn']}", 1); if($refill_info['notify_time'] == 0) { $mod_refill->edit($order_id, ['notify_state' =>1, 'notify_time' => time()]); } util::pop_queue_order($refill_info['mchid'],$refill_info['mch_order']); QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true]); showMessage('操作成功'); } public function refill_order_batchOp() { $model_refill_order = Model('refill_order'); $condition = []; $orders = []; $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00"); if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) { $condition['vr_order.order_state'] = $_GET['order_state']; } if (!empty($_GET['mchid'])) { $condition['refill_order.mchid'] = $_GET['mchid']; } if (!empty($_GET['store_id'])) { $condition['vr_order.store_id'] = $_GET['store_id']; } //批量查询,二者都有,以卡号为主 if(!empty($_GET['card_nos'])) { $card_nos = trim($_GET['card_nos'], ','); $condition['refill_order.card_no'] = ['in', $card_nos]; } elseif (!empty($_GET['mch_orders'])) { $mch_orders = rtrim($_GET['mch_orders'], ','); $condition['refill_order.mch_order'] = ['in', $mch_orders]; } if(!empty($_GET['order_sns'])) { $order_sns = trim($_GET['order_sns'], ','); $condition['refill_order.order_sn'] = ['in', $order_sns]; } if (!empty($_GET['card_type'])) { if (in_array($_GET['card_type'], ['1', '2', '4', '5', '6', '7'])) { $condition['refill_order.card_type'] = intval($_GET['card_type']); } } $merchant_list = $this->merchants(); $provider_list = $this->providers(); if(!empty($condition)) { $condition['refill_order.inner_status'] = 0; $start_unixtime = intval(strtotime($_GET['query_start_time'])); $end_unixtime = intval(strtotime($_GET['query_end_time'])); if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) { $condition['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and']; $condition['vr_order.add_time'] = [['egt', $start_unixtime],['lt', $end_unixtime], 'and']; } elseif ($start_unixtime > 0) { $condition['refill_order.order_time'] = ['egt', $start_unixtime]; $condition['vr_order.add_time'] = ['egt', $start_unixtime]; } elseif ($end_unixtime > 0) { $condition['refill_order.order_time'] = ['lt', $end_unixtime]; } else { $start = strtotime(date('Y-m-d', time())); $condition['refill_order.order_time'] = ['egt', $start]; $condition['vr_order.add_time'] = ['egt', $start]; } $orders = $model_refill_order->getMerchantOrderList($condition, 400, 0,'refill_order.*,vr_order.order_state', 'refill_order.channel_name DESC '); $orders = $this->OrderDataFormat($orders, $merchant_list); $order_ids = array_column($orders,'order_id'); $order_ids = $this->unique_array($order_ids); $refill_buyback_model = Model('refill_buyback'); $buybacks = $refill_buyback_model->getBuyBackList(['order_id' => ['in',$order_ids], 'manual_type' => 'buyback']); $buyback_ids = array_column($buybacks, 'order_id'); $buyback_ids = $this->int_array($buyback_ids); $buyback_ids = $this->unique_array($buyback_ids); foreach ($orders as $key => $order) { if($order['order_state'] != ORDER_STATE_SUCCESS) { $order[$key]['buyback'] = false; continue; } $order_id = intval($order['order_id']); if(algorithm::binary_search($buyback_ids,$order_id)) { $orders[$key]['buyback'] = true; }else{ $orders[$key]['buyback'] = false; } } } Tpl::output('merchant_list', $merchant_list); Tpl::output('provider_list', $provider_list); Tpl::output('order_list', $orders); Tpl::output('show_page', $model_refill_order->showpage()); Tpl::showpage('refill.order.batch'); } public function refill_order_batch_disposeOp() { $oid_reader = function ($sids) { $sids = explode(',',$sids); $ids = $this->int_array($sids); return $this->unique_array($ids); }; $oper_type = $_GET['type']; $order_ids = $oid_reader($_GET['order_id']); $cond = []; $cond['refill_order.order_id'] = ['in',$order_ids]; $cond['refill_order.inner_status'] = 0; $cond['refill_order.is_retrying'] = 0; if ($oper_type == 'success' || $oper_type == 'cancel') { $cond['vr_order.order_state'] = ORDER_STATE_SEND; } elseif ($oper_type == 'buyback') { $cond['vr_order.order_state'] = ORDER_STATE_SUCCESS; } $model_refill_order = Model('refill_order'); $orders = $model_refill_order->getMerchantOrderList($cond,'',0,'refill_order.*,vr_order.order_state,vr_order.buyer_id,vr_order.store_id','refill_order.order_id desc',2000); if(empty($orders)) { showMessage('操作数据为空'); } if($oper_type == 'notify') { foreach ($orders as $order) { if ($order['order_state'] == ORDER_STATE_SEND) { QueueClient::push("QueryRefillState", ['order_id' => $order['order_id']]); } else { QueueClient::push("NotifyMerchantComplete", ['order_id' => $order['order_id'], 'manual' => true]); } } } elseif (in_array($oper_type, ['success', 'cancel', 'buyback'])) { $this->manual_record($orders, $oper_type, $order_ids, $_GET); } else { showMessage('手动操作类型错误'); } showMessage('操作成功'); } private function manual_record($orders, $oper_type, $order_ids, $input) { $admininfo = $this->getAdminInfo(); $bz = empty($input['bz']) ? '' : $input['bz']; $buyback_ids = function ($order_ids, $oper_type) { $buybacks = Model('refill_buyback')->getBuyBackList(['order_id' => ['in', $order_ids], 'manual_type' => $oper_type]); $buyback_ids = array_column($buybacks, 'order_id'); $buyback_ids = $this->int_array($buyback_ids); return $this->unique_array($buyback_ids); }; $format_item = function ($order, $oper_type, $admininfo, $cur_time, $bz) { return ['order_id' => $order['order_id'], 'order_sn' => $order['order_sn'], 'order_time' => $order['order_time'], 'notify_time' => $order['notify_time'], 'manual_type' => $oper_type, 'admin_id' => $admininfo['id'], 'admin_name' => $admininfo['name'], 'act_time' => $cur_time, 'bz' => $bz]; }; if($oper_type == 'buyback') { $merge = $input['merge']; $mchids = array_column($orders, 'mchid'); $mchids = $this->unique_array($mchids); if($merge > 0 && count($mchids) > 1) { showMessage('下游机构多家时,返销记录不可合并'); } $merchant_list = $this->merchants(['mchid' => ['in', $mchids]]); foreach ($merchant_list as $merchant) { $merchants[$merchant['mchid']] = $merchant; } $store_ids = array_column($orders, 'store_id'); $store_ids = $this->unique_array($store_ids); if($merge > 0 && count($store_ids) > 1) { showMessage('上游通道多家时,返销记录不可合并'); } $provider_list = $this->providers(['refill_provider.store_id' => ['in', $store_ids]]); foreach ($provider_list as $provider) { $providers[$provider['store_id']] = $provider; } } $mod_buyback = Model('refill_buyback'); $buyback_ids = $buyback_ids($order_ids, $oper_type); $fetch_order_ids = $this->check_fetch_order($order_ids); $fetch_order_ids = $this->unique_array($fetch_order_ids); $cur_time = time(); if($oper_type == 'buyback') { $refill_evidence = []; $provider_amount = []; foreach ($orders as $order) { $order_id = intval($order['order_id']); if (algorithm::binary_search($buyback_ids, $order_id)) continue; $mchid = $order['mchid']; $merchant_info = $merchants[$mchid]; $buyer_id = $order['buyer_id']; $store_id = $order['store_id']; $provider_info = $providers[$store_id]; $account_id = $provider_info['account_id']; if (empty($mchid) || empty($buyer_id) || empty($store_id) || empty($account_id)) { Log::record("refill order manual err order_id:{$order_id}, order_sn:{$order['order_sn']}"); continue; } try { $trans = new trans_wapper($mod_buyback, __METHOD__); $item = $mod_buyback->getOrder(['order_id' => $order_id, 'manual_type' => $oper_type], '*', true, true); if(!empty($item)) { $trans->commit(); continue; } $insert_item = $format_item($order, $oper_type, $admininfo, $cur_time, $bz); $ret = $mod_buyback->insert($insert_item); if($ret) { $merchant_bz = "机构:{$mchid},订单号:{$order['mch_order']},卡号:{$order['card_no']},返销退款:{$order['mch_amount']}"; $this->credit_save_money($order['mch_amount'], 'add', $buyer_id, $merchant_bz); if ($merge > 0) { $refill_evidence['mchid'] = $mchid; if (!array_key_exists('mch_amount', $refill_evidence)) { $refill_evidence['mch_amount'] = $order['mch_amount']; $refill_evidence['count'] = 1; } else { $refill_evidence['mch_amount'] += $order['mch_amount']; $refill_evidence['count'] += 1; } } else { $this->ct_refill_evidence(['mch_amount' => $order['mch_amount'], 'bz' => $merchant_bz], $merchant_info, $cur_time, $admininfo); } } if($ret) { $provider_bz = "通道:{$store_id},椰子单号:{$order['order_sn']},卡号:{$order['card_no']},返销退款:{$order['channel_amount']}"; $this->credit_save_money($order['channel_amount'], 'add', $account_id, $provider_bz); if($merge > 0) { $provider_amount['store_id'] = $store_id; if (!array_key_exists('channel_amount', $provider_amount)) { $provider_amount['channel_amount'] = $order['channel_amount']; $provider_amount['count'] = 1; } else { $provider_amount['channel_amount'] += $order['channel_amount']; $provider_amount['count'] += 1; } }else{ $this->ct_provider_amount(['channel_amount' => $order['channel_amount']], $provider_info, $cur_time, $admininfo); } } $trans->commit(); } catch (Exception $e) { $trans->rollback(); Log::record("manual_record err: {$e->getMessage()}", Log::ERR); } } if(!empty($refill_evidence)) { $merchant_bz = "机构:{$mchid},共返销单数:{$refill_evidence['count']},返销退款总金额:{$refill_evidence['mch_amount']}"; $merchant_info = $merchants[$refill_evidence['mchid']]; $this->ct_refill_evidence(['mch_amount' => $refill_evidence['mch_amount'], 'bz' => $merchant_bz], $merchant_info, $cur_time, $admininfo); } if(!empty($provider_amount)) { $provider_info = $providers[$store_id]; $this->ct_provider_amount(['channel_amount' => $provider_amount['channel_amount']], $provider_info, $cur_time, $admininfo); } } else { foreach ($orders as $order) { $order_id = intval($order['order_id']); if (algorithm::binary_search($buyback_ids, $order_id)) continue; if (algorithm::binary_search($fetch_order_ids, $order_id)) continue; if ($oper_type == 'success') { refill\util::manual_success($order_id); } elseif ($oper_type == 'cancel') { refill\util::manual_cancel($order_id); } else { continue; } if (empty($bz)) { $bz = "批量处理页面,手动处理,操作人:{$admininfo['name']}"; } $insert_item = $format_item($order, $oper_type, $admininfo, $cur_time, $bz); $ins[] = $insert_item; } if(!empty($ins)) { $mod_buyback->insertAll($ins); } } } public function set_cancel_orderOp() { $mod = Model('refill_order'); $condition = []; $order_list = []; $mch_orderData = []; if(!empty($_GET['mchid'])) { $condition['mchid'] = $_GET['mchid']; } if (!empty($_GET['mch_orders'])) { $mch_orders = rtrim($_GET['mch_orders'],','); $condition['mch_order'] = ['in', $mch_orders]; } $merchant_list = $this->merchants(); if(!empty($condition)) { $condition['inner_status'] = 0; $order_list = $mod->getMerchantOrderList($condition, 200, 0,'refill_order.*,vr_order.order_state', 'refill_order.order_time desc'); $order_list = $this->OrderDataFormat($order_list, $merchant_list); if(empty($mch_orders)) { $mch_orderData = []; }else{ $mch_orderData = explode(',',$mch_orders); } foreach ($order_list as $order_id => $order) { $mch_order = $order['mch_order']; if(in_array($mch_order, $mch_orderData)) { $key = array_search($mch_order, $mch_orderData); unset($mch_orderData[$key]); } $order_list[$order_id]['can_cancel'] = $this->can_cancel_order($order); } } Tpl::output('noexist_mch_order', $mch_orderData); Tpl::output('merchant_list', $merchant_list); Tpl::output('list', $order_list); Tpl::output('show_page', $mod->showpage()); Tpl::showpage('set.cancel.order'); } public function order_cancel_disposeOp() { $order_ids = $_GET['order_ids']; $order_ids = explode(',', $order_ids); $condition['refill_order.order_id'] = ['in',$order_ids]; $order_list = Model('refill_order')->getMerchantOrderList($condition,1000,0,'refill_order.*,vr_order.order_state'); foreach ($order_list as $order) { if($this->can_cancel_order($order)) { $mchid = $order['mchid']; $mch_order = $order['mch_order']; refill\util::set_cancel_order($mchid,$mch_order); $this->log("拦截订单,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid}", 1); } } showMessage('操作成功'); } private function can_cancel_order($order): bool { if($order['order_state'] == ORDER_STATE_SUCCESS) { return false; } if($order['order_state'] == ORDER_STATE_CANCEL && $order['is_retrying'] == 0) { return false; } return true; } private function transfer_orderData($input, $condition) { $mod = Model('refill_order'); $cur_time = time(); $start_day = $cur_time - 86400 * 2; if (!empty($input['mch_orders'])) { $mch_orders = rtrim($input['mch_orders'],','); $condition['refill_order.mch_order'] = ['in', $mch_orders]; } if (!empty($input['card_nos'])) { $card_nos = rtrim($input['card_nos'],','); $condition['refill_order.card_no'] = ['in', $card_nos]; } $transfer = new refill\transfer(); $mMchid2Infos = $transfer->transfers(); $mchids = []; foreach ($mMchid2Infos as $mch) { $mchids[] = $mch['transfer_mchid']; } // $mchids[] = 1092; //for test $condition['inner_status'] = 0; if(!empty($input['mchid'])){ $condition['mchid'] = $input['mchid']; }elseif(!empty($mchids)) { $condition['mchid'] = ['in', $mchids]; } else { return []; } // $condition['vr_order.add_time&vr_order.add_time'] = ['_multi' => true, // ['egt', $start_day], // ['lt', $cur_time]]; // $condition['refill_order.order_time&refill_order.order_time'] = ['_multi' => true, // ['egt', $start_day], // ['lt', $cur_time]]; $merchant_list = $this->merchants(['mchid' => ['in', $mchids]]); $order_list = $mod->getMerchantOrderList($condition, 200, 0,'refill_order.*,vr_order.order_state', 'refill_order.order_time desc'); $order_list = $this->OrderDataFormat($order_list, $merchant_list); return [$order_list, $merchant_list]; } public function transfer_orderOp() { $condition['vr_order.order_state'] = ORDER_STATE_SEND; [$order_list, $merchant_list] = $this->transfer_orderData($_GET, $condition); Tpl::output('list', $order_list); Tpl::output('merchant_list', $merchant_list); Tpl::output('show_page', Model('')->showpage()); Tpl::showpage('transfer.order'); } public function transfer_order_disposeOp() { $type = $_GET['type']; $order_ids = $_GET['order_ids']; $order_ids = explode(',', $order_ids); $condition['refill_order.order_id'] = ['in',$order_ids]; $order_list = Model('refill_order')->getMerchantOrderList($condition,1000,0,'refill_order.mchid,refill_order.mch_order,refill_order.order_id'); foreach ($order_list as $order) { $mchid = $order['mchid']; $mch_order = $order['mch_order']; $order_id = $order['order_id']; if ($type === 'set_next_order') { refill\util::set_next_order($mchid, $mch_order); $this->log("预回调订单转快充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid}"); } elseif ($type === 'canceled_order_retry') { [$succ,$err] = refill\util::retry_canceled_order($order_id,false); $this->log("预回调订单失败补充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}"); } elseif ($type === 'canceled_order_retry_next') { [$succ,$err] = refill\util::retry_canceled_order($order_id,true); $this->log("预回调订单失败补快充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}"); } else { continue; } } showMessage('操作成功'); } public function transfer_order_rechargeOp() { $condition['vr_order.order_state'] = ORDER_STATE_CANCEL; [$order_list, $merchant_list] = $this->transfer_orderData($_GET, $condition); Tpl::output('list', $order_list); Tpl::output('merchant_list', $merchant_list); Tpl::output('show_page', Model('')->showpage()); Tpl::showpage('transfer.order.recharge'); } public function refill_buybackOp() { $model_refill_order = Model('refill_order'); $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00"); if (!empty($_GET['mchid'])) { $condition['refill_order.mchid'] = $_GET['mchid']; } if (!empty($_GET['store_id'])) { $condition['vr_order.store_id'] = $_GET['store_id']; } if(!empty($_GET['card_nos'])) { $card_nos = trim($_GET['card_nos'], ','); $condition['refill_order.card_no'] = ['in', $card_nos]; } if(!empty($_GET['order_sns'])) { $order_sns = trim($_GET['order_sns'], ','); $condition['refill_order.order_sn'] = ['in', $order_sns]; } if(!empty($_GET['manual_type'])) { $condition['manual_type'] = $_GET['manual_type']; } $start = intval(strtotime($_GET['query_start_time'])); $end = intval(strtotime($_GET['query_end_time'])); if ($end <= 0) { $end = time(); } $condition['refill_buyback.act_time'] = [['egt', $start], ['lt', $end], 'and']; $condition['inner_status'] = 0; if(!empty($_GET['export'])) { $this->Export($condition); return; } $merchant_list = $this->merchants(); $order_list = $model_refill_order->getBuyBackList($condition, 200, 'refill_buyback.*,refill_order.*,vr_order.order_state', 'refill_buyback.act_time desc','',true); $order_list = $this->OrderDataFormat($order_list, $merchant_list); $provider_list = $this->providers(); Tpl::output('provider_list', $provider_list); Tpl::output('merchant_list', $merchant_list); Tpl::output('order_list', $order_list); Tpl::output('show_page', $model_refill_order->showpage()); Tpl::showpage('refill.buyback.order'); } private function int_array($sids): array { $result = []; foreach ($sids as $sid) { $result[] = intval($sid); } return $result; } private function unique_array($ids): array { $ids = array_unique($ids); sort($ids); return $ids; } private function ct_provider_amount($params, $provider_info, $cur_time, $admininfo) { $input['provider_id'] = $provider_info['provider_id']; $input['memeber_id'] = $provider_info['account_id']; $input['amount'] = $params['channel_amount']; $input['operation'] = $admininfo['name']; $input['add_time'] = $cur_time; return Model('provider_amount')->addAmount($input); } private function ct_refill_evidence($params, $merchant_info, $cur_time, $admininfo) { $mem_info = Model('member')->getMemberInfo(['member_id' => $merchant_info['admin_id']], '*', true); $input['mchid'] = $merchant_info['mchid']; $input['mch_name'] = $merchant_info['name']; $input['member_id'] = $merchant_info['admin_id']; $input['amount'] = $params['mch_amount']; $input['bank_username'] = '椰子'; $input['bank_name'] = '椰子退款'; $input['bz'] = $params['bz']; $input['voucher_name'] = '/'; $input['status'] = 2; $input['is_operation'] = 2; $input['add_time'] = $input['check_time'] = $cur_time; $input['after_available'] = ncPriceFormat($mem_info['available_predeposit'] + $params['mch_amount']); $input['admin_name'] = $admininfo['name']; $input['admin_id'] = $admininfo['id']; $input['add_type'] = merchantModel::type_refund_back; return Model('merchant')->addRefillEvidence($input); } private function Export($cond) { $result = Model('refill_order')->getAllBuyBackOrders($cond); $this->createExcel($result); } private function createExcel($data = []) { $merchant_list = $this->merchants(); foreach ($merchant_list as $value) { $merchants[$value['mchid']] = $value; } Language::read('export'); import('libraries.excel'); $excel_obj = new Excel(); $excel_data = []; //设置样式 $excel_obj->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]); //header $excel_data[0][] = ['styleid' => 's_title', 'data' => '编号']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作日期']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '订单号']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '机构编号']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '机构名称']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '充值卡号']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '充值卡类型']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '充值额度']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '折扣后金额']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '下单日期']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '订单状态']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '渠道单号']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '渠道名称']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '折后金额']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作类型']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作人']; $excel_data[0][] = ['styleid' => 's_title', 'data' => '备注']; //data foreach ((array)$data as $k => $v) { $tmp = []; $tmp[] = ['data' => $k+1]; if (empty($v['act_time'])) { $tmp[] = ['data' => '']; } else { $tmp[] = ['data' => date('Y-m-d H:i:s', $v['act_time'])]; } $tmp[] = ['data' => $v['order_sn']]; $tmp[] = ['data' => $v['mchid']]; $tmp[] = ['data' => $merchants[$v['mchid']]['company_name']]; $tmp[] = ['data' => $v['card_no']]; $tmp[] = ['data' => $this->scard_type($v['card_type'])]; $tmp[] = ['data' => $v['refill_amount']]; $tmp[] = ['data' => $v['mch_amount']]; $tmp[] = ['data' => date('Y-m-d H:i:s', $v['order_time'])]; $tmp[] = ['data' => orderState($v)]; $tmp[] = ['data' => $v['ch_trade_no']]; $tmp[] = ['data' => $v['channel_name']]; $tmp[] = ['data' => $v['channel_amount']]; $tmp[] = ['data' => $v['manual_type']]; $tmp[] = ['data' => $v['admin_name']]; $tmp[] = ['data' => $v['bz']]; $excel_data[] = $tmp; } $excel_data = $excel_obj->charset($excel_data, CHARSET); $excel_obj->addArray($excel_data); $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET)); $excel_obj->generateXML('返销导出' . date('Y-m-d-H', time())); } }