| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\plugins\integral\models;
- use app\models\Goods;
- use Yii;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%saas_integral_goods}}".
- *
- * @property int $id
- * @property int $store_id
- * @property int $goods_id
- * @property int $cat_id
- * @property int $goods_count
- * @property int $detail
- * @property string $name
- * @property int $integral
- * @property int $status
- * @property int $user_num
- * @property string $attr
- * @property int $sales
- * @property int $sort
- * @property int $is_delete
- * @property int|null $created_at 添加时间
- * @property int|null $updated_at 更新时间
- */
- class SaasIntegralGoods extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%saas_integral_goods}}';
- }
- // 已删除
- const IS_DELETE_YES = 1;
- // 未删除
- const IS_DELETE_NO = 0;
- public function behaviors()
- {
- return [
- [
- 'class' => 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);
- }
- }
|