Browse Source

修改售后数据表以及模型

antshop
linyaostalker 5 years ago
parent
commit
87b49a07de
  1. 68
      backend/modules/shop/migrations/m191209_080245_update_table_after_sale.php
  2. 66
      backend/modules/shop/models/ars/AfterSale.php

68
backend/modules/shop/migrations/m191209_080245_update_table_after_sale.php

@ -0,0 +1,68 @@
<?php
use yii\db\Migration;
/**
* Class m191209_080245_update_table_after_sale
*/
class m191209_080245_update_table_after_sale extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$this->dropTable('ats_after_sale');
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="售后表"';
$this->createTable('ats_after_sale', [
'id' => $this->primaryKey(),
'wx_refund_id'=>$this->string(64)->defaultValue('')->notNull()->comment('微信退款单号'),
'after_sale_sn'=>$this->string(64)->defaultValue('')->notNull()->comment('售后单号'),
'user_id'=>$this->integer(11)->defaultValue('0')->notNull()->comment('用户id'),
'order_goods_id'=>$this->integer(11)->defaultValue('0')->notNull()->comment('订单商品id'),
'amount'=>$this->integer(20)->defaultValue("0")->notNull()->comment('退货时实际退的金额'),
'count'=>$this->integer(11)->defaultValue("0")->notNull()->comment('退换货的商品数量'),
'apply_at'=>$this->integer(11)->defaultValue(null)->comment('申请时间'),
'dealt_at'=>$this->integer(11)->defaultValue(null)->comment('处理时间'),
'finish_at'=>$this->integer(11)->defaultValue(null)->comment('完成时间'),
'operator_id'=>$this->integer(11)->defaultValue("0")->notNull()->comment('操作者'),
'refund_type'=>$this->tinyInteger(1)->defaultValue("1")->comment('退款类型:1:全额退款;2:部分退款'),
'description'=>$this->text()->comment('描述'),
'image' => $this->text()->comment('图片'),
'status' => $this->tinyInteger(2)->defaultValue('0')->notNull()->comment('处理状态:0:未处理;1:已同意,待买家确认;2:用户已确认;3:已拒绝;4:退款成功;5:已取消;'),
'reason'=>$this->smallInteger(2)->defaultValue("0")->comment('退换货理由'),
'remarks'=>$this->text()->comment('店家备注'),
'take_shipping_sn'=>$this->string(50)->defaultValue(null)->comment('用户发货物流单号'),
'refund_mode' => $this->tinyInteger(2)->defaultValue('1')->notNull()->comment('退款方式:1:仅退款;2:退货退款;')
],$tableOptions);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('ats_after_sale');
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="售后表"';
$this->createTable('ats_after_sale', [
'id' => $this->primaryKey(),
'operator_id'=>$this->integer(11)->notNull()->comment('操作者'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'wx_refund_id'=>$this->string(64)->defaultValue(null)->comment('微信退款单号'),
'after_sale_sn'=>$this->string(64)->defaultValue(null)->comment('售后单号'),
'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单商品id'),
'count'=>$this->integer(11)->defaultValue(null)->comment('退换货的商品数量'),
'amount'=>$this->integer(20)->notNull()->comment('退货时实际退的金额'),
'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
'reason'=>$this->smallInteger(2)->defaultValue(0)->comment('退换货理由'),
'description'=>$this->text()->comment('描述'),
'take_shipping_sn'=>$this->string(50)->defaultValue(null)->comment('用户发货物流单号'),
'send_shipping_sn'=>$this->string(50)->defaultValue(null)->comment('换货商家发货的物流单号'),
'remarks'=>$this->text()->comment('店家备注'),
'applyed_at'=>$this->integer(11)->defaultValue(null)->comment('申请时间'),
'dealed_at'=>$this->integer(11)->defaultValue(null)->comment('处理时间'),
'finished_at'=>$this->integer(11)->defaultValue(null)->comment('完成时间'),
],$tableOptions);
return true;
}
}

66
backend/modules/shop/models/ars/AfterSale.php

