作者 lyh

gx

... ... @@ -16,6 +16,7 @@ use App\Models\User\User as UserModel;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Mrgoon\AliSms\AliSms;
/***
... ... @@ -146,20 +147,36 @@ class ComController extends BaseController
}
public function ceshi(){
$arr = [];
$inquiry_list = (new FormGlobalsoApi())->getInquiryList('https://demomark.globalso.com/','',1,100000000);
//总数
$total = $inquiry_list['data']['total'];
$arr['total'] = $inquiry_list['data']['total'];
//数据详情
$data = $inquiry_list['data']['data'];
// 获取上个月的开始时间
$startTime = Carbon::now()->subMonth()->startOfMonth();
// 获取上个月的结束时间
$endTime = Carbon::now()->subMonth()->endOfMonth();
foreach ($data as $k => $v){
$arr['month_total'] = 0;
$countryArr = [];
foreach ($data as $v){
if(($startTime <= $v['submit_time']) && $v['submit_time'] <= $endTime){
}
}
$arr['month_total']++;
}
if(isset($countryArr[$v1['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 0;
}
}
// 获取当前日期时间
$arr['month'] = Carbon::now()->subMonth()->format('Y-m');
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = json_encode($top20);
$arr['created_at'] = date('Y-m-d H:i:s');
$arr['updated_at'] = date('Y-m-d H:i:s');
DB::table('gl_inquiry_month_count')->insert($arr);
$this->response('success',Code::SUCCESS,$inquiry_list);
}
... ...