Authored by hf

code review by fei.hong: do merge yangyang and huanbao codes

@@ -371,7 +371,6 @@ class CartData @@ -371,7 +371,6 @@ class CartData
371 } 371 }
372 $param['payment_id'] = $paymentId; 372 $param['payment_id'] = $paymentId;
373 $param['payment_type'] = $paymentType; 373 $param['payment_type'] = $paymentType;
374 - $param['remark'] = $remark;  
375 if (!empty($couponCode)) { 374 if (!empty($couponCode)) {
376 $param['coupon_code'] = $couponCode; 375 $param['coupon_code'] = $couponCode;
377 } 376 }
@@ -384,9 +383,10 @@ class CartData @@ -384,9 +383,10 @@ class CartData
384 if (!empty($isPrintPrice)) { 383 if (!empty($isPrintPrice)) {
385 $param['is_print_price'] = 'Y'; 384 $param['is_print_price'] = 'Y';
386 } 385 }
  386 + $param['remark'] = $remark;
387 $param['client_secret'] = Sign::getSign($param); 387 $param['client_secret'] = Sign::getSign($param);
388 388
389 - return Yohobuy::get(Yohobuy::API_URL, $param, false, false, 10, $userAgent); 389 + return Yohobuy::post(Yohobuy::API_URL, $param, false, false, 10, $userAgent);
390 } 390 }
391 391
392 /** 392 /**
@@ -501,11 +501,15 @@ class HelperSearch @@ -501,11 +501,15 @@ class HelperSearch
501 foreach ($v['sub'] as $sortKey => $sort) { 501 foreach ($v['sub'] as $sortKey => $sort) {
502 $selfMisort[$sortKey]['name'] = $sort['sort_name']; 502 $selfMisort[$sortKey]['name'] = $sort['sort_name'];
503 $selfMisort[$sortKey]['checked'] = isset(self::$params['sort']) && self::$params['sort'] == $sort['sort_id'] ? true : false; 503 $selfMisort[$sortKey]['checked'] = isset(self::$params['sort']) && self::$params['sort'] == $sort['sort_id'] ? true : false;
504 - $selfMisort[$sortKey]['href'] = self::buildUrl(array(  
505 - 'msort' => $val['sort_id'],  
506 - 'misort' => $v['sort_id'],  
507 - 'sort' => $sort['sort_id'],  
508 - )); 504 + $selfMisort[$sortKey]['href'] = self::buildUrl(array_merge(self::$params,array('sort' => $sort['sort_id'])));
  505 + if (isset(self::$params['sort']) && self::$params['sort'] == $sort['sort_id']) {
  506 + $sortParam = self::$params;
  507 + unset($sortParam['sort']);
  508 + self::$selected['sort'] = array(
  509 + 'name' => $sort['sort_name'],
  510 + 'href' => self::buildUrl($sortParam)
  511 + );
  512 + }
509 } 513 }
510 } 514 }
511 self::$misort = $selfMisort; 515 self::$misort = $selfMisort;
@@ -899,14 +903,13 @@ class HelperSearch @@ -899,14 +903,13 @@ class HelperSearch
899 ); 903 );
900 } 904 }
901 //设置已选中,风格筛选条件设为空 905 //设置已选中,风格筛选条件设为空
902 - if (isset(self::$params['style']) && !empty(self::$params['style'])) { 906 + if (isset(self::$params['style']) && !empty(self::$params['style']) && !empty($styleName)) {
903 self::$selected['style'] = array( 907 self::$selected['style'] = array(
904 'name' => implode('、', $styleName), 908 'name' => implode('、', $styleName),
905 'href' => self::buildUrl($params) 909 'href' => self::buildUrl($params)
906 ); 910 );
907 return array(); 911 return array();
908 } 912 }
909 -  
910 if ($result) { 913 if ($result) {
911 $data[0] = array( 914 $data[0] = array(
912 'attr' => 'style', 915 'attr' => 'style',
@@ -924,6 +927,9 @@ class HelperSearch @@ -924,6 +927,9 @@ class HelperSearch
924 */ 927 */
925 public static function seniorChose($filter) 928 public static function seniorChose($filter)
926 { 929 {
  930 + if (self::$total == 0) {
  931 + return array();
  932 + }
927 $style = self::style($filter); 933 $style = self::style($filter);
928 $other = self::standard($filter); 934 $other = self::standard($filter);
929 $result = array_merge($style, $other); 935 $result = array_merge($style, $other);
@@ -1250,6 +1256,7 @@ class HelperSearch @@ -1250,6 +1256,7 @@ class HelperSearch
1250 */ 1256 */
1251 public static function recentShelve($list = array()) 1257 public static function recentShelve($list = array())
1252 { 1258 {
  1259 + $gender = array();
1253 if (empty($list)) { 1260 if (empty($list)) {
1254 return array(); 1261 return array();
1255 } 1262 }
@@ -1264,7 +1271,9 @@ class HelperSearch @@ -1264,7 +1271,9 @@ class HelperSearch
1264 self::$misortParam = array( 1271 self::$misortParam = array(
1265 'misort' => isset(self::$params['misort']) ? self::$params['misort'] : '' 1272 'misort' => isset(self::$params['misort']) ? self::$params['misort'] : ''
1266 ); 1273 );
1267 - 1274 + if (isset(self::$params['gender'])) {
  1275 + $gender['gender'] = self::$params['gender'];
  1276 + }
1268 foreach ($list as $k => $v) { 1277 foreach ($list as $k => $v) {
1269 $star_time = strtotime($k); 1278 $star_time = strtotime($k);
1270 $end_time = $star_time + 60 * 60 * 24; 1279 $end_time = $star_time + 60 * 60 * 24;
@@ -1274,7 +1283,7 @@ class HelperSearch @@ -1274,7 +1283,7 @@ class HelperSearch
1274 $data[$i]['active'] = true; 1283 $data[$i]['active'] = true;
1275 self::$selectedShelveTime = date('m月d日', strtotime($k)); 1284 self::$selectedShelveTime = date('m月d日', strtotime($k));
1276 } 1285 }
1277 - $data[$i]['href'] = self::buildUrl(array_merge($query, self::$msortParam, self::$misortParam)); 1286 + $data[$i]['href'] = self::buildUrl(array_merge($query, self::$msortParam, self::$misortParam, $gender));
1278 $data[$i]['name'] = date('m月d日', strtotime($k)); 1287 $data[$i]['name'] = date('m月d日', strtotime($k));
1279 $i++; 1288 $i++;
1280 } 1289 }
@@ -1404,25 +1413,34 @@ class HelperSearch @@ -1404,25 +1413,34 @@ class HelperSearch
1404 //组织静态资源数据格式 1413 //组织静态资源数据格式
1405 public static function getNodeContent($code) 1414 public static function getNodeContent($code)
1406 { 1415 {
  1416 + $result = array();
1407 $nodeContent = BrandData::getByNodeContent($code); //TODO异步 1417 $nodeContent = BrandData::getByNodeContent($code); //TODO异步
  1418 +
1408 if (isset($nodeContent['code']) && $nodeContent['code'] === 200) { 1419 if (isset($nodeContent['code']) && $nodeContent['code'] === 200) {
1409 $result = array(); 1420 $result = array();
  1421 + //print_r($nodeContent['data']);
  1422 + $arr = explode('<br />', $nodeContent['data']);
  1423 + $arr = array_values($arr);
1410 1424
1411 - $string = $nodeContent['data'];  
1412 $hrefPatten = "/<a href=[\'\"]?([^\'\" ]+).*?>/"; 1425 $hrefPatten = "/<a href=[\'\"]?([^\'\" ]+).*?>/";
1413 - preg_match_all($hrefPatten, $string, $href);  
1414 -  
1415 $pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/"; 1426 $pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/";
1416 - preg_match_all($pattern, $string, $img);  
1417 - foreach ($img[1] as $key => $vo) {  
1418 - if (strrchr($vo, '.swf') == '.swf') { 1427 + foreach($arr as $key => $value){
  1428 +
  1429 + preg_match($hrefPatten, $value, $href);
  1430 + preg_match($pattern, $value, $img);
  1431 + if (isset($href[1])) {
  1432 + $result[$key]['href'] = str_replace('&amp;', '&', $href[1]);
  1433 + }
  1434 + if (isset($img[1])) {
  1435 + if (strrchr($img[1], '.swf') == '.swf') {
1419 $result[$key]['isVedio'] = true; 1436 $result[$key]['isVedio'] = true;
1420 - $result[$key]['src'] = $vo;  
1421 - } else {  
1422 - $result[$key]['href'] = isset($href[1][$key]) ? str_replace('&amp;', '&', $href[1][$key]) : '';  
1423 - $result[$key]['src'] = $vo; 1437 + $result[$key]['src'] = $img[1];
  1438 + }else{
  1439 + $result[$key]['src'] = $img[1];
1424 } 1440 }
1425 } 1441 }
  1442 + }
  1443 +
1426 return $result; 1444 return $result;
1427 } 1445 }
1428 } 1446 }
@@ -1855,36 +1873,50 @@ class HelperSearch @@ -1855,36 +1873,50 @@ class HelperSearch
1855 $selectedShelveTime = !empty(self::$selectedShelveTime) ? self::$selectedShelveTime : '';//当前新品到着时间 1873 $selectedShelveTime = !empty(self::$selectedShelveTime) ? self::$selectedShelveTime : '';//当前新品到着时间
1856 //新品到着页seo 1874 //新品到着页seo
1857 if ($options['controller'] == 'List' && $options['action'] == 'new') { 1875 if ($options['controller'] == 'List' && $options['action'] == 'new') {
  1876 + $new = $channelCnName . $selectedShelveTime;
1858 return array( 1877 return array(
1859 - 'title' => $channelCnName . $selectedShelveTime . '新品上架-YOHO!有货 100%正品保证',  
1860 - 'keywords' => $channelCnName . $selectedShelveTime . '新品上架',  
1861 - 'description' => $channelCnName . $selectedShelveTime . '新品上架,正品网购,官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。' 1878 + 'title' => (!empty($new) ? $new : '') . '新品上架-YOHO!有货 100%正品保证',
  1879 + 'keywords' => (!empty($new) ? $new : '') . '新品上架',
  1880 + 'description' => (!empty($new) ? $new : '') . '新品上架,正品网购,官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。'
1862 ); 1881 );
1863 } 1882 }
1864 //sale折扣页seo 1883 //sale折扣页seo
1865 if ($options['controller'] == 'List' && $options['action'] == 'sale') { 1884 if ($options['controller'] == 'List' && $options['action'] == 'sale') {
  1885 + $BPP = $selectedBrand . $selectedP_d . $selectedPrice;
  1886 + $C = $channelCnName;
  1887 + $BP = $selectedBrand . $selectedP_d;
1866 return array( 1888 return array(
1867 - 'title' => $selectedBrand . $selectedP_d . $selectedPrice . '|' . $channelCnName . '全部折扣' . '|YOHO!有货 100%正品保证',  
1868 - 'keywords' => $selectedBrand . $selectedP_d . ',' . $selectedBrand . $selectedP_d . $selectedPrice . ',' . $channelCnName . '全部折扣' . $selectedBrand . $selectedP_d,  
1869 - 'description' => $selectedBrand . $selectedP_d . $selectedPrice. '正品网购。' . $channelCnName . '全部折扣,' . $selectedBrand . $selectedP_d . '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。' 1889 + 'title' => (!empty($BPP)?$BPP.'|': '') . (!empty($C) ? $C : '') . '全部折扣' . '|YOHO!有货 100%正品保证',
  1890 + 'keywords' => (!empty($BP)?$BP.',':'') . (!empty($BPP)?$BPP.',':'') . (!empty($C)?$C:'') . '全部折扣' . (!empty($BP)?$BP:''),
  1891 + 'description' => (!empty($BPP)?$BPP:''). '正品网购。' . $channelCnName . '全部折扣,' . (!empty($BP)?$BP:'') . '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。'
1870 ); 1892 );
1871 } 1893 }
1872 //品牌页seo 1894 //品牌页seo
1873 if ($options['controller'] == 'Index' && $options['action'] == 'brand') { 1895 if ($options['controller'] == 'Index' && $options['action'] == 'brand') {
1874 $selectedBrandCn = isset($options['brandNameCn']) ? $options['brandNameCn'] : '';//当前选中的品牌中文名(只有品牌页有此参数) 1896 $selectedBrandCn = isset($options['brandNameCn']) ? $options['brandNameCn'] : '';//当前选中的品牌中文名(只有品牌页有此参数)
1875 $selectedBrand = isset($options['brandNameEn']) ? $options['brandNameEn'] : '';//当前选中的品牌中文名(只有品牌页有此参数) 1897 $selectedBrand = isset($options['brandNameEn']) ? $options['brandNameEn'] : '';//当前选中的品牌中文名(只有品牌页有此参数)
  1898 + $B = $selectedBrand;
  1899 + $BB = $selectedBrand . ' ' . $selectedBrandCn;
  1900 + $C = $channelCnName;
  1901 + $BC = $selectedBrand . $channelCnName;
  1902 + $BBC = $selectedBrand . $selectedBrandCn . $channelCnName;
1876 return array( 1903 return array(
1877 - 'title' => $selectedBrand . '|' . $selectedBrand . ' ' . $selectedBrandCn . '|' . $channelCnName . '品牌' . '|YOHO!有货 100%正品保证',  
1878 - 'keywords' => $selectedBrand . ',' . $selectedBrand . ' ' . $selectedBrandCn . ',' . $selectedBrand . $channelCnName . '品牌',  
1879 - 'description' => $selectedBrand . '正品网购。' . $selectedBrand . $selectedBrandCn . $channelCnName . '品牌' . '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。' 1904 + 'title' => (!empty($B)?$B.'|':'') . (!empty($selectedBrand)&&!empty($selectedBrandCn)?$BB.'|':''). $channelCnName . '品牌' . '|YOHO!有货 100%正品保证',
  1905 + 'keywords' => (!empty($B)?$B.',':'') . (!empty($selectedBrand)&&!empty($selectedBrandCn)?$BB.',':'') . (!empty($BC)?$BC:'') . '品牌',
  1906 + 'description' => $selectedBrand . '正品网购。' . (!empty($BBC)?$BBC:'') . '品牌' . '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。'
1880 ); 1907 );
1881 } 1908 }
1882 //list页seo 1909 //list页seo
1883 if ($options['controller'] == 'List' && $options['action'] == 'index') { 1910 if ($options['controller'] == 'List' && $options['action'] == 'index') {
  1911 + $BMPCM = $selectedBrand . $selectedMisort . $selectedPrice . $channelCnName . $selectedMsort;
  1912 + $BM = $selectedBrand . $selectedMisort;
  1913 + $BMP = $selectedBrand . $selectedMisort . $selectedPrice;
  1914 + $CMBM = $channelCnName . $selectedMsort . $selectedBrand . $selectedMisort;
  1915 + $CM = $channelCnName . $selectedMsort;
1884 return array( 1916 return array(
1885 - 'title' => $selectedBrand . $selectedMisort . $selectedPrice . $channelCnName . $selectedMsort . '|YOHO!有货 100%正品保证',  
1886 - 'keywords' => $selectedBrand . $selectedMisort . ',' . $selectedBrand . $selectedMisort . $selectedPrice . ',' . $channelCnName . $selectedMsort . $selectedBrand . $selectedMisort,  
1887 - 'description' => $selectedBrand . $selectedMisort . $selectedPrice . '正品网购。' . $channelCnName . $selectedMsort . ',' . $selectedBrand . $selectedMisort . '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。' 1917 + 'title' => (!empty($BMPCM)?$BMPCM.'|':''). 'YOHO!有货 100%正品保证',
  1918 + 'keywords' => (!empty($BM)?$BM.',':'') . (!empty($BMP)?$BMP.',':''). $CMBM,
  1919 + 'description' => $BMP . '正品网购。' . (!empty($CM)?$CM.',':''). $BM . '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。'
1888 ); 1920 );
1889 } 1921 }
1890 return array(); 1922 return array();
@@ -151,6 +151,18 @@ @@ -151,6 +151,18 @@
151 <td> 151 <td>
152 <a class="thumb-link" href="{{url}}"> 152 <a class="thumb-link" href="{{url}}">
153 <img class="thumb" src="{{img}}"> 153 <img class="thumb" src="{{img}}">
  154 + {{#if freebie}}
  155 + <span class="freebie-tag">赠品</span>
  156 + {{/if}}
  157 + {{#if advanceBuy}}
  158 + <span class="advance-buy-tag">加价购</span>
  159 + {{/if}}
  160 + {{#if virtualGood}}
  161 + <span class="virtual-good-tag">虚拟商品</span>
  162 + {{/if}}
  163 + {{#if preSallGood}}
  164 + <span class="presall-tag">预售</span>
  165 + {{/if}}
154 </a> 166 </a>
155 <p class="name-color-size"> 167 <p class="name-color-size">
156 <a class="name" href="{{url}}">{{name}}</a> 168 <a class="name" href="{{url}}">{{name}}</a>
@@ -180,7 +192,7 @@ @@ -180,7 +192,7 @@
180 {{#if freight}} 192 {{#if freight}}
181 <p>运费:{{freight}}元</p> 193 <p>运费:{{freight}}元</p>
182 {{/if}} 194 {{/if}}
183 - <p>YOHO币抵扣:{{yohoCoin}}元</p> 195 + <p> {{yohoCoin}}</p>
184 {{#if coupons}} 196 {{#if coupons}}
185 <p>抵用券抵扣:{{coupons}}元</p> 197 <p>抵用券抵扣:{{coupons}}元</p>
186 {{/if}} 198 {{/if}}
@@ -125,18 +125,30 @@ @@ -125,18 +125,30 @@
125 <div id="foot-mobile"> 125 <div id="foot-mobile">
126 <ul class="mobile clearfix"> 126 <ul class="mobile clearfix">
127 <li> 127 <li>
128 - <a href="http://app.yohoshow.com/" target="_blank">  
129 - <img class="lazy" data-original="http://img13.static.yhbimg.com/adpic/2014/07/21/15/02d5e1cbc15ab59856f4a758fa860462ed.jpg"> 128 + <a href="http://www.yohomars.com/" target="_blank">
  129 + {{#if devEnv}}
  130 + <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/mars.png">
  131 + {{^}}
  132 + <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/mars.png">
  133 + {{/if}}
130 </a> 134 </a>
131 </li> 135 </li>
132 <li> 136 <li>
133 - <a href="http://www.yohoboys.com/" target="_blank">  
134 - <img class="lazy" data-original="http://img13.static.yhbimg.com/adpic/2014/07/21/15/0210a3490eae2aad6ef8bf3b8133a49ca9.jpg"> 137 + <a href="http://app.yohoshow.com/" target="_blank">
  138 + {{#if devEnv}}
  139 + <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/show.png">
  140 + {{^}}
  141 + <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/show.png">
  142 + {{/if}}
135 </a> 143 </a>
136 </li> 144 </li>
137 <li> 145 <li>
138 - <a href="http://www.yohogirls.com/" target="_blank">  
139 - <img class="lazy" data-original="http://img11.static.yhbimg.com/adpic/2014/07/21/15/018be2a193424658b5201240ef8c7729e6.jpg"> 146 + <a href="http://www.yoho.cn/product#yoho" target="_blank">
  147 + {{#if devEnv}}
  148 + <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/yoho.png">
  149 + {{^}}
  150 + <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/yoho.png">
  151 + {{/if}}
140 </a> 152 </a>
141 </li> 153 </li>
142 </ul> 154 </ul>
@@ -36,7 +36,7 @@ class ErrorController extends WebAction @@ -36,7 +36,7 @@ class ErrorController extends WebAction
36 // @todo debug 36 // @todo debug
37 // echo $exception->getMessage(); 37 // echo $exception->getMessage();
38 // 生成HTML (error.html) 38 // 生成HTML (error.html)
39 - //$this->_view->html('error_'.$channel); 39 + $this->_view->html('error_'.$channel);
40 // 渲染模板 40 // 渲染模板
41 $this->_view->display('index', array('errorPage' => true,'newProductLink'=> Helpers::url('/product/new'))); 41 $this->_view->display('index', array('errorPage' => true,'newProductLink'=> Helpers::url('/product/new')));
42 } 42 }
@@ -186,21 +186,48 @@ class OrderModel @@ -186,21 +186,48 @@ class OrderModel
186 $detail['goods'][$gok]['coin'] = $gov['yoho_give_coin']; 186 $detail['goods'][$gok]['coin'] = $gov['yoho_give_coin'];
187 $detail['goods'][$gok]['num'] = $gov['buy_number']; 187 $detail['goods'][$gok]['num'] = $gov['buy_number'];
188 $detail['goods'][$gok]['sum'] = $gov['goods_amount']; 188 $detail['goods'][$gok]['sum'] = $gov['goods_amount'];
  189 + $detail['goods'][$gok]['sku'] = $gov['product_sku'];
  190 + $goodsTagName = self::getGoodsTag($orderDetail['attribute'], $gov['goods_type']);
  191 + if ($goodsTagName) {
  192 + $detail['goods'][$gok][$goodsTagName] = TRUE;
  193 + }
189 } 194 }
190 } 195 }
191 $detail['sumPrice'] = $orderDetail['goods_total_amount']; 196 $detail['sumPrice'] = $orderDetail['goods_total_amount'];
  197 + if (!strstr($orderDetail['shipping_cost'], '0.00')) {
192 $detail['freight'] = $orderDetail['shipping_cost']; 198 $detail['freight'] = $orderDetail['shipping_cost'];
193 - $detail['yohoCoin'] = $orderDetail['yoho_coin_num']; 199 + }
  200 + if ($orderDetail['attribute'] == 3) {
  201 + $detail['yohoCoin'] = 'YOHO币使用:' . floatval(substr($orderDetail['yoho_coin_num'], 3)) * 100;
  202 + $detail['yohoCoin'].='个';
  203 + }
  204 + else {
  205 + $detail['yohoCoin'] = 'YOHO币抵扣:' . $orderDetail['yoho_coin_num'] . '元';
  206 + }
194 $detail['yohoCoinUrl'] = Helpers::url('/help', array('category_id' => 87)); //什么是yoho币介绍 207 $detail['yohoCoinUrl'] = Helpers::url('/help', array('category_id' => 87)); //什么是yoho币介绍
  208 + if (!strstr($orderDetail['coupons_amount'], '0.00')) {
195 $detail['coupons'] = $orderDetail['coupons_amount']; 209 $detail['coupons'] = $orderDetail['coupons_amount'];
  210 + }
196 $detail['payment'] = $orderDetail['amount']; 211 $detail['payment'] = $orderDetail['amount'];
197 - $detail['remark'] = '';//$orderDetail['remark']  
198 - $detail['operation'] = self::getOrderDetailOp($orderDetail['order_code'], $orderDetail['payment'], $orderDetail['status'], $orderDetail['is_cancel'], $orderDetail['payment_status'], $orderDetail['payment_type'], 1, $orderDetail['attribute']); //,$orderDetail['order_type_value'] 212 + $detail['remark'] = ''; //$orderDetail['remark']
  213 + $detail['operation'] = self::getOrderDetailOp($orderDetail['order_code'], $orderDetail['payment'], $orderDetail['status'], $orderDetail['is_cancel'], $orderDetail['payment_status'], $orderDetail['payment_type'], 1, $orderDetail['attribute'], 'N'); //,$orderDetail['order_type_value']
199 } 214 }
200 return $detail; 215 return $detail;
201 } 216 }
202 217
203 /** 218 /**
  219 + * 获取虚拟商品二维码图片
  220 + * @param type $uid
  221 + * @param type $sku
  222 + */
  223 + public static function getTicketImgs($uid,$sku)
  224 + {
  225 + $data = OrderData::getYohoodTicket($uid, $sku);
  226 +// var_dump($data);
  227 +// die();
  228 + }
  229 +
  230 + /**
204 * 订单详情页物流 231 * 订单详情页物流
205 * 232 *
206 */ 233 */
@@ -240,7 +267,7 @@ class OrderModel @@ -240,7 +267,7 @@ class OrderModel
240 /** 267 /**
241 * 订单详情页操作步骤 268 * 订单详情页操作步骤
242 */ 269 */
243 - protected static function getOrderDetailOp($orderCode, $payment, $status, $isCancel, $paymentStatus, $paymentType, $orderType, $attribute) 270 + protected static function getOrderDetailOp($orderCode, $payment, $status, $isCancel, $paymentStatus, $paymentType, $orderType, $attribute, $refundStatus)
244 { 271 {
245 $operation = array(); 272 $operation = array();
246 //立刻付款 273 //立刻付款
@@ -256,6 +283,9 @@ class OrderModel @@ -256,6 +283,9 @@ class OrderModel
256 $operation +=array('paid' => TRUE); 283 $operation +=array('paid' => TRUE);
257 } 284 }
258 //确认收货 285 //确认收货
  286 + if ($status >= 4 && $status < 6 && $refundStatus == 0 && $attribute != 3 && $isCancel == 'N') {
  287 + $operation[] += array('shipped' => TRUE);
  288 + }
259 //订单已取消 289 //订单已取消
260 if ($isCancel == 'Y') { 290 if ($isCancel == 'Y') {
261 $operation +=array('cancel' => TRUE); 291 $operation +=array('cancel' => TRUE);
@@ -122,7 +122,7 @@ class ItemModel @@ -122,7 +122,7 @@ class ItemModel
122 $goodsInfo['fashionTopGoods'] = array( 122 $goodsInfo['fashionTopGoods'] = array(
123 'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态 123 'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
124 'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码 124 'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
125 - 'LimitedCodeSoldOut'=> $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光 125 + 'limitedCodeSoldOut'=> $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
126 'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效 126 'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
127 ); 127 );
128 if($fashTopGoods['soldOut']) { 128 if($fashTopGoods['soldOut']) {
@@ -1124,7 +1124,6 @@ class ItemModel @@ -1124,7 +1124,6 @@ class ItemModel
1124 $result['dis'] = true; 1124 $result['dis'] = true;
1125 } else { 1125 } else {
1126 $result['openSoon'] = true; 1126 $result['openSoon'] = true;
1127 - $result['limitedCodeSoldOut'] = true;  
1128 $result['hasLimitedCode'] = false; 1127 $result['hasLimitedCode'] = false;
1129 } 1128 }
1130 break; 1129 break;
@@ -1132,6 +1131,7 @@ class ItemModel @@ -1132,6 +1131,7 @@ class ItemModel
1132 $result['buyNow'] = true; 1131 $result['buyNow'] = true;
1133 $result['dis'] = true; 1132 $result['dis'] = true;
1134 $result['limitedCodeSoldOut'] = true; 1133 $result['limitedCodeSoldOut'] = true;
  1134 + $result['getLimitedCode'] = false;
1135 $result['hasLimitedCode'] = false; 1135 $result['hasLimitedCode'] = false;
1136 break; 1136 break;
1137 case 3: // 开售后,商品已经售罄 1137 case 3: // 开售后,商品已经售罄
@@ -1142,7 +1142,6 @@ class ItemModel @@ -1142,7 +1142,6 @@ class ItemModel
1142 $result['buyNow'] = true; 1142 $result['buyNow'] = true;
1143 $result['dis'] = false; 1143 $result['dis'] = false;
1144 $result['hasLimitedCode'] = true; 1144 $result['hasLimitedCode'] = true;
1145 - $result['limitedCodeSoldOut'] = true;  
1146 if(!empty($uid)) {//限购码失效 1145 if(!empty($uid)) {//限购码失效
1147 $result['getLimitedCodeDis'] = true; 1146 $result['getLimitedCodeDis'] = true;
1148 } 1147 }
@@ -1151,12 +1150,12 @@ class ItemModel @@ -1151,12 +1150,12 @@ class ItemModel
1151 $result['openSoon'] = true; 1150 $result['openSoon'] = true;
1152 $result['hasLimitedCode'] = true; 1151 $result['hasLimitedCode'] = true;
1153 $result['limitedCodeSoldOut'] = true; 1152 $result['limitedCodeSoldOut'] = true;
  1153 + $result['getLimitedCode'] = false;
1154 1154
1155 break; 1155 break;
1156 case 6: // 开售前,即将开售(用户已领取限购码) 1156 case 6: // 开售前,即将开售(用户已领取限购码)
1157 $result['openSoon'] = true; 1157 $result['openSoon'] = true;
1158 $result['hasLimitedCode'] = true; 1158 $result['hasLimitedCode'] = true;
1159 - $result['limitedCodeSoldOut'] = true;  
1160 if(!empty($uid)) {//限购码失效 1159 if(!empty($uid)) {//限购码失效
1161 $result['getLimitedCodeDis'] = true; 1160 $result['getLimitedCodeDis'] = true;
1162 } 1161 }
@@ -35,20 +35,6 @@ class SaleModel @@ -35,20 +35,6 @@ class SaleModel
35 //获取$condition和$option 筛选条件和排序条件 35 //获取$condition和$option 筛选条件和排序条件
36 $searchCondition = SearchModel::searchCondition($customCondition, $customOptions); 36 $searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
37 37
38 - if (USE_CACHE) {  
39 - $key = WebCacheConfig::KEY_WEB_PRODUCT_SALE_INDEX;  
40 - if (!empty($searchCondition['userInput'])) {  
41 - $key .= http_build_query($searchCondition['userInput'], null, '&');  
42 - }  
43 - $channel = HomeModel::getSwitchChannel();  
44 - //key加上性别参数  
45 - $key .= $channel;  
46 - // 先尝试获取一级缓存(master), 有数据则直接返回.  
47 - $result = Cache::get($key, 'master');  
48 - if (!empty($result)) {  
49 - return $result;  
50 - }  
51 - }  
52 38
53 // 组合搜索商品url 39 // 组合搜索商品url
54 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']); 40 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
@@ -89,16 +75,6 @@ class SaleModel @@ -89,16 +75,6 @@ class SaleModel
89 $result['leftContent'][]['picLink']['list'] = $nodeContent; 75 $result['leftContent'][]['picLink']['list'] = $nodeContent;
90 } 76 }
91 77
92 - if (USE_CACHE) {  
93 - // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.  
94 - if (empty($result)) {  
95 - $result = Cache::get($key, 'slave');  
96 - }  
97 - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存  
98 - elseif(isset($data['product']) && !empty($data['product']['product_list']) && isset($data['sort']) && !empty($data['sort'])) {  
99 - Cache::set($key, $result, 1800); // 缓存30分钟  
100 - }  
101 - }  
102 78
103 return $result; 79 return $result;
104 } 80 }
1 -<?php  
2 -  
3 -use Action\WebAction;  
4 -use WebPlugin\Helpers;  
5 -use Shopping\CartModel;  
6 -use Product\ItemModel;  
7 -  
8 -/**  
9 - * 购物车相关的控制器  
10 - *  
11 - * @name IndexController  
12 - * @package Cart  
13 - * @copyright yoho.inc  
14 - * @version 1.0 (2016-2-17 15:43:19)  
15 - * @author fei.hong <fei.hong@yoho.cn>  
16 - */  
17 -class IndexController extends WebAction  
18 -{  
19 -  
20 - /**  
21 - * 通过当前用户审判是否跳到登录  
22 - *  
23 - * @param boolean $useSession (true:从服务端session中检查, false:从客户端cookie中检查)  
24 - * @pram string $refer 指定的来源地址  
25 - * @return void  
26 - */  
27 - protected function auditJumpLogin($useSession = true, $refer = '')  
28 - {  
29 - $uid = $this->getUid($useSession);  
30 - if (!$uid) {  
31 - if (empty($refer)) {  
32 - $refer = $this->server('HTTP_REFERER', SITE_MAIN);  
33 - }  
34 - $this->go(Helpers::url('/signin.html', array('refer' => $refer)));  
35 - }  
36 - }  
37 -  
38 - /**  
39 - * 我的购物车  
40 - */  
41 - public function indexAction()  
42 - {  
43 - $uid = $this->getUid(true);  
44 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
45 -  
46 - // 显示一次并清除已删除的COOKIE记录  
47 - $cartDelList = $this->getCookie('cart-del-list');  
48 - if (!empty($cartDelList)) {  
49 - $this->setCookie('cart-del-list', '');  
50 - }  
51 -  
52 - $this->setTitle('购物车', true, ' | ');  
53 - $this->setSimpleHeader();  
54 - $this->_view->display('cart', array(  
55 - 'cartEnsurePage' => true,  
56 - 'cartEnsure' => CartModel::myCartData($uid, $shoppingKey, $cartDelList),  
57 - ));  
58 - }  
59 -  
60 - /**  
61 - * 购物车商品选择与取消  
62 - *  
63 - * @param string skuList 商品sku列表,json格式,如{"744403":1,"777777":3}  
64 - * @return json  
65 - */  
66 - public function selectAction()  
67 - {  
68 - $result = array();  
69 -  
70 - if ($this->isAjax()) {  
71 - $productId = $this->post('skuList', 0);  
72 - $uid = $this->getUid(true);  
73 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
74 - $result = CartModel::selectGoods($uid, $productId, $shoppingKey);  
75 - }  
76 -  
77 - $this->echoJson($result);  
78 - }  
79 -  
80 - /**  
81 - * 修改购物车商品数量  
82 - *  
83 - * @param int sku  
84 - * @param int increaseNum  
85 - * @param int decreaseNum  
86 - * @return json  
87 - */  
88 - public function modifyAction()  
89 - {  
90 - $result = array();  
91 -  
92 - if ($this->isAjax()) {  
93 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
94 -  
95 - $uid = $this->getUid(true);  
96 - $sku = $this->post('sku', 0);  
97 - $increaseNum = $this->post('increaseNum', null);  
98 - $decreaseNum = $this->post('decreaseNum', null);  
99 -  
100 - $result = CartModel::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);  
101 - if (!empty($result['code']) && $result['code'] == 200) {  
102 - $this->setShoppingCookie($uid);  
103 - }  
104 - }  
105 -  
106 - $this->echoJson($result);  
107 - }  
108 -  
109 - /**  
110 - * 移出购物车  
111 - *  
112 - * @param string skuList 商品sku列表,json格式,如{"744403":1,"777777":3}  
113 - * @return json  
114 - */  
115 - public function removeAction()  
116 - {  
117 - $result = array();  
118 -  
119 - if ($this->isAjax()) {  
120 - $skuList = $this->post('skuList', 0);  
121 - $uid = $this->getUid(true);  
122 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
123 - $result = CartModel::removeFromCart($uid, $skuList, $shoppingKey);  
124 - if (!empty($result['code']) && $result['code'] == 200) {  
125 - $this->setShoppingCookie($uid);  
126 - }  
127 - }  
128 -  
129 - $this->echoJson($result);  
130 - }  
131 -  
132 - /**  
133 - * 移入收藏夹  
134 - *  
135 - * 支持批量移入收藏夹  
136 - *  
137 - * @param string 商品sku列表,json格式,如{"744403":1,"777777":3}  
138 - * @return json  
139 - */  
140 - public function favAction()  
141 - {  
142 - $result = array();  
143 -  
144 - if ($this->isAjax()) {  
145 - $skuList = $this->post('skuList');  
146 - $uid = $this->getUid(true);  
147 - $result = CartModel::addToFav($uid, $skuList);  
148 - if (!empty($result['code']) && $result['code'] == 200) {  
149 - $this->setShoppingCookie($uid);  
150 - }  
151 - }  
152 -  
153 - $this->echoJson($result);  
154 - }  
155 -  
156 - /**  
157 - * 检查是否收藏  
158 - *  
159 - * @param string sknList 商品productId列表,如["123123","123412"]  
160 - */  
161 - public function checkFavAction()  
162 - {  
163 - $result = array('code' => 200, 'message' => '是否收藏', 'data' => array());  
164 -  
165 - if ($this->isAjax()) {  
166 - $uid = $this->getUid(false);  
167 - $pidList = $this->post('pidList', '');  
168 - $result['data'] = CartModel::checkUserIsFav($uid, $pidList);  
169 - }  
170 -  
171 - $this->echoJson($result);  
172 - }  
173 -  
174 - /**  
175 - * 凑单商品异步请求  
176 - */  
177 - public function getTogetherProductAction()  
178 - {  
179 - $result = array('code' => 200, 'data' => array(), 'message' => '凑单商品');  
180 -  
181 - if ($this->isAjax()) {  
182 - $page = $this->get('page', 1);  
183 - $result = CartModel::getTogetherProduct($page);  
184 - }  
185 -  
186 - $this->echoJson($result);  
187 - }  
188 -  
189 - /**  
190 - * 最近浏览的商品异步请求  
191 - */  
192 - public function getHistroyProductAction()  
193 - {  
194 - $result = array('code' => 200, 'data' => array(), 'message' => '浏览记录');  
195 -  
196 - do {  
197 - if (!$this->isAjax()) {  
198 - break;  
199 - }  
200 -  
201 - $page = $this->get('page', 1);  
202 -// $uid = $this->getUid(false);  
203 -// if ($uid) {  
204 -// $udid = $this->getUdid();  
205 -// $result = CartModel::getBrowseProduct($uid, $udid, $page);  
206 -// break;  
207 -// }  
208 -  
209 - $sknList = $this->getCookie('_browseskn');  
210 - if (empty($sknList)) {  
211 - break;  
212 - }  
213 - $sknList = explode(',', rawurldecode($sknList));  
214 - $result = CartModel::getNamedBrowseProduct($page, 6, $sknList);  
215 - }  
216 - while (false);  
217 -  
218 - $this->echoJson($result);  
219 - }  
220 -  
221 - /**  
222 - * 确认订单  
223 - */  
224 - public function orderEnsureAction()  
225 - {  
226 - $type = $this->get('type', 1);  
227 - $refer = Helpers::url('/cart/index/orderEnsure', array('type' => $type));  
228 -  
229 - // 审判用户是否已登录  
230 - $this->auditJumpLogin(true, $refer);  
231 -  
232 - $this->setTitle('填写订单', true, ' | ');  
233 - $this->setSimpleHeader();  
234 -  
235 - $cartType = ($type == 2) ? 'advance' : 'ordinary';  
236 - $isAdvanceCart = ($type == 2) ? true : false;  
237 - $uid = $this->getUid(true);  
238 -  
239 - $orderEnsure = CartModel::cartPay($uid, $cartType, $isAdvanceCart);  
240 - if (empty($orderEnsure)) {  
241 - $this->go(Helpers::url('/shopping/cart'));  
242 - }  
243 -  
244 - $this->_view->display('order-ensure', array(  
245 - 'orderEnsurePage' => true,  
246 - 'orderEnsure' => $orderEnsure,  
247 - ));  
248 - }  
249 -  
250 - /**  
251 - * 异步获取地址信息  
252 - *  
253 - * @return json  
254 - */  
255 - public function getAddressAction()  
256 - {  
257 - $result = array('code' => 200, 'data' => array(), 'message' => '地址信息');  
258 -  
259 - if ($this->isAjax()) {  
260 - $uid = $this->getUid(true);  
261 - $result['data'] = CartModel::userAddressList($uid);  
262 - }  
263 -  
264 - $this->echoJson($result);  
265 - }  
266 -  
267 - /**  
268 - * 设置为默认的地址  
269 - *  
270 - * @param int id 地址ID  
271 - * @return json  
272 - */  
273 - public function setDefaultAddressAction()  
274 - {  
275 - $result = array();  
276 -  
277 - if ($this->isAjax()) {  
278 - $uid = $this->getUid(true);  
279 - $addressId = $this->post('id');  
280 - $result = CartModel::setDefaultAddress($uid, $addressId);  
281 - }  
282 -  
283 - $this->echoJson($result);  
284 - }  
285 -  
286 - /**  
287 - * 保存地址信息  
288 - *  
289 - * @param int $id 地址ID ,当修改操作的时候需要传,添加时候不需要传  
290 - * @param string $address 地址信息  
291 - * @param int $areaCode 城市码  
292 - * @param string $consignee 收货人  
293 - * @param string $email 邮箱地址  
294 - * @param string $mobile 手机号码  
295 - * @param string $zipCode 邮编  
296 - * @return json  
297 - */  
298 - public function saveAddressAction()  
299 - {  
300 - $result = array();  
301 -  
302 - if ($this->isAjax()) {  
303 - $uid = $this->getUid(true);  
304 - $id = $this->post('id', null);  
305 - $address = $this->post('address', '');  
306 - $areaCode = $this->post('areaCode', '');  
307 - $consignee = $this->post('consignee', '');  
308 - $email = $this->post('email', '');  
309 - $mobile = $this->post('mobile', '');  
310 - $zipCode = $this->post('zipCode', '');  
311 - $result = CartModel::saveAddressData($uid, $address, $areaCode, $consignee, $email, $id, $mobile, $zipCode);  
312 - }  
313 -  
314 - $this->echoJson($result);  
315 - }  
316 -  
317 - /**  
318 - * 删除地址  
319 - *  
320 - * @param int id 地址ID  
321 - */  
322 - public function delAddressAction()  
323 - {  
324 - $result = array();  
325 -  
326 - if ($this->isAjax()) {  
327 - $uid = $this->getUid(true);  
328 - $addressId = $this->post('id');  
329 - $result = CartModel::delAddress($uid, $addressId);  
330 - }  
331 -  
332 - $this->echoJson($result);  
333 - }  
334 -  
335 - /**  
336 - * 获取省市区县信息列表  
337 - *  
338 - * @param int id  
339 - * @return json  
340 - */  
341 - public function getAreaListAction()  
342 - {  
343 - $result = array('code' => 200, 'message' => '地区信息', 'data' => array());  
344 -  
345 - if ($this->isAjax()) {  
346 - $id = $this->get('id', 0);  
347 - $result['data'] = CartModel::getAreaList($id);  
348 - }  
349 -  
350 - $this->echoJson($result);  
351 - }  
352 -  
353 - /**  
354 - * 获取优惠券列表  
355 - *  
356 - * @return json  
357 - */  
358 - public function getCouponListAction()  
359 - {  
360 - $result = array('code' => 200, 'message' => '优惠券信息', 'data' => array());  
361 -  
362 - if ($this->isAjax()) {  
363 - $uid = $this->getUid(true);  
364 - $result['data'] = CartModel::getCouponList($uid);  
365 - }  
366 -  
367 - $this->echoJson($result);  
368 - }  
369 -  
370 - /**  
371 - * 购物车选择改变字段,重新运算订单数据  
372 - *  
373 - * @param string $cartType 购物车类型,ordinary表示普通, advance表示预售  
374 - * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运  
375 - * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款  
376 - * @param string $couponCode 优惠券码  
377 - * @param mixed $yohoCoin 使用的YOHO币数量  
378 - * @param int $redEnvelopes 红包  
379 - * @return json  
380 - */  
381 - public function orderComputeAction()  
382 - {  
383 - $result = array();  
384 -  
385 - if ($this->isAjax()) {  
386 - $cartType = $this->post('cartType', 'ordinary');  
387 - $deliveryWay = $this->post('deliveryWay', 1);  
388 - $paymentType = $this->post('paymentType', 1);  
389 - $couponCode = $this->post('couponCode', null);  
390 - $yohoCoin = $this->post('yohoCoin', null);  
391 - $redEnvelopes = $this->post('redEnvelopes', null);  
392 - $uid = $this->getUid(true);  
393 - $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes);  
394 - }  
395 -  
396 - $this->echoJson($result);  
397 - }  
398 -  
399 - /**  
400 - * 确认结算订单  
401 - *  
402 - * @param int $addressId 地址ID  
403 - * @param int $cartType 购物车类型ID  
404 - * @param int $deliveryTimeId 寄送时间ID  
405 - * @param int $deliveryWayId 寄送方式ID  
406 - * @param string $invoiceTitle 发票抬头  
407 - * @param int $invoiceId 发票类型ID  
408 - * @param int $paymentId 支付方式ID  
409 - * @param int $paymentType 支付类型ID  
410 - * @param string $remark 留言  
411 - * @param string $couponCode 优惠券码  
412 - * @param mixed $yohoCoin 使用的YOHO币数量或为空  
413 - * @param int $isPreContact 送货前是否联系 true:是, false:否  
414 - * @param int $isPrintPrice 是否打印价格 true:是, false:否  
415 - * @param int $redEnvelopes 红包  
416 - * @return json  
417 - */  
418 - public function orderSubAction()  
419 - {  
420 - $result = array('code' => 400, 'data' => array(), 'message' => CartModel::ERROR_400_MESSAGE);  
421 -  
422 - do {  
423 - // 判断是否是AJAX请求  
424 - if (!$this->isAjax()) {  
425 - break;  
426 - }  
427 -  
428 - // 判断用户是否登录  
429 - $uid = $this->getUid(true);  
430 - if (!$uid) {  
431 - $result['message'] = '请先登录';  
432 - break;  
433 - }  
434 -  
435 - $addressId = $this->post('addressId', null);  
436 - $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车  
437 - $deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送  
438 - $deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递  
439 - $invoiceTitle = $this->post('invoiceTitle', null); // 发票抬头  
440 - $invoiceId = $this->post('invoiceId', null); // 发票类型  
441 - $paymentId = $this->post('paymentId', 15); // 支付ID  
442 - $paymentType = $this->post('paymentType', 1); // 默认在线支付  
443 - $remark = $this->post('remark', ''); // 备注信息  
444 - $couponCode = $this->post('couponCode', null); // 优惠码  
445 - $yohoCoin = $this->post('yohoCoin', 1); // YOHO币  
446 - $isPreContact = $this->post('isPreContact', false); // 送货前是否联系  
447 - $isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格  
448 - $redEnvelopes = $this->post('redEnvelopes', null);  
449 -  
450 - // 调用下单接口  
451 - $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId,  
452 - $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);  
453 -  
454 - // 判断是否下单成功  
455 - if (empty($result['data']['order_code'])) {  
456 - break;  
457 - }  
458 -  
459 - // 跳转到支付的URL链接  
460 - $result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code']));  
461 - }  
462 - while (false);  
463 -  
464 -// $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);  
465 -//  
466 -// // 记录下单异常的数据  
467 -// if (empty($result)) {  
468 -// $message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime  
469 -// . ',deliveryWay:' . $deliveryWay . 'invoiceTitle:' . $invoiceTitle . ',invoiceId:' . $invoiceId . ',yohoCoin:' . $yohoCoin  
470 -// . ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";  
471 -// error_log($message, 3, '/Data/logs/php/pc_error/order.' . date('Ym') . '.log');  
472 -// }  
473 -// // 返回数据  
474 -// else {  
475 -// // 提交成功清除Cookie  
476 -// $this->setCookie('order-info', null);  
477 -//  
478 -// $this->echoJson($result);  
479 -// }  
480 -//  
481 -// if ($uid && !empty($result['data'])) {  
482 -// try {  
483 -// UnionTrans::set($uid, $result['data']['order_code'], $result['data']['order_amount']);  
484 -// } catch (Exception $e) {  
485 -// // do nothing  
486 -// }  
487 -// }  
488 -  
489 - $this->echoJson($result);  
490 - }  
491 -  
492 - /**  
493 - * 加入购物车  
494 - *  
495 - * @param string productSku 商品的SKU  
496 - * @param int buyNumber 购买数量  
497 - * @param int promotionId 促销ID, 加价购有关  
498 - * @param int goodsType 商品类型,0表示普通商品,1表示加价购商品  
499 - * @param int isEdit 是否是编辑商品SKU,0表示不是编辑  
500 - * @return json  
501 - */  
502 - public function addAction()  
503 - {  
504 - $result = array();  
505 -  
506 - if ($this->isAjax()) {  
507 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
508 - $productSku = $this->post('productSku');  
509 - $buyNumber = $this->post('buyNumber', 1);  
510 - $goodsType = $this->post('goodsType', 0);  
511 - $promotionId = $this->post('promotionId', 0);  
512 - $isEdit = $this->post('isEdit', 0);  
513 - $uid = $this->getUid(true);  
514 -  
515 - // 执行加入购物车操作  
516 - $result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);  
517 -  
518 - // 设置加入购物车凭证到客户端浏览器  
519 - if (empty($shoppingKey) && isset($result['data']['shopping_key'])) {  
520 - $this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);  
521 - }  
522 - // 老站购物车需要的COOKIE  
523 - if (isset($result['data']['shopping_key'])) {  
524 - $this->setCookie('_g', json_encode(array(  
525 - '_k' => $result['data']['shopping_key'],  
526 - '_nac' => $result['data']['goods_count'],  
527 - '_ac' => 0,  
528 - '_r' => 1  
529 - )));  
530 - }  
531 - }  
532 -  
533 - $this->echoJson($result);  
534 - }  
535 -  
536 - /**  
537 - * 获取商品信息  
538 - */  
539 - public function getProductInfoAction()  
540 - {  
541 - $productId = $this->get('productId');  
542 - $uid = $this->getUid();  
543 - $vipLevel = -1;  
544 - $data = array();  
545 - if(!empty($this->_vip)) {  
546 - $vipLevel = Helpers::getVipLevel($this->_vip);  
547 - }  
548 - if(!empty($productId)) {  
549 - $data = ItemModel::getCartProductInfo($productId, $uid, $vipLevel);  
550 - }  
551 - $this->_view->display('goods-detail', $data);  
552 - }  
553 -  
554 - /**  
555 - * 获取购物车商品总数  
556 - *  
557 - * @return jsonp  
558 - */  
559 - public function countAction()  
560 - {  
561 - $callback = $this->get('callback', 'callback');  
562 - $uid = $this->getUid(false);  
563 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
564 - $result = CartModel::getCartCount($uid, $shoppingKey);  
565 -  
566 - $this->helpJsonCallbackResult($callback, 200, '总数', $result);  
567 - }  
568 -  
569 - /**  
570 - * 设置购物车COOKIE信息  
571 - */  
572 - private function setShoppingCookie($uid = null)  
573 - {  
574 - ($uid === null) ? $uid = $this->getUid(false) : true;  
575 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
576 - $cartCount = CartModel::getCartCount($uid, $shoppingKey);  
577 - if (!empty($cartCount['data']['cart_goods_count'])) {  
578 - $this->setCookie('_g', json_encode(array(  
579 - '_k' => $shoppingKey,  
580 - '_nac' => $cartCount['data']['cart_goods_count'],  
581 - '_ac' => 0,  
582 - '_r' => 1  
583 - )));  
584 - }  
585 - }  
586 -  
587 -}  
1 -<?php  
2 -  
3 -use Action\WebAction;  
4 -use WebPlugin\Helpers;  
5 -use Shopping\CartModel;  
6 -use Product\ItemModel;  
7 -  
8 -/**  
9 - * 购物车相关的控制器  
10 - *  
11 - * @name IndexController  
12 - * @package Cart  
13 - * @copyright yoho.inc  
14 - * @version 1.0 (2016-2-17 15:43:19)  
15 - * @author fei.hong <fei.hong@yoho.cn>  
16 - */  
17 -class IndexController extends WebAction  
18 -{  
19 -  
20 - /**  
21 - * 通过当前用户审判是否跳到登录  
22 - *  
23 - * @param boolean $useSession (true:从服务端session中检查, false:从客户端cookie中检查)  
24 - * @pram string $refer 指定的来源地址  
25 - * @return void  
26 - */  
27 - protected function auditJumpLogin($useSession = true, $refer = '')  
28 - {  
29 - $uid = $this->getUid($useSession);  
30 - if (!$uid) {  
31 - if (empty($refer)) {  
32 - $refer = $this->server('HTTP_REFERER', SITE_MAIN);  
33 - }  
34 - $this->go(Helpers::url('/signin.html', array('refer' => $refer)));  
35 - }  
36 - }  
37 -  
38 - /**  
39 - * 我的购物车  
40 - */  
41 - public function indexAction()  
42 - {  
43 - $uid = $this->getUid(true);  
44 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
45 -  
46 - // 显示一次并清除已删除的COOKIE记录  
47 - $cartDelList = $this->getCookie('cart-del-list');  
48 - if (!empty($cartDelList)) {  
49 - $this->setCookie('cart-del-list', '');  
50 - }  
51 -  
52 - $this->setTitle('购物车', true, ' | ');  
53 - $this->setSimpleHeader();  
54 - $this->_view->display('cart', array(  
55 - 'cartEnsurePage' => true,  
56 - 'cartEnsure' => CartModel::myCartData($uid, $shoppingKey, $cartDelList),  
57 - ));  
58 - }  
59 -  
60 - /**  
61 - * 购物车商品选择与取消  
62 - *  
63 - * @param string skuList 商品sku列表,json格式,如{"744403":1,"777777":3}  
64 - * @return json  
65 - */  
66 - public function selectAction()  
67 - {  
68 - $result = array();  
69 -  
70 - if ($this->isAjax()) {  
71 - $productId = $this->post('skuList', 0);  
72 - $uid = $this->getUid(true);  
73 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
74 - $result = CartModel::selectGoods($uid, $productId, $shoppingKey);  
75 - }  
76 -  
77 - $this->echoJson($result);  
78 - }  
79 -  
80 - /**  
81 - * 修改购物车商品数量  
82 - *  
83 - * @param int sku  
84 - * @param int increaseNum  
85 - * @param int decreaseNum  
86 - * @return json  
87 - */  
88 - public function modifyAction()  
89 - {  
90 - $result = array();  
91 -  
92 - if ($this->isAjax()) {  
93 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
94 -  
95 - $uid = $this->getUid(true);  
96 - $sku = $this->post('sku', 0);  
97 - $increaseNum = $this->post('increaseNum', null);  
98 - $decreaseNum = $this->post('decreaseNum', null);  
99 -  
100 - $result = CartModel::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);  
101 - if (!empty($result['code']) && $result['code'] == 200) {  
102 - $this->setShoppingCookie($uid);  
103 - }  
104 - }  
105 -  
106 - $this->echoJson($result);  
107 - }  
108 -  
109 - /**  
110 - * 移出购物车  
111 - *  
112 - * @param string skuList 商品sku列表,json格式,如{"744403":1,"777777":3}  
113 - * @return json  
114 - */  
115 - public function removeAction()  
116 - {  
117 - $result = array();  
118 -  
119 - if ($this->isAjax()) {  
120 - $skuList = $this->post('skuList', 0);  
121 - $uid = $this->getUid(true);  
122 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
123 - $result = CartModel::removeFromCart($uid, $skuList, $shoppingKey);  
124 - if (!empty($result['code']) && $result['code'] == 200) {  
125 - $this->setShoppingCookie($uid);  
126 - }  
127 - }  
128 -  
129 - $this->echoJson($result);  
130 - }  
131 -  
132 - /**  
133 - * 移入收藏夹  
134 - *  
135 - * 支持批量移入收藏夹  
136 - *  
137 - * @param string 商品sku列表,json格式,如{"744403":1,"777777":3}  
138 - * @return json  
139 - */  
140 - public function favAction()  
141 - {  
142 - $result = array();  
143 -  
144 - if ($this->isAjax()) {  
145 - $skuList = $this->post('skuList');  
146 - $uid = $this->getUid(true);  
147 - $result = CartModel::addToFav($uid, $skuList);  
148 - if (!empty($result['code']) && $result['code'] == 200) {  
149 - $this->setShoppingCookie($uid);  
150 - }  
151 - }  
152 -  
153 - $this->echoJson($result);  
154 - }  
155 -  
156 - /**  
157 - * 检查是否收藏  
158 - *  
159 - * @param string sknList 商品productId列表,如["123123","123412"]  
160 - */  
161 - public function checkFavAction()  
162 - {  
163 - $result = array('code' => 200, 'message' => '是否收藏', 'data' => array());  
164 -  
165 - if ($this->isAjax()) {  
166 - $uid = $this->getUid(false);  
167 - $pidList = $this->post('pidList', '');  
168 - $result['data'] = CartModel::checkUserIsFav($uid, $pidList);  
169 - }  
170 -  
171 - $this->echoJson($result);  
172 - }  
173 -  
174 - /**  
175 - * 凑单商品异步请求  
176 - */  
177 - public function getTogetherProductAction()  
178 - {  
179 - $result = array('code' => 200, 'data' => array(), 'message' => '凑单商品');  
180 -  
181 - if ($this->isAjax()) {  
182 - $page = $this->get('page', 1);  
183 - $result = CartModel::getTogetherProduct($page);  
184 - }  
185 -  
186 - $this->echoJson($result);  
187 - }  
188 -  
189 - /**  
190 - * 最近浏览的商品异步请求  
191 - */  
192 - public function getHistroyProductAction()  
193 - {  
194 - $result = array('code' => 200, 'data' => array(), 'message' => '浏览记录');  
195 -  
196 - do {  
197 - if (!$this->isAjax()) {  
198 - break;  
199 - }  
200 -  
201 - $page = $this->get('page', 1);  
202 -// $uid = $this->getUid(false);  
203 -// if ($uid) {  
204 -// $udid = $this->getUdid();  
205 -// $result = CartModel::getBrowseProduct($uid, $udid, $page);  
206 -// break;  
207 -// }  
208 -  
209 - $sknList = $this->getCookie('_browseskn');  
210 - if (empty($sknList)) {  
211 - break;  
212 - }  
213 - $sknList = explode(',', rawurldecode($sknList));  
214 - $result = CartModel::getNamedBrowseProduct($page, 6, $sknList);  
215 - }  
216 - while (false);  
217 -  
218 - $this->echoJson($result);  
219 - }  
220 -  
221 - /**  
222 - * 确认订单  
223 - */  
224 - public function orderEnsureAction()  
225 - {  
226 - $type = $this->get('type', 1);  
227 - $refer = Helpers::url('/cart/index/orderEnsure', array('type' => $type));  
228 -  
229 - // 审判用户是否已登录  
230 - $this->auditJumpLogin(true, $refer);  
231 -  
232 - $this->setTitle('填写订单', true, ' | ');  
233 - $this->setSimpleHeader();  
234 -  
235 - $cartType = ($type == 2) ? 'advance' : 'ordinary';  
236 - $isAdvanceCart = ($type == 2) ? true : false;  
237 - $uid = $this->getUid(true);  
238 -  
239 - $orderEnsure = CartModel::cartPay($uid, $cartType, $isAdvanceCart);  
240 - if (empty($orderEnsure)) {  
241 - $this->go(Helpers::url('/shopping/cart'));  
242 - }  
243 -  
244 - $this->_view->display('order-ensure', array(  
245 - 'orderEnsurePage' => true,  
246 - 'orderEnsure' => $orderEnsure,  
247 - ));  
248 - }  
249 -  
250 - /**  
251 - * 异步获取地址信息  
252 - *  
253 - * @return json  
254 - */  
255 - public function getAddressAction()  
256 - {  
257 - $result = array('code' => 200, 'data' => array(), 'message' => '地址信息');  
258 -  
259 - if ($this->isAjax()) {  
260 - $uid = $this->getUid(true);  
261 - $result['data'] = CartModel::userAddressList($uid);  
262 - }  
263 -  
264 - $this->echoJson($result);  
265 - }  
266 -  
267 - /**  
268 - * 设置为默认的地址  
269 - *  
270 - * @param int id 地址ID  
271 - * @return json  
272 - */  
273 - public function setDefaultAddressAction()  
274 - {  
275 - $result = array();  
276 -  
277 - if ($this->isAjax()) {  
278 - $uid = $this->getUid(true);  
279 - $addressId = $this->post('id');  
280 - $result = CartModel::setDefaultAddress($uid, $addressId);  
281 - }  
282 -  
283 - $this->echoJson($result);  
284 - }  
285 -  
286 - /**  
287 - * 保存地址信息  
288 - *  
289 - * @param int $id 地址ID ,当修改操作的时候需要传,添加时候不需要传  
290 - * @param string $address 地址信息  
291 - * @param int $areaCode 城市码  
292 - * @param string $consignee 收货人  
293 - * @param string $email 邮箱地址  
294 - * @param string $mobile 手机号码  
295 - * @param string $zipCode 邮编  
296 - * @return json  
297 - */  
298 - public function saveAddressAction()  
299 - {  
300 - $result = array();  
301 -  
302 - if ($this->isAjax()) {  
303 - $uid = $this->getUid(true);  
304 - $id = $this->post('id', null);  
305 - $address = $this->post('address', '');  
306 - $areaCode = $this->post('areaCode', '');  
307 - $consignee = $this->post('consignee', '');  
308 - $email = $this->post('email', '');  
309 - $mobile = $this->post('mobile', '');  
310 - $zipCode = $this->post('zipCode', '');  
311 - $result = CartModel::saveAddressData($uid, $address, $areaCode, $consignee, $email, $id, $mobile, $zipCode);  
312 - }  
313 -  
314 - $this->echoJson($result);  
315 - }  
316 -  
317 - /**  
318 - * 删除地址  
319 - *  
320 - * @param int id 地址ID  
321 - */  
322 - public function delAddressAction()  
323 - {  
324 - $result = array();  
325 -  
326 - if ($this->isAjax()) {  
327 - $uid = $this->getUid(true);  
328 - $addressId = $this->post('id');  
329 - $result = CartModel::delAddress($uid, $addressId);  
330 - }  
331 -  
332 - $this->echoJson($result);  
333 - }  
334 -  
335 - /**  
336 - * 获取省市区县信息列表  
337 - *  
338 - * @param int id  
339 - * @return json  
340 - */  
341 - public function getAreaListAction()  
342 - {  
343 - $result = array('code' => 200, 'message' => '地区信息', 'data' => array());  
344 -  
345 - if ($this->isAjax()) {  
346 - $id = $this->get('id', 0);  
347 - $result['data'] = CartModel::getAreaList($id);  
348 - }  
349 -  
350 - $this->echoJson($result);  
351 - }  
352 -  
353 - /**  
354 - * 获取优惠券列表  
355 - *  
356 - * @return json  
357 - */  
358 - public function getCouponListAction()  
359 - {  
360 - $result = array('code' => 200, 'message' => '优惠券信息', 'data' => array());  
361 -  
362 - if ($this->isAjax()) {  
363 - $uid = $this->getUid(true);  
364 - $result['data'] = CartModel::getCouponList($uid);  
365 - }  
366 -  
367 - $this->echoJson($result);  
368 - }  
369 -  
370 - /**  
371 - * 购物车选择改变字段,重新运算订单数据  
372 - *  
373 - * @param string $cartType 购物车类型,ordinary表示普通, advance表示预售  
374 - * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运  
375 - * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款  
376 - * @param string $couponCode 优惠券码  
377 - * @param mixed $yohoCoin 使用的YOHO币数量  
378 - * @param int $redEnvelopes 红包  
379 - * @return json  
380 - */  
381 - public function orderComputeAction()  
382 - {  
383 - $result = array();  
384 -  
385 - if ($this->isAjax()) {  
386 - $cartType = $this->post('cartType', 'ordinary');  
387 - $deliveryWay = $this->post('deliveryWay', 1);  
388 - $paymentType = $this->post('paymentType', 1);  
389 - $couponCode = $this->post('couponCode', null);  
390 - $yohoCoin = $this->post('yohoCoin', null);  
391 - $redEnvelopes = $this->post('redEnvelopes', null);  
392 - $uid = $this->getUid(true);  
393 - $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes);  
394 - }  
395 -  
396 - $this->echoJson($result);  
397 - }  
398 -  
399 - /**  
400 - * 确认结算订单  
401 - *  
402 - * @param int $addressId 地址ID  
403 - * @param int $cartType 购物车类型ID  
404 - * @param int $deliveryTimeId 寄送时间ID  
405 - * @param int $deliveryWayId 寄送方式ID  
406 - * @param string $invoiceTitle 发票抬头  
407 - * @param int $invoiceId 发票类型ID  
408 - * @param int $paymentId 支付方式ID  
409 - * @param int $paymentType 支付类型ID  
410 - * @param string $remark 留言  
411 - * @param string $couponCode 优惠券码  
412 - * @param mixed $yohoCoin 使用的YOHO币数量或为空  
413 - * @param int $isPreContact 送货前是否联系 true:是, false:否  
414 - * @param int $isPrintPrice 是否打印价格 true:是, false:否  
415 - * @param int $redEnvelopes 红包  
416 - * @return json  
417 - */  
418 - public function orderSubAction()  
419 - {  
420 - $result = array('code' => 400, 'data' => array(), 'message' => CartModel::ERROR_400_MESSAGE);  
421 -  
422 - do {  
423 - // 判断是否是AJAX请求  
424 - if (!$this->isAjax()) {  
425 - break;  
426 - }  
427 -  
428 - // 判断用户是否登录  
429 - $uid = $this->getUid(true);  
430 - if (!$uid) {  
431 - $result['message'] = '请先登录';  
432 - break;  
433 - }  
434 -  
435 - $addressId = $this->post('addressId', null);  
436 - $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车  
437 - $deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送  
438 - $deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递  
439 - $invoiceTitle = $this->post('invoiceTitle', null); // 发票抬头  
440 - $invoiceId = $this->post('invoiceId', null); // 发票类型  
441 - $paymentId = $this->post('paymentId', 15); // 支付ID  
442 - $paymentType = $this->post('paymentType', 1); // 默认在线支付  
443 - $remark = $this->post('remark', ''); // 备注信息  
444 - $couponCode = $this->post('couponCode', null); // 优惠码  
445 - $yohoCoin = $this->post('yohoCoin', 1); // YOHO币  
446 - $isPreContact = $this->post('isPreContact', false); // 送货前是否联系  
447 - $isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格  
448 - $redEnvelopes = $this->post('redEnvelopes', null);  
449 -  
450 - // 调用下单接口  
451 - $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId,  
452 - $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);  
453 -  
454 - // 判断是否下单成功  
455 - if (empty($result['data']['order_code'])) {  
456 - break;  
457 - }  
458 -  
459 - // 跳转到支付的URL链接  
460 - $result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code']));  
461 - }  
462 - while (false);  
463 -  
464 -// $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);  
465 -//  
466 -// // 记录下单异常的数据  
467 -// if (empty($result)) {  
468 -// $message = 'uid:' . $uid . ',addressId:' . $addressId . ',cartType:' . $cartType . ',deliveryTime:' . $deliveryTime  
469 -// . ',deliveryWay:' . $deliveryWay . 'invoiceTitle:' . $invoiceTitle . ',invoiceId:' . $invoiceId . ',yohoCoin:' . $yohoCoin  
470 -// . ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";  
471 -// error_log($message, 3, '/Data/logs/php/pc_error/order.' . date('Ym') . '.log');  
472 -// }  
473 -// // 返回数据  
474 -// else {  
475 -// // 提交成功清除Cookie  
476 -// $this->setCookie('order-info', null);  
477 -//  
478 -// $this->echoJson($result);  
479 -// }  
480 -//  
481 -// if ($uid && !empty($result['data'])) {  
482 -// try {  
483 -// UnionTrans::set($uid, $result['data']['order_code'], $result['data']['order_amount']);  
484 -// } catch (Exception $e) {  
485 -// // do nothing  
486 -// }  
487 -// }  
488 -  
489 - $this->echoJson($result);  
490 - }  
491 -  
492 - /**  
493 - * 加入购物车  
494 - *  
495 - * @param string productSku 商品的SKU  
496 - * @param int buyNumber 购买数量  
497 - * @param int promotionId 促销ID, 加价购有关  
498 - * @param int goodsType 商品类型,0表示普通商品,1表示加价购商品  
499 - * @param int isEdit 是否是编辑商品SKU,0表示不是编辑  
500 - * @return json  
501 - */  
502 - public function addAction()  
503 - {  
504 - $result = array();  
505 -  
506 - if ($this->isAjax()) {  
507 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
508 - $productSku = $this->post('productSku');  
509 - $buyNumber = $this->post('buyNumber', 1);  
510 - $goodsType = $this->post('goodsType', 0);  
511 - $promotionId = $this->post('promotionId', 0);  
512 - $isEdit = $this->post('isEdit', 0);  
513 - $uid = $this->getUid(true);  
514 -  
515 - // 执行加入购物车操作  
516 - $result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);  
517 -  
518 - // 设置加入购物车凭证到客户端浏览器  
519 - if (empty($shoppingKey) && isset($result['data']['shopping_key'])) {  
520 - $this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);  
521 - }  
522 - // 老站购物车需要的COOKIE  
523 - if (isset($result['data']['shopping_key'])) {  
524 - $this->setCookie('_g', json_encode(array(  
525 - '_k' => $result['data']['shopping_key'],  
526 - '_nac' => $result['data']['goods_count'],  
527 - '_ac' => 0,  
528 - '_r' => 1  
529 - )));  
530 - }  
531 - }  
532 -  
533 - $this->echoJson($result);  
534 - }  
535 -  
536 - /**  
537 - * 获取商品信息  
538 - */  
539 - public function getProductInfoAction()  
540 - {  
541 - $productId = $this->get('productId');  
542 - $uid = $this->getUid();  
543 - $vipLevel = -1;  
544 - $data = array();  
545 - if(!empty($this->_vip)) {  
546 - $vipLevel = Helpers::getVipLevel($this->_vip);  
547 - }  
548 - if(!empty($productId)) {  
549 - $data = ItemModel::getCartProductInfo($productId, $uid, $vipLevel);  
550 - }  
551 - $this->_view->display('goods-detail', $data);  
552 - }  
553 -  
554 - /**  
555 - * 获取购物车商品总数  
556 - *  
557 - * @return jsonp  
558 - */  
559 - public function countAction()  
560 - {  
561 - $callback = $this->get('callback', 'callback');  
562 - $uid = $this->getUid(false);  
563 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
564 - $result = CartModel::getCartCount($uid, $shoppingKey);  
565 -  
566 - $this->helpJsonCallbackResult($callback, 200, '总数', $result);  
567 - }  
568 -  
569 - /**  
570 - * 设置购物车COOKIE信息  
571 - */  
572 - private function setShoppingCookie($uid = null)  
573 - {  
574 - ($uid === null) ? $uid = $this->getUid(false) : true;  
575 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
576 - $cartCount = CartModel::getCartCount($uid, $shoppingKey);  
577 - if (!empty($cartCount['data']['cart_goods_count'])) {  
578 - $this->setCookie('_g', json_encode(array(  
579 - '_k' => $shoppingKey,  
580 - '_nac' => $cartCount['data']['cart_goods_count'],  
581 - '_ac' => 0,  
582 - '_r' => 1  
583 - )));  
584 - }  
585 - }  
586 -  
587 -}  
@@ -112,10 +112,10 @@ class OrdersController extends WebAction @@ -112,10 +112,10 @@ class OrdersController extends WebAction
112 'remark' => $detail['remark'], 112 'remark' => $detail['remark'],
113 'goods' => $detail['goods'], 113 'goods' => $detail['goods'],
114 'sumPrice' => $detail['sumPrice'], 114 'sumPrice' => $detail['sumPrice'],
115 - 'freight' => $detail['freight'], 115 + 'freight' => isset($detail['freight']) ? $detail['freight'] : 0,
116 'yohoCoin' => $detail['yohoCoin'], 116 'yohoCoin' => $detail['yohoCoin'],
117 'yohoCoinUrl' => $detail['yohoCoinUrl'], 117 'yohoCoinUrl' => $detail['yohoCoinUrl'],
118 - 'coupons' => $detail['coupons'], 118 + 'coupons' => isset($detail['coupons']) ? $detail['coupons'] : 0,
119 'payment' => $detail['payment'], 119 'payment' => $detail['payment'],
120 'operation' => $detail['operation'] 120 'operation' => $detail['operation']
121 ); 121 );
@@ -195,14 +195,18 @@ class OrdersController extends WebAction @@ -195,14 +195,18 @@ class OrdersController extends WebAction
195 $path = UserModel::getCenterCrumb('查看二维码', array('url' => Helpers::url('/home/orders'), 'name' => '订单中心')); 195 $path = UserModel::getCenterCrumb('查看二维码', array('url' => Helpers::url('/home/orders'), 'name' => '订单中心'));
196 $leftNav = UserModel::getCenterLeftNav('我的订单'); 196 $leftNav = UserModel::getCenterLeftNav('我的订单');
197 197
  198 + $orderCode = $this->get('orderCode', '');
  199 + $detail = OrderModel::getOrderDetail($uid, $orderCode);
  200 + if (isset($detail) && $detail) {
  201 + $tickets = OrderModel::getTicketImgs($uid, $detail['goods'][0]['sku']);
198 $data = array( 202 $data = array(
199 'path' => $path, 203 'path' => $path,
200 'userThumb' => UserModel::getUserHeadImg($uid), 204 'userThumb' => UserModel::getUserHeadImg($uid),
201 'homeNav' => $leftNav, 205 'homeNav' => $leftNav,
202 - 'name' => 'JIT预售虚拟商品Yohood票',  
203 - 'num' => 1,  
204 - 'orderNum' => '160169853',  
205 - 'myOrdersUrl' => '', 206 + 'name' => $detail['goods'][0]['name'],
  207 + 'num' => $detail['goods'][0]['num'],
  208 + 'orderNum' => $detail['orderNum'],
  209 + 'myOrdersUrl' => Helpers::url('/home/orders'),
206 'tickets' => array( 210 'tickets' => array(
207 array( 211 array(
208 'img' => 'http://static.yohobuy.com/images/v2/common/2dcode_disabled.png', 212 'img' => 'http://static.yohobuy.com/images/v2/common/2dcode_disabled.png',
@@ -218,6 +222,7 @@ class OrdersController extends WebAction @@ -218,6 +222,7 @@ class OrdersController extends WebAction
218 ) 222 )
219 ) 223 )
220 ); 224 );
  225 + }
