Ejemplo n.º 1
0
/**
 *  合并指定用户订单
 *
 * @access  public
 * @param   string      $from_order         合并的从订单号
 * @param   string      $to_order           合并的主订单号
 *
 * @return  boolen      $bool
 */
function merge_user_order($from_order, $to_order, $user_id = 0)
{
    if ($user_id > 0) {
        /* 检查订单是否属于指定用户 */
        if (strlen($to_order) > 0) {
            $sql = "SELECT user_id FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_sn = '{$to_order}'";
            $order_user = $GLOBALS['db']->getOne($sql);
            if ($order_user != $user_id) {
                $GLOBALS['err']->add(L('no_priv'));
            }
        } else {
            $GLOBALS['err']->add(L('order_sn_empty'));
            return false;
        }
    }
    $result = merge_order($from_order, $to_order);
    if ($result === true) {
        return true;
    } else {
        $GLOBALS['err']->add($result);
        return false;
    }
}
Ejemplo n.º 2
0
         $goods['attr_list'] = array();
         $res = $db->query($sql);
         while ($row = $db->fetchRow($res)) {
             $goods['attr_list'][$row['attr_id']][] = $row;
         }
         $goods['attr_list'] = array_values($goods['attr_list']);
         echo $json->encode($goods);
     }
 } elseif ($_REQUEST['act'] == 'ajax_merge_order') {
     /* 检查权限 */
     admin_priv('order_os_edit');
     include_once ROOT_PATH . 'includes/cls_json.php';
     $json = new JSON();
     $from_order_sn = empty($_POST['from_order_sn']) ? '' : json_str_iconv(substr($_POST['from_order_sn'], 1));
     $to_order_sn = empty($_POST['to_order_sn']) ? '' : json_str_iconv(substr($_POST['to_order_sn'], 1));
     $m_result = merge_order($from_order_sn, $to_order_sn);
     $result = array('error' => 0, 'content' => '');
     if ($m_result === true) {
         $result['message'] = $GLOBALS['_LANG']['act_ok'];
     } else {
         $result['error'] = 1;
         $result['message'] = $m_result;
     }
     die($json->encode($result));
 } elseif ($_REQUEST['act'] == 'remove_order') {
     /* 检查权限 */
     admin_priv('order_edit');
     $order_id = intval($_REQUEST['id']);
     /* 检查权限 */
     check_authz_json('order_edit');
     /* 检查订单是否允许删除操作 */