Merge branch 'master' of git.mycht.cn:developers/information-system

hotfix/远程访问多媒体中心
cyc 8 years ago
commit 011657491d

@ -7,6 +7,7 @@ staging:
production:
script:
- curl -sSf http://cht.mycht.cn/please_dont_delete_this_file_4a4f500ae61d9e44b931d9f72fb14aaf95517b7e.php?branch=master
- curl -sSf https://www.arachina.com/pull-from-origin-by-icht.php?branch=info
only:
- master
- /^deploy-.*$/

@ -0,0 +1,100 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Info_amp extends CI_Controller
{
function __construct()
{
parent::__construct();
//$this->permission->is_admin();
$this->load->model('InfoMetas_model');
//CORS TEST
header('Access-Control-Allow-Origin:*');
}
public function save_amp()
{
$icid = $this->input->post('icid');
$json = $this->input->post('json');
$html = $this->input->post('html');
$css = $this->input->post('css');
$status = $this->input->post('status');
if ($icid && $json && $html) {
try {
//html
$meta = $this->InfoMetas_model->get($icid, 'AMP_BODY');
if ($meta === false) {
$this->InfoMetas_model->add($icid, 'AMP_BODY', $html);
} else {
$this->InfoMetas_model->update($icid, 'AMP_BODY', $html);
}
//json
$meta = $this->InfoMetas_model->get($icid, 'AMP_JSON');
if ($meta === false) {
$this->InfoMetas_model->add($icid, 'AMP_JSON', $json);
} else {
$this->InfoMetas_model->update($icid, 'AMP_JSON', $json);
}
//css
$meta = $this->InfoMetas_model->get($icid, 'AMP_CSS');
if ($meta === false) {
$this->InfoMetas_model->add($icid, 'AMP_CSS', $css);
} else {
$this->InfoMetas_model->update($icid, 'AMP_CSS', $css);
}
//status
$meta = $this->InfoMetas_model->get($icid, 'AMP_STATUS');
if ($meta === false) {
$this->InfoMetas_model->add($icid, 'AMP_STATUS', $status);
} else {
$this->InfoMetas_model->update($icid, 'AMP_STATUS', $status);
}
echo json_encode(array(
"succ" => true
));
} catch(Exception $e) {
echo json_encode(array(
"succ" => false,
"message" => "save_amp() -> ".$e->getMessage()
));
}
} else {
echo json_encode(array(
"succ" => false,
"message" => "save_amp() -> Post para error."
));
}
}
public function load_amp()
{
$icid = $this->input->post('icid');
if (!$icid) {
echo json_encode(array(
"succ" => false,
"message" => "load_amp() -> Post para error."
));
return false;
}
$json = $this->InfoMetas_model->get($icid, 'AMP_JSON');
$status = $this->InfoMetas_model->get($icid, 'AMP_STATUS');
if ($json) {
echo json_encode(array(
"succ" => true,
"icid" => $icid,
"json" => $json,
"status" => $status
));
} else {
echo json_encode(array(
"succ" => false,
"message" => "load_amp() -> No data error."
));
}
}
}

@ -537,6 +537,7 @@
</label>
</div>
<div class="col-xs-17 text-right">
<label title="AMP页面编辑"><a href="http://202.103.68.62:3000/?icid=<?php echo($information->ic_id); ?>" target="_blank">AMP构建工具</a></label> |
<?php if (get_meta($information->ic_id, 'AMP_STATUS') === '1') {?>
<label title="AMP页面编辑"><a href="<?php echo site_url('amp/edit/' . $information->ic_id); ?>" target="_blank"><i class="glyphicon glyphicon-flash"></i></a></label>
<?php } else {?>

Loading…
Cancel
Save