linwu 2 жил өмнө
parent
commit
a5667b04a8

+ 92 - 0
app/admin/controller/Demand.php

@@ -8,6 +8,7 @@ use app\common\model\Demand as DemandModel;
 use app\common\model\DemandOther as DemandOtherModel;
 use app\common\model\DemandCate as DemandCateModel;
 use app\common\model\DemandLog as DemandLogModel;
+use app\common\model\DemandSnatch as DemandSnatchModel;
 
 use app\common\validate\Demand as DemandValidate;
 use think\exception\ValidateException;
@@ -543,4 +544,95 @@ class Demand extends BaseController
             'code' => 0,
         ]));
     }
+
+    public function snatchList()
+    {
+        if (Request::isAjax()) {
+            $limit = input('limit/d', 20);
+            $page  = input('page/d', 1);
+            $map   = [];
+
+            $worker_id = input('worker_id/d', 0);
+            if (!empty($worker_id)) {
+                $map[] = ['worker_id', '=', $worker_id];
+            }
+            $status = input('status/d', 0);
+            if (!empty($status)) {
+                $map[] = ['status', '=', $status];
+            }
+            $list = DemandSnatchModel::with(['demand', 'worker', 'demand.worker'])
+                ->where($map)
+                ->order(['id' => 'desc',])
+                ->limit($limit)
+                ->page($page)
+                ->append(['status_text'])
+                ->select();
+
+            $count = DemandSnatchModel::where($map)->count();
+            if ($count == 0) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "未查询到数据",
+                ]));
+            }
+            exit(json_encode([
+                'code'  => 0,
+                'msg'   => "",
+                'count' => $count,
+                'data'  => $list,
+            ]));
+
+        } else {
+            $workerlist = WorkerModel::order(['id' => 'desc'])->select();
+            return view('demand/snatchlist', [
+                'workerlist' => $workerlist,
+            ]);
+        }
+    }
+
+    public function demandDetail()
+    {
+        $id = input('id/d, 0');
+        if (empty($id)) {
+            return '未查询到数据';
+        }
+        $demand = DemandModel::with(['worker', 'demand_cate'])->findOrEmpty($id);
+        if ($demand->isEmpty()) {
+            return '未查询到数据';
+        }
+
+        $typelist   = [1 => '代招', 2 => '劳务派遣'];
+        $wtypelist  = [1 => '按月', 2 => '按时', 3 => '按件', 4 => '按项目', 5 => '其他'];
+        $ftypelist  = [1 => '一次性', 2 => '小时工', 3 => '管理费', 4 => '其他'];
+        $statuslist = [1 => '待修改', 2 => '待审核', 3 => '已上架', 4 => '已停招', 5 => '已下架'];
+        return view('demand/demanddetail', [
+            'demand'     => $demand,
+            'typelist'   => $typelist,
+            'wtypelist'  => $wtypelist,
+            'ftypelist'  => $ftypelist,
+            'statuslist' => $statuslist,
+        ]);
+    }
+
+    public function snatchstatus()
+    {
+        $id = input('id/d, 0');
+        $status = input('status/d, 0');
+
+        $snatch = DemandSnatchModel::findOrEmpty($id);
+        if ($snatch->isEmpty()) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "信息不存在",
+            ]));
+        } else {
+            $snatch->save([
+                'status' => $status,
+            ]);
+        }
+
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
 }

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

@@ -151,7 +151,7 @@ class RensheService
     private function _enDataCbc()
     {
         $data = $this->_time . json_encode($this->_data);
-        return base64_encode(http_request('http://192.168.1.91/sm4_en.php', 'POST', ['data' => $data]));
+        return base64_encode(http_request('http://10.10.10.63/sm4_en.php', 'POST', ['data' => $data]));
 //        return base64_encode(openssl_encrypt($data, "SM4", self::KEY, 0, self::IV));
     }
 