@ -1,6 +1,6 @@
<?php
namespace backend\modules\shop\models\ars;
namespace backend\modules\shop\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
@ -9,25 +9,40 @@ use yii\behaviors\TimestampBehavior;
* This is the model class for table "ats_after_sale".
*
* @property int $id
* @property int $operator_id 操作者
* @property int $user_id 用户id
* @property string $wx_refund_id 微信退款单号
* @property string $after_sale_sn 售后单号
* @property int $user_id 用户id
* @property int $order_goods_id 订单商品id
* @property int $count 退换货的商品数量
* @property int $amount 退货时实际退的金额
* @property int $type 类型
* @property int $reason 退换货理由
* @property int $count 退换货的商品数量
* @property int $apply_at 申请时间
* @property int $dealt_at 处理时间
* @property int $finish_at 完成时间
* @property int $operator_id 操作者
* @property int $refund_type 退款类型:1:全额退款;2:部分退款
* @property string $description 描述
* @property string $take_shipping_sn 用户发货物流单号
* @property string $send_shipping_sn 换货商家发货的物流单号
* @property string $image 图片
* @property int $status 处理状态:0:未处理;1:已同意,待买家确认;2:用户已确认;3:已拒绝;4:退款成功;5:已取消;
* @property int $reason 退换货理由
* @property string $remarks 店家备注
* @property int $applyed_at 申请时间
* @property int $dealed_at 处理时间
* @property int $finished_at 完成时间
* @property string $take_shipping_sn 用户发货物流单号
* @property int $refund_mode 退款方式:1:仅退款;2:退货退款;
*/
class AfterSale extends \yii\db\ActiveRecord
{
//退款类型
const REFUND_TYPE_ALL = 1; //全额退款
const REFUND_TYPE_PART = 2; //部分退款
//处理状态
const STATUS_UNTREATED = 0; //未处理
const STATUS_ACCEPT = 1; //已同意,待买家确认
const STATUS_CONFIRM = 2; //用户已确认
const STATUS_REJECT = 3; //已拒绝
const STATUS_FINISH = 4; //退款成功
const STATUS_CANCEL = 5; //已取消
//退款方式
const REFUND_MODE_MONEY = 1; //仅退款
const REFUND_MODE_MONEY_GOODS = 2;
/**
* {@inheritdoc}
*/
@ -42,11 +57,10 @@ class AfterSale extends \yii\db\ActiveRecord
public function rules()
{
return [
[['operator_id', 'user_id', 'amount'], 'required'],
[['operator_id', 'user_id', 'order_goods_id', 'count', 'amount', 'type', 'reason', 'applyed_at', 'dealed_at', 'finished_at'], 'integer'],
[['description', 'remarks'], 'string'],
[['user_id', 'order_goods_id', 'amount', 'count', 'apply_at', 'dealt_at', 'finish_at', 'operator_id', 'refund_type', 'status', 'reason', 'refund_mode'], 'integer'],
[['description', 'image', 'remarks'], 'string'],
[['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
[['take_shipping_sn', 'send_shipping_sn'], 'string', 'max' => 50],
[['take_shipping_sn'], 'string', 'max' => 50],
];
}
@ -57,22 +71,24 @@ class AfterSale extends \yii\db\ActiveRecord
{
return [
'id' => 'id',
'operator_id' => '操作者',
'user_id' => '用户id',
'wx_refund_id' => '微信退款单号',
'after_sale_sn' => '售后单号',
'user_id' => '用户id',
'order_goods_id' => '订单商品id',
'count' => '退换货的商品数量',
'amount' => '退货时实际退的金额',
'type' => '类型',
'reason' => '退换货理由',
'count' => '退换货的商品数量',
'apply_at' => '申请时间',
'dealt_at' => '处理时间',
'finish_at' => '完成时间',
'operator_id' => '操作者',
'refund_type' => '退款类型',
'description' => '描述',
'take_shipping_sn' => '用户发货物流单号',
'send_shipping_sn' => '换货商家发货的物流单号',
'image' => '图片',
'status' => '处理状态',
'reason' => '退换货理由',
'remarks' => '店家备注',
'applyed_at' => '申请时间',
'dealed_at' => '处理时间',
'finished_at' => '完成时间',
'take_shipping_sn' => '用户发货物流单号',
'refund_mode' => '退款方式',
];
}

Loading…
Cancel
Save