TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at' ] ] ]; } /** * {@inheritdoc} */ public function rules() { return [ [['store_id', 'goods_id'], 'required'], [['store_id', 'goods_id', 'goods_count', 'sales', 'integral', 'status', 'user_num', 'sort', 'is_delete', 'created_at'], 'integer'], [['attr', 'name', 'detail'], 'string'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'store_id' => 'Store ID', 'goods_id' => '商品id', 'goods_count' => '商品数量', 'name' => '商品名称', 'detail' => '商品详情', 'integral' => '所需积分', 'status' => '状态', 'user_num' => '每个人限制兑换数量', 'attr' => '详细规格', 'sales' => '商品虚拟销量', 'sort' => '排序', 'is_delete' => '是否删除', 'created_at' => '添加时间', 'updated_at' => '更新时间' ]; } public static function getGoods($goods_id) { return Goods::findOne($goods_id); } }