|
@@ -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,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|