65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
class Comment extends MY_Controller
|
|
{
|
|
var $db_smartone;
|
|
public function index()
|
|
{
|
|
echo "API";
|
|
}
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
public function save()
|
|
{
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
$note = $prm["T_OrderHeaderVerificationNote"];
|
|
$id = $prm["T_OrderHeaderID"];
|
|
|
|
$userid = $this->sys_user["M_UserID"];
|
|
|
|
$sql = "update t_orderheader
|
|
set T_OrderHeaderVerificationNote = ? ,
|
|
T_OrderHeaderVerificationNoteM_UserID = ?
|
|
where T_OrderHeaderID = ?";
|
|
$query = $this->db_smartone->query($sql, array($note,$userid, $id) );
|
|
if (! $query) {
|
|
$this->sys_error_db("", $this->db_smartone);
|
|
exit;
|
|
}
|
|
|
|
$result = array("status" => "OK" );
|
|
$this->sys_ok($result);
|
|
}
|
|
public function req()
|
|
{
|
|
if (! $this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
$id = $prm["T_OrderHeaderID"];
|
|
|
|
|
|
$sql = "select Nat_PositionName, group_concat(Nat_RequirementName) Requirement
|
|
from t_orderreq
|
|
join nat_position on T_OrderReqNat_PositionID = Nat_PositionID
|
|
join nat_requirement on json_contains(T_OrderReqs, Nat_RequirementID )
|
|
where T_OrderReqT_OrderHeaderID = ?
|
|
group by Nat_PositionName";
|
|
$query = $this->db_smartone->query($sql, array($id) );
|
|
if (! $query) {
|
|
$this->sys_error_db("", $this->db_smartone);
|
|
exit;
|
|
}
|
|
$rows = $query->result_array();
|
|
$result = array("status" => "OK", "data" => $rows );
|
|
$this->sys_ok($result);
|
|
}
|
|
}
|