Authored by 郭成尧

代码注解

@@ -20,7 +20,6 @@ class CouponData @@ -20,7 +20,6 @@ class CouponData
20 * @param $uid 用户ID 20 * @param $uid 用户ID
21 * @param $contentCode 资源码 21 * @param $contentCode 资源码
22 * @return array|mixed 22 * @return array|mixed
23 - * @internal param $contentCode  
24 */ 23 */
25 public static function getCouponRousource($contentCode, $uid) 24 public static function getCouponRousource($contentCode, $uid)
26 { 25 {
@@ -22,6 +22,7 @@ class CouponFloorProcess @@ -22,6 +22,7 @@ class CouponFloorProcess
22 */ 22 */
23 public static function getContent($data) 23 public static function getContent($data)
24 { 24 {
  25 + // tar debug
25 // self::debugOut($data); 26 // self::debugOut($data);
26 $result = array(); 27 $result = array();
27 28
@@ -146,10 +147,10 @@ class CouponFloorProcess @@ -146,10 +147,10 @@ class CouponFloorProcess
146 147
147 /** 148 /**
148 * 149 *
149 - * 数据输出 150 + * 辅助方法 Debug 数据输出
150 * 151 *
151 * @param $data 152 * @param $data
152 - * @param bool $is_exit 153 + * @param bool $is_exit 输出后是否中断执行
153 */ 154 */
154 public static function debugOut($data, $is_exit = true) 155 public static function debugOut($data, $is_exit = true)
155 { 156 {
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 * Date: 2016/4/11 6 * Date: 2016/4/11
7 * Time: 16:31 7 * Time: 16:31
8 */ 8 */
9 -use LibModels\Wap\Coupon\CouponData;  
10 use Action\AbstractAction; 9 use Action\AbstractAction;
  10 +use LibModels\Wap\Coupon\CouponData;
11 use Plugin\DataProcess\CouponFloorProcess; 11 use Plugin\DataProcess\CouponFloorProcess;
12 use Plugin\Helpers; 12 use Plugin\Helpers;
13 13
@@ -27,11 +27,11 @@ class CouponController extends AbstractAction @@ -27,11 +27,11 @@ class CouponController extends AbstractAction
27 )); 27 ));
28 $result = array(); 28 $result = array();
29 29
  30 + // 正常接口调用
30 // $uid = $this->getUid(); 31 // $uid = $this->getUid();
31 - // 调用模拟接口  
32 -// $resource = $this->getFloor();  
33 - $resource = CouponData::getCouponRousource('b38b9c4f1c76f89533e9214629b458e4', 8040277);  
34 // $resource = CouponData::getCouponRousource($receiveData['contentCode'],$uid); 32 // $resource = CouponData::getCouponRousource($receiveData['contentCode'],$uid);
  33 + // 数据写死,调用接口,测试使用
  34 + $resource = CouponData::getCouponRousource('b38b9c4f1c76f89533e9214629b458e4', 8040277);
35 if (isset($resource['code']) && $resource['code'] == 200) { 35 if (isset($resource['code']) && $resource['code'] == 200) {
36 $result = CouponFloorProcess::getContent($resource['data']); 36 $result = CouponFloorProcess::getContent($resource['data']);
37 } 37 }
@@ -72,7 +72,7 @@ class CouponController extends AbstractAction @@ -72,7 +72,7 @@ class CouponController extends AbstractAction
72 } 72 }
73 } else { 73 } else {
74 // 登录后调用领券接口 74 // 登录后调用领券接口
75 - $result = CouponData::receiveCoupon($this->getUid(),$receiveData['couponID']); 75 + $result = CouponData::receiveCoupon($this->getUid(), $receiveData['couponID']);
76 switch ($result['code']) { 76 switch ($result['code']) {
77 case 200: 77 case 200:
78 $returnData = array( 78 $returnData = array(
@@ -92,39 +92,6 @@ class CouponController extends AbstractAction @@ -92,39 +92,6 @@ class CouponController extends AbstractAction
92 } 92 }
93 93
94 /** 94 /**
95 - * 领券接口模拟  
96 - *  
97 - * @param $couponId  
98 - * @return array  
99 - * @internal param $couponId  
100 - */  
101 - public function getCouponHandler($couponId)  
102 - {  
103 -  
104 - if ($couponId) {  
105 - $result['alg'] = 'SALT_MD5';  
106 - $result['code'] = 200;  
107 - $result['data'] = '';  
108 - $result['md5'] = '50d19f5f5098c34607018f144baec14a';  
109 - $result['message'] = '操作成功';  
110 - } else {  
111 - $result['alg'] = 'SALT_MD5';  
112 - $result['code'] = 402;  
113 - $result['data'] = '';  
114 - $result['md5'] = '50d19f5f5098c34607018f144baec14a';  
115 - $result['message'] = '操作失败';  
116 - }  
117 - /* // 组合接口参数  
118 - $params['method'] = 'app.promotion.getCoupon';  
119 - $params['couponId'] = $couponId;  
120 - $params['uid'] = $this->getUid();  
121 -  
122 - $result = \Api\YohobuyH5::get(\Api\YohobuyH5::SERVICE_URL, $params);*/  
123 -  
124 - return $result;  
125 - }  
126 -  
127 - /**  
128 * 判断是否是 APP 95 * 判断是否是 APP
129 * 96 *
130 * @return bool 97 * @return bool
@@ -134,103 +101,4 @@ class CouponController extends AbstractAction @@ -134,103 +101,4 @@ class CouponController extends AbstractAction
134 return (null !== $this->get('app_version')); 101 return (null !== $this->get('app_version'));
135 } 102 }
136 103
137 -  
138 - /**  
139 - * 模拟后台接口数据  
140 - *  
141 - * @return array  
142 - */  
143 - public function getFloor()  
144 - {  
145 - $result = array();  
146 - $result = [  
147 - 'alg' => 'SALT_MD5',  
148 - 'code' => 200,  
149 - 'data' => [  
150 - 0 => [  
151 - 'data' => [  
152 - 'list' => [  
153 - 0 => [  
154 - 'couponID' => 2516,  
155 - 'status' => 1,  
156 - 'goShopping' => 'http://item.m.yohobuy.com/product/pro_325933_419711/XiongJiaYouPin619081838990XiongJiaYouPinChuangYiLanRenTanZhuTuiKuan.html',  
157 - 'image' => [  
158 - 'src' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/01/02f639de49d79ece0cf86a2f214be781da.jpg?imageView/2/w/640/h/200',  
159 - 'url' => 'http://2percent.yohobuy.com/?gender=2,3\n',  
160 - ],  
161 - 'isShow' => 'YES',  
162 - 'title' => '标题内容',  
163 - ],  
164 - ],  
165 - ],  
166 - 'template_id' => 1111253,  
167 - 'template_name' => 'getCoupon'  
168 - ],  
169 - 1 => [  
170 - 'data' => [  
171 - 'list' => [  
172 - 0 => [  
173 - 'couponID' => 200,  
174 - 'status' => 3,  
175 - 'goShopping' => 'http://item.m.yohobuy.com/product/pro_325933_419711/XiongJiaYouPin619081838990XiongJiaYouPinChuangYiLanRenTanZhuTuiKuan.html',  
176 - 'image' => [  
177 - 'src' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/01/02f639de49d79ece0cf86a2f214be781da.jpg?imageView/2/w/640/h/200',  
178 - 'url' => 'http://2percent.yohobuy.com/?gender=2,3\n',  
179 - ],  
180 - 'isShow' => 'YES',  
181 - 'title' => '标题内容',  
182 - ],  
183 - ],  
184 - ],  
185 - 'template_id' => 1111257,  
186 - 'template_name' => 'getCoupon'  
187 - ],  
188 - 2 => [  
189 - 'data' => [  
190 - 'list' => [  
191 - 0 => [  
192 - 'couponID' => 1565,  
193 - 'status' => 2,  
194 - 'goShopping' => 'http://item.m.yohobuy.com/product/pro_325933_419711/XiongJiaYouPin619081838990XiongJiaYouPinChuangYiLanRenTanZhuTuiKuan.html',  
195 - 'image' => [  
196 - 'src' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/01/02f639de49d79ece0cf86a2f214be781da.jpg?imageView/2/w/640/h/200',  
197 - 'url' => 'http://2percent.yohobuy.com/?gender=2,3\n',  
198 - ],  
199 - 'isShow' => 'YES',  
200 - 'title' => '标题内容',  
201 - ],  
202 - ],  
203 - ],  
204 - 'template_id' => 1111255,  
205 - 'template_name' => 'getCoupon'  
206 - ],  
207 - 3 => [  
208 - 'data' => [  
209 - 'list' => [  
210 - 0 => [  
211 - 'src' => 'http://img11.static.yhbimg.com/yhb-img01/2016/04/13/06/019bd2c1581f881c8ea22daf0e39a4a9ab.png?imageView/2/w/640/h/200',  
212 - 'url' => []  
213 - ],  
214 -  
215 - 1 => [  
216 - 'src' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/13/06/02576fa876ccfbfe0648b4e2dabb989b6f.png?imageView/2/w/640/h/200',  
217 - 'url' => []  
218 - ],  
219 - 2 => [  
220 - 'src' => 'http://img11.static.yhbimg.com/yhb-img01/2016/04/13/06/01362e8c56fd6ac56ad3852b6a192e5336.png?imageView/2/w/640/h/200',  
221 - 'url' => []  
222 - ],  
223 - ],  
224 - 'speed' => '3'  
225 - ],  
226 - 'template_id' => 1111253,  
227 - 'template_intro' => '轮播banner',  
228 - 'template_name' => 'carousel_banner'  
229 - ],  
230 - ],  
231 - 'md5' => '8febf00780011298f4a0530b6441827b',  
232 - 'message' => '请求成功'  
233 - ];  
234 - return $result;  
235 - }  
236 } 104 }