Authored by hf

do maylike and guang opt

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>注册</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<script type="text/javascript">
(function (doc, win) {
var docEl = doc.documentElement;
(function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://static.dev.yohobuy.com/css/index.css">
</head>
<body class=passport-body>
<div class="reg-page passport-page yoho-page">
<div class="header">
<a class="go-back" href=/>
<img src="http://static.dev.yohobuy.com/img/passport/go-back.png">
</a>
<p class="title">注册</p>
</div> <div class="content">
<div class="select-container row">
<span class="select-title">国家和地区</span>
<select id="country-select" class="country-select select in-android-uc">
<option value=+61 >澳大利亚</option>
<option value=+82 >韩国</option>
<option value=+1 >加拿大</option>
<option value=+60 >马来西亚</option>
<option value=+1 >美国</option>
<option value=+81 >日本</option>
<option value=+65 >新加坡</option>
<option value=+44 >英国</option>
<option value=+86 selected>中国</option>
<option value=+853 >中国澳门</option>
<option value=+886 >中国台湾</option>
<option value=+852 >中国香港</option>
</select>
<div class="arrow-right"></div>
</div> <div class="input-container phone-container row has-clear">
<span id="area-code" class="area-code">+86</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<p class="register-tip">YOHO!Family账号可登录YOHO!有货、YOHO!Boys、YOHO!Girls及SHOW</p>
</div>
</div>
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>
seajs.config({
base: 'http://localhost:8000/'
});
</script>
<script>
seajs.use('js/passport/register/register');
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -2,7 +2,6 @@
namespace LibModels\Wap\Guang;
use Api\Sign;
use Api\Yohobuy;
/**
... ... @@ -27,7 +26,7 @@ class OptData
*/
public static function favoriteBrand($uid, $id, $opt = 'ok')
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'toggleBrandFav', array($uid, $id));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id) );
}
/**
... ... @@ -41,48 +40,26 @@ class OptData
public static function favoriteProduct($uid, $skn, $opt = 'ok')
{
if ($opt === 'cancel') {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn) );
} else {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn));
}
}
/**
* 品牌相关资讯点赞/取消赞
*
* @param int $uid 用户ID
* @param int $id 唯一的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function praiseBrandArticle($uid, $id, $opt = 'ok')
{
if ($opt === 'cancel') {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v1/favorite/', 'cancelPraise', array($id, $uid));
} else {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v1/favorite/', 'setPraise', array($id, $uid));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn) );
}
}
/**
* 逛资讯点赞/取消赞
*
* @param int $udid 唯一客户端cookie标识
* @param int $udid 唯一客户端标识
* @param int $id 唯一资讯的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function praiseArticle($udid, $id, $opt = 'ok')
{
$param = Yohobuy::param();
$param['udid'] = $udid;
$param['article_id'] = $id;
$param['client_secret'] = Sign::getSign($param);
if ($opt === 'cancel') {
return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/api/v2/praise/setPraise', $param);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid) );
} else {
return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/api/v2/praise/cancel', $param);
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid) );
}
}
... ...
... ... @@ -36,7 +36,7 @@ class RecomData
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, true);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
... ... @@ -55,7 +55,7 @@ class RecomData
$param['yh_channel'] = '3';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, true);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
... ... @@ -74,7 +74,7 @@ class RecomData
$param['yh_channel'] = '4';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, true);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -64,7 +64,7 @@ class Cache
}
// LINUX
else {
$result = HoodCache::Memcached($node)->set(self::makeKey($key, $node));
$result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));
}
return $result;
... ...
... ... @@ -46,19 +46,18 @@ class Helpers
$result['name'] = $productData['product_name'];
$result['price'] = $productData['market_price'];
$result['salePrice'] = $productData['sales_price'];
$result['isFew'] = ($productData['is_soon_sold_out'] === 'Y');
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
$result['url'] = ''; // @todo
if ($showTags) {
$result['tags'] = array();
$result['tags']['isNew'] = isset($productData['is_new']) && $productData['is_new'] === 'Y'; // 新品
$result['tags']['isSale'] = isset($productData['is_discount']) && $productData['is_discount'] === 'Y'; // 在售
$result['tags']['isLimit'] = isset($productData['is_limited']) && $productData['is_limited'] === 'Y'; // 限量
$result['tags']['isYohood'] = isset($productData['is_yohood']) && $productData['is_yohood'] === 'Y'; // YOHOOD
$result['tags']['is_new'] = isset($productData['is_new']) && $productData['is_new'] === 'Y'; // 新品
$result['tags']['is_discount'] = isset($productData['is_discount']) && $productData['is_discount'] === 'Y'; // 在售
$result['tags']['is_limited'] = isset($productData['is_limited']) && $productData['is_limited'] === 'Y'; // 限量
$result['tags']['is_yohood'] = isset($productData['is_yohood']) && $productData['is_yohood'] === 'Y'; // YOHOOD
$result['tags']['midYear'] = isset($productData['mid-year']) && $productData['mid-year'] === 'Y'; // 年中
$result['tags']['yearEnd'] = isset($productData['year-end']) && $productData['year-end'] === 'Y'; // 年末
$result['tags']['isReNew'] = false; // 再到着
$result['tags']['isNewFestival'] = false; // 新品节
$result['tags']['is_advance'] = isset($productData['is_advance']) && $productData['is_advance'] === 'Y'; // 再到着
}
return $result;
... ... @@ -82,9 +81,9 @@ class Helpers
$result = array();
$result['id'] = $articleData['id'];
$result['showTag'] = $showTag;
$result['showTags'] = $showTag;
$result['img'] = self::getImageUrl($articleData['src'], 640, 640);
$result['url'] = $articleData['url']; // @todo
$result['url'] = '/guang/detail/index?id=' . $articleData['id']; // @todo
$result['title'] = $articleData['title'];
$result['text'] = $articleData['intro'];
$result['publishTime'] = $articleData['publish_time'];
... ...
... ... @@ -115,6 +115,8 @@ class TemplateLayout implements View_Interface
if (is_array($this->_tpl_vars)) {
$tpl_vars = array_merge($this->_tpl_vars, $tpl_vars);
}
// 应用版本号
$tpl_vars['version'] = $config->version;
// 取得模板的最后修改时间戳
$lastModifyTime = filemtime($viewName);
... ...
{{# goods}}
{{> good}}
{{/ goods}}
\ No newline at end of file
... ...
{{# goodsContainer}}
<div class="goods-list {{^show}}hide{{/show}}">
{{# goods}}
{{> good}}
{{/ goods}}
</div>
{{/ goodsContainer}}
\ No newline at end of file
... ...
... ... @@ -37,4 +37,4 @@
{{/price}}
</div>
</div>
</div>
\ No newline at end of file
</div>
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\RecomData;
use Plugin\Helpers;
/**
* 推荐相关的控制器
*/
class RecomController extends AbstractAction
{
/**
* 你可能喜欢的BOYS或GIRLS的商品列表
*
* @param string gender 1,3表示男, 2,3表示女
* @param int page 分页的页码
* @return html
*/
public function maylikeAction()
{
do {
/* 判断是否是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断分页参数是否有效 */
$page = $this->get('page', 1);
if (!is_numeric($page)) {
break;
}
/* 取可能喜欢的数据 */
$recom = array();
$gender = $this->get('gender', '1,3');
// 女
if ($gender === '2,3') {
$recom = RecomData::mayLike('2,3', 2);
}
// 男
else {
$recom = RecomData::mayLike('1,3', 1);
}
/* 判断是否有内容返回 */
if (empty($recom['data']['product_list'])) {
break;
}
/* 构建商品数据 */
$data = array();
foreach ($recom['data']['product_list'] as $value) {
$data['goods'][] = Helpers::formatProduct($value, true);
}
$this->_view->display('maylike', $data);
}
while (false);
echo ' ';
}
/**
* 你可能喜欢的潮童的商品列表
*
* @param int page 分页的页码
* @return html
*/
public function maylikekidsAction()
{
do {
/* 判断是否是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断分页参数是否有效 */
$page = $this->get('page', 1);
if (!is_numeric($page)) {
break;
}
/* 取可能喜欢的数据 */
$recom = RecomData::mayLikeKids();
if (empty($recom['data']['product_list'])) {
break;
}
/* 构建模板需要的商品数据 */
$data = array();
foreach ($recom['data']['product_list'] as $value) {
$data['goods'][] = Helpers::formatProduct($value, true);
}
$this->_view->display('maylike', $data);
}
while (false);
echo ' ';
}
/**
* 你可能喜欢的创意生活的新品到着和人气单品列表
*
* @return html
*/
public function maylikelifeAction()
{
do {
/* 判断是否是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断分页参数是否有效 */
$page = $this->get('page', 1);
if (!is_numeric($page)) {
break;
}
/* 取可能喜欢的数据 */
$recom = RecomData::mayLikeLifestyle();
if (empty($recom['data']['product_list'])) {
break;
}
/* 构建模板需要的商品数据 */
$data = array();
$build = array();
if (!empty($recom['data']['product_list']['top'])) {
$build = array();
$build['show'] = true;
foreach ($recom['data']['product_list']['top'] as $value) {
$build['goods'][] = Helpers::formatProduct($value, true);
}
$data['goodsContainer'][] = $build;
}
if (!empty($recom['data']['product_list']['new'])) {
$build = array();
foreach ($recom['data']['product_list']['new'] as $value) {
$build['show'] = false;
$build['goods'][] = Helpers::formatProduct($value, true);
}
$data['goodsContainer'][] = $build;
}
$this->_view->display('maylikelife', $data);
}
while (false);
echo ' ';
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Guang\OptData;
/**
* 逛操作
*/
class OptController extends AbstractAction
{
/**
* 资讯文章点赞
*
* @param int $id 唯一的资讯ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return json
*/
public function praiseArticleAction()
{
$result = array();
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否有效 */
$id = $this->get('id');
if (!is_numeric($id)) {
break;
}
/* 执行点赞或取消操作 */
$opt = $this->get('opt', 'ok');
$udid = $this->getUdid();
$result = OptData::praiseArticle($udid, $id, $opt);
}
while (false);
$this->echoJson($result);
}
/**
* 品牌收藏
*
* @param int $id 品牌的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return json
*/
public function favoriteBrandAction()
{
$result = array('code' => 400, 'message' => '未登录', 'data' => false);
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否有效 */
$id = $this->get('id');
if (!is_numeric($id)) {
break;
}
/* 检查用户是否登录 */
$uid = $this->getUid();
if (!$uid) {
break;
}
/* 执行点赞或取消操作 */
$opt = $this->get('opt', 'ok');
$status = OptData::favoriteBrand($uid, $id, $opt);
if (!$status) {
break;
}
$result = array('code' => 200, 'message' => '收藏成功', 'data' => $status);
}
while (false);
$this->echoJson($result);
}
}
... ...
... ... @@ -47,4 +47,7 @@ application.template.partials = ROOT_PATH "/template/m.yohobuy.com/partials"
application.template.ext = ".phtml"
;静态HTML页面的存放目录, 该目录需要有读写权限
application.assets.path = ROOT_PATH "/assets"
\ No newline at end of file
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.1"
\ No newline at end of file
... ...
... ... @@ -47,4 +47,7 @@ application.template.partials = ROOT_PATH "/template/m.yohobuy.com/partials"
application.template.ext = ".phtml"
;静态HTML页面的存放目录, 该目录需要有读写权限
application.assets.path = ROOT_PATH "/assets"
\ No newline at end of file
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.1"
\ No newline at end of file
... ...
... ... @@ -47,4 +47,7 @@ application.template.partials = ROOT_PATH "/template/m.yohobuy.com/partials"
application.template.ext = ".phtml"
;静态HTML页面的存放目录, 该目录需要有读写权限
application.assets.path = ROOT_PATH "/assets"
\ No newline at end of file
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.1"
\ No newline at end of file
... ...