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; } } }