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.

121 lines
3.6 KiB

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