|
@@ -10,6 +10,8 @@ |
|
@@ -10,6 +10,8 @@ |
|
10
|
namespace App\Models\Com;
|
10
|
namespace App\Models\Com;
|
|
11
|
|
11
|
|
|
12
|
use App\Models\Base;
|
12
|
use App\Models\Base;
|
|
|
|
13
|
+use Illuminate\Support\Carbon;
|
|
|
|
14
|
+use Illuminate\Support\Facades\Cache;
|
|
13
|
|
15
|
|
|
14
|
class KeywordVideoTaskLog extends Base
|
16
|
class KeywordVideoTaskLog extends Base
|
|
15
|
{
|
17
|
{
|
|
@@ -19,4 +21,26 @@ class KeywordVideoTaskLog extends Base |
|
@@ -19,4 +21,26 @@ class KeywordVideoTaskLog extends Base |
|
19
|
const STATUS_ERROR = 3;
|
21
|
const STATUS_ERROR = 3;
|
|
20
|
|
22
|
|
|
21
|
protected $table = 'gl_keyword_video_task_log';
|
23
|
protected $table = 'gl_keyword_video_task_log';
|
|
|
|
24
|
+
|
|
|
|
25
|
+ /**
|
|
|
|
26
|
+ * 获取当月视频生成数量
|
|
|
|
27
|
+ * FIXME 混剪视频订阅计划 50000/m
|
|
|
|
28
|
+ * @return mixed
|
|
|
|
29
|
+ */
|
|
|
|
30
|
+ public static function getMonthVideoNum()
|
|
|
|
31
|
+ {
|
|
|
|
32
|
+ $key = 'video_keyword_number_month';
|
|
|
|
33
|
+ $num = Cache::get($key, function () use ($key) {
|
|
|
|
34
|
+ $this_day = date('d');
|
|
|
|
35
|
+ if($this_day >= 13) {
|
|
|
|
36
|
+ $start_date = Carbon::now()->day(13)->format('Y-m-d 00:00:00');
|
|
|
|
37
|
+ } else {
|
|
|
|
38
|
+ $start_date = Carbon::now()->subMonth()->day(13)->format('Y-m-d 00:00:00');
|
|
|
|
39
|
+ }
|
|
|
|
40
|
+ $num = self::where('created_at', '>', $start_date)->count();
|
|
|
|
41
|
+ Cache::put($key, $num, 1800);
|
|
|
|
42
|
+ return $num;
|
|
|
|
43
|
+ });
|
|
|
|
44
|
+ return $num;
|
|
|
|
45
|
+ }
|
|
22
|
} |
46
|
} |