KeywordVideoTaskLog.php
1.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
<?php
/**
* @remark :
* @name :KeywordVideoTask.php
* @author :lyh
* @method :post
* @time :2024/2/26 9:33
*/
namespace App\Models\Com;
use App\Models\Base;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
class KeywordVideoTaskLog extends Base
{
const STATUS_INIT = 0;
const STATUS_RUNNING = 1;
const STATUS_FINISH = 2;
const STATUS_ERROR = 3;
protected $table = 'gl_keyword_video_task_log';
/**
* 获取当月视频生成数量
* FIXME 混剪视频订阅计划 50000/m
* @return mixed
*/
public static function getMonthVideoNum()
{
$key = 'video_keyword_number_month';
$num = Cache::get($key, function () use ($key) {
$this_day = date('d');
if($this_day >= 13) {
$start_date = Carbon::now()->day(13)->format('Y-m-d 00:00:00');
} else {
$start_date = Carbon::now()->subMonth()->day(13)->format('Y-m-d 00:00:00');
}
$num = self::where('created_at', '>', $start_date)->count();
Cache::put($key, $num, 3600);
return $num;
});
return $num;
}
}