当前位置: 首页>>代码示例>>PHP>>正文


PHP make_semiangle函数代码示例

本文整理汇总了PHP中make_semiangle函数的典型用法代码示例。如果您正苦于以下问题:PHP make_semiangle函数的具体用法?PHP make_semiangle怎么用?PHP make_semiangle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了make_semiangle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: address

function address()
{
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'GET':
            $r_data = get_consignee_list($_SESSION['user_id']);
            return $r_data;
            break;
        case 'DELETE':
            $consignee_id = intval($_GET['id']);
            if (drop_consignee($consignee_id)) {
                $r_data = 'Delete Address Success!';
            } else {
                $r_data = 'Delete Address Failed!';
            }
            return $r_data;
            break;
        case 'POST':
            $address = array('user_id' => $_SESSION['user_id'], 'address_id' => intval($_POST['address_id']), 'country' => isset($_POST['country']) ? intval($_POST['country']) : 0, 'province' => isset($_POST['province']) ? intval($_POST['province']) : 0, 'city' => isset($_POST['city']) ? intval($_POST['city']) : 0, 'district' => isset($_POST['district']) ? intval($_POST['district']) : 0, 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'tel' => isset($_POST['tel']) ? compile_str(make_semiangle(trim($_POST['tel']))) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(make_semiangle(trim($_POST['mobile']))) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '');
            if (update_address($address)) {
                $r_data = 'Update Address Success!';
            } else {
                $r_data = 'Update Address Failed!';
            }
            return $r_data;
            break;
        default:
            return 'This API can not support ' . $_SERVER['REQUEST_METHOD'] . ' method';
            break;
    }
}
开发者ID:jiusanzhou,项目名称:ecapi,代码行数:30,代码来源:lib_controller_address.php

示例2: get_search_engine

function get_search_engine(&$keyword, $url = null)
{
    global $db;
    if (is_null($url)) {
        $url = $_SERVER['HTTP_REFERER'];
    }
    $url = urldecode($url);
    $url = make_semiangle($url);
    $parsed_url = @parse_url($url);
    if (!isset($parsed_url['host'])) {
        return false;
    }
    /*
     * if (!isset($parsed_url['query'])) { $google = 'google.co.jp'; if (stripos($url, $google) !== false) return true; else return false; }
     */
    $filter_keywords = FILTER_SEARCH_KEYWORDS;
    $filter_keywords = !empty($filter_keywords) ? explode(',', $filter_keywords) : array();
    $result = $db->Execute('SELECT `server`, `getvar` FROM `' . DB_PREFIX . 'search_engine`', false, true);
    while (!$result->EOF) {
        $host =& $result->fields['server'];
        $varname =& $result->fields['getvar'];
        if (strstr($parsed_url['host'], $host)) {
            $k = array();
            $key_string = $parsed_url['query'];
            if (empty($key_string) && isset($parsed_url['fragment']) && !empty($parsed_url['fragment'])) {
                $key_string = $parsed_url['fragment'];
            }
            preg_match('/' . $varname . '=.+\\&' . '/U', $key_string, $k);
            if (!isset($k[0]) || empty($k[0])) {
                preg_match('/' . $varname . '=.+$' . '/', $key_string, $k);
            }
            $keyword = urldecode(str_replace('+', ' ', $k[0]));
            if (strpos($keyword, '&') !== false) {
                $keyword = substr($keyword, 0, strpos($keyword, '&'));
            }
            $keyword = ltrim($keyword, $varname . '=');
            $keyword = str_ireplace('¤', '', $keyword);
            $keyword = str_ireplace('|', '', $keyword);
            $keyword = trim($keyword);
            if (empty($keyword) && stripos($parsed_url['host'], $host) !== false) {
                return true;
                // no keyword and host pass
            }
            // filter keyword
            foreach ($filter_keywords as $key) {
                if (stripos($keyword, trim($key)) !== false) {
                    return false;
                }
            }
            return true;
        }
        $result->MoveNext();
    }
    return false;
}
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:55,代码来源:functions_following.php

