作者 王智

baoxiu22

@@ -86,6 +86,7 @@ class Index extends Api @@ -86,6 +86,7 @@ class Index extends Api
86 $list[$k]['status'] = $v['status']; //审核状态 86 $list[$k]['status'] = $v['status']; //审核状态
87 $list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']); //报修时间 87 $list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']); //报修时间
88 // $list[$k]['time'] = $v['createtime']; //报修时间 88 // $list[$k]['time'] = $v['createtime']; //报修时间
  89 + $list[$k]['BankRed'] = $this->SizeRed($user_id, $v['id']); //标红
89 } 90 }
90 if ($param['ids'] == 1) { 91 if ($param['ids'] == 1) {
91 array_multisort(array_column($list, 'id'), SORT_ASC, $list); 92 array_multisort(array_column($list, 'id'), SORT_ASC, $list);
@@ -285,7 +286,8 @@ class Index extends Api @@ -285,7 +286,8 @@ class Index extends Api
285 'repair_type' => 0, 286 'repair_type' => 0,
286 'price' => 0, 287 'price' => 0,
287 'status' => 0, 288 'status' => 0,
288 - 'is_genghuan' => 2 289 + 'is_genghuan' => 2,
  290 + 'fenpei_type' => 0,
289 ]; 291 ];
290 $res = Db::name('baoxiudan')->insert($data); 292 $res = Db::name('baoxiudan')->insert($data);
291 if ($res) { 293 if ($res) {
@@ -422,11 +424,34 @@ class Index extends Api @@ -422,11 +424,34 @@ class Index extends Api
422 } 424 }
423 if (empty($arr['yuji']) || $arr['yuji'] == null || $arr['yuji'] == '' || $arr['yuji'] == "") { 425 if (empty($arr['yuji']) || $arr['yuji'] == null || $arr['yuji'] == '' || $arr['yuji'] == "") {
424 $yuji = ''; 426 $yuji = '';
425 -  
426 } else { 427 } else {
427 $yuji = date('Y-m-d H:i:s', $arr['yuji']); 428 $yuji = date('Y-m-d H:i:s', $arr['yuji']);
428 } 429 }
  430 + //是否是维修总负责人 是否可以分配给维修负责人
  431 + if ($level == 7) {
  432 + if ($arr['fenpei_type'] == 0) {
  433 + $WXZFZR = 1;
  434 + } else {
  435 + $WXZFZR = 0;
  436 + }
  437 + } else {
  438 + $WXZFZR = 0;
  439 + }
  440 + //是否是维修负责人 是否可以进行分配给维修成员
  441 + if ($level == 3) {
  442 + if ($arr['wx_user_id'] == $user_id) {
  443 + if ($arr['fenpei_type'] == 1) {
  444 + $FPWXCY = 1;
  445 + }
  446 + } else {
  447 + $FPWXCY = 0;
  448 + }
  449 + } else {
  450 + $FPWXCY = 0;
  451 + }
