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.

86 lines
2.0 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_delivery".
  7. *
  8. * @property int $id
  9. * @property int $order_id 订单id
  10. * @property string $shipping_name 货流名称
  11. * @property string $shipping_id 运货单位
  12. * @property int $type 类型
  13. * @property string $goods 商品
  14. * @property int $status 状态
  15. * @property string $decription 描述
  16. * @property int $updated_at 更新时间
  17. * @property int $created_at 创建时间
  18. */
  19. class Delivery extends \yii\db\ActiveRecord
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName()
  25. {
  26. return 'ats_delivery';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [['order_id', 'type', 'status'], 'integer'],
  35. [['shipping_id'], 'required'],
  36. [['goods', 'decription'], 'string'],
  37. [['shipping_name'], 'string', 'max' => 50],
  38. [['shipping_id'], 'string', 'max' => 10],
  39. ];
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'id' => 'id',
  48. 'order_id' => '订单id',
  49. 'shipping_name' => '货流名称',
  50. 'shipping_id' => '运货单位',
  51. 'type' => '类型',
  52. 'goods' => '商品',
  53. 'status' => '状态',
  54. 'decription' => '描述',
  55. 'updated_at' => '更新时间',
  56. 'created_at' => '创建时间',
  57. ];
  58. }
  59. /**
  60. * @author linyao
  61. * @email 602604991@qq.com
  62. * @created Nov 8, 2019
  63. *
  64. * 行为存储创建时间和更新时间
  65. */
  66. public function behaviors()
  67. {
  68. return [
  69. [
  70. 'class' => TimestampBehavior::className(),
  71. 'createdAtAttribute' => 'created_at',
  72. 'updatedAtAttribute' => 'updated_at',
  73. 'value' => function() {
  74. return time();
  75. },
  76. ],
  77. ];
  78. }
  79. }