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
Rock Zhang
9 years ago
Commit
91d99f1d41edd6fd7ecb897fca55923cba911e72
1 parent
3e874f2e
添加商品详情页用户咨询点赞以及有用接口
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
0 deletions
library/LibModels/Wap/Product/DetailData.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
library/LibModels/Wap/Product/DetailData.php
View file @
91d99f1
...
...
@@ -138,4 +138,40 @@ class DetailData
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 咨询点赞
*
* @param int $uid 用户ID
* @param int $id 咨询ID
* @return array
*/
public
static
function
upvoteConsult
(
$uid
,
$id
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.consult.like'
;
$param
[
'id'
]
=
$id
;
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 咨询有用
*
* @param int $uid 用户ID
* @param int $id 咨询ID
* @return array
*/
public
static
function
usefulConsult
(
$uid
,
$id
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.consult.useful'
;
$param
[
'id'
]
=
$id
;
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
91d99f1
...
...
@@ -567,6 +567,11 @@ class DetailModel
$build
[
'question'
]
=
$value
[
'ask'
];
$build
[
'time'
]
=
$value
[
'askTime'
];
$build
[
'answer'
]
=
$value
[
'answer'
];
$build
[
'id'
]
=
$value
[
'id'
];
$build
[
'isLike'
]
=
$value
[
'isLike'
];
$build
[
'like'
]
=
$value
[
'like'
];
$build
[
'isUseful'
]
=
$value
[
'isUseful'
];
$build
[
'useful'
]
=
$value
[
'useful'
];
$result
[]
=
$build
;
}
}
...
...
@@ -577,6 +582,66 @@ class DetailModel
}
/**
* 咨询点赞
*
* @param int $uid 用户ID
* @param int $id 咨询ID
* @return array
*/
public
static
function
upvoteConsult
(
$uid
,
$id
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦~'
);
do
{
$record
=
DetailData
::
upvoteConsult
(
$uid
,
$id
);
if
(
empty
(
$uid
))
{
$result
[
'code'
]
=
401
;
$result
[
'message'
]
=
'用户id为空'
;
break
;
}
// 处理数据
if
(
$record
&&
isset
(
$record
[
'code'
]))
{
$result
[
'code'
]
=
$record
[
'code'
];
$result
[
'message'
]
=
$record
[
'message'
];
}
}
while
(
false
);
return
$result
;
}
/**
* 咨询有用
*
* @param int $uid 用户ID
* @param int $id 咨询ID
* @return array
*/
public
static
function
usefulConsult
(
$uid
,
$id
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦~'
);
do
{
$record
=
DetailData
::
upvoteConsult
(
$uid
,
$id
);
if
(
empty
(
$uid
))
{
$result
[
'code'
]
=
401
;
$result
[
'message'
]
=
'用户id为空'
;
break
;
}
// 处理数据
if
(
$record
&&
isset
(
$record
[
'code'
]))
{
$result
[
'code'
]
=
$record
[
'code'
];
$result
[
'message'
]
=
$record
[
'message'
];
}
}
while
(
false
);
return
$result
;
}
/**
* 获取为你优选的商品
*
* @param int $productSkn 商品SKN
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
View file @
91d99f1
...
...
@@ -163,6 +163,38 @@ class DetailController extends AbstractAction
$this
->
_view
->
display
(
'consults'
,
$data
);
}
/*
* 咨询点赞
*/
public
function
consultupvoteAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
();
$id
=
$this
->
get
(
'id'
);
$result
=
\Product\DetailModel
::
upvoteConsult
(
$uid
,
$id
);
}
$this
->
echoJson
(
$result
);
}
/*
* 咨询有用
*/
public
function
consultusefulAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
();
$id
=
$this
->
get
(
'id'
);
$result
=
\Product\DetailModel
::
upvoteConsult
(
$uid
,
$id
);
}
$this
->
echoJson
(
$result
);
}
/**
* 我要咨询表单
*/
...
...
Please
register
or
login
to post a comment