예제 #1
0
 private function searchConditions()
 {
     $conditions = [];
     if (!$this->isNationWideBid()) {
         $bid = $this->getOperatorBid();
         $conditions[] = '{User}.bid=' . $bid;
     }
     $post = $this->request->get();
     if (isset($post['keyword']) and !empty($post['keyword'])) {
         $keyword = $post['keyword'];
         if (preg_match('/^\\d+$/', $keyword)) {
             $conditions[] = '{User}.uid = ' . intval($keyword);
         }
         if (\Util\Validator::isCh($keyword)) {
             $conditions[] = '{User}.realname = \'' . $keyword . '\'';
         }
     }
     if (isset($post['deal']) and in_array($post['deal'], [-1, 1])) {
         if ($post['deal'] == 1) {
             $conditions[] = '{Loan}.status>=' . \App\LoanStatus::getStatusRunConfirm();
         } else {
             $conditions[] = '{Loan}.status=' . \App\LoanStatus::getStatusRcAgree();
             $conditions[] = '{Loan}.gps=1 and {Loan}.contract=1 and {Loan}.car_key=1 and {Loan}.pledge_notary=1';
         }
     } else {
         $conditions[] = '{Loan}.status>=' . \App\LoanStatus::getStatusRcAgree();
         $conditions[] = '{Loan}.gps=1 and {Loan}.contract=1 and {Loan}.car_key=1 and {Loan}.pledge_notary=1';
     }
     return $conditions;
 }
예제 #2
0
 private function searchConditions()
 {
     $conditions = [];
     if (!$this->isNationWideBid()) {
         $bid = $this->getOperatorBid();
         $conditions[] = '{User}.bid=' . $bid;
     }
     $post = $this->request->get();
     if (isset($post['keyword']) and !empty($post['keyword'])) {
         $keyword = $post['keyword'];
         if (preg_match('/^\\d+$/', $keyword)) {
             $conditions[] = '{User}.uid = ' . intval($keyword);
         }
         if (\Util\Validator::isCh($keyword)) {
             $conditions[] = '{User}.realname = \'' . $keyword . '\'';
         }
     }
     $conditions[] = '{Loan}.status>=' . \App\LoanStatus::getStatusRcAgree();
     if (isset($post['deal']) and in_array($post['deal'], [1, -1])) {
         $conditions[] = '{Loan}.gps' . ($post['deal'] == 1 ? '=1' : '!=1');
     }
     return $conditions;
 }
예제 #3
0
 public static function updateStatus($uid, $status)
 {
     $info = LoanSketch::findFirst("uid={$uid}");
     if (!$info) {
         return false;
     }
     //面审
     if ($status == \App\LoanStatus::getStatusFace()) {
     } else {
         if ($status == \App\LoanStatus::getStatusVisit() and Car::hasDone($uid)) {
             $status = \App\LoanStatus::getStatusChecked();
         } else {
             if ($status == \App\LoanStatus::getStatusCarAssess() and Visit::hasDone($uid)) {
                 $status = \App\LoanStatus::getStatusChecked();
             } else {
                 if (in_array($status, [\App\LoanStatus::getStatusRcAgree(), \App\LoanStatus::getStatusRcRefuse()])) {
                 }
             }
         }
     }
     $info->status = $status;
     return $info->update();
 }
예제 #4
0
 /**
  * 处理案件
  */
 public function dealAction()
 {
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         $type = $data['type'];
         if (!in_array($type, ['agree', 'refuse'])) {
             $this->error('参数错误');
         }
         $data['oid'] = $this->getOperatorId();
         $data['status'] = $type == 'agree' ? \App\LoanStatus::getStatusRcAgree() : \App\LoanStatus::getStatusRcRefuse();
         $model = new LoanForm($type);
         $result = $model->validate($data);
         if ($result) {
             if ($model->deal()) {
                 LoanSketch::updateStatus($data['uid'], $data['status']);
                 Log::add($data['uid'], $data['oid'], \App\Config\Log::loanOperate('rc'));
                 $this->success('操作成功');
             } else {
                 Log::add($data['uid'], $data['oid'], \App\Config\Log::loanOperate('rc_refuse'));
                 $this->error('操作失败');
             }
         } else {
             $this->error('验证失败');
         }
         exit;
     }
 }