示例3: act_edit_address

	public function act_edit_address (){
		checkLogin();	
		include_once(RPC_ROOT . 'includes/lib_transaction_ec.php');
		$user_id = intval($_SESSION['user_id']);
		$address = array(
			'user_id'    => $user_id,
			'address_id' => intval($_GET['address_id']),
			'country'    => isset($_GET['country'])   ? intval($_GET['country'])  : 0,
			'province'   => isset($_GET['province'])  ? intval($_GET['province']) : 0,
			'city'       => isset($_GET['city'])      ? intval($_GET['city'])     : 0,
			'district'   => isset($_GET['district'])  ? intval($_GET['district']) : 0,
			'email'      => isset($_GET['email'])     ? trim($_GET['email'])      : '',
			'tel'        => isset($_GET['tel'])       ? make_semiangle(trim($_GET['tel'])) : '',
			'mobile'     => isset($_GET['mobile'])    ? make_semiangle(trim($_GET['mobile'])) : '',
			'best_time'  => isset($_GET['best_time']) ? trim($_GET['best_time'])  : '',
			'zipcode'       => isset($_GET['zipcode'])       ? make_semiangle(trim($_GET['zipcode'])) : '',
		);
		if(EC_CHARSET == 'utf-8'){
			$address['address'] = isset($_GET['address'])   ? gbktoutf8(trim($_GET['address'])) : '';
			$address['consignee'] = isset($_GET['consignee']) ? gbktoutf8(trim($_GET['consignee']))  : '';
			$address['sign_building'] = isset($_GET['sign_building']) ? gbktoutf8(trim($_GET['sign_building'])) : '';
		}else{
			$address['address'] = isset($_GET['address'])   ? utf8togbk(trim($_GET['address'])) : '';
			$address['consignee'] = isset($_GET['consignee']) ? utf8togbk(trim($_GET['consignee']))  : '';
			$address['sign_building'] = isset($_GET['sign_building']) ? utf8togbk(trim($_GET['sign_building'])) : '';
		}
		$default = isset($_GET['default']) ? trim($_GET['default'])  : false;
		
		if (update_address($address,$default))
		{
			$msg = rpcLang('user.php', 'address_update_success');
			$code = '0';
		}else
		{
			$msg = rpcLang('user.php', 'address_update_failure');
			$code = '1';
		}
		jsonExit("{\"status\":\"$msg\",\"code\":\"$code\"}");
	}
开发者ID:noikiy,项目名称:mdwp,代码行数:39,代码来源:user.action.php

示例4: ecs_header

    /* 跳转 */
    ecs_header("Location: user.php?act=order_detail&order_id=$order_id\n");
    exit;
}

/* 保存订单详情收货地址 */
elseif ($action == 'save_order_address')
{
    include_once(ROOT_PATH .'includes/lib_transaction.php');
    
    $address = array(
        'consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee']))  : '',
        'email'     => isset($_POST['email'])     ? compile_str(trim($_POST['email']))      : '',
        'address'   => isset($_POST['address'])   ? compile_str(trim($_POST['address']))    : '',
        'zipcode'   => isset($_POST['zipcode'])   ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '',
        'tel'       => isset($_POST['tel'])       ? compile_str(trim($_POST['tel']))        : '',
        'mobile'    => isset($_POST['mobile'])    ? compile_str(trim($_POST['mobile']))     : '',
        'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '',
        'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time']))  : '',
        'order_id'  => isset($_POST['order_id'])  ? intval($_POST['order_id']) : 0
        );
    if (save_order_address($address, $user_id))
    {
        ecs_header('Location: user.php?act=order_detail&order_id=' .$address['order_id']. "\n");
        exit;
    }
    else
    {
        $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list');
    }
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:30,代码来源:user.php

