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


PHP QueueClient類代碼示例

本文整理匯總了PHP中QueueClient的典型用法代碼示例。如果您正苦於以下問題:PHP QueueClient類的具體用法?PHP QueueClient怎麽用?PHP QueueClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: addRefundReturn

 /**
  * 增加退款退貨
  *
  * @param
  * @return int
  */
 public function addRefundReturn($refund_array, $order = array(), $goods = array())
 {
     if (!empty($order) && is_array($order)) {
         $refund_array['order_id'] = $order['order_id'];
         $refund_array['order_sn'] = $order['order_sn'];
         $refund_array['store_id'] = $order['store_id'];
         $refund_array['store_name'] = $order['store_name'];
         $refund_array['buyer_id'] = $order['buyer_id'];
         $refund_array['buyer_name'] = $order['buyer_name'];
     }
     if (!empty($goods) && is_array($goods)) {
         $refund_array['goods_id'] = $goods['goods_id'];
         $refund_array['order_goods_id'] = $goods['rec_id'];
         $refund_array['order_goods_type'] = $goods['goods_type'];
         $refund_array['goods_name'] = $goods['goods_name'];
         $refund_array['commis_rate'] = $goods['commis_rate'];
         $refund_array['goods_image'] = $goods['goods_image'];
     }
     $refund_array['refund_sn'] = $this->getRefundsn($refund_array['store_id']);
     $refund_id = $this->table('refund_return')->insert($refund_array);
     // 發送商家提醒
     $param = array();
     if (intval($refund_array['refund_type']) == 1) {
         // 退款
         $param['code'] = 'refund';
     } else {
         // 退貨
         $param['code'] = 'return';
     }
     $param['store_id'] = $order['store_id'];
     $type = $refund_array['order_lock'] == 2 ? '售前' : '售後';
     $param['param'] = array('type' => $type, 'refund_sn' => $refund_array['refund_sn']);
     QueueClient::push('sendStoreMsg', $param);
     return $refund_id;
 }
開發者ID:dotku,項目名稱:shopnc_cnnewyork,代碼行數:41,代碼來源:refund_return.model.php

示例2: indexOp

 /**
  * 通知
  */
 public function indexOp()
 {
     $strat_time = strtotime("-30 day");
     // 隻通知最近30天的記錄
     $model_arrtivalnotice = Model('arrival_notice');
     $count = $model_arrtivalnotice->getArrivalNoticeCount(array());
     $times = ceil($count / $this->_num);
     if ($times == 0) {
         return false;
     }
     for ($i = 0; $i <= $times; $i++) {
         // 刪除30天之前的記錄
         $model_arrtivalnotice->delArrivalNotice(array('an_addtime' => array('lt', $strat_time)));
         $notice_list = $model_arrtivalnotice->getArrivalNoticeList(array(), '*', $i . ',' . $this->_num);
         if (empty($notice_list)) {
             continue;
         }
         // 查詢商品是否已經上架
         $goodsid_array = array();
         foreach ($notice_list as $val) {
             $goodsid_array[] = $val['goods_id'];
         }
         $goodsid_array = array_unique($goodsid_array);
         $goods_list = Model('goods')->getGoodsOnlineList(array('goods_id' => array('in', $goodsid_array), 'goods_storage' => array('gt', 0)), 'goods_id');
         if (empty($goods_list)) {
             continue;
         }
         // 需要通知到貨的商品
         $goodsid_array = array();
         foreach ($goods_list as $val) {
             $goodsid_array[] = $val['goods_id'];
         }
         // 根據商品id重新查詢需要通知的列表
         $notice_list = $model_arrtivalnotice->getArrivalNoticeList(array('goods_id' => array('in', $goodsid_array)), '*');
         if (empty($notice_list)) {
             continue;
         }
         foreach ($notice_list as $val) {
             $param = array();
             $param['code'] = 'arrival_notice';
             $param['member_id'] = $val['member_id'];
             $param['param'] = array('goods_name' => $val['goods_name'], 'goods_url' => urlShop('goods', 'index', array('goods_id' => $val['goods_id'])));
             QueueClient::push('sendMemberMsg', $param);
         }
         // 清楚發送成功的數據
         $model_arrtivalnotice->delArrivalNotice(array('goods_id' => array('in', $goodsid_array)));
     }
 }
