|
|
@@ -9,6 +9,7 @@ use common\helpers\Excel;
|
|
|
use common\helpers\Form;
|
|
|
use common\helpers\http\RemoteUploadApi;
|
|
|
use common\helpers\ocr\OcrApi;
|
|
|
+use common\helpers\Tool;
|
|
|
use common\helpers\user\Info;
|
|
|
use common\models\ExcelAddUser;
|
|
|
use common\models\ExcelImport;
|
|
|
@@ -66,6 +67,7 @@ class UploadForm extends Model {
|
|
|
'invoiceFront' => ['file', 'token', 'remark', 'withdrawId'],
|
|
|
'proveFront' => ['file', 'token', 'rechargeId'],
|
|
|
'ad' => ['file', 'token'],
|
|
|
+ 'article' => ['file', 'token'],
|
|
|
'excel' => ['file', 'token', 'excelOption'],
|
|
|
'goodsImg' => ['file', 'token'],
|
|
|
];
|
|
|
@@ -170,21 +172,23 @@ class UploadForm extends Model {
|
|
|
'md5' => $uploadResult['md5'] ?? null,
|
|
|
];
|
|
|
} else {
|
|
|
- throw new Exception('文件远程上传失败');
|
|
|
+ throw new Exception('Remote service error');
|
|
|
}
|
|
|
// 删除本地临时文件
|
|
|
unlink($this->file->tempName);
|
|
|
} else {
|
|
|
+ // 生成文件名
|
|
|
+ $fileName = Tool::generateId(false);
|
|
|
// 保存在本地
|
|
|
- $localPath = \Yii::getAlias('@common/runtime/uploads/') . $this->file->baseName . '.' . $this->file->extension;
|
|
|
+ $localPath = \Yii::getAlias('@common/runtime/uploads/') . $fileName . '.' . $this->file->extension;
|
|
|
if (!$this->file->saveAs($localPath)) {
|
|
|
- throw new Exception('文件保存失败');
|
|
|
+ throw new Exception('Failed');
|
|
|
}
|
|
|
$uploadInfo = [
|
|
|
- 'fileName' => $this->file->baseName . '.' . $this->file->extension,
|
|
|
+ 'fileName' => $fileName . '.' . $this->file->extension,
|
|
|
'category' => $uploadCategory,
|
|
|
// 'url' => $localPath,
|
|
|
- 'url' => $this->file->baseName . '.' . $this->file->extension,
|
|
|
+ 'url' => $fileName . '.' . $this->file->extension,
|
|
|
'fileSize' => null,
|
|
|
'md5' => null,
|
|
|
];
|
|
|
@@ -200,7 +204,7 @@ class UploadForm extends Model {
|
|
|
$uploads->REMARK = $uploadRemark;
|
|
|
$uploads->CREATED_AT = Date::nowTime();
|
|
|
if (!$uploads->save()) {
|
|
|
- throw new Exception('上传文件信息保存失败');
|
|
|
+ throw new Exception('Save error');
|
|
|
}
|
|
|
// 如果是上传发票,更新发票信息,并绑定提现记录
|
|
|
if ($this->scenario == 'invoiceFront') {
|