master
LMR 10 months ago
parent 56dd146567
commit b2fd56e4f0

@ -220,7 +220,7 @@ class infofix extends CI_Controller
}
/**
* 无条件更新信息内容
* 无条件更新信息内容(上线前内容)
*/
function update_by_icid()
{
@ -239,5 +239,42 @@ class infofix extends CI_Controller
echo json_encode($rs);
}
/**
* 转化旧版构建工具数据(上线前的准备)
* @param mixed $ic_id
*/
function migrate_hb($ic_id, $dev = 'prod')
{
// 本地测试参数
$api = 'https://hmk.arachina.com/beta/3733/server_render2';
if ($dev == 'dev') {
$api = 'http://127.0.0.1:3733/server_render2';
}
// 请求api
$json = $this->infoMetas_model->get($ic_id, 'AMP_JSON');
if (!empty($json)) {
// 请求转化服务器
$post_data = 'json=' . urlencode($json);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$curl_rs = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($curl_rs && ($httpCode == 200 || $httpCode == 201)) {
// 强制更新信息内容
$this->infoContents_model->force_update($ic_id, $curl_rs);
echo $curl_rs;
} else {
echo $ic_id + ' @ ' + $post_data;
}
}
}
}
//end of infofix
Loading…
Cancel
Save