|
@@ -0,0 +1,98 @@
|
|
|
+<?php
|
|
|
+namespace app\mainapp\controller;
|
|
|
+
|
|
|
+use app\mainapp\BaseController;
|
|
|
+
|
|
|
+use \app\common\model\Resident as ResidentModel;
|
|
|
+use \app\common\model\ComjobsReport as ComjobsReportModel;
|
|
|
+use \app\common\model\Broker as BrokerModel;
|
|
|
+use \app\common\model\ResidentLog as ResidentLogModel;
|
|
|
+
|
|
|
+
|
|
|
+class Resident extends BaseController
|
|
|
+{
|
|
|
+
|
|
|
+ public function comjobsReport()
|
|
|
+ {
|
|
|
+ $ppage = input('ppage/d', 1);
|
|
|
+ $psize = input('psize/d', 20);
|
|
|
+ $map = [];
|
|
|
+ $residentid = input('residentid/d', 0);
|
|
|
+ $resident = ResidentModel::find($residentid);
|
|
|
+ if (empty($resident)) {
|
|
|
+ page_result(1,'没有权限查看');
|
|
|
+ }
|
|
|
+ $brokerIds = BrokerModel::where('workerid',$resident['workerid'])->column('id');
|
|
|
+ if (empty($brokerIds)) {
|
|
|
+ page_result(0, "", [
|
|
|
+ 'plist' => [],
|
|
|
+ 'pstatus' => 'noMore',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ $map[] = ['brokerid','in',$brokerIds];
|
|
|
+ $plist = ComjobsReportModel::with(['comjobs', 'broker'])->where($map)->order(['createtime' => 'desc', 'id' => 'desc'])->page($ppage)->limit($psize)->append(['status_text'])->select();
|
|
|
+ page_result(0, "", [
|
|
|
+ 'plist' => $plist,
|
|
|
+ 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function comjobsSetReportStatus()
|
|
|
+ {
|
|
|
+ $residentid = input('residentid/d', 0);
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $report = ComjobsReportModel::with(['comjobs', 'broker'])->where(['id' => $id])->append(['status_text'])->findOrEmpty();
|
|
|
+ if ($report->isEmpty()) {
|
|
|
+ page_result(1, "报备信息不存在。");
|
|
|
+ }
|
|
|
+ $status = input('status/d', 1);
|
|
|
+ $retremark = $status == 4 ? input('retremark/s', "") : "";
|
|
|
+ $report->save([
|
|
|
+ 'status' => $status,
|
|
|
+ 'retremark' => $retremark,
|
|
|
+ ]);
|
|
|
+ $status_text = [1=>'待审核', 2=>'待面试', 3=>'已入职', 4=>'无效报备'];
|
|
|
+ ResidentLogModel::create([
|
|
|
+ 'workerid' => $report['workerid'],
|
|
|
+ 'residentid' => $residentid,
|
|
|
+ 'content' => "修改状态为“{$status_text[$status]}”,报备id为{$id}",
|
|
|
+ 'createtime' => time(),
|
|
|
+ ]);
|
|
|
+ page_result(0, "", [
|
|
|
+ 'report' => $report,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listDemand()
|
|
|
+ {
|
|
|
+ $status = input('status/d', 1);
|
|
|
+ $ppage = input('ppage/d', 1);
|
|
|
+ $psize = input('psize/d', 20);
|
|
|
+ $map = [];
|
|
|
+ $residentid = input('residentid/d', 0);
|
|
|
+ $resident = ResidentModel::find($residentid);
|
|
|
+ if (empty($resident)) {
|
|
|
+ page_result(1,'没有权限查看');
|
|
|
+ }
|
|
|
+ $brokerIds = BrokerModel::where('workerid',$resident['workerid'])->column('id');
|
|
|
+ if (empty($brokerIds)) {
|
|
|
+ page_result(0, "", [
|
|
|
+ 'plist' => [],
|
|
|
+ 'pstatus' => 'noMore',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ $map[] = ['brokerid','in',$brokerIds];
|
|
|
+ if (!empty($status)) {
|
|
|
+ $map[] = ['status', '=', $status];
|
|
|
+ }
|
|
|
+
|
|
|
+ $orderby = ['updatetime' => 'desc', 'createtime' => 'desc', 'id' => 'desc'];
|
|
|
+ $plist = DemandModel::with(['demandCate'])->where($map)->order($orderby)->page($ppage)->limit($psize)->append(['ftype_text'])->select();
|
|
|
+ $param = ParamModel::where(1)->findOrEmpty();
|
|
|
+ page_result(0, "", [
|
|
|
+ 'param' => $param,
|
|
|
+ 'plist' => $plist,
|
|
|
+ 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+}
|