diff --git a/application/controllers/infofix.php b/application/controllers/infofix.php index 016ed03d..3286f291 100644 --- a/application/controllers/infofix.php +++ b/application/controllers/infofix.php @@ -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)); } @@ -183,7 +183,27 @@ class infofix extends CI_Controller } echo json_encode($keyArr); - + + } + + 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 + ) + ); + } } }