Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
14 changed files
with
256 additions
and
178 deletions
@@ -18,7 +18,7 @@ class BrandData | @@ -18,7 +18,7 @@ class BrandData | ||
18 | { | 18 | { |
19 | 19 | ||
20 | const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get'; | 20 | const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get'; |
21 | - const URL_BRAND_LOGO = '/shops/service/v1/brand'; | 21 | + const URL_BRAND_LOGO = '/cmsproduct/service/v1/brands'; |
22 | const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands'; | 22 | const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands'; |
23 | const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent'; | 23 | const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent'; |
24 | 24 | ||
@@ -76,9 +76,9 @@ class BrandData | @@ -76,9 +76,9 @@ class BrandData | ||
76 | * @param int $domain 品牌domain | 76 | * @param int $domain 品牌domain |
77 | * @return array | 77 | * @return array |
78 | */ | 78 | */ |
79 | - public static function getBrandLogoByDomain($domain) | 79 | + public static function getBrandLogoByDomain($domain, $fields = 'less') |
80 | { | 80 | { |
81 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain)); | 81 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain, $fields)); |
82 | } | 82 | } |
83 | 83 | ||
84 | /** | 84 | /** |
@@ -9,7 +9,7 @@ use Api\Yohobuy; | @@ -9,7 +9,7 @@ use Api\Yohobuy; | ||
9 | */ | 9 | */ |
10 | class HotrankData extends \LibModels\Wap\Product\SearchData | 10 | class HotrankData extends \LibModels\Wap\Product\SearchData |
11 | { | 11 | { |
12 | - const URI_HOTRANK_TAG = 'http://test.service.api.yohobuy.com/operations/service/v1/hotranktag'; | 12 | + const URI_HOTRANK_TAG = 'operations/service/v1/hotranktag'; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * 获取标签 | 15 | * 获取标签 |
@@ -19,7 +19,7 @@ class HotrankData extends \LibModels\Wap\Product\SearchData | @@ -19,7 +19,7 @@ class HotrankData extends \LibModels\Wap\Product\SearchData | ||
19 | public static function getHotranktag($client_type = 'web',$channel = 0,$is_concurrent = true) | 19 | public static function getHotranktag($client_type = 'web',$channel = 0,$is_concurrent = true) |
20 | { | 20 | { |
21 | $params = array('client_type'=>$client_type,'channel'=>$channel,'is_concurrent' => $is_concurrent); | 21 | $params = array('client_type'=>$client_type,'channel'=>$channel,'is_concurrent' => $is_concurrent); |
22 | - return Yohobuy::yarClient(self::URI_HOTRANK_TAG, 'getTag',$params); | 22 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, 'getTag',$params); |
23 | } | 23 | } |
24 | 24 | ||
25 | /** | 25 | /** |
@@ -29,6 +29,6 @@ class HotrankData extends \LibModels\Wap\Product\SearchData | @@ -29,6 +29,6 @@ class HotrankData extends \LibModels\Wap\Product\SearchData | ||
29 | public static function getTagById($id,$is_concurrent = true) | 29 | public static function getTagById($id,$is_concurrent = true) |
30 | { | 30 | { |
31 | $params['id'] = $id; | 31 | $params['id'] = $id; |
32 | - return Yohobuy::yarClient(self::URI_HOTRANK_TAG, 'getOneTag',$params); | 32 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, 'getOneTag',$params); |
33 | } | 33 | } |
34 | } | 34 | } |
@@ -83,7 +83,7 @@ class HelperSearch | @@ -83,7 +83,7 @@ class HelperSearch | ||
83 | //一周新品上架 | 83 | //一周新品上架 |
84 | $result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array(); | 84 | $result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array(); |
85 | //品牌banner | 85 | //品牌banner |
86 | - $result['brandBanner'] = isset($data['banner']) && isset($data['brand']) ? self::getBannerFormat($data['banner'],$data['brand']) : array(); | 86 | + $result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array(); |
87 | //总记录数 | 87 | //总记录数 |
88 | $result['totalCount'] = $data['product']['total']; | 88 | $result['totalCount'] = $data['product']['total']; |
89 | //品牌店铺信息 | 89 | //品牌店铺信息 |
@@ -1248,19 +1248,6 @@ class HelperSearch | @@ -1248,19 +1248,6 @@ class HelperSearch | ||
1248 | return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | 1248 | return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | - /** | ||
1252 | - * 并行调接口url获取(获取品牌banner数据) | ||
1253 | - */ | ||
1254 | - public static function getBannerUrl($customOptions = array()) | ||
1255 | - { | ||
1256 | - // 构建必传参数 | ||
1257 | - $param = Yohobuy::param(); | ||
1258 | - $param['brand_id'] = $customOptions['brandId']; | ||
1259 | - $param['method'] = 'app.brand.banner'; | ||
1260 | - $param['client_secret'] = Sign::getSign($param); | ||
1261 | - | ||
1262 | - return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
1263 | - } | ||
1264 | 1251 | ||
1265 | 1252 | ||
1266 | /** | 1253 | /** |
@@ -1278,13 +1265,12 @@ class HelperSearch | @@ -1278,13 +1265,12 @@ class HelperSearch | ||
1278 | * | 1265 | * |
1279 | * @return array 品牌banner条数据 | 1266 | * @return array 品牌banner条数据 |
1280 | */ | 1267 | */ |
1281 | - public static function getBannerFormat($banner, $brand) | 1268 | + public static function getBannerFormat($brand, $brandBanner) |
1282 | { | 1269 | { |
1283 | // 根据品牌Id获取品牌banner图 | 1270 | // 根据品牌Id获取品牌banner图 |
1284 | - if (isset($banner['banner'])) { | ||
1285 | - $bannerImg = Helpers::getImageUrl($banner['banner'], '', 150); | ||
1286 | - } | ||
1287 | - | 1271 | + $bannerImg = Helpers::getImageUrl($brandBanner, '', 150); |
1272 | + $brandHome = Helpers::url('/product/index/brand', '', $brand['brand_domain']); | ||
1273 | + $brandIntro = Helpers::url('/product/index/brandIntro', '', $brand['brand_domain']); | ||
1288 | $is_favorite = false; | 1274 | $is_favorite = false; |
1289 | if(isset($brand['is_favorite'])){ | 1275 | if(isset($brand['is_favorite'])){ |
1290 | // 获取是否收藏 | 1276 | // 获取是否收藏 |
@@ -1299,7 +1285,9 @@ class HelperSearch | @@ -1299,7 +1285,9 @@ class HelperSearch | ||
1299 | return array( | 1285 | return array( |
1300 | 'bannerHeight' => '150', | 1286 | 'bannerHeight' => '150', |
1301 | 'coled' => $is_favorite, | 1287 | 'coled' => $is_favorite, |
1302 | - 'banner' => $bannerImg | 1288 | + 'banner' => $bannerImg, |
1289 | + 'brandHome' => $brandHome, | ||
1290 | + 'brandIntro' => $brandIntro | ||
1303 | ); | 1291 | ); |
1304 | } | 1292 | } |
1305 | 1293 |
@@ -25,9 +25,9 @@ | @@ -25,9 +25,9 @@ | ||
25 | <div class="center-content clearfix"> | 25 | <div class="center-content clearfix"> |
26 | {{> layout/path-nav}} | 26 | {{> layout/path-nav}} |
27 | 27 | ||
28 | - {{# brandAbout}} | 28 | + {{#if brandAbout}} |
29 | <div class="brand-about"> | 29 | <div class="brand-about"> |
30 | - {{{brandIntro}}} | 30 | + {{{brandAbout}}} |
31 | </div> | 31 | </div> |
32 | {{^}} | 32 | {{^}} |
33 | <div class="list-left pull-left"> | 33 | <div class="list-left pull-left"> |
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | 54 | ||
55 | {{> product/latest-walk}} | 55 | {{> product/latest-walk}} |
56 | </div> | 56 | </div> |
57 | - {{/ brandAbout}} | 57 | + {{/if}} |
58 | </div> | 58 | </div> |
59 | {{/ list}} | 59 | {{/ list}} |
60 | </div> | 60 | </div> |
@@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract | @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract | ||
71 | $controller = 'Index'; | 71 | $controller = 'Index'; |
72 | $action = 'Index'; | 72 | $action = 'Index'; |
73 | // 二级域名 | 73 | // 二级域名 |
74 | - if (2 === $level) { | 74 | + if (3 === $level) { |
75 | $url = strtolower($dispatcher->getRequest()->getRequestUri()); | 75 | $url = strtolower($dispatcher->getRequest()->getRequestUri()); |
76 | if(empty($url) || $url == '/index' || $url == '/') { | 76 | if(empty($url) || $url == '/index' || $url == '/') { |
77 | $urlAction = '/index'; | 77 | $urlAction = '/index'; |
@@ -159,5 +159,68 @@ class CommonController extends WebAction | @@ -159,5 +159,68 @@ class CommonController extends WebAction | ||
159 | return $this->helpJsonCallbackResult($callback, 403, '意见反馈失败', ''); | 159 | return $this->helpJsonCallbackResult($callback, 403, '意见反馈失败', ''); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | - | 162 | + |
163 | + /* | ||
164 | + * 简单头部 | ||
165 | + */ | ||
166 | + | ||
167 | + public function getSimpleHeaderAction() | ||
168 | + { | ||
169 | + $result = array(); | ||
170 | + do { | ||
171 | + /* 判断是不是AJAX请求 */ | ||
172 | + if (!$this->isAjax()) { | ||
173 | + break; | ||
174 | + } | ||
175 | + | ||
176 | + //获取用户 | ||
177 | + $uid = $this->getUid(true); | ||
178 | + if (!$uid) { | ||
179 | + $isLogin = false; | ||
180 | + $username = ''; | ||
181 | + } | ||
182 | + else { | ||
183 | + $isLogin = true; | ||
184 | + $username = $this->_uname; | ||
185 | + } | ||
186 | + //拼接简单头部 | ||
187 | + $tool = array( | ||
188 | + 'favorite' => Helpers::url('/home/favorite?t=' . time()), //我的收藏链接 | ||
189 | + 'coupon' => Helpers::url('/home/coupons?t=' . time()), //我的优惠券链接 | ||
190 | + 'order' => Helpers::url('/home/orders?t=' . time()), //订单中心连接 | ||
191 | + 'help' => Helpers::url('/help'), | ||
192 | + ); | ||
193 | + if ($isLogin) { | ||
194 | + $tool+=array( | ||
195 | + 'user' => $username, | ||
196 | + 'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接 | ||
197 | + 'logout' => Helpers::url('/logout.html?t=' . time()), //退出 | ||
198 | + ); | ||
199 | + } | ||
200 | + else { | ||
201 | + $tool+=array( | ||
202 | + 'login' => Helpers::url('/signin.html'), //登录链接,已登录不传 | ||
203 | + 'register' => Helpers::url('/reg.html'), //注册链接,已登录不传 | ||
204 | + ); | ||
205 | + } | ||
206 | + | ||
207 | + $simpleHeader = array( | ||
208 | + 'user' => $username, | ||
209 | + 'href' => $tool, | ||
210 | + 'logo' => array( | ||
211 | + 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png', | ||
212 | + 'url' => SITE_MAIN | ||
213 | + ), | ||
214 | + ); | ||
215 | + | ||
216 | + $result = array( | ||
217 | + 'code' => 200, | ||
218 | + 'data' => $simpleHeader | ||
219 | + ); | ||
220 | + } | ||
221 | + while (false); | ||
222 | + | ||
223 | + $this->echoJson($result); | ||
224 | + } | ||
225 | + | ||
163 | } | 226 | } |
@@ -20,26 +20,27 @@ use Plugin\Captcha; | @@ -20,26 +20,27 @@ use Plugin\Captcha; | ||
20 | class PassportModel | 20 | class PassportModel |
21 | { | 21 | { |
22 | 22 | ||
23 | - const REGISTER_LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064';//注册左边的banner | ||
24 | - const BACK_LFFT_BANNER_CODE = '3bbaf502c447a2ddad60879042e286d8';//找回密码左边的banner | ||
25 | - const SIGNIN_LEFT_BANNER_CODE ='db350894e01e90eac55cd3a13ad77331';//登录页左边的banner | ||
26 | - const AUTOUSERINFO_LEFT_BANNER_CODE ='c62d5da06d843b6ed78d8d27e87fa143';//完善信息页左边的banner | 23 | + const REGISTER_LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064'; //注册左边的banner |
24 | + const BACK_LFFT_BANNER_CODE = '3bbaf502c447a2ddad60879042e286d8'; //找回密码左边的banner | ||
25 | + const SIGNIN_LEFT_BANNER_CODE = 'db350894e01e90eac55cd3a13ad77331'; //登录页左边的banner | ||
26 | + const AUTOUSERINFO_LEFT_BANNER_CODE = 'c62d5da06d843b6ed78d8d27e87fa143'; //完善信息页左边的banner | ||
27 | const BACK_FIND_SECRET_KEY = '_+@#$%^'; | 27 | const BACK_FIND_SECRET_KEY = '_+@#$%^'; |
28 | - | 28 | + |
29 | //简单头部 | 29 | //简单头部 |
30 | public static function getSimpleHeader($isLogin, $username = '') | 30 | public static function getSimpleHeader($isLogin, $username = '') |
31 | { | 31 | { |
32 | + //拼接简单头部 | ||
32 | $tool = array( | 33 | $tool = array( |
33 | - 'favoriteHref' => Helpers::url('/home/favorite/index'), //我的收藏链接 | ||
34 | - 'couponHref' => Helpers::url('/home/coupons/index'), //我的优惠券链接 | ||
35 | - 'orderHref' => Helpers::url('/home/orders/index'), //订单中心连接 | 34 | + 'favoriteHref' => Helpers::url('/home/favorite?t=' . time()), //我的收藏链接 |
35 | + 'couponHref' => Helpers::url('/home/coupons?t=' . time()), //我的优惠券链接 | ||
36 | + 'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接 | ||
36 | 'helpHref' => Helpers::url('/help'), | 37 | 'helpHref' => Helpers::url('/help'), |
37 | ); | 38 | ); |
38 | if ($isLogin) { | 39 | if ($isLogin) { |
39 | $tool+=array( | 40 | $tool+=array( |
40 | 'user' => $username, | 41 | 'user' => $username, |
41 | - 'userCenter' => Helpers::url('/home/index'), //用户中心链接 | ||
42 | - 'logoutHref' => Helpers::url('/passport/signout/index'), //退出 | 42 | + 'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接 |
43 | + 'logoutHref' => Helpers::url('/logout.html?t=' . time()), //退出 | ||
43 | ); | 44 | ); |
44 | } | 45 | } |
45 | else { | 46 | else { |
@@ -68,13 +69,13 @@ class PassportModel | @@ -68,13 +69,13 @@ class PassportModel | ||
68 | */ | 69 | */ |
69 | public static function getLeftBanner($code) | 70 | public static function getLeftBanner($code) |
70 | { | 71 | { |
71 | - $ret = array('img'=>'','url'=>''); | 72 | + $ret = array('img' => '', 'url' => ''); |
72 | $resource = IndexData::getResourceData($code); | 73 | $resource = IndexData::getResourceData($code); |
73 | - if(isset($resource['data'][0])) | ||
74 | - { | ||
75 | - if($resource['data'][0]['template_name'] == 'single_image') { | 74 | + if (isset($resource['data'][0])) { |
75 | + if ($resource['data'][0]['template_name'] == 'single_image') { | ||
76 | $val = current($resource['data'][0]['data']); | 76 | $val = current($resource['data'][0]['data']); |
77 | - } else if($resource['data'][0]['template_name'] == 'single_name_image') { | 77 | + } |
78 | + else if ($resource['data'][0]['template_name'] == 'single_name_image') { | ||
78 | $val = $resource['data'][0]['data']; | 79 | $val = $resource['data'][0]['data']; |
79 | } | 80 | } |
80 | $ret['img'] = Images::getImageUrl($val['src'], 252, 190); | 81 | $ret['img'] = Images::getImageUrl($val['src'], 252, 190); |
@@ -86,7 +87,7 @@ class PassportModel | @@ -86,7 +87,7 @@ class PassportModel | ||
86 | } | 87 | } |
87 | return $ret; | 88 | return $ret; |
88 | } | 89 | } |
89 | - | 90 | + |
90 | /** | 91 | /** |
91 | * 校验验证码 | 92 | * 校验验证码 |
92 | * | 93 | * |
@@ -98,12 +99,12 @@ class PassportModel | @@ -98,12 +99,12 @@ class PassportModel | ||
98 | $verifyCode = strtolower($verifyCode); | 99 | $verifyCode = strtolower($verifyCode); |
99 | $ret = true; | 100 | $ret = true; |
100 | //检测验证码不正确 | 101 | //检测验证码不正确 |
101 | - if($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) { | 102 | + if ($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) { |
102 | $ret = false; | 103 | $ret = false; |
103 | } | 104 | } |
104 | return $ret; | 105 | return $ret; |
105 | } | 106 | } |
106 | - | 107 | + |
107 | /** | 108 | /** |
108 | * 根据手机号获取用户信息 | 109 | * 根据手机号获取用户信息 |
109 | * | 110 | * |
@@ -111,31 +112,34 @@ class PassportModel | @@ -111,31 +112,34 @@ class PassportModel | ||
111 | * @param string $mobile | 112 | * @param string $mobile |
112 | * @return array | 113 | * @return array |
113 | */ | 114 | */ |
114 | - public static function getUserInfoByMobile($area, $mobile) { | 115 | + public static function getUserInfoByMobile($area, $mobile) |
116 | + { | ||
115 | $ret = array(); | 117 | $ret = array(); |
116 | $data = UserData::getUserInfoByMobile($area, $mobile); | 118 | $data = UserData::getUserInfoByMobile($area, $mobile); |
117 | - if($data['code'] == 200) { | ||
118 | - if(!empty($data['data'])) { | 119 | + if ($data['code'] == 200) { |
120 | + if (!empty($data['data'])) { | ||
119 | $ret = current($data['data']); | 121 | $ret = current($data['data']); |
120 | } | 122 | } |
121 | } | 123 | } |
122 | return $ret; | 124 | return $ret; |
123 | } | 125 | } |
124 | - | 126 | + |
125 | /** | 127 | /** |
126 | * 根据邮箱获取用户信息 | 128 | * 根据邮箱获取用户信息 |
127 | * | 129 | * |
128 | * @param string $email | 130 | * @param string $email |
129 | * @return array | 131 | * @return array |
130 | */ | 132 | */ |
131 | - public static function getUserInfoByEmail($email) { | 133 | + public static function getUserInfoByEmail($email) |
134 | + { | ||
132 | $ret = array(); | 135 | $ret = array(); |
133 | $data = UserData::getUserInfoByEmail($email); | 136 | $data = UserData::getUserInfoByEmail($email); |
134 | - if($data['code'] == 200) { | ||
135 | - if(!empty($data['data'])) { | 137 | + if ($data['code'] == 200) { |
138 | + if (!empty($data['data'])) { | ||
136 | $ret = current($data['data']); | 139 | $ret = current($data['data']); |
137 | } | 140 | } |
138 | } | 141 | } |
139 | return $ret; | 142 | return $ret; |
140 | } | 143 | } |
144 | + | ||
141 | } | 145 | } |
@@ -38,7 +38,7 @@ class BrandsModel | @@ -38,7 +38,7 @@ class BrandsModel | ||
38 | $adNav = self::getAdNav($options['brandId']); | 38 | $adNav = self::getAdNav($options['brandId']); |
39 | $data['leftContent'][] = array('picLink' => $adNav); | 39 | $data['leftContent'][] = array('picLink' => $adNav); |
40 | 40 | ||
41 | - //获取静态内容(eg:20141219-100447) | 41 | + //获取静态内容 |
42 | if ($options['node']) { | 42 | if ($options['node']) { |
43 | $nodeContent = HelperSearch::formatNodeContent($options['node']); | 43 | $nodeContent = HelperSearch::formatNodeContent($options['node']); |
44 | $data['leftContent'][]['picLink']['list'] = $nodeContent; | 44 | $data['leftContent'][]['picLink']['list'] = $nodeContent; |
@@ -46,7 +46,44 @@ class BrandsModel | @@ -46,7 +46,44 @@ class BrandsModel | ||
46 | 46 | ||
47 | return $data; | 47 | return $data; |
48 | } | 48 | } |
49 | - | 49 | + |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + /** | ||
55 | + * 品牌介绍页 | ||
56 | + * @param array $customCondition | ||
57 | + * @param array $customOptions | ||
58 | + * @return array | ||
59 | + */ | ||
60 | + public static function getBrandIntro($customCondition = array(), $customOptions = array()) | ||
61 | + { | ||
62 | + $urlList = array(); | ||
63 | + //组合搜索品牌url | ||
64 | + $urlList['brand'] = HelperSearch::getBrandUrl($customOptions); | ||
65 | + | ||
66 | + //批量调接口 | ||
67 | + $result = Yohobuy::getMulti($urlList, array(), true); | ||
68 | + | ||
69 | + if (isset($result['brand'])) { | ||
70 | + $banner = HelperSearch::getBannerFormat($result['brand'], $customOptions['brandBanner']); | ||
71 | + } | ||
72 | + | ||
73 | + return array( | ||
74 | + 'brandBanner' => $banner, | ||
75 | + 'brandAbout' => $customOptions['brandAbout'] | ||
76 | + ); | ||
77 | + } | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | ||
50 | //获取品牌系列数据 | 87 | //获取品牌系列数据 |
51 | public static function getAdNav($brandId, $status = 1) | 88 | public static function getAdNav($brandId, $status = 1) |
52 | { | 89 | { |
@@ -86,18 +123,17 @@ class BrandsModel | @@ -86,18 +123,17 @@ class BrandsModel | ||
86 | //组合搜索品牌url | 123 | //组合搜索品牌url |
87 | $urlList['brand'] = HelperSearch::getBrandUrl($customOptions); | 124 | $urlList['brand'] = HelperSearch::getBrandUrl($customOptions); |
88 | 125 | ||
89 | - //组合获取品牌banner url | ||
90 | - $urlList['banner'] = HelperSearch::getBannerUrl($customOptions); | ||
91 | 126 | ||
92 | //组合用户浏览记录url | 127 | //组合用户浏览记录url |
93 | //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); | 128 | //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); |
129 | + | ||
94 | //批量调接口 | 130 | //批量调接口 |
95 | $result = Yohobuy::getMulti($urlList, array(), true); | 131 | $result = Yohobuy::getMulti($urlList, array(), true); |
96 | - | 132 | + |
97 | //组织模板数据格式 | 133 | //组织模板数据格式 |
98 | $data = HelperSearch::getList($result, $searchCondition['options']); | 134 | $data = HelperSearch::getList($result, $searchCondition['options']); |
99 | 135 | ||
100 | - | 136 | + |
101 | return $data; | 137 | return $data; |
102 | } | 138 | } |
103 | 139 |
@@ -9,6 +9,32 @@ use \LibModels\Web\Product\SearchData; | @@ -9,6 +9,32 @@ use \LibModels\Web\Product\SearchData; | ||
9 | class HotrankModel { | 9 | class HotrankModel { |
10 | 10 | ||
11 | /** | 11 | /** |
12 | + * 获取热销排行频道资源 | ||
13 | + * | ||
14 | + * @param string $channel | ||
15 | + * @return array | ||
16 | + */ | ||
17 | + static public function getChannelResource() | ||
18 | + { | ||
19 | + $channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; | ||
20 | + switch ($channel) | ||
21 | + { | ||
22 | + case 'boys' : | ||
23 | + $resource = array('channel' => 'boys', 'gender' => '1,3','road' => 1,'code' => '80d772d8dff25300a2a2e4c97165330c'); | ||
24 | + return $resource; | ||
25 | + case 'girls' : | ||
26 | + $resource = array('channel' => 'girls','gender' => '2,3','road' => 2,'code' => '8df64e505e94edb9881fd1e7efb702e9'); | ||
27 | + return $resource; | ||
28 | + case 'lifestyle' : | ||
29 | + $resource = array('channel' => 'lifestyle','gender' => '','road' => 4,'code' => 'd131aba83a84a6977eee3a7403a713de'); | ||
30 | + return $resource; | ||
31 | + case 'kids' : | ||
32 | + $resource = array('channel' => 'kids','gender' => '','road' => 3,'code' => 'bd6a06a08f8ca9b0db762f78e0bc5b68'); | ||
33 | + return $resource; | ||
34 | + } | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
12 | * 人气单品 一周热卖 | 38 | * 人气单品 一周热卖 |
13 | */ | 39 | */ |
14 | static public function getSearchData($param,$page,$ajax) | 40 | static public function getSearchData($param,$page,$ajax) |
@@ -5,6 +5,7 @@ use LibModels\Web\Passport\RegData; | @@ -5,6 +5,7 @@ use LibModels\Web\Passport\RegData; | ||
5 | use LibModels\Web\Passport\LoginData; | 5 | use LibModels\Web\Passport\LoginData; |
6 | use Passport\PassportModel as PassportModel; | 6 | use Passport\PassportModel as PassportModel; |
7 | use Plugin\Helpers; | 7 | use Plugin\Helpers; |
8 | + | ||
8 | class LoginController extends WebAction | 9 | class LoginController extends WebAction |
9 | { | 10 | { |
10 | 11 | ||
@@ -93,7 +94,6 @@ class LoginController extends WebAction | @@ -93,7 +94,6 @@ class LoginController extends WebAction | ||
93 | $account = trim($this->post('account')); | 94 | $account = trim($this->post('account')); |
94 | $password = trim($this->post('password')); | 95 | $password = trim($this->post('password')); |
95 | $isRemember = trim($this->post('isRemember')); | 96 | $isRemember = trim($this->post('isRemember')); |
96 | - $isRemember = false; | ||
97 | if (!is_numeric($area) || empty($account) || empty($password)) { | 97 | if (!is_numeric($area) || empty($account) || empty($password)) { |
98 | break; | 98 | break; |
99 | } | 99 | } |
@@ -119,17 +119,6 @@ class LoginController extends WebAction | @@ -119,17 +119,6 @@ class LoginController extends WebAction | ||
119 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { | 119 | if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { |
120 | break; | 120 | break; |
121 | } | 121 | } |
122 | - //登录成功记录账户信息 | ||
123 | - if ($isRemember) { | ||
124 | - $this->setCookie('account', $this->encrypt($account), time() + 3600 * 24 * 7, '/'); | ||
125 | - $this->setCookie('userInfo', $this->encrypt($password), time() + 3600 * 24 * 7, '/'); | ||
126 | - $this->setCookie('isRemember', $isRemember, time() + 3600 * 24 * 7); | ||
127 | - } | ||
128 | - else { | ||
129 | - $this->setCookie('account', '', -1, '/'); | ||
130 | - $this->setCookie('userInfo', '', -1, '/'); | ||
131 | - $this->setCookie('isRemember', '', -1, '/'); | ||
132 | - } | ||
133 | 122 | ||
134 | $refer = $this->getCookie('refer'); | 123 | $refer = $this->getCookie('refer'); |
135 | if (empty($refer) || strstr($refer, 'signin.html') || strstr($refer, 'passport/login/index')) { | 124 | if (empty($refer) || strstr($refer, 'signin.html') || strstr($refer, 'passport/login/index')) { |
@@ -138,7 +127,7 @@ class LoginController extends WebAction | @@ -138,7 +127,7 @@ class LoginController extends WebAction | ||
138 | else { | 127 | else { |
139 | $refer = rawurldecode($refer); | 128 | $refer = rawurldecode($refer); |
140 | } | 129 | } |
141 | - $data['data']['session'] = Helpers::syncUserSession($data['data']['uid'],$refer); | 130 | + $data['data']['session'] = Helpers::syncUserSession($data['data']['uid'], $refer); |
142 | $data['data']['href'] = $refer; | 131 | $data['data']['href'] = $refer; |
143 | 132 | ||
144 | $token = Helpers::makeToken($data['data']['uid']); | 133 | $token = Helpers::makeToken($data['data']['uid']); |
@@ -172,59 +161,4 @@ class LoginController extends WebAction | @@ -172,59 +161,4 @@ class LoginController extends WebAction | ||
172 | $this->go($refer); | 161 | $this->go($refer); |
173 | } | 162 | } |
174 | 163 | ||
175 | - /* | ||
176 | - * 加密算法 | ||
177 | - */ | ||
178 | - | ||
179 | - private function encrypt($data, $key='yohobuy') | ||
180 | - { | ||
181 | - $key = md5($key); | ||
182 | - $x = 0; | ||
183 | - $str=''; | ||
184 | - $char=''; | ||
185 | - $len = strlen($data); | ||
186 | - $l = strlen($key); | ||
187 | - for ($i = 0; $i < $len; $i++) { | ||
188 | - if ($x == $l) { | ||
189 | - $x = 0; | ||
190 | - } | ||
191 | - $char .= $key{$x}; | ||
192 | - $x++; | ||
193 | - } | ||
194 | - for ($i = 0; $i < $len; $i++) { | ||
195 | - $str .= chr(ord($data{$i}) + (ord($char{$i})) % 256); | ||
196 | - } | ||
197 | - return base64_encode($str); | ||
198 | - } | ||
199 | - | ||
200 | - /* | ||
201 | - * 解密算法 | ||
202 | - */ | ||
203 | - | ||
204 | - private function decrypt($data, $key='yohobuy') | ||
205 | - { | ||
206 | - $key = md5($key); | ||
207 | - $x = 0; | ||
208 | - $str=''; | ||
209 | - $char=''; | ||
210 | - $data = base64_decode($data); | ||
211 | - $len = strlen($data); | ||
212 | - $l = strlen($key); | ||
213 | - for ($i = 0; $i < $len; $i++) { | ||
214 | - if ($x == $l) { | ||
215 | - $x = 0; | ||
216 | - } | ||
217 | - $char .= substr($key, $x, 1); | ||
218 | - $x++; | ||
219 | - } | ||
220 | - for ($i = 0; $i < $len; $i++) { | ||
221 | - if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1))) { | ||
222 | - $str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1))); | ||
223 | - } | ||
224 | - else { | ||
225 | - $str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1))); | ||
226 | - } | ||
227 | - } | ||
228 | - return $str; | ||
229 | - } | ||
230 | } | 164 | } |
@@ -8,10 +8,6 @@ use LibModels\Web\Home\IndexData; | @@ -8,10 +8,6 @@ use LibModels\Web\Home\IndexData; | ||
8 | 8 | ||
9 | class IndexController extends WebAction | 9 | class IndexController extends WebAction |
10 | { | 10 | { |
11 | - public $channel; | ||
12 | - public $gender; | ||
13 | - public $road;//频道 | ||
14 | - public $code; | ||
15 | /** | 11 | /** |
16 | * 品牌首页 | 12 | * 品牌首页 |
17 | */ | 13 | */ |
@@ -24,10 +20,13 @@ class IndexController extends WebAction | @@ -24,10 +20,13 @@ class IndexController extends WebAction | ||
24 | } | 20 | } |
25 | $uid = $this->getUid(); | 21 | $uid = $this->getUid(); |
26 | //根据品牌域名获取品牌id(同时判断品牌域名是否有效) | 22 | //根据品牌域名获取品牌id(同时判断品牌域名是否有效) |
27 | - $brandInfo = BrandData::getBrandLogoByDomain($domain); | ||
28 | - if (!empty($brandInfo['data']) && $brandInfo['code'] === 200) { | 23 | + $fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code'; |
24 | + $brandInfo = BrandData::getBrandLogoByDomain($domain, $fields); | ||
25 | + | ||
26 | + if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) { | ||
29 | $brandId = $brandInfo['data']['id']; | 27 | $brandId = $brandInfo['data']['id']; |
30 | - $node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false; | 28 | + $node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false; |
29 | + $brandBanner = $brandInfo['data']['brand_banner']; | ||
31 | } else { | 30 | } else { |
32 | $this->go(SITE_MAIN); | 31 | $this->go(SITE_MAIN); |
33 | } | 32 | } |
@@ -42,6 +41,8 @@ class IndexController extends WebAction | @@ -42,6 +41,8 @@ class IndexController extends WebAction | ||
42 | $options['uid'] = $uid; | 41 | $options['uid'] = $uid; |
43 | $options['brandId'] = $brandId; | 42 | $options['brandId'] = $brandId; |
44 | $options['node'] = $node; | 43 | $options['node'] = $node; |
44 | + $options['brandBanner'] = $brandBanner; | ||
45 | + $options['reviewNum'] = 6; | ||
45 | 46 | ||
46 | //调用模型获得数据 | 47 | //调用模型获得数据 |
47 | $data = Product\BrandsModel::getBrandSearchData($condition, $options); | 48 | $data = Product\BrandsModel::getBrandSearchData($condition, $options); |
@@ -56,46 +57,66 @@ class IndexController extends WebAction | @@ -56,46 +57,66 @@ class IndexController extends WebAction | ||
56 | $this->_view->display('list',$data); | 57 | $this->_view->display('list',$data); |
57 | } | 58 | } |
58 | 59 | ||
60 | + //品牌介绍页 | ||
61 | + public function brandIntroAction() | ||
62 | + { | ||
63 | + //品牌域名 | ||
64 | + $domain = $this->param('named'); | ||
65 | + if (empty($domain)) { | ||
66 | + $this->go(SITE_MAIN); | ||
67 | + } | ||
68 | + $uid = $this->getUid(); | ||
69 | + //根据品牌域名获取品牌id(同时判断品牌域名是否有效) | ||
70 | + $fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro'; | ||
71 | + $brandInfo = BrandData::getBrandLogoByDomain($domain, $fields); | ||
72 | + | ||
73 | + if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) { | ||
74 | + $brandId = $brandInfo['data']['id']; | ||
75 | + $brandBanner = $brandInfo['data']['brand_banner']; | ||
76 | + $brandAbout = $brandInfo['data']['brand_intro']; | ||
77 | + } else { | ||
78 | + $this->go(SITE_MAIN); | ||
79 | + } | ||
80 | + | ||
81 | + //品牌ID参数 | ||
82 | + $condition = array(); | ||
83 | + $condition['brand'] = $brandId; | ||
84 | + | ||
85 | + //$options参数数组 | ||
86 | + $options = array(); | ||
87 | + $options['brandName'] = $domain; | ||
88 | + $options['uid'] = $uid; | ||
89 | + $options['brandId'] = $brandId; | ||
90 | + $options['brandBanner'] = $brandBanner; | ||
91 | + $options['brandAbout'] = $brandAbout; | ||
92 | + //调用模型获得数据 | ||
93 | + $data = Product\BrandsModel::getBrandIntro($condition, $options); | ||
94 | + | ||
95 | + $data = array( | ||
96 | + //初始化js | ||
97 | + 'searchListPage' => true, | ||
98 | + 'list' => $data | ||
99 | + ); | ||
100 | + | ||
101 | + $this->setWebNavHeader(); | ||
102 | + //渲染模板 | ||
103 | + $this->_view->display('list',$data); | ||
104 | + } | ||
59 | /** | 105 | /** |
60 | * 热销排行 | 106 | * 热销排行 |
61 | */ | 107 | */ |
62 | public function hotrankAction() | 108 | public function hotrankAction() |
63 | { | 109 | { |
64 | //获取频道 | 110 | //获取频道 |
65 | - $cookie = $this->getCookie('_Channel'); | ||
66 | - $this->channel = isset($cookie) ? $cookie : 'boys'; | ||
67 | - switch ($this->channel) | ||
68 | - { | ||
69 | - case 'boys' : | ||
70 | - $this->gender = '1,3'; | ||
71 | - $this->road = 1; | ||
72 | - $this->code = '80d772d8dff25300a2a2e4c97165330c'; | ||
73 | - break; | ||
74 | - case 'girls' : | ||
75 | - $this->gender = '2,3'; | ||
76 | - $this->road = 2; | ||
77 | - $this->code = '8df64e505e94edb9881fd1e7efb702e9'; | ||
78 | - break; | ||
79 | - case 'lifestyle' : | ||
80 | - $this->gender = ''; | ||
81 | - $this->road = 4; | ||
82 | - $this->code = 'd131aba83a84a6977eee3a7403a713de'; | ||
83 | - break; | ||
84 | - case 'kids' : | ||
85 | - $this->gender = ''; | ||
86 | - $this->road = 3; | ||
87 | - $this->code = 'bd6a06a08f8ca9b0db762f78e0bc5b68'; | ||
88 | - break; | ||
89 | - | ||
90 | - } | ||
91 | - $this->setWebNavHeader(\Index\HomeModel::$this->channel); | 111 | + $channel = \product\HotrankModel::getChannelResource(); |
112 | + $this->setWebNavHeader($channel['channel']); | ||
92 | $data = array( 'hotrankPage' => true, | 113 | $data = array( 'hotrankPage' => true, |
93 | 'footerTop'=> true, | 114 | 'footerTop'=> true, |
94 | 'hotrank' => array() | 115 | 'hotrank' => array() |
95 | ); | 116 | ); |
96 | 117 | ||
97 | //焦点图 热门品牌 | 118 | //焦点图 热门品牌 |
98 | - $focus = \Index\HomeModel::getChannelResource($this->channel, $this->code); | 119 | + $focus = \Index\HomeModel::getChannelResource($channel['channel'], $channel['code']); |
99 | $data['hotrank']['slide'] = $focus[0]['slide']; | 120 | $data['hotrank']['slide'] = $focus[0]['slide']; |
100 | $data['hotrank']['hotBrands'] = $focus[1]['hotBrands']; | 121 | $data['hotrank']['hotBrands'] = $focus[1]['hotBrands']; |
101 | 122 | ||
@@ -103,15 +124,15 @@ class IndexController extends WebAction | @@ -103,15 +124,15 @@ class IndexController extends WebAction | ||
103 | $page = $this->get('page',1); | 124 | $page = $this->get('page',1); |
104 | $sort_id = $this->get('sid',0); | 125 | $sort_id = $this->get('sid',0); |
105 | $viewNum = 60; | 126 | $viewNum = 60; |
106 | - $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$this->gender,'attribute_not'=>2); | 127 | + $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$channel['gender'],'attribute_not'=>2); |
107 | if($sort_id != 0) | 128 | if($sort_id != 0) |
108 | { | 129 | { |
109 | $param['sort'] = $sort_id; | 130 | $param['sort'] = $sort_id; |
110 | } | 131 | } |
111 | - if($this->road == 3) | 132 | + if($channel['road'] == 3) |
112 | { | 133 | { |
113 | $param['msort'] = 365; | 134 | $param['msort'] = 365; |
114 | - }elseif($this->road == 4){ | 135 | + }elseif($channel['road'] == 4){ |
115 | $param['msort'] = 10; | 136 | $param['msort'] = 10; |
116 | }else{ | 137 | }else{ |
117 | $param['not_maxSortId'] = '10,365'; | 138 | $param['not_maxSortId'] = '10,365'; |
@@ -119,9 +140,9 @@ class IndexController extends WebAction | @@ -119,9 +140,9 @@ class IndexController extends WebAction | ||
119 | $publiclist = \product\HotrankModel::getSearchData($param,$page,0); | 140 | $publiclist = \product\HotrankModel::getSearchData($param,$page,0); |
120 | $data['hotrank']['popular'] = $publiclist['popular']; | 141 | $data['hotrank']['popular'] = $publiclist['popular']; |
121 | $data['hotrank']['hotWeek'] = $publiclist['hotWeek']; | 142 | $data['hotrank']['hotWeek'] = $publiclist['hotWeek']; |
122 | - | 143 | + |
123 | //分类标签 | 144 | //分类标签 |
124 | - $nav = \product\HotrankModel::getHotranktag('web',$this->road,true); | 145 | + $nav = \product\HotrankModel::getHotranktag('web',$channel['road'],true); |
125 | $data['hotrank']['hotWeek']['nav'] = $nav; | 146 | $data['hotrank']['hotWeek']['nav'] = $nav; |
126 | $this->_view->display('hotrank', $data); | 147 | $this->_view->display('hotrank', $data); |
127 | } | 148 | } |
@@ -131,6 +152,7 @@ class IndexController extends WebAction | @@ -131,6 +152,7 @@ class IndexController extends WebAction | ||
131 | */ | 152 | */ |
132 | public function getdataAction() | 153 | public function getdataAction() |
133 | { | 154 | { |
155 | + | ||
134 | $page = $this->get('page',1); | 156 | $page = $this->get('page',1); |
135 | //加载到100个以后停止 | 157 | //加载到100个以后停止 |
136 | if($page > 2) | 158 | if($page > 2) |
@@ -150,15 +172,17 @@ class IndexController extends WebAction | @@ -150,15 +172,17 @@ class IndexController extends WebAction | ||
150 | $sort = $info['data']['category_id']; | 172 | $sort = $info['data']['category_id']; |
151 | } | 173 | } |
152 | } | 174 | } |
153 | - $viewNum = 60; | 175 | + $viewNum = 60; |
176 | + //获取频道资源 | ||
177 | + $channel = \product\HotrankModel::getChannelResource(); | ||
154 | $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1, | 178 | $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1, |
155 | - 'gender'=>$this->gender,'attribute_not'=>2); | 179 | + 'gender'=>$channel['gender'],'attribute_not'=>2,); |
156 | if(empty($param['sort'])) | 180 | if(empty($param['sort'])) |
157 | { | 181 | { |
158 | - if($this->road == 3) | 182 | + if($channel['road'] == 3) |
159 | { | 183 | { |
160 | $param['msort'] = 365; | 184 | $param['msort'] = 365; |
161 | - }elseif($this->road == 4){ | 185 | + }elseif($channel['road'] == 4){ |
162 | $param['msort'] = 10; | 186 | $param['msort'] = 10; |
163 | }else{ | 187 | }else{ |
164 | $param['not_maxSortId'] = '10,365'; | 188 | $param['not_maxSortId'] = '10,365'; |
@@ -9,7 +9,8 @@ class ListController extends WebAction | @@ -9,7 +9,8 @@ class ListController extends WebAction | ||
9 | $positionId = 10; //搜素banner 位置id | 9 | $positionId = 10; //搜素banner 位置id |
10 | $condition = array(); | 10 | $condition = array(); |
11 | $options = array( | 11 | $options = array( |
12 | - 'positionId' => $positionId | 12 | + 'positionId' => $positionId, |
13 | + 'reviewNum' => 6 | ||
13 | ); | 14 | ); |
14 | $indexData = Product\IndexModel::getIndexData($condition, $options); | 15 | $indexData = Product\IndexModel::getIndexData($condition, $options); |
15 | 16 | ||
@@ -31,7 +32,8 @@ class ListController extends WebAction | @@ -31,7 +32,8 @@ class ListController extends WebAction | ||
31 | ); | 32 | ); |
32 | $options = array( | 33 | $options = array( |
33 | 'specialsale_id' => 'Y', | 34 | 'specialsale_id' => 'Y', |
34 | - 'needDay' => 'Y' | 35 | + 'needDay' => 'Y', |
36 | + 'reviewNum' => 6 | ||
35 | ); | 37 | ); |
36 | 38 | ||
37 | $newData = Product\NewModel::getNewSearchData($condition, $options); | 39 | $newData = Product\NewModel::getNewSearchData($condition, $options); |
@@ -41,7 +41,8 @@ class SaleController extends WebAction | @@ -41,7 +41,8 @@ class SaleController extends WebAction | ||
41 | 41 | ||
42 | $options = array( | 42 | $options = array( |
43 | 'specialsale_id' => 'Y', | 43 | 'specialsale_id' => 'Y', |
44 | - 'controller' => $this->_request->controller | 44 | + 'controller' => $this->_request->controller, |
45 | + 'reviewNum' => 6 | ||
45 | ); | 46 | ); |
46 | 47 | ||
47 | $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo); | 48 | $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo); |
@@ -21,7 +21,7 @@ routes.login.route.action = Index | @@ -21,7 +21,7 @@ routes.login.route.action = Index | ||
21 | 21 | ||
22 | ; 登录退出页 | 22 | ; 登录退出页 |
23 | routes.logout.type = "rewrite" | 23 | routes.logout.type = "rewrite" |
24 | -routes.logout.match = "/passport/signout/index" | 24 | +routes.logout.match = "/logout.html" |
25 | routes.logout.route.module = Passport | 25 | routes.logout.route.module = Passport |
26 | routes.logout.route.controller = Login | 26 | routes.logout.route.controller = Login |
27 | routes.logout.route.action = Out | 27 | routes.logout.route.action = Out |
-
Please register or login to post a comment