Authored by 郭成尧

领券接口调用方法

@@ -107,19 +107,47 @@ class CouponController extends AbstractAction @@ -107,19 +107,47 @@ class CouponController extends AbstractAction
107 public function getCoupon($couponId) 107 public function getCoupon($couponId)
108 { 108 {
109 if ($couponId) { 109 if ($couponId) {
110 - $param['alg'] = 'SALT_MD5';  
111 - $param['code'] = 200;  
112 - $param['data'] = '';  
113 - $param['md5'] = '50d19f5f5098c34607018f144baec14a';  
114 - $param['message'] = '操作成功'; 110 + $result['alg'] = 'SALT_MD5';
  111 + $result['code'] = 200;
  112 + $result['data'] = '';
  113 + $result['md5'] = '50d19f5f5098c34607018f144baec14a';
  114 + $result['message'] = '操作成功';
115 } else { 115 } else {
116 - $param['alg'] = 'SALT_MD5';  
117 - $param['code'] = 402;  
118 - $param['data'] = '';  
119 - $param['md5'] = '50d19f5f5098c34607018f144baec14a';  
120 - $param['message'] = '操作失败'; 116 + $result['alg'] = 'SALT_MD5';
  117 + $result['code'] = 402;
  118 + $result['data'] = '';
  119 + $result['md5'] = '50d19f5f5098c34607018f144baec14a';
  120 + $result['message'] = '操作失败';
121 } 121 }
122 - return $param; 122 +
  123 + /*// 判断用户是否登录
  124 + if (!$this->getUid() || !is_numeric($this->getUid())) {
  125 + // 用户未登录,跳转登录页面,这边不知道 APP 和 WAP 分别跳转哪个页面
  126 + if ($this->isApp()) {
  127 + $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url($_SERVER["REQUEST_URI"])), 'default'));
  128 + } else {
  129 + $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url($_SERVER["REQUEST_URI"])), 'default'));
  130 + }
  131 +
  132 + }
  133 +
  134 + // 组合接口参数
  135 + $params['method'] = 'app.promotion.getCoupon';
  136 + $params['couponId'] = $couponId;
  137 + $params['uid'] = $this->getUid();
  138 +
  139 + $result = \Api\YohobuyH5::get(\Api\YohobuyH5::SERVICE_URL, $params);*/
  140 +
  141 + return $result;
123 } 142 }
124 143
  144 + /**
  145 + * 判断是否是 APP
  146 + *
  147 + * @return bool
  148 + */
  149 + public function isApp()
  150 + {
  151 + return (null !== $this->get('app_version'));
  152 + }
125 } 153 }