429 $list = [ 452 $list = [
  453 + 'allocation' => $WXZFZR, //是否可以进行维修总负责人分配权限 1=是,0=否
  454 + 'fpwxcy' => $FPWXCY, //是否可以进行维修负责人分配维修成员 1=是,0=否
430 'level' => $level, //用户等级 455 'level' => $level, //用户等级
431 'repair_type' => $arr['repair_type'], //维修状态:0=未接收,1=进行中,2=已完成 456 'repair_type' => $arr['repair_type'], //维修状态:0=未接收,1=进行中,2=已完成
432 'type' => $arr['type'], //报修单状态:1=进行中,2=已完成 457 'type' => $arr['type'], //报修单状态:1=进行中,2=已完成
@@ -494,6 +519,39 @@ class Index extends Api @@ -494,6 +519,39 @@ class Index extends Api
494 519
495 520
496 /** 521 /**
  522 + * @ApiTitle (首页-维修负责人列表)
  523 + * @ApiSummary (维修负责人列表)
  524 + * @ApiMethod (POST)
  525 + * @ApiRoute (/api/Index/FuZePeopleList)
  526 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  527 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  528 + * @ApiReturn ({
  529 + "code":"1",
  530 + "msg": "返回成功",
  531 + "data": [
  532 + {
  533 + "id": 用户ID,
  534 + "name": "姓名"
  535 + }
  536 + ]
  537 + })
  538 + */
  539 + public function FuZePeopleList()
  540 + {
  541 + $arr = Db::name('user')->where(['level' => 3])->order('id desc')->select();
  542 + if (empty($arr)) {
  543 + $list = [];
  544 + } else {
  545 + foreach ($arr as $k => $v) {
  546 + $list[$k]['id'] = $v['id'];
  547 + $list[$k]['name'] = $v['name'];
  548 + }
  549 + }
  550 + $this->success('成功', $list);
  551 + }
  552 +
  553 +
  554 + /**
497 * @ApiTitle (首页-再次提交审核) 555 * @ApiTitle (首页-再次提交审核)
498 * @ApiSummary (再次提交审核) 556 * @ApiSummary (再次提交审核)
499 * @ApiMethod (POST) 557 * @ApiMethod (POST)
@@ -564,6 +622,39 @@ class Index extends Api @@ -564,6 +622,39 @@ class Index extends Api
564 622
565 623
566 /** 624 /**
  625 + * @ApiTitle (首页-分配维修负责人)
  626 + * @ApiSummary (分配维修负责人)
  627 + * @ApiMethod (POST)
  628 + * @ApiRoute (/api/Index/FenPeiWxFzr)
  629 + * @ApiHeaders (name="authorization", type=string, required=true, description="请求的Token")
  630 + * @ApiHeaders (name="id", type=int, required=true, description="报修单ID")
  631 + * @ApiHeaders (name="user_id", type=int, required=true, description="维修负责人用户ID")
  632 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  633 + * @ApiReturn ({
  634 + "code":"1",
  635 + "msg": "返回成功",
  636 + "data":{
  637 + }
  638 + })
  639 + */
  640 + public function FenPeiWxFzr()
  641 + {
  642 + $user_id = $this->is_token($this->request->header());
  643 + $param = $this->request->param();
  644 + $data = [
  645 + 'wx_user_id' => $param['user_id'],
  646 + 'wxfzr_user_id' => $user_id,
  647 + ];
  648 + $res = Db::name('baoxiudan')->where(['id' => $param['id']])->update($data);
  649 + if ($res) {
  650 + $this->success('分配成功', 1);
  651 + } else {
  652 + $this->error('分配失败', 0);
  653 + }
  654 + }
  655 +
  656 +
  657 + /**
567 * @ApiTitle (首页-维修成员报修单操作) 658 * @ApiTitle (首页-维修成员报修单操作)
568 * @ApiSummary (维修成员报修单操作) 659 * @ApiSummary (维修成员报修单操作)
569 * @ApiMethod (POST) 660 * @ApiMethod (POST)
@@ -453,4 +453,55 @@ class Api @@ -453,4 +453,55 @@ class Api
453 curl_close($ch); 453 curl_close($ch);
454 return $result; 454 return $result;
455 } 455 }
  456 +
  457 + //标红
  458 + public function SizeRed($UserId, $OrderId)
  459 + {
  460 + $Level = Db::name('user')->where('id', $UserId)->value('level');
  461 + $Order = Db::name('baoxiudan')->where('id', $OrderId)->find();
  462 + $Type = 0;
  463 + if ($Level == 1) {
  464 + //公司分管领导
  465 + if ($Order['price'] == 3 && $Order['status'] == 1) {
  466 + $Type = 1;
  467 + }
  468 + }
  469 + if ($Level == 2) {
  470 + //公司机电负责人
  471 + if ($Order['price'] == 2 && $Order['status'] == 1) {
  472 + $Type = 1;
  473 + }
  474 + }
  475 + if ($Level == 3) {
  476 + //维修负责人
  477 + if ($Order['wx_user_id'] == $UserId && $Order['redio_user_id'] == '') {
  478 + $Type = 1;
  479 + }
  480 + }
  481 + if ($Level == 4) {
  482 + //维修成员
  483 + if ($Order['redio_user_id'] == $UserId && $Order['repair_type'] == 0) {
  484 + $Type = 1;
  485 + }
  486 + }
  487 + if ($Level == 5) {
  488 + //报修负责人
  489 + if ($Order['talk_con'] == null && $Order['type'] == 2) {
  490 + $Type = 1;
  491 + }
  492 + }
  493 + if ($Level == 6) {
  494 + //报修成员
  495 + if ($Order['type'] == 1 && $Order['repair_type'] == 2) {
  496 + $Type = 1;
  497 + }
  498 + }
  499 + if ($Level == 7) {
  500 + //维修总负责人
  501 + if ($Order['fenpei_type'] == 0) {
  502 + $Type = 1;
  503 + }
  504 + }
  505 + return $Type;
  506 + }
456 } 507 }