当前位置: 首页>>代码示例>>PHP>>正文


PHP array_bind_key函数代码示例

本文整理汇总了PHP中array_bind_key函数的典型用法代码示例。如果您正苦于以下问题:PHP array_bind_key函数的具体用法?PHP array_bind_key怎么用?PHP array_bind_key使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了array_bind_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCatProValue

 public function getCatProValue($params)
 {
     $objMdlCat = app::get('syscategory')->model('cat');
     $filter['cat_id'] = $params['cat_id'];
     if ($filter['cat_id']) {
         $cat = $objMdlCat->getRow('level,is_leaf', $filter);
         if ($cat['level'] != 3) {
             throw new LogicException('cat_id必须为三级类目的id');
         }
     }
     $propIds = explode(',', $params['prop_id']);
     if (!$params['prop_id']) {
         $objMdlCatRelProp = app::get('syscategory')->model('cat_rel_prop');
         $catRelPropList = $objMdlCatRelProp->getList('*', $filter, 0, -1, 'order_sort ASC');
         if (!$catRelPropList) {
             return array();
         }
         $propIds = array_column($catRelPropList, 'prop_id');
     }
     $objMdlProps = app::get('syscategory')->model('props');
     $props = $objMdlProps->getList('*', array('prop_id' => $propIds, 'prop_type' => $params['type']), 0, -1, 'order_sort ASC');
     $props = array_bind_key($props, 'prop_id');
     $objMdlPropValues = app::get('syscategory')->model('prop_values');
     $propValues = $objMdlPropValues->getList('*', array('prop_id' => $propIds));
     foreach ($propValues as $key => $val) {
         $newPropValues[$val['prop_id']][$val['prop_value_id']] = $val;
     }
     foreach ($props as $key => $value) {
         $props[$key]['prop_value'] = $newPropValues[$value['prop_id']];
     }
     return $props;
 }
开发者ID:453111208,项目名称:bbc,代码行数:32,代码来源:getCatProValue.php

示例2: getData

 public function getData($params)
 {
     $filter = $this->__filter($params);
     $data['trade_rates'] = array();
     $countTotal = app::get('sysrate')->model('traderate')->count($filter);
     if ($countTotal) {
         $pageTotal = ceil($countTotal / $params['page_size']);
         $page = $params['page_no'] ? $params['page_no'] : 1;
         $limit = $params['page_size'] ? $params['page_size'] : 10;
         $currentPage = $pageTotal < $page ? $totalPage : $page;
         $offset = ($currentPage - 1) * $limit;
         $orderBy = $params['orderBy'] ? $params['orderBy'] : 'modified_time desc';
         $data['trade_rates'] = app::get('sysrate')->model('traderate')->getList($params['fields']['rows'], $filter, $offset, $limit, $orderBy);
         if (isset($params['fields']['extends']['appeal'])) {
             foreach ((array) $data['trade_rates'] as $info) {
                 if ($info['appeal_status'] != 'NO_APPEAL') {
                     $rateIds[] = $info['rate_id'];
                 }
             }
             if (!empty($rateIds)) {
                 $appealData = app::get('sysrate')->model('appeal')->getList($params['fields']['extends']['appeal'], ['rate_id' => $rateIds]);
                 $appealData = array_bind_key($appealData, 'rate_id');
             }
             foreach ((array) $data['trade_rates'] as $key => $row) {
                 $data['trade_rates'][$key]['appeal'] = $appealData[$row['rate_id']] ? $appealData[$row['rate_id']] : [];
             }
         }
     }
     $data['total_results'] = $countTotal;
     return $data;
 }
开发者ID:453111208,项目名称:bbc,代码行数:31,代码来源:list.php

