add get_by_icid

master
LMR 11 months ago
parent 042c54cb3d
commit 25dc172813

@ -47,8 +47,8 @@ class infofix extends CI_Controller
// 链接 // 链接
$sub_url = mb_stripos($info->ic_url, $key) !== false ? $info->ic_url : ''; $sub_url = mb_stripos($info->ic_url, $key) !== false ? $info->ic_url : '';
if ($sub_url) { if ($sub_url) {
$sub_url = str_replace($key,'@@@'.$key.'@@@',$sub_url); $sub_url = str_replace($key, '@@@' . $key . '@@@', $sub_url);
$sub_url = explode('@@@',$sub_url); $sub_url = explode('@@@', $sub_url);
} }
$limitStr = 100; $limitStr = 100;
@ -58,8 +58,8 @@ class infofix extends CI_Controller
$sub_content = array(); $sub_content = array();
while ($pos_content) { while ($pos_content) {
$_str = '[...' . mb_substr($info->ic_content, $pos_content - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]'; $_str = '[...' . mb_substr($info->ic_content, $pos_content - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key,'@@@'.$key.'@@@',$_str); $_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@',$_str); $_str = explode('@@@', $_str);
array_push($sub_content, $_str); array_push($sub_content, $_str);
$pos_content = mb_stripos($info->ic_content, $key, $pos_content + mb_strlen($key)); $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); $pos_content2 = mb_stripos($info->amp_json, $key);
while ($pos_content2) { while ($pos_content2) {
$_str = '[...' . mb_substr($info->amp_json, $pos_content2 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]'; $_str = '[...' . mb_substr($info->amp_json, $pos_content2 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key,'@@@'.$key.'@@@',$_str); $_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@',$_str); $_str = explode('@@@', $_str);
array_push($sub_content2, $_str); array_push($sub_content2, $_str);
$pos_content2 = mb_stripos($info->amp_json, $key, $pos_content2 + mb_strlen($key)); $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); $pos_content3 = mb_stripos($info->amp_body, $key);
while ($pos_content3) { while ($pos_content3) {
$_str = '[...' . mb_substr($info->amp_body, $pos_content3 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]'; $_str = '[...' . mb_substr($info->amp_body, $pos_content3 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key,'@@@'.$key.'@@@',$_str); $_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@',$_str); $_str = explode('@@@', $_str);
array_push($sub_content3, $_str); array_push($sub_content3, $_str);
$pos_content3 = mb_stripos($info->amp_body, $key, $pos_content3 + mb_strlen($key)); $pos_content3 = mb_stripos($info->amp_body, $key, $pos_content3 + mb_strlen($key));
} }
@ -186,5 +186,25 @@ class infofix extends CI_Controller
} }
function get_by_icid($ic_id)
{
$ic = $this->infoContents_model->get_ic_contents2($ic_id);
if ($ic) {
echo json_encode(
array(
'state' => 0,
'data' => $ic
)
);
} else {
echo json_encode(
array(
'state' => -1,
'msg' => 'not content by ' . $ic_id
)
);
}
}
} }
//end of infofix //end of infofix
Loading…
Cancel
Save