Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
7c68e9738259561c7c66aadb4ed811228a06e94f
1 parent
bad032df
do modify home page code to change check user is login and fixes bugs
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
28 deletions
library/LibModels/Wap/Product/DetailData.php
template/m.yohobuy.com/actions/product/detail/consultform.phtml
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 @
7c68e97
...
...
@@ -16,12 +16,12 @@ use Api\Yohobuy;
*/
class
DetailData
{
const
PRODUCT_BASE_INFO
=
'product/queryProductDetailByProductId'
;
const
PRODUCT_SIZE_INFO
=
'product/queryProductIntroBySkn'
;
const
PRODUCT_CONSULT_LIST
=
'consult/queryConsults'
;
const
PRODUCT_COMMENT_LIST
=
'sns/comments/commentList'
;
/**
* 商品基本信息
*
...
...
@@ -31,11 +31,11 @@ class DetailData
*/
public
static
function
baseInfo
(
$productId
,
$uid
)
{
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_BASE_INFO
,
array
(
'param'
=>
intval
(
$productId
),
'userId'
=>
intval
(
$uid
)
)
);
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_BASE_INFO
,
array
(
'param'
=>
intval
(
$productId
),
'userId'
=>
intval
(
$uid
)
));
}
/**
* 商品尺码信息
*
...
...
@@ -44,9 +44,9 @@ class DetailData
*/
public
static
function
sizeInfo
(
$productSkn
)
{
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_SIZE_INFO
,
array
(
'param'
=>
intval
(
$productSkn
)
)
);
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_SIZE_INFO
,
array
(
'param'
=>
intval
(
$productSkn
)
)
);
}
/**
* 咨询内容列表
*
...
...
@@ -58,13 +58,13 @@ class DetailData
public
static
function
consultList
(
$productId
,
$pageNum
,
$pageSize
)
{
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_CONSULT_LIST
,
array
(
'productId'
=>
intval
(
$productId
),
'pageNum'
=>
intval
(
$pageNum
),
'pageSize'
=>
intval
(
$pageSize
),
)
);
'productId'
=>
intval
(
$productId
),
'pageNum'
=>
intval
(
$pageNum
),
'pageSize'
=>
intval
(
$pageSize
),
));
}
/**
/**
* 评论内容列表
*
* @param int $productId 产品ID
...
...
@@ -75,12 +75,12 @@ class DetailData
public
static
function
commentList
(
$productId
,
$pageNum
,
$pageSize
)
{
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_COMMENT_LIST
,
array
(
'productId'
=>
intval
(
$productId
),
'pageNum'
=>
intval
(
$pageNum
),
'pageSize'
=>
intval
(
$pageSize
),
)
);
'productId'
=>
intval
(
$productId
),
'pageNum'
=>
intval
(
$pageNum
),
'pageSize'
=>
intval
(
$pageSize
),
));
}
/**
* 为你优选的商品列表
*
...
...
@@ -88,14 +88,33 @@ class DetailData
* @param int $productSkn 商品SKN号
* @return array
*/
public
static
function
preference
(
$productSkn
)
public
static
function
preference
(
$productSkn
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.product.topreference'
;
$param
[
'product_skn'
]
=
$productSkn
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
3600
);
// 缓存1小时
}
/**
* 添加咨询
*
* @param int $uid 用户ID
* @param int $productId 商品ID
* @return array
*/
public
static
function
addConsult
(
$uid
,
$productId
,
$content
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.consult.add'
;
$param
[
'product_id'
]
=
$productId
;
$param
[
'content'
]
=
$content
;
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
template/m.yohobuy.com/actions/product/detail/consultform.phtml
View file @
7c68e97
{
{>
layout/header
}
}
<div
class=
"consult-form-page"
>
<form
class=
"consult-form"
>
<textarea>这款衣服有WS吗?</textarea>
<a
href=
""
type=
"submit"
>提交</a>
</form>
<form
class=
"consult-form"
url=
"{{formUrl}}"
>
<textarea
id=
"content"
name=
"content"
>请输入咨询内容</textarea>
<input
type=
"hidden"
id=
"product_id"
value=
"{{productId}}"
>
<a
type=
"submit"
>提交</a>
</form>
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
7c68e97
...
...
@@ -234,6 +234,15 @@ class DetailModel
// 商品信息
if
(
isset
(
$sizeInfo
[
'productDescBo'
][
'erpProductId'
]))
{
$sex
=
'通用'
;
switch
(
$sizeInfo
[
'productDescBo'
][
'gender'
])
{
case
1
:
$sex
=
'男款'
;
break
;
case
2
:
$sex
=
'女款'
;
break
;
}
$result
[
'goodsDescription'
]
=
array
(
'title'
=>
'商品信息'
,
'enTitle'
=>
'PRODUCT INFO'
,
...
...
@@ -241,6 +250,7 @@ class DetailModel
'list'
=>
array
(
array
(
'param'
=>
'编号:'
.
$sizeInfo
[
'productDescBo'
][
'erpProductId'
]),
array
(
'param'
=>
'颜色:'
.
$sizeInfo
[
'productDescBo'
][
'colorName'
]),
array
(
'param'
=>
'性别:'
.
$sex
),
)
),
);
...
...
@@ -296,6 +306,11 @@ class DetailModel
'enTitle'
=>
'REFERENCE'
,
'detail'
=>
array
(
'list'
=>
array
()),
);
// 控制是否显示备注
$showRemark
=
false
;
$remarkList
=
array
(
0
=>
array
(
'param'
=>
'备注'
));
$result
[
'reference'
][
'detail'
][
'list'
][
0
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
''
));
// 头像列表
$result
[
'reference'
][
'detail'
][
'list'
][
1
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
'模特'
));
// 模特名字列表
$result
[
'reference'
][
'detail'
][
'list'
][
2
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
'身高'
));
// 身高列表
...
...
@@ -303,6 +318,7 @@ class DetailModel
$result
[
'reference'
][
'detail'
][
'list'
][
4
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
'三围'
));
// 三围列表
$result
[
'reference'
][
'detail'
][
'list'
][
5
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
'吊牌尺码'
));
// 吊牌尺码
$result
[
'reference'
][
'detail'
][
'list'
][
6
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
'试穿描述'
));
// 试穿描述
foreach
(
$sizeInfo
[
'modelBos'
]
as
$value
)
{
$result
[
'reference'
][
'detail'
][
'list'
][
0
][
'params'
][]
=
array
(
'param'
=>
$value
[
'avatar'
]);
$result
[
'reference'
][
'detail'
][
'list'
][
1
][
'params'
][]
=
array
(
'param'
=>
$value
[
'modelName'
]);
...
...
@@ -311,6 +327,17 @@ class DetailModel
$result
[
'reference'
][
'detail'
][
'list'
][
4
][
'params'
][]
=
array
(
'param'
=>
$value
[
'vitalStatistics'
]);
$result
[
'reference'
][
'detail'
][
'list'
][
5
][
'params'
][]
=
array
(
'param'
=>
$value
[
'fitModelBo'
][
'fit_size'
]);
$result
[
'reference'
][
'detail'
][
'list'
][
6
][
'params'
][]
=
array
(
'param'
=>
$value
[
'fitModelBo'
][
'feel'
]);
if
(
!
empty
(
$value
[
'fitModelBo'
][
'fit_remark'
]))
{
$showRemark
=
true
;
$remarkList
[]
=
array
(
'param'
=>
$value
[
'fitModelBo'
][
'fit_remark'
]);
}
else
{
$remarkList
[]
=
array
(
'param'
=>
''
);
}
}
// 显示模特备注
if
(
$showRemark
)
{
$result
[
'reference'
][
'detail'
][
'list'
][
7
][
'params'
]
=
$remarkList
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
View file @
7c68e97
...
...
@@ -2,6 +2,7 @@
use
Action\AbstractAction
;
use
Plugin\Helpers
;
use
LibModels\Wap\Product\DetailData
;
/**
* 商品详情的控制器
...
...
@@ -126,15 +127,47 @@ class DetailController extends AbstractAction
}
/**
* 我要咨询
* 我要咨询
表单
*/
public
function
consultformAction
()
{
$uid
=
$this
->
getUid
();
if
(
!
$uid
)
{
$this
->
go
(
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
$this
->
server
(
'HTTP_REFERER'
,
'/'
))));
}
$this
->
setTitle
(
'我要咨询'
);
$this
->
setNavHeader
(
'我要咨询'
);
$productId
=
$this
->
get
(
'product_id'
,
0
);
// 渲染模板
$this
->
_view
->
display
(
'consultform'
,
array
(
'consultform'
=>
true
));
$this
->
_view
->
display
(
'consultform'
,
array
(
'consultform'
=>
true
,
'productId'
=>
$productId
,
'formUrl'
=>
Helpers
::
url
(
'/product/detail/consultsubmit'
),
));
}
/**
* 添加咨询操作
*
* @param int product_id 商品ID
* @param string content 咨询内容
* @return json
*/
public
function
consultsubmitAction
()
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'请输入咨询内容'
,
'data'
=>
''
);
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
();
$productId
=
$this
->
post
(
'product_id'
,
0
);
$content
=
$this
->
post
(
'content'
);
$result
=
DetailData
::
addConsult
(
$uid
,
$productId
,
$content
);
}
$this
->
echoJson
(
$result
);
}
/**
...
...
Please
register
or
login
to post a comment