Showing
3 changed files
with
36 additions
and
4 deletions
@@ -194,9 +194,10 @@ class UserData | @@ -194,9 +194,10 @@ class UserData | ||
194 | * @param int $uid 用户ID | 194 | * @param int $uid 用户ID |
195 | * @param int $page 第几页,默认1 | 195 | * @param int $page 第几页,默认1 |
196 | * @param int $limit 限制读取的数目,默认10 | 196 | * @param int $limit 限制读取的数目,默认10 |
197 | + * @param string $type 请求类型 get,post | ||
197 | * @return array YOHO币接口返回的数据 | 198 | * @return array YOHO币接口返回的数据 |
198 | */ | 199 | */ |
199 | - public static function yohoCoinData($uid, $page = 1, $limit = 10) | 200 | + public static function yohoCoinData($uid, $page = 1, $limit = 10,$type = 'get') |
200 | { | 201 | { |
201 | $param = Yohobuy::param(); | 202 | $param = Yohobuy::param(); |
202 | $param['method'] = 'app.yohocoin.lists'; | 203 | $param['method'] = 'app.yohocoin.lists'; |
@@ -205,7 +206,7 @@ class UserData | @@ -205,7 +206,7 @@ class UserData | ||
205 | $param['limit'] = $limit; | 206 | $param['limit'] = $limit; |
206 | $param['client_secret'] = Sign::getSign($param); | 207 | $param['client_secret'] = Sign::getSign($param); |
207 | 208 | ||
208 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 209 | + return Yohobuy::$type(Yohobuy::API_URL, $param); |
209 | } | 210 | } |
210 | 211 | ||
211 | /** | 212 | /** |
@@ -827,8 +827,11 @@ class HomeController extends AbstractAction | @@ -827,8 +827,11 @@ class HomeController extends AbstractAction | ||
827 | { | 827 | { |
828 | $this->setTitle('YOHO币'); | 828 | $this->setTitle('YOHO币'); |
829 | $this->setNavHeader('YOHO币', true, false); | 829 | $this->setNavHeader('YOHO币', true, false); |
830 | - | ||
831 | - $uid = $this->getUid(); | 830 | + $page = $this->get('page', 1); |
831 | + $size = $this->get('size', 10); | ||
832 | + //$currency = UserModel::getYohoCoinLists($this->_uid,$page,$size); | ||
833 | + $currency = UserModel::getYohoCoinLists(3965746,$page,$size); | ||
834 | + print_r($currency);exit; | ||
832 | $currency = array( | 835 | $currency = array( |
833 | array( | 836 | array( |
834 | 'title' => '购买商品 Nike XXXXXX 运动鞋', | 837 | 'title' => '购买商品 Nike XXXXXX 运动鞋', |
@@ -354,6 +354,34 @@ class UserModel | @@ -354,6 +354,34 @@ class UserModel | ||
354 | } | 354 | } |
355 | 355 | ||
356 | /** | 356 | /** |
357 | + * 处理YOHO币变化履历数据 | ||
358 | + * | ||
359 | + * @param int $uid 用户ID | ||
360 | + * @param int $page 当前页 | ||
361 | + * @param int $limit 一页记录数 | ||
362 | + * @return array|mixed 处理之后的YOHO币数据 | ||
363 | + */ | ||
364 | + public static function getYohoCoinLists($uid, $page, $limit) | ||
365 | + { | ||
366 | + $result = array(); | ||
367 | + | ||
368 | + // 调用接口获取YOHO币 | ||
369 | + $yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post'); | ||
370 | + // 处理YOHO币数据 | ||
371 | + $coinList = $yohoCoin['data']['coinlist']; | ||
372 | + $result['many'] = $yohoCoin['data']['total']; | ||
373 | + foreach($coinList as $key => $val){ | ||
374 | + $result[$key]['title'] = $val['message']; | ||
375 | + $result[$key]['time'] = $val['date']; | ||
376 | + if($val['num'] > 0){ | ||
377 | + $val['num'] = '+'.$val['num']; | ||
378 | + } | ||
379 | + $result[$key]['count'] = $val['num']; | ||
380 | + } | ||
381 | + return $result; | ||
382 | + } | ||
383 | + | ||
384 | + /** | ||
357 | * 处理优惠券数据 | 385 | * 处理优惠券数据 |
358 | * | 386 | * |
359 | * @param int $uid 用户ID | 387 | * @param int $uid 用户ID |
-
Please register or login to post a comment