@@ -162,7 +162,7 @@ class RensheService
      */
     private function _deDataCbc($data)
     {
-        $res = http_request('http://192.168.1.91/sm4_de.php', 'POST', ['data' => base64_decode($data)]);
+        $res = http_request('http://10.10.10.63/sm4_de.php', 'POST', ['data' => base64_decode($data)]);
 //        $res = openssl_decrypt(base64_decode($data), "SM4", self::KEY, 0, self::IV);
         if ($res[0] != "{") {
             $res = mb_substr($res, 14, strlen($res), 'UTF-8');

+ 86 - 7
app/worker/controller/Demand.php

@@ -11,6 +11,7 @@ use app\common\model\DemandLog as DemandLogModel;
 use app\common\model\User as UserModel;
 use app\common\model\UserIntegral as UserIntegralModel;
 use app\common\model\DemandSnatch as DemandSnatchModel;
+use app\common\model\DemandReport as DemandReportModel;
 
 use app\common\validate\Demand as DemandValidate;
 use think\exception\ValidateException;
@@ -896,22 +897,23 @@ class Demand extends BaseController
     public function roblist()
     {
         if (Request::isAjax()) {
-            $limit = input('limit/d', 20);
-            $page  = input('page/d', 1);
-            $map   = [];
+            $limit       = input('limit/d', 20);
+            $page        = input('page/d', 1);
+            $worker_data = Session::get('access_worker');
+            $map         = [['worker_id', '=', $worker_data['id']]];
 
             $status = input('status/d', 0);
             if (!empty($status)) {
                 $map[] = ['status', '=', $status];
             }
-            $list  = DemandSnatchModel::with(['demand','worker'])
+            $list = DemandSnatchModel::with(['demand', 'demand.worker'])
                 ->where($map)
-                ->order(['id' => 'desc',])
+                ->order(['id' => 'desc'])
                 ->limit($limit)
                 ->page($page)
-                ->append([ 'status_text'])
+                ->append(['status_text'])
                 ->select();
-//            halt($list);
+
             $count = DemandSnatchModel::where($map)->count();
             if ($count == 0) {
                 exit(json_encode([
@@ -931,4 +933,81 @@ class Demand extends BaseController
         }
     }
 
+    public function demandDetail()
+    {
+        $id = input('id/d, 0');
+        if (empty($id)) {
+            return '未查询到数据';
+        }
+        $demand = DemandModel::with(['worker', 'demand_cate'])->findOrEmpty($id);
+        if ($demand->isEmpty()) {
+            return '未查询到数据';
+        }
+
+        $typelist   = [1 => '代招', 2 => '劳务派遣'];
+        $wtypelist  = [1 => '按月', 2 => '按时', 3 => '按件', 4 => '按项目', 5 => '其他'];
+        $ftypelist  = [1 => '一次性', 2 => '小时工', 3 => '管理费', 4 => '其他'];
+        $statuslist = [1 => '待修改', 2 => '待审核', 3 => '已上架', 4 => '已停招', 5 => '已下架'];
+        return view('demand/demanddetail', [
+            'demand'     => $demand,
+            'typelist'   => $typelist,
+            'wtypelist'  => $wtypelist,
+            'ftypelist'  => $ftypelist,
+            'statuslist' => $statuslist,
+        ]);
+    }
+
+    public function report()
+    {
+        $id = input('id/d', 0);
+        if (empty($id)) {
+            return '未查询到数据';
+        }
+
+        if (Request::isAjax()) {
+            //订单信息
+            $snatch = DemandSnatchModel::with('demand')->find($id);
+            if (empty($snatch)) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "订单不存在",
+                ]));
+            }
+
+            $snatch_num = DemandReportModel::where('snatchid', $id)->count();
+            if ($snatch_num >= $snatch['num']) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "人数已满",
+                ]));
+            }
+
+            $mobile = input('mobile/s', '');
+            $idcard = input('idcard/s', '');
+            $check = DemandReportModel::where('snatchid',$id)->where('mobile',$mobile)->whereOr('idcard',$idcard)->find();
+            if (!empty($check)) {
+                exit(json_encode([
+                    'code' => 1,
+                    'msg'  => "该手机号或身份证号已报备,请勿重复",
+                ]));
+            }
+
+            DemandReportModel::create([
+                'demandid'   => $snatch['demand_id'],
+                'snatchid'   => $id,
+                'workerid'   => $snatch['demand']['workerid'],
+                'realname'   => input('realname/s', ''),
+                'mobile'     => $mobile,
+                'idcard'     => $idcard,
+                'arrivetime' => input('arrivetime/s', ''),
+                'remark'     => input('remark/s', ''),
+                'createtime' => time(),
+            ]);
+            exit(json_encode(['code' => 0]));
+        } else {
+            return view('demand/report', [
+                'id' => $id,
+            ]);
+        }
+    }
 }

+ 24 - 67
app/worker/view/demand/roblist.html

@@ -22,18 +22,16 @@
 		</div>
 
 		<div class="layui-card-body">
-			<div style="padding-bottom: 10px;">
-				<button class="layui-btn layuiadmin-btn" data-type="batchdel">删除</button>
-			</div>
-
 			<table id="LAY-demand-demandlist-table" lay-filter="LAY-demand-demandlist-table"></table>
 			<script type="text/html" id="selectStatus">
 				<select name="status" lay-filter="status" data-value=""></select>
 			</script>
 			<script type="text/html" id="setTpl">
