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
bd13b9cd
Commit
bd13b9cd
authored
Aug 23, 2016
by
蒋林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 搜索维修单
2. 获取维修单详情 3. api返回修改
parent
38adbe41
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
701 additions
and
191 deletions
+701
-191
Welcome.php
application/controllers/Welcome.php
+1
-66
Galanz.php
application/controllers/api/Galanz.php
+63
-45
Galanz.php
application/controllers/task/Galanz.php
+1
-1
Rgalanz.php
application/controllers/test/Rgalanz.php
+62
-0
Sgalanz.php
application/controllers/test/Sgalanz.php
+60
-0
Receive.php
application/libraries/Receive/Receive.php
+18
-16
ReceiveGalanz.php
application/libraries/Receive/ReceiveGalanz.php
+4
-4
SourceGalanz.php
application/libraries/Source/SourceGalanz.php
+487
-59
galanz_.gif
public/captcha/galanz_.gif
+0
-0
galanz_.cookie
public/cookie/galanz_.cookie
+5
-0
No files found.
application/controllers/Welcome.php
View file @
bd13b9cd
...
@@ -6,74 +6,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
...
@@ -6,74 +6,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
*/
class
Welcome
extends
BaseController
{
class
Welcome
extends
BaseController
{
public
function
order
()
{
$this
->
load
->
config
(
'account'
,
true
);
$account
=
$this
->
config
->
item
(
'account'
);
$galanzAccount
=
$account
[
'galanz'
];
var_dump
(
$galanzAccount
);
die
();
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$galanzAccount
[
'c01000005'
],
'SourceGalanz'
);
$order
=
$this
->
SourceGalanz
->
OrderDetail
(
'8e2a13a1-5624-4b1e-a36f-93adcc08befa'
);
echo
"<pre>"
;
print_r
(
$order
);
}
public
function
t
()
public
function
t
()
{
{
$this
->
load
->
library
(
'Push/PushGalanz'
,
null
,
'PushGalanz'
);
echo
'11'
;
$result
=
$this
->
PushGalanz
->
GetToken
();
print_r
(
$result
);
}
}
public
function
api
()
{
$this
->
load
->
library
(
'Receive/ReceiveGalanz'
,
null
,
'ReceiveGalanz'
);
$data
[
'appid'
]
=
'10001'
;
$data
[
'out_trade_no'
]
=
'CALL2016082200544'
;
$data
[
'nonce_str'
]
=
$this
->
ReceiveGalanz
->
GetNonceStr
();
$this
->
ReceiveGalanz
->
SetValues
(
$data
);
$this
->
ReceiveGalanz
->
SetSign
();
$values
=
$this
->
ReceiveGalanz
->
GetValues
();
$url
=
"http://testwxh.pp.cc/api/galanz/getOrderDetail"
;
$result
=
$this
->
curlPost
(
$url
,
$values
);
$result
[
'data'
]
=
json_decode
(
$result
[
'data'
],
true
);
echo
"<pre>"
;
print_r
(
$result
);
}
protected
function
curlGet
(
$url
)
{
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
$result
=
curl_exec
(
$curl
);
//执行cURL抓取页面内容
$code
=
curl_getinfo
(
$curl
,
CURLINFO_HTTP_CODE
);
curl_close
(
$curl
);
return
[
'code'
=>
$code
,
'data'
=>
$result
];
}
protected
function
curlPost
(
$url
,
$post
)
{
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$post
));
$result
=
curl_exec
(
$curl
);
$code
=
curl_getinfo
(
$curl
,
CURLINFO_HTTP_CODE
);
curl_close
(
$curl
);
return
[
'code'
=>
$code
,
'data'
=>
$result
];
}
}
}
application/controllers/api/Galanz.php
View file @
bd13b9cd
...
@@ -20,33 +20,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
...
@@ -20,33 +20,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class
Galanz
extends
BaseController
class
Galanz
extends
BaseController
{
{
protected
static
$receiveGalanzObj
=
null
;
public
function
__construct
()
public
function
__construct
()
{
{
parent
::
__construct
();
parent
::
__construct
();
$this
->
load
->
library
(
'Receive/ReceiveGalanz'
,
null
,
'ReceiveGalanz'
);
self
::
$receiveGalanzObj
=
$this
->
ReceiveGalanz
;
}
private
function
getAccount
(
$username
)
{
$this
->
load
->
config
(
'account'
,
true
);
$account
=
$this
->
config
->
item
(
'account'
);
$galanzAccount
=
$account
[
'galanz'
];
return
$galanzAccount
[
$username
];
}
}
//订单详情
public
function
getOrderDetail
()
public
function
getOrderDetail
()
{
{
$param
=
$this
->
input
->
post
();
$param
=
$this
->
input
->
post
();
//验证参数
//验证参数
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
$obj
=
$this
->
receiveGalanzObj
();
self
::
$receiveGalanzObj
->
CheckGetOrderDetailValues
();
$obj
->
SetValues
(
$param
);
$values
=
self
::
$receiveGalanzObj
->
GetValues
();
$obj
->
CheckGetOrderDetailValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'getOrderDetail'
,
$param
);
$this
->
saveLog
(
$values
[
'out_trade_no'
],
'getOrderDetail'
,
$param
);
...
@@ -54,31 +42,37 @@ class Galanz extends BaseController
...
@@ -54,31 +42,37 @@ class Galanz extends BaseController
$info
=
$this
->
galanz_model
->
infoByNewName
(
$values
[
'out_trade_no'
]);
$info
=
$this
->
galanz_model
->
infoByNewName
(
$values
[
'out_trade_no'
]);
if
(
empty
(
$info
))
{
if
(
empty
(
$info
))
{
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10101'
,
'订单不存在'
);
$obj
->
ReturnMessage
(
false
,
'订单不存在'
);
}
}
//订单账号
//订单详情
$account
=
$this
->
getAccount
(
$info
[
'new_username'
]);
$sourceGalanzObj
=
$this
->
sourceGalanzObj
(
$info
[
'new_username'
],
$obj
);
$order
=
$sourceGalanzObj
->
OrderDetail
(
$info
[
'new_id'
]);
$obj
->
ReturnMessage
(
true
,
''
,
$order
);
}
//获取订单详情
//搜索订单
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$account
,
'SourceGalanz'
);
public
function
searchOrder
()
$order
=
$this
->
SourceGalanz
->
OrderDetail
(
$info
[
'new_id'
]);
{
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
,
''
,
$order
);
}
}
//搜索维修单
//保存订单
//保存订单
public
function
saveOrder
()
public
function
saveOrder
()
{
{
$param
=
$this
->
input
->
post
();
$param
=
$this
->
input
->
post
();
//验证参数
//验证参数
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
$obj
=
$this
->
receiveGalanzObj
();
self
::
$receiveGalanzObj
->
CheckSaveOrderValues
();
$obj
->
SetValues
(
$param
);
$obj
->
CheckSaveOrderValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
''
,
'saveOrder'
,
$param
);
$this
->
saveLog
(
''
,
'saveOrder'
,
$param
);
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
$obj
->
ReturnMessage
(
true
,
''
,
$values
);
}
}
//拒绝订单
//拒绝订单
...
@@ -87,12 +81,13 @@ class Galanz extends BaseController
...
@@ -87,12 +81,13 @@ class Galanz extends BaseController
$param
=
$this
->
input
->
post
();
$param
=
$this
->
input
->
post
();
//验证参数
//验证参数
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
$obj
=
$this
->
receiveGalanzObj
();
self
::
$receiveGalanzObj
->
CheckRefuseOrderValues
();
$obj
->
SetValues
(
$param
);
$obj
->
CheckRefuseOrderValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
''
,
'refuseOrder'
,
$param
);
$this
->
saveLog
(
''
,
'refuseOrder'
,
$param
);
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
$obj
->
ReturnMessage
(
true
,
''
,
$values
);
}
}
//接受订单
//接受订单
...
@@ -101,12 +96,13 @@ class Galanz extends BaseController
...
@@ -101,12 +96,13 @@ class Galanz extends BaseController
$param
=
$this
->
input
->
post
();
$param
=
$this
->
input
->
post
();
//验证参数
//验证参数
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
$obj
=
$this
->
receiveGalanzObj
();
self
::
$receiveGalanzObj
->
CheckAcceptOrderValues
();
$obj
->
SetValues
(
$param
);
$obj
->
CheckAcceptOrderValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
''
,
'acceptOrder'
,
$param
);
$this
->
saveLog
(
''
,
'acceptOrder'
,
$param
);
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
$obj
->
ReturnMessage
(
true
,
''
,
$values
);
}
}
//转录维修单
//转录维修单
...
@@ -115,12 +111,13 @@ class Galanz extends BaseController
...
@@ -115,12 +111,13 @@ class Galanz extends BaseController
$param
=
$this
->
input
->
post
();
$param
=
$this
->
input
->
post
();
//验证参数
//验证参数
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
$obj
=
$this
->
receiveGalanzObj
();
self
::
$receiveGalanzObj
->
CheckCreateWorkOrderValues
();
$obj
->
SetValues
(
$param
);
$obj
->
CheckCreateWorkOrderValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
''
,
'createWorkOrder'
,
$param
);
$this
->
saveLog
(
''
,
'createWorkOrder'
,
$param
);
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
$obj
->
ReturnMessage
(
true
,
''
,
$values
);
}
}
//转录安装单
//转录安装单
...
@@ -129,13 +126,13 @@ class Galanz extends BaseController
...
@@ -129,13 +126,13 @@ class Galanz extends BaseController
$param
=
$this
->
input
->
post
();
$param
=
$this
->
input
->
post
();
//验证参数
//验证参数
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
$obj
=
$this
->
receiveGalanzObj
();
self
::
$receiveGalanzObj
->
CheckCreateUserprofileOrderValues
();
$obj
->
SetValues
(
$param
);
$obj
->
CheckCreateUserprofileOrderValues
();
$values
=
$obj
->
GetValues
();
$this
->
saveLog
(
''
,
'createUserprofileOrder'
,
$param
);
$this
->
saveLog
(
''
,
'createUserprofileOrder'
,
$param
);
$obj
->
ReturnMessage
(
true
,
''
,
$values
);
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
}
}
private
function
saveLog
(
$search
,
$method
,
$data
)
private
function
saveLog
(
$search
,
$method
,
$data
)
...
@@ -145,4 +142,25 @@ class Galanz extends BaseController
...
@@ -145,4 +142,25 @@ class Galanz extends BaseController
$this
->
api_log_model
->
add
(
$search
,
'galanz'
,
$method
,
$data
);
$this
->
api_log_model
->
add
(
$search
,
'galanz'
,
$method
,
$data
);
}
}
private
function
receiveGalanzObj
()
{
$this
->
load
->
library
(
'Receive/ReceiveGalanz'
,
null
,
'ReceiveGalanz'
);
return
$this
->
ReceiveGalanz
;
}
private
function
sourceGalanzObj
(
$username
,
$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
->
library
(
'Source/SourceGalanz'
,
$galanzAccount
[
$username
],
'SourceGalanz'
);
return
$this
->
SourceGalanz
;
}
}
}
\ No newline at end of file
application/controllers/task/Galanz.php
View file @
bd13b9cd
...
@@ -65,7 +65,7 @@ class Galanz extends BaseController
...
@@ -65,7 +65,7 @@ class Galanz extends BaseController
$endTime
=
date
(
"Y/m/d"
,
strtotime
(
$nowTime
)
+
86400
);
$endTime
=
date
(
"Y/m/d"
,
strtotime
(
$nowTime
)
+
86400
);
$orders
=
$this
->
SourceGalanz
->
SearchOrder
(
$startTime
,
$endTime
);
$orders
=
$this
->
SourceGalanz
->
SearchOrder
(
''
,
''
,
$startTime
,
$endTime
);
if
(
empty
(
$orders
))
{
if
(
empty
(
$orders
))
{
return
false
;
return
false
;
...
...
application/controllers/test/Rgalanz.php
0 → 100644
View file @
bd13b9cd
<?php
/**
* Created by PhpStorm.
* User: LinJiangL
* Date: 16/8/23
* Time: 下午1:58
*/
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
/**
* 接口测试
*
* @property SourceGalanz SourceGalanz
*/
class
Rgalanz
extends
BaseController
{
public
function
getOrderDetail
()
{
$obj
=
$this
->
galanzObj
();
$data
[
'appid'
]
=
'10001'
;
$data
[
'out_trade_no'
]
=
'CALL2016082200544'
;
$data
[
'nonce_str'
]
=
$obj
->
GetNonceStr
();
$obj
->
SetValues
(
$data
);
$obj
->
SetSign
();
$values
=
$obj
->
GetValues
();
$url
=
"http://wxh.pp.cn/api/galanz/getOrderDetail"
;
$result
=
$this
->
curlPost
(
$url
,
$values
);
$result
[
'data'
]
=
json_decode
(
$result
[
'data'
],
true
);
$this
->
show
(
$result
[
'data'
]);
}
private
function
galanzObj
()
{
$this
->
load
->
library
(
'Receive/ReceiveGalanz'
,
null
,
'ReceiveGalanz'
);
return
$this
->
ReceiveGalanz
;
}
private
function
show
(
$data
)
{
echo
"<pre>"
;
print_r
(
$data
);
}
protected
function
curlPost
(
$url
,
$post
)
{
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$post
));
$result
=
curl_exec
(
$curl
);
$code
=
curl_getinfo
(
$curl
,
CURLINFO_HTTP_CODE
);
curl_close
(
$curl
);
return
[
'code'
=>
$code
,
'data'
=>
$result
];
}
}
\ No newline at end of file
application/controllers/test/Sgalanz.php
0 → 100644
View file @
bd13b9cd
<?php
/**
* Created by PhpStorm.
* User: LinJiangL
* Date: 16/8/23
* Time: 下午1:58
*/
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
/**
* 抓取数据接口测试
*
* @property SourceGalanz SourceGalanz
*/
class
Sgalanz
extends
BaseController
{
public
function
searchOrder
()
{
$obj
=
$this
->
galanzObj
();
$list
=
$obj
->
SearchOrder
(
'CALL2016082203611'
);
$this
->
show
(
$list
);
}
public
function
orderDetail
()
{
$obj
=
$this
->
galanzObj
();
$list
=
$obj
->
OrderDetail
(
'3911c4cd-6855-4a2c-8085-6e489972e6a3'
);
$this
->
show
(
$list
);
}
public
function
searchWorkOrder
()
{
$obj
=
$this
->
galanzObj
();
$list
=
$obj
->
SearchWorkOrder
(
'WO2016082204280'
);
$this
->
show
(
$list
);
}
public
function
workOrderDetail
()
{
$obj
=
$this
->
galanzObj
();
$list
=
$obj
->
WorkOrderDetail
(
'07ef7b0e-9788-4d05-88a5-25adc4406aef'
);
$this
->
show
(
$list
);
}
private
function
galanzObj
(
$username
=
'c01000005'
)
{
$this
->
load
->
config
(
'account'
,
true
);
$account
=
$this
->
config
->
item
(
'account'
);
$galanzAccount
=
$account
[
'galanz'
];
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$galanzAccount
[
$username
],
'SourceGalanz'
);
return
$this
->
SourceGalanz
;
}
private
function
show
(
$data
)
{
echo
"<pre>"
;
print_r
(
$data
);
}
}
\ No newline at end of file
application/libraries/Receive/Receive.php
View file @
bd13b9cd
...
@@ -159,12 +159,12 @@ class Receive
...
@@ -159,12 +159,12 @@ class Receive
/**
/**
* 返回数据
* 返回数据
* @param string $code
* @param bool $code
* @param string $data
* @param string $msg
* @param string $msg
* @return array
* @param array $data
* @return string
*/
*/
public
function
ReturnMessage
(
$code
=
'10000'
,
$msg
=
''
,
$data
=
''
)
public
function
ReturnMessage
(
$code
=
true
,
$msg
=
''
,
$data
=
[]
)
{
{
echo
$this
->
SetErrorCode
(
$code
,
$msg
,
$data
);
echo
$this
->
SetErrorCode
(
$code
,
$msg
,
$data
);
die
();
die
();
...
@@ -172,23 +172,25 @@ class Receive
...
@@ -172,23 +172,25 @@ class Receive
/**
/**
* 返回数据
* 返回数据
* @param string $code
* @param bool $code
* @param string $data
* @param string $msg
* @param string $msg
* @return array
* @param array $data
* @return string
*/
*/
public
function
SetErrorCode
(
$code
=
'10000'
,
$msg
=
''
,
$data
=
''
)
public
function
SetErrorCode
(
$code
=
true
,
$msg
=
''
,
$data
=
[]
)
{
{
$error
=
[
$return
[
'return_code'
]
=
$code
?
'SUCCESS'
:
'FAIL'
;
'10000'
=>
'OK'
,
$return
[
'return_msg'
]
=
$code
?
'成功'
:
$msg
;
'10001'
=>
'APPID错误'
,
'10002'
=>
'签名错误'
,
'10999'
=>
'参数错误'
,
];
$msg
=
isset
(
$error
[
$code
])
?
$error
[
$code
]
:
$msg
;
if
(
$data
)
{
if
(
!
is_array
(
$data
))
{
$return
[
'return_data'
]
=
$data
;
}
$return
=
array_merge
(
$return
,
$data
);
}
return
json_encode
(
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
]
,
JSON_UNESCAPED_UNICODE
);
return
json_encode
(
$return
,
JSON_UNESCAPED_UNICODE
);
}
}
}
}
\ No newline at end of file
application/libraries/Receive/ReceiveGalanz.php
View file @
bd13b9cd
...
@@ -14,15 +14,15 @@ class ReceiveGalanz extends Receive
...
@@ -14,15 +14,15 @@ class ReceiveGalanz extends Receive
public
function
CheckPublicValues
()
public
function
CheckPublicValues
()
{
{
if
(
!
$this
->
GetValues
())
{
if
(
!
$this
->
GetValues
())
{
$this
->
ReturnMessage
(
'10999
'
);
$this
->
ReturnMessage
(
false
,
'参数错误!
'
);
}
}
if
(
$this
->
CheckAppid
()
==
false
)
{
if
(
$this
->
CheckAppid
()
==
false
)
{
$this
->
ReturnMessage
(
'10001
'
);
$this
->
ReturnMessage
(
false
,
'缺少appid参数!
'
);
}
}
if
(
$this
->
CheckSign
()
==
false
)
{
if
(
$this
->
CheckSign
()
==
false
)
{
$this
->
ReturnMessage
(
'10002
'
);
$this
->
ReturnMessage
(
false
,
'签名错误!
'
);
}
}
}
}
...
@@ -34,7 +34,7 @@ class ReceiveGalanz extends Receive
...
@@ -34,7 +34,7 @@ class ReceiveGalanz extends Receive
$this
->
CheckPublicValues
();
$this
->
CheckPublicValues
();
if
(
!
array_key_exists
(
'out_trade_no'
,
$this
->
values
)
||
$this
->
values
[
'out_trade_no'
]
==
''
)
{
if
(
!
array_key_exists
(
'out_trade_no'
,
$this
->
values
)
||
$this
->
values
[
'out_trade_no'
]
==
''
)
{
$this
->
ReturnMessage
(
'10003'
,
'缺少out_trade_no参数!'
);
$this
->
ReturnMessage
(
false
,
'缺少out_trade_no参数!'
);
}
}
}
}
...
...
application/libraries/Source/SourceGalanz.php
View file @
bd13b9cd
This diff is collapsed.
Click to expand it.
public/captcha/galanz_.gif
0 → 100644
View file @
bd13b9cd
1.31 KB
public/cookie/galanz_.cookie
0 → 100644
View file @
bd13b9cd
# 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 s25qsykf2gs54yyimlfkg3te
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