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.

123 lines
3.7 KiB

  1. <?php
  2. namespace backend\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_order".
  7. *
  8. * @property int $id
  9. * @property int $user_id 用户id
  10. * @property string $order_sn 订单号
  11. * @property string $invoice_id 发票单号
  12. * @property int $status 状态
  13. * @property int $type 类型
  14. * @property int $goods_count 商品数量
  15. * @property int $goods_amount 商品金额
  16. * @property int $shipping_amount 物流金额
  17. * @property int $shipping_type 物流类型
  18. * @property string $consignee 收件人
  19. * @property string $phone 手机号码
  20. * @property string $province 省份
  21. * @property string $city 城市
  22. * @property string $area 区域
  23. * @property int $taking_site 自提点
  24. * @property int $pay_type 支付方式
  25. * @property int $pay_at 支付时间
  26. * @property string $payment_sn 付款单号
  27. * @property int $payment_amount 支付金额
  28. * @property int $receivables 应收款
  29. * @property string $remarks 备注
  30. * @property int $discount_amount 折扣金额
  31. * @property string $discount_description 折扣说明
  32. * @property int $updated_at 更新时间
  33. * @property int $created_at 创建时间
  34. * @property string $address 详细地址
  35. */
  36. class Order extends \yii\db\ActiveRecord
  37. {
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public static function tableName()
  42. {
  43. return 'ats_order';
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function rules()
  49. {
  50. return [
  51. [['user_id'], 'required'],
  52. [['user_id', 'status', 'type', 'goods_count', 'goods_amount', 'shipping_amount', 'shipping_type', 'taking_site', 'pay_type', 'pay_at', 'payment_amount', 'receivables', 'discount_amount'], 'integer'],
  53. [['discount_description', 'address'], 'string'],
  54. [['order_sn', 'invoice_id'], 'string', 'max' => 64],
  55. [['consignee', 'phone'], 'string', 'max' => 20],
  56. [['province', 'city', 'area'], 'string', 'max' => 10],
  57. [['payment_sn'], 'string', 'max' => 120],
  58. [['remarks'], 'string', 'max' => 255],
  59. ];
  60. }
  61. /**
  62. * {@inheritdoc}
  63. */
  64. public function attributeLabels()
  65. {
  66. return [
  67. 'id' => 'id',
  68. 'user_id' => '用户id',
  69. 'order_sn' => '订单号',
  70. 'invoice_id' => '发票单号',
  71. 'status' => '状态',
  72. 'type' => '类型',
  73. 'goods_count' => '商品数量',
  74. 'goods_amount' => '商品金额',
  75. 'shipping_amount' => '物流金额',
  76. 'shipping_type' => '物流类型',
  77. 'consignee' => '收件人',
  78. 'phone' => '手机号码',
  79. 'province' => '省份',
  80. 'city' => '城市',
  81. 'area' => '区域',
  82. 'taking_site' => '自提点',
  83. 'pay_type' => '支付方式',
  84. 'pay_at' => '支付时间',
  85. 'payment_sn' => '付款单号',
  86. 'payment_amount' => '支付金额',
  87. 'receivables' => '应收款',
  88. 'remarks' => '备注',
  89. 'discount_amount' => '折扣金额',
  90. 'discount_description' => '折扣说明',
  91. 'updated_at' => '更新时间',
  92. 'created_at' => '创建时间',
  93. 'address' => '详细地址',
  94. ];
  95. }
  96. /**
  97. * @author linyao
  98. * @email 602604991@qq.com
  99. * @created Nov 8, 2019
  100. *
  101. * 行为存储创建时间和更新时间
  102. */
  103. public function behaviors()
  104. {
  105. return [
  106. [
  107. 'class' => TimestampBehavior::className(),
  108. 'createdAtAttribute' => 'created_at',
  109. 'updatedAtAttribute' => 'updated_at',
  110. 'value' => function() {
  111. return time();
  112. },
  113. ],
  114. ];
  115. }
  116. }