3f0bdd98 by sayhoChun

md5 encription added, AS search added, autologin added

1 parent 7f3eccc7
......@@ -222,16 +222,13 @@ if(! class_exists("ApiBase") ) {
{
$param = Array(
$loginParams["userNumber"],
$loginParams["deviceID"],
$loginParams["deviceTypeID"],
$loginParams["storeTypeID"],
$loginParams["registrationKey"],
$loginParams["appVersion"],
$loginparams["appType"]
$loginParams[0],
$loginParams[1],
$loginParams[2],
$loginParams[3],
$loginParams[4]
) ;
$ret = Array(
"po_returnCode" => "@po_returnCode",
"po_returnMsg" => "@po_returnMsg"
......@@ -242,6 +239,7 @@ if(! class_exists("ApiBase") ) {
$result = $this->getMultiArray($sql) ;
//echo $loginParams[5];
if($result[0][0]["po_returnCode"] == "-1")
{
......@@ -253,7 +251,14 @@ if(! class_exists("ApiBase") ) {
{
$loginInfo["isLogin"] = $result[0][0]["po_returnCode"];
$loginInfo["loginMessage"] = $result[0][0]["po_returnMsg"];
$loginInfo["loginInfo"] = $this->inFn_ApiBase_getInfoOfUser($loginParams["userNumber"]);
$loginInfo["loginInfo"] = $this->inFn_ApiBase_getInfoOfUser($loginParams[0]);
if($loginParams[5]!=$loginInfo["loginInfo"]["userPwd"]){
$loginInfo["loginInfo"]="";
$loginInfo["isLogin"]="-1000";
$loginInfo["loginMessage"]="비밀번호를 확인하세요";
return $loginInfo;
}
LoginUtil::doAppLogin($loginInfo["loginInfo"]);
}
......@@ -289,7 +294,7 @@ if(! class_exists("ApiBase") ) {
}
else
{
unset($userInfo["userPwd"]) ;
//unset($userInfo["userPwd"]) ;
}
return $userInfo;
......@@ -309,8 +314,7 @@ if(! class_exists("ApiBase") ) {
{
$appVersion = $versionParams["appVersion"]; // APP 버전
$appTypeID = $versionParams["deviceTypeID"]; // APP 타입
$storeTypeID = $versionParams["storeTypeID"]; // store 타입
$appType = $versionParams["appType"]; // 1:동네 2:직장
$appVersionInt = (int)str_replace(".", "", $appVersion);
$isMustUpdate = "0";
......@@ -318,15 +322,15 @@ if(! class_exists("ApiBase") ) {
$sql = "
SELECT COUNT(*) AS isUpdate
FROM tblAppVersion
WHERE appTypeID = '{$appTypeID}' AND storeTypeID = '{$storeTypeID}' AND versionInt > {$appVersionInt};
WHERE appTypeID = '{$appTypeID}' AND versionInt > {$appVersionInt};
SELECT COUNT(*) AS isMustUpdate
FROM tblAppVersion
WHERE appTypeID = '{$appTypeID}' AND storeTypeID = '{$storeTypeID}' AND versionInt > {$appVersionInt} AND isMustUpdate > 0;
WHERE appTypeID = '{$appTypeID}' versionInt > {$appVersionInt} AND isMustUpdate > 0;
SELECT version
FROM tblAppVersion
WHERE appTypeID = '{$appTypeID}' AND storeTypeID = '{$storeTypeID}'
WHERE appTypeID = '{$appTypeID}'
ORDER BY versionInt DESC
LIMIT 0, 1;
";
......
......@@ -432,17 +432,17 @@ if (! class_exists("ApiBoard"))
//AS엄체 리스트
function getListOfCompany(){
$provinceNumber=$this->req["provinceNumber"];
$cityNumber=$this->req["cityNumber"];
$productNumber=$this->req["productNumber"];
$searchText=$this->req["searchText"];
$where="WHERE status=1";
if(!empty($provinceNumber)){
$where.=" AND address LIKE (SELECT abbreviation FROM tblZipProvince WHERE provinceNumber='{$provinceNumber}')";
$where.=" AND provinceCode='{$provinceNumber}'";
}
if(!empty($cityNumber)){
$where.=" AND address LIKE (SELECT abbreviation FROM tblZipCity WHERE provinceNumber='{$provinceNumber}')";
if(!empty($productNumber)){
$where.=" AND productCode='{$productNumber}'";
}
if(!empty($searchText)){
$where.=" AND name LIKE '%{$searchText}%'";
......@@ -662,6 +662,12 @@ if (! class_exists("ApiBoard"))
$balance=$this->req["balance"];
$specialAddition=$this->req["specialAddition"];
if(empty($requestDate) || empty($customerName) || empty($companyName) || empty($productName) || empty($telephone) || empty($userFk) || empty($balance) || empty($type) || empty($alCoil) || empty($floor) || empty($tent) || empty($sideBoard)
|| empty($windStopper) || empty($freezer) || empty($gateType) || empty($gateSize) || empty($load) || empty($frontBack) || empty($eTrackGate) || empty($eTrackWing) || empty($toolBucket) || empty($bumperFootHold) || empty($wingProtector)
|| empty($axis)){
return $this->makeResultJson("-1", "저장오류");
}
$sql="
INSERT INTO tblProductionSpec(
userFk,
......@@ -803,8 +809,8 @@ if (! class_exists("ApiBoard"))
if(!empty($dateLatter)){
$where .= " AND DATE_FORMAT(requestDate, '%Y%m%d') <= DATE_FORMAT('{$dateLatter}', '%Y%m%d')";
}
if(!empty($managerFk)){
$where .= " AND userFk'{$userFk}'";
if(!empty($userFk)){
$where .= " AND userFk='{$userFk}'";
}
$sql="
......@@ -834,32 +840,23 @@ if (! class_exists("ApiBoard"))
//제작사양서 상세정보
function getInfoOfProductionSpec(){
$userNo=$this->appUser["userNo"];
$productionNo=$this->req["productionNo"];
$productionNo=3;
$sql="
SELECT PS.*, U.userNo, U.userName
SELECT PS.*, U.userNo, U.userName, IFNULL((SELECT userNo FROM tblLike WHERE userNo='{$userNo}' AND productionNo='{$productionNo}'), 0) AS likeStatus
FROM tblProductionSpec PS
JOIN tblUser U ON PS.userFk=U.userNo
WHERE productionNo='{$productionNo}'
";
$info=$this->getRow($sql);
if($userNo == $info["userNo"])
$info["balance"] = null;
return $this->makeResultJson("1", "", $info);
}
//담당자 리스트
function getListOfManager(){
$sql="
SELECT userNo, userName
FROM tblUser
WHERE userType=2 AND STATUS=1
ORDER BY userName ASC;
";
$list=$this->getArray($sql);
if(sizeof($list)>0)
return $this->makeResultJson("1", "", $list);
else
return $this->makeResultJson("-1000", "내역이 없습니다");
}
//좋아요
function productionLike(){
......
......@@ -138,19 +138,17 @@ if (! class_exists("ApiStatic")){
return $this->makeResultJson("1", "", $result);
}
//시 리스트
function getListOfCity(){
$provinceNumber=$this->req["provinceNumber"];
function getListOfCompanyProductType(){
$sql="
SELECT `cityNumber`, `desc`, `abbreviation`
FROM tblZipCity
ORDER BY cityNumber ASC
SELECT *
FROM tblCompanyProductType
ORDER BY productNumber ASC
";
$result=$this->getArray($sql);
return $this->makeResultJson("1", "", $result);
}
function getListOfEmergency(){
$sql="
SELECT *
......@@ -161,6 +159,20 @@ if (! class_exists("ApiStatic")){
return $this->makeResultJson("1", "", $result);
}
function getListOfManager(){
$sql="
SELECT userNo, userName
FROM tblUser
WHERE userType=2 AND status=1
ORDER BY userName ASC;
";
$list=$this->getArray($sql);
if(sizeof($list)>0)
return $this->makeResultJson("1", "", $list);
else
return $this->makeResultJson("-1000", "내역이 없습니다");
}
}
}
......
......@@ -58,8 +58,6 @@ if (! class_exists("ApiUser"))
return $this->makeResultJson(-100, "사용할 수 없는 아이디 입니다");
else
return $this->makeResultJson(1, "사용할 수 있는 아이디 입니다");
}
function checkNickRedundancy(){
......@@ -83,8 +81,8 @@ if (! class_exists("ApiUser"))
function memberJoin()
{
$userID = $this->req["userID"];
$userPwd = $this->req["userPwd"];
$userPwdConfirm=$this->req["userPwdConfirm"];
$userPwd = md5($this->req["userPwd"]);
$userPwdConfirm=md5($this->req["userPwdConfirm"]);
$userName = $this->req["userName"];
$nickName = $this->req["nickName"];
$userTel = str_replace(" ", "", $this->req["userTel"]);
......@@ -109,26 +107,29 @@ if (! class_exists("ApiUser"))
";
$regInfo = $this->getRow($sql);
if(strlen($userID)<6)
return $this->makeResultJson(-106, "아이디는 여섯 자리 이상이어야 합니다.");
if($regInfo != null)
return $this->makeResultJson(-100, "아이디 중복을 확인해 주세요");
return $this->makeResultJson(-100, "아이디 중복을 확인해 주세요.");
$sql="SELECT * FROM tblUser WHERE nickName='{$nickName} AND status=1'";
$regInfo=$this->getRow($sql);
if($regInfo != null)
return $this->makeResultJson(-101, "닉네임 중복을 확인해 주세요");
return $this->makeResultJson(-101, "닉네임 중복을 확인해 주세요.");
if(strlen($userID)<6)
return $this->makeResultJson(-102, "아이디는 여섯자리 이상이어야 합니다");
return $this->makeResultJson(-102, "아이디는 여섯자리 이상이어야 합니다.");
if(strlen($userPwd) != strlen($this->removeSpecials($userPwd))) {
return $this->makeResultJson(-103, "비밀번호에는 특수문자가 포함될 수 없습니다.");
}
else if(strlen($userPwd) < 4)
return $this->makeResultJson(-104, "비밀번호는 네 자리 이상이어야 합니다");
return $this->makeResultJson(-104, "비밀번호는 네 자리 이상이어야 합니다.");
if($userPwd != $userPwdConfirm)
return $this->makeResultJson(-105, "비밀번호가 일치하지 않습니다");
return $this->makeResultJson(-105, "비밀번호가 일치하지 않습니다.");
/*
if($userTel == "")
return $this->makeResultJson(-105, "전화번호는 필수 입력사항입니다.");
......@@ -204,6 +205,7 @@ if (! class_exists("ApiUser"))
function userLogin()
{
$userID = $this->req["userID"];
$userPwd= md5($this->req["userPwd"]);
$deviceID = $this->req["deviceID"];
$deviceTypeID = $this->req["deviceTypeID"];
$registrationKey = $this->req["registrationKey"];
......@@ -224,6 +226,11 @@ if (! class_exists("ApiUser"))
if ($result[0][0]["v_returnCode"] > 0)
{
$userInfo = $this->inFn_ApiBase_getInfoOfUser($result[0][0]["v_userNumber"]);
//echo $userPwd;
//echo $userInfo["userID"];
if($userInfo["userPwd"] != $userPwd)
return $this->makeResultJson("-1000", "비밀번호를 확인하세요");
LoginUtil::doAppLogin($userInfo);
return $this->makeResultJson($result[0][0]["v_returnCode"], $result[0][0]["v_returnMsg"], $userInfo);
......@@ -234,6 +241,30 @@ if (! class_exists("ApiUser"))
}
}
function userAutoLogin(){
$userNumber=$this->req["userNumber"];
$userID = $this->req["userID"];
$deviceID = $this->req["deviceID"];
$deviceTypeID = $this->req["deviceTypeID"];
$registrationKey = $this->req["registrationKey"];
$appVersion = $this->req["appVersion"];
$userPwd=md5($this->req["userPwd"]);
$param = Array(
$userNumber,
$deviceID,
$deviceTypeID,
$registrationKey,
$appVersion,
$userPwd
);
$result=$this->inFn_ApiBase_autoLogin($param);
return $this->makeResultJson($result["isLogin"], $result["loginMessage"], $result["loginInfo"]);
}
// 비동기 푸시키 갱신 API
function setUserRegistrationKey()
{
......@@ -291,7 +322,6 @@ if (! class_exists("ApiUser"))
$userPwd = $this->req["userPwd"];
$userPwdConfirm = $this->req["userPwdConfirm"];
$userName = $this->req["userName"];
$nickName = $this->req["nickName"];
$userTel = str_replace(" ", "", $this->req["userTel"]);
$userVehicleTON=$this->req["userVehicleTON"];
......@@ -339,7 +369,6 @@ if (! class_exists("ApiUser"))
UPDATE tbl_user
SET
userPwd='{$userPwd}',
userName='{$userName}',
nickName='{$nickName}',
userTel='{$userTel}',
userVehicleTON='{$userVehicleTON}',
......
......@@ -143,7 +143,8 @@ $(document).ready(function(){
async : false,
cache : false,
data:{
"userID" : "fishcreek",
"userID" : "fishcreek1",
"userPwd": "alclsekf1",
"deviceID" : "device",
"deviceTypeID" : 2,
"registrationKey" : "regKeyregKeyregKeyregKeyregKeyregKeyregKeyregKeyregKey",
......@@ -158,6 +159,30 @@ $(document).ready(function(){
});
}) ;
$(".autoLogin").click2(function(){
$.ajax({
type: 'post',
url : "/action_front.php?cmd=ApiUser.userAutoLogin",
async : false,
cache : false,
data:{
"userNumber" : 11,
"userID" : "fishcreek1",
"userPwd": "alclsekf1",
"deviceID" : "device",
"deviceTypeID" : 2,
"registrationKey" : "autologinKeyautologinKeyautologinKeyautologinKeyautologinKeyautologinKeyautologinKey",
"appVersion" : "v1.0"
},
success : function(data){
alert(data.returnmessage);
},
error : function(req, res, error){
alert(req+res+error);
}
});
}) ;
$(".memberJoin").click2(function(){
$.ajax({
type: 'post',
......@@ -165,10 +190,11 @@ $(document).ready(function(){
async : false,
cache : false,
data:{
"userID" : "ellivga",
"userPwd" : "device",
"userID" : "fishcreek1",
"userPwd" : "alclsekf1",
"userPwdConfirm" : "alclsekf1",
"userName" : "세호",
"nickName" : "device",
"nickName" : "fishcreek1",
"userTel" : "01026264848",
"userVehicleTON" : 21,
"userVehicleName" : "내장탑차",
......@@ -304,6 +330,7 @@ $(document).ready(function(){
<span class="button bigrounded blue saveProductionSpec btnleft_y">제작사양서 저장 </span>
<span class="button bigrounded blue memberJoin btnleft_y">회원가입 </span>
<span class="button bigrounded blue login btnleft_y">로그인 </span>
<span class="button bigrounded blue autoLogin btnleft_y">자동 로그인 </span>
</form>
<div class="data">
<table class="datacList" id="datacList">
......