Sfoglia il codice sorgente

增加切换申报系统数据库配置

sandm 2 anni fa
parent
commit
4f35ed714f
4 ha cambiato i file con 3 aggiunte e 448 eliminazioni
  1. 1 0
      .gitignore
  2. 0 426
      app/Http/Controllers/Web/Talent/JjhcController.php
  3. 2 2
      config/database.php
  4. 0 20
      public/test.php

+ 1 - 0
.gitignore

@@ -20,3 +20,4 @@ horizon.log
 /package.json
 database
 online2020m
+/app/Http/Controllers/Web/Talent/JjhcController.php

+ 0 - 426
app/Http/Controllers/Web/Talent/JjhcController.php

@@ -1,426 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Web\Talent;
-
-libxml_disable_entity_loader(false);
-use App\Http\Controllers\Web\WebBaseController;
-use App\Models\RecruitAppointInfo;
-use App\Models\RecruitAppointSelect;
-use App\Models\RecruitPost;
-use App\Models\RecruitTicket;
-use App\Services\Common\SmsService;
-use Illuminate\Support\Facades\Cache;
-use PhpOffice\PhpSpreadsheet\Spreadsheet;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use PhpOffice\PhpSpreadsheet\Cell\DataType;
-use PhpOffice\PhpWord\IOFactory as WordIOFactory;
-use PhpOffice\PhpWord\Settings;
-use PhpOffice\PhpWord\TemplateProcessor;
-use Illuminate\Support\Facades\DB;
-use App\Exceptions\ResponseException;
-use Illuminate\Http\Request;
-use App\Services\Common\BaiduService;
-
-class JjhcController extends WebBaseController
-{
-    private $smsService;
-    public function __construct(SmsService $smsService)
-    {
-        $this->smsService = $smsService;
-    }
-
-    public function yqfk()
-    {
-        return view("app.talent.jjhc.yqfk");
-    }
-
-    public function chaxun(Request $request)
-    {
-        $data = array('msg'=>'查无此用户!','status' => 0);
-        return response()->json($data);
-        $info = DB::connection('fangyi')->table('fillinfo')
-            ->where(['lxdh'=>$request->tel])->first();
-        if($info){
-            $data = array('status'=>1,'msg'=>'查到已存在数据!','info'=>$info);
-        }else{
-            $data = array('msg'=>'查无此用户!','status' => 0);
-        }
-        return response()->json($data);
-    }
-
-    public function getGuid(){
-        $redis = Cache::getRedis();
-        $guid = $redis->get('sjhj_guid');
-        if(!$guid){
-            $client = new \SoapClient("http://222.77.0.158:8090/Convergence/webservice/ConvergenceService?wsdl");
-            // 组织参数  根据接口具体提供参数组织对应参数
-            $param = [
-                'userid'=>'jjswzzb_cxz',
-                'password'=>'Cxz@1234'
-            ];
-            $guid =$client->LoginByAccount ($param);
-            $redis->set('sjhj_guid',$guid->return);
-            $redis->expire('sjhj_guid',1800);
-            return $guid->return;
-        }
-
-        return $guid;
-    }
-
-    public function push(){
-        ini_set('display_errors',1);
-        error_reporting(E_ALL);
-        $guid = $this->getGuid();
-        $index = 0;
-        for ($i = 71;$i<=100;$i++){
-            $list = DB::table("recruit_appoint_info")->distinct('card')->offset($index)->limit(500)->get();
-            if($list && count($list) > 0){
-                $str = '<?xml version="1.0" encoding="UTF-8"?><table>';
-                $template = '<row type="add">
-    <id name="主键" isattachment="false"><![CDATA[%s]]></id>
-    <uid name="用户id" isattachment="false"><![CDATA[%s]]></uid>
-    <realname name="姓名" isattachment="false"><![CDATA[%s]]></realname>
-    <sex name="性别" isattachment="false"><![CDATA[%s]]></sex>
-    <birthday name="生日" isattachment="false"><![CDATA[%s]]></birthday>
-    <nation name="民族" isattachment="false"><![CDATA[%s]]></nation>
-    <native_place name="籍贯" isattachment="false"><![CDATA[%s]]></native_place>
-    <political_attitudes name="政治面貌" isattachment="false"><![CDATA[%s]]></political_attitudes>
-    <join_time name="入党时间" isattachment="false"><![CDATA[%s]]></join_time>
-    <titles name="职称或职业资格" isattachment="false"><![CDATA[%s]]></titles>
-    <work name="现工作单位及职务" isattachment="false"><![CDATA[%s]]></work>
-    <house_register name="户籍所在地" isattachment="false"><![CDATA[%s]]></house_register>
-    <edu_type name="教育类型" isattachment="false"><![CDATA[%s]]></edu_type>
-    <education name="学历" isattachment="false"><![CDATA[%s]]></education>
-    <school name="学校" isattachment="false"><![CDATA[%s]]></school>
-    <degree name="学位" isattachment="false"><![CDATA[%s]]></degree>
-    <pro name="所学专业" isattachment="false"><![CDATA[%s]]></pro>
-    <address name="通信地址" isattachment="false"><![CDATA[%s]]></address>
-    <card name="身份证号码" isattachment="false"><![CDATA[%s]]></card>
-    <mobile name="联系电话" isattachment="false"><![CDATA[%s]]></mobile>
-    <email name="电子邮箱" isattachment="false"><![CDATA[%s]]></email>
-    <concat_name name="联系人姓名" isattachment="false"><![CDATA[%s]]></concat_name>
-    <concat_mobile name="联系人手机号码" isattachment="false"><![CDATA[%s]]></concat_mobile>
-    <resume name="个人简历" isattachment="false"><![CDATA[%s]]></resume>
-    <training name="培训学习经历" isattachment="false"><![CDATA[%s]]></training>
-    <rewards_and_punishments name="奖惩情况" isattachment="false"><![CDATA[%s]]></rewards_and_punishments>
-    <introduce name="个人情况介绍" isattachment="false"><![CDATA[%s]]></introduce>
-    <status name="状态" isattachment="false"><![CDATA[%s]]></status>
-    <createtime name="提交时间" isattachment="false"><![CDATA[%s]]></createtime>
-  </row>';
-
-                foreach ($list as $k => $v){
-                    $item_str = sprintf($template,$v->id,$v->uid,$v->realname,$v->sex,$v->birthday,$v->nation,$v->native_place,$v->political_affiliation,$v->join_time
-                        ,$v->titles,$v->work,$v->house_register,$v->edu_type,$v->education,$v->school,$v->degree,$v->pro,$v->address
-                        ,$v->card,$v->mobile,$v->email,$v->concat_name,$v->concat_mobile,$v->resume,'','',''
-                        ,$v->audit,$v->created_at);
-//                    dd($item_str);
-                    $str .= $item_str;
-                }
-                $str .= '</table>';
-
-                try{
-                    $client = new \SoapClient('http://61.131.47.134:8756/Convergence/webservice/ConvergenceService?wsdl');
-                    // 组织参数  根据接口具体提供参数组织对应参数
-                    $param = [
-                        'guid'=>$guid,
-                        'catalogid'=>'WEB2445',
-                        'xmlstr' => $str
-                    ];
-
-                    $res = $client->pushXml($param);
-                    echo $res->return;
-                } catch (\Exception $e){
-                    dd($e->getMessage());
-                }
-            }
-
-
-            $index += 500;
-        }
-        echo $index;
-
-    }
-
-    public function test(Request $request)
-    {
-        $keyword = $request->input('keyword');
-        if($keyword != "j0vOW5mBREZxdo3P"){
-            throw new ResponseException("who are you?", [], 404);
-        }
-
-//        $redis = Cache::getRedis();
-//        $quota = $redis->get('recruit_quota');
-//        if(!$quota){
-//            $quota = [
-//                [
-//                    'name' => '新塘街道',
-//                    'value' => 13
-//                ],
-//                [
-//                    'name' => '陈埭镇',
-//                    'value' => 88
-//                ],
-//                [
-//                    'name' => '池店镇',
-//                    'value' => 10
-//                ],
-//                [
-//                    'name' => '安海镇',
-//                    'value' => 10
-//                ],
-//                [
-//                    'name' => '磁灶镇',
-//                    'value' => 21
-//                ],
-//                [
-//                    'name' => '内坑镇',
-//                    'value' => 22
-//                ],
-//                [
-//                    'name' => '东石镇',
-//                    'value' => 4
-//                ],
-//                [
-//                    'name' => '永和镇',
-//                    'value' => 27
-//                ],
-//                [
-//                    'name' => '英林镇',
-//                    'value' => 5
-//                ],
-//                [
-//                    'name' => '金井镇',
-//                    'value' => 13
-//                ],
-//                [
-//                    'name' => '龙湖镇',
-//                    'value' => 53
-//                ],
-//                [
-//                    'name' => '深沪镇',
-//                    'value' => 23
-//                ],
-//                [
-//                    'name' => '西滨镇',
-//                    'value' => 3
-//                ]
-//            ];
-//            $redis->set('recruit_quota',json_encode($quota));
-//        }else{
-//            $quota = json_decode($quota,true);
-//        }
-//        $list = DB::table('recruit_appoint_select as a')->leftJoin('recruit_appoint_info as b','a.appoint_id','=','b.id')->leftJoin('recruit_ticket as c','a.appoint_id','=','c.appoint_id')->whereRaw('a.select_result is null and a.result is not null and a.status = 1')->select(['b.realname','c.ex_number','a.result','a.select_result','a.id'])->orderBy('record','desc')->get();
-//
-//        $array_column = array_column($quota,'name');
-//        foreach ($list as $k => $v){
-//            $person_select_result = json_decode($v->result,true);
-//            foreach ($person_select_result as $val){
-//                //寻找下标
-//                $index = array_search($val,$array_column);
-//                if($quota[$index]['value'] > 0){
-//                    $quota_data = [
-//                        'index' => $index,
-//                        'old_value' => $quota[$index]['value']
-//                    ];
-//                    //有名额允许择岗
-//                    DB::table('recruit_appoint_select')->where('id',$v->id)->update(['select_result'=>$val,'status' => 1]);
-//                    $v->select_result = $val;
-//                    $quota[$index]['value']--;
-//                    $quota_data['new_value'] = $quota[$index]['value'];
-//                    break;
-//                }
-//            }
-//
-//
-//        }
-
-//        $option_list = [
-//            '青阳街道','梅岭街道','西园街道','罗山街道','灵源街道','新塘街道','陈埭镇','池店镇','安海镇','磁灶镇','内坑镇','紫帽镇','东石镇','永和镇','英林镇','金井镇','龙湖镇','深沪镇','西滨镇'
-//        ];
-//        $list = DB::table("recruit_appoint_info")->where('recruit_id',18)->where('audit',3)->where('pen_audit',1)->where('post_id',309)->get();
-//        foreach ($list as $k => $v){
-//            $uid = $v->uid;
-//            $recruit_id = 18;
-//            $appoint_id = $v->id;
-////            $info = RecruitAppointSelect::where('uid',$uid)->where('recruit_id',$recruit_id)->where('appoint_id',$appoint_id)->first();
-////            if($info){
-////                return ['status' => 0, 'msg' => "测试数据重复,请重新点击生成测试数据!"];
-////            }
-//            $data = [
-//                'recruit_id' => $recruit_id,
-//                'appoint_id' => $appoint_id,
-//                'uid' => $uid,
-//                'status' => 1,
-//                'record' => mt_rand(50.0,100)
-//            ];
-//            shuffle($option_list);
-//            $select = array_slice($option_list,0,rand(1,19));
-//            $result = [];
-//            if(is_array($select) && count($select) > 0){
-//                foreach ($select as $v) {
-//                    array_push($result,$v);
-//                }
-//            }
-//            $data['result'] = json_encode($result);
-//            RecruitAppointSelect::create($data);
-//
-//        }
-        $redis = Cache::getRedis();
-        $redis->set('recruit_quota',false);
-//        $list = DB::table("recruit_temp")->get();
-//        foreach ($list as $k => $v){
-//            $appoint_info = RecruitAppointInfo::where('card',$v->f3)->where('recruit_id',18)->first();
-//            $data = [
-//                'batch' => 2,
-//                'appoint_id' => $appoint_info->id,
-//                'recruit_id' => 18,
-//                'uid' => $appoint_info->uid,
-//                'record' => $v->f6,
-//                'status' => 0
-//            ];
-//
-//            RecruitAppointSelect::create($data);
-//        }
-
-
-//        for ($room = 1;$room <= 78; $room++){
-//            $list = DB::table("recruit_ticket")->leftJoin("recruit_appoint_info","recruit_ticket.appoint_id",'=','recruit_appoint_info.id')->where("recruit_ticket.ex_start",'2022-08-05 08:00:00')->where('recruit_ticket.ex_room',$room)->orderBy('ex_seat','ASC')->get()->toArray();
-//
-//            $objPHPExcel = IOFactory::load(base_path() . "/public/cunwu.xlsx");
-//            $sheet = $objPHPExcel->getActiveSheet();
-//            $row = 4;
-//            $sheet->setCellValue('A1', "晋江市公开招聘第十三批村务(社区)专职工作者笔试参考情况一览表(第".intval($room)."考场)");
-//
-//            foreach ($list as $k => $v){
-//                $sheet->setCellValueByColumnAndRow('1',$row, $v->ex_seat);
-//                $sheet->setCellValueByColumnAndRow('2',$row, $v->realname);
-//                $sheet->setCellValueExplicitByColumnAndRow('3',$row, $v->ex_number,DataType::TYPE_STRING);
-//                $row++;
-//            }
-//
-//            $writer = IOFactory::createWriter($objPHPExcel, 'Xlsx');
-//            $writer->save(base_path() . "/public/excel/cunwu{$room}.xlsx");
-//        }
-
-
-//        for ($room = 1;$room <= 78; $room++){
-//            $word = new TemplateProcessor(base_path() . "/public/cunwu1.docx");
-//            $word->setValue('room', $room);
-//            if($room<10){
-//                $room = sprintf('%02s', $room);
-//            }
-//            $list = DB::table("recruit_ticket")->leftJoin("recruit_appoint_info","recruit_ticket.appoint_id",'=','recruit_appoint_info.id')->where("recruit_ticket.ex_start",'2022-08-05 08:00:00')->where('recruit_ticket.ex_room',$room)->orderBy('ex_seat','ASC')->get()->toArray();
-//            $rows = count($list);//总行数
-//            $word->cloneRow('id', $rows);//复制行
-//            for ($i = 0; $i < $rows; $i++) {
-//                $word->setValue("id#" . ($i + 1), $i + 1);//替换变量
-//                $word->setValue("realname#" . ($i + 1), $list[$i]->realname);
-//                $word->setValue("ex_number#" . ($i + 1), $list[$i]->ex_number);
-//            }
-//            $word->saveAs(base_path() ."/public/excel/cunwu_{$room}.docx");//另存为
-//        }
-
-//        $spreadsheet = new Spreadsheet();
-//        $sheet = $spreadsheet->getActiveSheet();
-//        $header = ['姓名','身份证','准考证','报考岗位'];
-//        foreach ($header as $key => $value) {
-//            $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
-//        }
-//        $row = 2;
-//        $sheet->getStyle('S')->getNumberFormat()->setFormatCode('0');
-//        $list = DB::table("recruit_ticket")->leftJoin("recruit_appoint_info","recruit_ticket.appoint_id",'=','recruit_appoint_info.id')->where("recruit_appoint_info.recruit_id",'16')->orderBy('recruit_appoint_info.post_id','ASC')->orderBy('recruit_appoint_info.id','ASC')->get()->toArray();
-//        $post_data = RecruitPost::where('recruit_id',16)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
-//        foreach ($list as $k => $v){
-//            $sheet->setCellValueByColumnAndRow('1',$row, $v->realname);
-//            $sheet->setCellValueExplicitByColumnAndRow('2',$row, $v->card,DataType::TYPE_STRING);
-//            $sheet->setCellValueExplicitByColumnAndRow('3',$row, $v->ex_number,DataType::TYPE_STRING);
-//            $sheet->setCellValueByColumnAndRow('4',$row, $post_data[$v->post_id]);
-//            $row++;
-//        }
-//        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
-//        header('Content-Disposition: attachment;filename="'.time().'.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');
-
-        echo "success";
-
-//        $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);
-    }
-
-}

+ 2 - 2
config/database.php

@@ -59,8 +59,8 @@ return [
             'host' => env('DB_HOST', '127.0.0.1'),
             'port' => env('DB_PORT', '3306'),
             'database' => 'report_system',
-            'username' => 'jinjianghc',
-            'password' => 'l9cb9kWrGqjFMl^W',
+            'username' => env('DB_USERNAME', 'forge'),
+            'password' => env('DB_PASSWORD', ''),
             'unix_socket' => '',
             'charset' => 'utf8mb4',
             'collation' => 'utf8mb4_unicode_ci',

+ 0 - 20
public/test.php

@@ -1,20 +0,0 @@
-<?php
-
-use Swoole\Coroutine\Client;
-use function Swoole\Coroutine\run;
-
-run(function () {
-    $client = new Client(SWOOLE_SOCK_TCP);
-    if (!$client->connect('10.10.10.150', 8131, 0.5))
-    {
-        echo "connect failed. Error: {$client->errCode}\n";
-    }
-    $data = [
-        'cmd' =>"getsn",
-        'id' => '22'
-    ];
-
-    $client->send("VZ00".json_encode($data));
-    print_r($client->recv());
-    $client->close();
-});