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.

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