public static function add($uid, $oid, $foid, $adviseType, $reason) { $Advise = new Advise(); $Advise->uid = $uid; $Advise->oid = $oid; $Advise->foid = $foid; $Advise->type = $adviseType; $Advise->reason = $reason; $Advise->addtime = time(); $Advise->status = 0; return $Advise->create(); }
public static function hasDone($uid) { $visit = Visit::findFirst("uid={$uid}"); if (!$visit) { return false; } $advises = Advise::getAdvisesByUid($uid, Advise::STATUS_UNDO, 'visit'); return $advises ? false : true; }
public static function hasDone($uid) { $car = Car::findFirst("uid={$uid}"); if (!$car) { return false; } $advises = Advise::getAdvisesByUid($uid, Advise::STATUS_UNDO, 'car'); return $advises ? false : true; }
public static function advise($uid, $foid, $adviseType, $reason, $loan = false) { $isLoanSketch = false; switch ($adviseType) { case 'loansketch': $status = \App\LoanStatus::getStatusSketch(); $oid = User::findFirst("uid={$uid}")->oid; $isLoanSketch = true; break; case 'visit': $status = \App\LoanStatus::getStatusCarAssess(); $oid = Visit::findFirst("uid={$uid}")->oid; $isLoanSketch = true; break; case 'car': $status = \App\LoanStatus::getStatusVisit(); $oid = Car::findFirst("uid={$uid}")->oid; $isLoanSketch = true; break; case 'face': $status = \App\LoanStatus::getStatusChecked(); $oid = Face::findFirst("uid={$uid}")->oid; $isLoanSketch = true; break; } if (empty($oid)) { return false; } if ($isLoanSketch) { $model = LoanSketch::findFirst("uid={$uid}"); $model->status = $status; $model->update(); } Advise::add($uid, $oid, $foid, $adviseType, $reason); return true; }
private function canModifyActions($uid, $status) { $advises = Advise::formatByType(Advise::getAdvisesByUid($uid)); $actions = ['loansketch' => 0, 'visit' => 0, 'car' => 0, 'face' => 0, 'rc' => 0]; $advises_undo = array_intersect_key($advises, $actions); if ($advises_undo) { $this->view->setVars(['advises' => $advises_undo]); } else { if (\App\LoanStatus::needRc($status)) { $actions['rc'] = true; } } return $actions; }
/** * 获取贷款所有信息、全国风控提交之前的数据 */ public static function infos($uid, $level = '*') { $uid = intval($uid); $infos = []; $infos['user'] = self::findFirst("uid={$uid}")->toArray(); $isArray = is_array($level); $all = $level == '*'; if ($all || ($isArray and in_array('loansketch', $level))) { $infos['loansketch'] = LoanSketch::findByUid($uid); $infos['loansketch_advises'] = Advise::getAdvisesByUid($uid, Advise::STATUS_UNDO, 'loansketch'); } //面审 if ($all || ($isArray and in_array('face', $level))) { $infos['face'] = Face::findByUid($uid); $infos['face_advises'] = Advise::getAdvisesByUid($uid, Advise::STATUS_UNDO, 'face'); } //外访 if ($all || ($isArray and in_array('visit', $level))) { $infos['visit'] = Visit::findByUid($uid); $infos['visit_advises'] = Advise::getAdvisesByUid($uid, Advise::STATUS_UNDO, 'visit'); } //车评 if ($all || ($isArray and in_array('car', $level))) { $infos['car'] = Car::findByUid($uid); $infos['car_advises'] = Advise::getAdvisesByUid($uid, Advise::STATUS_UNDO, 'car'); } if ($all || ($isArray and in_array('car_files', $level))) { $infos['car_files'] = Files::getFilesByUid($uid, \App\Config\Loan::uploadTypes('car')); } //贷款 if ($all || ($isArray and in_array('loan', $level))) { $infos['loan'] = Loan::findByUid($uid); } return $infos; }
/** * 获取当前操作者所具有的面审、车评、外访等权限 * 判断是否有待处理任务、和贷款状态 */ private function canModifyActions($uid, $status, $type = null) { $apply = $this->authHasAction('apply'); $face = $this->authHasAction('face'); $visit = $this->authHasAction('visit'); $car = $this->authHasAction('car'); $actions = ['apply' => false, 'face' => false, 'visit' => false, 'car' => false, 'reface' => false]; $advises = Advise::formatByType(Advise::getAdvisesByUid($uid)); if (array_key_exists('loansketch', $advises)) { $do = 'apply'; } else { if (\App\LoanStatus::needVisit($status) || \App\LoanStatus::needCarAssess($status) || array_key_exists('visit', $advises) || array_key_exists('car', $advises)) { $do = ['visit', 'car']; } else { if (\App\LoanStatus::needReface($status) || array_key_exists('face', $advises)) { $do = 'reface'; } else { if (\App\LoanStatus::needFace($status) || array_key_exists('face', $advises)) { $do = 'face'; } else { if (\App\LoanStatus::needRc($status)) { $do = 'rc'; } } } } } if ($apply and $status == \App\LoanStatus::getStatusSketch()) { $actions['apply'] = true; } if ($face and $do == 'face') { $actions['face'] = true; } else { if ($visit || $car and $do == ['visit', 'car']) { $actions['visit'] = $visit; $actions['car'] = $car; } else { if ($face and $do == 'reface') { $actions['reface'] = true; } } } if ($type) { return array_key_exists($type, $actions) ? $actions[$type] : false; } $this->view->setVars(['advises' => $advises, 'do' => $do]); return $actions; }