示例3: list_freepostage

 public function list_freepostage()
 {
     $this->contentHeaderTitle = app::get('topshop')->_('免邮管理');
     $filter = input::get();
     if (!$filter['pages']) {
         $filter['pages'] = 1;
     }
     $pageSize = 10;
     $params = array('page_no' => $pageSize * ($filter['pages'] - 1), 'page_size' => $pageSize, 'fields' => '*', 'shop_id' => $this->shopId);
     $freepostageListData = app::get('topshop')->rpcCall('promotion.freepostage.list', $params, 'seller');
     $count = $freepostageListData['count'];
     $pagedata['freepostageList'] = $freepostageListData['freepostages'];
     //处理翻页数据
     $current = $filter['pages'] ? $filter['pages'] : 1;
     $filter['pages'] = time();
     if ($count > 0) {
         $total = ceil($count / $pageSize);
     }
     $pagedata['pagers'] = array('link' => url::action('topshop_ctl_promotion_freepostage@list_freepostage', $filter), 'current' => $current, 'total' => $total, 'token' => $filter['pages']);
     $gradeList = app::get('topshop')->rpcCall('user.grade.list');
     // 组织会员等级的key,value的数组,方便取会员等级名称
     $gradeKeyValue = array_bind_key($gradeList, 'grade_id');
     // 增加列表中会员等级名称字段
     foreach ($pagedata['freepostageList'] as &$v) {
         $valid_grade = explode(',', $v['valid_grade']);
         $checkedGradeName = array();
         foreach ($valid_grade as $gradeId) {
             $checkedGradeName[] = $gradeKeyValue[$gradeId]['grade_name'];
         }
         $v['valid_grade_name'] = implode(',', $checkedGradeName);
     }
     $pagedata['now'] = time();
     $pagedata['total'] = $count;
     return $this->page('topshop/promotion/freepostage/index.html', $pagedata);
 }
开发者ID:453111208,项目名称:bbc,代码行数:35,代码来源:freepostage.php

示例4: getList

 public function getList($params)
 {
     $objMdlCat = app::get('syscategory')->model('cat');
     $row = "cat_id,cat_name,level,parent_id";
     if ($params['fields']) {
         $row = $params['fields'];
         $row = str_append($row, 'cat_id');
     }
     if ($params['cat_id']) {
         $filter['cat_id'] = explode(',', $params['cat_id']);
     }
     if ($params['cat_path']) {
         $filter['cat_path|has'] = ',' . $params['cat_path'] . ',';
     }
     if (isset($params['parent_id']) && intval($params['parent_id']) >= 0) {
         $filter['parent_id'] = $params['parent_id'];
     } elseif (is_array($params['parent_id'])) {
         $filter['parent_id'] = explode(',', $params['parent_id']);
     }
     if ($params['cat_name'] && $params['level']) {
         $filter['cat_name'] = $params['cat_name'];
         $filter['level'] = $params['level'];
     }
     if ($params['level']) {
         $filter['level'] = $params['level'];
     }
     $catList = $objMdlCat->getList($row, $filter);
     return array_bind_key($catList, 'cat_id');
 }
开发者ID:453111208,项目名称:bbc,代码行数:29,代码来源:getinfo.php

