90 lines
2.7 KiB
PHP
90 lines
2.7 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Biz_settle_srv_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_biz_settle_srv';
|
|
private $status_ary = [-1 => '删除' , 0 => '禁用', 1 => '正常'];
|
|
private $type_ary = [
|
|
1 => '挂牌', 2=>'保险' , 3=> '按揭'
|
|
];
|
|
private $insure_type_ary = [1 => '商业险', 2 => '交强险', 3 => '意外险'];
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
/**
|
|
* 获取状态
|
|
* @param $status
|
|
* @return string|string[]
|
|
*/
|
|
public function get_status($status){
|
|
if(strlen($status)){
|
|
return $this->status_ary[$status];
|
|
}else{
|
|
return $this->status_ary;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取类型
|
|
* @param $type
|
|
* @return string|string[]
|
|
*/
|
|
public function get_type($type){
|
|
if(strlen($type)){
|
|
return $this->type_ary[$type];
|
|
}else{
|
|
return $this->type_ary;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取保险类型
|
|
* @param $type
|
|
* @return string|string[]
|
|
*/
|
|
public function get_insure_type($type){
|
|
if(strlen($type)){
|
|
return $this->insure_type_ary[$type];
|
|
}else{
|
|
return $this->insure_type_ary;
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* type = 1 (price结算价)
|
|
* type = 2 (type 保险类型[1商业险 2交强险 3意外险] rebate 返点 s_time 开始时间 e_time 结束时间)
|
|
* @param $type
|
|
* @param $jsondata
|
|
* @return array
|
|
*/
|
|
public function get_jsondata($type,$jsondata){
|
|
$jsondata = json_decode($jsondata,true);
|
|
$res = [];
|
|
if($jsondata){
|
|
switch ($type){
|
|
case 1:
|
|
$res['结算价'] = $jsondata['price'];
|
|
break;
|
|
case 2:
|
|
$res['返点'] = $jsondata['rebate'];
|
|
#$res['保险类型'] = $jsondata['type'] ==1 ? '商业险' : '交强险';
|
|
$res['保险类型'] = intval($jsondata['type']) ? $this->get_insure_type(intval($jsondata['type'])) : '';
|
|
$res['时间区间'] = $jsondata['s_time']&&$jsondata['e_time'] ? date('Y-m-d',$jsondata['s_time'])."到".date('Y-m-d',$jsondata['e_time']) : "";
|
|
break;
|
|
case 3:
|
|
$res['期数'] = $jsondata['finance_num'];
|
|
$res['返点'] = $jsondata['rebate'];
|
|
#$res['产品'] = $jsondata['supplier_title'] ? $jsondata['supplier_title'] : $jsondata['finance_title'];
|
|
break;
|
|
default:
|
|
}
|
|
}
|
|
return $res;
|
|
}
|
|
}
|