Authored by 周少峰

brand change and mobile encryption

@@ -280,13 +280,26 @@ class UserData @@ -280,13 +280,26 @@ class UserData
280 public static function addressData($uid) 280 public static function addressData($uid)
281 { 281 {
282 $param = Yohobuy::param(); 282 $param = Yohobuy::param();
283 - $param['method'] = 'app.address.get'; 283 + $param['method'] = 'app.address.gethidden';
284 $param['uid'] = $uid; 284 $param['uid'] = $uid;
285 $param['client_secret'] = Sign::getSign($param); 285 $param['client_secret'] = Sign::getSign($param);
  286 + return Yohobuy::get(Yohobuy::API_URL, $param);
  287 + }
286 288
  289 + /**
  290 + * @param $uid
  291 + * @return mixed
  292 + */
  293 + public static function addressTextData($uid)
  294 + {
  295 + $param = Yohobuy::param();
  296 + $param['method'] = 'app.address.get';
  297 + $param['uid'] = $uid;
  298 + $param['client_secret'] = Sign::getSign($param);
287 return Yohobuy::get(Yohobuy::API_URL, $param); 299 return Yohobuy::get(Yohobuy::API_URL, $param);
288 } 300 }
289 301
  302 +
290 /** 303 /**
291 * 获取三级地址列表数据 304 * 获取三级地址列表数据
292 * 305 *
@@ -38,7 +38,7 @@ class SearchData @@ -38,7 +38,7 @@ class SearchData
38 case 'test': 38 case 'test':
39 case 'developer': 39 case 'developer':
40 default: 40 default:
41 - return 'http://192.168.10.64:8080/yohosearch/search.json'; 41 + return 'http://192.168.102.216:8087/yohosearch/search.json';
42 } 42 }
43 } 43 }
44 44
@@ -154,8 +154,6 @@ class BrandModel @@ -154,8 +154,6 @@ class BrandModel
154 154
155 $brand = BrandData::getBrandsData($channel); 155 $brand = BrandData::getBrandsData($channel);
156 if (!empty($brand['data']['brands'])) { 156 if (!empty($brand['data']['brands'])) {
157 - $list = array();  
158 - $build = array();  
159 foreach ($brand['data']['brands'] as $char => $value) { 157 foreach ($brand['data']['brands'] as $char => $value) {
160 $build = array(); 158 $build = array();
161 foreach ($value as $row) { 159 foreach ($value as $row) {
@@ -174,4 +172,54 @@ class BrandModel @@ -174,4 +172,54 @@ class BrandModel
174 return $result; 172 return $result;
175 } 173 }
176 174
  175 + /**
  176 + * 品牌搜索历史
  177 + * @param int $uid
  178 + * @author sefon 2016-5-17 12:12:28
  179 + * @return array
  180 + */
  181 + public static function branchSearchHistory($uid)
  182 + {
  183 + $result = array();
  184 + $list = BrandData::branchSearchHistory($uid);
  185 + do {
  186 + if (!isset($list['code']) || $list['code'] != 200 || !isset($list['data']) || empty($list['data'])) {
  187 + break;
  188 + }
  189 + foreach ($list['data'] as $key => $val) {
  190 + $result[] = array(
  191 + 'url' => isset($val['brandDomain']) ? Helpers::url('', '', $val['brandDomain']) : 'test',
  192 + 'id' => $val['id'],
  193 + 'name' => $val['brandName']
  194 + );
  195 + }
  196 + } while(false);
  197 +
  198 + return $result;
  199 + }
  200 +
  201 + /**
  202 + * 热搜品牌
  203 + * @author sefon 2016-5-17 12:20:26
  204 + * @return array
  205 + */
  206 + public static function branchSearchHot()
  207 + {
  208 + $result = array();
  209 + $hot = BrandData::hotSearchBrands();
  210 + do {
  211 + if (!isset($hot['code']) || $hot['code'] != 200 || !isset($hot['data']) || empty($hot['data'])) {
  212 + break;
  213 + }
  214 + foreach ($hot['data'] as $key => $val) {
  215 + $result[] = array(
  216 + 'url' => isset($val['brandDomain']) ? Helpers::url('', '', $val['brandDomain']) : 'test',
  217 + 'id' => $val['id'],
  218 + 'name' => $val['brandName']
  219 + );
  220 + }
  221 + } while(false);
  222 +
  223 + return $result;
  224 + }
177 } 225 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use Plugin\Helpers; 4 use Plugin\Helpers;
5 use LibModels\Wap\Category\BrandData; 5 use LibModels\Wap\Category\BrandData;
  6 +use Category\BrandModel;
6 7
7 /** 8 /**
8 * 品牌相关的控制器 9 * 品牌相关的控制器
@@ -57,12 +58,18 @@ class BrandController extends AbstractAction @@ -57,12 +58,18 @@ class BrandController extends AbstractAction
57 */ 58 */
58 public function searchAction() 59 public function searchAction()
59 { 60 {
  61 + $uid = $this->getUid();
60 $this->setTitle('品牌一览'); 62 $this->setTitle('品牌一览');
61 $this->setNavHeader('品牌一览', true, true); 63 $this->setNavHeader('品牌一览', true, true);
62 64
63 $channel = Helpers::getChannelByCookie(); 65 $channel = Helpers::getChannelByCookie();
64 - $data = Category\BrandModel::getBrandForSearch($channel);  
65 - 66 + $data = BrandModel::getBrandForSearch($channel);
  67 + //品牌搜索记录
  68 + if (!empty($uid)) {
  69 + $data['historySearch']['history'] = BrandModel::branchSearchHistory($uid);
  70 + }
  71 + //热搜品牌
  72 + $data['hot'] = BrandModel::branchSearchHot();
66 // 渲染模板 73 // 渲染模板
67 $this->_view->display('search', $data); 74 $this->_view->display('search', $data);
68 } 75 }