https://github.com/chriskacerguis/codeigniter-restserver 참조하여 나머지 API 서버를 개발 중 입니다. Mongo와 Mysql을 사용하여 API 응답을 저장하고 있습니다. 내 컨트롤러는 웹훅 엔드 포인트 응답을 저장합니다. Mongo에 데이터를 저장할 수 있지만 MYSQL이 작동하지 않습니다. 조언 부탁드립니다.
내 컨트롤러-Hooks.php
public function opened_post() {
// $_POST = $this->request->body;
//Get the message id
if(!$mid = $this->input->post('message-id')) $this->response(array("status" => true));
//Parse message ID
$mid = explode("@", $mid, 2)[0];
//Update the record
$this->mail_store->mid($mid)->data(array('opened' => true))->update();
$this->load->model('message_store');
$this->messages_store->add();
$this->response(array("status" => "success"));
}
내 모델-Message_store.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Message_store extends CI_Model {
public function __construct() {
// Call the Model constructor
parent::__construct();
}
/**
* Store message into queue
*/
public function add($event, $data, $token) {
{
$store = array('event' => 'HOOK', 'data' => 'Grap', 'token' => 'ABC12345');
$this->db->insert($store->hooks, $store);
}
//Clear
$this->clear_();
}
}
?>
Restserver에 Mongo와 MYSQL 모두에 웹 후크를 저장하도록 요청하는 별도의 PHP 파일을 개발했습니다.
문제 해결됨
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다