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.
385 lines
12 KiB
385 lines
12 KiB
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
|
|
/**
|
|
* This is the model class for table "order_t".
|
|
*
|
|
* @property integer $id
|
|
* @property integer $car_id
|
|
* @property integer $user_id
|
|
* @property string $car_no
|
|
* @property string $engine_no
|
|
* @property string $car_frame_no
|
|
* @property string $car_man
|
|
* @property string $car_man_type
|
|
* @property string $car_man_phone
|
|
* @property string $car_man_number
|
|
* @property string $gift_other
|
|
* @property integer $company_id
|
|
* @property integer $company2_id
|
|
* @property integer $status_id
|
|
* @property string $submit_date
|
|
* @property string $id_man
|
|
* @property string $id_man_number
|
|
* @property string $id_man_phone
|
|
* @property string $id_man_type
|
|
* @property string $link_man
|
|
* @property string $link_man_phone
|
|
* @property string $link_man_type
|
|
* @property string $link_man_number
|
|
* @property string $insurer1_begin_date
|
|
* @property string $insurer1_end_date
|
|
* @property string $insurer2_begin_date
|
|
* @property string $insurer2_end_date
|
|
* @property string $send_date
|
|
* @property integer $pay_type_id
|
|
* @property string $pay_no
|
|
* @property string $remark
|
|
* @property string $total1
|
|
* @property string $total1_clear
|
|
* @property string $total1_real
|
|
* @property string $total1_dis
|
|
* @property string $total1_percent
|
|
* @property string $total1_rate
|
|
* @property string $total2
|
|
* @property string $total2_clear
|
|
* @property string $total2_rate
|
|
* @property string $total3
|
|
* @property string $total_all
|
|
* @property string $total_real
|
|
* @property string $price_remark
|
|
* @property string $insurer1_no
|
|
* @property string $insurer2_no
|
|
* @property string $identifying_code
|
|
* @property integer $lock_id
|
|
* @property string $money_man
|
|
* @property string $money_no
|
|
* @property string $money_bank
|
|
* @property string $email
|
|
* @property integer $success_id
|
|
* @property integer $return_status_id
|
|
* @property integer $return_time
|
|
* @property string $return_remark
|
|
* @property string $print_date
|
|
* @property string $piao_header
|
|
* @property integer $first_send
|
|
* @property integer $send_times
|
|
* @property integer $check_gift
|
|
* @property string $tijiang
|
|
* @property integer $gift_type1_id
|
|
* @property integer $gift_type2_id
|
|
* @property integer $gift_type3_id
|
|
* @property integer $gift_type4_id
|
|
* @property integer $gift_type5_id
|
|
* @property integer $gift_type6_id
|
|
* @property integer $gift_type7_id
|
|
* @property integer $gift_type8_id
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property string $photo_face
|
|
* @property string $photo_back
|
|
* @property integer $op1_id
|
|
* @property integer $op2_id
|
|
*/
|
|
class OrderT extends \common\models\Base
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'order_t';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['car_id', 'user_id', 'company_id', 'company2_id', 'status_id', 'pay_type_id','lock_id','send_city_id','send_district_id','success_id','return_status_id','return_time','first_send','send_times','check_gift','gift_type1_id','gift_type8_id','gift_type2_id','gift_type3_id','gift_type4_id','gift_type5_id','gift_type6_id','gift_type7_id','business_group_id','op1_id','op2_id','shoufei_id','payer','payee_id','hk_status','payment_id','account_status','insurance_status','el_insurance','ord_scheme_id','non_num','addr_id'], 'integer'],
|
|
[['submit_date', 'insurer1_begin_date', 'insurer1_end_date', 'insurer2_begin_date', 'insurer2_end_date', 'send_date','print_date','zhifu_date', 'created_at', 'updated_at','insurer_date_start','insurer_date_end'], 'safe'],
|
|
[['gift_other', 'id_man', 'id_man_number', 'id_man_type', 'id_man_phone', 'link_man', 'link_man_phone', 'link_man_type', 'link_man_number', 'send_address','car_frame_no','car_man','total1','total1_clear','total1_real','total1_dis','total1_percent','total1_rate','total2','total2_clear','total2_rate','total3','total_all','total_real','price_remark','money_no','money_bank','email','return_remark','piao_header','photo_back','photo_face','tijiang'], 'string', 'max' => 100],
|
|
[['car_no','engine_no','pay_no','insurer1_no','insurer2_no','identifying_code','money_man','insurer_non_no'], 'string', 'max' => 50],
|
|
[['remark'], 'string', 'max' => 200],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'car_id' => 'Car ID',
|
|
'user_id' => 'User ID',
|
|
'car_no' => 'Car No',
|
|
'engine_no' => 'Engine No',
|
|
'car_frame_no' => 'Car Frame No',
|
|
'car_man' => 'Car Man',
|
|
'gift_other' => 'Gift Other',
|
|
'company_id' => 'Company ID',
|
|
'company2_id' => 'Company2 ID',
|
|
'status_id' => 'Status ID',
|
|
'submit_date' => 'Submit Date',
|
|
'id_man' => 'Id Man',
|
|
'id_number' => 'Id Number',
|
|
'link_man' => 'Link Man',
|
|
'insurer1_begin_date' => 'Insurer1 Begin Date',
|
|
'insurer1_end_date' => 'Insurer1 End Date',
|
|
'insurer2_begin_date' => 'Insurer2 Begin Date',
|
|
'insurer2_end_date' => 'Insurer2 End Date',
|
|
'send_date' => 'Send Date',
|
|
'direction_id' => 'Direction 1 ID',
|
|
'range1_id' => 'Range 1 ID',
|
|
'city1_id' => 'City 1 ID',
|
|
'district1_id' => 'District 1 ID',
|
|
'send_address1' => 'Send Address 1',
|
|
'direction2_id' => 'Direction 2 ID',
|
|
'range2_id' => 'Range 2 ID',
|
|
'city2_id' => 'City 2 ID',
|
|
'district2_id' => 'District 2 ID',
|
|
'pay_type_id' => 'Pay Type ID',
|
|
'pay_no' => 'Pay No',
|
|
'remark' => 'Remark',
|
|
'total1' => 'Total 1',
|
|
'total1_clear' => 'Total 1 Clear',
|
|
'total1_real' => 'Total 1 Real',
|
|
'total1_dis' => 'Total 1 Dis',
|
|
'total1_percent' => 'Total 1 Percent',
|
|
'total1_rate' => 'Total 1 Rate',
|
|
'total2' => 'Total 2',
|
|
'total2_clear' => 'Total 2 Clear',
|
|
'total2_rate' => 'Total 2 Rate',
|
|
'total3' => 'Total 3',
|
|
'total_all' => 'Total all',
|
|
'total_real' => 'Total Real',
|
|
'price_remark' => 'Price Remark',
|
|
'lock_id' => 'Lock ID',
|
|
'insurer1_no' => 'Insurer 1 No',
|
|
'insurer2_no' => 'Insurer 2 No',
|
|
'identifying_code' => 'Identifying Code',
|
|
'money_man' => 'Money Man',
|
|
'money_no' => 'Money No',
|
|
'money_bank' => 'Money Bank',
|
|
'email' => 'email',
|
|
'success_id' => 'Success ID',
|
|
'return_status_id' => 'Return Status ID',
|
|
'return_time' => 'Return Time',
|
|
'return_remark' => 'Return Remark',
|
|
'print_date' => 'Print Date',
|
|
'piao_header' => 'Piao Header',
|
|
'first_send' => 'First Send',
|
|
'send_times' => 'Send Times',
|
|
'check_gift' => 'Check Gift',
|
|
'tijiang' => 'Ti Jiang',
|
|
'gift_type1_id' => 'Gift Type1 ID',
|
|
'gift_type2_id' => 'Gift Type2 ID',
|
|
'gift_type3_id' => 'Gift Type3 ID',
|
|
'gift_type4_id' => 'Gift Type4 ID',
|
|
'gift_type5_id' => 'Gift Type5 ID',
|
|
'gift_type6_id' => 'Gift Type6 ID',
|
|
'gift_type7_id' => 'Gift Type7 ID',
|
|
'gift_type8_id' => 'Gift Type8 ID',
|
|
'created_at' => 'Created At',
|
|
'updated_at' => 'Updated At',
|
|
'photo_face' => 'Photo Face',
|
|
'photo_back' => 'Photo Back',
|
|
'business_group_id' => 'Business Group Id',
|
|
'op1_id' => 'Op 1 ID',
|
|
'op2_id' => 'Op 2 ID'
|
|
];
|
|
}
|
|
|
|
public function getUser()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'user_id']);
|
|
}
|
|
public function getAddr()
|
|
{
|
|
return $this->hasOne(OrderAddress::className(),['id'=>'addr_id']);
|
|
}
|
|
public function getPayee()
|
|
{
|
|
return $this->hasOne(PayeeT::className(),['id'=>'payee_id']);
|
|
}
|
|
public function getPayment()
|
|
{
|
|
return $this->hasOne(Payment::className(),['id'=>'payment_id']);
|
|
}
|
|
public function getLock()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'lock_id']);
|
|
}
|
|
|
|
public function getSuccess()
|
|
{
|
|
return $this->hasOne(InvalidT::className(),['id'=>'success_id']);
|
|
}
|
|
public function getPayType()
|
|
{
|
|
return $this->hasOne(PayTypeT::className(),['id'=>'pay_type_id']);
|
|
}
|
|
|
|
public function getCar()
|
|
{
|
|
return $this->hasOne(CarT::className(),['id'=>'car_id']);
|
|
}
|
|
|
|
public function getStatus()
|
|
{
|
|
return $this->hasOne(StatusT::className(),['id'=>'status_id']);
|
|
}
|
|
|
|
public function getCompany()
|
|
{
|
|
return $this->hasOne(InsurerCompanyT::className(),['id'=>'company_id']);
|
|
}
|
|
|
|
public function getCompany2()
|
|
{
|
|
return $this->hasOne(InsurerCompany2T::className(),['id'=>'company2_id']);
|
|
}
|
|
|
|
public function getPrices()
|
|
{
|
|
return $this->hasMany(PriceT::className(),['order_id'=>'id']);
|
|
}
|
|
|
|
public function getRange1()
|
|
{
|
|
return $this->hasOne(RangeT::className(),['id'=>'range1_id']);
|
|
}
|
|
|
|
public function getSendCity()
|
|
{
|
|
return $this->hasOne(CityT::className(),['id'=>'send_city_id']);
|
|
}
|
|
|
|
public function getSendDistrict()
|
|
{
|
|
return $this->hasOne(DistrictT::className(),['id'=>'send_district_id']);
|
|
}
|
|
|
|
public function getRange2()
|
|
{
|
|
return $this->hasOne(RangeT::className(),['id'=>'range2_id']);
|
|
}
|
|
|
|
public function getDirection2()
|
|
{
|
|
return $this->hasOne(DirectionT::className(),['id'=>'direction2_id']);
|
|
}
|
|
|
|
public function getCity2()
|
|
{
|
|
return $this->hasOne(CityT::className(),['id'=>'city2_id']);
|
|
}
|
|
|
|
public function getDistrict2()
|
|
{
|
|
return $this->hasOne(DistrictT::className(),['id'=>'district2_id']);
|
|
}
|
|
|
|
public function getGifts()
|
|
{
|
|
return $this->hasMany(GiftT::className(),['id'=>'gift_id'])
|
|
->viaTable('car_gift_t',['order_id'=>'id']);
|
|
}
|
|
|
|
public function getGiftType1()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type1_id']);
|
|
}
|
|
public function getGiftType2()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type2_id']);
|
|
}
|
|
public function getGiftType3()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type3_id']);
|
|
}
|
|
public function getGiftType4()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type4_id']);
|
|
}
|
|
public function getGiftType5()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type5_id']);
|
|
}
|
|
public function getGiftType6()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type6_id']);
|
|
}
|
|
public function getGiftType7()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type7_id']);
|
|
}
|
|
public function getGiftType8()
|
|
{
|
|
return $this->hasOne(GiftType2T::className(),['id'=>'gift_type8_id']);
|
|
}
|
|
|
|
public function getCaiwu()
|
|
{
|
|
return $this->hasOne(OrderCaiwuT::className(),['order_id'=>'id']);
|
|
}
|
|
public function getCaiwu1()
|
|
{
|
|
return $this->hasOne(OrderCaiwuT1::className(),['order_id'=>'id']);
|
|
}
|
|
public function getSendLog()
|
|
{
|
|
return $this->hasOne(SendLogT::className(),['order_id'=>'id']);
|
|
}
|
|
|
|
public function getOrderGifts()
|
|
{
|
|
return $this->hasMany(OrderGiftT::className(),['order_id'=>'id']);
|
|
}
|
|
|
|
public function getGiftPrice($is_free,$gift_type)
|
|
{
|
|
$order_gifts = OrderGiftT::find()
|
|
->where('order_id='.$this->id.' and is_free='.$is_free.' and gift_type='.$gift_type)
|
|
->all();
|
|
$price = 0;
|
|
foreach($order_gifts as $order_gift) {
|
|
$price += $order_gift->price;
|
|
}
|
|
return $price;
|
|
}
|
|
|
|
public function getUsers()
|
|
{
|
|
return $this->hasMany(OrderUserT::className(),['order_id'=>'id']);
|
|
}
|
|
|
|
/**
|
|
* 获取业务分组
|
|
* 2017-12-20
|
|
* xzz
|
|
*/
|
|
public function getBusinessGroup()
|
|
{
|
|
return $this->hasOne(BusinessGroupT::className(), ['id' => 'business_group_id']);
|
|
}
|
|
|
|
public function getOp1()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'op1_id']);
|
|
}
|
|
|
|
public function getOp2()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'op2_id']);
|
|
}
|
|
public function getNona()
|
|
{
|
|
return $this->hasOne(Scheme::className(),['id'=>'ord_scheme_id']);
|
|
}
|
|
}
|
|
|