示例5: json_str_iconv

    /* 取得参数 */
    $id = json_str_iconv(trim($_POST['id']));
    $val = json_str_iconv(trim($_POST['val']));
    /* 更新描述 */
    $exc->edit("shipping_desc = '{$val}'", $id);
    make_json_result(stripcslashes($val));
} elseif ($_REQUEST['act'] == 'edit_insure') {
    /* 检查权限 */
    check_authz_json('ship_manage');
    /* 取得参数 */
    $id = json_str_iconv(trim($_POST['id']));
    $val = json_str_iconv(trim($_POST['val']));
    if (empty($val)) {
        $val = 0;
    } else {
        $val = make_semiangle($val);
        //全角转半角
        if (strpos($val, '%') === false) {
            $val = floatval($val);
        } else {
            $val = floatval($val) . '%';
        }
    }
    /* 检查该插件是否支持保价 */
    $set_modules = true;
    include_once ROOT_PATH . 'includes/modules/shipping/' . $id . '.php';
    if (isset($modules[0]['insure']) && $modules[0]['insure'] === false) {
        make_json_error($_LANG['not_support_insure']);
    }
    /* 更新保价费用 */
    $exc->edit("insure = '{$val}'", $id);
开发者ID:netroby,项目名称:ecshop,代码行数:31,代码来源:shipping.php

示例6: flow_update_cart

/**
 * 更新购物车中的商品数量
 *
 * @access  public
 * @param   array   $arr
 * @return  void
 */
function flow_update_cart($arr)
{
    foreach ($arr as $key => $val) {
        $val = intval(make_semiangle($val));
        if ($val <= 0) {
            continue;
        }
        $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        $goods = $GLOBALS['db']->getRow($sql);
        /* 系统启用了库存,检查输入的商品数量是否有效 */
        if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') {
            $sql = "SELECT g.goods_name, g.goods_number " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'";
            $row = $GLOBALS['db']->getRow($sql);
            if ($row['goods_number'] < $val) {
                show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], $row['goods_number'], $row['goods_number']));
                exit;
            }
        }
        /* 检查该项是否为基本件以及有没有配件存在 */
        $sql = "SELECT a.goods_number, a.rec_id FROM " . $GLOBALS['ecs']->table('cart') . " AS b " . "LEFT JOIN " . $GLOBALS['ecs']->table('cart') . " AS a " . "ON a.parent_id = b.goods_id AND a.session_id = '" . SESS_ID . "' AND a.extension_code <> 'package_buy'" . "WHERE b.rec_id = '{$key}'";
        $fittings = $GLOBALS['db']->getAll($sql);
        if ($val > 0) {
            foreach ($fittings as $k => $v) {
                if ($v['goods_number'] != null && $v['rec_id'] != null) {
                    /* 该商品有配件,更新配件的商品数量 */
                    $num = $v['goods_number'] > $val ? $val : $v['goods_number'];
                    $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$num}' WHERE rec_id = {$v['rec_id']}";
                    $GLOBALS['db']->query($sql);
                }
            }
            if ($goods['extension_code'] == 'package_buy') {
                /* 更新购物车中的商品数量 */
                $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
            } else {
                $attr_id = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']);
                $goods_price = get_final_price($goods['goods_id'], $val, true, $attr_id);
                /* 更新购物车中的商品数量 */
                $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}', goods_price = '{$goods_price}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
            }
        } else {
            if (is_object($fittings) && $fittings->goods_number != null && $fittings->rec_id != null) {
                $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id={$fittings['rec_id']}";
                $GLOBALS['db']->query($sql);
            }
            $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        }
        $GLOBALS['db']->query($sql);
    }
    /* 删除所有赠品 */
    $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0";
    $GLOBALS['db']->query($sql);
}
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:59,代码来源:flow.php

