Merge branch 'feature/yoho-coin-new' of http://git.dev.yoho.cn/web/yohobuy into …
…feature/yoho-coin-new
Showing
3 changed files
with
38 additions
and
68 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,73 +827,13 @@ class HomeController extends AbstractAction | @@ -827,73 +827,13 @@ 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(); | ||
832 | - $currency = array( | ||
833 | - array( | ||
834 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
835 | - 'time' => '2015.11.23 12:45:33', | ||
836 | - 'count' => '+943' | ||
837 | - ), | ||
838 | - array( | ||
839 | - 'title' => '购买商品 Nike 运动鞋', | ||
840 | - 'time' => '2015.11.23 12:45:33', | ||
841 | - 'count' => '+943' | ||
842 | - ), | ||
843 | - array( | ||
844 | - 'title' => '购买商品 Nike XXXXXX 运动鞋运动鞋运动鞋运动鞋运动鞋运动鞋', | ||
845 | - 'time' => '2015.11.23 12:45:33', | ||
846 | - 'count' => '+943' | ||
847 | - ), | ||
848 | - array( | ||
849 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
850 | - 'time' => '2015.11.23 12:45:33', | ||
851 | - 'count' => '+943' | ||
852 | - ), | ||
853 | - array( | ||
854 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
855 | - 'time' => '2015.11.23 12:45:33', | ||
856 | - 'count' => '+943' | ||
857 | - ), | ||
858 | - array( | ||
859 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
860 | - 'time' => '2015.11.23 12:45:33', | ||
861 | - 'count' => '+943' | ||
862 | - ), | ||
863 | - array( | ||
864 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
865 | - 'time' => '2015.11.23 12:45:33', | ||
866 | - 'count' => '+943' | ||
867 | - ), | ||
868 | - array( | ||
869 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
870 | - 'time' => '2015.11.23 12:45:33', | ||
871 | - 'count' => '+943' | ||
872 | - ), | ||
873 | - array( | ||
874 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
875 | - 'time' => '2015.11.23 12:45:33', | ||
876 | - 'count' => '+943' | ||
877 | - ), | ||
878 | - array( | ||
879 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
880 | - 'time' => '2015.11.23 12:45:33', | ||
881 | - 'count' => '+943' | ||
882 | - ), | ||
883 | - array( | ||
884 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
885 | - 'time' => '2015.11.23 12:45:33', | ||
886 | - 'count' => '+943' | ||
887 | - ), | ||
888 | - array( | ||
889 | - 'title' => '购买商品 Nike XXXXXX 运动鞋', | ||
890 | - 'time' => '2015.11.23 12:45:33', | ||
891 | - 'count' => '+943' | ||
892 | - ) | ||
893 | - ); | ||
894 | - | 830 | + $page = $this->get('page', 1); |
831 | + $size = $this->get('size', 10); | ||
832 | + //$data = UserModel::getYohoCoinLists($this->_uid,$page,$size); | ||
833 | + $data = UserModel::getYohoCoinLists(3965746,$page,$size); | ||
895 | $this->_view->display('currency-detail', array( | 834 | $this->_view->display('currency-detail', array( |
896 | - 'currency' => $currency, | 835 | + 'currency' => $data['list'], |
836 | + 'money' => $data['money'], | ||
897 | 'pageFooter' => true, | 837 | 'pageFooter' => true, |
898 | 'money' => 100, | 838 | 'money' => 100, |
899 | 'currencyDetailPage' => true | 839 | 'currencyDetailPage' => true |
@@ -354,6 +354,35 @@ class UserModel | @@ -354,6 +354,35 @@ 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 | + $data['money'] = $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 | + $data['list'] = $result; | ||
382 | + return $data; | ||
383 | + } | ||
384 | + | ||
385 | + /** | ||
357 | * 处理优惠券数据 | 386 | * 处理优惠券数据 |
358 | * | 387 | * |
359 | * @param int $uid 用户ID | 388 | * @param int $uid 用户ID |
-
Please register or login to post a comment