當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config::getInfo方法代碼示例

本文整理匯總了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 = '配置參數填寫不完整';
     }
 }
開發者ID:Wen1750686723,項目名稱:utao,代碼行數:28,代碼來源:sendmail.php

示例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 = '配置參數填寫不完整';
     }
 }
開發者ID:zhendeguoke1008,項目名稱:shop,代碼行數:32,代碼來源:sendmail.php

示例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');
 }
開發者ID:xzdesk,項目名稱:iwebshop.com,代碼行數:8,代碼來源:site.php

示例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;
 }
開發者ID:Wen1750686723,項目名稱:utao,代碼行數:14,代碼來源:frontend.php

示例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');
     }
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:101,代碼來源:simple+-6-29.php

示例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('&nbsp;', area::name($data['province'], $data['city'], $data['area'])) . "&nbsp;" . $data['address'];
     $data['seller_id'] = $seller_id;
     $this->setRenderData($data);
     $this->redirect("merge_template");
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:28,代碼來源:order+-+2015-9-19.php

示例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);
 }
開發者ID:xzdesk,項目名稱:iwebshop.com,代碼行數:20,代碼來源:countsum.php

示例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;
 }
開發者ID:xzdesk,項目名稱:iwebshop.com,代碼行數:90,代碼來源:payment.php

示例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");
 }
開發者ID:chenyongze,項目名稱:iwebshop,代碼行數:26,代碼來源:order.php

示例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);
 }
開發者ID:chenyongze,項目名稱:iwebshop,代碼行數:56,代碼來源:ucenter.php

示例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;
 }
開發者ID:zhendeguoke1008,項目名稱:shop,代碼行數:63,代碼來源:payment.php

示例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');
 }
開發者ID:chenyongze,項目名稱:iwebshop,代碼行數:14,代碼來源:system.php

示例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;
//.........這裏部分代碼省略.........
開發者ID:Wen1750686723,項目名稱:utao,代碼行數:101,代碼來源:goods.php

示例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');
 }
開發者ID:Wen1750686723,項目名稱:utao,代碼行數:23,代碼來源:block.php

示例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++;
                             //如果新添加的,則處理圖片
                         }
                     }
                 }
                 //保存圖片
//.........這裏部分代碼省略.........
開發者ID:Wen1750686723,項目名稱:utao,代碼行數:101,代碼來源:goods_csv.php


注:本文中的Config::getInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。