示例7: make_json_result

    make_json_result(stripcslashes($desc));
} elseif ($_REQUEST['act'] == 'edit_order') {
    /* 检查权限 */
    check_authz_json('payment');
    /* 取得参数 */
    $code = json_str_iconv(trim($_POST['id']));
    $order = intval($_POST['val']);
    /* 更新排序 */
    $exc->edit("pay_order = '{$order}'", $code);
    make_json_result(stripcslashes($order));
} elseif ($_REQUEST['act'] == 'edit_pay_fee') {
    /* 检查权限 */
    check_authz_json('payment');
    /* 取得参数 */
    $code = json_str_iconv(trim($_POST['id']));
    $pay_fee = json_str_iconv(trim($_POST['val']));
    if (empty($pay_fee)) {
        $pay_fee = 0;
    } else {
        $pay_fee = make_semiangle($pay_fee);
        //全角转半角
        if (strpos($pay_fee, '%') === false) {
            $pay_fee = floatval($pay_fee);
        } else {
            $pay_fee = floatval($pay_fee) . '%';
        }
    }
    /* 更新支付费用 */
    $exc->edit("pay_fee = '{$pay_fee}'", $code);
    make_json_result(stripcslashes($pay_fee));
}
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:payment.php

示例8: saveStudentJob

 /**
  * @Author: 段涛
  * @添加保存招聘信息
  * @function name saveStudentJob
  */
 public function saveStudentJob()
 {
     if (IS_POST) {
         $this->hotCompany();
         $company = M('business_info')->field('industry,id')->where(array('uid' => session('userID')))->find();
         $jobID = I('post.jobID');
         $data['companyName'] = $companyName = I('post.companyName');
         $data['jobName'] = $jobName = I('post.jobName');
         $data['needPeople'] = $needPeople = I('post.needPeople');
         $data['text'] = $text = $_POST['text'];
         $data['work_price'] = $workPrice = I('post.work_price');
         $data['unit'] = I('post.unit');
         $data['work_time_type'] = $workTimeType = I('post.work_time_type');
         $data['welfare'] = $welfare = I('post.welfare');
         $data['email'] = $email = I('post.email');
         $data['phone'] = $telephone = I('post.telephone');
         $data['linkman'] = $linkMan = I('post.linkman');
         $data['education'] = $education = I('post.education');
         $data['work_year'] = $workYear = I('post.work_year');
         $data['cityID'] = $city = I('post.city');
         $data['userID'] = session('userID');
         $data['natureID'] = $company['industry'];
         $data['business_infoID'] = $company['id'];
         $data['visits'] = 0;
         $data['creat_time'] = time();
         $data = make_semiangle($data);
         //数据安全校正
         if ($companyName == '' || $jobName == '' || $workPrice == '' || $email == '' || $telephone == '' || $linkMan == '' || $city == '') {
             $this->error('数据不合法!');
         }
         //todo
         //验证邮箱规则
         if (isset($jobID) && $jobID != '') {
             $data['id'] = $jobID;
             //数据安全校正
             $isOK = M('stu_job')->where(array('userID' => session('userID'), 'id' => $jobID))->find();
             if (!$isOK) {
                 $this->error('非法操作!');
             } else {
                 $status = M('stu_job')->save($data);
             }
         } else {
             $status = M('stu_job')->add($data);
         }
         if ($status) {
             $this->success('保存成功!', U('/Home/Student/manager/companyID/' . $company['id']), 1);
         } else {
             $this->error('保存失败!');
         }
     } else {
         $this->error('非法操作!');
     }
 }
开发者ID:anLl,项目名称:ybirds,代码行数:58,代码来源:StudentController.class.php

示例9: action_save_order_address

