|
|
|
@ -47,8 +47,8 @@ class infofix extends CI_Controller
|
|
|
|
|
// 链接
|
|
|
|
|
$sub_url = mb_stripos($info->ic_url, $key) !== false ? $info->ic_url : '';
|
|
|
|
|
if ($sub_url) {
|
|
|
|
|
$sub_url = str_replace($key,'@@@'.$key.'@@@',$sub_url);
|
|
|
|
|
$sub_url = explode('@@@',$sub_url);
|
|
|
|
|
$sub_url = str_replace($key, '@@@' . $key . '@@@', $sub_url);
|
|
|
|
|
$sub_url = explode('@@@', $sub_url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$limitStr = 100;
|
|
|
|
@ -58,8 +58,8 @@ class infofix extends CI_Controller
|
|
|
|
|
$sub_content = array();
|
|
|
|
|
while ($pos_content) {
|
|
|
|
|
$_str = '[...' . mb_substr($info->ic_content, $pos_content - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
|
|
|
|
|
$_str = str_replace($key,'@@@'.$key.'@@@',$_str);
|
|
|
|
|
$_str = explode('@@@',$_str);
|
|
|
|
|
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
|
|
|
|
|
$_str = explode('@@@', $_str);
|
|
|
|
|
array_push($sub_content, $_str);
|
|
|
|
|
$pos_content = mb_stripos($info->ic_content, $key, $pos_content + mb_strlen($key));
|
|
|
|
|
}
|
|
|
|
@ -72,8 +72,8 @@ class infofix extends CI_Controller
|
|
|
|
|
$pos_content2 = mb_stripos($info->amp_json, $key);
|
|
|
|
|
while ($pos_content2) {
|
|
|
|
|
$_str = '[...' . mb_substr($info->amp_json, $pos_content2 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
|
|
|
|
|
$_str = str_replace($key,'@@@'.$key.'@@@',$_str);
|
|
|
|
|
$_str = explode('@@@',$_str);
|
|
|
|
|
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
|
|
|
|
|
$_str = explode('@@@', $_str);
|
|
|
|
|
array_push($sub_content2, $_str);
|
|
|
|
|
$pos_content2 = mb_stripos($info->amp_json, $key, $pos_content2 + mb_strlen($key));
|
|
|
|
|
}
|
|
|
|
@ -86,8 +86,8 @@ class infofix extends CI_Controller
|
|
|
|
|
$pos_content3 = mb_stripos($info->amp_body, $key);
|
|
|
|
|
while ($pos_content3) {
|
|
|
|
|
$_str = '[...' . mb_substr($info->amp_body, $pos_content3 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
|
|
|
|
|
$_str = str_replace($key,'@@@'.$key.'@@@',$_str);
|
|
|
|
|
$_str = explode('@@@',$_str);
|
|
|
|
|
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
|
|
|
|
|
$_str = explode('@@@', $_str);
|
|
|
|
|
array_push($sub_content3, $_str);
|
|
|
|
|
$pos_content3 = mb_stripos($info->amp_body, $key, $pos_content3 + mb_strlen($key));
|
|
|
|
|
}
|
|
|
|
@ -186,5 +186,39 @@ class infofix extends CI_Controller
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 无条件获取内容
|
|
|
|
|
* @param mixed $ic_id
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
function get_by_icid($ic_id)
|
|
|
|
|
{
|
|
|
|
|
$ic = $this->infoContents_model->get_ic_contents2($ic_id);
|
|
|
|
|
$json = $this->infoMetas_model->get($ic_id, 'AMP_JSON');
|
|
|
|
|
if ($ic) {
|
|
|
|
|
echo json_encode(
|
|
|
|
|
array(
|
|
|
|
|
'state' => 0,
|
|
|
|
|
'ic_content' => $ic->ic_content,
|
|
|
|
|
'json' => $json
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
echo json_encode(
|
|
|
|
|
array(
|
|
|
|
|
'state' => -1,
|
|
|
|
|
'msg' => 'not content by ' . $ic_id
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function update_by_icid()
|
|
|
|
|
{
|
|
|
|
|
$ic_id = $this->input->get_post('ic_id');
|
|
|
|
|
$ic_content = $this->input->get_post('ic_content');
|
|
|
|
|
$this->infoContents_model->force_update($ic_id, $ic_content);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//end of infofix
|