示例5: tradeList

 public function tradeList($params)
 {
     if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
         $params['user_id'] = $params['oauth']['account_id'];
     } elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
         $sellerId = $params['oauth']['account_id'];
         $params['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $sellerId), 'seller');
     }
     $tradeRow = $params['fields']['rows'];
     $orderRow = $params['fields']['extends']['order'];
     $activityRow = $params['fields']['extends']['activity'];
     //分页使用
     $pageSize = $params['page_size'] ? $params['page_size'] : 40;
     $pageNo = $params['page_no'] ? $params['page_no'] : 1;
     $max = 1000000;
     if ($pageSize >= 1 && $pageSize < 500 && $pageNo >= 1 && $pageNo < 200 && $pageSize * $pageNo < $max) {
         $limit = $pageSize;
         $page = ($pageNo - 1) * $limit;
     }
     $orderBy = $params['orderBy'];
     if (!$params['orderBy']) {
         $orderBy = "created_time desc";
     }
     unset($params['fields'], $params['page_no'], $params['page_size'], $params['order_by'], $params['oauth']);
     foreach ($params as $k => $val) {
         if (!$val) {
             unset($params[$k]);
             continue;
         }
         if ($k == "status" || $k == "tid") {
             $params[$k] = explode(',', $val);
         }
     }
     $objMdlTrade = app::get('systrade')->model('trade');
     $count = $objMdlTrade->count($params);
     $tradeLists = $objMdlTrade->getList($tradeRow, $params, $page, $limit, $orderBy);
     $tradeLists = array_bind_key($tradeLists, 'tid');
     if ($orderRow && $tradeLists) {
         $orderRow = str_append($orderRow, 'tid');
         $objMdlOrder = app::get('systrade')->model('order');
         $tids = array_column($tradeLists, 'tid');
         $orderLists = $objMdlOrder->getList($orderRow, array('tid' => $tids));
         //是否需要显示标签促销tag
         if ($activityRow && $orderLists) {
             $oids = array_column($orderLists, 'oid');
             $promotionActivityData = app::get('systrade')->model('promotion_detail')->getList('promotion_tag,oid', ['promotion_type' => 'activity', 'oid' => $oids]);
             //一个子订单只可参加一次标签促销活动
             $promotionActivityData = array_bind_key($promotionActivityData, 'oid');
         }
         foreach ($orderLists as $key => $value) {
             if ($promotionActivityData[$value['oid']]['promotion_tag']) {
                 $value['promotion_tag'] = $promotionActivityData[$value['oid']]['promotion_tag'];
             }
             $tradeLists[$value['tid']]['order'][] = $value;
         }
     }
     $trade['list'] = $tradeLists;
     $trade['count'] = $count;
     return $trade;
 }
开发者ID:453111208,项目名称:bbc,代码行数:60,代码来源:list.php

示例6: tradeList

 public function tradeList($params, $oauth)
 {
     if (isset($oauth['shop_id'])) {
         $params['shop_id'] = $oauth['shop_id'];
     } else {
         if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
             $params['user_id'] = $params['oauth']['account_id'];
         } elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
             $sellerId = $params['oauth']['account_id'];
             $params['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $sellerId), 'seller');
         }
     }
     $tradeRow = $params['fields']['rows'];
     $orderRow = $params['fields']['extends']['order'];
     //lastmodify的范围划分
     if ($params['update_time_start'] > 0 && $params['update_time_end'] > 0) {
         $params['modified_time|between'] = array($params['update_time_start'], $params['update_time_end']);
     }
     unset($params['update_time_start']);
     unset($params['update_time_end']);
     //分页使用
     $pageSize = $params['page_size'] ? $params['page_size'] : 40;
     $pageNo = $params['page_no'] ? $params['page_no'] : 1;
     $max = 1000000;
     if ($pageSize >= 1 && $pageSize < 500 && $pageNo >= 1 && $pageNo < 200 && $pageSize * $pageNo < $max) {
         $limit = $pageSize;
         $page = ($pageNo - 1) * $limit;
     }
     $orderBy = $params['orderBy'];
     if (!$params['orderBy']) {
         $orderBy = "created_time desc";
     }
     unset($params['fields'], $params['page_no'], $params['page_size'], $params['order_by'], $params['oauth']);
     foreach ($params as $k => $val) {
         if (!$val) {
             unset($params[$k]);
             continue;
         }
         if ($k == "status" || $k == "tid") {
             $params[$k] = explode(',', $val);
         }
     }
     $objMdlTrade = app::get('systrade')->model('trade');
     $count = $objMdlTrade->count($params);
     $tradeLists = $objMdlTrade->getList($tradeRow, $params, $page, $limit, $orderBy);
     $tradeLists = array_bind_key($tradeLists, 'tid');
     if ($orderRow && $tradeLists) {
         $orderRow = str_append($orderRow, 'tid');
         $objMdlOrder = app::get('systrade')->model('order');
         $tids = array_column($tradeLists, 'tid');
         $orderLists = $objMdlOrder->getList($orderRow, array('tid' => $tids));
         foreach ($orderLists as $key => $value) {
             $tradeLists[$value['tid']]['order'][] = $value;
         }
     }
     $trade['list'] = $tradeLists;
     $trade['count'] = $count;
     return $trade;
 }
