正在显示
1 个修改的文件
包含
10 行增加
和
4 行删除
| @@ -53,11 +53,9 @@ class UpgradeProjectCount extends Command | @@ -53,11 +53,9 @@ class UpgradeProjectCount extends Command | ||
| 53 | foreach ($list as $k=>$v){ | 53 | foreach ($list as $k=>$v){ |
| 54 | $v = (array)$v; | 54 | $v = (array)$v; |
| 55 | $monthCountModel = new MonthCount(); | 55 | $monthCountModel = new MonthCount(); |
| 56 | - $monthCountModel->read(['month'=>$v['month']]); | 56 | + $info = $monthCountModel->read(['month'=>$v['month']]); |
| 57 | // 获取当月开始时间 | 57 | // 获取当月开始时间 |
| 58 | $start = date('Y-m-01', strtotime($v['month'])); | 58 | $start = date('Y-m-01', strtotime($v['month'])); |
| 59 | - echo date('Y-m-d H:i:s') . 'end'.$start . PHP_EOL; | ||
| 60 | - return; | ||
| 61 | // 获取当月结束时间 | 59 | // 获取当月结束时间 |
| 62 | $end = date('Y-m-t', strtotime($v['month'])); | 60 | $end = date('Y-m-t', strtotime($v['month'])); |
| 63 | $arr['project_id'] = 439; | 61 | $arr['project_id'] = 439; |
| @@ -66,7 +64,15 @@ class UpgradeProjectCount extends Command | @@ -66,7 +64,15 @@ class UpgradeProjectCount extends Command | ||
| 66 | $arr['country'] = '{"\u5c3c\u65e5\u5229\u4e9a":1,"\u5370\u5ea6\u5c3c\u897f\u4e9a":1,"\u4f0a\u6717":1}'; | 64 | $arr['country'] = '{"\u5c3c\u65e5\u5229\u4e9a":1,"\u5370\u5ea6\u5c3c\u897f\u4e9a":1,"\u4f0a\u6717":1}'; |
| 67 | $arr = $this->pv_ip($arr,$start,$end); | 65 | $arr = $this->pv_ip($arr,$start,$end); |
| 68 | $arr = $this->sourceCount($arr,$start,$end); | 66 | $arr = $this->sourceCount($arr,$start,$end); |
| 69 | - | 67 | + if($info === false){ |
| 68 | + $selectedDate = $start; | ||
| 69 | + $firstDayOfNextMonth = date('Y-m-01 01:00:00', strtotime("$selectedDate +1 month")); | ||
| 70 | + $arr['created_at'] = $firstDayOfNextMonth; | ||
| 71 | + $arr['updated_at'] = $firstDayOfNextMonth; | ||
| 72 | + $monthCountModel->add(); | ||
| 73 | + }else{ | ||
| 74 | + $monthCountModel->edit($arr,['id'=>$info['id']]); | ||
| 75 | + } | ||
| 70 | } | 76 | } |
| 71 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 77 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 72 | } | 78 | } |
-
请 注册 或 登录 后发表评论