Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xiaowei
9 years ago
Commit
fc233e4fcaabd6a3220ac9d5a7f719f1b0713754
1 parent
7ba786e9
重构-在线客服
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
15 deletions
library/LibModels/Wap/Home/OnlineData.php
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/home/Online.php
library/LibModels/Wap/Home/OnlineData.php
0 → 100644
View file @
fc233e4
<?php
namespace
LibModels\Wap\Home
;
use
Api\Sign
;
use
Api\Yohobuy
;
/**
* 在线客服数据模型
*
* @name OnlineData
* @package LibModels/Wap/Home
* @copyright yoho.inc
* @version 1.0 (2015-11-13)
* @author xiaowei
*/
class
OnlineData
{
const
ONLINE_URI
=
'operations/api/v1/help/'
;
//获取帮助列表(分类)
public
static
function
getOnlineServiceInfo
(
$clientType
=
'iphone'
)
{
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
ONLINE_URI
.
'getCategory'
,
array
(
'client_type'
=>
$clientType
));
}
//获取问题详情
public
static
function
getOnlineServiceDetail
(
$cateId
,
$clientType
=
'iphone'
)
{
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
ONLINE_URI
.
'getHelp'
,
array
(
'category_id'
=>
$cateId
,
'client_type'
=>
$clientType
));
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
fc233e4
...
...
@@ -240,23 +240,26 @@ class HomeController extends AbstractAction
));
}
/**
* 在线客服
*/
public
function
onlineServiceAction
()
{
$service
=
\Index\UserModel
::
getOnlineServiceData
();
print_r
(
$service
);
//在线客服
public
function
onlineServiceAction
()
{
$service
=
home\OnlineModel
::
getOnlineServiceInfo
();
$this
->
_view
->
display
(
'online_service'
,
$service
);
}
$this
->
_view
->
display
(
'online_service'
,
array
(
'onlineServicePage'
=>
true
,
'pageFooter'
=>
true
,
'service'
=>
$service
));
}
//在线客服-具体详情
public
function
onlineServiceDetailAction
()
{
$service
=
array
();
$cateId
=
$this
->
get
(
'cateId'
,
0
);
if
(
$cateId
>
0
)
{
$service
=
home\OnlineModel
::
getOnlineServiceDetail
(
$cateId
);
}
$this
->
_view
->
display
(
'online_service_detail'
,
$service
);
}
/**
/**
* 我的逛
*/
public
function
myGuangAction
()
...
...
yohobuy/m.yohobuy.com/application/models/home/Online.php
0 → 100644
View file @
fc233e4
<?php
namespace
home
;
use
LibModels\Wap\Home\OnlineData
;
use
Action\AbstractAction
;
use
Plugin\Helpers
;
/**
* 在线客服相关数据处理
*/
class
OnlineModel
{
//获取在线帮助分类
public
static
function
getOnlineServiceInfo
(
$clientType
=
'iphone'
)
{
//调用接口获取数据
$res
=
OnlineData
::
getOnlineServiceInfo
(
$clientType
);
$cateInfo
=
$res
[
'data'
];
$question
=
array
();
$tab
=
array
();
if
(
$cateInfo
)
{
foreach
(
$cateInfo
as
$key
=>
$value
)
{
//强制截成3个tab
if
(
$key
>
2
)
{
break
;
}
$tab
[
$key
][
'tabid'
]
=
'tab'
.
$value
[
'id'
];
$tab
[
$key
][
'tabname'
]
=
$value
[
'category_name'
];
$tab
[
$key
][
'iscut'
]
=
true
;
$tab
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$question
[
$key
][
'name'
]
=
'tab'
.
$value
[
'id'
];
$question
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$sub
=
$value
[
'sub'
];
$qTmp
=
array
();
if
(
$sub
)
{
foreach
(
$sub
as
$sk
=>
$sv
)
{
$qTmp
[
$sk
][
'title'
]
=
$sv
[
'category_name'
];
$qTmp
[
$sk
][
'link'
]
=
'/home/onlineservicedetail?cateId='
.
$sv
[
'id'
];
}
}
$question
[
$key
][
'list'
]
=
$qTmp
;
}
$question
[
0
][
'current'
]
=
true
;
$tab
[
count
(
$tab
)
-
1
][
'iscut'
]
=
false
;
}
//处理返回信息
$result
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'tab'
=>
$tab
,
'question'
=>
$question
);
return
$result
;
}
//加载分类下的问题和解决方法
public
static
function
getOnlineServiceDetail
(
$cateId
,
$clinetType
=
'iphone'
)
{
$result
=
array
();
if
(
!
$cateId
)
{
return
$result
;
}
$res
=
OnlineData
::
getOnlineServiceDetail
(
$cateId
,
$clinetType
);
$questionInfo
=
$res
[
'data'
];
if
(
$questionInfo
)
{
$list
=
array
();
if
(
$questionInfo
)
{
foreach
(
$questionInfo
as
$qk
=>
$qv
)
{
$list
[
$qk
][
'q'
]
=
$qv
[
'title'
];
$list
[
$qk
][
'a'
]
=
$qv
[
'content'
];
}
}
//处理返回信息
$result
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'list'
=>
$list
);
}
return
$result
;
}
}
...
...
Please
register
or
login
to post a comment