|
@@ -0,0 +1,138 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\common\controller;
|
|
|
+
|
|
|
+use app\BaseController;
|
|
|
+use app\admin\model\Enterprise;
|
|
|
+use app\enterprise\model\Talent;
|
|
|
+use app\common\api\DictApi;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 需要权限的公共方法放这
|
|
|
+ * Description of Tool
|
|
|
+ *
|
|
|
+ * @author sgq
|
|
|
+ */
|
|
|
+class Data extends BaseController {
|
|
|
+
|
|
|
+ //protected $middleware = [ApiEncrypt::class];
|
|
|
+
|
|
|
+ public function __construct(\think\App $app) {
|
|
|
+ parent::__construct($app);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getEnterprise(\think\Request $request){
|
|
|
+ $pageSize = $request->param('pageSize',20);
|
|
|
+ $page = $request->param('page',1);
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
|
+ $where[] = ['type','=',1];
|
|
|
+ $list = Enterprise::where($where)->limit(($page-1)*$pageSize, $page*$pageSize)->order("createTime", 'desc')->field('id,industryFieldNew,enterpriseTag,organizationTag,institutionTag,enterpriseType,name,idCard,street,address,legal,ephone,agentName,agentPhone,username,password,bankCard,bankNetwork,bank,agentEmail,imgurl,bankImg,domainImg,typeImg,beian,checkState,checkMsg,checkUser,active,activeMsg,createTime,updateUser,updateTime,modify_fields,modify_files')->select()->toArray();
|
|
|
+ $json = [
|
|
|
+ 'code' => 200,
|
|
|
+ 'msg' => '查询成功',
|
|
|
+ 'data' => $list
|
|
|
+ ];
|
|
|
+ return $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => json_encode($json),'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+ //return openssl_encrypt(json_encode($json),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getTalent(\think\Request $request){
|
|
|
+ $pageSize = $request->param('pageSize',20);
|
|
|
+ $page = $request->param('page',1);
|
|
|
+ $enterprise_id = $request->param('enterprise_id',0);
|
|
|
+ if(empty($enterprise_id)){
|
|
|
+ $json = [
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => '企业ID不能为空',
|
|
|
+ ];
|
|
|
+ return $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => json_encode($json),'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+
|
|
|
+ //return openssl_encrypt(json_encode($json),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ }
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
|
+ $where[] = ["enterprise_id",'=',$enterprise_id];
|
|
|
+ $field = 'id,salary_pay_way,salary_pay_month,tax_insurance_month,labor_contract_rangetime,pre_import_type,enterprise_id,name,headimgurl,card_type,card_number,sex,birthday,nationality,province,city,county,nation,politics,talent_arrange,talent_condition,fj_talent_condition_text,qz_talent_condition_text,highest_degree,graduate_school,major,professional,pro_qua,bank,bank_number,bank_account,study_abroad,abroad_school,abroad_major,phone,email,apply_year,import_way,return,fst_work_time,cur_entry_time,cur_quit_time,position,source,source_batch,source_city,source_county,fujian_highcert_pubtime,fujian_highcert_exptime,quanzhou_highcert_pubtime,quanzhou_highcert_exptime,createTime,updateTime,modify_fields,modify_files,first_submit_time,new_submit_time,first_dept_check_time,pass_dept_check,checkState,highProcess,isEffect,publicBatch,certificateGetTime,certificateExpireTime,certificateNo,experience,education,annual_salary,break_faith,identifyGetTime,identifyConditionName,title,check_companys,re_check_companys,isImport,fjImport,qzImport,qz_talent_level,fj_talent_level,qz_talent_info,fj_talent_info,isMatchZhiren,active,identifyMonth,fst_city_work_time';
|
|
|
+ $list = Talent::where($where)->limit(($page-1)*$pageSize, $page*$pageSize)->field($field)->select()->toArray();
|
|
|
+ $json = [
|
|
|
+ 'code' => 200,
|
|
|
+ 'msg' => '查询成功',
|
|
|
+ 'data' => $list
|
|
|
+ ];
|
|
|
+ return $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => json_encode($json),'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+ //return openssl_encrypt(json_encode($json),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getDict(\think\Request $request){
|
|
|
+ $code = $request->param('code');
|
|
|
+ if(empty($code)){
|
|
|
+ $json = [
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => '字典值不能为空',
|
|
|
+ ];
|
|
|
+ return $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => json_encode($json),'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+ //return openssl_encrypt(json_encode($json),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ }
|
|
|
+ $dict_self = DictApi::findDictByCode($code);
|
|
|
+ if(!$dict_self){
|
|
|
+ $json = [
|
|
|
+ 'code' => 200,
|
|
|
+ 'msg' => '查询成功,无此字典',
|
|
|
+ 'data' => null
|
|
|
+ ];
|
|
|
+ return $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => json_encode($json),'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+ //return openssl_encrypt(json_encode($json),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ }
|
|
|
+ $child_dict = DictApi::findChildDictByCode($code);
|
|
|
+ if(count($child_dict) > 0){
|
|
|
+ $res = array_merge([$dict_self->toArray()],$child_dict);
|
|
|
+ }else{
|
|
|
+ $res = $dict_self;
|
|
|
+ }
|
|
|
+ $json = [
|
|
|
+ 'code' => 200,
|
|
|
+ 'msg' => '查询成功',
|
|
|
+ 'data' => $res
|
|
|
+ ];
|
|
|
+ return $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => json_encode($json),'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+ //return openssl_encrypt(json_encode($json),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function test(){
|
|
|
+ $str = "Hello World!";
|
|
|
+ //$encrypt = openssl_encrypt(json_encode($str),'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ $encrypt = $this->curlPost("http://sm4.jinjianghc.com/sm4_cbc.php",['data' => $str,'key' => '3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ','iv' => 'jKihG4wF622ocb8z']);
|
|
|
+
|
|
|
+ $decrypt = openssl_decrypt($encrypt,'sm4-cbc','3eh2rxdtkULT2zpkDdRiRGH8PL5J0LsZ',OPENSSL_RAW_DATA,'jKihG4wF622ocb8z');
|
|
|
+ //$decrypt = $this->curlPost("http://sm4.jinjianghc.com/decode.php",['data' => $encrypt]);
|
|
|
+
|
|
|
+ dump($decrypt);
|
|
|
+ }
|
|
|
+
|
|
|
+ private function curlPost($url, $postFields) {
|
|
|
+
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); //若果报错 name lookup timed out 报错时添加这一行代码
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
|
|
|
+ curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
+ $ret = curl_exec($ch);
|
|
|
+ if (false == $ret) {
|
|
|
+ $result = curl_error($ch);
|
|
|
+ } else {
|
|
|
+ $rsp = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
+ if (200 != $rsp) {
|
|
|
+ $result = "请求状态 " . $rsp . " " . curl_error($ch);
|
|
|
+ } else {
|
|
|
+ $result = $ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ curl_close($ch);
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|