|
@@ -17,12 +17,20 @@ class DirectlyIdentify extends AdminController{
|
|
}
|
|
}
|
|
|
|
|
|
public function enterprise_import(){
|
|
public function enterprise_import(){
|
|
- if (!$this->request->file())
|
|
|
|
- return json(["msg" => "没有选择文件"]);
|
|
|
|
|
|
+ $response_obj = new \StdClass();
|
|
|
|
+ if (!$this->request->file()){
|
|
|
|
+ $response_obj->code = 500;
|
|
|
|
+ $response_obj->msg = '没有选择文件';
|
|
|
|
+ return \StrUtil::back($response_obj, "DirectlyIdentify.callBack");
|
|
|
|
+ }
|
|
|
|
+
|
|
$excel = $this->request->file("file");
|
|
$excel = $this->request->file("file");
|
|
|
|
|
|
- if (!isExcelFile($excel->getMime()))
|
|
|
|
- return json(["msg" => "不是正确的Excel文件"]);
|
|
|
|
|
|
+ if (!isExcelFile($excel->getMime())){
|
|
|
|
+ $response_obj->code = 500;
|
|
|
|
+ $response_obj->msg = '不是正确的Excel文件,该文件类型为:'.$excel->getMime();
|
|
|
|
+ return \StrUtil::back($response_obj, "DirectlyIdentify.callBack");
|
|
|
|
+ }
|
|
|
|
|
|
$savename = \think\facade\Filesystem::disk("public")->putFile("uploadexcel", $excel);
|
|
$savename = \think\facade\Filesystem::disk("public")->putFile("uploadexcel", $excel);
|
|
|
|
|
|
@@ -46,12 +54,20 @@ class DirectlyIdentify extends AdminController{
|
|
}
|
|
}
|
|
|
|
|
|
public function talent_import(){
|
|
public function talent_import(){
|
|
- if (!$this->request->file())
|
|
|
|
- return json(["msg" => "没有选择文件"]);
|
|
|
|
|
|
+ $response_obj = new \StdClass();
|
|
|
|
+ if (!$this->request->file()){
|
|
|
|
+ $response_obj->code = 500;
|
|
|
|
+ $response_obj->msg = '没有选择文件';
|
|
|
|
+ return \StrUtil::back($response_obj, "DirectlyIdentify.callBack");
|
|
|
|
+ }
|
|
|
|
+
|
|
$excel = $this->request->file("file");
|
|
$excel = $this->request->file("file");
|
|
|
|
|
|
- if (!isExcelFile($excel->getMime()))
|
|
|
|
- return json(["msg" => "不是正确的Excel文件"]);
|
|
|
|
|
|
+ if (!isExcelFile($excel->getMime())){
|
|
|
|
+ $response_obj->code = 500;
|
|
|
|
+ $response_obj->msg = '不是正确的Excel文件,该文件类型为:'.$excel->getMime();
|
|
|
|
+ return \StrUtil::back($response_obj, "DirectlyIdentify.callBack");
|
|
|
|
+ }
|
|
|
|
|
|
$savename = \think\facade\Filesystem::disk("public")->putFile("uploadexcel", $excel);
|
|
$savename = \think\facade\Filesystem::disk("public")->putFile("uploadexcel", $excel);
|
|
|
|
|
|
@@ -67,7 +83,7 @@ class DirectlyIdentify extends AdminController{
|
|
|
|
|
|
queue("app\job\Import", ["id" => $id,"type" => 2]);
|
|
queue("app\job\Import", ["id" => $id,"type" => 2]);
|
|
|
|
|
|
- $response_obj = new \StdClass();
|
|
|
|
|
|
+
|
|
$response_obj->code = 200;
|
|
$response_obj->code = 200;
|
|
$response_obj->msg = '导入成功';
|
|
$response_obj->msg = '导入成功';
|
|
return \StrUtil::back($response_obj, "DirectlyIdentify.callBack");
|
|
return \StrUtil::back($response_obj, "DirectlyIdentify.callBack");
|