|
@@ -184,4 +184,36 @@ class Manage
|
|
|
Dever::db('card/code')->update($update);
|
|
|
return 'ok';
|
|
|
}
|
|
|
+
|
|
|
+ public function outCode($data)
|
|
|
+ {
|
|
|
+ $header = array('礼品卡名称', '卡号', '总面值', '已用面值', '剩余面值', '使用状态', '兑换时间');
|
|
|
+ $body = array();
|
|
|
+
|
|
|
+ $config = Dever::db('card/code')->config;
|
|
|
+ foreach($data as $k => $v) {
|
|
|
+
|
|
|
+ $card = Dever::db('card/info')->find($v['card_id']);
|
|
|
+ $date = '';
|
|
|
+ if ($v['ddate']) {
|
|
|
+ $date = date('Y-m-d H:i', $v['ddate']);
|
|
|
+ }
|
|
|
+ $status = $config['status'][$v['status']];
|
|
|
+ $d = array
|
|
|
+ (
|
|
|
+ $card['name'],
|
|
|
+ $v['card'],
|
|
|
+ $v['total_cash'],
|
|
|
+ $v['use_cash'],
|
|
|
+ round($v['total_cash'] - $v['use_cash'], 2),
|
|
|
+ $status,
|
|
|
+ $date,
|
|
|
+
|
|
|
+ );
|
|
|
+
|
|
|
+ $body[] = $d;
|
|
|
+ }
|
|
|
+ $file = Dever::input('excel_name');
|
|
|
+ return Dever::excelExport($body, $header, $file);
|
|
|
+ }
|
|
|
}
|