|
|
|
@ -29,7 +29,7 @@ class Info_amp extends CI_Controller
|
|
|
|
|
$pc_html = $this->input->get_post('pc_html');
|
|
|
|
|
$pc_css = $this->input->get_post('pc_css');
|
|
|
|
|
$css = $this->input->get_post('css');
|
|
|
|
|
$schema = $this->input->get_post('schema');
|
|
|
|
|
$schema = $this->input->get_post('schema');
|
|
|
|
|
$script = $this->input->get_post('script');
|
|
|
|
|
$status = $this->input->get_post('status');
|
|
|
|
|
|
|
|
|
@ -86,7 +86,7 @@ class Info_amp extends CI_Controller
|
|
|
|
|
} else {
|
|
|
|
|
$this->InfoMetas_model->update($icid, 'AMP_SCRIPT', $script);
|
|
|
|
|
}
|
|
|
|
|
//schema
|
|
|
|
|
//schema
|
|
|
|
|
$meta = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
|
|
|
|
|
if ($meta === FALSE) {
|
|
|
|
|
$this->InfoMetas_model->add($icid, 'AMP_SCHEMA', $schema);
|
|
|
|
@ -103,10 +103,10 @@ class Info_amp extends CI_Controller
|
|
|
|
|
echo json_encode(array(
|
|
|
|
|
"succ" => true
|
|
|
|
|
));
|
|
|
|
|
} catch(Exception $e) {
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
echo json_encode(array(
|
|
|
|
|
"succ" => false,
|
|
|
|
|
"message" => "save_amp() -> ".$e->getMessage()
|
|
|
|
|
"message" => "save_amp() -> " . $e->getMessage()
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -162,17 +162,17 @@ class Info_amp extends CI_Controller
|
|
|
|
|
$site = '';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$json = $this->InfoMetas_model->get($icid, 'AMP_JSON');
|
|
|
|
|
$status = $this->InfoMetas_model->get($icid, 'AMP_STATUS');
|
|
|
|
|
$schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
|
|
|
|
|
$schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
|
|
|
|
|
if ($json) {
|
|
|
|
|
echo json_encode(array(
|
|
|
|
|
"succ" => true,
|
|
|
|
|
"icid" => $icid,
|
|
|
|
|
"icurl" => $site.$ic->ic_url,
|
|
|
|
|
"icurl" => $site . $ic->ic_url,
|
|
|
|
|
"json" => $json,
|
|
|
|
|
"schema" => $schema,
|
|
|
|
|
"schema" => $schema,
|
|
|
|
|
"status" => $status
|
|
|
|
|
));
|
|
|
|
|
} else {
|
|
|
|
@ -275,14 +275,14 @@ class Info_amp extends CI_Controller
|
|
|
|
|
if ($show_photo_meta == 'no') {
|
|
|
|
|
$use_photo = '';
|
|
|
|
|
} else {
|
|
|
|
|
$use_photo = $this->config->item('site_image_url').$info->ic_photo;
|
|
|
|
|
$use_photo = $this->config->item('site_image_url') . $info->ic_photo;
|
|
|
|
|
}
|
|
|
|
|
if ($info->ic_type === 'c_attraction' || $info->ic_template === 'city_info_attractions_list' || $info->ic_template === 'r_tpl_empty_navi1p') {
|
|
|
|
|
$list_info = true;
|
|
|
|
|
} else {
|
|
|
|
|
$list_info = false;
|
|
|
|
|
}
|
|
|
|
|
if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/')===false) {
|
|
|
|
|
if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/') === false) {
|
|
|
|
|
array_push($newrs, array(
|
|
|
|
|
'is_path' => $info->is_path,
|
|
|
|
|
'ic_url' => $info->ic_url,
|
|
|
|
@ -312,12 +312,12 @@ class Info_amp extends CI_Controller
|
|
|
|
|
if ($show_photo_meta == 'no') {
|
|
|
|
|
$use_photo = '';
|
|
|
|
|
} else {
|
|
|
|
|
$use_photo = $this->config->item('site_image_url').$ic->ic_photo;
|
|
|
|
|
$use_photo = $this->config->item('site_image_url') . $ic->ic_photo;
|
|
|
|
|
}
|
|
|
|
|
echo json_encode(array(
|
|
|
|
|
"succ" => true,
|
|
|
|
|
"info" => $ic->ic_content ? $ic->ic_content : "<p>".$ic->ic_seo_description."</p>",
|
|
|
|
|
"title" => $ic->ic_title,
|
|
|
|
|
"info" => $ic->ic_content ? $ic->ic_content : "<p>" . $ic->ic_seo_description . "</p>",
|
|
|
|
|
"title" => $ic->ic_title,
|
|
|
|
|
"photo" => $use_photo,
|
|
|
|
|
"url" => $ic->ic_url,
|
|
|
|
|
"site" => $this->config->item('site_url')
|
|
|
|
@ -336,12 +336,13 @@ class Info_amp extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function handel_png_source() {
|
|
|
|
|
public function handel_png_source()
|
|
|
|
|
{
|
|
|
|
|
//ini_set('memory_limit', '50M');
|
|
|
|
|
$png_base64 = $this->input->post('png_base64');
|
|
|
|
|
//$png_base64 = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
|
|
|
|
|
$file = md5($png_base64).'.jpg';
|
|
|
|
|
$path = realpath('../cht-system/views/information/word_img').'/'.$file;
|
|
|
|
|
$file = md5($png_base64) . '.jpg';
|
|
|
|
|
$path = realpath('../cht-system/views/information/word_img') . '/' . $file;
|
|
|
|
|
$png_base64 = str_replace('data:image/png;base64,', '', $png_base64);
|
|
|
|
|
$png_base64 = str_replace('data:image/jpg;base64,', '', $png_base64);
|
|
|
|
|
$png_base64 = base64_decode($png_base64);
|
|
|
|
@ -351,25 +352,26 @@ class Info_amp extends CI_Controller
|
|
|
|
|
//释放内存
|
|
|
|
|
imagedestroy($im);
|
|
|
|
|
$size = getimagesize($path);
|
|
|
|
|
if($png_base64 && $size) {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
if ($png_base64 && $size) {
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'success',
|
|
|
|
|
'path' => '/information-view/information/word_img/'.$file,
|
|
|
|
|
'path' => '/information-view/information/word_img/' . $file,
|
|
|
|
|
'width' => $size[0],
|
|
|
|
|
'height' => $size[1]
|
|
|
|
|
)));
|
|
|
|
|
} else {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error'
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function handel_image_source() {
|
|
|
|
|
public function handel_image_source()
|
|
|
|
|
{
|
|
|
|
|
@ini_set('memory_limit', '256M');
|
|
|
|
|
$file = $_FILES['file'];
|
|
|
|
|
if (!$file) {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'msg' => "图片上传失败。"
|
|
|
|
|
)));
|
|
|
|
@ -378,20 +380,20 @@ class Info_amp extends CI_Controller
|
|
|
|
|
$usr = $this->input->post('usr');
|
|
|
|
|
$icid = $this->input->post('icid');
|
|
|
|
|
//转移文件
|
|
|
|
|
$md5_file = md5($usr.$icid.$file['name']);
|
|
|
|
|
$md5_file = md5($usr . $icid . $file['name']);
|
|
|
|
|
//ext
|
|
|
|
|
$ext = mb_strtolower(strrchr($file["name"],'.'));
|
|
|
|
|
$ext = mb_strtolower(strrchr($file["name"], '.'));
|
|
|
|
|
if ($ext != '.jpg') {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'msg' => '只能接收(.jpg)图片。',
|
|
|
|
|
'filename' => $file["name"]
|
|
|
|
|
)));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$md5_name = $md5_file.$ext;
|
|
|
|
|
$md5_name = $md5_file . $ext;
|
|
|
|
|
//临时docx文件
|
|
|
|
|
$image_path = realpath('../cht-system/views/information/word_img').'/'.basename($md5_name);
|
|
|
|
|
$image_path = realpath('../cht-system/views/information/word_img') . '/' . basename($md5_name);
|
|
|
|
|
$html = 'to use mammoth';
|
|
|
|
|
if (move_uploaded_file($file['tmp_name'], $image_path)) {
|
|
|
|
|
//图片处理
|
|
|
|
@ -399,31 +401,32 @@ class Info_amp extends CI_Controller
|
|
|
|
|
imagejpeg($im, $image_path);
|
|
|
|
|
imagedestroy($im);
|
|
|
|
|
$size = getimagesize($image_path);
|
|
|
|
|
if($size) {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
if ($size) {
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'success',
|
|
|
|
|
'path' => '/information-view/information/word_img/'.$md5_name,
|
|
|
|
|
'path' => '/information-view/information/word_img/' . $md5_name,
|
|
|
|
|
'width' => $size[0],
|
|
|
|
|
'height' => $size[1]
|
|
|
|
|
)));
|
|
|
|
|
} else {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error'
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'msg' => "图片文件解析失败。"
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function handel_word_source() {
|
|
|
|
|
public function handel_word_source()
|
|
|
|
|
{
|
|
|
|
|
@ini_set('memory_limit', '256M');
|
|
|
|
|
$file = $_FILES['file'];
|
|
|
|
|
if (!$file) {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'msg' => "文件上传失败。"
|
|
|
|
|
)));
|
|
|
|
@ -432,27 +435,27 @@ class Info_amp extends CI_Controller
|
|
|
|
|
$usr = $this->input->post('usr');
|
|
|
|
|
$icid = $this->input->post('icid');
|
|
|
|
|
//转移文件
|
|
|
|
|
$md5_file = md5($usr.$icid.$file['name']);
|
|
|
|
|
$md5_file = md5($usr . $icid . $file['name']);
|
|
|
|
|
//ext
|
|
|
|
|
$ext = mb_strtolower(strrchr($file["name"],'.'));
|
|
|
|
|
$ext = mb_strtolower(strrchr($file["name"], '.'));
|
|
|
|
|
if ($ext != '.docx') {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'msg' => '只能接收word(.docx)文档。'
|
|
|
|
|
)));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$md5_name = $md5_file.$ext;
|
|
|
|
|
$md5_name = $md5_file . $ext;
|
|
|
|
|
//临时docx文件
|
|
|
|
|
$docx_path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name);
|
|
|
|
|
$docx_path = realpath('../cht-system/views/information/word_source') . '/' . basename($md5_name);
|
|
|
|
|
$html = 'to use mammoth';
|
|
|
|
|
if (move_uploaded_file($file['tmp_name'], $docx_path)) {
|
|
|
|
|
$docx_dir = realpath('../cht-system/views/information/word_source');
|
|
|
|
|
//图片及html目录
|
|
|
|
|
$img_dir = $docx_dir.'/'.$md5_file;
|
|
|
|
|
$img_dir = $docx_dir . '/' . $md5_file;
|
|
|
|
|
is_dir($img_dir) || mkdir($img_dir, 0777);
|
|
|
|
|
//临时html文件
|
|
|
|
|
$docx_parh = $img_dir.'/'.$md5_name;
|
|
|
|
|
$docx_parh = $img_dir . '/' . $md5_name;
|
|
|
|
|
$html_parh = str_ireplace('.docx', '.html', $docx_parh);
|
|
|
|
|
//运行docx转化插件
|
|
|
|
|
if ($_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '202.103.68.62') {
|
|
|
|
@ -462,16 +465,16 @@ class Info_amp extends CI_Controller
|
|
|
|
|
$yarnbin = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth ';
|
|
|
|
|
$test_host = '';
|
|
|
|
|
}
|
|
|
|
|
$command = $yarnbin.$docx_path.' --output-dir='.$img_dir. ' 2>&1';
|
|
|
|
|
//$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1';
|
|
|
|
|
$command = $yarnbin . $docx_path . ' --output-dir=' . $img_dir . ' 2>&1';
|
|
|
|
|
//$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1';
|
|
|
|
|
exec($command, $rs, $st);
|
|
|
|
|
//图片处理
|
|
|
|
|
$scan_img = scandir($img_dir);
|
|
|
|
|
$tmp = '';
|
|
|
|
|
foreach($scan_img as $f) {
|
|
|
|
|
foreach ($scan_img as $f) {
|
|
|
|
|
$tmp_ext = mb_strtolower(strrchr($f, '.'));
|
|
|
|
|
if ($tmp_ext == '.jpeg') {
|
|
|
|
|
$tmp_img = $img_dir.'/'.$f;
|
|
|
|
|
$tmp_img = $img_dir . '/' . $f;
|
|
|
|
|
$tmp_jpg = str_ireplace('.jpeg', '.jpg', $tmp_img);
|
|
|
|
|
$im = imagecreatefromjpeg($tmp_img);
|
|
|
|
|
imagejpeg($im, $tmp_jpg);
|
|
|
|
@ -485,34 +488,35 @@ class Info_amp extends CI_Controller
|
|
|
|
|
if (file_exists($html_parh)) {
|
|
|
|
|
$html = file_get_contents($html_parh);
|
|
|
|
|
} else {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'html' => $command.' # '.$html_parh,
|
|
|
|
|
'rs' => print_r($rs, true).' # '.$st
|
|
|
|
|
'html' => $command . ' # ' . $html_parh,
|
|
|
|
|
'rs' => print_r($rs, true) . ' # ' . $st
|
|
|
|
|
)));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$html = preg_replace('/src="([\d]+).jpeg"/i', 'src="'.$test_host.'/information-view/information/word_source/'.$md5_file.'/$1.jpg"', $html);
|
|
|
|
|
$html = preg_replace('/src="([\d]+).jpeg"/i', 'src="' . $test_host . '/information-view/information/word_source/' . $md5_file . '/$1.jpg"', $html);
|
|
|
|
|
//删除临时html
|
|
|
|
|
@unlink($html_parh);
|
|
|
|
|
//删除docx文档
|
|
|
|
|
@unlink($docx_path);
|
|
|
|
|
if ($html) {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'success',
|
|
|
|
|
'path' => $docx_path,
|
|
|
|
|
'html' => $html
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
echo(json_encode(array(
|
|
|
|
|
echo (json_encode(array(
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'msg' => "word文件解析失败。"
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function save_history() {
|
|
|
|
|
public function save_history()
|
|
|
|
|
{
|
|
|
|
|
$json = $this->input->get_post('json');
|
|
|
|
|
$icid = $this->input->get_post('icid');
|
|
|
|
|
if ($json && $icid) {
|
|
|
|
@ -529,7 +533,8 @@ class Info_amp extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function list_history() {
|
|
|
|
|
public function list_history()
|
|
|
|
|
{
|
|
|
|
|
$icid = $this->input->get_post('icid');
|
|
|
|
|
if ($icid) {
|
|
|
|
|
echo json_encode(array(
|
|
|
|
@ -544,7 +549,8 @@ class Info_amp extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function pick_history() {
|
|
|
|
|
public function pick_history()
|
|
|
|
|
{
|
|
|
|
|
$log_action_id = $this->input->get_post('log_action_id');
|
|
|
|
|
if ($log_action_id) {
|
|
|
|
|
echo json_encode(array(
|
|
|
|
@ -558,5 +564,4 @@ class Info_amp extends CI_Controller
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|