Files
liche/common/models/biz/Biz_settle_srv_model.php
T
2022-06-28 16:39:53 +08:00

75 lines
2.1 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=> '按揭'
];
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;
}
}
/**
*
* type = 1 (price结算价)
* type = 2 (type 保险类型[1商业险 2交强险] 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['时间区间'] = $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['rebate'];
$res['产品'] = $jsondata['finance_title'];
$res['期数'] = $jsondata['finance_num'];
break;
default:
}
}
return $res;
}
}