| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\plugins\adopt\models;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- /**
- * Class Goods
- * @package app\modules\common\models
- * @property integer $id
- * @property integer $store_id
- * @property integer $goods_id
- * @property integer $growth_cycle
- * @property string $desc
- * @property string $yield
- * @property string $varieties
- * @property string $adopt_income
- * @property string $self_pick_date
- * @property string $self_pick_times
- * @property integer $is_delete
- * @property string $created_at
- * @property string $updated_at
- */
- class AdoptGoods extends ActiveRecord
- {
- public static function tableName()
- {
- return '{{%adopt_goods}}';
- }
- public function behaviors()
- {
- return [
- [
- // 自动更新创建和更新时间
- 'class' => TimestampBehavior::class,
- 'value' => time()
- ]
- ];
- }
- public function rules()
- {
- return [
- [['store_id', 'goods_id',], 'required', 'on' => self::whenSave()],
- [['store_id', 'goods_id', 'is_delete', 'created_at', 'updated_at', 'growth_cycle' ], 'integer', 'on' => self::whenSave()],
- [['desc', 'yield', 'varieties', ], 'string', 'max' => 255, 'on' => self::whenSave()],
- [['adopt_income', 'self_pick_date', 'self_pick_times'], 'string', 'on' => self::whenSave()],
- [['goods_id', 'store_id'], 'integer', 'on' => self::whenList()],
- ];
- }
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'goods_id' => '商品id',
- 'desc' => '认养简介',
- 'yield' => '认养产量',
- 'varieties' => '认养品种',
- 'growth_cycle' => '生长周期',
- 'adopt_income' => '认养收获',
- 'self_pick_date' => '自采日期',
- 'self_pick_times' => '自采时间',
- 'is_delete' => 'Is Delete',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- public static function whenSave ()
- {
- return 'save';
- }
- public static function whenList ()
- {
- return 'list';
- }
- }
|