function action_save_order_address()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    $address = array('consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '', 'tel' => isset($_POST['tel']) ? compile_str(trim($_POST['tel'])) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(trim($_POST['mobile'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0);
    if (save_order_address($address, $user_id)) {
        ecs_header('Location: user.php?act=order_detail&order_id=' . $address['order_id'] . "\n");
        exit;
    } else {
        $err = $GLOBALS['err'];
        if (empty($address['order_id'])) {
            $err->show($_LANG['order_list_lnk'], 'user.php?act=order_list');
        } else {
            $err->show($_LANG['order_list_lnk'], 'user.php?act=order_detail&order_id=' . $address['order_id']);
        }
    }
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:23,代码来源:user.php

示例10: array

    if (empty($_POST['tel'])) {
        echo '<script language=javascript>alert("联系电话不可为空!");history.go(-1);</script>';
        exit;
    }
    if (empty($_POST['mobile'])) {
        echo '<script language=javascript>alert("联系手机不可为空!");history.go(-1);</script>';
        exit;
    }
    if (empty($_POST['email'])) {
        echo '<script language=javascript>alert("电子邮箱不可为空!");history.go(-1);</script>';
        exit;
    }
    /*
     * 保存收货人信息
     */
    $consignee = array('user_id' => $_SESSION['user_id'], 'address_id' => empty($_POST['address_id']) ? 0 : intval($_POST['address_id']), 'consignee' => empty($_POST['consignee']) ? '' : trim($_POST['consignee']), 'country' => empty($_POST['country']) ? '' : $_POST['country'], 'province' => empty($_POST['province']) ? '' : $_POST['province'], 'city' => empty($_POST['city']) ? '' : $_POST['city'], 'district' => empty($_POST['district']) ? '' : $_POST['district'], 'email' => empty($_POST['email']) ? '' : $_POST['email'], 'address' => empty($_POST['address']) ? '' : $_POST['address'], 'zipcode' => empty($_POST['zipcode']) ? '' : make_semiangle(trim($_POST['zipcode'])), 'tel' => empty($_POST['tel']) ? '' : make_semiangle(trim($_POST['tel'])), 'mobile' => empty($_POST['mobile']) ? '' : make_semiangle(trim($_POST['mobile'])), 'sign_building' => empty($_POST['sign_building']) ? '' : $_POST['sign_building'], 'best_time' => empty($_POST['best_time']) ? '' : $_POST['best_time']);
    $result = update_address($consignee);
    if ($result) {
        echo '<script language=javascript>alert("增加收货地址成功");location.href="user.php?act=address_list";</script>';
    } else {
        echo '<script language=javascript>alert("增加收货地址失败");history.go(-1);</script>';
    }
    if ($_SESSION['user_id'] > 0) {
        $smarty->assign('user_name', $_SESSION['user_name']);
    }
} elseif ($act == 'drop_address') {
    include_once 'includes/lib_transaction.php';
    $consignee_id = intval($_GET['id']);
    if (drop_consignee($consignee_id)) {
        ecs_header("Location: user.php?act=address_list\n");
        exit;
开发者ID:qgz,项目名称:ecshop,代码行数:31,代码来源:user.php

示例11: array

 }
 $config = array();
 foreach ($modules[0]['configure'] as $key => $val) {
     $config[$key]['name'] = $val['name'];
     $config[$key]['value'] = $_POST[$val['name']];
 }
 $count = count($config);
 $config[$count]['name'] = 'free_money';
 $config[$count]['value'] = empty($_POST['free_money']) ? '' : $_POST['free_money'];
 $count++;
 $config[$count]['name'] = 'fee_compute_mode';
 $config[$count]['value'] = empty($_POST['fee_compute_mode']) ? '' : $_POST['fee_compute_mode'];
 if ($modules[0]['cod']) {
     $count++;
     $config[$count]['name'] = 'pay_fee';
     $config[$count]['value'] = make_semiangle(empty($_POST['pay_fee']) ? '' : $_POST['pay_fee']);
 }
 $sql = "UPDATE " . $ecs->table('shipping_area') . " SET shipping_area_name='{$_POST['shipping_area_name']}', " . "configure='" . serialize($config) . "' " . "WHERE shipping_area_id='{$_POST['id']}'";
 $db->query($sql);
 admin_log($_POST['shipping_area_name'], 'edit', 'shipping_area');
 /* 过滤掉重复的region */
 $selected_regions = array();
 if (isset($_POST['regions'])) {
     foreach ($_POST['regions'] as $region_id) {
         $selected_regions[$region_id] = $region_id;
     }
 }
 // 查询所有区域 region_id => parent_id
 $sql = "SELECT region_id, parent_id FROM " . $ecs->table('region');
 $res = $db->query($sql);
 while ($row = $db->fetchRow($res)) {
开发者ID:Ryan007,项目名称:mybb,代码行数:31,代码来源:shipping_area.php

示例12: flow_update_cart

/**
 * 更新购物车中的商品数量
 *
 * @access  public
 * @param   array   $arr
 * @return  void
 */
function flow_update_cart($arr)
{
    /* 处理 */
    foreach ($arr as $key => $val) {
        $val = intval(make_semiangle($val));
        if ($val <= 0 || !is_numeric($key)) {
            continue;
        }
        //查询:
        $sql = "SELECT `goods_id`, `goods_attr_id`, `product_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        $goods = $GLOBALS['db']->getRow($sql);
        $sql = "SELECT g.goods_name, g.goods_number " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'";
        $row = $GLOBALS['db']->getRow($sql);
        //查询:系统启用了库存,检查输入的商品数量是否有效
        if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') {
            if ($row['goods_number'] < $val) {
                GZ_Api::outPut(10008);
                exit;
            }
            /* 是货品 */
            $goods['product_id'] = trim($goods['product_id']);
            if (!empty($goods['product_id'])) {
                $sql = "SELECT product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $goods['product_id'] . "'";
                $product_number = $GLOBALS['db']->getOne($sql);
                if ($product_number < $val) {
                    GZ_Api::outPut(10008);
                    exit;
                }
            }
        } elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') {
            if (judge_package_stock($goods['goods_id'], $val)) {
                GZ_Api::outPut(10008);
                exit;
            }
        }
        /* 查询:检查该项是否为基本件 以及是否存在配件 */
        /* 此处配件是指添加商品时附加的并且是设置了优惠价格的配件 此类配件都有parent_id goods_number为1 */
        $sql = "SELECT b.goods_number, b.rec_id\n                FROM " . $GLOBALS['ecs']->table('cart') . " a, " . $GLOBALS['ecs']->table('cart') . " b\n                WHERE a.rec_id = '{$key}'\n                AND a.session_id = '" . SESS_ID . "'\n                AND a.extension_code <> 'package_buy'\n                AND b.parent_id = a.goods_id\n                AND b.session_id = '" . SESS_ID . "'";
        $offers_accessories_res = $GLOBALS['db']->query($sql);
        //订货数量大于0
        if ($val > 0) {
            /* 判断是否为超出数量的优惠价格的配件 删除*/
            $row_num = 1;
            while ($offers_accessories_row = $GLOBALS['db']->fetchRow($offers_accessories_res)) {
                if ($row_num > $val) {
                    $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '" . $offers_accessories_row['rec_id'] . "' LIMIT 1";
                    $GLOBALS['db']->query($sql);
                }
                $row_num++;
            }
            /* 处理超值礼包 */
            if ($goods['extension_code'] == 'package_buy') {
                //更新购物车中的商品数量
                $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
            } else {
                $attr_id = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']);
                $goods_price = get_final_price($goods['goods_id'], $val, true, $attr_id);
                //更新购物车中的商品数量
                $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}', goods_price = '{$goods_price}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
            }
        } else {
            /* 如果是基本件并且有优惠价格的配件则删除优惠价格的配件 */
            while ($offers_accessories_row = $GLOBALS['db']->fetchRow($offers_accessories_res)) {
                $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '" . $offers_accessories_row['rec_id'] . "' LIMIT 1";
                $GLOBALS['db']->query($sql);
            }
            $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        }
        $GLOBALS['db']->query($sql);
    }
    /* 删除所有赠品 */
    $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0";
    $GLOBALS['db']->query($sql);
}
开发者ID:dx8719,项目名称:ECMobile_Universal,代码行数:81,代码来源:cart.php