開發者ID:noikiy,項目名稱:shopnc-minion,代碼行數:51,代碼來源:arrival_notice.php

示例3: consult_replyOp

 /**
  * 回複谘詢
  */
 public function consult_replyOp()
 {
     $model_mallconsult = Model('mall_consult');
     if (chksubmit()) {
         $mc_id = intval($_POST['mc_id']);
         $reply_content = trim($_POST['reply_content']);
         if ($mc_id <= 0 || $reply_content == '') {
             showMessage(L('param_error'));
         }
         $update['is_reply'] = 1;
         $update['mc_reply'] = $reply_content;
         $update['mc_reply_time'] = TIMESTAMP;
         $update['admin_id'] = $this->admin_info['id'];
         $update['admin_name'] = $this->admin_info['name'];
         $result = $model_mallconsult->editMallConsult(array('mc_id' => $mc_id), $update);
         if ($result) {
             $consult_info = $model_mallconsult->getMallConsultInfo(array('mc_id' => $mc_id));
             // 發送用戶消息
             $param = array();
             $param['code'] = 'consult_mall_reply';
             $param['member_id'] = $consult_info['member_id'];
             $param['param'] = array('consult_url' => urlShop('member_mallconsult', 'mallconsult_info', array('id' => $mc_id)));
             QueueClient::push('sendMemberMsg', $param);
             showMessage('回複成功', urlAdmin('mall_consult', 'index'));
         } else {
             showMessage('回複失敗');
         }
     }
     $id = intval($_GET['id']);
     if ($id <= 0) {
         showMessage(L('param_error'));
     }
     $consult_info = $model_mallconsult->getMallConsultDetail($id);
     Tpl::output('consult_info', $consult_info);
     Tpl::showpage('mall_consult.reply');
 }
開發者ID:noikiy,項目名稱:ejia,代碼行數:39,代碼來源:mall_consult.php

示例4: receiveOp

 /**
  * 收貨
  *
  */
 public function receiveOp()
 {
     $model_refund = Model('refund_return');
     $model_trade = Model('trade');
     $condition = array();
     $condition['store_id'] = $_SESSION['store_id'];
     $condition['refund_id'] = intval($_GET['return_id']);
     $return_list = $model_refund->getReturnList($condition);
     $return = $return_list[0];
     Tpl::output('return', $return);
     $return_delay = $model_trade->getMaxDay('return_delay');
     //發貨默認5天後才能選擇沒收到
     $delay_time = time() - $return['delay_time'] - 60 * 60 * 24 * $return_delay;
     Tpl::output('return_delay', $return_delay);
     Tpl::output('return_confirm', $model_trade->getMaxDay('return_confirm'));
     //賣家不處理收貨時按同意並棄貨處理
     Tpl::output('delay_time', $delay_time);
     if (chksubmit()) {
         if ($return['seller_state'] != '2' || $return['goods_state'] != '2') {
             //檢查狀態,防止頁麵刷新不及時造成數據錯誤
             showDialog(Language::get('wrong_argument'), 'reload', 'error', 'CUR_DIALOG.close();');
         }
         $refund_array = array();
         if ($_POST['return_type'] == '3' && $delay_time > 0) {
             $refund_array['goods_state'] = '3';
         } else {
             $refund_array['receive_time'] = time();
             $refund_array['receive_message'] = '確認收貨完成';
             $refund_array['refund_state'] = '2';
             //狀態:1為處理中,2為待管理員處理,3為已完成
             $refund_array['goods_state'] = '4';
         }
         $state = $model_refund->editRefundReturn($condition, $refund_array);
         if ($state) {
             $this->recordSellerLog('退貨確認收貨,退貨編號:' . $return['refund_sn']);
             // 發送買家消息
             $param = array();
             $param['code'] = 'refund_return_notice';
             $param['member_id'] = $return['buyer_id'];
             $param['param'] = array('refund_url' => urlShop('member_return', 'view', array('return_id' => $return['refund_id'])), 'refund_sn' => $return['refund_sn']);
             QueueClient::push('sendMemberMsg', sendMemberMsg);
             showDialog(Language::get('nc_common_save_succ'), 'reload', 'succ', 'CUR_DIALOG.close();');
         } else {
             showDialog(Language::get('nc_common_save_fail'), 'reload', 'error', 'CUR_DIALOG.close();');
         }
     }
     $express_list = rkcache('express', true);
     if ($return['express_id'] > 0 && !empty($return['invoice_no'])) {
         Tpl::output('e_name', $express_list[$return['express_id']]['e_name']);
         Tpl::output('e_code', $express_list[$return['express_id']]['e_code']);
     }
     Tpl::showpage('store_return_receive', 'null_layout');
 }
