forked from mahdahar/crm-summit
46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Controllers;
|
||
|
|
|
||
|
|
use CodeIgniter\API\ResponseTrait;
|
||
|
|
use CodeIgniter\Controller;
|
||
|
|
|
||
|
|
class Lqms extends BaseController {
|
||
|
|
use ResponseTrait;
|
||
|
|
|
||
|
|
public function index() {
|
||
|
|
$db = \Config\Database::connect();
|
||
|
|
$sql = "SELECT * FROM lqms_log LimiT 0,30";
|
||
|
|
$query = $db->query($sql);
|
||
|
|
$results = $query->getResultArray();
|
||
|
|
$data['logs'] = $results;
|
||
|
|
return view('lqms_index', $data);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function postData() {
|
||
|
|
$db = \Config\Database::connect();
|
||
|
|
$post = $this->request->getJSON();
|
||
|
|
$sql = "insert into lqms_log(message) values(".$db->escape(json_encode($post)).")";
|
||
|
|
$query = $db->query($sql);
|
||
|
|
$data['post'] = $post;
|
||
|
|
echo "$sql";
|
||
|
|
//return $this->respond($data);
|
||
|
|
/*
|
||
|
|
echo "<pre>";
|
||
|
|
print_r(json_encode($post));
|
||
|
|
echo "</pre>";
|
||
|
|
*/
|
||
|
|
}
|
||
|
|
|
||
|
|
public function log_clear() {
|
||
|
|
$db = \Config\Database::connect();
|
||
|
|
$sql = "DELETE FROM lqms_log";
|
||
|
|
$query = $db->query($sql);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function log_delete($mesid=null) {
|
||
|
|
$db = \Config\Database::connect();
|
||
|
|
$sql = "DELETE FROM lqms_log where mesid=$mesid";
|
||
|
|
$query = $db->query($sql);
|
||
|
|
}
|
||
|
|
}
|