示例13: reportAction

 /**
  * 举报分类信息.
  * 
  * @access public
  * @return void 
  */
 public function reportAction()
 {
     $id = (int) I('post.id', '');
     // 分类信息 ID.
     $content = (string) I('post.content', '');
     // 举报的内容.
     $other = (string) I('post.other', '');
     if (empty($content)) {
         $this->setAjaxData(Message::FAILED, '举报内容不能为空')->myAjaxReturn();
     }
     if ($id < 1) {
         $this->setAjaxData(Message::PARAM_ERROR, Message::get(Message::PARAM_ERROR))->myAjaxReturn();
     }
     // 数据库检查该信息是否有效.
     $modelCtgData = new CtgDataModel();
     $resCheck = $modelCtgData->checkInfo($id);
     if (FALSE === $resCheck) {
         $this->setAjaxData(Message::PARAM_ERROR, Message::get(Message::PARAM_ERROR))->myAjaxReturn();
     }
     unset($modelCtgData, $resCheck);
     $loginedInfo = $this->getLoginedUserInfo();
     // 登录的用户信息.
     $data = ['userID' => $loginedInfo['uid'], 'dataID' => $id, 'reportTxt' => $content . $other, 'creatTime' => time(), 'status' => 0, 'reportName' => $loginedInfo['userName'], 'checkTime' => 0, 'mailToOwner' => '', 'mailToReporter' => '', 'checkUserName' => ''];
     $data = make_semiangle($data);
     // 全角字符转半角.
     $modelReport = new ReportModel();
     // 实例化 Report 模型.
     // 检查是否已举报过.
     //		$isReported = $modelReport->checkIsReported($id, $loginedInfo['uid']);
     //		if($isReported) {
     //			$this->setAjaxData(Message::FAILED, '您已举报了该条信息!')->myAjaxReturn();
     //		}
     if ($modelReport->addInfo($data)) {
         $this->setAjaxData(Message::SUCCESS, '举报成功')->myAjaxReturn();
     }
     $this->setAjaxData(Message::FAILED, '举报失败')->myAjaxReturn();
 }
