a704acc3 by sayhoChun

api test complete

1 parent 05145a47
......@@ -64,7 +64,8 @@ if (! class_exists("ApiBoard"))
//자유게시판 게시물 작성
function saveBoard(){
$title=$this->req["title"];
$userFk = $this->appUser["no"];
//$userFk = $this->appUser["no"];
$userFk=$this->req["userFk"];
$imgPathBoard1=$this->req["imgPathBoard1"];
$imgPathBoard2=$this->req["imgPathBoard2"];
$imgPathBoard3=$this->req["imgPathBoard3"];
......@@ -74,7 +75,7 @@ if (! class_exists("ApiBoard"))
INSERT INTO tblBoard(userFk, title, imgPathBoard1, imgPathBoard2, imgPathBoard3, content, status, regDate)
VALUES
(
'{$userFk}',,
'{$userFk}',
'{$title}',
'{$imgPathBoard1}',
'{$imgPathBoard2}',
......@@ -153,7 +154,7 @@ if (! class_exists("ApiBoard"))
FROM tblComment C
JOIN tblUser U ON C.userFk=U.userNo
WHERE targetFk='{$boardNo}' AND commentType='FB'
ORDER BY C.commentGroup ASC, C.gOrder ASC
ORDER BY C.commentGroup DESC, C.gOrder ASC
";
$commentList=$this->getArray($sql);
......@@ -169,7 +170,8 @@ if (! class_exists("ApiBoard"))
//고객센터 게시물 저장
function saveCS(){
$title=$this->req["title"];
$userFk = $this->appUser["no"];
//$userFk = $this->appUser["no"];
$userFk=$this->req["userFk"];
$targetType=$this->req["targetType"];
$imgPathCS1=$this->req["imgPathCS1"];
$imgPathCS2=$this->req["imgPathCS2"];
......@@ -201,7 +203,7 @@ if (! class_exists("ApiBoard"))
$searchText=$this->req["searchText"];
$searchType=$this->req["searchType"];
$where="status=1 AND targetType = 1";
$where="CS.status=1 AND targetType = 1";
if(!empty($searchText)){
if(empty($search_type)){
......@@ -219,8 +221,8 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT COUNT(*)
FROM tblCustomerService CS
JOIN tblUser U ON CS.userFk=U.no
WHERE status=1
JOIN tblUser U ON CS.userFk=U.userNo
WHERE CS.status=1
ORDER BY csNo DESC
";
$this->rownum = $this->getValue($sql, "rn");
......@@ -228,9 +230,9 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT CS.*, U.userID, U.userNo
FORM tblCustomerService CS
JOIN tblUser U ON CS.userFk=U.no
WHERE status=1
FROM tblCustomerService CS
JOIN tblUser U ON CS.userFk=U.userNo
WHERE CS.status=1
ORDER BY csNo DESC
LIMIT {$this->startNum}, {$this->endNum}
";
......@@ -244,7 +246,8 @@ if (! class_exists("ApiBoard"))
//고객센터 게시물 내용
function getInfoOfCS(){
$csNo=$this->req["no"];
//$csNo=$this->req["no"];
$csNo=2;
$sql="
SELECT *
FROM tblCustomerService
......@@ -259,7 +262,7 @@ if (! class_exists("ApiBoard"))
FROM tblComment C
JOIN tblUser U ON C.userFk=U.userNo
WHERE targetFk='{$csNo}' AND commentType='CS'
ORDER BY C.commentGroup ASC, C.gOrder ASC
ORDER BY C.commentGroup DESC, C.gOrder ASC
";
$commentList=$this->getArray($sql);
......@@ -280,12 +283,19 @@ if (! class_exists("ApiBoard"))
$cityNumber=$this->req["cityNumber"];
$searchText=$this->req["searchText"];
$where="status=1";
$where="WHERE status=1";
if(!empty($provinceNumber)){
$where.=" AND address LIKE (SELECT abbreviation FROM tblZipProvince WHERE provinceNumber='{$provinceNumber}')";
}
if(!empty($cityNumber)){
$where.=" AND address LIKE (SELECT abbreviation FROM tblZipCity WHERE provinceNumber='{$provinceNumber}')";
}
if(!empty($searchText)){
$where.=" AND name LIKE '%{$searchText}%'";
}
$sql="
SELECT COUNT(*)
FROM tblCompany
......@@ -312,7 +322,8 @@ if (! class_exists("ApiBoard"))
//AS업체 상세
function getInfoOfCompany(){
$companyNo=$this->req["no"];
//$companyNo=$this->req["no"];
$companyNo=1;
$sql="
SELECT *
......@@ -328,7 +339,7 @@ if (! class_exists("ApiBoard"))
FROM tblComment C
JOIN tblUser U ON C.userFk=U.userNo
WHERE targetFk='{$companyNo}' AND commentType='CP'
ORDER BY C.ommentGroup ASC, C.gOrder ASC
ORDER BY C.commentGroup DESC, C.gOrder ASC
";
$commentList=$this->getArray($sql);
......@@ -350,8 +361,6 @@ if (! class_exists("ApiBoard"))
$content=$this->req["content"];
$parentNo=$this->req["parentNo"]; //부모 댓글의 기본키
if(empty($parentNo)){ //부모가 없을 때
$sql="
INSERT INTO tblComment(userFk, targetFk, commentGroup, gOrder, depth, content, commentType, status, regDate)
......@@ -380,115 +389,56 @@ if (! class_exists("ApiBoard"))
return $this->makeResultJson("1", "저장되었습니다");
}
else{ //부모 있을 때
else{ //부모 있을 때
$sql="
SELECT *
FROM tblComment
WHERE commentType='{$commentType}'
AND commentGroup=(SELECT commentGroup FROM tblComment WHERE commentType='{$commentType}' AND commentNo='{$parentNo}' AND status=1)
AND gOrder=(SELECT gOrder+1 FROM tblComment WHERE commentType='{$commentType}' AND commentNo='{$parentNo}' AND status=1)
AND depth=(SELECT depth+1 FROM tblComment WHERE commentType='{$commentType}' AND commentNo='{$parentNo}' AND status=1)
ORDER BY gOrder DESC
LIMIT 0, 1
SELECT gOrder, commentGroup, depth
FROM tblComment
WHERE commentNo='{$parentNo}'
";
$child=$this->getRow($sql);
$childNo=$child["commentNo"];
$childGroup=$child["commentGroup"];
$childOrder=$child["gOrder"];
$childDepth=$child["depth"];
$parent=$this->getRow($sql);
$parentGOrder=$parent["gOrder"];
$parentCommentGroup=$parent["commentGroup"];
$parentDepth=$parent["depth"];
$sql="
UPDATE tblComment
SET gOrder=gOrder+1
WHERE commentGroup='{$parentCommentGroup}' AND gOrder>'{$parentGOrder}'
";
$this->update($sql);
if(!empty($childNo)){ //부모에게 자식이 있을 때
$sql="
INSERT INTO tblComment(userFk, targetFk, commentGroup, gOrder, depth, content, commentType, status, regDate)
VALUES
(
$sql="
INSERT INTO tblComment(userFk, targetFk, commentGroup, gOrder, depth, content, commentType, status, regDate)
VALUES
(
'{$userFk}',
'{$targetFk}',
'{$childGroup}',
'{$childOrder}' + 1,
'{$childDepth}',
'{$parentCommentGroup}',
'{$parentGOrder}' + 1,
'{$parentDepth}' + 1,
'{$content}',
'{$commentType}',
1,
NOW()
)
";
$this->update($sql);
$currentNo=$this->mysql_insert_id();
$sql="
UPDATE tblComment
SET gOrder=gOrder+1
WHERE commentGroup='{$childGroup}' AND gOrder >= '{$childOrder}' + 1 AND commentNo <> '{$currentNo}' AND status=1
";
$this->update($sql);
$sql="
SELECT COUNT(*) AS count
FROM tblComment
WHERE commentGroup='{$childGroup}' AND gOrder='{$childOrder}'+1;
";
$count=$this->getValue($sql, "count");
if($count != 1){
$sql="
UPDATE tblComment
SET gOrder=gOrder+1
WHERE commentNo='{$currentNo}'
";
$this->update($sql);
}
return $this->makeResultJson("1", "저장되었습니다");
}
else{ //부모에게 자식이 없을 때
$sql="
INSERT INTO tblComment(userFk, targetFk, commentGroup, gOrder, depth, content, commentType, status, regDate)
VALUES
(
'{$userFk}',
'{$targetFk}',
(SELECT commentGroup FROM (SELECT * FROM tblComment) AS tblComment WHERE commentNo='{$parentNo}' AND status=1),
(SELECT gOrder + 1 FROM (SELECT * FROM tblComment) AS tblComment WHERE commentNo='{$parentNo}' AND status=1),
(SELECT depth + 1 FROM (SELECT * FROM tblComment) AS tblComment WHERE commentNo='{$parentNo}' AND status=1),
'{$content}',
'{$commentType}',
1,
NOW()
)
";
$this->update($sql);
$currentNo=$this->mysql_insert_id();
$sql="SELECT commentGroup FROM tblComment WHERE commentNo='{$parentNo}' AND status=1";
$commentGroup=$this->getValue($sql, "commentGroup");
$sql="SELECT gOrder + 1 FROM tblComment WHERE commentNo='{$parentNo}' AND status=1";
$gOrder=$this->getValue($sql, "gOrder + 1");
$sql="
UPDATE tblComment
SET gOrder=gOrder+1
WHERE commentGroup='{$commentGroup}' AND gOrder >= '{$gOrder}' AND commentNo <> '{$currentNo}' AND status=1
";
$this->update($sql);
return $this->makeResultJson("1", "저장되었습니다");
}
";
$this->update($sql);
return $this->makeResultJson("1", "저장되었습니다");
}
}
//제작사양서 저장
function saveProductionSpec(){
$userFk = $this->appUser["no"];
//$userFk = $this->appUser["no"];
$userFk = $this->req["userFk"];
$requestDate=$this->req["requestDate"];
$companyName=$this->req["companyName"];
$vehicleTON=$this->req["vehicleTON"];
$vehicleText=$this->req["vehicleText"];
$vehicleType=$this->req["vehicleType"];
$productName=$thie->req["productName"];
$productName=$this->req["productName"];
$telephone=$this->req["telephone"];
$managerFk=$this->req["managerFk"];
$type=$this->req["type"];
......@@ -515,8 +465,8 @@ if (! class_exists("ApiBoard"))
$specialAddition=$this->req["specialAddition"];
$sql="
INSERT INTO tblProductionSpec(userFk, requestDate, companyName, vehicleTON, vehicleText, vehicleType, productName, telephone, managerFk, type, internalLength, internalHeight, internalWidth, alCoil,
floor, floorValue, tent, sideBoard, windStopper, freezer, gate, load, eTrackGate, eTrackWing, turnBuckle, toolBucket, bumperFootHold, wingProtector, axis, axisValue, specialAddition)
INSERT INTO tblProductionSpec(userFk, requestDate, companyName, vehicleTON, vehicleText, vehicleType, productName, telephone, managerFk, `type`, internalLength, internalHeight, internalWidth, alCoil,
`floor`, floorValue, tent, sideBoard, windStopper, freezer, gate, `load`, eTrackGate, eTrackWing, turnBuckle, toolBucket, bumperFootHold, wingProtector, axis, axisValue, specialAddition, status, regDate)
VALUES
(
'{$userFk}',
......@@ -560,7 +510,8 @@ if (! class_exists("ApiBoard"))
//내 제작사양서
function getListOfMyProductionSpec(){
$userFk=$this->appUser["no"];
//$userFk=$this->appUser["no"];
$userFk=1;
$sql="
SELECT productionNo, companyName, requestDate
FROM tblProductionSpec
......@@ -580,8 +531,8 @@ if (! class_exists("ApiBoard"))
$dateFormer=$this->req["dateFormer"];
$dateLatter=$this->req["dateLatter"];
$managerFk=$this->req["managerFk"];
$where="status=1";
$where="WHERE status=1";
if(!empty($dateFormer)){
$where .= " AND DATE_FORMAT(requestDate, '%Y%m%d') >= DATE_FORMAT('{$dateFormer}', '%Y%m%d')";
}
......@@ -594,7 +545,7 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT productionNo, companyName, requestDate
FROM tblProduntionSpec
FROM tblProductionSpec
{$where}
ORDER BY productionNo DESC
";
......@@ -609,6 +560,7 @@ if (! class_exists("ApiBoard"))
//제작사양서 상세정보
function getInfoOfProductionSpec(){
$productionNo=$this->req["productionNo"];
$productionNo=3;
$sql="
SELECT *
FROM tblProductionSpec
......@@ -627,7 +579,10 @@ if (! class_exists("ApiBoard"))
ORDER BY name ASC
";
$list=$this->getArray($sql);
return $this->makeResultJson("1", "", $list);
if(sizeof($list)>0)
return $this->makeResultJson("1", "", $list);
else
return $this->makeResultJson("-1000", "내역이 없습니다");
}
//좋아요
......@@ -658,7 +613,7 @@ if (! class_exists("ApiBoard"))
$userNo=$this->appUser["no"];
$sql="
SELECT productionNo, companyName, requestDate
SELECT PS.productionNo, companyName, requestDate
FROM tblProductionSpec PS
JOIN tblLike L ON PS.productionNo=L.productionNo
WHERE L.userNo='{$userNo}'
......
......@@ -89,7 +89,7 @@ if (! class_exists("ApiStatic")){
//탑차 분류별 리스트
function getListOfVehicle(){
$vehicleType=$this->req["vehicleType"];
$vehicleType="IS";
$sql="
SELECT vehicleNo, name, imgPathVehicle
FROM tblVehicle
......@@ -103,13 +103,14 @@ if (! class_exists("ApiStatic")){
//탑차 정보
function getInfoOfVehicle(){
$vehicleNo=$this->req["vehicleNo"];
$vehicleNo=1;
echo $vehicleNo;
$sql="
SELECT *
FROM tblVehicle
WHERE vehicleNo='{$vehicleNo}'
";
$reusult=$this->getRow($sql);
$result=$this->getRow($sql);
return $this->makeResultJson("1", "", $result);
}
......
......@@ -10,6 +10,16 @@
$event = $obj2->getListOfEvent();
$board = $obj2->getListOfBoard();
$comment= $obj2->getInfoOfBoard();
$CS = $obj2->getListOfCS();
$CSInfo = $obj2->getInfoOfCS();
$AS = $obj2->getListOfCompany();
$ASInfo = $obj2->getInfoOfCompany();
$myProductionSpec=$obj2->getListOfMyProductionSpec();
$productionSpec=$obj2->getListOfProductionSpec();
$productionSpecInfo=$obj2->getInfoOfProductionSpec();
$vehicleList=$obj->getListOfVehicle();
$vehicleInfo=$obj->getInfoOfVehicle();
//$vnum = $obj->virtualNum ;
?>
......@@ -58,11 +68,105 @@ $(document).ready(function(){
async : false,
cache : false,
data:{
"commentType" : "FB",
"targetFk" : 1,
"commentType" : "CS",
"targetFk" : 2,
"userFk" : 1,
"content" : "세 번째 부모"
"content" : "test 대댓글2",
"parentNo" : 62
},
success : function(data){
alert(data.returnmessage);
},
error : function(req, res, error){
alert(req+res+error);
}
});
}) ;
$(".saveBoard").click2(function(){
$.ajax({
type: 'post',
url : "/action_front.php?cmd=ApiBoard.saveBoard",
async : false,
cache : false,
data:{
"title" : "제목제목제목",
"userFk" : 1,
"imgPathBoard1" : "경로1",
"imgPathBoard2" : "경로2",
"imgPathBoard3" : "경로3",
"content" : "내용내용내용"
},
success : function(data){
alert(data.returnmessage);
},
error : function(req, res, error){
alert(req+res+error);
}
});
}) ;
$(".saveCS").click2(function(){
$.ajax({
type: 'post',
url : "/action_front.php?cmd=ApiBoard.saveCS",
async : false,
cache : false,
data:{
"title" : "제목제목제목",
"userFk" : 1,
"imgPathBoard1" : "경로1",
"imgPathBoard2" : "경로2",
"imgPathBoard3" : "경로3",
"content" : "내용내용내용"
},
success : function(data){
alert(data.returnmessage);
},
error : function(req, res, error){
alert(req+res+error);
}
});
}) ;
$(".saveProductionSpec").click2(function(){
$.ajax({
type: 'post',
url : "/action_front.php?cmd=ApiBoard.saveProductionSpec",
async : false,
cache : false,
data:{
"userFk" : 1,
"requestDate" : "2017-10-18",
"companyName" : "리치",
"vehicleTON" : "123123",
"vehicleText" : "vehicleText",
"vehicleType" : "HY",
"productName" : "wtf",
"telephone" : "01001011",
"managerFk" : "1",
"type" : "R",
"internalLength" : 108,
"internalHeight" : 120,
"internalWidth" : 32,
"alCoil" : "G",
"floor" : "C",
"floorValue" : 22,
"tent" : 0,
"sideBoard" : 1,
"windStopper" : 1,
"freezer" : 0,
"gate" : 2,
"load" : "S",
"eTrackGate" : 0,
"eTrackWing" : 1,
"turnBuckle" : "rkskek",
"toolBucket" : 2,
"bumberFootHold" : 1,
"wingProtector" : 2,
"axis" : 1,
"axisValue" : "302",
"specialAddition" : "special"
},
success : function(data){
alert(data.returnmessage);
......@@ -124,6 +228,9 @@ $(document).ready(function(){
<div id="Contents" class="notice" style="width:1000px;" >
<form name=test1 method=POST>
<span class="button bigrounded blue saveComment btnleft_y">댓글 저장 </span>
<span class="button bigrounded blue saveBoard btnleft_y">게시물 저장 </span>
<span class="button bigrounded blue saveCS btnleft_y">고객센터 게시물 저장 </span>
<span class="button bigrounded blue saveProductionSpec btnleft_y">제작사양서 저장 </span>
</form>
<div class="data">
<table class="datacList" id="datacList">
......@@ -157,6 +264,43 @@ $(document).ready(function(){
<td class="center">Comment</td>
<td class=""><?echo $comment;?></td>
</tr>
<tr>
<td class="center">CS</td>
<td class=""><?echo $CS;?></td>
</tr>
<tr>
<td class="center">CSInfo</td>
<td class=""><?echo $CSInfo;?></td>
</tr>
<tr>
<td class="center">AS</td>
<td class=""><?echo $AS;?></td>
</tr>
<tr>
<td class="center">ASInfo</td>
<td class=""><?echo $ASInfo;?></td>
</tr>
<tr>
<td class="center">MyProductionSpec</td>
<td class=""><?echo $myProductionSpec;?></td>
</tr>
<tr>
<td class="center">ProductionSpecList</td>
<td class=""><?echo $productionSpec;?></td>
</tr>
<tr>
<td class="center">ProductionSpecInfo</td>
<td class=""><?echo $productionSpecInfo;?></td>
</tr>
<tr>
<td class="center">vehicleList</td>
<td class=""><?echo $vehicleList;?></td>
</tr>
<tr>
<td class="center">vehicleInfo</td>
<td class=""><?echo $vehicleInfo;?></td>
</tr>
</table>
</div>
<br>
......