|
@@ -101,16 +101,16 @@ class TalentAllowance extends EnterpriseController {
|
|
|
|
|
|
$batch = BatchApi::getValidBatch(ProjectState::JBT, $this->user["type"])["batch"];
|
|
|
if (!$batch) {
|
|
|
- return new Response(Response::ERROR, "当前并无有效的申报批次进行中");
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, "当前并无有效的申报批次进行中"), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
if (!$tmp) {
|
|
|
- return new Response(Response::ERROR, "没有上传批量申请文档");
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, "没有上传批量申请文档"), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
if (!isExcelFile($tmp->getMime())) {
|
|
|
- return new Response(Response::ERROR, "只能识别Excel文档");
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, "只能识别Excel文档"), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
if (round($tmp->getSize() / 1024 / 1024, 2) > $maxFileSize) {
|
|
|
- return new Response(Response::ERROR, "文档大小不能超过10MB");
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, "文档大小不能超过10MB"), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
$filepath = $tmp->getPathname();
|
|
|
$rows = getExcelDatas($filepath);
|
|
@@ -125,35 +125,35 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$idCard = trim($row[1]);
|
|
|
$allowanceType = trim($row[2]);
|
|
|
if (!$idCard) {
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行身份证不能放空,请仔细检查内容完整后再重新提交", $no));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行身份证不能放空,请仔细检查内容完整后再重新提交", $no)), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
if (in_array($idCard, $idCards)) {
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行身份证存在重复,请请仔细检查内容无误后再重新提交", $no));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行身份证存在重复,请请仔细检查内容无误后再重新提交", $no)), "TalentAllowanceInfo.importCallBack");
|
|
|
} else {
|
|
|
$idCards[] = $idCard;
|
|
|
}
|
|
|
if (!in_array($allowanceType, $allowanceTypes)) {
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行申请补贴类型错误,请仔细检查内容无误后再重新提交", $no));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行申请补贴类型错误,请仔细检查内容无误后再重新提交", $no)), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
if ($allowanceType == "工作津贴") {
|
|
|
for ($i = 3; $i < 9; $i++) {
|
|
|
$monthstr = str_replace([" ", ","], ",", trim($row[$i]));
|
|
|
$months = array_filter(explode(",", $monthstr));
|
|
|
if (!$months)
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行%s不能为空,请仔细检查内容完整后再重新提交", $no, $titles[$i]));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行%s不能为空,请仔细检查内容完整后再重新提交", $no, $titles[$i])), "TalentAllowanceInfo.importCallBack");
|
|
|
if (array_diff($months, $checkMonths))
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行%s错误,请查看模板文档对应列说明修改后再重新提交", $no, $titles[$i]));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行%s错误,请查看模板文档对应列说明修改后再重新提交", $no, $titles[$i])), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
} else {
|
|
|
$monthstr = str_replace([" ", ","], ",", trim($row[5]));
|
|
|
$monthstr = str_replace(":", ":", $monthstr);
|
|
|
$months = array_filter(explode(",", $monthstr));
|
|
|
if (!$months)
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行%s不能为空,请仔细检查内容完整后再重新提交", $no, $titles[5]));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行%s不能为空,请仔细检查内容完整后再重新提交", $no, $titles[5])), "TalentAllowanceInfo.importCallBack");
|
|
|
foreach ($months as $m) {
|
|
|
list($a, $b) = explode(":", $m);
|
|
|
if (!in_array($a, $checkMonths) || !is_numeric($b) || $b > 31 || $b < 0)
|
|
|
- return new Response(Response::ERROR, sprintf("第%d行%s错误,请查看模板文档对应列说明修改后再重新提交", $no, $titles[5]));
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行%s错误,请查看模板文档对应列说明修改后再重新提交", $no, $titles[5])), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -161,7 +161,7 @@ class TalentAllowance extends EnterpriseController {
|
|
|
for ($i = 0; $i < count($rows); $i++) {
|
|
|
queue("app\job\TalentAllowance", ["type" => 1, "method" => 2, "data" => $rows[$i], "enterprise" => $this->user, "year" => $batch, "allowanceType" => trim($rows[$i][2]) == "工作津贴" ? 1 : 2]);
|
|
|
}
|
|
|
- return new Response(Response::SUCCESS, "已经成功添加到计划任务,请稍候查看申报列表进行确认");
|
|
|
+ return \StrUtil::back(new Response(Response::SUCCESS, "已经成功添加到计划任务,请稍候查看申报列表进行确认"), "TalentAllowanceInfo.importCallBack");
|
|
|
}
|
|
|
|
|
|
private function save($talentAllowance, \think\Request $request) {
|