Product.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\plugins\product_traceability\models;
  8. use yii\behaviors\TimestampBehavior;
  9. use yii\db\ActiveRecord;
  10. /**
  11. *
  12. * Class Product
  13. * @package app\plugins\product_traceability\models
  14. * @property integer $id
  15. * @property integer $store_id
  16. * @property string $product_name
  17. * @property string $is_show
  18. * @property integer $is_delete
  19. * @property string $created_at
  20. * @property string $updated_at
  21. */
  22. class Product extends ActiveRecord
  23. {
  24. public function behaviors()
  25. {
  26. return [
  27. [
  28. // 自动更新创建和更新时间
  29. 'class' => TimestampBehavior::class,
  30. 'value' => time()
  31. ]
  32. ];
  33. }
  34. public static function tableName()
  35. {
  36. return '{{%product}}';
  37. }
  38. public function rules()
  39. {
  40. return [
  41. [['store_id', 'product_name',], 'required'],
  42. [['store_id', 'created_at', 'updated_at', 'is_delete', 'is_show'], 'integer'],
  43. [['product_name'], 'string', 'max' => 255],
  44. ];
  45. }
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'ID',
  50. 'store_id' => '商城id',
  51. 'product_name' => '产品名称',
  52. 'created_at' => '创建时间',
  53. 'updated_at' => '更新时间',
  54. 'is_delete' => 'Is Delete',
  55. 'is_show' => '是否使用 0-禁止 1-使用',
  56. ];
  57. }
  58. }