mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-29 05:41:37 +08:00
修复视频清晰度配置序列化问题
This commit is contained in:
parent
74f34752e5
commit
6b2b3891c6
@ -162,7 +162,8 @@ class Setting extends Service
|
||||
public function updateVodSettings($section, $settings)
|
||||
{
|
||||
if (isset($settings['video_quality'])) {
|
||||
$settings['video_quality'] = kg_json_encode($settings['video_quality']);
|
||||
$data = array_values($settings['video_quality']);
|
||||
$settings['video_quality'] = kg_json_encode($data);
|
||||
}
|
||||
|
||||
$this->updateSettings($section, $settings);
|
||||
|
40
db/migrations/20210903040558.php
Normal file
40
db/migrations/20210903040558.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||
* @license https://opensource.org/licenses/GPL-2.0
|
||||
* @link https://www.koogua.com
|
||||
*/
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class V20210903040558 extends AbstractMigration
|
||||
{
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->handleVodSetting();
|
||||
}
|
||||
|
||||
protected function handleVodSetting()
|
||||
{
|
||||
$row = $this->getQueryBuilder()
|
||||
->select('*')
|
||||
->from('kg_setting')
|
||||
->where(['section' => 'vod', 'item_key' => 'video_quality'])
|
||||
->execute()->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
/**
|
||||
* 数组索引不连续造成对象序列化后的数据不合乎要求
|
||||
*/
|
||||
$itemValue = json_decode($row['item_value'], true);
|
||||
$itemValue = array_values($itemValue);
|
||||
$itemValue = json_encode($itemValue);
|
||||
|
||||
$this->getQueryBuilder()
|
||||
->update('kg_setting')
|
||||
->set('item_value', $itemValue)
|
||||
->where(['id' => $row['id']])
|
||||
->execute();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user