Showing
5 changed files
with
73 additions
and
32 deletions
@@ -68,7 +68,7 @@ class AbstractAction extends Controller_Abstract | @@ -68,7 +68,7 @@ class AbstractAction extends Controller_Abstract | ||
68 | case 'develop': // 开发 | 68 | case 'develop': // 开发 |
69 | default: | 69 | default: |
70 | $this->_view->assign('devEnv', true); | 70 | $this->_view->assign('devEnv', true); |
71 | - $this->_useSession = false; | 71 | + $this->_useSession = true; |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | } | 74 | } |
@@ -329,10 +329,11 @@ class AbstractAction extends Controller_Abstract | @@ -329,10 +329,11 @@ class AbstractAction extends Controller_Abstract | ||
329 | if (!$this->_useSession) { | 329 | if (!$this->_useSession) { |
330 | $useSession = false; | 330 | $useSession = false; |
331 | } | 331 | } |
332 | - $useSession = false; | 332 | + //$useSession = false; |
333 | 333 | ||
334 | if (!$this->_uid) { | 334 | if (!$this->_uid) { |
335 | $cookie = $this->getCookie('_UID'); | 335 | $cookie = $this->getCookie('_UID'); |
336 | + // 兼容老的 | ||
336 | if (!empty($cookie)) { | 337 | if (!empty($cookie)) { |
337 | $cookieList = explode('::', $cookie); | 338 | $cookieList = explode('::', $cookie); |
338 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { | 339 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { |
@@ -352,6 +353,13 @@ class AbstractAction extends Controller_Abstract | @@ -352,6 +353,13 @@ class AbstractAction extends Controller_Abstract | ||
352 | $this->_vip = $cookieList[2]; | 353 | $this->_vip = $cookieList[2]; |
353 | } | 354 | } |
354 | } | 355 | } |
356 | + // 新的, 如果老站没有同步成功,再尝试从SESSION获取 | ||
357 | + elseif ($useSession) { | ||
358 | + $uid = $this->getSession('_LOGIN_UID'); | ||
359 | + if (!empty($uid)) { | ||
360 | + $this->_uid = $uid; | ||
361 | + } | ||
362 | + } | ||
355 | } | 363 | } |
356 | return $this->_uid; | 364 | return $this->_uid; |
357 | } | 365 | } |
@@ -67,7 +67,7 @@ class WebAction extends Controller_Abstract | @@ -67,7 +67,7 @@ class WebAction extends Controller_Abstract | ||
67 | case 'develop': // 开发 | 67 | case 'develop': // 开发 |
68 | default: | 68 | default: |
69 | $this->_view->assign('devEnv', true); | 69 | $this->_view->assign('devEnv', true); |
70 | - $this->_useSession = false; | 70 | + $this->_useSession = true; |
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | } | 73 | } |
@@ -333,9 +333,11 @@ class WebAction extends Controller_Abstract | @@ -333,9 +333,11 @@ class WebAction extends Controller_Abstract | ||
333 | if (!$this->_useSession) { | 333 | if (!$this->_useSession) { |
334 | $useSession = false; | 334 | $useSession = false; |
335 | } | 335 | } |
336 | + //$useSession = false; | ||
336 | 337 | ||
337 | if (!$this->_uid) { | 338 | if (!$this->_uid) { |
338 | $cookie = $this->getCookie('_UID'); | 339 | $cookie = $this->getCookie('_UID'); |
340 | + // 兼容老的 | ||
339 | if (!empty($cookie)) { | 341 | if (!empty($cookie)) { |
340 | $cookieList = explode('::', $cookie); | 342 | $cookieList = explode('::', $cookie); |
341 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { | 343 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { |
@@ -355,6 +357,13 @@ class WebAction extends Controller_Abstract | @@ -355,6 +357,13 @@ class WebAction extends Controller_Abstract | ||
355 | $this->_vip = $cookieList[2]; | 357 | $this->_vip = $cookieList[2]; |
356 | } | 358 | } |
357 | } | 359 | } |
360 | + // 新的, 如果老站没有同步成功,再尝试从SESSION获取 | ||
361 | + elseif ($useSession) { | ||
362 | + $uid = $this->getSession('_LOGIN_UID'); | ||
363 | + if (!empty($uid)) { | ||
364 | + $this->_uid = $uid; | ||
365 | + } | ||
366 | + } | ||
358 | } | 367 | } |
359 | return $this->_uid; | 368 | return $this->_uid; |
360 | } | 369 | } |
@@ -208,7 +208,7 @@ class FloorProcess | @@ -208,7 +208,7 @@ class FloorProcess | ||
208 | foreach ($data['list'] as &$one) { | 208 | foreach ($data['list'] as &$one) { |
209 | if (isset($one['url'])) { | 209 | if (isset($one['url'])) { |
210 | $one['url'] = Helpers::getFilterUrl($one['url']); | 210 | $one['url'] = Helpers::getFilterUrl($one['url']); |
211 | -// isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type]; | 211 | + isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type]; |
212 | } | 212 | } |
213 | $one['img'] = Helpers::getImageUrl($one['src'], 158, 174); | 213 | $one['img'] = Helpers::getImageUrl($one['src'], 158, 174); |
214 | unset($one['src']); | 214 | unset($one['src']); |
@@ -190,7 +190,7 @@ class Helpers | @@ -190,7 +190,7 @@ class Helpers | ||
190 | */ | 190 | */ |
191 | public static function transPrice($price) | 191 | public static function transPrice($price) |
192 | { | 192 | { |
193 | - return (!empty($price) && !is_float($price)) ? $price . '.00' : number_format($price, 2, '.', ''); | 193 | + return number_format($price, 2, '.', ''); |
194 | } | 194 | } |
195 | 195 | ||
196 | /** | 196 | /** |
@@ -566,8 +566,8 @@ class Helpers | @@ -566,8 +566,8 @@ class Helpers | ||
566 | $arr[$key]['appearDate'] = $vo['expect_arrival_time']; | 566 | $arr[$key]['appearDate'] = $vo['expect_arrival_time']; |
567 | } | 567 | } |
568 | // 商品链接 | 568 | // 商品链接 |
569 | - if ($haveLink && isset($vo['product_id'])) { | ||
570 | - $arr[$key]['link'] = self::url('/product/pro_' . $vo['product_id'] . '_' . $vo['goods_id'] . '/' . $vo['cn_alphabet'] . '.html'); | 569 | + if ($haveLink && isset($vo['product_skn'])) { |
570 | + $arr[$key]['link'] = self::url('/product/show_' . $vo['product_skn'] . '.html'); | ||
571 | } | 571 | } |
572 | // 累计购买数 | 572 | // 累计购买数 |
573 | $count += intval($vo['buy_number']); | 573 | $count += intval($vo['buy_number']); |
@@ -576,43 +576,61 @@ class Helpers | @@ -576,43 +576,61 @@ class Helpers | ||
576 | return $arr; | 576 | return $arr; |
577 | } | 577 | } |
578 | 578 | ||
579 | - /** | 579 | +/** |
580 | * 格式化购物车商品 | 580 | * 格式化购物车商品 |
581 | * | 581 | * |
582 | * @param array $cartGoods 购物车商品列表 | 582 | * @param array $cartGoods 购物车商品列表 |
583 | + * @param boolean $isValid 是否是可用商品(非失效商品),默认是 | ||
584 | + * @param bool $isAdvanceCart 是否是预售购物车(和上市期有关) | ||
583 | * @return array 处理之后的购物车商品数据 | 585 | * @return array 处理之后的购物车商品数据 |
584 | */ | 586 | */ |
585 | - public static function formatCartGoods($cartGoods) | 587 | + public static function formatCartGoods($cartGoods, $isAdvanceCart, $isValid = true) |
586 | { | 588 | { |
587 | $arr = array(); | 589 | $arr = array(); |
588 | 590 | ||
589 | $oneGoods = array(); | 591 | $oneGoods = array(); |
590 | foreach ($cartGoods as $key => $value) { | 592 | foreach ($cartGoods as $key => $value) { |
593 | + $oneGoods = array(); | ||
591 | $oneGoods['id'] = $value['product_sku']; | 594 | $oneGoods['id'] = $value['product_sku']; |
592 | $oneGoods['skn'] = $value['product_skn']; | 595 | $oneGoods['skn'] = $value['product_skn']; |
593 | $oneGoods['name'] = $value['product_name']; | 596 | $oneGoods['name'] = $value['product_name']; |
594 | - $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : ''; | 597 | + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : ''; |
595 | $oneGoods['color'] = $value['color_name']; | 598 | $oneGoods['color'] = $value['color_name']; |
596 | $oneGoods['size'] = $value['size_name']; | 599 | $oneGoods['size'] = $value['size_name']; |
597 | - $oneGoods['price'] = self::transPrice($value['sales_price']); | 600 | + $oneGoods['checked'] = $value['selected'] === 'Y'; |
601 | + $oneGoods['price'] = self::transPrice($value['last_vip_price']); | ||
602 | + $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price']; | ||
598 | $oneGoods['count'] = $value['buy_number']; | 603 | $oneGoods['count'] = $value['buy_number']; |
599 | - $oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']); | 604 | + |
605 | + if ($isValid) { | ||
606 | + // 库存不足 | ||
607 | + $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']); | ||
608 | + } else { // 失效商品 | ||
609 | + $oneGoods['inValid'] = true; | ||
610 | + } | ||
611 | + | ||
600 | //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; | 612 | //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; |
601 | if (!isset($value['goods_type'])) { | 613 | if (!isset($value['goods_type'])) { |
602 | - $oneGoods['isSoldOut'] = true; | 614 | + $oneGoods['inValid'] = true; |
603 | } elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) { | 615 | } elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) { |
604 | $oneGoods['isGift'] = true; | 616 | $oneGoods['isGift'] = true; |
617 | + $oneGoods['salesPrice'] = self::transPrice($value['sales_price']); | ||
618 | + $oneGoods['price'] = self::transPrice($value['last_price']); | ||
605 | } elseif ($value['goods_type'] == 'price_gift') { | 619 | } elseif ($value['goods_type'] == 'price_gift') { |
620 | + $oneGoods['showCheckbox'] = true; | ||
606 | $oneGoods['isAdvanceBuy'] = true; | 621 | $oneGoods['isAdvanceBuy'] = true; |
622 | + $oneGoods['salesPrice'] = self::transPrice($value['sales_price']); | ||
623 | + $oneGoods['price'] = self::transPrice($value['last_price']); | ||
624 | + } else { | ||
625 | + $oneGoods['showCheckbox'] = true; | ||
607 | } | 626 | } |
627 | + | ||
608 | // 上市期 | 628 | // 上市期 |
609 | - if (!empty($value['expect_arrival_time'])) { | 629 | + if ($isAdvanceCart && !empty($value['expect_arrival_time'])) { |
610 | $oneGoods['appearDate'] = $value['expect_arrival_time']; | 630 | $oneGoods['appearDate'] = $value['expect_arrival_time']; |
611 | } | 631 | } |
612 | // 商品链接 | 632 | // 商品链接 |
613 | - if (isset($value['cn_alphabet']) ) { | ||
614 | - $oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html'); | ||
615 | - } | 633 | + $oneGoods['link'] = self::url('/product/show_' . $value['product_skn'] . '.html'); |
616 | 634 | ||
617 | $arr[$key] = $oneGoods; | 635 | $arr[$key] = $oneGoods; |
618 | } | 636 | } |
@@ -621,7 +639,7 @@ class Helpers | @@ -621,7 +639,7 @@ class Helpers | ||
621 | } | 639 | } |
622 | 640 | ||
623 | /** | 641 | /** |
624 | - * 格式化加价购商品 | 642 | + * 格式化加价购和赠品商品 |
625 | * | 643 | * |
626 | * @param array $advanceGoods 加价购商品列表 | 644 | * @param array $advanceGoods 加价购商品列表 |
627 | * @param int $count 计商品件数 | 645 | * @param int $count 计商品件数 |
@@ -633,26 +651,31 @@ class Helpers | @@ -633,26 +651,31 @@ class Helpers | ||
633 | 651 | ||
634 | $gift = array(); | 652 | $gift = array(); |
635 | $oneGoods = array(); | 653 | $oneGoods = array(); |
654 | + $number = 0; | ||
636 | foreach ($advanceGoods as $value) { | 655 | foreach ($advanceGoods as $value) { |
637 | $gift = array(); | 656 | $gift = array(); |
657 | + $gift['promotionId'] = $value['promotion_id']; | ||
638 | $gift['promotionTitle'] = $value['promotion_title']; | 658 | $gift['promotionTitle'] = $value['promotion_title']; |
639 | 659 | ||
660 | + $number = 0; | ||
640 | foreach ($value['goods_list'] as $single) { | 661 | foreach ($value['goods_list'] as $single) { |
662 | + $oneGoods = array(); | ||
641 | $oneGoods['id'] = $single['product_skn']; | 663 | $oneGoods['id'] = $single['product_skn']; |
642 | $oneGoods['name'] = $single['product_name']; | 664 | $oneGoods['name'] = $single['product_name']; |
643 | - $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 120) : ''; | ||
644 | - $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据 | ||
645 | - $oneGoods['price'] = $single['last_price']; | ||
646 | - $oneGoods['marketPrice'] = $single['market_price']; | 665 | + $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : ''; |
666 | + $oneGoods['price'] = self::transPrice($single['last_price']); | ||
667 | + $oneGoods['marketPrice'] = self::transPrice($single['market_price']); | ||
647 | $oneGoods['count'] = $single['storage_number']; | 668 | $oneGoods['count'] = $single['storage_number']; |
648 | 669 | ||
649 | $gift['goods'][] = $oneGoods; | 670 | $gift['goods'][] = $oneGoods; |
671 | + $number ++; | ||
650 | } | 672 | } |
651 | 673 | ||
652 | $arr[] = $gift; | 674 | $arr[] = $gift; |
653 | 675 | ||
654 | // 计算加价购商品数目 | 676 | // 计算加价购商品数目 |
655 | - $count += count($value['goods_list']); | 677 | + //$count += count($value['goods_list']); |
678 | + $count += $number; | ||
656 | } | 679 | } |
657 | 680 | ||
658 | return $arr; | 681 | return $arr; |
@@ -45,7 +45,9 @@ class AlipayNotify { | @@ -45,7 +45,9 @@ class AlipayNotify { | ||
45 | $isSign = $this->getSignVeryfy($_POST, $_POST["sign"]); | 45 | $isSign = $this->getSignVeryfy($_POST, $_POST["sign"]); |
46 | //获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息) | 46 | //获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息) |
47 | $responseTxt = 'true'; | 47 | $responseTxt = 'true'; |
48 | - if (! empty($_POST["notify_id"])) {$responseTxt = $this->getResponse($_POST["notify_id"]);} | 48 | + if (!empty($_POST["notify_id"])) { |
49 | + $responseTxt = $this->getResponse($_POST["notify_id"]); | ||
50 | + } | ||
49 | 51 | ||
50 | //写日志记录 | 52 | //写日志记录 |
51 | //if ($isSign) { | 53 | //if ($isSign) { |
@@ -57,11 +59,10 @@ class AlipayNotify { | @@ -57,11 +59,10 @@ class AlipayNotify { | ||
57 | //$log_text = "responseTxt=".$responseTxt."\n notify_url_log:isSign=".$isSignStr.","; | 59 | //$log_text = "responseTxt=".$responseTxt."\n notify_url_log:isSign=".$isSignStr.","; |
58 | //$log_text = $log_text.createLinkString($_POST); | 60 | //$log_text = $log_text.createLinkString($_POST); |
59 | //logResult($log_text); | 61 | //logResult($log_text); |
60 | - | ||
61 | //验证 | 62 | //验证 |
62 | //$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 | 63 | //$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 |
63 | //isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 | 64 | //isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 |
64 | - if (preg_match("/true$/i",$responseTxt) && $isSign) { | 65 | + if (preg_match("/true$/i", $responseTxt) && $isSign) { |
65 | return true; | 66 | return true; |
66 | } else { | 67 | } else { |
67 | return false; | 68 | return false; |
@@ -74,15 +75,16 @@ class AlipayNotify { | @@ -74,15 +75,16 @@ class AlipayNotify { | ||
74 | * @return 验证结果 | 75 | * @return 验证结果 |
75 | */ | 76 | */ |
76 | function verifyReturn(){ | 77 | function verifyReturn(){ |
77 | - if(empty($_GET)) {//判断POST来的数组是否为空 | 78 | + if (empty($_GET)) {//判断POST来的数组是否为空 |
78 | return false; | 79 | return false; |
79 | - } | ||
80 | - else { | 80 | + } else { |
81 | //生成签名结果 | 81 | //生成签名结果 |
82 | $isSign = $this->getSignVeryfy($_GET, $_GET["sign"]); | 82 | $isSign = $this->getSignVeryfy($_GET, $_GET["sign"]); |
83 | //获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息) | 83 | //获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息) |
84 | $responseTxt = 'true'; | 84 | $responseTxt = 'true'; |
85 | - if (! empty($_GET["notify_id"])) {$responseTxt = $this->getResponse($_GET["notify_id"]);} | 85 | + if (!empty($_GET["notify_id"])) { |
86 | + $responseTxt = $this->getResponse($_GET["notify_id"]); | ||
87 | + } | ||
86 | 88 | ||
87 | //写日志记录 | 89 | //写日志记录 |
88 | //if ($isSign) { | 90 | //if ($isSign) { |
@@ -94,11 +96,10 @@ class AlipayNotify { | @@ -94,11 +96,10 @@ class AlipayNotify { | ||
94 | //$log_text = "responseTxt=".$responseTxt."\n return_url_log:isSign=".$isSignStr.","; | 96 | //$log_text = "responseTxt=".$responseTxt."\n return_url_log:isSign=".$isSignStr.","; |
95 | //$log_text = $log_text.createLinkString($_GET); | 97 | //$log_text = $log_text.createLinkString($_GET); |
96 | //logResult($log_text); | 98 | //logResult($log_text); |
97 | - | ||
98 | //验证 | 99 | //验证 |
99 | //$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 | 100 | //$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 |
100 | //isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 | 101 | //isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 |
101 | - if (preg_match("/true$/i",$responseTxt) && $isSign) { | 102 | + if (preg_match("/true$/i", $responseTxt) && $isSign) { |
102 | return true; | 103 | return true; |
103 | } else { | 104 | } else { |
104 | return false; | 105 | return false; |
-
Please register or login to post a comment