cxgj/models/OrderRefund.php
2023-11-27 09:45:13 +08:00

142 lines
6.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\models;
use Yii;
use app\models\Model;
/**
* This is the model class for table "{{%order_refund}}".
*
* @property int $id ID
* @property int $cx_mch_id 平台商家ID
* @property int $user_id 用户ID
* @property int $order_id 订单ID
* @property int $order_detail_id 关联订单详情
* @property string $order_no 退款单号
* @property int $type 售后类型1=退货退款2=换货
* @property float $refund_price 退款金额
* @property string $remark 用户退款备注、说明
* @property string $pic_urls 用户上传图片凭证
* @property int $status 状态1=待商家处理2=同意3=拒绝
* @property int $status_time 商家处理时间
* @property string $merchant_remark 商家同意|拒绝备注、理由
* @property int $is_send 用户是否发货0=未发货1=已发货
* @property int $send_time 发货时间
* @property string|null $customer_name 京东商家编号
* @property string $express 快递公司
* @property string $express_no 快递单号
* @property int $address_id 退换货地址ID
* @property int $is_confirm 商家确认操作
* @property int $confirm_time 确认时间
* @property string|null $merchant_customer_name 商家京东商家编号
* @property string $merchant_express 商家发货快递公司
* @property string $merchant_express_no 商家发货快递单号
* @property int $created_at 添加时间
* @property int $updated_at 更新时间
* @property int $deleted_at 删除时间
* @property int $is_delete 是否删除
* @property int $refund_time 退款时间
* @property int $is_refund 是否打款0=否1=是
* @property float $reality_refund_price 商家实际退款金额
* @property string $merchant_express_content 物流内容
* @property string $mobile 联系方式
* @property string $refund_data 售后数据
*/
class OrderRefund extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%order_refund}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['pic_urls', 'refund_data', 'order_no', 'remark', 'merchant_remark', 'express_no', 'merchant_express_no', 'merchant_express_content', 'mobile', 'customer_name', 'express', 'merchant_customer_name', 'merchant_express'], 'trim'],
[['cx_mch_id', 'user_id', 'order_id', 'order_detail_id', 'type', 'status', 'status_time', 'is_send', 'send_time', 'address_id', 'is_confirm', 'confirm_time', 'created_at', 'updated_at', 'deleted_at', 'is_delete', 'refund_time', 'is_refund'], 'integer'],
[['user_id', 'order_id', 'order_detail_id', 'type', 'pic_urls', 'created_at', 'updated_at', 'deleted_at', 'refund_data'], 'required'],
[['refund_price', 'reality_refund_price'], 'number'],
[['pic_urls', 'refund_data'], 'string'],
[['order_no'], 'string', 'max' => 64],
[['remark', 'merchant_remark', 'express_no', 'merchant_express_no', 'merchant_express_content', 'mobile'], 'string', 'max' => 255],
[['customer_name', 'express', 'merchant_customer_name', 'merchant_express'], 'string', 'max' => 65],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cx_mch_id' => '平台商家ID',
'user_id' => '用户ID',
'order_id' => '订单ID',
'order_detail_id' => '关联订单详情',
'order_no' => '退款单号',
'type' => '售后类型1=退货退款2=换货',
'refund_price' => '退款金额',
'remark' => '用户退款备注、说明',
'pic_urls' => '用户上传图片凭证',
'status' => '状态1=待商家处理2=同意3=拒绝',
'status_time' => '商家处理时间',
'merchant_remark' => '商家同意|拒绝备注、理由',
'is_send' => '用户是否发货0=未发货1=已发货',
'send_time' => '发货时间',
'customer_name' => '京东商家编号',
'express' => '快递公司',
'express_no' => '快递单号',
'address_id' => '退换货地址ID',
'is_confirm' => '商家确认操作',
'confirm_time' => '确认时间',
'merchant_customer_name' => '商家京东商家编号',
'merchant_express' => '商家发货快递公司',
'merchant_express_no' => '商家发货快递单号',
'created_at' => '添加时间',
'updated_at' => '更新时间',
'deleted_at' => '删除时间',
'is_delete' => '是否删除',
'refund_time' => '退款时间',
'is_refund' => '是否打款0=否1=是',
'reality_refund_price' => '商家实际退款金额',
'merchant_express_content' => '物流内容',
'mobile' => '联系方式',
'refund_data' => '售后数据',
];
}
public function beforeSave($insert) {
if(parent::beforeSave($insert)){
if($this->isNewRecord){
$this->created_at = time();
}
$this->updated_at = time();
if($this->is_delete == 1)
$this->deleted_at = time();
$this->htmlTagFilter();
return true;
} else {
return false;
}
}
public function htmlTagFilter()
{
$this->remark = Model::htmlTagFilter($this->remark);
$this->merchant_remark = Model::htmlTagFilter($this->merchant_remark);
$this->merchant_customer_name = Model::htmlTagFilter($this->merchant_customer_name);
$this->merchant_express = Model::htmlTagFilter($this->merchant_express);
$this->merchant_express_no = Model::htmlTagFilter($this->merchant_express_no);
$this->mobile = Model::htmlTagFilter($this->mobile);
}
}