瀏覽代碼

停招传给人社

linwu 2 年之前
父節點
當前提交
ffacb2b79d
共有 3 個文件被更改,包括 96 次插入71 次删除
  1. 3 59
      app/admin/controller/Comjobs.php
  2. 75 2
      app/common/service/RensheService.php
  3. 18 10
      app/mainapp/controller/Index.php

+ 3 - 59
app/admin/controller/Comjobs.php

@@ -510,66 +510,10 @@ class Comjobs extends BaseController
 
     public function synRenshe()
     {
-        //获取数据
-        $id   = input('id/d', 0);
-        $info = ComjobsModel::with([
-            'worker',
-            'comjobsCate',
-            'ageCode'          => function ($query) {
-                $query->where('type', 'age');
-            }, 'educationCode' => function ($query) {
-                $query->where('type', 'education');
-            }])->find($id);
-
-
-        //数据重组
-        $list           = $item = [];
-        $item['baz367'] = $info['id'];
-        if (!empty($info['comjobsCate']['code'])) {
-            $item['aca111'] = $info['comjobsCate']['code'];
-        }
-        $item['aca112'] = $info['title'];
-        $item['bcz002'] = $info['wtype'];
-        $item['bcz017'] = $info['zwagall'];
-        if (!empty($info['community'])) {
-            $item['cae006'] = $info['community'];
-        }
-        $item['cae007'] = $info['province'] . $info['city'] . $info['district'] . $info['address'];
-        if (!empty($info['educationCode']['code'])) {
-            $item['aac011'] = $info['educationCode']['code'];
-        }
-        if (!empty($info['ageCode']['code'])) {
-            $item['bcz006'] = $info['ageCode']['code'];
-        }
-        $item['bcz019'] = implode(',', $info['tags']);
-//        $item['caa004s'] = $info['tags_code'];
-        $item['bcz007'] = $info['comdetails'];
-        $item['bcz008'] = $info['requirement'];
-        $item['bcz009'] = $info['worker']['wtype'];
-        if (empty($info['third_id'])) {
-            $item['aab069'] = $info['worker']['title'];
-            $item['aae004'] = $info['worker']['realname'];
-            $item['aae006'] = $info['worker']['province'] . $info['worker']['city'] . $info['worker']['district'] . $info['worker']['address'];
-        } else {
-            $third = WorkerThird::where('id',$info['third_id'])->find();
-            $item['aab069'] = $third['name'];
-            $item['aae004'] = $third['contact'];;
-            $item['aae006'] = $info['worker']['province'] . $info['worker']['city'] . $info['worker']['district'] . $info['worker']['address'];
-        }
-        $item['aae005'] = $info['telephone'];
-        $item['bcz018'] = $info['emp_code'];
-        $item['bcz011'] = $info['is_worry'];
-        $item['bcz015'] = $info['longitude'];
-        $item['bcz016'] = $info['latitude'];
-        $item['bye002'] = $info['updatetime'];
-        $item           = array_filter($item);
-        $item['aae100'] = $info['status'] == 3 ? 1 : 0;
-        $list[]         = $item;
-        $send['list']   = $list;
-
         //发送数据
-        $service = new RensheService($send);
-        $res     = $service->JobInfo();
+        $id   = input('id/d', 0);
+        $service = new RensheService();
+        $res     = $service->jobInfoByComId($id);
 
         if ($res['code'] == 200) {
             return json(['code' => 0]);

+ 75 - 2
app/common/service/RensheService.php

@@ -2,7 +2,9 @@
 
 namespace app\common\service;
 
+use app\common\model\WorkerThird;
 use think\facade\Log;
+use app\common\model\Comjobs as ComjobsModel;
 
 class RensheService
 {
@@ -43,10 +45,70 @@ class RensheService
         }
     }
 
+    private function _jobInfoData($id)
+    {
+        $info = ComjobsModel::with([
+            'worker',
+            'comjobsCate',
+            'ageCode'          => function ($query) {
+                $query->where('type', 'age');
+            }, 'educationCode' => function ($query) {
+                $query->where('type', 'education');
+            }])->find($id);
+
+
+        //数据重组
+        $list           = $item = [];
+        $item['baz367'] = $info['id'];
+        if (!empty($info['comjobsCate']['code'])) {
+            $item['aca111'] = $info['comjobsCate']['code'];
+        }
+        $item['aca112'] = $info['title'];
+        $item['bcz002'] = $info['wtype'];
+        $item['bcz017'] = $info['zwagall'];
+        if (!empty($info['community'])) {
+            $item['cae006'] = $info['community'];
+        }
+        $item['cae007'] = $info['province'] . $info['city'] . $info['district'] . $info['address'];
+        if (!empty($info['educationCode']['code'])) {
+            $item['aac011'] = $info['educationCode']['code'];
+        }
+        if (!empty($info['ageCode']['code'])) {
+            $item['bcz006'] = $info['ageCode']['code'];
+        }
+        $item['bcz019'] = implode(',', $info['tags']);
+//        $item['caa004s'] = $info['tags_code'];
+        $item['bcz007'] = $info['comdetails'];
+        $item['bcz008'] = $info['requirement'];
+        $item['bcz009'] = $info['worker']['wtype'];
+        if (empty($info['third_id'])) {
+            $item['aab069'] = $info['worker']['title'];
+            $item['aae004'] = $info['worker']['realname'];
+            $item['aae006'] = $info['worker']['province'] . $info['worker']['city'] . $info['worker']['district'] . $info['worker']['address'];
+        } else {
+            $third          = WorkerThird::where('id', $info['third_id'])->find();
+            $item['aab069'] = $third['name'];
+            $item['aae004'] = $third['contact'];;
+            $item['aae006'] = $info['worker']['province'] . $info['worker']['city'] . $info['worker']['district'] . $info['worker']['address'];
+        }
+        $item['aae005'] = $info['telephone'];
+        $item['bcz018'] = $info['emp_code'];
+        $item['bcz011'] = $info['is_worry'];
+        $item['bcz015'] = $info['longitude'];
+        $item['bcz016'] = $info['latitude'];
+        $item['bye002'] = $info['updatetime'];
+        $item           = array_filter($item);
+        $item['aae100'] = $info['status'] == 3 ? 1 : 0;
+        $list[]         = $item;
+        $send['list']   = $list;
+
+        $this->setData($send);
+    }
+
     /**
      * 岗位信息库提交
      */
-    public function JobInfo()
+    public function jobInfo()
     {
         $this->_log_name = '岗位信息库';
         $url             = self::BASE_URL . '/dayjob/submitJobInfo.html';
@@ -55,10 +117,21 @@ class RensheService
         return $res;
     }
 
+    /**
+     * 岗位信息库提交ComId
+     */
+    public function jobInfoByComId($id)
+    {
+        $this->_jobInfoData($id);
+        $res = $this->jobInfo();
+
+        return $res;
+    }
+
     /**
      * 岗位撮合信息结果信息提交
      */
-    public function MatchSubmit()
+    public function matchSubmit()
     {
         $this->_log_name = '岗位撮合';
         $url             = self::BASE_URL . '/dayjob/submitLaborRelations.html';

+ 18 - 10
app/mainapp/controller/Index.php

@@ -4,6 +4,7 @@ namespace app\mainapp\controller;
 
 use app\common\model\RensheCode;
 use app\common\model\WorkerThird;
+use app\common\service\RensheService;
 use app\mainapp\BaseController;
 use think\facade\Db;
 
@@ -50,7 +51,14 @@ class Index extends BaseController
 
     public function listComjobs()
     {
-        ComjobsModel::where('enddate', '<', time() - 86400)->where('status', '=', 3)->update(['status' => 4]);
+        $ids = ComjobsModel::where('enddate', '<', time() - 86400)->where('status', '=', 3)->column('id');
+        if (!empty($ids)) {
+            ComjobsModel::where('id', 'in', $ids)->update(['status' => 4]);
+            foreach ($ids as $id) {
+                $service = new RensheService();
+                $service->jobInfoByComId($id);
+            }
+        }
         $ppage = input('ppage/d', 1);
         $psize = input('psize/d', 20);
         $map[] = ['createtime', '<=', time()];
@@ -106,9 +114,9 @@ class Index extends BaseController
         $row           = Db::query("select * ," . $sql . "as distance from echo_comjobs where deletetime=0 and status in (3,4) order by distance limit " . $pagelistcount * ($page - 1) . "," . $pagelistcount);
 
         //第三方id和工作列表
-        $third_ids   = [];
-        $third_lists = [];
-        $worker_ids = [];
+        $third_ids    = [];
+        $third_lists  = [];
+        $worker_ids   = [];
         $worker_lists = [];
         foreach ($row as $l) {
             if (!empty($l['third_id'])) {
@@ -150,12 +158,12 @@ class Index extends BaseController
         $map[] = ['priority', '>', 0];
         $map[] = ['status', 'in', '3,4'];
 
-        $userid = input('userid/d',0);
+        $userid = input('userid/d', 0);
         if (!empty($userid)) {
-            $user = UserModel::where('id',$userid)->find();
+            $user = UserModel::where('id', $userid)->find();
             if (!empty($user['com_cate'])) {
-                $ids = ComjobsCateModel::where('title','in',$user['com_cate'])->column('id');
-                $map[] = ['cateid','in',$ids];
+                $ids   = ComjobsCateModel::where('title', 'in', $user['com_cate'])->column('id');
+                $map[] = ['cateid', 'in', $ids];
             }
         }
         $plist = ComjobsModel::with(['worker'])->where($map)->order(['status' => 'asc', 'priority' => 'desc', 'updatetime' => 'desc', 'id' => 'desc'])->page($ppage)->limit($psize)->select();
@@ -187,7 +195,7 @@ class Index extends BaseController
 
     public function getRensheCode()
     {
-        $type = input('type','');
+        $type = input('type', '');
         if (empty($type)) {
             page_result(0, "", []);
         }
@@ -198,7 +206,7 @@ class Index extends BaseController
 
     public function getComCate()
     {
-        $catelist   = ComjobsCate::order(['priority' => 'desc', 'id' => 'desc'])->select();
+        $catelist = ComjobsCate::order(['priority' => 'desc', 'id' => 'desc'])->select();
         page_result(0, "", $catelist);
     }
 }