Authored by hf

code review by fei.hong: do add login support https

@@ -800,8 +800,24 @@ class Helpers @@ -800,8 +800,24 @@ class Helpers
800 */ 800 */
801 public static function syncUserSession($uid, $refer = '', $callback = 'call') 801 public static function syncUserSession($uid, $refer = '', $callback = 'call')
802 { 802 {
803 - return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback  
804 - . '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer; 803 + $url = '';
  804 + switch (APPLICATION_ENV) {
  805 + case 'production':
  806 + $url = 'http://mapi.yohobuy.com';
  807 + break;
  808 + case 'preview':
  809 + $url = 'https://login.m.yohobuy.com';
  810 + break;
  811 + case 'testing':
  812 + $url = 'http://m1.yohobuy.com';
  813 + break;
  814 + default:
  815 + $url = 'http://m1.yohobuy.com';
  816 + break;
  817 + }
  818 + $url .= '/Passport/session/index?callback=' . $callback . '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
  819 +
  820 + return $url;
805 } 821 }
806 822
807 /** 823 /**
@@ -809,15 +825,31 @@ class Helpers @@ -809,15 +825,31 @@ class Helpers
809 * 825 *
810 * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION 826 * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION
811 * 827 *
812 - * @param int $uid 用户ID 828 + * @param int $token 用户ID
813 * @param string $refer 访问来源 829 * @param string $refer 访问来源
814 * @param string $callback 回调方法名 830 * @param string $callback 回调方法名
815 * @return string 831 * @return string
816 */ 832 */
817 public static function logoutSession($token, $refer = '', $callback = 'call') 833 public static function logoutSession($token, $refer = '', $callback = 'call')
818 { 834 {
819 - return 'http://mapi.yohobuy.com/Passport/session/logout?callback=' . $callback  
820 - . '&sign=' . md5(md5('Js8Yn0!EwPM45-ws')) . '&token=' . $token . '&go=' . $refer; 835 + $url = '';
  836 + switch (APPLICATION_ENV) {
  837 + case 'production':
  838 + $url = 'http://mapi.yohobuy.com';
  839 + break;
  840 + case 'preview':
  841 + $url = 'https://login.m.yohobuy.com';
  842 + break;
  843 + case 'testing':
  844 + $url = 'http://m1.yohobuy.com';
  845 + break;
  846 + default:
  847 + $url = 'http://m1.yohobuy.com';
  848 + break;
  849 + }
  850 + $url .= '/Passport/session/logout?callback=' . $callback . '&sign=' . md5(md5('Js8Yn0!EwPM45-ws')) . '&token=' . $token . '&go=' . $refer;
  851 +
  852 + return $url;
821 } 853 }
822 854
823 /** 855 /**
@@ -438,13 +438,18 @@ server @@ -438,13 +438,18 @@ server
438 } 438 }
439 439
440 location ^~ /dist/ { 440 location ^~ /dist/ {
441 - #root /Data/PE/yohobuy/yohobuy/static;  
442 - #expires 30d;  
443 proxy_redirect off; 441 proxy_redirect off;
444 proxy_set_header X-Real-IP $remote_addr; 442 proxy_set_header X-Real-IP $remote_addr;
445 proxy_pass http://cdn.yoho.cn/; 443 proxy_pass http://cdn.yoho.cn/;
446 } 444 }
447 445
  446 + location = /Passport/session/index {
  447 + proxy_redirect off;
  448 + proxy_set_header X-Real-IP $remote_addr;
  449 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  450 + proxy_pass http://mapi.yohobuy.com;
  451 + }
  452 +
448 location ~* \.(ico|woff|svg|eot|ttf|otf)$ { 453 location ~* \.(ico|woff|svg|eot|ttf|otf)$ {
449 expires 30d; 454 expires 30d;
450 } 455 }