mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-21 06:50:18 +00:00
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\upgrade\v143;
|
|
|
|
use app\model\diy\Diy;
|
|
|
|
class Upgrade
|
|
{
|
|
|
|
public function handle()
|
|
{
|
|
$this->handleDiyData();
|
|
}
|
|
|
|
/**
|
|
* 处理自定义数据
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
private function handleDiyData()
|
|
{
|
|
$diy_model = new Diy();
|
|
$where = [
|
|
[ 'value', '<>', '' ]
|
|
];
|
|
$field = 'id,name,title,template,value';
|
|
$list = $diy_model->where($where)->field($field)->select()->toArray();
|
|
|
|
if (!empty($list)) {
|
|
foreach ($list as $k => $v) {
|
|
$diy_data = json_decode($v[ 'value' ], true);
|
|
|
|
foreach ($diy_data[ 'value' ] as $ck => $cv) {
|
|
|
|
// 图片广告 组件
|
|
if ($cv[ 'componentName' ] == 'ImageAds') {
|
|
|
|
if (!isset($diy_data[ 'value' ][ $ck ][ 'isSameScreen' ])) {
|
|
$diy_data[ 'value' ][ $ck ][ 'isSameScreen' ] = false;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$diy_data = json_encode($diy_data);
|
|
$diy_model->where([ [ 'id', '=', $v[ 'id' ] ] ])->update([ 'value' => $diy_data ]);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|