Authored by uedxwg

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -42,4 +42,30 @@ class IndexData @@ -42,4 +42,30 @@ class IndexData
42 $params['client_secret'] = Sign::getSign($params); 42 $params['client_secret'] = Sign::getSign($params);
43 return Yohobuy::get(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_RESOURCE_GET, $params); 43 return Yohobuy::get(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_RESOURCE_GET, $params);
44 } 44 }
  45 +
  46 + /**
  47 + * 邮箱订阅
  48 + *
  49 + * @param string $email
  50 + * @param string $uid
  51 + * @return array
  52 + */
  53 + public static function emailSubscriber($email, $uid = 0)
  54 + {
  55 + //TODO 走老接口
  56 + // 构建必传参数
  57 + $param = Yohobuy::param();
  58 + $param['page'] = 1;
  59 + $param['open_key'] = '12345';
  60 + $param['method'] = 'open.subscriber.subscriber';
  61 + $param['email'] = $email;
  62 + $param['uid'] = $uid;
  63 + $param['client_secret'] = Sign::getSign($param);
  64 + unset($param['app_version']);
  65 + unset($param['client_type']);
  66 + unset($param['os_version']);
  67 + unset($param['screen_size']);
  68 + unset($param['v']);
  69 + return Yohobuy::get(Yohobuy::API_URL, $param);
  70 + }
45 } 71 }
@@ -6,6 +6,7 @@ use Plugin\Cache; @@ -6,6 +6,7 @@ use Plugin\Cache;
6 use Configs\CacheConfig; 6 use Configs\CacheConfig;
7 use Api\Yohobuy; 7 use Api\Yohobuy;
8 use Plugin\Images; 8 use Plugin\Images;
  9 +use Plugin\Helpers;
9 10
10 class CommonController extends WebAction 11 class CommonController extends WebAction
11 { 12 {
@@ -118,4 +119,24 @@ class CommonController extends WebAction @@ -118,4 +119,24 @@ class CommonController extends WebAction
118 } 119 }
119 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner); 120 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
120 } 121 }
  122 +
  123 + /**
  124 + * 获取邮件订阅
  125 + *
  126 + * @return jsonp
  127 + */
  128 + public function emailsubscriberAction()
  129 + {
  130 + $callback = $this->get('callback', '');
  131 + $email = $this->get('email', '');
  132 + $uid = intval($this->get('uid', '0'));
  133 + $data = array();
  134 + //验证邮件
  135 + if(Helpers::verifyEmail($email)) {
  136 + $data = IndexData::emailSubscriber($email, $uid);
  137 + return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
  138 + } else {
  139 + return $this->helpJsonCallbackResult($callback, 403, '订阅失败', '');
  140 + }
  141 + }
121 } 142 }