正在显示
1 个修改的文件
包含
8 行增加
和
1 行删除
| @@ -86,7 +86,14 @@ class Count extends Command | @@ -86,7 +86,14 @@ class Count extends Command | ||
| 86 | if($arr === false){ | 86 | if($arr === false){ |
| 87 | $data[] = $v['test_domain']; | 87 | $data[] = $v['test_domain']; |
| 88 | } | 88 | } |
| 89 | - DB::table('gl_count')->insert($arr); | 89 | + //查询当天数据是否存在 存在则更新 |
| 90 | + $countModel = new \App\Models\HomeCount\Count(); | ||
| 91 | + $info = $countModel->read(['date'=>$arr['date'],'project_id'=>$v['id']]); | ||
| 92 | + if($info === false){ | ||
| 93 | + DB::table('gl_count')->insert($arr); | ||
| 94 | + }else{ | ||
| 95 | + $countModel->edit($arr,['id'=>$info['id']]); | ||
| 96 | + } | ||
| 90 | Log::channel('day_count')->error('日期:'.$arr['created_at'].'success: ' .$v['test_domain']); | 97 | Log::channel('day_count')->error('日期:'.$arr['created_at'].'success: ' .$v['test_domain']); |
| 91 | } | 98 | } |
| 92 | } | 99 | } |
-
请 注册 或 登录 后发表评论