221 226
222 $this->_view->display('ticket', array('meOrderTicket' => $data)); 227 $this->_view->display('ticket', array('meOrderTicket' => $data));
223 } 228 }
@@ -214,17 +214,24 @@ class ItemController extends WebAction @@ -214,17 +214,24 @@ class ItemController extends WebAction
214 if(!empty($browseSknList)) { 214 if(!empty($browseSknList)) {
215 $goodsSknList = explode(',', $browseSknList); 215 $goodsSknList = explode(',', $browseSknList);
216 } 216 }
  217 + //处理存在
217 if(in_array($goodsId, $goodsList) || in_array($skn . '-' . $goodsId, $goodsSknList)) { 218 if(in_array($goodsId, $goodsList) || in_array($skn . '-' . $goodsId, $goodsSknList)) {
218 - return;  
219 - } else { 219 + $key = array_search($goodsId, $goodsList);
  220 + if($key !== false) {
  221 + unset($goodsList[$key]);
  222 + }
  223 + $key = array_search($skn . '-' . $goodsId, $goodsSknList);
  224 + if($key !== false) {
  225 + unset($goodsSknList[$key]);
  226 + }
  227 + }
220 array_unshift($goodsList, $goodsId); 228 array_unshift($goodsList, $goodsId);
221 array_unshift($goodsSknList, $skn . '-' . $goodsId); 229 array_unshift($goodsSknList, $skn . '-' . $goodsId);
222 $browse = implode(',', array_slice($goodsList, 0, 30)); 230 $browse = implode(',', array_slice($goodsList, 0, 30));
223 $browseSkn = implode(',', array_slice($goodsSknList, 0, 30)); 231 $browseSkn = implode(',', array_slice($goodsSknList, 0, 30));
224 -  
225 $this->setCookie('_browse', $browse, 2000000000); 232 $this->setCookie('_browse', $browse, 2000000000);
226 $this->setCookie('_browseskn', $browseSkn, 2000000000); 233 $this->setCookie('_browseskn', $browseSkn, 2000000000);
227 - } 234 +
228 } 235 }
229 236
230 } 237 }
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets/web" 50 application.assets.path = ROOT_PATH "/assets/web"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.9" 53 +application.version = "0.0.10"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" 56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证"
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets/web" 50 application.assets.path = ROOT_PATH "/assets/web"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.9" 53 +application.version = "0.0.10"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" 56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证"
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets/web" 50 application.assets.path = ROOT_PATH "/assets/web"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.9" 53 +application.version = "0.0.10"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" 56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证"
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets/web" 50 application.assets.path = ROOT_PATH "/assets/web"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.9" 53 +application.version = "0.0.10"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" 56 application.seo.title = "YOHO!有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证"
@@ -4,7 +4,7 @@ define('SITE_MAIN', 'http://web.dev.yohobuy.com'); // 网站主域名 @@ -4,7 +4,7 @@ define('SITE_MAIN', 'http://web.dev.yohobuy.com'); // 网站主域名
4 define('OLD_MAIN', 'http://www.yohobuy.com'); // 网站旧域名 4 define('OLD_MAIN', 'http://www.yohobuy.com'); // 网站旧域名
5 define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域 5 define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域
6 define('SUB_DOMAIN', '.yohobuy.com'); // 子域名后缀 6 define('SUB_DOMAIN', '.yohobuy.com'); // 子域名后缀
7 -define('USE_CACHE', false); // 缓存的开关 7 +define('USE_CACHE', true); // 缓存的开关
8 define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 8 define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 9 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
10 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer'); 10 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');