修改教师姓名拼音计算方式,修改文件下载方法
This commit is contained in:
1 parent
6ef5d7058c
commit
5c625dc46a
34 files changed
+43364
-507
No files matched your search
@@ -413,44 +413,3 @@ function strToarray($str)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @access public
|
||||
* @param $url 文件地址
|
||||
* @param $newname 新文件名
|
||||
* @return array 返回类型
|
||||
*/
|
||||
function smDownload($url,$newname='')
|
||||
{
|
||||
$file = $url;
|
||||
|
||||
if(strlen($newname)==0)
|
||||
{
|
||||
$newname = filesize($file);
|
||||
}
|
||||
|
||||
|
||||
if (file_exists($file)) {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename='.$newname);
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
ob_clean();
|
||||
flush();
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -784,7 +784,7 @@ class Student extends BaseController
|
||||
public function download()
|
||||
{
|
||||
$url = public_path().'public\\uploads\\student\\student_template.xlsx';
|
||||
return smDownload($url,'学生名单模板.xlsx');
|
||||
return download($url,'学生名单模板.xlsx');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -319,20 +319,24 @@ class Teacher extends BaseController
|
||||
return json($data);
|
||||
}
|
||||
|
||||
$pinyin = new \Overtrue\Pinyin\Pinyin;
|
||||
|
||||
$aa = $pinyin->abbr('带着希望去旅行');
|
||||
|
||||
|
||||
// 删除标题行
|
||||
array_splice($teacherinfo,0,4 );
|
||||
|
||||
$teacherinfo = array_filter($teacherinfo,function($item){
|
||||
return $item[1] !== null && $item[2] !== null && $item[3] !== null ;
|
||||
});
|
||||
|
||||
|
||||
// 整理数据
|
||||
$i = 0;
|
||||
$teacherlist = array();
|
||||
|
||||
foreach ($teacherinfo as $key => $value) {
|
||||
// 如果姓名、性别、出生日期、全拼、首拼为空则跳过
|
||||
if(empty($value[1]) || empty($value[2]) || empty($value[3]) || empty($value[11]) || empty($value[12]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 整理数据
|
||||
$teacherlist[$i]['xingming'] = $value[1];
|
||||
@@ -346,8 +350,10 @@ class Teacher extends BaseController
|
||||
$teacherlist[$i]['subject'] = srcSubject($value[7]);
|
||||
$teacherlist[$i]['zhuanye'] = $value[9];
|
||||
$teacherlist[$i]['xueli'] = srcXl($value[10]);
|
||||
$teacherlist[$i]['quanpin'] = trim(strtolower(str_replace(' ', '', $value[11])));
|
||||
$teacherlist[$i]['shoupin'] = trim(strtolower($value[12]));
|
||||
$quanpin = $pinyin->sentence($value[1]);
|
||||
$jianpin = $pinyin->abbr($value[1]);
|
||||
$teacherlist[$i]['quanpin'] = trim(strtolower(str_replace(' ', '', $quanpin)));
|
||||
$teacherlist[$i]['shoupin'] = trim(strtolower($jianpin));
|
||||
|
||||
$i++;
|
||||
}
|
||||
@@ -420,15 +426,9 @@ class Teacher extends BaseController
|
||||
public function downloadXls()
|
||||
{
|
||||
$url = public_path().'public\\uploads\\teacher\\TeacherInfo.xlsx';
|
||||
return smDownload($url,'教师名单模板.xlsx');
|
||||
return download($url,'教师名单模板.xlsx');
|
||||
}
|
||||
|
||||
// 下载表格VBA代码
|
||||
public function downloadVba()
|
||||
{
|
||||
$url = public_path().'public\\uploads\\teacher\\jiaoShiXingMingVBA.bas';
|
||||
return smDownload($url,'jiaoShiXingMingVBA.bas');
|
||||
}
|
||||
|
||||
|
||||
// 查询教师荣誉
|
||||
|
||||
Loaded 3 of 34 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user