예제 #1
0
 public static function del_one_order($order_id)
 {
     include_once ROOT_PATH . 'includes/lib_transaction.php';
     include_once ROOT_PATH . 'includes/lib_common.php';
     global $db;
     global $ecs;
     $user_id = $_SESSION['user_id'];
     //只有没有确认的订单才可以取消
     //$current_order = $db->getRow("select order_status,pay_status from ecs_order_info where user_id = '$user_id' and order_id = '$order_id'");
     $current_order = $db->getRow("select order_status,pay_status,bonus,surplus,bonus_id,order_sn from ecs_order_info where user_id = '{$user_id}' and order_id = '{$order_id}'");
     if ($current_order['order_status'] == OS_UNCONFIRMED && $current_order['pay_status'] != PS_PAYED) {
         $sql = "update ecs_order_info set order_status =" . OS_CANCELED . " where user_id = '{$user_id}' and order_id = '{$order_id}'";
         $orders = $db->query($sql);
         if ($orders) {
             $change_desc = "订单号:" . $current_order['order_sn'];
             //取消礼金卡支付的订单记录礼金卡账户变动
             if ($current_order['surplus'] > 0) {
                 log_mcard_change($user_id, $current_order['surplus'], $change_desc, 0, $order_id, 3);
             } else {
                 if ($current_order['bonus'] > 0) {
                     unuse_bonus(trim($current_order['bonus_id']));
                 } else {
                     log_account_change($user_id, 0, 0, 0, 0, $change_desc);
                 }
             }
         }
         return json_encode(array('code' => RES_SUCCSEE));
     } else {
         return json_encode(array('code' => RES_FAIL));
     }
 }
예제 #2
0
파일: flow.php 프로젝트: songtaiwu/m-cmsold
     $sender->sendOrder();
     $ordertime = $order['add_time'] + 8 * 3600;
     $sql = "INSERT INTO cps ( " . "order_id,src,channel,cid,wi,order_time)" . " values('{$new_order_id}','emar','cps'," . $arr[2] . ",'" . $arr[3] . "','" . $ordertime . "') ";
     $db->query($sql);
 }
 /* 修改拍卖活动状态 
     if ($order['extension_code']=='auction')
     {
         $sql = "UPDATE ". $ecs->table('goods_activity') ." SET is_finished='2' WHERE act_id=".$order['extension_id'];
         $db->query($sql);
     }
 	*/
 /* 处理余额、积分、红包 */
 if ($order['user_id'] > 0 && $order['surplus'] > 0) {
     //log_account_change($order['user_id'], $order['surplus'] * (-1), 0, 0, 0, sprintf($_LANG['pay_order'], $order['order_sn']));
     log_mcard_change($order['user_id'], $order['surplus'] * -1, sprintf($_LANG['pay_order'], $order['order_sn']), 0, $order['order_id'], 1);
 }
 if ($order['user_id'] > 0 && $order['integral'] > 0) {
     log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * -1, sprintf($_LANG['pay_order'], $order['order_sn']));
 }
 if ($order['bonus_id'] > 0 && $temp_amout > 0) {
     use_bonus($order['bonus_id'], $new_order_id);
 }
 /* 如果使用库存,且下订单时减库存,则减少库存 */
 if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) {
     change_order_goods_storage($order['order_id'], true, SDT_PLACE);
 }
 /* 如果订单金额为0 处理虚拟卡 */
 if ($order['order_amount'] <= 0) {
     $sql = "SELECT goods_id, goods_name, goods_number AS num FROM " . $GLOBALS['ecs']->table('cart') . " WHERE is_real = 0 AND extension_code = 'virtual_card'" . " AND session_id = '" . SESS_ID . "' AND rec_type = '{$flow_type}'";
     $res = $GLOBALS['db']->getAll($sql);
예제 #3
0
                 $user_m = $change_money - 50;
             } else {
                 $user_m = $change_money;
             }
             $r = $db->query("update ecs_users set user_money=user_money+{$user_m} where user_id={$us_id}");
             if ($r) {
                 $charge_num = $db->query("update ecs_users set charge_num=2 where user_id={$us_id}");
                 $user_money = $GLOBALS['db']->getOne('SELECT user_money FROM ' . $ecs->table('users') . " WHERE user_id={$us_id}");
                 $result['user_money'] = $user_money;
                 $result['change_money'] = $change_money;
                 $result['error'] = 0;
                 $result['message'] = '操作成功';
                 die($json->encode($result));
             }
         } else {
             log_mcard_change($_SESSION['user_id'], $change_money, '储值卡:' . $card_num . '充值', 0, 0, 2);
             $user_money = $GLOBALS['db']->getOne('SELECT user_money FROM ' . $ecs->table('users') . " WHERE user_id='{$_SESSION['user_id']}'");
             $result['user_money'] = $user_money;
             $result['change_money'] = $change_money;
             $result['error'] = 0;
             $result['message'] = '操作成功';
             die($json->encode($result));
         }
     } else {
         $result['error'] = 11;
         $result['message'] = '更新储值卡状态失败,请重试';
         die($json->encode($result));
     }
 } elseif ($action == 'got_verify') {
     $mobile = !empty($_GET['mobile']) ? $_GET['mobile'] : '';
     //$oldmobile=$_GET['oldmobile'];