/** * @author: liaoxianwen@ymt360.com * @description 产品列表 */ public function lists() { $post = $this->post; $page = $this->get_page(); $show_page = empty($_POST['itemsPerPage']) ? FALSE : TRUE; $ip_address = ''; // 当前id地址 if (empty($post['upid'])) { $this->_return_json(array('status' => C('tips.code.op_failed'), 'msg' => '查询条件不满足')); } // 查询所属城市 if (!empty($post['locationId'])) { $post['location_id'] = intval($post['locationId']); } // 优先取登录用户的所在城市 $cur = $this->userauth->current(TRUE); $user_info = array(); if ($cur) { $post['location_id'] = $cur['province_id']; $local_info = $this->format_query('/location/info', array('where' => array('id' => $cur['province_id']))); // 所在城市info信息 if (intval($local_info['status']) === 0) { $user_info = array('location_id' => $cur['province_id'], 'line_id' => $cur['line_id'], 'name' => $local_info['info']['name']); } } $customer_type = !empty($cur['customer_type']) ? $cur['customer_type'] : C('customer.type.normal.value'); $response = $this->format_query('/product/lists', array('upid' => $post['upid'], 'offset' => $page['offset'], 'location_id' => $post['location_id'], 'page_size' => $show_page ? $page['page_size'] : 0, 'user_info' => $user_info, 'customer_type' => $customer_type)); if (!empty($response['list'])) { $response = $this->_format_product_lists($cur, $response); //过滤输出 $required_fields = parent::$_app_required_fields['product']['lists']; parent::_get_required_fields($response, 'list', $required_fields['list']); } $this->_return_json($response); }
/** * @author: liaoxianwen@ymt360.com * @description 用户 */ public function lists() { $response = array('status' => C('status.auth.login_timeout'), 'msg' => '登录超时,请重新登录'); if ($this->_user_info) { $post['where'] = ''; $post['where'] = array('customer_id' => $this->_user_info['id']); $post['site_id'] = $this->_user_info['site_id']; // 待收货状态特俗处理,包括三种状态 if (isset($this->post['status'])) { $post['status'] = $this->post['status']; } $lists = $this->format_query('/customer_coupon/lists', $post); $res_lists = array(); $res_total = 0; $res_all_total = 0; if (!empty($lists) && isset($lists['status']) && $lists['status'] == 0) { $res_lists = !empty($lists['list']) ? $lists['list'] : array(); $res_total = !empty($lists['total']) ? $lists['total'] : 0; $res_all_total = !empty($lists['all_nums']) ? $lists['all_nums'] : 0; } $response = array('status' => C('tips.code.op_success'), 'msg' => 'success', 'lists' => $res_lists, 'total' => $res_total, 'all_total' => $res_all_total); if (!empty($response['lists'])) { $required_fields = parent::$_app_required_fields['coupon']['lists']; parent::_get_required_fields($response, 'lists', $required_fields); } } $this->_return_json($response); }
/** * @description app端获取未读消息 */ public function get_unread_messages() { $app_uid = empty($_POST['app_uid']) ? 0 : intval($_POST['app_uid']); if (!$app_uid) { $this->_return_json(array('status' => -1, 'msg' => 'user_id为空')); } $app_type_id = C('jpush.app_type.dachu'); $msg_list = $this->MMessage_log->get_lists('*', array('app_type_id' => $app_type_id, 'app_uid' => $app_uid, 'status' => C('jpush.message_status.init'))); $msg_list = $this->_format_messages($msg_list); if (!empty($msg_list)) { $required_fields = parent::$_app_required_fields['message']['get_unread_messages']; foreach ($msg_list as $k => $val) { parent::_get_required_fields($msg_list, $k, $required_fields); } } $this->_return_json(array('status' => 0, 'msg' => '获取消息成功', 'lists' => $msg_list)); $this->_return_json($result); }
/** * @author: liaoxianwen@ymt360.com * @description 专门获取分类,目前是app分类页数据接口 */ public function cate_lists() { $return_data = $this->_get_lists(); extract($return_data); if (!empty($data['list'])) { //输出参数过滤 $required_field = parent::$_app_required_fields['category']['cate_lists']; if (!empty($data['list']['top'])) { parent::_get_required_fields($data['list'], 'top', $required_field['list']['top']); } if (!empty($data['list']['second'])) { foreach ($data['list']['second'] as $k => $v) { parent::_get_required_fields($data['list']['second'], $k, $required_field['list']['second']); } } } $this->_return_json($data); }
/** * @author: liaoxianwen@ymt360.com * @description 广告列表 */ public function lists() { $site_id = C('app_sites.chu.id'); $status = C('status.common.success'); // 查询所属城市 if (!empty($this->post['pos_id'])) { $pos_id = intval($this->post['pos_id']); } else { $this->_return_json(array('status' => C('tips.code.op_failed'), 'msg' => '广告位id没有标注')); } if (!isset($this->post['locationId'])) { $location_id = C('open_cities.beijing.id'); } else { $location_id = $this->post['locationId']; } // 检测用户是否已经登录, // 登录用户不允许切换城市 // 优先取登录用户的所在城市 $cur = $this->userauth->current(TRUE); // 增加是否需要登录的来判断 $need_login = array(0); if ($cur) { $location_id = $cur['province_id']; $need_login = array(0, 1); } $post = array('where' => array('status' => $status, 'location_id' => $location_id, 'site_id' => $site_id, 'in' => array('need_login' => $need_login), 'customer_type' => !empty($cur['customer_type']) ? $cur['customer_type'] : C('customer.type.normal.value'))); $data = $this->format_query('/ads/get_valid_ads_list', $post); $status = empty($data['list']) ? FALSE : TRUE; if ($status) { $data['list'] = $this->_deal_by_pos_id($data, $pos_id, $cur); } if ($status && isset($data['list'])) { $response = $data; $required_fields = parent::$_app_required_fields['ads']['lists']; parent::_get_required_fields($response, 'list', $required_fields); } else { $response = array('status' => C('tips.code.op_success'), 'list' => array(), 'msg' => '没有广告'); } $this->_return_json($response); }
/** * 获取个人信息 * @author yugang@dachuwang.com * @since 2015-03-06 */ public function baseinfo() { // 权限校验 $this->check_validation('customer', 'view'); // 获取当前登录客户 $cur = $this->userauth->current(TRUE); $_POST['user_id'] = $cur['id']; // 调用基础服务接口,通过调用基础服务无法获取到对应的session信息 $return = $this->format_query('/customer/baseinfo', $_POST); $valid_coupon_nums = $this->format_query('/customer_coupon/count', array('status' => C('coupon_status.valid.value'), 'customer_id' => $cur['id'])); $return['info']['valid_coupon_nums'] = $return['valid_coupon_nums'] = isset($valid_coupon_nums['total']) ? $valid_coupon_nums['total'] : 0; if (!empty($return['info'])) { //过滤输出 $required_fields = parent::$_app_required_fields['customer']['baseinfo']; parent::_get_required_fields($return, 'info', $required_fields['info']); } if (!empty($return['order'])) { //过滤输出 parent::_get_required_fields($return, 'order', $required_fields['order']); } $this->_return_json($return); }
public function get_wx_order_info() { if (!empty($_POST['order_number'])) { $response_data = $this->format_query('/order/get_order', array('order_number' => $_POST['order_number'])); if (is_array($response_data['data'])) { $response_data['data']['total_price'] /= 100; $response_data['data']['final_price'] /= 100; $response_data['data']['minus_amount'] /= 100; $response_data['data']['service_fee'] /= 100; $response_data['data']['deliver_fee'] /= 100; } } else { $response_data = array('status' => C('tips.code.op_failed'), 'msg' => '参数缺失'); } if (!empty($response_data['data'])) { //过滤字段 $required_fields = parent::$_app_required_fields['order']['get_wx_order_info']['data']; parent::_get_required_fields($response_data, 'data', $required_fields); } $this->_return_json($response_data); }