開發者ID:ff00x0,項目名稱:shopnc,代碼行數:57,代碼來源:store_return.php

示例5: _updateGroupBuy

 /**
  * 更新搶購購買人數和數量
  */
 private function _updateGroupBuy($goods_info)
 {
     if ($goods_info['ifgroupbuy'] && $goods_info['groupbuy_id']) {
         $groupbuy_info = array();
         $groupbuy_info['groupbuy_id'] = $goods_info['groupbuy_id'];
         $groupbuy_info['quantity'] = $goods_info['quantity'];
         QueueClient::push('editGroupbuySaleCount', $groupbuy_info);
     }
 }
開發者ID:noikiy,項目名稱:cunkou,代碼行數:12,代碼來源:buy_virtual.logic.php

示例6: delXianshiGoods

 /**
  * 刪除
  * @param array $condition
  * @return bool
  *
  */
 public function delXianshiGoods($condition)
 {
     $xianshi_goods_list = $this->getXianshiGoodsList($condition, null, '', 'goods_id');
     $result = $this->where($condition)->delete();
     if ($result) {
         if (!empty($xianshi_goods_list)) {
             foreach ($xianshi_goods_list as $val) {
                 // 刪除商品限時折扣緩存
                 $this->_dGoodsXianshiCache($val['goods_id']);
                 // 插入對列 更新促銷價格
                 QueueClient::push('updateGoodsPromotionPriceByGoodsId', $val['goods_id']);
             }
         }
     }
     return $result;
 }
開發者ID:flying3615,項目名稱:chuniang,代碼行數:22,代碼來源:p_xianshi_goods.model.php

示例7: changePd