开发者ID:453111208,项目名称:bbc,代码行数:59,代码来源:listByShop.php

示例7: get

 public function get($params)
 {
     $fields = $params['fields'] ? $params['fields'] : "*";
     $filter['item_id'] = $params['item_id'];
     $objMdlItemCount = app::get('sysitem')->model('item_count');
     $itemInfoCount = $objMdlItemCount->getList($fields, $filter);
     return array_bind_key($itemInfoCount, 'item_id');
 }
开发者ID:453111208,项目名称:bbc,代码行数:8,代码来源:getCount.php

示例8: getList

 public function getList($params)
 {
     $prop_id = explode(',', $params['prop_id']);
     $objMdlProps = app::get('syscategory')->model('props');
     $props = $objMdlProps->getList('*', array('prop_id' => $prop_id));
     $props = array_bind_key($props, 'prop_id');
     return $props;
 }
开发者ID:453111208,项目名称:bbc,代码行数:8,代码来源:getPropList.php

示例9: index

 public function index()
 {
     $objLibFilter = kernel::single('topc_item_filter');
     $params = $objLibFilter->decode(input::get());
     $params['use_platform'] = '0,1';
     //判断自营  自营是1,非自营是0
     if ($params['is_selfshop'] == '1') {
         $pagedata['isself'] = '0';
     } else {
         $pagedata['isself'] = '1';
     }
     //如果不是从分类进入,并且没有关键字搜索则不能进入列表页
     $params['search_keywords'] = trim($params['search_keywords']);
     if (empty($params['cat_id']) && empty($params['search_keywords'])) {
         return redirect::back();
     }
     //默认图片
     $pagedata['image_default_id'] = app::get('image')->getConf('image.set');
     //搜索或者筛选获取商品
     $searchParams = $this->__preFilter($params);
     $searchParams['fields'] = 'item_id,title,image_default_id,price,promotion.ids';
     $itemsList = app::get('topc')->rpcCall('item.search', $searchParams);
     //检测是否有参加团购活动
     if ($itemsList['list']) {
         $itemsList['list'] = array_bind_key($itemsList['list'], 'item_id');
         $itemIds = array_keys($itemsList['list']);
         $activityParams['item_id'] = implode(',', $itemIds);
         $activityParams['status'] = 'agree';
         $activityParams['end_time'] = 'bthan';
         $activityParams['start_time'] = 'sthan';
         $activityParams['fields'] = 'activity_id,item_id,activity_tag,price,activity_price';
         $activityItemList = app::get('topc')->rpcCall('promotion.activity.item.list', $activityParams);
         if ($activityItemList['list']) {
             foreach ($activityItemList['list'] as $key => $value) {
                 $itemsList['list'][$value['item_id']]['activity'] = $value;
                 $itemsList['list'][$value['item_id']]['price'] = $value['activity_price'];
             }
         }
     }
     //根据条件搜索出最多商品的分类,进行显示渐进式筛选项
     $filterItems = app::get('topc')->rpcCall('item.search.filterItems', $params);
     //渐进式筛选的数据
     $pagedata['screen'] = $filterItems;
     $pagedata['items'] = $itemsList['list'];
     //根据条件搜索出的商品
     $pagedata['count'] = $itemsList['total_found'];
     //根据条件搜索到的总数
     //已有的搜索条件
     $tmpFilter = $params;
     unset($tmpFilter['pages']);
     $pagedata['filter'] = $objLibFilter->encode($tmpFilter);
     //分页
     $pagedata['pagers'] = $this->__pages($params['pages'], $pagedata['count'], $pagedata['filter']);
     //已选择的搜索条件
     $pagedata['activeFilter'] = $params;
     return $this->page('topc/list/index.html', $pagedata);
 }
开发者ID:453111208,项目名称:bbc,代码行数:57,代码来源:list.php

