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
62ee6c27
Commit
62ee6c27
authored
Aug 23, 2016
by
蒋林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
del
parent
e96349c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
211 deletions
+0
-211
Galanz.php
application/controllers/Apii/Galanz.php
+0
-95
Galanz.php
application/controllers/Tasks/Galanz.php
+0
-116
No files found.
application/controllers/Apii/Galanz.php
deleted
100755 → 0
View file @
e96349c0
<?php
/**
* Created by PhpStorm.
* User: LinJiangL
* Date: 16/8/19
* Time: 上午11:14
*/
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
/**
* Class Galanz 格兰仕相关接口
*
* @property galanz_model galanz_model
* @property PushGalanz PushGalanz
* @property SourceGalanz SourceGalanz
* @property api_log_model api_log_model
* @property ReceiveGalanz ReceiveGalanz
*/
class
Galanz
extends
BaseController
{
protected
static
$receiveGalanzObj
=
null
;
public
function
__construct
()
{
parent
::
__construct
();
$this
->
load
->
library
(
'Receive/ReceiveGalanz'
,
null
,
'ReceiveGalanz'
);
$this
->
load
->
model
(
'api_log_model'
);
self
::
$receiveGalanzObj
=
$this
->
ReceiveGalanz
;
}
//保存订单
public
function
saveOrder
()
{
$param
=
$this
->
input
->
post
();
$this
->
api_log_model
->
add
(
''
,
'galanz_saveOrder'
,
$param
);
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
self
::
$receiveGalanzObj
->
CheckRefuseOrderValues
();
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
}
//拒绝订单
public
function
refuseOrder
()
{
$param
=
$this
->
input
->
post
();
$this
->
api_log_model
->
add
(
''
,
'galanz_refuseOrder'
,
$param
);
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
self
::
$receiveGalanzObj
->
CheckRefuseOrderValues
();
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
}
//接受订单
public
function
acceptOrder
()
{
$param
=
$this
->
input
->
post
();
$this
->
api_log_model
->
add
(
''
,
'galanz_acceptOrder'
,
$param
);
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
self
::
$receiveGalanzObj
->
CheckRefuseOrderValues
();
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
}
//转录维修单
public
function
createWorkOrder
()
{
$param
=
$this
->
input
->
post
();
$this
->
api_log_model
->
add
(
''
,
'galanz_createWorkOrder'
,
$param
);
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
self
::
$receiveGalanzObj
->
CheckRefuseOrderValues
();
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
}
//转录安装单
public
function
createUserprofileOrder
()
{
$param
=
$this
->
input
->
post
();
$this
->
api_log_model
->
add
(
''
,
'galanz_createUserprofileOrder'
,
$param
);
self
::
$receiveGalanzObj
->
SetValues
(
$param
);
self
::
$receiveGalanzObj
->
CheckRefuseOrderValues
();
self
::
$receiveGalanzObj
->
ReturnMessage
(
'10000'
);
}
}
\ No newline at end of file
application/controllers/Tasks/Galanz.php
deleted
100755 → 0
View file @
e96349c0
<?php
/**
* Created by PhpStorm.
* User: LinJiangL
* Date: 16/8/18
* Time: 下午2:00
*/
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
/**
* Class Galanz 计划任务
*
* @property galanz_model galanz_model
* @property PushGalanz PushGalanz
* @property SourceGalanz SourceGalanz
*/
class
Galanz
extends
BaseController
{
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* 定时抓取订单数据
*/
public
function
index
()
{
ini_set
(
"max_execution_time"
,
12000
);
//账号配置
$accountConfig
=
[
[
'username'
=>
'c01000005'
,
//用户名
'pwd'
=>
'weixiuhui010'
,
//密码
'city'
=>
'北京'
,
//地区
'category'
=>
'热水器'
,
//产品类型
]
];
$orders
=
[];
foreach
(
$accountConfig
as
$v
)
{
$orders
[]
=
$this
->
galanzHandle
(
$v
);
}
echo
"<pre>"
;
print_r
(
$orders
);
}
private
function
galanzHandle
(
$account
)
{
$this
->
load
->
model
(
'galanz_model'
);
$this
->
load
->
library
(
'Source/SourceGalanz'
,
$account
,
'SourceGalanz'
);
//调取最近的数据
$maxTimeOrder
=
$this
->
galanz_model
->
infoMaxDaytime
();
$nowTime
=
date
(
"Y/m/d"
,
time
());
if
(
$maxTimeOrder
)
{
$startTime
=
strtotime
(
date
(
"Y/m/d"
,
$maxTimeOrder
[
'new_callintime'
]));
$startTime
=
date
(
"Y/m/d"
,
$startTime
);
}
else
{
//前三天的时间
$startTime
=
date
(
"Y/m/d"
,
strtotime
(
$nowTime
)
-
86400
*
2
);
}
$endTime
=
date
(
"Y/m/d"
,
strtotime
(
$nowTime
)
+
86400
);
$orders
=
$this
->
SourceGalanz
->
SearchOrder
(
$startTime
,
$endTime
);
if
(
empty
(
$orders
))
{
return
false
;
}
$result
=
[];
foreach
(
$orders
as
$k
=>
$v
)
{
$order
=
$this
->
SourceGalanz
->
OrderDetail
(
$v
[
0
]);
//如果订单存在, 不需要保存
$info
=
$this
->
galanz_model
->
infoByNewName
(
$order
[
'new_name'
]);
if
(
empty
(
$info
))
{
$id
=
$this
->
galanz_model
->
add
(
$order
);
//记录插入的订单
$order
[
'id'
]
=
$id
;
$result
[
$k
]
=
$order
;
}
}
return
$result
;
}
/**
* 推送订单到维修汇
*/
public
function
pushOrder
()
{
$this
->
load
->
model
(
'galanz_model'
);
$this
->
load
->
library
(
'Push/PushGalanz'
,
null
,
'PushGalanz'
);
$orders
=
$this
->
galanz_model
->
getOrderList
();
foreach
(
$orders
as
$k
=>
$v
)
{
$result
=
$this
->
PushGalanz
->
PushOrder
(
$v
);
//推送成功, 修改推送状态
if
(
$result
[
'code'
]
==
200
&&
$result
[
'data'
]
==
'OK'
)
{
$this
->
galanz_model
->
updatePushStatus
(
$v
[
'id'
]);
}
}
}
}
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