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
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
1f93e88ef2f8cc66f7a077bd164af7b1d001c715
2 parents
704265f9
42f2e1e3
do merge develop code
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
186 additions
and
47 deletions
library/Api/Yohobuy.php
library/LibModels/Wap/Home/GuangData.php
library/LibModels/Wap/Home/OnlineData.php
static/sass/me/_home.scss
template/m.yohobuy.com/actions/index/home/index.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Home/Guang.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
yohobuy/m.yohobuy.com/application/models/home/Online.php
library/Api/Yohobuy.php
View file @
1f93e88
...
...
@@ -16,7 +16,7 @@ use Plugin\Cache;
class
Yohobuy
{
// /* 正式环境 */
// const API_URL = 'http://api2.open.yohobuy.com/';
// const API_URL2 = 'http://api.open.yohobuy.com/';
...
...
@@ -30,7 +30,6 @@ class Yohobuy
const
API_URL_MYCENTER
=
'http://192.168.102.213:8080/api-gateway-web/'
;
// 我的个人中心接口URL
const
API_URL_SHOPINGCART
=
'http://192.168.102.213:8080/api-gateway-web/'
;
// 我的购物车接口URL
/**
* 私钥列表
*
...
...
library/LibModels/Wap/Home/GuangData.php
0 → 100644
View file @
1f93e88
<?php
namespace
LibModels\Wap\Home
;
use
Api\Sign
;
use
Api\Yohobuy
;
/**
* 我的逛数据模型
*
* @name GuangData
* @package LibModels/Wap/Home
* @copyright yoho.inc
* @version 1.0 (2015-11-13)
* @author xiaowei
*/
class
GuangData
{
const
GUANG_URI
=
'guang/api/v1/favorite/'
;
//我的guang
public
static
function
getGuangInfo
(
$uid
,
$page
,
$yh_channel
=
1
,
$gender
=
'1,3'
,
$limit
=
10
)
{
$param
=
Yohobuy
::
param
();
$param
[
'uid'
]
=
$uid
;
$param
[
'page'
]
=
$page
;
$param
[
'gender'
]
=
$gender
;
$param
[
'limit'
]
=
$limit
;
$param
[
'yh_channel'
]
=
$yh_channel
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
// return Yohobuy::post(Yohobuy::API_URL, $param);
return
Yohobuy
::
post
(
Yohobuy
::
SERVICE_URL
.
self
::
GUANG_URI
.
'getUserFavArticleList'
,
$param
);
}
}
...
...
library/LibModels/Wap/Home/OnlineData.php
View file @
1f93e88
...
...
@@ -2,7 +2,6 @@
namespace
LibModels\Wap\Home
;
use
Api\Sign
;
use
Api\Yohobuy
;
/**
...
...
@@ -18,16 +17,23 @@ class OnlineData
{
const
ONLINE_URI
=
'operations/api/v1/help/'
;
//获取帮助列表(分类)
/*
* 获取帮助列表(分类),缓存1h
* clientType客户端
*/
public
static
function
getOnlineServiceInfo
(
$clientType
=
'iphone'
)
{
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
ONLINE_URI
.
'getCategory'
,
array
(
'client_type'
=>
$clientType
));
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
ONLINE_URI
.
'getCategory'
,
array
(
'client_type'
=>
$clientType
)
,
3600
);
}
//获取问题详情
/*
* 获取问题详情,缓存1h
* cateId问题分类ID
* 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
));
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
ONLINE_URI
.
'getHelp'
,
array
(
'category_id'
=>
$cateId
,
'client_type'
=>
$clientType
)
,
3600
);
}
}
...
...
static/sass/me/_home.scss
View file @
1f93e88
...
...
@@ -2,6 +2,7 @@
background
:
#f0f0f0
;
.user-info
{
display
:
block
;
position
:
relative
;
padding
:
0
pxToRem
(
30px
);
color
:
#fff
;
...
...
template/m.yohobuy.com/actions/index/home/index.phtml
View file @
1f93e88
{
{>
layout/header
}
}
<div
class=
"my-page yoho-page"
>
<div
class=
"my-header"
>
<
div
class=
"user-info"
><!--/home/personaldetails--
>
<
a
class=
"user-info"
href=
"/home/personaldetails"
>
<img
class=
"user-avatar"
src=
"{{head_ico}}"
>
<span
class=
"username"
>
{
{profile_name
}
}</span>
{
{#vip_info
}
}
<span
class=
"vip-icon vip-{{next_level}}"
></span>
{
{/vip_info
}
}
<div
class=
"iconfont more-icon"
>
604
;</div>
</
div
>
</
a
>
</div>
<div
class=
"my-link clearfix"
>
<a
class=
"link-item"
href=
"/home/favorite"
>
{
{product_favorite_total
}
}
<p>收藏的商品</p>
</a>
<a
class=
"link-item"
href=
"/home/favoritebrand"
>
<a
class=
"link-item"
href=
"/home/favorite
?tab=
brand"
>
{
{brand_favorite_total
}
}
<p>收藏的品牌</p>
</a>
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
1f93e88
...
...
@@ -68,20 +68,26 @@ class HomeController extends AbstractAction
$this
->
setTitle
(
'我的收藏'
);
$this
->
setNavHeader
(
'我的收藏'
,
true
,
SITE_MAIN
);
$tab
=
$this
->
get
(
'tab'
,
''
);
$uid
=
$this
->
getUid
();
$uid
=
8826435
;
$gender
=
Helpers
::
getGenderByCookie
();
$favProducts
=
\Index\UserModel
::
getFavProductData
(
$uid
);
$favBrands
=
\Index\UserModel
::
getFavBrandData
(
$uid
,
$gender
);
$this
->
_view
->
display
(
'favorite'
,
array
(
'favPage'
=>
true
,
//加载js
'pageFooter'
=>
true
,
'favorite'
=>
true
,
'hasFavProduct'
=>
$favProducts
,
'hasFavBrand'
=>
$favBrands
));
$data
=
array
(
'favPage'
=>
true
,
//加载js
'pageFooter'
=>
true
,
'favorite'
=>
true
,
'hasFavProduct'
=>
$favProducts
,
'hasFavBrand'
=>
$favBrands
);
// 判断时候为品牌页
if
(
$tab
===
'brand'
)
{
$data
[
'brandTab'
]
=
true
;
}
$this
->
_view
->
display
(
'favorite'
,
$data
);
}
/**
...
...
@@ -106,19 +112,6 @@ class HomeController extends AbstractAction
}
/**
* 用户收藏的品牌
*/
public
function
favoritebrandAction
()
{
$uid
=
$this
->
getUid
();
$gender
=
Helpers
::
getGenderByCookie
();
$favBrands
=
\Index\UserModel
::
getFavBrandData
(
$uid
,
$gender
);
print_r
(
$favBrands
);
}
/**
* 个人信息
*/
public
function
personalDetailsAction
()
...
...
@@ -314,7 +307,14 @@ class HomeController extends AbstractAction
*/
public
function
myGuangAction
()
{
echo
'My Guang'
;
$page
=
$this
->
get
(
'page'
,
1
);
$limit
=
$this
->
get
(
'limit'
,
10
);
$uid
=
$this
->
getUid
();
$yh_channel
=
Helpers
::
getChannelByCookie
();
$uid
=
5687179
;
$gender
=
Helpers
::
getGenderByCookie
();
$guangInfo
=
\home\GuangModel
::
getMyGuang
(
$uid
,
$page
,
$yh_channel
,
$gender
,
$limit
);
$this
->
_view
->
display
(
'my-guang'
,
array
(
'myGuang'
=>
$guangInfo
));
}
/**
...
...
yohobuy/m.yohobuy.com/application/models/Home/Guang.php
0 → 100644
View file @
1f93e88
<?php
namespace
Home
;
use
LibModels\Wap\Home\GuangData
;
use
Action\AbstractAction
;
use
Plugin\Helpers
;
/**
* 我的逛数据处理
*/
class
GuangModel
{
//获取我的逛列表
public
static
function
getMyGuang
(
$uid
,
$page
,
$yh_channel
=
1
,
$gender
=
'1,3'
,
$limit
=
10
)
{
$result
=
array
();
//调用接口获取数据
$res
=
GuangData
::
getGuangInfo
(
$uid
,
$page
,
$yh_channel
,
$gender
,
$limit
);
$guangInfo
=
$res
[
'data'
][
'data'
];
if
(
$guangInfo
)
{
foreach
(
$guangInfo
as
$k
=>
$v
)
{
$result
[
$k
][
'id'
]
=
$v
[
'id'
];
$result
[
$k
][
'author'
]
=
$v
[
'author'
];
$tag
=
self
::
getTag
(
TRUE
,
intval
(
$v
[
'category_id'
]));
$result
[
$k
][
'url'
]
=
$v
[
'url'
];
$result
[
$k
][
'img'
]
=
$v
[
'src'
];
$result
[
$k
][
'title'
]
=
$v
[
'title'
];
$result
[
$k
][
'text'
]
=
$v
[
'intro'
];
$result
[
$k
][
'pageView'
]
=
$v
[
'views_num'
];
$result
[
$k
][
'publish_time'
]
=
$v
[
'publish_time'
];
$like
=
(
$v
[
'isPraise'
]
==
"Y"
)
?
true
:
false
;
$collect
=
(
$v
[
'isFavor'
]
==
"Y"
)
?
true
:
false
;
$result
[
$k
][
'like'
]
=
array
(
'isLiked'
=>
$like
,
'count'
=>
$v
[
'praise_num'
]);
$result
[
$k
][
'collect'
]
=
array
(
'isCollected'
=>
$collect
,
'url'
=>
$v
[
'url'
]);
$result
[
$k
]
+=
$tag
;
$result
[
$k
][
'share'
]
=
$v
[
'url'
];
}
}
return
$result
;
}
//【标签】isTip-小贴士;isCollocation-搭配 isFashionMan-潮人 isFashionGood-潮品 isTopic-话题
private
static
function
getTag
(
$isShow
,
$tagId
)
{
$ret
[
'showTags'
]
=
$isShow
;
$ret
[
'isTopic'
]
=
false
;
$ret
[
'isCollocation'
]
=
false
;
$ret
[
'isFashionMan'
]
=
false
;
$ret
[
'isFashionGood'
]
=
false
;
$ret
[
'isTip'
]
=
false
;
switch
(
$tagId
)
{
case
1
:
$ret
[
'isTopic'
]
=
true
;
break
;
case
2
:
$ret
[
'isCollocation'
]
=
true
;
break
;
case
3
:
$ret
[
'isFashionMan'
]
=
true
;
break
;
case
4
:
$ret
[
'isFashionGood'
]
=
true
;
break
;
case
5
:
$ret
[
'isTip'
]
=
true
;
break
;
default
:
$ret
[
'showTags'
]
=
FALSE
;
break
;
}
return
$ret
;
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
1f93e88
...
...
@@ -157,12 +157,13 @@ class UserModel
$product
=
array
();
foreach
(
$favProduct
[
'data'
][
'product_list'
]
as
$val
)
{
$product
=
array
();
$product
[
'fav_id'
]
=
$val
[
'product_id'
];
$product
[
'imgUrl'
]
=
$val
[
'image'
];
$product
[
'title'
]
=
$val
[
'product_name'
];
$product
[
'price'
]
=
'¥'
.
$val
[
'market_price'
];
$product
[
'discountPrice'
]
=
'¥'
.
$val
[
'sales_price'
]
;
$product
[
'discountPrice'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
'¥'
.
$val
[
'sales_price'
]
:
false
;
$product
[
'savePrice'
]
=
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
]
>
0
)
?
'¥'
.
(
$val
[
'market_price'
]
-
$val
[
'sales_price'
])
:
false
;
$product
[
'sellOut'
]
=
boolval
(
$val
[
'price_down'
]);
$product
[
'sellOut'
]
=
(
bool
)
(
$val
[
'price_down'
]);
$result
[]
=
$product
;
}
...
...
@@ -432,7 +433,7 @@ class UserModel
$one
[
'imgUrl'
]
=
Helpers
::
getImageUrl
(
$val
[
'cover_image'
],
640
,
240
);
$one
[
'title'
]
=
$val
[
'filter_content'
];
$one
[
'content'
]
=
$val
[
'reply_content'
];
$one
[
'good'
]
=
boolval
(
$val
[
'is_reliable'
]);
$one
[
'good'
]
=
(
bool
)
(
$val
[
'is_reliable'
]);
$one
[
'bad'
]
=
!
$one
[
'good'
];
$result
[]
=
$one
;
...
...
yohobuy/m.yohobuy.com/application/models/home/Online.php
View file @
1f93e88
...
...
@@ -11,7 +11,10 @@ use Plugin\Helpers;
class
OnlineModel
{
//获取在线帮助分类
/*
* 获取在线帮助分类
* $clientType客户端类型
*/
public
static
function
getOnlineServiceInfo
(
$clientType
=
'iphone'
)
{
//调用接口获取数据
...
...
@@ -19,10 +22,13 @@ class OnlineModel
$cateInfo
=
$res
[
'data'
];
$question
=
array
();
$tab
=
array
();
if
(
$cateInfo
)
{
foreach
(
$cateInfo
as
$key
=>
$value
)
{
if
(
$cateInfo
)
{
foreach
(
$cateInfo
as
$key
=>
$value
)
{
//强制截成3个tab
if
(
$key
>
2
)
{
if
(
$key
>
2
)
{
break
;
}
$tab
[
$key
][
'tabid'
]
=
'tab'
.
$value
[
'id'
];
...
...
@@ -33,10 +39,12 @@ class OnlineModel
$question
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$sub
=
$value
[
'sub'
];
$qTmp
=
array
();
if
(
$sub
)
{
foreach
(
$sub
as
$sk
=>
$sv
)
{
if
(
$sub
)
{
foreach
(
$sub
as
$sk
=>
$sv
)
{
$qTmp
[
$sk
][
'title'
]
=
$sv
[
'category_name'
];
$qTmp
[
$sk
][
'link'
]
=
'/home/onlineservicedetail?cateId='
.
$sv
[
'id'
]
.
'&cateName='
.
$sv
[
'category_name'
]
;
$qTmp
[
$sk
][
'link'
]
=
Helpers
::
url
(
'/home/onlineservicedetail'
,
array
(
'cateId'
=>
$sv
[
'id'
],
'cateName'
=>
$sv
[
'category_name'
]))
;
}
}
$question
[
$key
][
'list'
]
=
$qTmp
;
...
...
@@ -54,19 +62,27 @@ class OnlineModel
return
$result
;
}
//加载分类下的问题和解决方法
/*
* 加载分类下的问题和解决方法
* cateId问题分类ID
* clientType客户端
*/
public
static
function
getOnlineServiceDetail
(
$cateId
,
$clinetType
=
'iphone'
)
{
$result
=
array
();
if
(
!
$cateId
)
{
if
(
!
$cateId
)
{
return
$result
;
}
$res
=
OnlineData
::
getOnlineServiceDetail
(
$cateId
,
$clinetType
);
$questionInfo
=
$res
[
'data'
];
if
(
$questionInfo
)
{
if
(
$questionInfo
)
{
$list
=
array
();
if
(
$questionInfo
)
{
foreach
(
$questionInfo
as
$qk
=>
$qv
)
{
if
(
$questionInfo
)
{
foreach
(
$questionInfo
as
$qk
=>
$qv
)
{
$list
[
$qk
][
'q'
]
=
$qv
[
'title'
];
$list
[
$qk
][
'a'
]
=
$qv
[
'content'
];
}
...
...
Please
register
or
login
to post a comment