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.

84 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. [['goods', 'decription'], 'string'],
  36. [['shipping_name'], 'string', 'max' => 50],
  37. [['shipping_id'], 'string', 'max' => 10],
  38. ];
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'id' => 'id',
  47. 'order_id' => '订单id',
  48. 'shipping_name' => '货流名称',
  49. 'shipping_id' => '运货单位',
  50. 'type' => '类型',
  51. 'goods' => '商品',
  52. 'status' => '状态',
  53. 'decription' => '描述',
  54. 'updated_at' => '更新时间',
  55. 'created_at' => '创建时间',
  56. ];
  57. }
  58. /**
  59. * @author linyao
  60. * @email 602604991@qq.com
  61. * @created Nov 8, 2019
  62. *
  63. * 行为存储创建时间和更新时间
  64. */
  65. public function behaviors()
  66. {
  67. return [
  68. [
  69. 'class' => TimestampBehavior::className(),
  70. 'createdAtAttribute' => 'created_at',
  71. 'updatedAtAttribute' => 'updated_at',
  72. 'value' => function() {
  73. return time();
  74. },
  75. ],
  76. ];
  77. }
  78. }