當前位置: 首頁>>代碼示例>>PHP>>正文


PHP utils::array_md5方法代碼示例

本文整理匯總了PHP中utils::array_md5方法的典型用法代碼示例。如果您正苦於以下問題:PHP utils::array_md5方法的具體用法?PHP utils::array_md5怎麽用?PHP utils::array_md5使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utils的用法示例。


在下文中一共展示了utils::array_md5方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: gallery

 /**
  * 商品列表.
  */
 public function gallery($params = array())
 {
     $default_params = array('page_size' => 20, 'page_index' => 1, 'orderby' => '');
     if (!is_array($params)) {
         $params = array();
     }
     $params = array_merge($default_params, $params, $this->req_params);
     if ($params['orderby']) {
         $params['orderby'] = str_replace('-', ' ', $params['orderby']);
     }
     $cache_key = utils::array_md5($params);
     //優先從緩存讀取
     if (cachemgr::get($cache_key, $gallery_data)) {
         $this->success($gallery_data);
     }
     cachemgr::co_start();
     $filter = $params['filter'];
     if (!is_array($filter)) {
         $filter = array();
     }
     $filter['marketable'] = 'true';
     $obj_goods_stage = vmc::singleton('b2c_goods_stage');
     //set_member
     if ($this->app->member_id = vmc::singleton('b2c_user_object')->get_member_id()) {
         $obj_goods_stage->set_member($this->app->member_id);
     }
     $mdl_goods = app::get('b2c')->model('goods');
     $goods_cols = 'goods_id,gid,name,type_id,cat_id,brand_id,nostore_sell,brief,image_default_id,goods_setting';
     $goods_list = $mdl_goods->getList($goods_cols, $filter, $params['page_size'] * ($params['page_index'] - 1), $params['page_size'], $params['orderby']);
     if (!$goods_list) {
         $this->failure();
     }
     $total = $mdl_goods->count($filter);
     $obj_goods_stage->gallery($goods_list);
     //引用傳遞
     $page_total = $total ? ceil($total / $the_params['page_size']) : 1;
     $gallery_data = array('page_total' => $page_total > 0 ? $page_total : 1, 'goods_list' => array_values($goods_list));
     cachemgr::set($cache_key, $gallery_data, cachemgr::co_end());
     $this->success($gallery_data);
 }
開發者ID:yindonghai,項目名稱:msk.com,代碼行數:43,代碼來源:goods.php

示例2: _list

 private function _list($filter, $page, $orderby)
 {
     $cache_key = utils::array_md5(func_get_args());
     if (cachemgr::get($cache_key, $return)) {
         return $return;
     }
     cachemgr::co_start();
     $goods_cols = '*';
     $mdl_goods = $this->app->model('goods');
     $goods_list = $mdl_goods->getList($goods_cols, $filter, $page['size'] * ($page['index'] - 1), $page['size'], $orderby);
     $obj_goods_stage = vmc::singleton('b2c_goods_stage');
     //set_member
     if ($this->app->member_id = vmc::singleton('b2c_user_object')->get_member_id()) {
         $obj_goods_stage->set_member($this->app->member_id);
     }
     $obj_goods_stage->gallery($goods_list);
     //引用傳遞
     $total = $mdl_goods->count($filter);
     $return = array('data' => $goods_list, 'count' => count($goods_list), 'all_count' => $total, 'page_info' => array('total' => $total ? ceil($total / $page['size']) : 1, 'current' => intval($page['index'])));
     cachemgr::set($cache_key, $return, cachemgr::co_end());
     return $return;
 }
開發者ID:noikiy,項目名稱:msk.com,代碼行數:22,代碼來源:list.php

示例3: remove_coupon

 public function remove_coupon($is_fastbuy = false)
 {
     if ($is_fastbuy) {
         $filter['is_fastbuy'] = 'true';
         //在立即購買結算流程中使用優惠券
     } else {
         $filter = null;
     }
     $params = $this->_request->get_params(true);
     $this->cart_stage->delete('coupon', $params['obj_ident'], $is_fastbuy);
     $cart_result = $this->cart_stage->result($filter);
     $cart_result['new_cart_md5'] = utils::array_md5($cart_result);
     //用於直接在購物車取消優惠券
     if (!$this->_request->is_ajax()) {
         $this->redirect(array('app' => 'b2c', 'ctl' => 'mobile_cart'));
     }
     $this->splash('success', '', $cart_result);
 }
開發者ID:noikiy,項目名稱:snk,代碼行數:18,代碼來源:cart.php

