public static function format($data) { static $repay_method = null; static $use_type = null; static $loan_type = null; static $status = null; !$repay_method and $repay_method = \App\Config\Loan::repayMethod(); !$use_type and $use_type = \App\Config\Loan::useType(); !$loan_type and $loan_type = \App\Config\Loan::loanType(); !$status and $status = \App\Config\Loan::status(); foreach ($data as &$row) { $row['repay_method_text'] = $repay_method[$row['repay_method']]; $row['use_type_text'] = $use_type[$row['use_type']]; $row['loan_type_text'] = $loan_type[$row['loan_type']]; $row['addtime'] = date('Y/m/d', $row['addtime']); $row['status_text'] = $status[$row['status']]; $row['amount'] = str_replace('.00', '', $row['amount']); $row['contract_text'] = $row['contract'] ? '已签' : ' - '; $row['gps_text'] = $row['gps'] ? '已安装' : ' - '; $row['car_key_text'] = $row['car_key'] ? '已拿' : ' - '; $row['pledge_notary_text'] = $row['pledge_notary'] ? '是' : ' - '; if ($row['begintime']) { $row['begintime'] = date('Y-m-d', $row['begintime']); } } return $data; }
static function getStatusText($_status) { static $status = null; !$status and $status = \App\Config\Loan::status(); return \Func\getArrayValue($status, $_status); }