本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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, '订单提交成功');
}
示例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;
}
示例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;
}