|
@@ -5,47 +5,94 @@ namespace Active\Lib;
|
|
use Dever;
|
|
use Dever;
|
|
Class Excel {
|
|
Class Excel {
|
|
#活动订单的导出
|
|
#活动订单的导出
|
|
- public function out_active_order($data){
|
|
|
|
- $header = array('订单单号', '姓名', '手机号', '活动名称', '购买数量', '金额', '支付状态', '支付类型','购买时间');
|
|
|
|
|
|
+ public function out_active_order($data){
|
|
|
|
+ $header = array('订单单号', '姓名', '手机号', '活动名称', '购买数量', '金额', '支付状态', '支付类型','购买时间');
|
|
|
|
+ $body = array();
|
|
|
|
+ foreach ($data as $k => $v){
|
|
|
|
+ $user = Dever::db('active/user')->find($v['uid']);
|
|
|
|
+ $member = Dever::load('active/lib/user')->agent($user);
|
|
|
|
+ $active = Dever::db('active/info')->find($v['active_id']);
|
|
|
|
+ $member_name = '';
|
|
|
|
+ $member_mobile = '';
|
|
|
|
+ if($user){
|
|
|
|
+ $member_name = $user['name'];
|
|
|
|
+ $member_mobile = $user['mobile'];
|
|
|
|
+ }
|
|
|
|
+ $active_name = '';
|
|
|
|
+ if($active && $active['name']){
|
|
|
|
+ $active_name = $active['name'];
|
|
|
|
+ }
|
|
|
|
+ $config_status = Dever::db('active/order')->config['config_status'];
|
|
|
|
+ $status = Dever::status($config_status,$v['status']);
|
|
|
|
+ $config_pay_type = Dever::db('active/order')->config['config_pay_type'];
|
|
|
|
+ $pay_type = Dever::status($config_pay_type,$v['pay_type']);
|
|
|
|
+ $cdate = '';
|
|
|
|
+ if($v['cdate']){
|
|
|
|
+ $cdate = date('Y-m-d H:i',$v['cdate']);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $d = array
|
|
|
|
+ (
|
|
|
|
+ $v['order_num'],
|
|
|
|
+ $member_name,
|
|
|
|
+ $member_mobile,
|
|
|
|
+ $active_name,
|
|
|
|
+ $v['num'],
|
|
|
|
+ $v['price'],
|
|
|
|
+ $status,
|
|
|
|
+ $pay_type,
|
|
|
|
+ $cdate,
|
|
|
|
+ );
|
|
|
|
+ $body[] = $d;
|
|
|
|
+ }
|
|
|
|
+ $file = Dever::input('excel_name');
|
|
|
|
+ return Dever::excelExport($body, $header, $file);
|
|
|
|
+ }
|
|
|
|
+ #活动核销码导出
|
|
|
|
+ public function out_active_code($data)
|
|
|
|
+ {
|
|
|
|
+ $header = array('活动名称', '参加人姓名', '参加人手机号', '购买人姓名', '购买人手机号', '领取日期');
|
|
$body = array();
|
|
$body = array();
|
|
- foreach ($data as $k => $v){
|
|
|
|
- $user = Dever::db('active/user')->find($v['uid']);
|
|
|
|
- $member = Dever::load('active/lib/user')->agent($user);
|
|
|
|
- $active = Dever::db('active/info')->find($v['active_id']);
|
|
|
|
- $member_name = '';
|
|
|
|
- $member_mobile = '';
|
|
|
|
- if($user){
|
|
|
|
- $member_name = $user['name'];
|
|
|
|
- $member_mobile = $user['mobile'];
|
|
|
|
- }
|
|
|
|
- $active_name = '';
|
|
|
|
- if($active && $active['name']){
|
|
|
|
- $active_name = $active['name'];
|
|
|
|
- }
|
|
|
|
- $config_status = Dever::db('active/order')->config['config_status'];
|
|
|
|
- $status = Dever::status($config_status,$v['status']);
|
|
|
|
- $config_pay_type = Dever::db('active/order')->config['config_pay_type'];
|
|
|
|
- $pay_type = Dever::status($config_pay_type,$v['pay_type']);
|
|
|
|
- $cdate = '';
|
|
|
|
- if($v['cdate']){
|
|
|
|
- $cdate = date('Y-m-d H:i',$v['cdate']);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $d = array
|
|
|
|
- (
|
|
|
|
- $v['order_num'],
|
|
|
|
- $member_name,
|
|
|
|
- $member_mobile,
|
|
|
|
- $active_name,
|
|
|
|
- $v['num'],
|
|
|
|
- $v['price'],
|
|
|
|
- $status,
|
|
|
|
- $pay_type,
|
|
|
|
- $cdate,
|
|
|
|
- );
|
|
|
|
- $body[] = $d;
|
|
|
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
|
+ $active_name = '';
|
|
|
|
+ if ($v['active_id']) {
|
|
|
|
+ $active = Dever::db('active/info')->find($v['active_id']);
|
|
|
|
+ $active_name = $active['name'];
|
|
|
|
+ }
|
|
|
|
+ $join_name = '';
|
|
|
|
+ $join_mobile = '';
|
|
|
|
+ if ($v['join_uid']) {
|
|
|
|
+ $user = Dever::db('active/user')->find($v['join_uid']);
|
|
|
|
+ if ($user){
|
|
|
|
+ $join_name = $user['name'];
|
|
|
|
+ $join_mobile = $user['mobile'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $buy_name = '';
|
|
|
|
+ $buy_mobile = '';
|
|
|
|
+ if ($v['buy_uid']) {
|
|
|
|
+ $user = Dever::db('active/user')->find($v['buy_uid']);
|
|
|
|
+ if ($user){
|
|
|
|
+ $buy_name = $user['name'];
|
|
|
|
+ $buy_mobile = $user['mobile'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $cdate = '';
|
|
|
|
+ if ($v['cdate']) {
|
|
|
|
+ $cdate = date('Y-m-d H:i:s',$v['cdate']);
|
|
|
|
+ }
|
|
|
|
+ $d = array
|
|
|
|
+ (
|
|
|
|
+ $active_name,
|
|
|
|
+ $join_name,
|
|
|
|
+ $join_mobile,
|
|
|
|
+ $buy_name,
|
|
|
|
+ $buy_mobile,
|
|
|
|
+ $cdate,
|
|
|
|
+ );
|
|
|
|
+ $body[] = $d;
|
|
}
|
|
}
|
|
$file = Dever::input('excel_name');
|
|
$file = Dever::input('excel_name');
|
|
return Dever::excelExport($body, $header, $file);
|
|
return Dever::excelExport($body, $header, $file);
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|