PdfFile.php
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace App\Models\File;
use App\Models\Base;
/**
* App\Models\File\PdfFile
*
* @property int $id
* @property int $pid AICC用户ID
* @property string $file_path 生成文件路径
* @property int $is_pdf 0 - 未生成 1 - 已生成 2 - 其它问题
* @property int|null $is_push 0 - 未推送 1 - 已推送 2 - 其他问题
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method \Illuminate\Database\Eloquent\Builder|PdfFile newModelQuery()
* @method \Illuminate\Database\Eloquent\Builder|PdfFile newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|PdfFile query()
* @method \Illuminate\Database\Eloquent\Builder|PdfFile whereCreatedAt($value)
* @method \Illuminate\Database\Eloquent\Builder|PdfFile whereFilePath($value)
* @method \Illuminate\Database\Eloquent\Builder|PdfFile whereId($value)
* @method \Illuminate\Database\Eloquent\Builder|PdfFile whereIsPdf($value)
* @method \Illuminate\Database\Eloquent\Builder|PdfFile whereIsPush($value)
* @method \Illuminate\Database\Eloquent\Builder|PdfFile wherePid($value)
* @method \Illuminate\Database\Eloquent\Builder|PdfFile whereUpdatedAt($value)
* @mixin \Eloquent
*/
class PdfFile extends Base
{
protected $table = 'gl_pdf_file';
/** @var int PDF - 未生成 */
const GENERATE_NOT_PDF = 0;
/** @var int PDF - 已生成 */
const GENERATE_PDF = 1;
/** @var int PDF - 其它问题 */
const GENERATE_OTHER_PDF = 2;
/** @var int AICC - 未推送 */
const GENERATE_NOT_PUSH = 0;
/** @var int AICC - 已推送 */
const GENERATE_PUSH = 1;
/** @var int AICC - 其他问题 */
const GENERATE_OTHER_PUSH = 2;
public function saveData(array $data): bool
{
# v6项目ID
$pid = (int)$data['pid'] ?? 0;
$time = $data['time'] ?? date('Y-m-d');
$isRes = self::query()->wherePid($pid)->where('created_at', 'like', $time . '%')->first();
if (!$isRes) {
$isRes = new self();
$isRes->pid = $pid;
# 生成文件路径
$isRes->file_path = $data['file_path'] ?? '';
}
return $isRes->save();
}
}