//.........這裏部分代碼省略.........
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = -$data['amount'];
             $data_msg['freeze_amount'] = $data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'order_cancel':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '取消訂單,解凍預存款,訂單號: ' . $data['order_sn'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = -$data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'order_comb_pay':
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '下單,支付被凍結的預存款,訂單號: ' . $data['order_sn'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = 0;
             $data_msg['freeze_amount'] = $data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'recharge':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '充值,充值單號: ' . $data['pdr_sn'];
             $data_log['lg_admin_name'] = $data['admin_name'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'refund':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '確認退款,訂單號: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'vr_refund':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '虛擬兌碼退款成功,訂單號: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'cash_apply':
             $data_log['lg_av_amount'] = -$data['amount'];
             $data_log['lg_freeze_amount'] = $data['amount'];
             $data_log['lg_desc'] = '申請提現,凍結預存款,提現單號: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit-' . $data['amount']);
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = -$data['amount'];
             $data_msg['freeze_amount'] = $data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'cash_pay':
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '提現成功,提現單號: ' . $data['order_sn'];
             $data_log['lg_admin_name'] = $data['admin_name'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = 0;
             $data_msg['freeze_amount'] = -$data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'cash_del':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '取消提現申請,解凍預存款,提現單號: ' . $data['order_sn'];
             $data_log['lg_admin_name'] = $data['admin_name'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = -$data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         default:
             throw new Exception('參數錯誤');
             break;
     }
     $update = Model('member')->editMember(array('member_id' => $data['member_id']), $data_pd);
     if (!$update) {
         throw new Exception('操作失敗');
     }
     $insert = $this->table('pd_log')->insert($data_log);
     if (!$insert) {
         throw new Exception('操作失敗');
     }
     // 支付成功發送買家消息
     $param = array();
     $param['code'] = 'predeposit_change';
     $param['member_id'] = $data['member_id'];
     $data_msg['av_amount'] = ncPriceFormat($data_msg['av_amount']);
     $data_msg['freeze_amount'] = ncPriceFormat($data_msg['freeze_amount']);
     $param['param'] = $data_msg;
     QueueClient::push('sendMemberMsg', $param);
     return $insert;
 }
開發者ID:uwitec,項目名稱:xbshop,代碼行數:101,代碼來源:predeposit.model.php

示例8: editOp

 /**
  * 退貨處理頁
  *
  */
 public function editOp()
 {
     $model_refund = Model('refund_return');
     $condition = array();
     $condition['refund_id'] = intval($_GET['return_id']);
     $return_list = $model_refund->getReturnList($condition);
     $return = $return_list[0];
     if (chksubmit()) {
         if ($return['refund_state'] != '2') {
             //檢查狀態,防止頁麵刷新不及時造成數據錯誤
             showMessage(Language::get('nc_common_save_fail'));
         }
         $order_id = $return['order_id'];
         $refund_array = array();
         $refund_array['admin_time'] = time();
         $refund_array['refund_state'] = '3';
         //狀態:1為處理中,2為待管理員處理,3為已完成
         $refund_array['admin_message'] = $_POST['admin_message'];
         $state = $model_refund->editOrderRefund($return);
         if ($state) {
             $model_refund->editRefundReturn($condition, $refund_array);
             $this->log('退貨確認,退貨編號' . $return['refund_sn']);
             // 發送買家消息
             $param = array();
             $param['code'] = 'refund_return_notice';
             $param['member_id'] = $return['buyer_id'];
             $param['param'] = array('refund_url' => urlShop('return_id', 'view', array('return_id' => $return['refund_id'])), 'refund_sn' => $return['refund_sn']);
             QueueClient::push('sendMemberMsg', $param);
             showMessage(Language::get('nc_common_save_succ'), 'index.php?act=return&op=return_manage');
         } else {
             showMessage(Language::get('nc_common_save_fail'));
         }
     }
     Tpl::output('return', $return);
     $info['buyer'] = array();
     if (!empty($return['pic_info'])) {
         $info = unserialize($return['pic_info']);
     }
     Tpl::output('pic_list', $info['buyer']);
     Tpl::showpage('return.edit');
 }
開發者ID:noikiy,項目名稱:cunkou,代碼行數:45,代碼來源:return.php

示例9: editOrder

 /**
  * 更改訂單信息
  *
  * @param unknown_type $data
  * @param unknown_type $condition
  */
 public function editOrder($data, $condition, $limit = '')
 {
     $update = $this->table('order')->where($condition)->limit($limit)->update($data);
     if ($update) {
         //更新緩存
         QueueClient::push('delOrderCountCache', $condition);
     }
     return $update;
 }
開發者ID:noikiy,項目名稱:cunkou,代碼行數:15,代碼來源:order.model.php

示例10: recordStoreCost

 /**
  * 記錄店鋪費用
  *
  * @param $cost_price 費用金額
  * @param $cost_remark 費用備注
  */
 protected function recordStoreCost($cost_price, $cost_remark)
 {
     // 平台店鋪不記錄店鋪費用
     if (checkPlatformStore()) {
         return false;
     }
     $model_store_cost = Model('store_cost');
     $param = array();
     $param['cost_store_id'] = $_SESSION['store_id'];
     $param['cost_seller_id'] = $_SESSION['seller_id'];
     $param['cost_price'] = $cost_price;
     $param['cost_remark'] = $cost_remark;
     $param['cost_state'] = 0;
     $param['cost_time'] = TIMESTAMP;
     $model_store_cost->addStoreCost($param);
     // 發送店鋪消息
     $param = array();
     $param['code'] = 'store_cost';
     $param['store_id'] = $_SESSION['store_id'];
     $param['param'] = array('price' => $cost_price, 'seller_name' => $_SESSION['seller_name'], 'remark' => $cost_remark);
     QueueClient::push('sendStoreMsg', $param);
 }
開發者ID:uwitec,項目名稱:xbshop,代碼行數:28,代碼來源:control.php

示例11: remind_renewalOp

 /**
  * 提醒續費
  */
 public function remind_renewalOp()
 {
     $store_id = intval($_GET['store_id']);
     $store_info = Model('store')->getStoreInfoByID($store_id);
     if (!empty($store_info) && $store_info['store_end_time'] < TIMESTAMP + 864000 && cookie('remindRenewal' . $store_id) == null) {
         // 發送商家消息
         $param = array();
         $param['code'] = 'store_expire';
         $param['store_id'] = intval($_GET['store_id']);
         $param['param'] = array();
         QueueClient::push('sendStoreMsg', $param);
         setNcCookie('remindRenewal' . $store_id, 1, 86400 * 10);
         // 十天
         showMessage('消息發送成功');
     }
     showMessage('消息發送失敗');
 }
開發者ID:flying3615,項目名稱:chuniang,代碼行數:20,代碼來源:store.php

示例12: wxpayOp

 /**
  * 微信退款 v3-b12
  *
  */
 public function wxpayOp()
 {
     $result = array('state' => 'false', 'msg' => '參數錯誤,微信退款失敗');
     $refund_id = intval($_GET['refund_id']);
     $model_refund = Model('vr_refund');
     $condition = array();
     $condition['refund_id'] = $refund_id;
     $condition['refund_state'] = '1';
     $detail_array = $model_refund->getDetailInfo($condition);
     //退款詳細
     if (!empty($detail_array) && in_array($detail_array['refund_code'], array('wxpay', 'wx_jsapi', 'wx_saoma'))) {
         $order = $model_refund->getPayDetailInfo($detail_array);
         //退款訂單詳細
         $refund_amount = $order['pay_refund_amount'];
         //本次在線退款總金額
         if ($refund_amount > 0) {
             $wxpay = $order['payment_config'];
             define('WXPAY_APPID', $wxpay['appid']);
             define('WXPAY_MCHID', $wxpay['mchid']);
             define('WXPAY_KEY', $wxpay['key']);
             $total_fee = $order['pay_amount'] * 100;
             //微信訂單實際支付總金額(在線支付金額,單位為分)
             $refund_fee = $refund_amount * 100;
             //本次微信退款總金額(單位為分)
             $api_file = BASE_PATH . DS . 'api' . DS . 'refund' . DS . 'wxpay' . DS . 'WxPay.Api.php';
             include $api_file;
             $input = new WxPayRefund();
             $input->SetTransaction_id($order['trade_no']);
             //微信訂單號
             $input->SetTotal_fee($total_fee);
             $input->SetRefund_fee($refund_fee);
             $input->SetOut_refund_no($detail_array['batch_no']);
             //退款批次號
             $input->SetOp_user_id(WxPayConfig::MCHID);
             $data = WxPayApi::refund($input);
             if (!empty($data) && $data['return_code'] == 'SUCCESS') {
                 //請求結果
                 if ($data['result_code'] == 'SUCCESS') {
                     //業務結果
                     $detail_array = array();
                     $detail_array['pay_amount'] = ncPriceFormat($data['refund_fee'] / 100);
                     $detail_array['pay_time'] = time();
                     $model_refund->editDetail(array('refund_id' => $refund_id), $detail_array);
                     $result['state'] = 'true';
                     $result['msg'] = '微信成功退款:' . $detail_array['pay_amount'];
                     $refund = $model_refund->getRefundInfo(array('refund_id' => $refund_id));
                     $consume_array = array();
                     $consume_array['member_id'] = $refund['buyer_id'];
                     $consume_array['member_name'] = $refund['buyer_name'];
                     $consume_array['consume_amount'] = $detail_array['pay_amount'];
                     $consume_array['consume_time'] = time();
                     $consume_array['consume_remark'] = '微信在線退款成功(到賬有延遲),虛擬退款單號:' . $refund['refund_sn'];
                     QueueClient::push('addConsume', $consume_array);
                 } else {
                     $result['msg'] = '微信退款錯誤,' . $data['err_code_des'];
                     //錯誤描述
                 }
             } else {
                 $result['msg'] = '微信接口錯誤,' . $data['return_msg'];
                 //返回信息
             }
         }
     }
     exit(json_encode($result));
 }
開發者ID:dotku,項目名稱:shopnc_cnnewyork,代碼行數:69,代碼來源:vr_refund.php

示例13: _create_vr_order_bill

    /**
     * 生成所有店鋪月訂單出賬單[虛擬訂單]
     *
     * @param int $data
     */
    private function _create_vr_order_bill($data){
        $model_order = Model('vr_order');
        $model_bill = Model('vr_bill');
        $model_store = Model('store');
    
        //批量插入order_bill表
        $condition = array();
        $condition['order_state'] = array('egt',ORDER_STATE_PAY);
        $condition['payment_time'] = array(array('egt',$data['os_start_date']),array('elt',$data['os_end_date']),'and');
        //取出有最終成交訂單的店鋪ID數量(ID不重複)
        $order_info =  $model_order->getOrderInfo($condition,'count(DISTINCT store_id) as store_count');
        $store_count = $order_info['store_count'];
        //分批生成該月份的店鋪空結算表,每批生成300個店鋪
        $insert = false;
        for ($i=0;$i<=$store_count;$i=$i+300){
            $store_list = $model_order->getOrderList($condition,'','DISTINCT store_id','',"{$i},300");
            if ($store_list){
                //自動生成以月份為單位的空結算記錄
                $data_bill = array();
                foreach($store_list as $store_info){
                    $data_bill['ob_no'] = $data['os_month'].$store_info['store_id'];
                    $data_bill['ob_start_date'] = $data['os_start_date'];
                    $data_bill['ob_end_date'] = $data['os_end_date'];
                    $data_bill['os_month'] = $data['os_month'];
                    $data_bill['ob_state'] = 0;
                    $data_bill['ob_store_id'] = $store_info['store_id'];
                    if (!$model_bill->getOrderBillInfo(array('ob_no'=>$data_bill['ob_no']))) {
                        $insert = $model_bill->addOrderBill($data_bill);
                        if (!$insert) {
                            throw new Exception('生成賬單['.$data_bill['ob_no'].']失敗');
                        }
                        //對已生成空賬單進行銷量、傭金統計
                        $update = $this->_calc_vr_order_bill($data_bill);
                        if (!$update){
                            throw new Exception('更新賬單['.$data_bill['ob_no'].']失敗');
                        }

                        // 發送店鋪消息
                        $param = array();
                        $param['code'] = 'store_bill_affirm';
                        $param['store_id'] = $store_info['store_id'];
                        $param['param'] = array(
                                'state_time' => date('Y-m-d H:i:s', $data_bill['ob_start_date']),
                                'end_time' => date('Y-m-d H:i:s', $data_bill['ob_end_date']),
                                'bill_no' => $data_bill['ob_no']
                        );
                        QueueClient::push('sendStoreMsg', $param);
                    }
                }
            }
        }
    }
開發者ID:noikiy,項目名稱:ejia,代碼行數:57,代碼來源:month.php

示例14: updateOp

 /**
  * 購物車更新商品數量
  */
 public function updateOp()
 {
     $cart_id = intval(abs($_GET['cart_id']));
     $quantity = intval(abs($_GET['quantity']));
     if (empty($cart_id) || empty($quantity)) {
         exit(json_encode(array('msg' => Language::get('cart_update_buy_fail', 'UTF-8'))));
     }
     $model_cart = Model('cart');
     $model_goods = Model('goods');
     $logic_buy_1 = logic('buy_1');
     //存放返回信息
     $return = array();
     $cart_info = $model_cart->getCartInfo(array('cart_id' => $cart_id, 'buyer_id' => $_SESSION['member_id']));
     if ($cart_info['bl_id'] == '0') {
         //普通商品
         $goods_id = intval($cart_info['goods_id']);
         $goods_info = $logic_buy_1->getGoodsOnlineInfo($goods_id, $quantity);
         if (empty($goods_info)) {
             $return['state'] = 'invalid';
             $return['msg'] = '商品已被下架';
             $return['subtotal'] = 0;
             QueueClient::push('delCart', array('buyer_id' => $_SESSION['member_id'], 'cart_ids' => array($cart_id)));
             exit(json_encode($return));
         }
         //搶購
         $logic_buy_1->getGroupbuyInfo($goods_info);
         //限時折扣
         $logic_buy_1->getXianshiInfo($goods_info, $quantity);
         $quantity = $goods_info['goods_num'];
         if (intval($goods_info['goods_storage']) < $quantity) {
             $return['state'] = 'shortage';
             $return['msg'] = '庫存不足';
             $return['goods_num'] = $goods_info['goods_num'];
             $return['goods_price'] = $goods_info['goods_price'];
             $return['subtotal'] = $goods_info['goods_price'] * $quantity;
             $model_cart->editCart(array('goods_num' => $goods_info['goods_storage']), array('cart_id' => $cart_id, 'buyer_id' => $_SESSION['member_id']));
             exit(json_encode($return));
         }
     } else {
         //優惠套裝商品
         $model_bl = Model('p_bundling');
         $bl_goods_list = $model_bl->getBundlingGoodsList(array('bl_id' => $cart_info['bl_id']));
         $goods_id_array = array();
         foreach ($bl_goods_list as $goods) {
             $goods_id_array[] = $goods['goods_id'];
         }
         $goods_list = $model_goods->getGoodsOnlineListAndPromotionByIdArray($goods_id_array);
         //如果其中有商品下架,刪除
         if (count($goods_list) != count($goods_id_array)) {
             $return['state'] = 'invalid';
             $return['msg'] = '該優惠套裝已經無效,建議您購買單個商品';
             $return['subtotal'] = 0;
             QueueClient::push('delCart', array('buyer_id' => $_SESSION['member_id'], 'cart_ids' => array($cart_id)));
             exit(json_encode($return));
         }
         //如果有商品庫存不足,更新購買數量到目前最大庫存
         foreach ($goods_list as $goods_info) {
             if ($quantity > $goods_info['goods_storage']) {
                 $return['state'] = 'shortage';
                 $return['msg'] = '該優惠套裝部分商品庫存不足,建議您降低購買數量或購買庫存足夠的單個商品';
                 $return['goods_num'] = $goods_info['goods_storage'];
                 $return['goods_price'] = $cart_info['goods_price'];
                 $return['subtotal'] = $cart_info['goods_price'] * $quantity;
                 $model_cart->editCart(array('goods_num' => $goods_info['goods_storage']), array('cart_id' => $cart_id, 'buyer_id' => $_SESSION['member_id']));
                 exit(json_encode($return));
                 break;
             }
         }
         $goods_info['goods_price'] = $cart_info['goods_price'];
     }
     $data = array();
     $data['goods_num'] = $quantity;
     $data['goods_price'] = $goods_info['goods_price'];
     $update = $model_cart->editCart($data, array('cart_id' => $cart_id, 'buyer_id' => $_SESSION['member_id']));
     if ($update) {
         $return = array();
         $return['state'] = 'true';
         $return['subtotal'] = $goods_info['goods_price'] * $quantity;
         $return['goods_price'] = $goods_info['goods_price'];
         $return['goods_num'] = $quantity;
     } else {
         $return = array('msg' => Language::get('cart_update_buy_fail', 'UTF-8'));
     }
     exit(json_encode($return));
 }
開發者ID:xuxuecheng,項目名稱:shopnc,代碼行數:88,代碼來源:cart.php

示例15: buyStep2


//.........這裏部分代碼省略.........
         }
         //取得商品最新在售信息
         $goods_info = $model_cart->getGoodsOnlineInfo($goods_id, $quantity);
         if (empty($goods_info)) {
             return array('error' => '商品不存在');
         }
         //判斷是不是正在搶購中,如果是則按搶購價格計算,購買數量若超過搶購規定的上限,則按搶購上限計算
         $goods_info = $model_cart->getGroupbuyInfo($goods_info);
         //如果未進行搶購,則再判斷是否限時折扣中
         if (!$goods_info['ifgroupbuy']) {
             $goods_info = $model_cart->getXianshiInfo($goods_info, $quantity);
         } else {
             //這裏記錄一下搶購數量,訂單完成後需要更新一下搶購表信息
             $groupbuy_info = array();
             $groupbuy_info['groupbuy_id'] = $goods_info['groupbuy_id'];
             $groupbuy_info['quantity'] = $quantity;
         }
         //轉成多維數組,方便統一使用購物車方法與模板
         $store_cart_list = array();
         $goods_list = array();
         $goods_list[0] = $store_cart_list[$goods_info['store_id']][0] = $goods_info;
     }
     //商品金額計算(分別對每個商品/優惠套裝小計、每個店鋪小計)
     list($store_cart_list, $store_goods_total) = $model_cart->calcCartList($store_cart_list);
     //取得店鋪優惠 - 滿即送(贈品列表,店鋪滿送規則列表)
     list($store_premiums_list, $store_mansong_rule_list) = $model_cart->getMansongRuleCartListByTotal($store_goods_total);
     //重新計算店鋪扣除滿即送後商品實際支付金額
     $store_final_goods_total = $model_cart->reCalcGoodsTotal($store_goods_total, $store_mansong_rule_list, 'mansong');
     //得到有效的代金券
     $input_voucher_list = $model_cart->reParseVoucherList($input_voucher_list, $store_goods_total, $member_id);
     //重新計算店鋪扣除優惠券送商品實際支付金額
     $store_final_goods_total = $model_cart->reCalcGoodsTotal($store_final_goods_total, $input_voucher_list, 'voucher');
     //計算每個店鋪(所有店鋪級優惠活動)總共優惠多少
     $store_promotion_total = $this->getStorePromotionTotal($store_goods_total, $store_final_goods_total);
     //計算每個店鋪運費
     list($need_calc_sid_list, $cancel_calc_sid_list) = $this->getStoreFreightDescList($store_final_goods_total);
     $freight_list = $this->getStoreFreightList($goods_list, array_keys($cancel_calc_sid_list));
     $store_freight_total = $this->calcStoreFreight($freight_list, $input_city_id);
     //計算店鋪最終訂單實際支付金額(加上運費)
     $store_final_order_total = $model_cart->reCalcGoodsTotal($store_final_goods_total, $store_freight_total, 'freight');
     //計算店鋪分類傭金
     $store_gc_id_commis_rate_list = $this->getStoreGcidCommisRateList($goods_list);
     //將贈品追加到購買列表(如果庫存不足,則不送贈品)
     $append_premiums_to_cart_list = $this->appendPremiumsToCartList($store_cart_list, $store_premiums_list, $store_mansong_rule_list, $member_id);
     if (!empty($append_premiums_to_cart_list['error'])) {
         return array('error' => $append_premiums_to_cart_list['error']);
     } else {
         list($store_cart_list, $goods_buy_quantity, $store_mansong_rule_list) = $append_premiums_to_cart_list;
     }
     //整理已經得出的固定數據,準備下單
     $input = array();
     $input['pay_name'] = $input_pay_name;
     $input['if_offpay'] = $input_if_offpay;
     $input['if_vat'] = $input_if_vat;
     $input['pay_message'] = $post['pay_message'];
     $input['address_info'] = $input_address_info;
     $input['invoice_info'] = $input_invoice_info;
     $input['voucher_list'] = $input_voucher_list;
     $input['store_goods_total'] = $store_goods_total;
     $input['store_final_order_total'] = $store_final_order_total;
     $input['store_freight_total'] = $store_freight_total;
     $input['store_promotion_total'] = $store_promotion_total;
     $input['store_gc_id_commis_rate_list'] = $store_gc_id_commis_rate_list;
     $input['store_mansong_rule_list'] = $store_mansong_rule_list;
     $input['store_cart_list'] = $store_cart_list;
     try {
         //開始事務
         $model_cart->beginTransaction();
         //生成訂單
         list($pay_sn, $order_list) = $this->createOrder($input, $member_id, $member_name, $member_email);
         //記錄訂單日誌
         $this->addOrderLog($order_list);
         //變更庫存和銷量
         $this->updateGoodsStorageNum($goods_buy_quantity);
         //使用預存款支付
         $this->pdPay($order_list, $post, $member_id, $member_name);
         //提交事務
         $model_cart->commit();
     } catch (Exception $e) {
         //回滾事務
         $model_cart->rollback();
         return array('error' => $e->getMessage());
     }
     //更新使用的代金券狀態
     if (!empty($input_voucher_list) && is_array($input_voucher_list)) {
         QueueClient::push('editVoucherState', $input_voucher_list);
     }
     //更新搶購購買人數和數量
     if (!empty($groupbuy_info) && is_array($groupbuy_info)) {
         QueueClient::push('editGroupbuySaleCount', $groupbuy_info);
     }
     //更新收貨人所在省份
     QueueClient::push('editReciverProid', array('order_ids' => array_keys($order_list), 'area_id' => $input_city_id));
     //刪除購物車中的商品
     if ($post['ifcart']) {
         $model_cart->delCart('db', array('buyer_id' => $member_id, 'cart_id' => array('in', array_keys($input_buy_items))));
         //             QueueClient::push('delCart', array('buyer_id'=>$member_id,'cart_ids'=>array_keys($input_buy_items)));
     }
     return array('pay_sn' => $pay_sn);
 }
開發者ID:noikiy,項目名稱:cunkou,代碼行數:101,代碼來源:buy.model.php


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