示例10: getList

 public function getList($params)
 {
     $filter['shop_id'] = explode(',', $params['shop_id']);
     $objMdlShop = app::get('sysshop')->model('shop');
     $objMdlshopType = app::get('sysshop')->model('shop_type');
     $shopdata = $objMdlShop->getList('shop_id,shop_name,shop_type', $filter);
     $type = $objMdlshopType->getList('suffix,shop_type');
     $type = array_bind_key($type, 'shop_type');
     foreach ($shopdata as $value) {
         $shopName[$value['shop_id']] = $value['shop_name'] . $type[$value['shop_type']]['suffix'];
     }
     return $shopName;
 }
开发者ID:453111208,项目名称:bbc,代码行数:13,代码来源:getName.php

示例11: modifier_activity_id

 public function modifier_activity_id(&$colList)
 {
     foreach ($colList as $id) {
         $activityIds[] = $id;
     }
     // shop.get.list
     $data = app::get('syspromotion')->model('activity')->getList('activity_name,activity_id', array('activity_id' => $activityIds));
     $data = array_bind_key($data, 'activity_id');
     foreach ($colList as $k => $row) {
         if ($data[$row]['activity_name']) {
             $colList[$k] = $data[$row]['activity_name'];
         }
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:14,代码来源:register.php

示例12: couponDetail

 public function couponDetail()
 {
     $coupon_id = input::get('coupon_id');
     $pagedata['couponInfo'] = app::get('topm')->rpcCall('promotion.coupon.get', array('coupon_id' => $coupon_id));
     // 获取会员等级名称
     $validGrade = explode(',', $pagedata['couponInfo']['valid_grade']);
     $gradeList = app::get('topm')->rpcCall('user.grade.list', array(), 'buyer');
     $gradeNameArr = array_bind_key($gradeList, 'grade_id');
     $validGradeNameArr = array();
     foreach ($validGrade as $v) {
         $validGradeNameArr[] = $gradeNameArr[$v]['grade_name'];
     }
     $pagedata['couponInfo']['valid_grade_name'] = implode(',', $validGradeNameArr);
     return $this->page('topm/member/coupon/couponDetail.html', $pagedata);
 }
开发者ID:453111208,项目名称:bbc,代码行数:15,代码来源:coupon.php

示例13: get

 public function get($params)
 {
     $objMdlSeller = app::get('sysshop')->model('seller');
     $data = $objMdlSeller->getList('*', ['shop_id' => $params['shop_id'], 'seller_type' => '1']);
     if (empty($data)) {
         return array();
     }
     $sellerIds = array_column($data, 'seller_id');
     $accountData = app::get('sysshop')->model('account')->getList('seller_id,login_account,disabled', ['seller_id' => $sellerIds]);
     $data = array_bind_key($data, 'seller_id');
     foreach ($accountData as $row) {
         if ($data[$row['seller_id']]) {
             $data[$row['seller_id']]['login_account'] = $row['login_account'];
             $data[$row['seller_id']]['disabled'] = $row['disabled'];
         }
     }
     return $data;
 }
开发者ID:453111208,项目名称:bbc,代码行数:18,代码来源:sellerList.php

示例14: search

 public function search()
 {
     $tradeStatus = array('WAIT_BUYER_PAY' => '等待付款', 'WAIT_SELLER_SEND_GOODS' => '等待发货', 'WAIT_BUYER_CONFIRM_GOODS' => '等待确认收货', 'TRADE_FINISHED' => '已完成', 'TRADE_CLOSED' => '已关闭', 'TRADE_CLOSED_BY_SYSTEM' => '已关闭');
     $this->contentHeaderTitle = app::get('topshop')->_('订单查询');
     $postFilter = input::get();
     $filter = $this->_checkParams($postFilter);
     $limit = $this->limit;
     $status = $filter['status'];
     if (is_array($filter['status'])) {
         $status = implode(',', $filter['status']);
     }
     $page = $filter['pages'] ? $filter['pages'] : 1;
     $params = array('status' => $status, 'tid' => $filter['tid'], 'create_time_start' => $filter['created_time_start'], 'create_time_end' => $filter['created_time_end'], 'page_no' => $page, 'page_size' => $limit, 'order_by' => 'created_time desc', 'fields' => 'tid,shop_id,user_id,status,payment,total_fee,post_fee,payed_fee,receiver_name,created_time,receiver_mobile,discount_fee,adjust_fee,order.title,order.price,order.num,order.pic_path,order.tid,order.oid,order.item_id,need_invoice,invoice_name,invoice_type,invoice_main,pay_type');
     $tradeList = app::get('topshop')->rpcCall('trade.get.list', $params, 'seller');
     $count = $tradeList['count'];
     $tradeList = $tradeList['list'];
     foreach ($tradeList as $key => $value) {
         $usersId[] = $value['user_id'];
         if ($value['status'] == 'WAIT_SELLER_SEND_GOODS') {
             $tids[] = $value['tid'];
             $tradeList[$key]['is_apply_abnormal'] = true;
         } else {
             $tradeList[$key]['is_apply_abnormal'] = false;
             //不能申请取消异常订单
         }
     }
     if ($tids) {
         $abnormalData = app::get('topshop')->rpcCall('trade.abnormal.list.get', ['role' => 'seller', 'tid' => $tids, 'fields' => 'tid']);
         $tradeAnormalData = array_bind_key($abnormalData['tradeAnormal'], 'tid');
     }
     $username = app::get('topshop')->rpcCall('user.get.account.name', ['user_id' => implode(',', $usersId)], 'seller');
     foreach ($tradeList as $key => $value) {
         $tradeList[$key]['status_depict'] = $tradeStatus[$value['status']];
         $tradeList[$key]['user_login_name'] = $username[$value['user_id']];
         if ($tradeAnormalData[$value['tid']]) {
             $tradeList[$key]['is_apply_abnormal'] = false;
         }
     }
     $pagedata['orderlist'] = $tradeList;
     $pagedata['count'] = $count;
     $pagedata['image_default_id'] = app::get('image')->getConf('image.set');
     $pagedata['pagers'] = $this->__pager($postFilter, $page, $count);
     return view::make('topshop/trade/item.html', $pagedata);
 }
开发者ID:453111208,项目名称:bbc,代码行数:44,代码来源:list.php

示例15: move

 /**
  * 将image表中的历史数据转存到images中
  */
 public function move()
 {
     $objImage = app::get('image')->model('image');
     $objImages = app::get('image')->model('images');
     $db = app::get('systrade')->database();
     $count = $objImage->count();
     logger::info(sprintf('Total %d image', $count));
     logger::info(sprintf('image data from sdb_image_image move to sdb_image_images ... start.'));
     $pagesize = 10;
     for ($i = 0; $i < $count; $i += $pagesize) {
         $oldImages = $objImage->getList('*', array(), $i, $pagesize);
         if (empty($oldImages)) {
             continue;
         }
         $imageIds = array_column($oldImages, 'image_id');
         $oldImagesAttach = app::get('image')->model('image_attach')->getList('*', array('image_id' => $imageIds));
         $oldImagesAttach = array_bind_key($oldImagesAttach, 'image_id');
         foreach ($oldImages as $row) {
             $insert = array();
             if (!$row['ident']) {
                 continue;
             }
             if (!file_exists(MEDIA_DIR . $row['ident'])) {
                 continue;
             }
             $insert['storage'] = $row['storage'];
             $insert['image_name'] = $row['image_name'];
             $insert['ident'] = $row['ident'];
             $insert['url'] = kernel::get_host_mirror_img() . str_replace(PUBLIC_DIR, '', MEDIA_DIR) . $row['ident'];
             $insert['width'] = $row['width'];
             $insert['height'] = $row['height'];
             $insert['last_modified'] = $row['last_modified'];
             $insert['target_id'] = $oldImagesAttach[$row['image_id']]['target_id'];
             $insert['target_type'] = $oldImagesAttach[$row['image_id']]['target_type'];
             try {
                 $objImages->insert($insert);
             } catch (Exception $e) {
                 print_r($e);
             }
         }
     }
     logger::info(sprintf('image data from sdb_image_image move to sdb_image_images ... ok.' . "\n"));
     return true;
 }
开发者ID:453111208,项目名称:bbc,代码行数:47,代码来源:imagedata.php


注:本文中的array_bind_key函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。