| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 | <?phpnamespace 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()    {        $a = $this->smsService->sendSms('13313826760', 'sms_buyhouse_supply', ['username'=>'林武','phone'=>'06','content'=>'25']);        dd($a);        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);    }}
 |