add force ic_url

master
LMR 1 year ago
parent 76f1d93ce6
commit 9bff796497

@ -12,6 +12,7 @@ class infofix extends CI_Controller
$this->load->model('Information_model'); $this->load->model('Information_model');
$this->load->model('infoContents_model'); $this->load->model('infoContents_model');
$this->load->model('logs_model'); $this->load->model('logs_model');
$this->load->model('infoMetas_model');
$this->site_code = $this->input->get('site_code') ? $this->input->get('site_code') : $this->config->item('site_code'); $this->site_code = $this->input->get('site_code') ? $this->input->get('site_code') : $this->config->item('site_code');
} }
@ -106,7 +107,7 @@ class infofix extends CI_Controller
// json参数 // json参数
$site = $this->input->get_post('site'); $site = $this->input->get_post('site');
$keys = $this->input->get_post('keys'); $keys = $this->input->get_post('keys');
$keyArr = explode('@', $keys); // 250000343@oldurl@newurl@ $keyArr = explode('@', $keys); // 250000343@oldurl@newurl@250000462
sleep(2); sleep(2);
echo ($keys); echo ($keys);
@ -124,11 +125,31 @@ class infofix extends CI_Controller
$newStr = $keyArr[2]; $newStr = $keyArr[2];
$is_id = $keyArr[3]; $is_id = $keyArr[3];
// 先备份 // ic_content
//$this->logs_model->backup() $ic = $this->infoContents_model->get_ic_contents2($ic_id);
//$ic = $this->infoContents_model->get_ic_contents2($ic_id); if ($ic) {
//$ic->info_content = mb_str_replace($oldStr, $newStr, $keyArr); $this->logs_model->backup($is_id, $ic->ic_content); // 备份
$ic->ic_content = mb_str_replace($oldStr, $newStr, $ic->ic_content);
$this->infoContents_model->force_update($ic_id, $ic->ic_content);
$ic->ic_url = mb_str_replace($oldStr, $newStr, $ic->ic_url);
$this->infoContents_model->force_update_url($ic_id, $ic->ic_url);
}
// amp_json
$meta = $this->infoMetas_model->get($ic_id, 'AMP_JSON');
if ($meta) {
$this->logs_model->backup_meta($is_id, $meta->im_value, 'AMP_JSON'); // 备份
$meta->im_value = mb_str_replace($oldStr, $newStr, $meta->im_value);
$this->infoMetas_model->update($is_id, 'AMP_JSON', $meta->im_value);
}
// amp_body_pc
$meta = $this->infoMetas_model->get($ic_id, 'AMP_BODY_PC');
if ($meta) {
$this->logs_model->backup_meta($is_id, $meta->im_value, 'AMP_BODY_PC'); // 备份
$meta->im_value = mb_str_replace($oldStr, $newStr, $meta->im_value);
$this->infoMetas_model->update($is_id, 'AMP_BODY_PC', $meta->im_value);
}
} }
} }

@ -129,7 +129,7 @@ class InfoContents_model extends CI_Model
$ic_author, $ic_author,
$site_code = '' $site_code = ''
) { ) {
if (empty ($site_code)) { if (empty($site_code)) {
$site_code = $this->config->item('site_code'); $site_code = $this->config->item('site_code');
} }
$ic_content = str_replace('http:' . $this->config->item('site_image_url'), $this->config->item('site_image_url'), $ic_content); $ic_content = str_replace('http:' . $this->config->item('site_image_url'), $this->config->item('site_image_url'), $ic_content);
@ -281,7 +281,7 @@ class InfoContents_model extends CI_Model
return $query; return $query;
} }
//删除信息 //强制更新信息
function force_update($ic_id, $ic_content) function force_update($ic_id, $ic_content)
{ {
$sql = "UPDATE infoContents SET ic_content = N? WHERE ic_id = ?"; $sql = "UPDATE infoContents SET ic_content = N? WHERE ic_id = ?";
@ -289,6 +289,14 @@ class InfoContents_model extends CI_Model
return $query; return $query;
} }
//强制更新信息
function force_update_url($ic_id, $ic_url)
{
$sql = "UPDATE infoContents SET ic_url = N? WHERE ic_id = ?";
$query = $this->HT->query($sql, array($ic_url, $ic_id));
return $query;
}
//删除信息 //删除信息
function Delete($ic_id) function Delete($ic_id)
{ {

Loading…
Cancel
Save