示例4: create

 public function create($fastbuy = false)
 {
     $member_id = $this->app->member_id;
     //parent method
     //$member_info = $this->get_member_info($member_id);
     $this->logger->set_operator(array('ident' => $member_id, 'name' => '會員', 'model' => 'members'));
     $params = utils::_filter_input($_POST);
     //新訂單標準數據
     $order_sdf = array('member_id' => $member_id, 'memo' => $params['memo'], 'pay_app' => $params['payapp_id'], 'dlytype_id' => $params['dlytype_id'], 'createtime' => time(), 'need_shipping' => $params['need_shipping'], 'need_invoice' => $params['need_invoice'], 'invoice_title' => $params['invoice_title'], 'platform' => 'mobile');
     $redirect_cart = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_cart'), true);
     $redirect_checkout = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_checkout', 'args' => array($fastbuy)), true);
     if ($fastbuy) {
         $filter['is_fastbuy'] = 'true';
     }
     if ($order_sdf['need_shipping'] != 'N') {
         if ($order_sdf['need_shipping'] != 'N' && !$order_sdf['dlytype_id']) {
             $this->logger->fail('create', '未知配送方式', $params);
             $this->splash('error', $redirect_checkout, '未知配送方式');
         }
         //COD FIX
         if ($order_sdf['pay_app'] == '-1' || $order_sdf['pay_app'] == 'cod') {
             $order_sdf['is_cod'] = 'Y';
         } else {
             $dlytype = app::get('b2c')->model('dlytype')->dump($params['dlytype_id']);
             if ($dlytype['has_cod'] == 'true') {
                 $order_sdf['pay_app'] = 'cod';
                 $order_sdf['is_cod'] = 'Y';
             }
         }
         if (!$params['addr_id']) {
             $this->logger->fail('create', '無收貨人信息', $params);
             $this->splash('error', $redirect_checkout, '無收貨人信息');
         } else {
             $consignee = app::get('b2c')->model('member_addrs')->getRow('name,area,addr,zip,tel,mobile,email', array('member_id' => $member_id, 'addr_id' => $params['addr_id']));
             $order_sdf['consignee'] = $consignee;
         }
     }
     if (!$order_sdf['pay_app']) {
         $this->logger->fail('create', '未知支付方式', $params);
         $this->splash('error', $redirect_checkout, '未知支付方式');
     }
     //購物車數據
     $cart_result = $this->cart_stage->result($filter);
     if ($this->cart_stage->is_empty($cart_result)) {
         $this->logger->fail('create', '沒有可結算商品', $params);
         $this->splash('error', $redirect_cart, '沒有可結算商品');
     }
     if ($params['cart_md5'] != utils::array_md5($cart_result)) {
         $this->logger->fail('create', '購物車發生變化', $params);
         $this->splash('error', $redirect_cart, '購物車發生變化');
     }
     $db = vmc::database();
     //開啟事務
     $this->transaction_status = $db->beginTransaction();
     $order_create_service = vmc::singleton('b2c_order_create');
     //&$order_sdf、&$msg
     if (!$order_create_service->generate($order_sdf, $cart_result, $msg)) {
         $db->rollback();
         //事務回滾
         $msg = $msg ? $msg : '數據組織失敗';
         $this->logger->fail('create', $msg, $params);
         $this->splash('error', $redirect_cart, $msg);
     }
     if (!$order_create_service->save($order_sdf, $msg)) {
         $db->rollback();
         //事務回滾
         $msg = $msg ? $msg : '數據保存失敗';
         $this->logger->fail('create', $msg, $order_sdf);
         $this->splash('error', $redirect_cart, $msg);
     }
     $db->commit($this->transaction_status);
     //事務提交
     $this->logger->set_order_id($order_sdf['order_id']);
     $this->logger->success('create', '訂單創建成功', $params);
     /*
      * 優惠券凍結,優惠券使用記錄
      * 未使用成功in_use!="true"的優惠券不做凍結處理,不做記錄
      * @see /Applications/b2c/lib/postfilter/promotion.php line 200
      */
     foreach ($cart_result['objects']['coupon'] as $coupon) {
         if ($coupon['params']['in_use'] != 'true') {
             continue;
         }
         $couponlog_data = array('member_id' => $member_id, 'order_id' => $order_sdf['order_id'], 'cpns_id' => $coupon['params']['cpns_id'], 'memc_code' => $coupon['params']['code'], 'cpns_name' => $coupon['params']['name'], 'coupon_save' => $coupon['params']['save'], 'order_total' => $order_sdf['order_total']);
         vmc::singleton('b2c_coupon_stage')->couponlog($couponlog_data, $msg);
         if ($coupon['params']['cpns_type'] == '1') {
             //需凍結會員賬戶內的相關B類券
             vmc::singleton('b2c_coupon_stage')->freeze_member_coupon($member_id, $coupon['params']['code'], $msg);
         }
     }
     //清理購物車
     $this->cart_stage->clean($cart_result, $fastbuy);
     //隻刪除勾選結算項,對於優惠券,隻刪除觸發促銷的項
     $redirect_payment = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_checkout', 'act' => 'payment', 'args' => array($order_sdf['order_id'], '1')), true);
     $this->splash('success', $redirect_payment, '訂單提交成功');
 }
