Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
weixiuhui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
蒋林
weixiuhui
Commits
705ad4ec
Commit
705ad4ec
authored
Sep 02, 2016
by
蒋林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口密码相关业务调整
parent
dbed7d67
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
190 additions
and
72 deletions
+190
-72
Galanz.php
application/controllers/api/Galanz.php
+47
-33
Rgalanz.php
application/controllers/test/Rgalanz.php
+4
-2
Sgalanz.php
application/controllers/test/Sgalanz.php
+6
-5
base_helper.php
application/helpers/base_helper.php
+22
-0
Aes.php
application/libraries/Aes.php
+82
-0
SourceGalanz.php
application/libraries/Source/SourceGalanz.php
+29
-27
UuApi.php
application/libraries/UuApi.php
+0
-0
galanz_c01000005.gif
public/captcha/galanz_c01000005.gif
+0
-0
galanz_c01000005.cookie
public/cookie/galanz_c01000005.cookie
+0
-5
No files found.
application/controllers/api/Galanz.php
View file @
705ad4ec
...
...
@@ -25,21 +25,6 @@ class Galanz extends BaseController
parent
::
__construct
();
}
//搜索订单
public
function
searchOrder
()
{
$param
=
$this
->
input
->
post
();
//验证参数
$obj
=
$this
->
receiveGalanzObj
();
$obj
->
SetValues
(
$param
);
$obj
->
CheckSearchOrderValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'searchOrder'
,
$param
);
$obj
->
ReturnMessage
(
true
,
''
,
$values
);
}
//查询订单
public
function
queryOrder
()
{
...
...
@@ -53,7 +38,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'queryOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchOrder
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -67,6 +52,17 @@ class Galanz extends BaseController
$obj
->
ReturnMessage
(
false
,
'查询的订单不存在'
);
}
//字段过滤
$fields
=
[
'__VIEWSTATE'
,
// 'new_provinceid',
// 'new_cityid',
// 'new_countyid',
// 'new_townid',
// 'new_sentsiteid'
];
$order
=
$this
->
diff
(
$order
,
$fields
);
$obj
->
ReturnMessage
(
true
,
''
,
$order
);
}
...
...
@@ -83,7 +79,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'work_order_no'
],
'queryWorkOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchWorkOrder
(
$values
[
'work_order_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -112,7 +108,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'up_order_no'
],
'queryUserProfileOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchUserProfieOrder
(
$values
[
'mobile'
],
$values
[
'up_order_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -144,7 +140,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'saveOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchOrder
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -234,7 +230,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'createWorkOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchOrder
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -272,7 +268,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'createUserprofileOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchOrder
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -305,7 +301,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'work_order_no'
],
'saveWorkOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchWorkOrder
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -337,7 +333,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'work_order_no'
],
'sendWorkOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchWorkOrder
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -369,7 +365,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'up_order_no'
],
'saveUserProfileOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchUserProfieOrder
(
$values
[
'mobile'
],
$values
[
'up_order_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -401,7 +397,7 @@ class Galanz extends BaseController
$this
->
saveLog
(
$values
[
'up_order_no'
],
'sendUserProfileOrder'
,
$param
);
//搜索订单
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$obj
);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$values
[
'account'
],
$
values
[
'pwd'
],
$
obj
);
$search
=
$sourceGalanzObj
->
SearchUserProfieOrder
(
$values
[
'mobile'
],
$values
[
'up_order_no'
]);
if
(
empty
(
$search
))
{
...
...
@@ -421,6 +417,11 @@ class Galanz extends BaseController
$obj
->
ReturnMessage
(
true
,
''
,
$result
);
}
private
function
diff
(
$data
,
$keys
)
{
return
array_diff_key
(
$data
,
array_fill_keys
(
$keys
,
''
));
}
private
function
saveLog
(
$search
,
$method
,
$data
)
{
//记录日志
...
...
@@ -434,17 +435,30 @@ class Galanz extends BaseController
return
$this
->
ReceiveGalanz
;
}
private
function
sourceGalanzObj
(
$username
,
$obj
)
private
function
sourceGalanzObj
(
$username
,
$
pwd
,
$
obj
)
{
$this
->
load
->
config
(
'account'
,
true
);
$account
=
$this
->
config
->
item
(
'account'
);
$galanzAccount
=
$account
[
'galanz'
];
if
(
!
array_key_exists
(
$username
,
$galanzAccount
))
{
$obj
->
ReturnMessage
(
false
,
'用户名不存在'
);
// $this->load->config('account', true);
// $account = $this->config->item('account');
// $galanzAccount = $account['galanz'];
//
// if (!array_key_exists($username, $galanzAccount)) {
// $obj->ReturnMessage(false, '用户名不存在');
// }
//$this->load->library('Source/SourceGalanz', $galanzAccount[$username], 'SourceGalanz');
$pwd
=
str_aes
(
$pwd
,
''
,
'de'
);
if
(
!
$pwd
)
{
$obj
->
ReturnMessage
(
false
,
'密码无效'
);
}
$account
=
[
'username'
=>
$username
,
'pwd'
=>
$pwd
];
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$
galanzAccount
[
$username
]
,
'SourceGalanz'
);
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$
account
,
'SourceGalanz'
);
return
$this
->
SourceGalanz
;
}
...
...
application/controllers/test/Rgalanz.php
View file @
705ad4ec
...
...
@@ -16,7 +16,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class
Rgalanz
extends
BaseController
{
protected
static
$apiUrl
=
'http://wxh.pp.cn/'
;
//protected static $apiUrl = 'http://wxh.pp.cn/';
protected
static
$apiUrl
=
'http://testwxh.pp.cc/'
;
public
function
t
()
...
...
@@ -60,6 +61,7 @@ class Rgalanz extends BaseController
$data
[
'appid'
]
=
'10001'
;
$data
[
'out_trade_no'
]
=
'CALL2015100900929'
;
$data
[
'account'
]
=
'c01000005'
;
$data
[
'pwd'
]
=
str_aes
(
'weixiuhui010'
);
$data
[
'nonce_str'
]
=
$obj
->
GetNonceStr
();
$obj
->
SetValues
(
$data
);
...
...
@@ -71,7 +73,7 @@ class Rgalanz extends BaseController
$result
[
'data'
]
=
json_decode
(
$result
[
'data'
],
true
);
$this
->
show
(
$result
[
'data'
]
);
$this
->
show
(
$result
);
}
public
function
queryWorkOrder
()
...
...
application/controllers/test/Sgalanz.php
View file @
705ad4ec
...
...
@@ -77,13 +77,14 @@ class Sgalanz extends BaseController
$this
->
show
(
$list
);
}
private
function
galanzObj
(
$username
=
'c01000005'
)
private
function
galanzObj
()
{
$this
->
load
->
config
(
'account'
,
true
);
$account
=
$this
->
config
->
item
(
'account'
);
$galanzAccount
=
$account
[
'galanz'
];
$account
=
[
'username'
=>
'c01000005'
,
'pwd'
=>
'weixiuhui010'
];
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$
galanzAccount
[
$username
]
,
'SourceGalanz'
);
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$
account
,
'SourceGalanz'
);
return
$this
->
SourceGalanz
;
}
...
...
application/helpers/base_helper.php
View file @
705ad4ec
...
...
@@ -20,6 +20,28 @@ function get_uuapi($imagePath = '')
return
$result
;
}
/**
* 字符串aes加密/解密
* @param $str
* @param string $key
* @param string $type
* @return mixed
*/
function
str_aes
(
$str
,
$key
=
''
,
$type
=
'en'
)
{
$CI
=&
get_instance
();
$CI
->
load
->
library
(
'aes'
,
null
,
'aes'
);
$CI
->
aes
->
setKey
(
$key
);
if
(
$type
==
'en'
)
{
$result
=
$CI
->
aes
->
encrypt
(
$str
);
}
else
{
$result
=
$CI
->
aes
->
decrypt
(
$str
);
}
return
$result
;
}
function
curl_get
(
$url
)
{
$curl
=
curl_init
();
...
...
application/libraries/Aes.php
0 → 100644
View file @
705ad4ec
<?php
/**
* AES128加解密类
* Class Aes
*/
class
Aes
{
//密钥
private
$_secrect_key
;
public
function
setKey
(
$key
=
''
)
{
if
(
!
$key
)
{
$key
=
"lyt9mBmcGo2UAw1P/IKtKA=="
;
}
$key
=
$this
->
addPKCS7Padding
(
$key
);
$this
->
_secrect_key
=
$key
;
}
/**
* 加密方法
* @param string $str
* @return string
*/
public
function
encrypt
(
$str
){
//AES, 128 ECB模式加密数据
$screct_key
=
$this
->
_secrect_key
;
$screct_key
=
base64_decode
(
$screct_key
);
$str
=
trim
(
$str
);
$str
=
$this
->
addPKCS7Padding
(
$str
);
$iv
=
mcrypt_create_iv
(
mcrypt_get_iv_size
(
MCRYPT_RIJNDAEL_128
,
MCRYPT_MODE_ECB
),
MCRYPT_RAND
);
$encrypt_str
=
mcrypt_encrypt
(
MCRYPT_RIJNDAEL_128
,
$screct_key
,
$str
,
MCRYPT_MODE_ECB
,
$iv
);
return
base64_encode
(
$encrypt_str
);
}
/**
* 解密方法
* @param string $str
* @return string
*/
public
function
decrypt
(
$str
){
//AES, 128 ECB模式加密数据
$screct_key
=
$this
->
_secrect_key
;
$str
=
base64_decode
(
$str
);
$screct_key
=
base64_decode
(
$screct_key
);
$iv
=
mcrypt_create_iv
(
mcrypt_get_iv_size
(
MCRYPT_RIJNDAEL_128
,
MCRYPT_MODE_ECB
),
MCRYPT_RAND
);
$encrypt_str
=
mcrypt_decrypt
(
MCRYPT_RIJNDAEL_128
,
$screct_key
,
$str
,
MCRYPT_MODE_ECB
,
$iv
);
$encrypt_str
=
trim
(
$encrypt_str
);
$encrypt_str
=
$this
->
stripPKSC7Padding
(
$encrypt_str
);
return
$encrypt_str
;
}
/**
* 填充算法
* @param string $source
* @return string
*/
function
addPKCS7Padding
(
$source
){
$source
=
trim
(
$source
);
$block
=
mcrypt_get_block_size
(
'rijndael-128'
,
'ecb'
);
$pad
=
$block
-
(
strlen
(
$source
)
%
$block
);
if
(
$pad
<=
$block
)
{
$char
=
chr
(
$pad
);
$source
.=
str_repeat
(
$char
,
$pad
);
}
return
$source
;
}
/**
* 移去填充算法
* @param string $source
* @return string
*/
function
stripPKSC7Padding
(
$source
){
$source
=
trim
(
$source
);
$char
=
substr
(
$source
,
-
1
);
$num
=
ord
(
$char
);
if
(
$num
==
62
)
return
$source
;
$source
=
substr
(
$source
,
0
,
-
$num
);
return
$source
;
}
}
\ No newline at end of file
application/libraries/Source/SourceGalanz.php
View file @
705ad4ec
...
...
@@ -16,21 +16,25 @@ class SourceGalanz extends Source
public
function
__construct
(
$account
)
{
//默认账号
$CI
=&
get_instance
();
$CI
->
load
->
config
(
'account'
,
true
);
$accountConfig
=
$CI
->
config
->
item
(
'account'
);
$galanzAccount
=
$accountConfig
[
'galanz'
];
if
(
!
array_key_exists
(
$account
[
'username'
],
$galanzAccount
))
{
die
(
"galanz系统账号(
{
$account
[
'username'
]
}
)不存在"
);
}
//
$CI =& get_instance();
//
$CI->load->config('account', true);
//
$accountConfig = $CI->config->item('account');
//
$galanzAccount = $accountConfig['galanz'];
//
//
if (!array_key_exists($account['username'], $galanzAccount)) {
//
die("galanz系统账号({$account['username']})不存在");
//
}
self
::
$account
=
$account
;
self
::
$cookieFilePath
=
PUBDIR
.
"cookie/galanz_"
.
self
::
$account
[
'username'
]
.
".cookie"
;
self
::
$captchaFilePath
=
PUBDIR
.
"captcha/galanz_"
.
self
::
$account
[
'username'
]
.
".gif"
;
$this
->
IsLogin
();
//判断是否登陆
$result
=
$this
->
IsLogin
();
if
(
$result
==
false
)
{
echo
json_encode
([
'return_code'
=>
'FAIL'
,
'return_msg'
=>
'登陆失败'
],
JSON_UNESCAPED_UNICODE
);
die
();
}
}
/**
...
...
@@ -276,7 +280,6 @@ class SourceGalanz extends Source
$order
[
'new_id'
]
=
$id
;
$order
[
'new_username'
]
=
self
::
$account
[
'username'
];
$order
[
'new_category'
]
=
self
::
$account
[
'category'
];
foreach
(
$orderField
as
$kk
=>
$vv
)
{
$order
[
$kk
]
=
$this
->
OrderFormValue
(
$result
,
$vv
[
'reg'
],
$vv
[
'type'
]);
...
...
@@ -294,7 +297,6 @@ class SourceGalanz extends Source
$order
[
'new_id'
]
=
$id
;
$order
[
'new_username'
]
=
self
::
$account
[
'username'
];
$order
[
'new_category'
]
=
self
::
$account
[
'category'
];
foreach
(
$orderField
as
$kk
=>
$vv
)
{
$order
[
$kk
]
=
$this
->
OrderFormValue
(
$result
,
$vv
[
'reg'
],
$vv
[
'type'
]);
...
...
@@ -494,7 +496,6 @@ class SourceGalanz extends Source
$order
[
'new_id'
]
=
$id
;
$order
[
'new_username'
]
=
self
::
$account
[
'username'
];
$order
[
'new_category'
]
=
self
::
$account
[
'category'
];
foreach
(
$orderField
as
$kk
=>
$vv
)
{
$order
[
$kk
]
=
$this
->
OrderFormValue
(
$result
,
$vv
[
'reg'
],
$vv
[
'type'
]);
...
...
@@ -559,31 +560,32 @@ class SourceGalanz extends Source
return
$result
;
}
/**
* 是否登录
* 登录失败, 重试5次
* @param int $num
* @return mixed
*/
private
function
IsLogin
(
$num
=
0
)
public
function
IsLogin
()
{
$url
=
self
::
$host
.
'/Complaint/new_srv_callinMP.aspx?type=unsubscribe'
;
$result
=
$this
->
GetUrlContents
(
$url
);
if
(
strlen
(
addslashes
(
$result
))
<
2000
)
{
$
this
->
Login
()
;
$
flag
=
false
;
if
(
$num
==
5
)
{
die
(
'登陆失败'
);
//登陆
$result
=
$this
->
Login
();
if
(
$result
[
'code'
]
==
302
)
{
$flag
=
true
;
}
else
{
if
(
file_exists
(
self
::
$cookieFilePath
))
{
unlink
(
self
::
$cookieFilePath
);
}
}
$num
++
;
$
this
->
IsLogin
(
$num
)
;
}
else
{
$
flag
=
true
;
}
return
$flag
;
}
p
rivate
function
Login
()
p
ublic
function
Login
()
{
$loginUrl
=
self
::
$host
.
"/FLoginNew.aspx"
;
$captchaUrl
=
self
::
$host
.
"/SystemSetting/CheckCode.aspx"
;
...
...
application/libraries/
u
uApi.php
→
application/libraries/
U
uApi.php
View file @
705ad4ec
File moved
public/captcha/galanz_c01000005.gif
View replaced file @
dbed7d67
View file @
705ad4ec
1.3 KB
|
W:
|
H:
1.32 KB
|
W:
|
H:
2-up
Swipe
Onion skin
public/cookie/galanz_c01000005.cookie
deleted
100644 → 0
View file @
dbed7d67
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_202.104.26.131 FALSE / FALSE 0 ASP.NET_SessionId 3kchwe2cix5h0pohqymalyjg
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment