Example #1
0
 private function logEvent($event)
 {
     $evenId = $event['event'] ? $this->findOrCreate(array('name' => $event['event']), array('name')) : null;
     $classId = $this->getObject($event['object']) ? $this->systemClassRepository->findOrCreate(array('name' => $this->getObject($event['object'])), array('name')) : null;
     if ($evenId) {
         $this->eventLogRepository->create(array('log_id' => $this->logRepository->getCurrentLogId(), 'event_id' => $evenId, 'class_id' => $classId));
     }
 }
Example #2
0
 private function logEvent($event)
 {
     file_put_contents('/tmp/event.txt', $this->eventStorage->isOn() ? 'on' : 'off' . ' - event = ' . $event['event'] . ' -- object = ' . $this->getObject($event['object']) . "\n", FILE_APPEND);
     $evenId = $event['event'] ? $this->findOrCreate(array('name' => $event['event']), array('name')) : null;
     $classId = $this->getObject($event['object']) ? $this->systemClassRepository->findOrCreate(array('name' => $this->getObject($event['object'])), array('name')) : null;
     if ($evenId) {
         $this->eventLogRepository->create(array('log_id' => $this->logRepository->getCurrentLogId(), 'event_id' => $evenId, 'class_id' => $classId));
     }
 }
Example #3
0
 private function showInfo()
 {
     /*底部其他信息,侧边栏显示*/
     $info_id = intval($this->_input['info_id']);
     if ($info_id == 0) {
         header("Location:?info_id=1");
         exit;
     }
     require_once "system.class.php";
     $footer_shopnc_info = new SystemClass();
     $foot_array = $footer_shopnc_info->getSystemList();
     $this->output('foot_array', $foot_array);
     $info_array = $this->obj_shopnc_info->getSystemInfo(array('shop_id' => NC_SHOP_ID, 'info_id' => intval($this->_input['info_id'])));
     $this->output('info_array', $info_array);
     $this->showpage('shopnc_info');
 }
Example #4
0
 /**
  * Get the system class id by object name.
  *
  * @param $objectName
  * @return null
  */
 private function getClassId($objectName)
 {
     return $objectName ? $this->systemClassRepository->findOrCreate(array('name' => $objectName), array('name')) : null;
 }
Example #5
0
 /**
  * 对支付返回结果的处理
  *
  */
 private function modifyParment()
 {
     if (intval($this->_input['nc_order_serial']) == 0) {
         return false;
     }
     /*订单信息*/
     $order_info = $this->obj_shop_order->getOrderInfo(array('order_serial' => "'" . trim($_GET['nc_order_serial']) . "'"));
     if (!$order_info) {
         $this->showMessage($this->_lang['shopping_order_error'], $this->_configinfo['websit']['site_url'], 1, 1000);
     }
     /*调出支付系统的相关内容*/
     $pay_type = $this->obj_module_pay->getPayInfo(array('pay_id' => intval($this->_input['shopnccode'])));
     if (file_exists("api/payarea/" . $pay_type['pay_area_directory'] . "/" . $pay_type['pay_code'] . ".php")) {
         include_once "api/payarea/" . $pay_type['pay_area_directory'] . "/" . $pay_type['pay_code'] . ".php";
         $pay_class_name = $pay_type['pay_code'] . 'PayClass';
         $out_pay_type = new $pay_class_name();
         $result = $out_pay_type->getParmentDo($order_info, $pay_type);
     }
     if (!$result) {
         include_once "order.class.php";
         $goods_order = new OrderClass();
         include_once 'goods.class.php';
         $obj_goods = new GoodsClass();
         include "system.class.php";
         $email_template = new SystemClass();
         include 'shopGoods.class.php';
         $obj_shop_goods = new ShopGoodsClass();
         include "shopsOrder.class.php";
         $goods_shop_order = new ShopsOrderClass();
         /*订单已确认*/
         $goods_order->orderState(array('action_type' => 'conf_ok', 'order_state' => 1), $order_info['order_id']);
         /*订单已支付*/
         $goods_order->orderState(array('action_type' => 'pay_ok', 'online_pay' => 1), $order_info['order_id']);
         /*以下为虚拟卡自动发货处理*/
         $order_array = $goods_order->showGoodsOrder(array('detail_order_id' => $order_info['order_id']));
         if (is_array($order_array)) {
             /*判断虚拟卡库存是否不足*/
             $if_storage = true;
             foreach ($order_array as $k => $v) {
                 /*如果虚拟卡库存足够,取出符合条件的虚拟卡信息*/
                 if ($v['goods_type'] == 2 && $v['is_send'] == '0') {
                     /*虚拟卡库存*/
                     if ($this->_configinfo['websit']['pay_receive_type'] == 1) {
                         //子店商品库存
                         $virtual_card_array = $this->obj_product->getProductInfo(array('goods_id' => $v['goods_id']), 'goods_storage');
                         $virtual_goods_storage = $virtual_card_array['goods_storage'];
                         $sale_goods_id = $v['sale_goods_id'];
                     } else {
                         //主店商品库存
                         $shop_goods_array = $this->obj_product->getProductInfo(array('goods_id' => $v['goods_id']), 'shop_goods_id');
                         $virtual_goods_storage = $obj_shop_goods->getShopVirtualCardStorage($shop_goods_array['shop_goods_id']);
                         $sale_goods_id = $shop_goods_array['shop_goods_id'];
                     }
                     if ($v['goods_count'] > $virtual_goods_storage) {
                         /*库存不足*/
                         $if_storage = false;
                     } else {
                         /*取出本次要出售的虚拟卡*/
                         $virtual_card_array = array();
                         $condition = array();
                         $condition['goods_id'] = $sale_goods_id;
                         $condition['is_sell'] = '0';
                         $virtual_card_array = $this->obj_virtual_card->getShopVirtualCardList($condition, '', array(), array(), '*', $v['goods_count']);
                         /*更新虚拟卡状态*/
                         $condition_str = '';
                         foreach ($virtual_card_array as $vv) {
                             $condition_str .= $vv['card_id'] . ',';
                         }
                         $condition_str = ' card_id in (' . trim($condition_str, ',') . ')';
                         $input_value = array();
                         $input_value['is_sell'] = '1';
                         $input_value['order_serial'] = trim($_GET['nc_order_serial']);
                         $this->obj_virtual_card->updateVirtualCardState($input_value, $condition_str);
                         /*更新订单虚拟卡商品发货状态*/
                         if ($this->_configinfo['websit']['pay_receive_type'] == 1) {
                             $goods_order->updateOrderDetailState(array('is_send' => '1'), $v['order_detail_id']);
                         } else {
                             $goods_shop_order->updateOrderDetailState(array('is_send' => '1'), $v['order_detail_id']);
                         }
                         /*更新库存*/
                         if ($this->_configinfo['websit']['pay_receive_type'] == 1) {
                             $obj_goods->modifyGoods(array('goods_storage' => 'goods_storage-' . $v['goods_count']), $sale_goods_id, 'formula');
                         } else {
                             $obj_shop_goods->modifyGoods(array('goods_storage' => 'goods_storage-' . $v['goods_count']), $sale_goods_id, 'formula');
                         }
                         /*邮件发货*/
                         if ($this->_configinfo['websit']['send_virtual_card_mail'] == '1') {
                             $order_info['goods_name'] = $v['goods_name'];
                             /*定义发货列表内容*/
                             $order_list_body = '<li>';
                             foreach ($virtual_card_array as $vv) {
                                 $order_list_body .= $this->_lang['shoping_virtual_card_number'] . $vv['card_number'];
                                 $order_list_body .= $this->_lang['shoping_virtual_card_password'] . $vv['password'];
                                 $order_list_body .= $this->_lang['shoping_virtual_card_end_time'] . $vv['end_time'];
                                 $order_list_body .= '</li>';
                             }
                             $pay_email_template = $email_template->getEmailTemplate(array('mail_template_name' => "'send_virtual_card_mail'"));
                             $pay_goods_array = array('user_name' => $order_info['receiver_name'], 'shop_name' => $this->_configinfo['websit']['site_name'], 'order_sn' => $order_info['order_serial'], 'goods_name' => $order_info['goods_name'], 'order_body' => $order_list_body, 'send_date' => date('Y-m-d', time()));
                             $email_body = Common::replaceMailContent($pay_goods_array, $pay_email_template['mail_template_body']);
                             /*发送邮件*/
                             Common::shopnc_send_mail($order_info['receiver_email'], $order_info['receiver_name'], $email_body);
                         }
                     }
                 }
             }
             //如果订单只有虚拟卡,并且库存足够,即都已发货,更新订单状态为已发货
             if ($order_info['order_type'] == 2 && $if_storage) {
                 if ($this->_configinfo['websit']['pay_receive_type'] == 1) {
                     $goods_order->orderState(array('action_type' => 'send_ok', 'order_state' => 1), $order_info['order_id']);
                 } else {
                     $goods_shop_order->orderState(array('action_type' => 'send_ok', 'order_state' => 1), $order_info['order_id']);
                 }
             }
         }
         /*订单显示页面*/
         /*订单产品*/
         $order_goods = $goods_order->showGoodsOrder(array('detail_order_id' => $order_info['order_id']));
         $this->output('order_goods', $order_goods);
         /*订单信息*/
         $order_array = $goods_order->getOrderList(array('order_id' => $order_info['order_id']), '');
         /*虚拟卡信息*/
         if ($this->_configinfo['websit']['pay_receive_type'] == 1) {
             $virtual_card_array = $this->obj_virtual_card->getVirtualCardList(array('order_serial' => $order_array[0]['order_serial']), '', array('goods_id'));
         } else {
             $virtual_card_array = $this->obj_virtual_card->getShopVirtualCardList(array('order_serial' => $order_array[0]['order_serial']), '', array('goods_id'));
         }
         $this->output('virtual_card_array', $virtual_card_array);
         $this->getlang("user_center_my_order_view");
         $order_state[1] = $this->_lang['my_order_be_confirmed'];
         //已确定
         $order_state[0] = "<font color='red'>" . $this->_lang['my_order_unconfirmed'] . "</font>";
         //未确定
         $order_state1[1] = $this->_lang['my_order_have_paid'];
         //已付款
         $order_state1[0] = "<font color='red'>" . $this->_lang['my_order_not_paid'] . "</font>";
         //未付款
         $order_state2[1] = $this->_lang['my_order_yes_send'];
         //已发货
         $order_state2[0] = "<font color='red'>" . $this->_lang['my_order_no_send'] . "</font>";
         //未发货
         $order_state3[1] = $this->_lang['my_order_already_filled'];
         //已归档
         $order_state3[0] = "<font color='red'>" . $this->_lang['my_order_no_fill'] . "</font>";
         //为归档
         $order_array[0]['order_state_txt'] = $order_state[$order_array[0]['order_state']];
         $order_array[0]['order_state1_txt'] = $order_state1[$order_array[0]['order_state1']];
         $order_array[0]['order_state2_txt'] = $order_state2[$order_array[0]['order_state2']];
         $order_array[0]['order_state3_txt'] = $order_state3[$order_array[0]['order_state3']];
         $this->output('order_array', $order_array[0]);
         $this->output('shopnc_pay_ok', '1');
         $this->showpage('my_order_view');
         /*发送邮件*/
         if ($this->_configinfo['websit']['pay_mail'] == '1') {
             $pay_email_template = $email_template->getEmailTemplate(array('mail_template_name' => "'pay_mail'"));
             $pay_goods_array = array('user_name' => $order_array[0]['receiver_name'], 'shop_name' => $this->_configinfo['websit']['site_name'], 'order_sn' => $order_array[0]['order_serial']);
             $email_body = Common::replaceMailContent($pay_goods_array, $pay_email_template['mail_template_body']);
             /*发送邮件*/
             Common::shopnc_send_mail($order_array[0]['receiver_email'], $order_array[0]['receiver_name'], $email_body);
         }
     }
 }