| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | 
							- <?php
 
- namespace App\Http\Controllers\Web\Talent;
 
- use App\Http\Controllers\Web\WebBaseController;
 
- use App\Services\Common\SmsService;
 
- use PhpOffice\PhpSpreadsheet\Spreadsheet;
 
- use PhpOffice\PhpSpreadsheet\IOFactory;
 
- use Illuminate\Support\Facades\DB;
 
- use App\Exceptions\ResponseException;
 
- class JjhcController extends WebBaseController
 
- {
 
-     private $smsService;
 
-     public function __construct(SmsService $smsService)
 
-     {
 
-         $this->smsService = $smsService;
 
-     }
 
-     public function test()
 
-     {
 
-         throw new ResponseException("who are you?", [], 404);
 
- //        $list = DB::table('lt_apppointment')->distinct()->pluck('card')->toArray();
 
- //        $all = DB::table('lt_apppointment')->pluck('card')->toArray();
 
- //        $all = array_count_values($all);
 
- //        $time = time();
 
- //        $data = [
 
- //            'idCards' => $list,
 
- //            'sign' => strtoupper(md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi")),
 
- //            'timeStr' => $time,
 
- //        ];
 
- //        $data_string = json_encode($data);
 
- //        $ch = curl_init ();
 
- //        curl_setopt( $ch, CURLOPT_URL, "http://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards" );
 
- //        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
 
- //                'Content-Type: application/json',
 
- //                'Content-Length: ' . strlen($data_string))
 
- //        );
 
- //        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); //若果报错 name lookup timed out 报错时添加这一行代码
 
- //        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
 
- //        curl_setopt( $ch, CURLOPT_TIMEOUT,60);
 
- //        curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0);
 
- //        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0);
 
- //        curl_setopt( $ch, CURLOPT_POST, 1);
 
- //        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
 
- //        $result = curl_exec ( $ch );
 
- //        curl_close ( $ch );
 
- //        $ret = json_decode($result,true);
 
- //        $res = [];
 
- //        if(count($ret['obj']) > 0){
 
- //            foreach ($ret['obj'] as $k => $v){
 
- //                if(array_key_exists($v['street'],$res)){
 
- //                    $res[$v['street']]['number']++;
 
- //                    $res[$v['street']]['count'] += $all[$v['idCard']];
 
- //                }else{
 
- //                    $res[$v['street']] = [
 
- //                        'number' => 1,
 
- //                        'count' => $all[$v['idCard']]
 
- //                    ];
 
- //                }
 
- //            }
 
- //        }
 
- //
 
- //        $spreadsheet = new Spreadsheet();
 
- //        $sheet = $spreadsheet->getActiveSheet();
 
- //        $header = ['镇街','使用人数','使用次数'];
 
- //        foreach ($header as $key => $value) {
 
- //            $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
 
- //        }
 
- //        $row = 2;
 
- //        foreach ($res as $k => $v){
 
- //            $sheet->setCellValueByColumnAndRow(1, $row, $k);
 
- //            $sheet->setCellValueByColumnAndRow(2, $row, $v['number']);
 
- //            $sheet->setCellValueByColumnAndRow(3, $row, $v['count']);
 
- //            $row++;
 
- //        }
 
- //        $file_name = date("Y-m-d",time()) . '码上服务数据';
 
- //        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
 
- //        header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
 
- //        header('Cache-Control: max-age=0');
 
- //        // If you're serving to IE 9, then the following may be needed
 
- //        header('Cache-Control: max-age=1');
 
- //        // If you're serving to IE over SSL, then the following may be needed
 
- //        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
 
- //        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
 
- //        header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
 
- //        header('Pragma: public'); // HTTP/1.0
 
- //        $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
 
- //        $writer->save('php://output');
 
- //
 
- //        //dd($res);
 
-     }
 
- }
 
 
  |