ProductBatch.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 ProductBatch
  13. * @package app\plugins\product_traceability\models
  14. * @property integer $id
  15. * @property integer $store_id
  16. * @property string $batch_number
  17. * @property string $batch_name
  18. * @property integer $state
  19. * @property integer $product_id
  20. * @property integer $goods_id
  21. * @property integer $is_delete
  22. * @property string $created_at
  23. * @property string $updated_at
  24. */
  25. class ProductBatch extends ActiveRecord
  26. {
  27. public function behaviors()
  28. {
  29. return [
  30. [
  31. // 自动更新创建和更新时间
  32. 'class' => TimestampBehavior::class,
  33. 'value' => time()
  34. ]
  35. ];
  36. }
  37. public static function tableName()
  38. {
  39. return '{{%product_batch}}';
  40. }
  41. public function rules()
  42. {
  43. return [
  44. [['store_id', 'batch_number', 'batch_name'], 'required'],
  45. [['store_id', 'created_at', 'updated_at', 'is_delete', 'state', 'product_id', 'goods_id'], 'integer'],
  46. [['batch_number', 'batch_name'], 'string', 'max' => 255],
  47. ];
  48. }
  49. public function attributeLabels()
  50. {
  51. return [
  52. 'id' => 'ID',
  53. 'store_id' => '商城id',
  54. 'batch_number' => '批次编号',
  55. 'batch_name' => '批次名称',
  56. 'created_at' => '创建时间',
  57. 'updated_at' => '更新时间',
  58. 'is_delete' => 'Is Delete',
  59. 'state' => '是否绑定 0-未绑定 1-已绑定',
  60. 'product_id' => '产品id',
  61. 'goods_id' => '商品id',
  62. ];
  63. }
  64. }