正在显示
1 个修改的文件
包含
46 行增加
和
12 行删除
| @@ -3,17 +3,21 @@ | @@ -3,17 +3,21 @@ | ||
| 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\Common; | ||
| 6 | use App\Helper\FormGlobalsoApi; | 7 | use App\Helper\FormGlobalsoApi; |
| 7 | use App\Http\Logic\Bside\User\UserLogic; | 8 | use App\Http\Logic\Bside\User\UserLogic; |
| 8 | use App\Http\Logic\Bside\User\UserLoginLogic; | 9 | use App\Http\Logic\Bside\User\UserLoginLogic; |
| 10 | +use App\Models\Project\DeployBuild; | ||
| 9 | use App\Models\Project\Project; | 11 | use App\Models\Project\Project; |
| 10 | use App\Models\Project\Project as ProjectModel; | 12 | use App\Models\Project\Project as ProjectModel; |
| 11 | use App\Models\SmsLog; | 13 | use App\Models\SmsLog; |
| 12 | use App\Models\User\ProjectMenu as ProjectMenuModel; | 14 | use App\Models\User\ProjectMenu as ProjectMenuModel; |
| 13 | use App\Models\User\ProjectRole as ProjectRoleModel; | 15 | use App\Models\User\ProjectRole as ProjectRoleModel; |
| 14 | use App\Models\User\User as UserModel; | 16 | use App\Models\User\User as UserModel; |
| 17 | +use Carbon\Carbon; | ||
| 15 | use Illuminate\Http\Request; | 18 | use Illuminate\Http\Request; |
| 16 | use Illuminate\Support\Facades\Cache; | 19 | use Illuminate\Support\Facades\Cache; |
| 20 | +use Illuminate\Support\Facades\DB; | ||
| 17 | use Mrgoon\AliSms\AliSms; | 21 | use Mrgoon\AliSms\AliSms; |
| 18 | 22 | ||
| 19 | /*** | 23 | /*** |
| @@ -144,20 +148,50 @@ class ComController extends BaseController | @@ -144,20 +148,50 @@ class ComController extends BaseController | ||
| 144 | } | 148 | } |
| 145 | 149 | ||
| 146 | public function ceshi(){ | 150 | public function ceshi(){ |
| 147 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryList('https://demomark.globalso.com/','',1,100000000); | ||
| 148 | - //询盘国家统计 | ||
| 149 | - $countryData = $inquiry_list['data']['data']; | ||
| 150 | - $countryArr = []; | ||
| 151 | - foreach ($countryData as $v1){ | ||
| 152 | - if(isset($countryArr[$v1['country']])){ | ||
| 153 | - $countryArr[$v1['country']]++; | 151 | + $deployModel = new DeployBuild(); |
| 152 | + $list = $deployModel->list(); | ||
| 153 | + $data = []; | ||
| 154 | + $yesterday = Carbon::yesterday()->toDateString(); | ||
| 155 | + foreach ($list as $v){ | ||
| 156 | + $v['test_domain'] = 'https://demomark.globalso.com/'; | ||
| 157 | + $arr = []; | ||
| 158 | + $arr['pv_num'] = DB::table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$v['test_domain'])->count(); | ||
| 159 | + $arr['ip_num'] = DB::table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$v['test_domain'])->count(); | ||
| 160 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryList($v['test_domain'],'',1,100000000); | ||
| 161 | + if($inquiry_list['status'] == 400){ | ||
| 162 | + $arr['inquiry_num'] = 0; | ||
| 154 | }else{ | 163 | }else{ |
| 155 | - $countryArr[$v1['country']] = 0; | 164 | + $arr['inquiry_num'] = $inquiry_list['data']['total']; |
| 165 | + //询盘国家统计 | ||
| 166 | + $countryData = $inquiry_list['data']['data']; | ||
| 167 | + $countryArr = []; | ||
| 168 | + foreach ($countryData as $v1){ | ||
| 169 | + if(isset($countryArr[$v1['country']])){ | ||
| 170 | + $countryArr[$v1['country']]++; | ||
| 171 | + }else{ | ||
| 172 | + $countryArr[$v1['country']] = 0; | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + arsort($countryArr); | ||
| 176 | + $top20 = array_slice($countryArr, 0, 20, true); | ||
| 177 | + $arr['country'] = json_encode($top20); | ||
| 178 | + var_dump($arr['country']); | ||
| 179 | + die(); | ||
| 156 | } | 180 | } |
| 181 | + $arr['date'] = $yesterday; | ||
| 182 | + $rank_info = DB::table('gl_rank_data')->where(['updated_date'=>$yesterday,'lang'=>''])->select(['compliance_day'])->first(); | ||
| 183 | + if(empty($rank_info)){ | ||
| 184 | + $arr['compliance_day'] = 0; | ||
| 185 | + }else{ | ||
| 186 | + $arr['compliance_day'] = $rank_info->compliance_day; | ||
| 187 | + } | ||
| 188 | + $arr['service_day'] = $v['service_duration'] - Common::getDaysToTargetDate($v['created_at']); | ||
| 189 | + $arr['project_id'] = $v['project_id']; | ||
| 190 | + $arr['created_at'] = date('Y-m-d H:i:s'); | ||
| 191 | + $arr['updated_at'] = date('Y-m-d H:i:s'); | ||
| 192 | + $data[] = $arr; | ||
| 157 | } | 193 | } |
| 158 | - arsort($countryArr); | ||
| 159 | - $top20 = array_slice($countryArr, 0, 20, true); | ||
| 160 | - return json_encode($top20); | ||
| 161 | - | 194 | + //判断数据是否存在 |
| 195 | + DB::table('gl_count')->insert($data); | ||
| 162 | } | 196 | } |
| 163 | } | 197 | } |
-
请 注册 或 登录 后发表评论