if ($page == 1) { $json_return['count'] = D('User_coupon')->where($where)->count('id'); } //$order_by = ""; $limit = 10; $offset = ($page - 1) * $limit; $order_by = ''; $coupon_list = M('User_coupon')->getList($where, $order_by, $limit, $offset); $store_id_list = array(); foreach ($coupon_list as $coupon) { $store_id_list[$coupon['store_id']] = $coupon['store_id']; } $store_list = M('Store')->getStoreName($store_id_list); $json_return['list'] = $coupon_list; if (count($json_return['list']) < 10) { $json_return['noNextPage'] = true; } json_return(0, $json_return); } /********************控制*************************/ $action = isset($_GET['action']) ? $_GET['action'] : ''; //dump($wap_user); switch ($action) { case 'get_usercoupon_list': get_usercoupon_list($wap_user); break; default: shows(); break; } echo ob_get_clean();
$offset = ($page - 1) * $limit; $order_by = ''; $coupon_list = M('Coupon')->getList($where, $order_by, $limit, $offset); $store_id_list = array(); foreach ($coupon_list as $coupon) { $store_id_list[$coupon['store_id']] = $coupon['store_id']; } $store_list = M('Store')->getStoreName($store_id_list); $json_return['list'] = $coupon_list; if (count($json_return['list']) < 10) { $json_return['noNextPage'] = true; } json_return(0, $json_return); } /********************控制*************************/ $action = isset($_GET['action']) ? $_GET['action'] : ''; $store_id = isset($_GET['id']) ? $_GET['id'] : pigcms_tips('您输入的网址有误', 'none'); //dump($wap_user); switch ($action) { case 'get_usercoupon_list': get_usercoupon_list($wap_user, $store_id); break; case 'user_get_coupon': //ajax用户领取优惠券 user_get_coupon($wap_user, $store_id); break; default: shows($store_id); break; } echo ob_get_clean();