|
@@ -105,4 +105,32 @@ class Codecreate extends Backend
|
|
|
}
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载
|
|
|
+ */
|
|
|
+ public function download()
|
|
|
+ {
|
|
|
+ $co_id = $params = $this->request->request("co_id");
|
|
|
+ if (!$co_id) {
|
|
|
+ $this->error('co_id为空!');
|
|
|
+ }
|
|
|
+ $list = $this->model->where('co_id', $co_id)->column('id')->select();
|
|
|
+
|
|
|
+ set_time_limit(0);
|
|
|
+ ini_set('memory_limit', '512M');
|
|
|
+
|
|
|
+ //导出csv格式
|
|
|
+ header("Content-Type:text/csv");
|
|
|
+ header("Content-Disposition:attachment;filename=" . $co_id ."-code-" . date("Y-m-d") . ".csv");
|
|
|
+ ob_end_clean();
|
|
|
+
|
|
|
+ echo 'ID,URL\n';
|
|
|
+
|
|
|
+ foreach ($list as $k => $v) {
|
|
|
+ echo $k+1,','.encrypt($v).'\n';
|
|
|
+ // code...
|
|
|
+ }
|
|
|
+ exit;
|
|
|
+ }
|
|
|
}
|