You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
simple-yewu/common/models/ZhongjiYingxiao.php

159 lines
4.5 KiB

<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "zhongji_yingxiao".
*
* @property int $id
* @property string $celuo_name 策略名字
* @property string $begin_date
* @property string $end_date
* @property string $baofei 保费额度
* @property int $xianzhong_one 险种n选1
* @property string $xianzhong_two 险种n选2
* @property int $car_type_id 车辆类型
* @property int $car_use_id 车辆使用性质
* @property string $created_at
* @property string $updated_at
*/
class ZhongjiYingxiao extends \common\models\Base
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'zhongji_yingxiao';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['begin_date', 'end_date', 'created_at', 'updated_at'], 'safe'],
[['baofei'], 'number'],
[['celuo_name','xianzhong_one', 'xianzhong_two', 'car_type_id', 'car_use_id'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'celuo_name' => 'Celuo Name',
'begin_date' => 'Begin Date',
'end_date' => 'End Date',
'baofei' => 'Baofei',
'xianzhong_one' => 'Xianzhong One',
'xianzhong_two' => 'Xianzhong Two',
'car_type_id' => 'Car Type ID',
'car_use_id' => 'Car Use ID',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
// public function getId()
// {
// return $this->id;
// }
public function getFanxian()
{
return $this->hasMany(ZhongjiFanxianT::className(),['celuo_id'=>'id']);
}
public function getKehufanxian()
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$this->id,'fanxian_type'=>1])->one();
}
public function getXianzhongfanxian($id)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>2])->all();
}
public function getXianzhongfanxianTwo($id)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>3])->one();
}
public function getXianzhongfanxianOne($id)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>5])->one();
}
public function getnogift($id = 0)
{
return ZhongjiFanxianT::find()->where(['celuo_id'=>$this->id,'fanxian_type'=>4])->one();
}
public function getKehuticheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>1])->one();
}
public function getOnlineticheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>2])->one();
}
public function getXianzhongticheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>3])->all();
}
public function getXianzhongtichengTwo($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>4])->one();
}
public function getXianzhongtichengOne($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>5])->one();
}
public function getnogiftTicheng($id)
{
return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>6])->one();
}
public function getGiftNonetwo($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>4])->all();
}
public function getQuanNonetwo($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>4])->all();
}
public function getGiftNone($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>3])->all();
}
public function getQuanNone($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>3])->all();
}
public function getGiftfree($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>1])->all();
}
public function getQuanfree($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>1])->all();
}
public function getGiftMoney($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>2])->all();
}
public function getQuanMoney($id)
{
return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>2])->all();
}
}