開發者ID:yindonghai,項目名稱:msk.com,代碼行數:96,代碼來源:order.php

示例5: check

 public function check($params)
 {
     $member_id = $params['member_id'];
     $addr_id = $params['addr_id'];
     $dlytype_id = $params['dlytype_id'];
     $payapp_id = $params['payapp_id'];
     $cart_result = $params['cart_result'];
     //支付方式過濾
     $payapp_filter = array('status' => 'true', 'platform_allow' => array('pc'));
     if ($params['payapp_filter']) {
         $payapp_filter = array_merge($payapp_filter, $params['payapp_filter']);
     }
     $_return = array();
     $mdl_maddr = app::get('b2c')->model('member_addrs');
     $mdl_dltype = app::get('b2c')->model('dlytype');
     $mdl_payapps = app::get('ectools')->model('payment_applications');
     if ($member_addrs = $mdl_maddr->getList('*', array('member_id' => $member_id), 0, -1, '`is_default` ASC,updatetime DESC,`addr_id`')) {
         $def_addr = $member_addrs[0];
         //會員默認收貨地址
         $member_addrs = utils::array_change_key($member_addrs, 'addr_id');
         $last_checkout = $this->get_default($member_id);
         //會員最後一次購物時選擇的配送和支付方式
         if ($addr_id) {
             $member_addrs[$addr_id]['selected'] = 'true';
             $area = $member_addrs[$addr_id]['area'];
         } else {
             $area = $def_addr['area'];
             $member_addrs[$def_addr['addr_id']]['selected'] = 'true';
         }
         $area_id = array_pop(explode(':', $area));
         $_return['member_addrs'] = $member_addrs;
     }
     //根據地區獲得送貨方式
     $dlytypes = $mdl_dltype->getAvailable($area_id);
     $dlytypes = utils::array_change_key($dlytypes, 'dt_id');
     if ($dlytype_id = $dlytype_id ? $dlytype_id : $last_checkout['dlytype_id']) {
         if ($dlytypes[$dlytype_id]) {
             $dlytypes[$dlytype_id]['selected'] = 'true';
             if ($dlytypes[$dlytype_id]['has_cod'] == 'true') {
                 $is_cod = true;
                 //為了貨到付款鎖定在線支付
             }
         } else {
             $dlytypes[key($dlytypes)]['selected'] = 'true';
         }
     }
     if ($is_cod) {
         $payapp_filter['app_id'] = 'cod';
     }
     $paymentapps = $mdl_payapps->getList('*', $payapp_filter);
     $paymentapps = utils::array_change_key($paymentapps, 'app_id');
     if ($payapp_id = $payapp_id ? $payapp_id : $last_checkout['pay_app']) {
         if ($paymentapps[$payapp_id]) {
             $paymentapps[$payapp_id]['selected'] = 'true';
         } else {
             $paymentapps[key($paymentapps)]['selected'] = 'true';
         }
     }
     $_return['dlytypes'] = $dlytypes;
     $_return['paymentapps'] = $paymentapps;
     if (!$params['ignore_return_cart_result']) {
         $_return['cart_result'] = $cart_result;
     }
     $_return['cart_md5'] = utils::array_md5($cart_result);
     $order_sdf_tmp = array('consignee' => array('area' => $area), 'dlytype_id' => $dlytype_id);
     $_return['total'] = vmc::singleton('b2c_order_total')->detail($order_sdf_tmp, $cart_result);
     //總價
     return $_return;
 }
開發者ID:noikiy,項目名稱:snk,代碼行數:69,代碼來源:stage.php

示例6: md5_cart_objects

 public function md5_cart_objects($is_fastbuy = false)
 {
     $arr = $this->app->model('cart')->get_basic_objects($is_fastbuy = false);
     $md5 = utils::array_md5($arr);
     return $md5;
 }
開發者ID:sss201413,項目名稱:ecstore,代碼行數:6,代碼來源:objects.php


注:本文中的utils::array_md5方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。