正在显示
1 个修改的文件
包含
44 行增加
和
26 行删除
| @@ -3,8 +3,11 @@ | @@ -3,8 +3,11 @@ | ||
| 3 | namespace App\Http\Controllers\Bside; | 3 | namespace App\Http\Controllers\Bside; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Helper\AyrShare as AyrShareHelper; | ||
| 6 | use App\Helper\Common; | 7 | use App\Helper\Common; |
| 7 | use App\Helper\FormGlobalsoApi; | 8 | use App\Helper\FormGlobalsoApi; |
| 9 | +use App\Models\AyrShare\AyrRelease as AyrReleaseModel; | ||
| 10 | +use App\Models\AyrShare\AyrShare as AyrShareModel; | ||
| 8 | use App\Models\Project\DeployBuild; | 11 | use App\Models\Project\DeployBuild; |
| 9 | use App\Models\Project\Project; | 12 | use App\Models\Project\Project; |
| 10 | use App\Models\Project\Project as ProjectModel; | 13 | use App\Models\Project\Project as ProjectModel; |
| @@ -156,34 +159,49 @@ class ComController extends BaseController | @@ -156,34 +159,49 @@ class ComController extends BaseController | ||
| 156 | } | 159 | } |
| 157 | 160 | ||
| 158 | public function ceshi(){ | 161 | public function ceshi(){ |
| 159 | - $deployModel = new DeployBuild(); | ||
| 160 | - $list = $deployModel->list(); | ||
| 161 | - $data = []; | ||
| 162 | - $yesterday = Carbon::yesterday()->toDateString(); | ||
| 163 | - foreach ($list as $v){ | ||
| 164 | - $arr = []; | ||
| 165 | - $arr['pv_num'] = DB::table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$v['test_domain'])->count(); | ||
| 166 | - $arr['ip_num'] = DB::table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$v['test_domain'])->count(); | ||
| 167 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($v['test_domain']); | ||
| 168 | - if($inquiry_list['status'] == 400){ | ||
| 169 | - $arr['inquiry_num'] = 0; | ||
| 170 | - }else{ | ||
| 171 | - $arr['inquiry_num'] = count($inquiry_list['data']['total']); | 162 | + $this->error = 0; |
| 163 | + //获取所有ayr_share用户 | ||
| 164 | + $ayr_share_model = new AyrShareModel(); | ||
| 165 | + $ayr_share_list = $ayr_share_model->list(); | ||
| 166 | + foreach ($ayr_share_list as $k => $v){ | ||
| 167 | + //查询当前用户是否有未推送的博文 | ||
| 168 | + $ayr_release = new AyrReleaseModel(); | ||
| 169 | + $release_info = $ayr_release->read(['schedule_date'=>['>',date('Y-m-d H:i:s',time())],'share_id'=>$v['id']]); | ||
| 170 | + //有推文时,直接跳出循环 | ||
| 171 | + if($release_info !== false){ | ||
| 172 | + continue; | ||
| 172 | } | 173 | } |
| 173 | - $arr['date'] = $yesterday; | ||
| 174 | - $rank_info = DB::table('gl_rank_data')->where(['updated_date'=>$yesterday,'lang'=>''])->select(['compliance_day'])->first(); | ||
| 175 | - if(empty($rank_info)){ | ||
| 176 | - $arr['compliance_day'] = 0; | ||
| 177 | - }else{ | ||
| 178 | - $arr['compliance_day'] = $rank_info->compliance_day; | 174 | + //查看用户是否在一周内有发送博客 |
| 175 | + $start_at = Carbon::now()->modify('-7 days')->toDateString(); | ||
| 176 | + $end_at = Carbon::now()->toDateString(); | ||
| 177 | + $release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]); | ||
| 178 | + //有发送博文,则跳出循环 | ||
| 179 | + if($release_info == false){ | ||
| 180 | + continue; | ||
| 181 | + } | ||
| 182 | + //删除用户第三方配置 | ||
| 183 | + $ayr_share_helper = new AyrShareHelper(); | ||
| 184 | + $data_profiles = [ | ||
| 185 | + 'title'=>$v['title'], | ||
| 186 | + 'profileKey'=>$v['profile_key'] | ||
| 187 | + ]; | ||
| 188 | + $res = $ayr_share_helper->deleted_profiles($data_profiles); | ||
| 189 | + if($res['status'] == 'fail'){ | ||
| 190 | + $this->error++; | ||
| 191 | + continue; | ||
| 192 | + } | ||
| 193 | + //更新数据库 | ||
| 194 | + $data = [ | ||
| 195 | + 'title'=>null, | ||
| 196 | + 'bind_plat_from'=>null, | ||
| 197 | + 'profile_key'=>null, | ||
| 198 | + 'ref_id'=>null, | ||
| 199 | + ]; | ||
| 200 | + $res = $ayr_share_model->edit($data,['id'=>$v['id']]); | ||
| 201 | + if($res == false){ | ||
| 202 | + $this->error++; | ||
| 179 | } | 203 | } |
| 180 | - $arr['service_day'] = $v['service_duration'] - Common::getDaysToTargetDate($v['created_at']); | ||
| 181 | - $arr['project_id'] = $v['project_id']; | ||
| 182 | - $arr['created_at'] = date('Y-m-d H:i:s'); | ||
| 183 | - $arr['updated_at'] = date('Y-m-d H:i:s'); | ||
| 184 | - $data[] = $arr; | ||
| 185 | } | 204 | } |
| 186 | - DB::table('gl_count')->insert($data); | ||
| 187 | - echo 1; | 205 | + return $this->error; |
| 188 | } | 206 | } |
| 189 | } | 207 | } |
-
请 注册 或 登录 后发表评论