| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace addons\BlindBox\common\models;
- use common\models\base\BaseActiveRecord;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_blind_box_notice".
- *
- * @property int $id
- * @property int $mall_id 商城id
- * @property int $user_id 会员id
- * @property string $content 内容
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at
- * @property int $updated_at
- */
- class BlindBoxNotice extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_blind_box_notice}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['id'], 'required'],
- [['id', 'mall_id', 'user_id', 'status', 'created_at', 'updated_at'], 'integer'],
- [['content'], 'string', 'max' => 1000],
- [['id'], 'unique'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城id',
- 'user_id' => '会员id',
- 'content' => '内容',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public static function setData($insert)
- {
- try {
- $field = ['mall_id', 'user_id', 'content', 'status', 'created_at', 'updated_at'];
- // 批量插入数据
- Yii::$app->db->createCommand()->batchInsert(self::tableName(), $field, $insert)->execute();
- return true;
- } catch (\Exception $e) {
- self::$static_error = $e->getMessage();
- return false;
- }
- }
- }
|