开发者ID:anLl,项目名称:ybirds,代码行数:43,代码来源:ClassifiedInfoController.class.php

示例14: addReport

 public function addReport()
 {
     if (IS_POST) {
         $yzm = I('post.yzm');
         //验证验证码
         if (check_verify($yzm) == false) {
             $this->error(L('VerificationCodeError'), $_SERVER['HTTP_REFERER'], 3);
         }
         $data['reportTxt'] = $ReportTxt = I('post.ReportTxt');
         $data['dataID'] = $dataID = I('post.dataID');
         $data['reportName'] = session('userName');
         $data['creatTime'] = time();
         $data['type'] = I('post.type', 0, 'intval');
         $data = make_semiangle($data);
         if ($ReportTxt == '' || $dataID == "") {
             $this->error(L('ContNotToDo'), U('Home/Class/index'), 3);
         }
         $report = M('Report');
         if ($report->add($data)) {
             $this->success('举报成功!', $_SERVER['HTTP_REFERER'], 1);
         } else {
             $this->error('保存失败', $_SERVER['HTTP_REFERER'], 3);
         }
     } else {
         $this->error(L('ContNotToDo'), U('Home/Class/index'), 3);
     }
 }
开发者ID:anLl,项目名称:ybirds,代码行数:27,代码来源:ClassController.class.php

示例15: format_fee

/**
 * 格式化费用:可以输入数字或百分比的地方
 *
 * @param   string      $fee    输入的费用
 */
function format_fee($fee)
{
    $fee = make_semiangle($fee);
    if (strpos($fee, '%') === false) {
        return floatval($fee);
    } else {
        return floatval($fee) . '%';
    }
}
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:14,代码来源:ecmall.php


注:本文中的make_semiangle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。