Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SSHis
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxinghua
SSHis
Commits
daef1dd1
Commit
daef1dd1
authored
Aug 11, 2020
by
wangxinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
参数验证
parent
6ce439b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
2 deletions
+53
-2
TestSoapController.class.php
Application/Home/Controller/TestSoapController.class.php
+6
-2
Bdyx.class.php
ThinkPHP/Library/Vendor/Bdyx.class.php
+47
-0
No files found.
Application/Home/Controller/TestSoapController.class.php
View file @
daef1dd1
...
...
@@ -4,13 +4,18 @@ use \Think\Controller;
ini_set
(
'soap.wsdl_cache_enabled'
,
'0'
);
//关闭缓存
class
TestSoapController
extends
Controller
{
private
$url
=
'http://127.0.0.1:8080/project/SSHis/index.php/Home/CreateSoap/index?wsdl'
;
//private $url = 'http://222.128.103.58:11288/SSHis/index.php/Home/CreateSoap/index?wsdl';
public
function
index
()
{
$params
=
array
();
$params
[
'userName'
]
=
'10002'
;
$params
[
'password'
]
=
'123456'
;
$params
[
'businessType'
]
=
'YYT_QRY_CLINIC_DEPT'
;
$params
[
'requestData'
]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
gb2312
\"
?><root><commitdata><data><datarow start_date=
\"\"
end_date=
\"\"
gh_flag=
\"\"
class_code=
\"
%
\"
\/><\/data><\/commitdata><returndata\/><operateinfo><info method=
\"
YYT_QRY_CLINIC_DEPT
\"
opt_id=
\"
opt_name=
\"\"
opt_ip=
\"\"
opt_date=
\"
"
.
date
(
'Y-m-d'
)
.
"
\"
guid=
\"
1590743721019
\"
token=
\"
AUTO-YYRMYY-20200529
\"
\/><\/operateinfo><result><info \/><\/result><\/root>"
;
$params
[
'requestData'
]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
gb2312
\"
?><root><commitdata><data><datarow start_date=
\"\"
end_date=
\"\"
gh_flag=
\"\"
class_code=
\"
%
\"
/></data></commitdata><returndata/><operateinfo><info method=
\"
YYT_QRY_CLINIC_DEPT
\"
opt_id=
\"\"
opt_name=
\"\"
opt_ip=
\"\"
opt_date=
\"
"
.
date
(
'Y-m-d'
)
.
"
\"
guid=
\"
1590743721019
\"
token=
\"
AUTO-YYRMYY-20200529
\"
/></operateinfo><result><info /></result></root>"
;
import
(
'Vendor.Bdyx'
);
$Bdyx
=
new
\Bdyx
();
//echo $Bdyx->FounderRequestData(json_encode($params));
//exit;
try
{
...
...
@@ -21,7 +26,6 @@ class TestSoapController extends Controller {
//$out = $soap->FounderRequestData(json_encode($params));
//这里模拟需要转成json,注意即可
$out
=
$soap
->
FounderRequestData
(
json_encode
(
$params
));
$out
=
htmlspecialchars_decode
(
$out
);
$out
=
str_replace
(
array
(
'gb2312'
,
'UTF-16'
),
array
(
'utf8'
,
'utf8'
),
$out
);
$out
=
simplexml_load_string
(
$out
);
...
...
ThinkPHP/Library/Vendor/Bdyx.class.php
View file @
daef1dd1
...
...
@@ -36,10 +36,57 @@ class Bdyx
return
$this
->
error_xml
(
'参数password不正确'
);
}
$function
=
$in
[
'businessType'
];
$in
[
'requestData'
]
=
htmlspecialchars_decode
(
$in
[
'requestData'
]);
$in
[
'requestData'
]
=
str_replace
(
array
(
'gb2312'
,
'UTF-16'
),
array
(
'utf8'
,
'utf8'
),
$in
[
'requestData'
]);
$requestData
=
simplexml_load_string
(
$in
[
'requestData'
]);
if
(
!
$requestData
)
{
return
$this
->
error_xml
(
'参数requestData不是合法的xml'
);
}
//验证参数
$data
=
(
array
)
$requestData
->
commitdata
->
data
;
if
(
!
is_array
(
$data
[
'datarow'
]))
{
$data
[
'datarow'
]
=
(
array
)
$data
[
'datarow'
];
foreach
(
$data
[
'datarow'
][
'@attributes'
]
as
$k
=>
$v
)
{
if
(
$v
==
""
)
{
return
$this
->
error_xml
(
'参数'
.
$k
.
'不能为空'
);
}
}
}
else
{
foreach
(
$data
[
'datarow'
]
as
$dr
)
{
$drr
=
(
array
)
$dr
->
attributes
();
foreach
(
$drr
[
'@attributes'
]
as
$k
=>
$v
)
{
if
(
$v
==
""
)
{
return
$this
->
error_xml
(
'参数'
.
$k
.
'不能为空'
);
}
}
}
}
$info
=
(
array
)
$requestData
->
operateinfo
->
info
;
foreach
(
$info
[
'@attributes'
]
as
$k
=>
$v
)
{
if
(
$v
==
""
)
{
return
$this
->
error_xml
(
'参数'
.
$k
.
'不能为空'
);
}
}
//调用具体业务方法
if
(
method_exists
(
$this
,
$function
))
return
$this
->
$function
(
$in
[
'requestData'
]);
else
return
$this
->
error_xml
(
'找不到'
.
$in
[
'requestData'
]
.
'业务方法'
);
}
//患者信息
private
function
YYT_QRY_PATI
(
$in
)
...
...
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