增加导入导出
This commit is contained in:
+172
-172
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -10,175 +10,175 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
|
||||
*/
|
||||
return array(
|
||||
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
|
||||
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
|
||||
'ai' => array('application/pdf', 'application/postscript'),
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
|
||||
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => array('application/x-javascript', 'text/plain'),
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'z' => 'application/x-compress',
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
|
||||
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aiff' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => array('text/css', 'text/plain'),
|
||||
'html' => array('text/html', 'text/plain'),
|
||||
'htm' => array('text/html', 'text/plain'),
|
||||
'shtml' => array('text/html', 'text/plain'),
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => array('application/xml', 'text/xml', 'text/plain'),
|
||||
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
|
||||
'dot' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
|
||||
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
|
||||
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'kdb' => 'application/octet-stream',
|
||||
'pgp' => 'application/pgp',
|
||||
'gpg' => 'application/gpg-keys',
|
||||
'sst' => 'application/octet-stream',
|
||||
'csr' => 'application/octet-stream',
|
||||
'rsa' => 'application/x-pkcs7',
|
||||
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => array('video/3gp', 'video/3gpp'),
|
||||
'mp4' => 'video/mp4',
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => array('video/mp4', 'video/x-f4v'),
|
||||
'flv' => 'video/x-flv',
|
||||
'webm' => 'video/webm',
|
||||
'aac' => 'audio/x-acc',
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
'xspf' => 'application/xspf+xml',
|
||||
'vlc' => 'application/videolan',
|
||||
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
|
||||
'au' => 'audio/x-au',
|
||||
'ac3' => 'audio/ac3',
|
||||
'flac' => 'audio/x-flac',
|
||||
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
|
||||
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
|
||||
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
|
||||
'ics' => 'text/calendar',
|
||||
'ical' => 'text/calendar',
|
||||
'zsh' => 'text/x-scriptzsh',
|
||||
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
|
||||
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
|
||||
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
|
||||
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
|
||||
'vcf' => 'text/x-vcard',
|
||||
'srt' => array('text/srt', 'text/plain'),
|
||||
'vtt' => array('text/vtt', 'text/plain'),
|
||||
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
|
||||
'odc' => 'application/vnd.oasis.opendocument.chart',
|
||||
'otc' => 'application/vnd.oasis.opendocument.chart-template',
|
||||
'odf' => 'application/vnd.oasis.opendocument.formula',
|
||||
'otf' => 'application/vnd.oasis.opendocument.formula-template',
|
||||
'odg' => 'application/vnd.oasis.opendocument.graphics',
|
||||
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
|
||||
'odi' => 'application/vnd.oasis.opendocument.image',
|
||||
'oti' => 'application/vnd.oasis.opendocument.image-template',
|
||||
'odp' => 'application/vnd.oasis.opendocument.presentation',
|
||||
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
|
||||
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
||||
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
||||
'oth' => 'application/vnd.oasis.opendocument.text-web'
|
||||
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
|
||||
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
|
||||
'ai' => array('application/pdf', 'application/postscript'),
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
|
||||
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => array('application/x-javascript', 'text/plain'),
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'z' => 'application/x-compress',
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
|
||||
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aiff' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => array('text/css', 'text/plain'),
|
||||
'html' => array('text/html', 'text/plain'),
|
||||
'htm' => array('text/html', 'text/plain'),
|
||||
'shtml' => array('text/html', 'text/plain'),
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => array('application/xml', 'text/xml', 'text/plain'),
|
||||
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
|
||||
'dot' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip', 'application/octet-stream'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
|
||||
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
|
||||
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'kdb' => 'application/octet-stream',
|
||||
'pgp' => 'application/pgp',
|
||||
'gpg' => 'application/gpg-keys',
|
||||
'sst' => 'application/octet-stream',
|
||||
'csr' => 'application/octet-stream',
|
||||
'rsa' => 'application/x-pkcs7',
|
||||
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => array('video/3gp', 'video/3gpp'),
|
||||
'mp4' => 'video/mp4',
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => array('video/mp4', 'video/x-f4v'),
|
||||
'flv' => 'video/x-flv',
|
||||
'webm' => 'video/webm',
|
||||
'aac' => 'audio/x-acc',
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
'xspf' => 'application/xspf+xml',
|
||||
'vlc' => 'application/videolan',
|
||||
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
|
||||
'au' => 'audio/x-au',
|
||||
'ac3' => 'audio/ac3',
|
||||
'flac' => 'audio/x-flac',
|
||||
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
|
||||
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
|
||||
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
|
||||
'ics' => 'text/calendar',
|
||||
'ical' => 'text/calendar',
|
||||
'zsh' => 'text/x-scriptzsh',
|
||||
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
|
||||
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
|
||||
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
|
||||
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
|
||||
'vcf' => 'text/x-vcard',
|
||||
'srt' => array('text/srt', 'text/plain'),
|
||||
'vtt' => array('text/vtt', 'text/plain'),
|
||||
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
|
||||
'odc' => 'application/vnd.oasis.opendocument.chart',
|
||||
'otc' => 'application/vnd.oasis.opendocument.chart-template',
|
||||
'odf' => 'application/vnd.oasis.opendocument.formula',
|
||||
'otf' => 'application/vnd.oasis.opendocument.formula-template',
|
||||
'odg' => 'application/vnd.oasis.opendocument.graphics',
|
||||
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
|
||||
'odi' => 'application/vnd.oasis.opendocument.image',
|
||||
'oti' => 'application/vnd.oasis.opendocument.image-template',
|
||||
'odp' => 'application/vnd.oasis.opendocument.presentation',
|
||||
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
|
||||
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
||||
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
||||
'oth' => 'application/vnd.oasis.opendocument.text-web'
|
||||
);
|
||||
|
||||
@@ -28,20 +28,54 @@ class Clues extends HD_Controller
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
$params = $this->input->get();
|
||||
list($lists, $count) = $this->lists();
|
||||
$map_cfrom = $this->clues_cfrom_model->map('id', 'title', array('status' => 1, 'pid' => 0, 'type' => 0), '', 0, 0, 'id, title');
|
||||
$map_cfrom2 = $this->clues_cfrom_model->map('id', 'title', array('status' => 1, 'pid' => $params['cfrom_id']), '', 0, 0, 'id, title');
|
||||
$statusList = array();
|
||||
foreach ($this->clues_model->statusAry() as $key => $value) {
|
||||
$cate = array();
|
||||
$where = array("status" => $key);
|
||||
$count1 = $this->clues_model->count($where);
|
||||
if ($value['list']) {
|
||||
foreach ($value['list'] as $key2 => $value2) {
|
||||
$where['status2'] = $key2;
|
||||
$count2 = $this->clues_model->count($where);
|
||||
$cate[] = array("id" => $key2, "name" => $value2, "count" => $count2);
|
||||
}
|
||||
}
|
||||
$statusList[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1);
|
||||
}
|
||||
|
||||
$this->data['province_id'] = intval($params['province_id']);
|
||||
$this->data['city_id'] = intval($params['city_id']);
|
||||
$this->data['county_id'] = intval($params['county_id']);
|
||||
$this->data['provinces'] = $this->province_ary();
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['searchTpAry'] = $this->searchTpAry;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['cfromAry'] = $map_cfrom;
|
||||
$this->data['cfromAry2'] = $map_cfrom2;
|
||||
$this->data['statusList'] = $statusList;
|
||||
$this->data['maintainAry'] = $this->maintainAry;
|
||||
$this->data['export_button'] = SUPER_ADMIN == $this->role ? 1 : 0;
|
||||
$this->data['_title'] = '线索池列表';
|
||||
return $this->show_view('receiver/clues/lists', true);
|
||||
}
|
||||
|
||||
public function lists($where = array())
|
||||
public function lists($export = false)
|
||||
{
|
||||
$where = [];
|
||||
$statusAry = $this->clues_model->statusAry();
|
||||
$params = $this->input->get();
|
||||
|
||||
$this->data['province_id'] = $province_id = intval($params['province_id']);
|
||||
$this->data['city_id'] = $city_id = intval($params['city_id']);
|
||||
$this->data['county_id'] = $county_id = intval($params['county_id']);
|
||||
$province_id = intval($params['province_id']);
|
||||
$city_id = intval($params['city_id']);
|
||||
$county_id = intval($params['county_id']);
|
||||
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$export && $size = 10000;
|
||||
|
||||
if ($params['title']) {
|
||||
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
|
||||
@@ -82,7 +116,7 @@ class Clues extends HD_Controller
|
||||
$where["biz_id in(select id from lc_biz where county_id={$params['county_id_admin']})"] = null;
|
||||
} else if ($params['city_id_admin']) {
|
||||
$where["biz_id in(select id from lc_biz where city_id={$params['city_id_admin']})"] = null;
|
||||
}else if ($params['province_id_admin']) {
|
||||
} else if ($params['province_id_admin']) {
|
||||
$where["biz_id in(select id from lc_biz where province_id={$params['province_id_admin']})"] = null;
|
||||
}
|
||||
|
||||
@@ -155,7 +189,6 @@ class Clues extends HD_Controller
|
||||
$str_ids = implode(',', $province_id_arr);
|
||||
$map_area_province = $this->area_model->map('province_id', '', ["province_id in ({$str_ids})" => null], '', 0, $size, 'province_id,province_name');
|
||||
}
|
||||
|
||||
foreach ($rows as $key => $val) {
|
||||
$val['cf_title'] = $cf_title_arr[$val['cf2_id']] ? $cf_title_arr[$val['cf2_id']] : $cf_title_arr[$val['cf_id']];
|
||||
|
||||
@@ -168,10 +201,10 @@ class Clues extends HD_Controller
|
||||
if ($val['county_id']) {
|
||||
$area = $map_area_county[$val['county_id']][0];
|
||||
$val['poi'] = "{$area['province_name']}-{$area['city_name']}-{$area['county_name']}";
|
||||
}elseif ($val['city_id']) {
|
||||
} elseif ($val['city_id']) {
|
||||
$area = $map_area_city[$val['city_id']][0];
|
||||
$val['poi'] = "{$area['province_name']}-{$area['city_name']}";
|
||||
}elseif ($val['province_id']) {
|
||||
} elseif ($val['province_id']) {
|
||||
$area = $map_area_province[$val['province_id']][0];
|
||||
$val['poi'] = "{$area['province_name']}";
|
||||
}
|
||||
@@ -184,35 +217,9 @@ class Clues extends HD_Controller
|
||||
$lists[] = $val;
|
||||
}
|
||||
}
|
||||
$statusList = array();
|
||||
foreach ($this->clues_model->statusAry() as $key => $value) {
|
||||
$cate = array();
|
||||
$where = array("status" => $key);
|
||||
$count1 = $this->clues_model->count($where);
|
||||
if ($value['list']) {
|
||||
foreach ($value['list'] as $key2 => $value2) {
|
||||
$where['status2'] = $key2;
|
||||
$count2 = $this->clues_model->count($where);
|
||||
$cate[] = array("id" => $key2, "name" => $value2, "count" => $count2);
|
||||
}
|
||||
}
|
||||
$statusList[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1);
|
||||
}
|
||||
|
||||
$map_cfrom = $this->clues_cfrom_model->map('id', 'title', array('status' => 1, 'pid' => 0, 'type' => 0), '', 0, 0, 'id, title');
|
||||
$map_cfrom2 = $this->clues_cfrom_model->map('id', 'title', array('status' => 1, 'pid' => $params['cfrom_id']), '', 0, 0, 'id, title');
|
||||
|
||||
$this->data['provinces'] = $this->province_ary();
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['searchTpAry'] = $this->searchTpAry;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['cfromAry'] = $map_cfrom;
|
||||
$this->data['cfromAry2'] = $map_cfrom2;
|
||||
$this->data['statusList'] = $statusList;
|
||||
$this->data['maintainAry'] = $this->maintainAry;
|
||||
$this->data['_title'] = '线索池列表';
|
||||
return $this->show_view('receiver/clues/lists', true);
|
||||
|
||||
return [$lists, $count];
|
||||
}
|
||||
|
||||
public function get()
|
||||
@@ -273,7 +280,7 @@ class Clues extends HD_Controller
|
||||
|
||||
//门店
|
||||
$biz = $this->biz_model->get(['id' => $re['biz_id']]);
|
||||
$dataInfo['province_id_admin'] = $biz ? $biz['province_id'] :0;
|
||||
$dataInfo['province_id_admin'] = $biz ? $biz['province_id'] : 0;
|
||||
$dataInfo['city_id_admin'] = $biz ? $biz['city_id'] : 0;
|
||||
$dataInfo['county_id_admin'] = $biz ? $biz['county_id'] : 0;
|
||||
$customer = $this->customers_model->get(array('rid' => $re['id'], 'status >' => -1));
|
||||
@@ -403,7 +410,7 @@ class Clues extends HD_Controller
|
||||
$log = '新增线索';
|
||||
$this->addLog(array('clue_id' => $ret, 'type' => 3, 'log' => $log));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '新增成功');
|
||||
}else{
|
||||
} else {
|
||||
debug_log("[error]# add fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
return $this->show_json(SYS_CODE_FAIL, '新增失败');
|
||||
}
|
||||
@@ -533,10 +540,10 @@ class Clues extends HD_Controller
|
||||
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => $log));
|
||||
}
|
||||
} else if ($info['editType'] == 3) {
|
||||
if($cus = $this->customers_model->get(array('mobile' => $re['mobile'], 'status >' => -1, 'biz_id' => $info['biz_id']))){
|
||||
if ($cus = $this->customers_model->get(array('mobile' => $re['mobile'], 'status >' => -1, 'biz_id' => $info['biz_id']))) {
|
||||
$code = SYS_CODE_FAIL;
|
||||
$msg = '门店已有该线索';
|
||||
}else{
|
||||
} else {
|
||||
$up_data = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'p_time' => date('Y-m-d H:i:s'),
|
||||
@@ -550,11 +557,11 @@ class Clues extends HD_Controller
|
||||
$this->addLog(array('clue_id' => $info['id'], 'type' => 3, 'log' => '派单'));
|
||||
}
|
||||
}
|
||||
}else if ($info['editType'] == 4) {
|
||||
if($cus = $this->customers_model->get(array('mobile' => $re['mobile'], 'status >' => -1, 'biz_id' => $re['biz_id']))){
|
||||
} else if ($info['editType'] == 4) {
|
||||
if ($cus = $this->customers_model->get(array('mobile' => $re['mobile'], 'status >' => -1, 'biz_id' => $re['biz_id']))) {
|
||||
$code = SYS_CODE_FAIL;
|
||||
$msg = '门店已在跟踪';
|
||||
}else{
|
||||
} else {
|
||||
$this->load->helper("order");
|
||||
$biz = $this->biz_model->get(array('id' => $re['biz_id']));
|
||||
$add = array(
|
||||
@@ -576,7 +583,7 @@ class Clues extends HD_Controller
|
||||
);
|
||||
|
||||
$customers_id = $this->customers_model->add($add);
|
||||
if($customers_id){
|
||||
if ($customers_id) {
|
||||
$this->addLog(array('clue_id' => $re['id'], 'type' => 3, 'log' => '移交门店跟进'));
|
||||
$this->clues_model->update(['status' => 1], ['id' => $re['id']]);
|
||||
|
||||
@@ -649,7 +656,37 @@ class Clues extends HD_Controller
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
list($lists, $count) = $this->lists(1);
|
||||
$indexs = [
|
||||
'id' => 'ID',
|
||||
'name' => '客户姓名',
|
||||
'mobile' => '手机',
|
||||
'cf_title' => "来源",
|
||||
'biz_name' => '门店',
|
||||
'biz_poi' => '所在地区',
|
||||
'status_name' => '状态',
|
||||
'c_time' => '创建时间',
|
||||
];
|
||||
$data = [];
|
||||
if ($lists) {
|
||||
foreach ($lists as $key => $val) {
|
||||
$item = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $val['mobile'],
|
||||
'cf_title' => $val['cf_title'],
|
||||
'biz_name' => $val['biz_name'],
|
||||
'biz_poi' => $val['biz_poi'],
|
||||
'status_name' => $val['status_name'],
|
||||
'c_time' => date('Y-m-d H:i:s', $val['c_time']),
|
||||
];
|
||||
$data[] = $item;
|
||||
}
|
||||
}
|
||||
$fileName = '线索列表';
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
//分配
|
||||
@@ -846,7 +883,7 @@ class Clues extends HD_Controller
|
||||
$where = array();
|
||||
if (strlen($pid) > 0) {
|
||||
$where['pid'] = $pid;
|
||||
}else{
|
||||
} else {
|
||||
!$type && $type = 0;
|
||||
$where['type'] = $type;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class Customer extends HD_Controller
|
||||
$this->data['status_arr'] = $status_arr;
|
||||
$this->data['qdjl_lists'] = $qdjl_lists;
|
||||
$this->data['provinces'] = $this->province_ary();
|
||||
$this->data['export_button'] = SUPER_ADMIN == $this->role || in_array($this->uid, array(1, 62, 82)) ? 1 : 0;
|
||||
$this->data['export_button'] = SUPER_ADMIN == $this->role ? 1 : 0;
|
||||
$this->data['_title'] = '客户列表';
|
||||
return $this->show_view('receiver/customer/lists', true);
|
||||
}
|
||||
@@ -919,20 +919,17 @@ class Customer extends HD_Controller
|
||||
"dt_time" => "到店时间",
|
||||
"order_time" => "下单时间",
|
||||
"cont_time" => "最后联系时间",
|
||||
"c_brand" => "品牌归属",
|
||||
"of_title_1" => "来源1",
|
||||
"of_title_2" => "来源2",
|
||||
"biz_name" => "归属门店",
|
||||
"admin_name" => "归属顾问",
|
||||
"wxqy_name" => "企微好友",
|
||||
"wxgr_name" => "加个微",
|
||||
];
|
||||
|
||||
$count = $this->customers_model->count($where);
|
||||
$data = [];
|
||||
|
||||
|
||||
$onlineSources = $this->customers_model->offlineSources();
|
||||
$offlineSources = $this->customers_model->offlineSources();
|
||||
$status_arr = $this->customers_model->get_status();
|
||||
unset($status_arr['-1']);
|
||||
if ($count) {
|
||||
@@ -962,12 +959,10 @@ class Customer extends HD_Controller
|
||||
'dt_time' => $val['dt_time'],
|
||||
'order_time' => $val['order_time'],
|
||||
'cont_time' => $val['cont_time'],
|
||||
'c_brand' => $this->customers_model->cbrandAry($val['c_brand']),
|
||||
'of_title_1' => $of_title_1,
|
||||
'of_title_2' => $of_title_2,
|
||||
'biz_name' => $val['biz_name'],
|
||||
'admin_name' => $val['admin_name'],
|
||||
'wxqy_name' => $this->customers_model->wxqyAry($val['wxqy']),
|
||||
'wxgr_name' => $this->customers_model->wxgrAry($val['wxgr']),
|
||||
);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@ class OrdersList
|
||||
!$params['of2_id'] && $params['of2_id'] = '';
|
||||
!strlen($params['payway']) && $params['payway'] = '';
|
||||
!strlen($params['over_id']) && $params['over_id'] = '';
|
||||
$fieldAry = $this->get_fields($status_pid, 0, $params['status']);
|
||||
$fieldAry = $this->get_fields($status_pid, 0);
|
||||
$show_info['offlineSourcesAry'] = $this->ci->mdCustomers->offlineSources_search();
|
||||
$show_info['paywayAry'] = $this->paywayAry;//付款方式
|
||||
//渠道经理
|
||||
@@ -219,11 +219,13 @@ class OrdersList
|
||||
$fields['id_card'] = $val['card_id'];
|
||||
$fields['mobile'] = $size > 1000 ? '="' . $mobile . '"' : $mobile;
|
||||
$fields['car_name'] = "{$brand_name}-{$series_name}-{$car_name}";
|
||||
$fields['price_car'] = 0;
|
||||
$fields['payway_name'] = $this->paywayAry[$val['payway']];
|
||||
$fields['payway'] = $fields['payway_name'];
|
||||
$fields['brand_name'] = $brand_name;
|
||||
$fields['series_name'] = $series_name;
|
||||
$fields['c_name'] = $car_name;
|
||||
$fields['color'] = $val['color'];
|
||||
$fields['in_color'] = $val['in_color'];
|
||||
$status_name = $order_status_cn[$val['status']];
|
||||
$fields['status_name'] = $status_name;
|
||||
$fields['biz_name'] = $bizs[$val['biz_id']] ? $bizs[$val['biz_id']]['biz_name'] . '<br>' . $admins[$val['admin_id']] : '';
|
||||
@@ -251,44 +253,11 @@ class OrdersList
|
||||
|
||||
if ($size > 1000) {
|
||||
$user_info = '';
|
||||
if ($bizs[$val['biz_id']]['type'] == 3) { //代理店显示渠道经理的姓名
|
||||
$channel_users = $this->ci->app_licheb_channel_biz_model->select(['biz_id' => $val['biz_id']], '', '', '', 'uid');
|
||||
$user_ids = array_column($channel_users, 'uid');
|
||||
$user_ids_str = implode(',', $user_ids);
|
||||
if ($user_ids_str && $user_ids) {
|
||||
$where = [
|
||||
'group_id' => 4,
|
||||
'status' => 1,
|
||||
"id in ($user_ids_str)" => null
|
||||
];
|
||||
$users = $this->ci->mdLichebUsers->select($where, 'id desc', 1, 10, 'uname,biz_id'); //渠道经理
|
||||
$users && $user_info = implode(' ', array_column($users, 'uname'));
|
||||
}
|
||||
$fields['admin_name'] = $user_info;
|
||||
}
|
||||
if (!$user_info) {
|
||||
$sale = $this->ci->mdLichebUsers->get(['id' => $val['sale_id']], 'uname');
|
||||
$fields['admin_name'] = $sale['uname'];
|
||||
}
|
||||
$fields['address'] = $info_json['c_address'];
|
||||
}
|
||||
if (!$val['payway']) { //按揭
|
||||
$fields['pro_loan'] = '';
|
||||
$fields['price_loan'] = $money_json['price_loan'];
|
||||
$fields['is_sure'] = '';
|
||||
$fields['is_tiexi'] = '是';
|
||||
// 首付按揭
|
||||
$fields['pro_loan0'] = '222';
|
||||
$fields['price_loan0'] = 10;
|
||||
$fields['is_sure0'] = '是';
|
||||
$fields['is_tiexi'] = '是';
|
||||
}
|
||||
$srv_info = [];
|
||||
$fields['srv_info_total'] = $srv_info['total'] > 0 ? $srv_info['total'] : '';
|
||||
$fields['srv_info_fee_carno'] = $srv_info['fee_carno'] ? $srv_info['fee_carno'] : '';
|
||||
$fields['srv_info_price_finance'] = $srv_info['price_finance'] ? $srv_info['price_finance'] : '';
|
||||
$fields['srv_info_price_fine_select'] = $srv_info['price_fine_select'] ? $srv_info['price_fine_select'] : '';
|
||||
$fields['srv_info_price_fine_select_detail'] = $srv_info['price_fine_select_detail'] ? $srv_info['price_fine_select_detail'] : '';
|
||||
$lists[] = $fields;
|
||||
}
|
||||
}
|
||||
@@ -307,7 +276,7 @@ class OrdersList
|
||||
* @param int $export
|
||||
* @return array
|
||||
*/
|
||||
public function get_fields($status_pid, $export = 0, $status)
|
||||
public function get_fields($status_pid, $export = 0)
|
||||
{
|
||||
$fields1 = $fields2 = [];
|
||||
if ($export) {
|
||||
@@ -316,10 +285,10 @@ class OrdersList
|
||||
$fields1['id_card'] = ['title' => '证件号码'];
|
||||
$fields1['brand_name'] = ['title' => '品牌'];
|
||||
$fields1['series_name'] = ['title' => '车系'];
|
||||
$fields1['v_name'] = ['title' => '车型'];
|
||||
$fields1['cor_name'] = ['title' => '车身颜色'];
|
||||
$fields1['c_name'] = ['title' => '车型'];
|
||||
$fields1['color'] = ['title' => '车身颜色'];
|
||||
$fields1['in_color'] = ['title' => '内饰颜色'];
|
||||
$fields1['city_name'] = ['title' => '城市'];
|
||||
$fields1['biz_type'] = ['title' => '门店类型'];
|
||||
$fields1['biz_name'] = ['title' => '门店'];
|
||||
$fields1['admin_name'] = ['title' => '销售人员'];
|
||||
$fields1['of_title_1'] = ['title' => '来源1'];
|
||||
@@ -335,25 +304,9 @@ class OrdersList
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
if ($export) {
|
||||
unset($fields['price'], $fields['c_time'], $fields['car_name'], $fields['of_title']);
|
||||
$fields['payway_name'] = ['title' => '付款方式'];
|
||||
$fields['pro_loan0'] = ['title' => '首付按揭-金融机构'];
|
||||
$fields['price_loan0'] = ['title' => '首付按揭-金额'];
|
||||
$fields['is_sure0'] = ['title' => '首付按揭-确认到款(是/否)'];
|
||||
$fields['pro_loan'] = ['title' => '金融机构'];
|
||||
$fields['is_tiexi'] = ['title' => '贴息'];
|
||||
$fields['price_loan'] = ['title' => '按揭金额'];
|
||||
$fields['is_sure'] = ['title' => '确认到款(是/否)'];
|
||||
$fields['price_car'] = ['title' => '最终售价'];
|
||||
$fields['srv_info_total'] = ['title' => '手续费'];
|
||||
$fields['srv_info_fee_carno'] = ['title' => '手续费-上牌'];
|
||||
$fields['srv_info_price_finance'] = ['title' => '手续费-按揭'];
|
||||
$fields['srv_info_price_fine_select'] = ['title' => '手续费-精品选装'];
|
||||
$fields['srv_info_price_fine_select_detail'] = ['title' => '精品选装内容'];
|
||||
!$fields['c_time'] && $fields['c_time'] = ['title' => '订单时间'];
|
||||
!$fields['over_time'] && $fields['over_time'] = ['title' => '止交付时间'];
|
||||
!$fields['order_time'] && $fields['order_time'] = ['title' => '下定时间'];
|
||||
!$fields['bill_time'] && $fields['bill_time'] = ['title' => '开票时间'];
|
||||
$fields['address'] = ['title' => '联系人地址'];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -159,16 +159,19 @@
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100"
|
||||
onclick="edit_adviser();">分配
|
||||
</button>
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" id="import" class="am-btn am-btn-success am-btn-sm w100">导入</button>
|
||||
</div-->
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100"
|
||||
data-modal="/receiver/clues/get_add" data-title="新增线索">新增
|
||||
</button>
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out()"
|
||||
title="最多500条" v-if="export_button">导出
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,7 +179,7 @@
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered " >
|
||||
<table class="am-table am-table-bordered ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"><label class="checkall">
|
||||
@@ -194,14 +197,17 @@
|
||||
<? if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td style="vertical-align: middle;"><input type="checkbox" name="ids[]" class="order-ids" value="<?= $v['id'] ?>"/></td>
|
||||
<td style="vertical-align: middle;"><a data-open="/receiver/clues/get?id=<?= $v['id'] ?>&type=clues" href="javascript:void(0);" ><?= $v['name'] ?><br><?= $v['mobile'] ?></a></td>
|
||||
<td style="vertical-align: middle;"><input type="checkbox" name="ids[]" class="order-ids"
|
||||
value="<?= $v['id'] ?>"/></td>
|
||||
<td style="vertical-align: middle;"><a
|
||||
data-open="/receiver/clues/get?id=<?= $v['id'] ?>&type=clues"
|
||||
href="javascript:void(0);"><?= $v['name'] ?><br><?= $v['mobile'] ?></a></td>
|
||||
<td style="vertical-align: middle;"><?= $v['cf_title'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['poi'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['biz_poi']?><br><?=$v['biz_name'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['biz_poi'] ?><br><?= $v['biz_name'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['status_name'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
|
||||
<td style="vertical-align: middle;"><?=$v['admin']?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['admin'] ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
} ?>
|
||||
@@ -240,21 +246,27 @@
|
||||
vue_obj = new Vue({
|
||||
el: '#search_form',
|
||||
data: {
|
||||
province_id:<?=$params['province_id'] ? $params['province_id'] : 0?>,
|
||||
city_id:<?=$params['city_id'] ? $params['city_id'] : 0?>,
|
||||
county_id:<?=$params['county_id'] ? $params['county_id'] : 0?>,
|
||||
province_id_admin:<?=$params['province_id_admin'] ? $params['province_id_admin'] : 0?>,
|
||||
city_id_admin:<?=$params['city_id_admin'] ? $params['city_id_admin'] : 0?>,
|
||||
county_id_admin:<?=$params['county_id_admin'] ? $params['county_id_admin'] : 0?>,
|
||||
biz_id_admin:<?=$params['biz_id_admin'] ? $params['biz_id_admin'] : 0?>,
|
||||
cfrom_id:<?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
|
||||
cfrom_id2:<?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
|
||||
province_id: <?=$params['province_id'] ? $params['province_id'] : 0?>,
|
||||
city_id: <?=$params['city_id'] ? $params['city_id'] : 0?>,
|
||||
county_id: <?=$params['county_id'] ? $params['county_id'] : 0?>,
|
||||
province_id_admin: <?=$params['province_id_admin'] ? $params['province_id_admin'] : 0?>,
|
||||
city_id_admin: <?=$params['city_id_admin'] ? $params['city_id_admin'] : 0?>,
|
||||
county_id_admin: <?=$params['county_id_admin'] ? $params['county_id_admin'] : 0?>,
|
||||
biz_id_admin: <?=$params['biz_id_admin'] ? $params['biz_id_admin'] : 0?>,
|
||||
cfrom_id: <?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
|
||||
cfrom_id2: <?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
|
||||
cfroms: [],
|
||||
cfroms2: [],
|
||||
provinceAry: [],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
admins: {provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>, cityAry: [], countyAry: [], bizAry: []},
|
||||
admins: {
|
||||
provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>,
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
bizAry: []
|
||||
},
|
||||
export_button: <?=$export_button?>,
|
||||
},
|
||||
mounted: function () {
|
||||
this.init_provinces();
|
||||
@@ -332,7 +344,22 @@
|
||||
that.biz_id_admin = '0';
|
||||
that.cfrom_id = 0;
|
||||
that.cfrom_id2 = 0;
|
||||
}
|
||||
},
|
||||
export_out: function () {
|
||||
var that = this;
|
||||
if (that.export_button == 0) {
|
||||
layer.msg('无权限导出');
|
||||
return false;
|
||||
}
|
||||
let count = <?=$pager['totle']?>;
|
||||
if (count == 0) {
|
||||
layer.msg('没有数据可导出');
|
||||
return false;
|
||||
}
|
||||
let href = $.menu.parseUri(window.location.href);
|
||||
href = href.replace("clues?", "clues/export?");
|
||||
window.location.href = href;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'province_id': function (nv, ov) {
|
||||
|
||||
@@ -160,7 +160,8 @@
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="today">今日</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);"
|
||||
data-date="yesterday">昨日</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="weeks">本周</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="month">本月</a>
|
||||
</div>
|
||||
@@ -176,10 +177,12 @@
|
||||
<input type="button" @click="btnTags" value="客户画像" class="am-btn am-btn-success am-btn-sm">
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<input type="button" @click="btnTagsIntention" value="客户意向" class="am-btn am-btn-success am-btn-sm">
|
||||
<input type="button" @click="btnTagsIntention" value="客户意向"
|
||||
class="am-btn am-btn-success am-btn-sm">
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<input type="button" @click="btnTagsDefeat" value="战败标签" class="am-btn am-btn-success am-btn-sm">
|
||||
<input type="button" @click="btnTagsDefeat" value="战败标签"
|
||||
class="am-btn am-btn-success am-btn-sm">
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
@@ -187,10 +190,12 @@
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
<!--div class="am-form-group fl ml10" v-if="export_button==1">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out()" title="最多500条">导出(带标签)</button>
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out(0)">导出(无标签)</button>
|
||||
</div-->
|
||||
<div class="am-form-group fl ml10" v-if="export_button==1">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out()"
|
||||
title="最多500条">导出(带标签)
|
||||
</button>
|
||||
<!--button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out(0)">导出(无标签)</button-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input name="status" value="<?= $params['status'] ?>" type="hidden">
|
||||
@@ -222,7 +227,9 @@
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr>
|
||||
<td style="vertical-align: middle;">{{v.cid}}</td>
|
||||
<td style="vertical-align: middle;"><a href="javascript:void(0);" :data-open="'/receiver/customer/get?id='+v.id">{{v.name}}<br>{{v.mobile_sub}}</a></td>
|
||||
<td style="vertical-align: middle;"><a href="javascript:void(0);"
|
||||
:data-open="'/receiver/customer/get?id='+v.id">{{v.name}}<br>{{v.mobile_sub}}</a>
|
||||
</td>
|
||||
<td style="vertical-align: middle;">{{v.level}}</td>
|
||||
<td style="vertical-align: middle;">{{v.of_title}}</td>
|
||||
<td style="vertical-align: middle;">{{v.biz_poi}}<br>{{v.biz_name}}</td>
|
||||
@@ -395,8 +402,24 @@
|
||||
searchTpAry: [],
|
||||
lists: [],
|
||||
qdjl_lists: [],
|
||||
admins: {provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>, cityAry: [], countyAry: [], bizAry: [], list: []},
|
||||
show_info: {levelAry: [], wxqyAry: [], wxgrAry: [], csbizidAry: [], tags: [], cfroms:[],cfroms2: [], tagsIntention: [], tagsDefeat: []},
|
||||
admins: {
|
||||
provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>,
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
bizAry: [],
|
||||
list: []
|
||||
},
|
||||
show_info: {
|
||||
levelAry: [],
|
||||
wxqyAry: [],
|
||||
wxgrAry: [],
|
||||
csbizidAry: [],
|
||||
tags: [],
|
||||
cfroms: [],
|
||||
cfroms2: [],
|
||||
tagsIntention: [],
|
||||
tagsDefeat: []
|
||||
},
|
||||
of2Ary: [],
|
||||
bizTypeAry: [],
|
||||
export_button: 0,
|
||||
@@ -619,16 +642,16 @@
|
||||
});
|
||||
$("#times_checkbox").prop("checked", false);
|
||||
},
|
||||
export_out: function (tag=1) {
|
||||
export_out: function (tag = 1) {
|
||||
var that = this;
|
||||
if (that.export_button == 0){
|
||||
if (that.export_button == 0) {
|
||||
layer.msg('无权限导出');
|
||||
return false;
|
||||
}
|
||||
let count = <?=$pager['totle']?>;
|
||||
if (count == 0) {
|
||||
layer.msg('没有数据可导出');
|
||||
return false;
|
||||
layer.msg('没有数据可导出');
|
||||
return false;
|
||||
}
|
||||
let href = $.menu.parseUri(window.location.href);
|
||||
href = href.replace("customer?", "customer/export?");
|
||||
|
||||
@@ -160,10 +160,10 @@
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
<!--div class="am-form-group fl ml10">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" @click="export_out(0)" class="am-btn am-btn-success am-btn-sm w100">导出
|
||||
</button>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: linfan
|
||||
* Date: 2018-11-28
|
||||
* Time: 16:49
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
require_once COMMPATH . 'third_party/PHPExcel.php';
|
||||
|
||||
class Excel extends PHPExcel
|
||||
{
|
||||
|
||||
/*
|
||||
* 导出Excel
|
||||
* @param array $data 数据数组
|
||||
* @param array $indexs 设置要导出的字段 array('key1' => '中文名称1', 'key2' => '中文名称2', ...)
|
||||
* @param string $filename 导出文件名称
|
||||
*/
|
||||
public function out($data, $indexs = array(), $filename = '')
|
||||
{
|
||||
if ($data) {
|
||||
$excel = new PHPExcel();
|
||||
$sheet = $excel->getActiveSheet();
|
||||
$cells = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
|
||||
$startRow = 1;
|
||||
|
||||
$indexs_key = $indexs ? array_keys($indexs) : array_keys($data);
|
||||
$indexs_name = $indexs ? array_values($indexs) : array_keys($data);
|
||||
|
||||
foreach ($data as $row) {
|
||||
foreach ($indexs_key as $key => $value) {
|
||||
$startRow == 1 ? $sheet->setCellValue($cells[$key] . $startRow, $indexs_name[$key]) : $sheet->setCellValue($cells[$key] . $startRow, $row[$value]);
|
||||
}
|
||||
|
||||
$startRow++;
|
||||
}
|
||||
|
||||
!$filename && $filename = date('YmdHis');
|
||||
|
||||
header("Pragma: public");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Type:application/vnd.ms-execl");
|
||||
header("Content-Type:application/octet-stream");
|
||||
header("Content-Type:application/download");;
|
||||
header('Content-Disposition:attachment;filename=' . $filename . '.xlsx');
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
|
||||
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
|
||||
$writer->save('php://output');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出 Excel支持多个 sheet
|
||||
* @param array $content 内容
|
||||
* @param string $fileName 文件名
|
||||
* @throws PHPExcel_Exception
|
||||
* @throws PHPExcel_Reader_Exception
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function exportExcel($content = [], $fileName = '')
|
||||
{
|
||||
if (empty($content)) die('内容不能为空!');
|
||||
if (empty($fileName)) die('文件名不能为空!');
|
||||
// 设置页面等待时间
|
||||
set_time_limit(0);
|
||||
// 不限制内存
|
||||
ini_set('memory_limit', -1);
|
||||
$objPHPExcel = new PHPExcel();
|
||||
// 所有单元格居中
|
||||
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$i = 0;
|
||||
// 外循环产生每一项 Sheet
|
||||
foreach ($content as $key => $value) {
|
||||
// 创建新的工作空间 sheet
|
||||
if ($i > 0) $objPHPExcel->createSheet();
|
||||
$objPHPExcel->setActiveSheetIndex($i);
|
||||
// 给 Sheet 设置名字
|
||||
$objPHPExcel->getActiveSheet()->setTitle($key);
|
||||
// 内容
|
||||
$j = 1;
|
||||
// 外循环产生每一列
|
||||
foreach ($value as $val) {
|
||||
// 内循环产生每一行
|
||||
foreach ($val as $k => $v) {
|
||||
// 数字列转换为字母列 如:27变为AA
|
||||
$objPHPExcel->getActiveSheet()->setCellValue(PHPExcel_Cell::stringFromColumnIndex($k) . $j, $v);
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$filename = iconv('UTF-8', 'UTF-8', $fileName) . '.xls';
|
||||
header('Pragma: public');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Content-Type: application/force-download');
|
||||
header('Content-Type: application/vnd.ms-execl');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Type: application/download');
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
}
|
||||
|
||||
/**
|
||||
* cvs格式导出
|
||||
* @param $data
|
||||
* @param array $indexs
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
*/
|
||||
public function out_csv($data, $indexs = array(), $filename = '')
|
||||
{
|
||||
header("Pragma: public");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Type:application/vnd.ms-execl");
|
||||
header("Content-Type:application/octet-stream");
|
||||
header("Content-Type:application/download");;
|
||||
header('Content-Disposition:attachment;filename=' . $filename . '.csv');
|
||||
header("Content-Transfer-Encoding:binary");
|
||||
|
||||
|
||||
$fp = fopen('php://output', 'a');
|
||||
|
||||
$indexs_key = $indexs ? array_keys($indexs) : array_keys($data);
|
||||
|
||||
//每隔$limit行,刷新一下输出buffer,不要太大,也不要太小
|
||||
$limit = 100000;
|
||||
$num = 0;
|
||||
foreach ($data as $k => $v) {
|
||||
$num++;
|
||||
//刷新一下输出buffer,防止由于数据过多造成问题
|
||||
if ($limit == $num) {
|
||||
ob_flush();
|
||||
flush();
|
||||
$num = 0;
|
||||
}
|
||||
|
||||
$row = array();
|
||||
foreach ($indexs_key as $col) {
|
||||
if (in_array($col, array('sid', 'refund_no')) && is_numeric($v[$col])) {
|
||||
$row[] = iconv('utf-8', 'GBK//IGNORE', "=\"{$v[$col]}\"");
|
||||
} else {
|
||||
$row[] = iconv('utf-8', 'GBK//IGNORE', $v[$col]);
|
||||
}
|
||||
}
|
||||
//将数据通过fputcsv写到文件句柄
|
||||
fputcsv($fp, $row);
|
||||
}
|
||||
|
||||
return fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data "数据数组"
|
||||
* @param $indexs "数据字段对应的列"
|
||||
* @param $file "文件路径"
|
||||
* @param $mode "a追加"
|
||||
* @return bool
|
||||
*/
|
||||
public function save($data, $indexs, $file, $mode = '')
|
||||
{
|
||||
$dir = substr($file, 0, strrpos($file, '/'));
|
||||
if (!file_exists($dir) && !mkdir($dir, 0777, true)) {//创建文件夹失败
|
||||
return false;
|
||||
}
|
||||
if ('a' == $mode && file_exists($file)) {
|
||||
$excel = PHPExcel_IOFactory::load($file);
|
||||
$sheet = $excel->getActiveSheet();
|
||||
$startRow = $sheet->getHighestRow() + 1;
|
||||
} else {
|
||||
$excel = new PHPExcel();
|
||||
$sheet = $excel->getActiveSheet();
|
||||
$startRow = 1;
|
||||
}
|
||||
$cells = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
|
||||
|
||||
foreach ($data as $row) {
|
||||
foreach ($indexs as $key => $value) {
|
||||
$sheet->setCellValue($cells[$key] . $startRow, $row[$value]);
|
||||
}
|
||||
|
||||
$startRow++;
|
||||
}
|
||||
|
||||
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
|
||||
$writer->save($file);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用csv方式保存
|
||||
* @param $data
|
||||
* @param $indexs
|
||||
* @param $file
|
||||
* @param string $mode
|
||||
* @return bool
|
||||
*/
|
||||
function csv($data, $indexs, $file, $mode = 'a')
|
||||
{
|
||||
$dir = substr($file, 0, strrpos($file, '/'));
|
||||
if (!file_exists($dir) && !mkdir($dir, 0777, true)) {//创建文件夹失败
|
||||
return false;
|
||||
}
|
||||
|
||||
$fp = fopen($file, $mode);
|
||||
|
||||
//每隔$limit行,刷新一下输出buffer,不要太大,也不要太小
|
||||
$limit = 100000;
|
||||
$num = 0;
|
||||
foreach ($data as $k => $v) {
|
||||
$num++;
|
||||
//刷新一下输出buffer,防止由于数据过多造成问题
|
||||
if ($limit == $num) {
|
||||
ob_flush();
|
||||
flush();
|
||||
$num = 0;
|
||||
}
|
||||
|
||||
$row = array();
|
||||
foreach ($indexs as $col) {
|
||||
if (in_array($col, array('sid', 'refund_no')) && is_numeric($v[$col])) {
|
||||
$row[] = iconv('utf-8', 'GBK//IGNORE', "=\"{$v[$col]}\"");
|
||||
} else {
|
||||
$row[] = iconv('utf-8', 'GBK//IGNORE', $v[$col]);
|
||||
}
|
||||
}
|
||||
//将数据通过fputcsv写到文件句柄
|
||||
fputcsv($fp, $row);
|
||||
}
|
||||
|
||||
return fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel,第一行支持多列表头合并
|
||||
* @param $data
|
||||
* @param $indexs
|
||||
* @param $headers
|
||||
* @param $sheet_title
|
||||
* @param $filename
|
||||
* @return bool
|
||||
*/
|
||||
public function excel2($data, $indexs, $headers=array(), $sheet_title='sheet1', $filename=''){
|
||||
!$sheet_title && $sheet_title = 'sheet1';
|
||||
!$filename && $filename = 'excel_' . date('YmdHis');
|
||||
set_time_limit(0); // 设置页面等待时间
|
||||
ini_set('memory_limit', -1); // 不限制内存
|
||||
|
||||
$objPHPExcel = new PHPExcel();
|
||||
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); // 单元格整体居右
|
||||
$objPHPExcel->setActiveSheetIndex(0); // 选中默认的第一个sheet
|
||||
$objPHPExcel->getActiveSheet()->setTitle($sheet_title); // 给 Sheet 设置名字
|
||||
|
||||
# 先生成表头
|
||||
$i = 0;
|
||||
$column_num = 0;
|
||||
foreach ($indexs as $k => $v){
|
||||
$columnkey = PHPExcel_Cell::stringFromColumnIndex($i);
|
||||
if ($column_num || in_array($k, array_keys($headers))){
|
||||
if (in_array($k, array_keys($headers)) && !$headers[$k]['is_create']){
|
||||
$column_num = $headers[$k]['column_num'];
|
||||
$title = $headers[$k]['title'];
|
||||
$headers[$k]['is_create'] = 1;
|
||||
# 第一行需合并多列的列
|
||||
$columnkey2 = PHPExcel_Cell::stringFromColumnIndex($i + $column_num - 1);
|
||||
$pRange = $columnkey.'1:'.$columnkey2.'1';
|
||||
$pCoordinate = $columnkey.'1';
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($pRange);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($pCoordinate, $title);
|
||||
|
||||
# 水平居中
|
||||
$objStyle = $objPHPExcel->getActiveSheet()->getStyle($pCoordinate); //获取要设置单元格的样式,括号里的内容也可是:('A1:E1')
|
||||
$objAlign = $objStyle->getAlignment(); //用来设置对齐属性和单元格内文本换行的一个变量
|
||||
$objAlign->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
}
|
||||
|
||||
# 第二行的列
|
||||
$pCoordinate = $columnkey.'2';
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($pCoordinate, $v);
|
||||
|
||||
$column_num--;
|
||||
}
|
||||
else{
|
||||
# 第一二行需合并的列
|
||||
$pRange = $columnkey.'1:'.$columnkey.'2';
|
||||
$pCoordinate = $columnkey.'1';
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($pRange);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($pCoordinate, $v);
|
||||
|
||||
# 垂直居中
|
||||
$objStyle = $objPHPExcel->getActiveSheet()->getStyle($pCoordinate);
|
||||
$objAlign = $objStyle->getAlignment();
|
||||
$objAlign->setVertical(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# 再生成数据
|
||||
$data = array_slice($data, 1);
|
||||
$j = 3;
|
||||
foreach ($data as $val) {
|
||||
$i = 0;
|
||||
// 内循环产生每一行
|
||||
foreach ($indexs as $k => $v){
|
||||
// 数字列转换为字母列 如:27变为AA
|
||||
$objPHPExcel->getActiveSheet()->setCellValue(PHPExcel_Cell::stringFromColumnIndex($i) . $j, $val[$k]);
|
||||
$i++;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
$filename = iconv('UTF-8', 'UTF-8', $filename) . '.xls';
|
||||
header('Pragma: public');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Content-Type: application/force-download');
|
||||
header('Content-Type: application/vnd.ms-execl');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Type: application/download');
|
||||
header("Content-Disposition: attachment; filename=$filename");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
return $objWriter->save('php://output');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user