-				<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>报备</a>
-				<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>报备记录</a>
-				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>订单详情</a>
+				{{# if(d.status > 1){ }}
+					<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="report"><i class="layui-icon layui-icon-edit"></i>报备</a>
+					<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reportlog"><i class="layui-icon layui-icon-edit"></i>报备记录</a>
+				{{# } }}
+				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="detail"><i class="layui-icon layui-icon-delete"></i>订单详情</a>
 			</script>
 		</div>
 	</div>
@@ -59,10 +57,9 @@
 			url: setter.baseWorkerUrl + 'demand/roblist',
 			cols: [
 				[
-					{ type: 'checkbox', fixed: 'left' },
 					{ field: 'id', width: 80, title: '表ID', sort: true },
 					{ field: 'demand', title: '岗位标题', minWidth: 200, toolbar: '<div>{{d.demand.title}}</div>' },
-					{ field: 'worker', title: '公司名称', width: 200, toolbar: '<div>{{d.worker.title}}</div>'  },
+					{ field: 'worker', title: '公司名称', width: 200, toolbar: '<div>{{d.demand.worker.title}}</div>'  },
 					{ field: 'demand', title: '联系电话', width: 120, toolbar: '<div>{{d.demand.telephone}}</div>' },
 					{ field: 'num', title: '招聘人数', width: 100 },
 					{ field: 'status_text', title: '状态', width: 100 },
@@ -86,66 +83,31 @@
 			});
 		});
 
-		var active = {
-			batchdel: function() {
-				var checkStatus = table.checkStatus('LAY-demand-demandlist-table'),
-					checkData = checkStatus.data; //得到选中的数据
-				if (checkData.length === 0) {
-					return layer.msg('请选择数据');
-				}
-				var idarr = [];
-				for (var i = 0; i < checkData.length; i++) {
-					idarr.push(checkData[i].id);
-				}
-				layer.confirm('确定删除此订单信息吗?', function(index) {
-					admin.req({
-						url: setter.baseWorkerUrl + 'demand/deldemand',
-						data: {
-							idarr: idarr
-						},
-						done: function(res) {
-							obj.del();
-							layer.msg('已删除');
-						}
-					});
-					table.reload('LAY-demand-demandlist-table');
-					layer.msg('已删除');
-				});
-			},
-
-			add: function() {
-				var index = layer.open({
+		table.on('tool(LAY-demand-demandlist-table)', function(obj) {
+			var data = obj.data;
+			if (obj.event === 'report') {
+				let index = layer.open({
 					type: 2,
-					title: '发布其他订单',
-					content: 'otherForm.html?id=0',
+					title: '报备',
+					content: 'report.html?id=' + data.id,
 					maxmin: true,
 					area: ['750px', '480px']
 				});
 				layer.full(index);
-			},
-		};
-
-		table.on('tool(LAY-demand-demandlist-table)', function(obj) {
-			var data = obj.data;
-			if (obj.event === 'del') {
-				layer.confirm('确定删除此订单信息吗?', function(index) {
-					admin.req({
-						url: setter.baseWorkerUrl + 'demand/deldemand',
-						data: {
-							idarr: [data.id]
-						},
-						done: function(res) {
-							obj.del();
-							layer.msg('已删除');
-						}
-					});
-					layer.close(index);
-				});
-			} else if (obj.event === 'edit') {
-				var index = layer.open({
+			} else if (obj.event === 'reportlog') {
+				let index = layer.open({
 					type: 2,
 					title: '编辑其他订单信息',
-					content: 'otherform.html?id=' + data.id,
+					content: 'reportlog.html?id=' + data.id,
+					maxmin: true,
+					area: ['750px', '480px']
+				});
+				layer.full(index);
+			} else if (obj.event === 'detail') {
+				let index = layer.open({
+					type: 2,
+					title: '订单详情',
+					content: 'demanddetail.html?id=' + data.demand_id,
 					maxmin: true,
 					area: ['750px', '480px']
 				});
@@ -153,10 +115,5 @@
 			}
 		});
 
-		$('.layui-btn.layuiadmin-btn').on('click', function() {
-			var type = $(this).data('type');
-			active[type] ? active[type].call(this) : '';
-		});
-
 	});
 </script>

+ 4 - 4
app/worker/view/index.html

@@ -113,9 +113,6 @@
 							<dd>
 								<a lay-href="{:url('/demand/demandlist')}" lay-text="派遣订单">派遣订单</a>
 							</dd>
-							<dd>
-								<a lay-href="{:url('/demand/otherlist')}" lay-text="其他订单">其他订单</a>
-							</dd>
 							<dd>
 								<a lay-href="{:url('/demand/allhall')}" lay-text="抢单大厅">抢单大厅</a>
 							</dd>
@@ -123,7 +120,10 @@
 								<a lay-href="{:url('/demand/roblist')}" lay-text="抢到的订单">抢到的订单</a>
 							</dd>
 							<dd>
-								<a lay-href="{:url('/demand/logList')}" lay-text="报名记录">报名记录</a>
+								<a lay-href="{:url('/demand/logList')}" lay-text="报备记录">报备记录</a>
+							</dd>
+							<dd>
+								<a lay-href="{:url('/demand/otherlist')}" lay-text="其他订单">其他订单</a>
 							</dd>
 						</dl>
 					</li>