本文整理汇总了PHP中Config::getInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getInfo方法的具体用法?PHP Config::getInfo怎么用?PHP Config::getInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::getInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($site_config = null)
{
if ($site_config == null) {
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
$this->config = $site_config;
} else {
$this->config = $site_config;
}
if ($this->checkEmailConf($site_config)) {
//使用系统mail函数发送
if (isset($site_config['email_type']) && $site_config['email_type'] == '2') {
$this->smtp = new ISmtp();
} else {
//使用外部SMTP服务器发送
$server = $site_config['smtp'];
$port = $site_config['smtp_port'];
$account = $site_config['smtp_user'];
$password = $site_config['smtp_pwd'];
$this->smtp = new ISmtp($server, $port, $account, $password);
}
if (!$this->smtp) {
$this->error = '无法创建smtp类';
}
} else {
$this->error = '配置参数填写不完整';
}
}
示例2: __construct
public function __construct($site_config = null)
{
if ($site_config == null) {
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
$this->config = $site_config;
} else {
$this->config = $site_config;
}
if ($this->checkEmailConf($site_config)) {
$phpMailerDir = IWEB_PATH . 'core/util/phpmailer/PHPMailerAutoload.php';
include_once $phpMailerDir;
//创建实例
$this->smtp = new PHPMailer();
$this->smtp->Timeout = 60;
$this->smtp->SMTPSecure = $site_config['email_safe'];
$this->smtp->isHTML();
//使用系统mail函数发送
if (isset($site_config['email_type']) && $site_config['email_type'] == '2') {
$this->smtp->isMail();
} else {
$this->smtp->isSMTP();
$this->smtp->SMTPAuth = true;
$this->smtp->Host = $site_config['smtp'];
$this->smtp->Port = $site_config['smtp_port'];
$this->smtp->Username = $site_config['smtp_user'];
$this->smtp->Password = $site_config['smtp_pwd'];
}
} else {
$this->error = '配置参数填写不完整';
}
}
示例3: index
function index()
{
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
$index_slide = isset($site_config['index_slide']) ? unserialize($site_config['index_slide']) : array();
$this->index_slide = $index_slide;
$this->redirect('index');
}
示例4: init
function init()
{
$this->tablePre = isset(IWeb::$app->config['DB']['tablePre']) ? IWeb::$app->config['DB']['tablePre'] : '';
// 获取导航配置
$guideObj = new IModel('guide');
$guide_list = $guideObj->query('', '`order`,`name`,`link`', '`order`', 'desc');
if (count($guide_list) > 0) {
$this->guide_list = $guide_list;
}
$this->sort_type_map = array('0' => "{$this->tablePre}goods.sort ASC", '1' => "{$this->tablePre}goods.volume DESC", '2' => "{$this->tablePre}goods.discount ASC");
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
$this->site_config = $site_config;
}
示例5: array
//.........这里部分代码省略.........
$seller_id = 0;
if ($gid) {
$goodsObj = new IModel("goods");
$sell = $goodsObj->getObj("id = " . $gid, 'seller_id');
if ($sell['seller_id'] > 0) {
$seller_id = $sell['seller_id'];
}
}
//最终订单金额计算
$orderData = $countSumObj->countOrderFee($goodsResult['sum'], $goodsResult['final_sum'], $goodsResult['weight'], $province, $delivery_id, $payment, $goodsResult['freeFreight'], $insured, $taxes);
//生成的订单数据
$dataArray = array('order_no' => $order_no, 'user_id' => $user_id, 'accept_name' => $accept_name, 'pay_type' => $payment, 'distribution' => $delivery_id, 'postcode' => $zip, 'telphone' => $telphone, 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $address, 'mobile' => $mobile, 'create_time' => ITime::getDateTime(), 'postscript' => $order_message, 'accept_time' => $accept_time, 'exp' => $goodsResult['exp'], 'point' => $goodsResult['point'], 'type' => $order_type, 'prop' => isset($dataArray['prop']) ? $dataArray['prop'] : null, 'payable_amount' => $goodsResult['sum'], 'real_amount' => $goodsResult['final_sum'], 'payable_freight' => $orderData['deliveryOrigPrice'], 'real_freight' => $orderData['deliveryPrice'], 'pay_fee' => $orderData['paymentPrice'], 'invoice' => $taxes ? 1 : 0, 'invoice_title' => $tax_title, 'taxes' => $taxes, 'promotions' => $goodsResult['proReduce'] + $goodsResult['reduce'] + (isset($ticketRow['value']) ? $ticketRow['value'] : 0), 'order_amount' => $orderData['orderAmountPrice'] - (isset($ticketRow['value']) ? $ticketRow['value'] : 0), 'if_insured' => $insured ? 1 : 0, 'insured' => $insured, 'takeself' => $takeself, 'active_id' => $active_id, 'seller_id' => $seller_id, 'address_id' => implode(',', $address_arr));
$dataArray['order_amount'] = $dataArray['order_amount'] <= 0 ? 0 : $dataArray['order_amount'];
if ($seller_id) {
$sellerObj = new IModel('seller');
$seller = $sellerObj->getObj("id = '{$seller_id}'");
if ($seller) {
//商家的预存款不足以扣除订单总价的1.2%
$nedd = floatval($dataArray['order_amount'] * (1.2 * 0.01));
if ($seller['balance'] <= 0 || $seller['balance'] < $nedd) {
IError::show(403, '商家预存款不足,不能进行购买');
exit;
}
}
}
$orderObj = new IModel('order');
$orderObj->setData($dataArray);
$this->order_id = $orderObj->add();
if ($this->order_id == false) {
IError::show(403, '订单生成错误');
}
/*将订单中的商品插入到order_goods表*/
$orderInstance = new Order_Class();
$orderInstance->insertOrderGoods($this->order_id, $goodsResult);
//记录用户默认习惯的数据
if (!isset($memberRow['custom'])) {
$memberObj = new IModel('member');
$memberRow = $memberObj->getObj('user_id = ' . $user_id, 'custom');
}
$memberData = array('custom' => serialize(array('payment' => $payment, 'delivery' => $delivery_id, 'takeself' => $takeself)));
$memberObj->setData($memberData);
$memberObj->update('user_id = ' . $user_id);
//收货地址的处理
/* if($user_id)
{
$addressObj = new IModel('address');
//如果用户之前没有收货地址,那么会自动记录此次的地址信息并且为默认
$addressRow = $addressObj->getObj('user_id = '.$user_id);
if(empty($addressRow))
{
$addressData = array('default'=>'1','user_id'=>$user_id,'accept_name'=>$accept_name,'province'=>$province,'city'=>$city,'area'=>$area,'address'=>$address,'zip'=>$zip,'telphone'=>$telphone,'mobile'=>$mobile);
$addressObj->setData($addressData);
$addressObj->add();
}
else
{
//如果用户有收货地址,但是没有设置默认项,那么会自动设置此次地址信息为默认
$radio_address = intval(IReq::get('radio_address'));
if($radio_address != 0)
{
$addressDefRow = $addressObj->getObj('user_id = '.$user_id.' and `default` = 1');
if(empty($addressDefRow))
{
$addressData = array('default' => 1);
$addressObj->setData($addressData);
$addressObj->update('user_id = '.$user_id.' and id = '.$radio_address);
}
}
}
} */
//获取备货时间
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
$this->stockup_time = isset($site_config['stockup_time']) ? $site_config['stockup_time'] : 2;
//数据渲染
$this->order_num = $dataArray['order_no'];
$this->final_sum = $dataArray['order_amount'];
$this->payment = $paymentName;
$this->paymentType = $paymentType;
$this->delivery = $deliveryRow['name'];
$this->tax_title = $tax_title;
$this->deliveryType = $deliveryRow['type'];
//订单金额为0时,订单自动完成
if ($this->final_sum <= 0) {
$order_id = Order_Class::updateOrderStatus($dataArray['order_no']);
if ($order_id) {
if ($user_id) {
$this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货") . '/?callback=ucenter/order_detail/id/' . $order_id);
} else {
$this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货"));
}
} else {
IError::show(403, '订单修改失败');
}
} else {
$this->setRenderData($dataArray);
$this->redirect('cart3');
}
}
示例6: merge_template
public function merge_template()
{
$this->layout = 'print';
$order_id = IFilter::act(IReq::get('id'), 'int');
$seller_id = IFilter::act(IReq::get('seller_id'), 'int');
$tb_order = new IModel('order');
$data = $tb_order->getObj('id=' . $order_id);
if ($seller_id) {
$sellerObj = new IModel('seller');
$config_info = $sellerObj->getObj('id = ' . $seller_id);
$data['set']['name'] = isset($config_info['true_name']) ? $config_info['true_name'] : '';
$data['set']['phone'] = isset($config_info['phone']) ? $config_info['phone'] : '';
$data['set']['email'] = isset($config_info['email']) ? $config_info['email'] : '';
$data['set']['url'] = isset($config_info['home_url']) ? $config_info['home_url'] : '';
} else {
$config = new Config("site_config");
$config_info = $config->getInfo();
$data['set']['name'] = isset($config_info['name']) ? $config_info['name'] : '';
$data['set']['phone'] = isset($config_info['phone']) ? $config_info['phone'] : '';
$data['set']['email'] = isset($config_info['email']) ? $config_info['email'] : '';
$data['set']['url'] = isset($config_info['url']) ? $config_info['url'] : '';
}
//获取地区
$data['address'] = join(' ', area::name($data['province'], $data['city'], $data['area'])) . " " . $data['address'];
$data['seller_id'] = $seller_id;
$this->setRenderData($data);
$this->redirect("merge_template");
}
示例7: getGoodsTax
/**
* 获取商品的税金
* @param $goodsSum float 商品总价格
* @param $seller_id int 商家ID
* @return $goodsTaxPrice float 商品的税金
*/
public static function getGoodsTax($goodsSum, $seller_id = 0)
{
if ($seller_id) {
$sellerDB = new IModel('seller');
$sellerRow = $sellerDB->getObj('id = ' . $seller_id);
$tax_per = $sellerRow['tax'];
} else {
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
$tax_per = isset($site_config['tax']) ? $site_config['tax'] : 0;
}
$goodsTaxPrice = $goodsSum * ($tax_per * 0.01);
return round($goodsTaxPrice, 2);
}
示例8: getPaymentInfo
/**
* @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
* @param $payment_id int 支付方式ID
* @param $type string 信息获取方式 order:订单支付;recharge:在线充值;
* @param $argument mix 参数
* @return array 支付提交信息
*/
public static function getPaymentInfo($payment_id, $type, $argument)
{
//最终返回值
$payment = array();
//初始化配置参数
$paymentInstance = Payment::createPaymentInstance($payment_id);
$configParam = $paymentInstance->configParam();
foreach ($configParam as $key => $val) {
$payment[$key] = '';
}
//获取公共信息
$paymentRow = self::getPaymentById($payment_id, 'config_param');
if ($paymentRow) {
$paymentRow = JSON::decode($paymentRow);
foreach ($paymentRow as $key => $item) {
$payment[$key] = $item;
}
}
if ($type == 'order') {
$orderIdArray = $argument;
$M_Amount = 0;
$M_OrderNO = array();
foreach ($orderIdArray as $key => $order_id) {
//获取订单信息
$orderObj = new IModel('order');
$orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
if (empty($orderRow)) {
IError::show(403, '订单信息不正确,不能进行支付');
}
//判断商品库存
$orderGoodsDB = new IModel('order_goods');
$orderGoodsList = $orderGoodsDB->query('order_id = ' . $order_id);
foreach ($orderGoodsList as $key => $val) {
if (!goods_class::checkStore($val['goods_nums'], $val['goods_id'], $val['product_id'])) {
IError::show(403, '商品库存不足无法支付,请重新下单');
}
}
$M_Amount += $orderRow['order_amount'];
$M_OrderNO[] = $orderRow['order_no'];
}
$payment['M_Remark'] = $orderRow['postscript'];
$payment['M_OrderId'] = $orderRow['id'];
$payment['M_OrderNO'] = $orderRow['order_no'];
$payment['M_Amount'] = $M_Amount;
//用户信息
$payment['P_Mobile'] = $orderRow['mobile'];
$payment['P_Name'] = $orderRow['accept_name'];
$payment['P_PostCode'] = $orderRow['postcode'];
$payment['P_Telephone'] = $orderRow['telphone'];
$payment['P_Address'] = $orderRow['address'];
//订单批量结算缓存机制
$cacheObj = new ICache('file');
$cacheObj->set($payment['M_OrderNO'], join(",", $M_OrderNO));
} else {
if ($type == 'recharge') {
if (ISafe::get('user_id') == null) {
IError::show(403, '请登录系统');
}
if (!isset($argument['account']) || $argument['account'] <= 0) {
IError::show(403, '请填入正确的充值金额');
}
$rechargeObj = new IModel('online_recharge');
$reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
$rechargeObj->setData($reData);
$r_id = $rechargeObj->add();
//充值时用户id跟随交易号一起发送,以"_"分割
$payment['M_OrderNO'] = 'recharge' . $reData['recharge_no'];
$payment['M_OrderId'] = $r_id;
$payment['M_Amount'] = $reData['account'];
}
}
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
//交易信息
$payment['M_Time'] = time();
$payment['M_Paymentid'] = $payment_id;
//店铺信息
$payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
$payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
$payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
$payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
return $payment;
}
示例9: IModel
function merge_template()
{
$this->layout = 'print';
$order_id = IFilter::string(IReq::get('id'));
$tb_order = new IModel('order');
$order_info = $tb_order->query('id=' . $order_id);
$this->setRenderData($order_info[0]);
//获得配置文件内容
$data = array();
$config = new Config("site_config");
$config_info = $config->getInfo();
$data['set']['name'] = isset($config_info['name']) ? $config_info['name'] : '';
$data['set']['mobile'] = isset($config_info['mobile']) ? $config_info['mobile'] : '';
$data['set']['email'] = isset($config_info['email']) ? $config_info['email'] : '';
$data['set']['url'] = isset($config_info['url']) ? $config_info['url'] : '';
$tb_deliver_doc = new IQuery('delivery_doc as dd');
$tb_deliver_doc->join = 'left join delivery_goods as dg on dd.id = dg.delivery_id';
$tb_deliver_doc->fields = 'dd.name,dd.mobile,dd.telphone,dd.address,dd.postcode,dd.delivery_type';
$tb_deliver_doc->where = 'dd.order_id=' . $order_id;
$deliver_doc_info = $tb_deliver_doc->find();
if (count($deliver_doc_info) > 0) {
$data['deliver'] = $deliver_doc_info[0];
}
$this->setRenderData($data);
$this->redirect("merge_template");
}
示例10: order_detail
/**
* @brief 订单详情
* @return String
*/
public function order_detail()
{
$id = IFilter::act(IReq::get('id'), 'int');
$order = new IModel('order');
$order_info = $order->query('id = ' . $id);
if (count($order_info) == 0) {
IError::show(403, '订单信息不存在');
}
$this->order_info = $order_info[0];
//查询地区
$str_areas = '(';
$area = new IModel('areas');
$str_areas .= $this->order_info['province'] . ',' . $this->order_info['city'] . ',' . $this->order_info['area'] . ')';
$area_rows = $area->query('area_id in ' . $str_areas);
$area_tem = array();
foreach ($area_rows as $area_row) {
$area_tem[$area_row['area_id']] = $area_row['area_name'];
}
$this->area = $area_tem;
//取得支付方式
if (isset($this->order_info['pay_type']) && $this->order_info['pay_type'] == 0) {
$this->pay_type = '货到付款';
} else {
$payment = new IModel('payment');
$pay = $payment->getObj('id = ' . $this->order_info['pay_type']);
if ($pay) {
$this->pay_type = $pay['type'];
$this->pay_name = $pay['name'];
$this->pay_note = $pay['note'];
} else {
$this->pay_name = '不存在';
}
}
//物流单号
$tb_delivery_doc = new IQuery('delivery_doc as dd');
$tb_delivery_doc->fields = 'd.name,dd.delivery_code,fc.freight_name';
$tb_delivery_doc->where = 'order_id=' . $id;
$tb_delivery_doc->join = 'left join delivery as d on dd.delivery_type=d.id left join freight_company as fc on d.freight_id=fc.id';
$delivery_info = $tb_delivery_doc->find();
$this->deliver_code = '';
$this->deliver_name = '';
if ($delivery_info) {
$coun = count($delivery_info);
$this->deliver_code = $delivery_info[$coun - 1]['delivery_code'];
$this->deliver_name = $delivery_info[$coun - 1]['name'];
}
//快递跟踪是否开启
$config = new Config("site_config");
$config_info = $config->getInfo();
$this->is_open = isset($config_info['express_open']) ? $config_info['express_open'] : '';
$this->redirect('order_detail', false);
}
示例11: getPaymentInfo
/**
* @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
* @param $payment_id int 支付方式ID
* @param $type string 信息获取方式 order:订单支付;recharge:在线充值;
* @param $argument mix 参数
* @return array 支付提交信息
*/
public static function getPaymentInfo($payment_id, $type, $argument)
{
//最终返回值
$payment = array();
//获取公共信息
$paymentRow = self::getPaymentById($payment_id);
$payment['M_PartnerId'] = $paymentRow['partner_id'];
$payment['M_PartnerKey'] = $paymentRow['partner_key'];
if ($type == 'order') {
$order_id = $argument;
//获取订单信息
$orderObj = new IModel('order');
$orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
if (empty($orderRow)) {
IError::show(403, '订单信息不正确,不能进行支付');
}
$payment['M_Remark'] = $orderRow['postscript'];
$payment['M_OrderId'] = $orderRow['id'];
$payment['M_OrderNO'] = $orderRow['order_no'];
$payment['M_Amount'] = $orderRow['order_amount'];
//用户信息
$payment['P_Mobile'] = $orderRow['mobile'];
$payment['P_Name'] = $orderRow['accept_name'];
$payment['P_PostCode'] = $orderRow['postcode'];
$payment['P_Telephone'] = $orderRow['telphone'];
$payment['P_Address'] = $orderRow['address'];
} else {
if ($type == 'recharge') {
if (ISafe::get('user_id') == null) {
IError::show(403, '请登录系统');
}
if (!isset($argument['account']) || $argument['account'] <= 0) {
IError::show(403, '请填入正确的充值金额');
}
$rechargeObj = new IModel('online_recharge');
$reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
$rechargeObj->setData($reData);
$r_id = $rechargeObj->add();
//充值时用户id跟随交易号一起发送,以"_"分割
$payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
$payment['M_OrderId'] = $r_id;
$payment['M_Amount'] = $reData['account'];
}
}
$siteConfigObj = new Config("site_config");
$site_config = $siteConfigObj->getInfo();
//交易信息
$payment['M_Time'] = time();
$payment['M_Paymentid'] = $payment_id;
//店铺信息
$payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
$payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
$payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
$payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
return $payment;
}
示例12: express
/**
* 快递跟踪
*/
public function express()
{
//配置信息
$siteConfigObj = new Config("site_config");
$config_info = $siteConfigObj->getInfo();
$data = array();
$data['express_key'] = isset($config_info['express_key']) ? $config_info['express_key'] : '';
$data['express_open'] = isset($config_info['express_open']) ? $config_info['express_open'] : '0';
$this->setRenderData($data);
$this->redirect('express');
}
示例13: IModel
/**
* @brief 保存修改商品信息
*/
function goods_update()
{
//获得post的数据
$goods_id = IFilter::act(IReq::get('goods_id'), 'int');
$goods_name = IFilter::act(IReq::get('goods_name'));
$goods_category = IReq::get('goods_category');
$goods_model = IFilter::act(IReq::get('goods_model'), 'int');
$goods_brand = IFilter::act(IReq::get('goods_brand'), 'int');
$goods_status = IFilter::act(IReq::get('goods_status'), 'int');
$goods_notes = IFilter::act(IReq::get('goods_notes'));
$goods_from = IFilter::act(IReq::get('goods_from'));
$goods_sellernick = IFilter::act(IReq::get('goods_sellernick'));
$goods_commission = IFilter::act(IReq::get('goods_commission'), 'float');
$goods_url = IFilter::act(IReq::get('goods_url'));
$goods_img = IFilter::act(IReq::get('goods_img'));
$list_img = IFilter::act(IReq::get('list_img'));
$show_img = IFilter::act(IReq::get('small_img'));
$sell_price = IFilter::act(IReq::get('sell_price'), 'float');
$market_price = IFilter::act(IReq::get('market_price'), 'float');
$discount = IFilter::act(IReq::get('discount'), 'float');
$store_nums = IFilter::act(IReq::get('store_nums'), 'int');
$weight = IFilter::act(IReq::get('weight'), 'float');
$store_unit = IFilter::act(IReq::get('store_unit'));
$content = IFilter::act(IReq::get('content'), 'text');
$seo_keywords = IReq::get('seo_keywords');
$seo_description = IReq::get('seo_description');
$point = IFilter::act(IReq::get('point'), 'int');
$exp = IFilter::act(IReq::get('exp'), 'int');
$sort = IFilter::act(IReq::get('sort'));
$focus_photo = IFilter::act(IReq::get('focus_photo'));
$goods_no = IFilter::act(IReq::get('goods_no'));
$keywords_for_search = IFilter::act(IReq::get('keywords_for_search'));
$tb_goods = new IModel('goods');
if (!$goods_no) {
//如用户没有输入商品货号,则默认货号
$goods_no = Block::goods_no($goods_id);
} else {
$goods_info = $tb_goods->query("goods_no='" . $goods_no . "'");
$flag = 2;
if (count($goods_info) > 0) {
if (count($goods_info) == 1) {
if ($goods_info[0]['id'] != $goods_id) {
$flag = 1;
}
} else {
$flag = 1;
}
}
if ($flag == 1) {
$type = array('gid' => $goods_id, 'admin_name' => $this->admin['admin_name'], 'admin_pwd' => $this->admin['admin_pwd']);
$goods_in_fo = $tb_goods->getObj('id=' . $goods_id);
$goods = new goods_class();
$data = $goods->edit($type, $goods_in_fo);
$this->setRenderData($data);
$this->redirect('goods_edit', false);
Util::showMessage("您输入的货号已存在!");
}
}
//标签关键词
$keywords_for_search = trim($keywords_for_search, ",");
if ($keywords_for_search) {
$keywords_for_search_array = array();
foreach (explode(",", $keywords_for_search) as $value) {
if (IString::getStrLen($value) <= 15) {
keywords::add($value, 0);
$keywords_for_search_array[] = $value;
}
}
if ($keywords_for_search_array) {
$data = array('goods_id' => $goods_id, 'keywords' => join(',', $keywords_for_search_array));
$obj_goods_keywords = new IModel("goods_keywords");
$obj_goods_keywords->setData($data);
if ($obj_goods_keywords->getObj("goods_id={$goods_id}")) {
$obj_goods_keywords->update("goods_id={$goods_id}");
} else {
$obj_goods_keywords->add();
}
}
}
//大图片
$show_img = $focus_photo;
$list_img = $focus_photo;
if ($focus_photo) {
$foot = substr($focus_photo, strpos($focus_photo, '.'));
//图片扩展名
$head = substr($focus_photo, 0, strpos($focus_photo, '.'));
//获得配置文件中的数据
$config = new Config("site_config");
$config_info = $config->getInfo();
$list_thumb_width = isset($config_info['list_thumb_width']) ? $config_info['list_thumb_width'] : 175;
$list_thumb_height = isset($config_info['list_thumb_height']) ? $config_info['list_thumb_height'] : 175;
$show_thumb_width = isset($config_info['show_thumb_width']) ? $config_info['show_thumb_width'] : 85;
$show_thumb_height = isset($config_info['show_thumb_height']) ? $config_info['show_thumb_height'] : 85;
//list
$list_img = $head . '_' . $list_thumb_width . '_' . $list_thumb_height . $foot;
//show
$show_img = $head . '_' . $show_thumb_width . '_' . $show_thumb_height . $foot;
//.........这里部分代码省略.........
示例14: substr
/**
* @brief 商品添加后图片的链接地址
*/
function goods_photo_link()
{
$img = IReq::get('img');
$img = substr($img, 1);
$foot = substr($img, strpos($img, '.'));
//图片扩展名
$head = substr($img, 0, strpos($img, '.'));
//获得配置文件中的数据
$config = new Config("site_config");
$config_info = $config->getInfo();
$list_thumb_width = isset($config_info['list_thumb_width']) ? $config_info['list_thumb_width'] : 175;
$list_thumb_height = isset($config_info['list_thumb_height']) ? $config_info['list_thumb_height'] : 175;
$show_thumb_width = isset($config_info['show_thumb_width']) ? $config_info['show_thumb_width'] : 85;
$show_thumb_height = isset($config_info['show_thumb_height']) ? $config_info['show_thumb_height'] : 85;
$data['img'] = IUrl::creatUrl() . $img;
$data['list_img'] = IUrl::creatUrl() . $head . '_' . $list_thumb_width . '_' . $list_thumb_height . $foot;
$data['small_img'] = IUrl::creatUrl() . $head . '_' . $show_thumb_width . '_' . $show_thumb_height . $foot;
$this->setRenderData($data);
$this->redirect('goods_photo_link');
}
示例15: import
/**
*导入CSV文件
* @param <文件路径> $name
* @param <文件标示> $mark
*/
function import($name, $mark)
{
$handle = fopen($name, 'r');
$goods_col = array();
$goods_col['1'] = 'name';
$goods_col['2'] = 'goods_no';
$goods_col['3'] = 'model_id';
$goods_col['4'] = 'sell_price';
$goods_col['5'] = 'market_price';
$goods_col['6'] = 'cost_price';
$goods_col['7'] = 'create_time';
$goods_col['8'] = 'store_nums';
$goods_col['9'] = 'img';
$goods_col['10'] = 'is_del';
$goods_col['11'] = 'content';
$goods_col['12'] = 'keywords';
$goods_col['13'] = 'description';
$goods_col['14'] = 'tag_ids';
$goods_col['15'] = 'weight';
$goods_col['16'] = 'point';
$goods_col['17'] = 'unit';
$goods_col['18'] = 'brand_id';
$goods_col['19'] = 'visit';
$goods_col['20'] = 'favorite';
$goods_col['21'] = 'sort';
$goods_col['22'] = 'list_img';
$goods_col['23'] = 'small_img';
$goods_col['24'] = 'spec_array';
$goods_col['25'] = 'exp';
$gid = '';
$products_id = '';
$total = 0;
//数据总条数
$suce = 0;
//成功的总条数
$group = array();
$product = array();
$config = new Config("site_config");
$config_info = $config->getInfo();
$list_thumb_width = isset($config_info['list_thumb_width']) ? $config_info['list_thumb_width'] : 175;
$list_thumb_height = isset($config_info['list_thumb_height']) ? $config_info['list_thumb_height'] : 175;
$show_thumb_width = isset($config_info['show_thumb_width']) ? $config_info['show_thumb_width'] : 85;
$show_thumb_height = isset($config_info['show_thumb_height']) ? $config_info['show_thumb_height'] : 85;
while ($data = fgetcsv($handle)) {
$total++;
$arr = array();
$num = count($data);
//导入goods表
for ($i = 0; $i < $num; $i++) {
if ($i == $num) {
break;
}
if ($data[0] == '*cols*') {
break;
}
if ($data[0] == 'gid') {
if ($i > 0 && $i < 26) {
$arr[$goods_col[$i]] = $this->i($data[$i]);
if ($goods_col[$i] == 'spec_array' || $goods_col[$i] == 'content') {
$arr[$goods_col[$i]] = addslashes($arr[$goods_col[$i]]);
}
}
if ($i == 26) {
$goods_no = $data[2];
$obj_goods = new IQuery('goods');
$obj_goods->fields = 'id';
$obj_goods->where = "goods_no='{$goods_no}'";
$goods_info = $obj_goods->find();
if (file_exists($arr['img'])) {
$arr['list_img'] = IImage::thumb($arr['img'], $list_thumb_width, $list_thumb_height, '_' . $list_thumb_width . '_' . $list_thumb_height);
$arr['small_img'] = IImage::thumb($arr['img'], $show_thumb_width, $show_thumb_height, '_' . $show_thumb_width . '_' . $show_thumb_height);
}
if (count($goods_info) == 0 || empty($goods_no)) {
$tb_goods = new IModel('goods');
$tb_goods->setData($arr);
$gid = $tb_goods->add();
$suce++;
//如果新添加的,则处理图片
} else {
if ($mark == 1) {
//生成新的商品
$tb_goods = new IModel('goods');
$tb_goods->setData($arr);
$gid = $tb_goods->update('id=' . $goods_info[0]['id']);
$suce++;
} else {
$tb_goods = new IModel('goods');
$tb_goods->setData($arr);
$gid = $tb_goods->add();
$suce++;
//如果新添加的,则处理图片
}
}
}
//保存图片
//.........这里部分代码省略.........