write() static public method

日志直接写入
static public write ( string $message, string $level = self::ERR, string $destination = '', integer $type = 3, string $extra = '' ) : void
$message string 日志信息
$level string 日志级别
$destination string 写入目标
$type integer 日志记录方式
$extra string 额外参数
return void
Exemplo n.º 1
0
 public function index()
 {
     if ($this->config->get('amazon_status') != '1') {
         return;
     }
     $this->load->model('openbay/amazon_product');
     $logger = new Log('amazon.log');
     $logger->write('amazon/listing_reports - started');
     $token = $this->config->get('openbay_amazon_token');
     $incomingToken = isset($this->request->post['token']) ? $this->request->post['token'] : '';
     if ($incomingToken !== $token) {
         $logger->write('amazon/listing_reports - Incorrect token: ' . $incomingToken);
         return;
     }
     $decrypted = $this->openbay->amazon->decryptArgs($this->request->post['data']);
     if (!$decrypted) {
         $logger->write('amazon/listing_reports - Failed to decrypt data');
         return;
     }
     $logger->write('Received Listing Report: ' . $decrypted);
     $request = json_decode($decrypted, 1);
     $data = array();
     foreach ($request['products'] as $product) {
         $data[] = array('marketplace' => $request['marketplace'], 'sku' => $product['sku'], 'quantity' => $product['quantity'], 'asin' => $product['asin'], 'price' => $product['price']);
     }
     if ($data) {
         $this->model_openbay_amazon_product->addListingReport($data);
     }
     $this->model_openbay_amazon_product->removeListingReportLock($request['marketplace']);
     $logger->write('amazon/listing_reports - Finished');
 }
Exemplo n.º 2
0
 function error($f3)
 {
     $log = new Log('error.log');
     $log->write($f3->get('ERROR.text'));
     foreach ($f3->get('ERROR.trace') as $frame) {
         if (isset($frame['file'])) {
             // Parse each backtrace stack frame
             $line = '';
             $addr = $f3->fixslashes($frame['file']) . ':' . $frame['line'];
             if (isset($frame['class'])) {
                 $line .= $frame['class'] . $frame['type'];
             }
             if (isset($frame['function'])) {
                 $line .= $frame['function'];
                 if (!preg_match('/{.+}/', $frame['function'])) {
                     $line .= '(';
                     if (isset($frame['args']) && $frame['args']) {
                         $line .= $f3->csv($frame['args']);
                     }
                     $line .= ')';
                 }
             }
             // Write to custom log
             $log->write($addr . ' ' . $line);
         }
     }
     Template::instance()->render('error.html');
 }
Exemplo n.º 3
0
/**
 * Error handler, called when an error occurs
 *
 * @param int $errno	Error code
 * @param int $errstr	Error message
 * @param int $errfile	File in which the error occured
 * @param int $errline	Line of the file where the error occured
 */
function error_handler($errno, $errstr, $errfile, $errline)
{
    $log = new Log('php_errors.log');
    $msg = '';
    $exception = true;
    // cf. http://www.php.net/manual/en/function.set-error-handler.php
    switch ($errno) {
        case E_ERROR:
        case E_USER_ERROR:
            $msg = 'Fatal error: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            $log->write($msg);
            if (Config::DEBUG) {
                return $msg;
            } else {
                return 'An error occured, please try again later.';
            }
            break;
        case E_WARNING:
        case E_USER_WARNING:
            $msg = 'Warning: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            break;
        case E_NOTICE:
        case E_USER_NOTICE:
            $msg = 'Notice: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            $exception = false;
            break;
        default:
            $msg = 'Unknown error [' . $errno . ']: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            break;
    }
    $log->write($msg);
    if ($exception) {
        throw new Exception($msg, $errno);
    }
}
Exemplo n.º 4
0
 public function logger($message)
 {
     if ($this->config->get('g2apay_debug') == 1) {
         $log = new Log('g2apay.log');
         $backtrace = debug_backtrace();
         $log->write('Origin: ' . $backtrace[6]['class'] . '::' . $backtrace[6]['function']);
         $log->write(print_r($message, 1));
     }
 }
Exemplo n.º 5
0
 public function index()
 {
     if ($this->config->get('amazon_status') != '1') {
         return;
     }
     $this->load->library('log');
     $this->load->library('amazon');
     $this->load->model('amazon/listing');
     $this->load->model('amazon/product');
     $logger = new Log('amazon_listing.log');
     $logger->write('amazon/listing - started');
     $token = $this->config->get('openbay_amazon_token');
     $incomingToken = isset($this->request->post['token']) ? $this->request->post['token'] : '';
     if ($incomingToken !== $token) {
         $logger->write('amazon/listing - Incorrect token: ' . $incomingToken);
         return;
     }
     $decrypted = $this->openbay->amazon->decryptArgs($this->request->post['data']);
     if (!$decrypted) {
         $logger->write('amazon/order Failed to decrypt data');
         return;
     }
     $data = json_decode($decrypted, 1);
     $logger->write("Received data: " . print_r($data, 1));
     if ($data['status']) {
         $logger->write("Updating " . $data['product_id'] . ' from ' . $data['marketplace'] . ' as successful');
         $this->model_amazon_listing->listingSuccessful($data['product_id'], $data['marketplace']);
         $this->model_amazon_product->linkProduct($data['sku'], $data['product_id']);
         $logger->write("Updated successfully");
     } else {
         $logger->write("Updating " . $data['product_id'] . ' from ' . $data['marketplace'] . ' as failed');
         $this->model_amazon_listing->listingFailed($data['product_id'], $data['marketplace'], $data['messages']);
         $logger->write("Updated successfully");
     }
 }
Exemplo n.º 6
0
 public function post_resetlogin()
 {
     $validatekey = Str::random(32, 'alpha');
     $uname = Str::random(16, 'alpha');
     $user = Admin_User::find(Auth::user()->userid);
     $user->username = $uname;
     $user->password = $uname;
     $user->status = 3;
     $user->validationkey = $validatekey;
     $user->save();
     try {
         $mailer = Message::to($user->userprofile->emel);
         $mailer->from('*****@*****.**', 'System Generate');
         $mailer->subject('Account Reset');
         $mailer->body('view: plugins.emailAccReset');
         $mailer->body->username = $uname;
         $mailer->body->password = $uname;
         $mailer->body->key = $key;
         $mailer->html(true);
         $mailer->send();
     } catch (Exception $e) {
         Log::write('email', 'Message was not sent.');
         Log::write('email', 'Mailer error: ' . $e->getMessage());
     }
 }
Exemplo n.º 7
0
/**
 * [halt 终止]
 * @Author   Rukic
 * @DateTime 2015-11-13T18:48:15+0800
 * @return   [type]                   [description]
 */
function halt($error, $level = "ERROR", $type = 3, $dest = NULL)
{
    if (is_array($error)) {
        Log::write($error['message'], $level, $type, $dest);
    } else {
        Log::write($error, $level, $type, $dest);
    }
    $e = array();
    //开启DEBUG
    if (DEBUG) {
        if (!is_array($error)) {
            $trace = debug_backtrace();
            //文件来源,追踪引导
            $e['message'] = $error;
            $e['file'] = $trace[0]['file'];
            $e['line'] = $trace[0]['line'];
            $e['class'] = isset($trace[0]['line']) ? $trace[0]['line'] : "";
            $e['function'] = isset($trace[0]['function']) ? $trace[0]['function'] : "";
            ob_start();
            debug_print_backtrace();
            $e['trace'] = htmlspecialchars(ob_get_clean());
        } else {
            $e = $error;
        }
    } else {
        if ($url = C('ERROR_URL')) {
            go($url);
        } else {
            $e['message'] = C('ERROR_MSG');
        }
    }
    include MYPHP_TPL_PATH . '/halt.html';
    die;
}
Exemplo n.º 8
0
 public function logger($message)
 {
     if ($this->config->get('globalpay_debug') == 1) {
         $log = new Log('globalpay.log');
         $log->write($message);
     }
 }
Exemplo n.º 9
0
 public function body($disclaimer = false)
 {
     $data = '';
     $ok = false;
     while (!$ok && $this->attempts() > 0) {
         $data = $this->execute_query();
         if (!is_int($data)) {
             $ok = true;
         }
     }
     if (!$ok) {
         \Log::write('error', 'connexion: ' . $this->host() . ' -> ' . $this->get_query_string());
     }
     if (!$data) {
         if (count(explode('.', $this->domain)) >= 3) {
             $data = 'This Domain is not available in our whois database';
         } else {
             $data = 3;
         }
     }
     if (!is_int($data)) {
         $this->body = $data . "\n";
     } else {
         $this->body = $data;
     }
     if (!$disclaimer || $this->connection_type === 'curl') {
         $this->remove_surplus();
     }
     return $this->body;
 }
Exemplo n.º 10
0
 /**
  * requestForTranslation method
  * called after Plugin.SourcePush event is dispatched
  *
  * @param array int id of new sources, target languages
  * @return void
  */
 public function requestForTranslation($event)
 {
     foreach ($event->data['newSources'] as $eventData) {
         $sourceId = $eventData[0];
         $targetLanguageId = $eventData[1];
         // get all the data
         $source = TableRegistry::get('sources')->findById($sourceId)->first();
         $sourceLanguage = TableRegistry::get('languages')->findById($source->language_id)->first();
         $targetLanguage = TableRegistry::get('languages')->findById($targetLanguageId)->first();
         // select suitable translators
         $translators = $this->SelectTranslator->selectTranslators($source->id, $targetLanguage->id);
         if (empty($translators)) {
             continue;
         }
         foreach ($translators as $translator) {
             // file in translation requests
             $translationRequest = $this->createTranslationRequest($translator, $source, $targetLanguage);
             if ($translationRequest === false) {
                 Log::write('newSource', 'createTranslationRequest fail: source:id = ' . $source->id . '; user_id = ' . $translator['id'] . '; targetLanguage_id = ' . $targetLanguage->id);
                 continue;
             }
             // notify translators about the requests
             $this->getMailer('translation')->send('translationRequest', [$source, $translator, $translationRequest['hash'], $sourceLanguage, $targetLanguage]);
         }
         // do machine translation
     }
 }
Exemplo n.º 11
0
 public function addHistory($order_id, $order_status_id, $comment)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int) $order_id . "', order_status_id = '" . (int) $order_status_id . "', notify = '0', comment = '" . $this->db->escape($comment) . "', date_added = NOW()");
 }
 public function logger($message)
 {
     if ($this->config->get('firstdata_debug') == 1) {
Exemplo n.º 12
0
 public static function send($msg, $detail, $level = self::USER, $mobile = null)
 {
     //判断是否定义需要发送短信
     if (!in_array($level, explode(',', C('SMS_LEVEL')))) {
         return;
     }
     //判断发送频率
     $mc = memcache_init();
     $is_send = $mc->get('think_sms_send');
     //如果已经发送,则不发送
     if ($is_send === 'true') {
         $status = 'not send';
     } else {
         //TODU,如果apibus类调整,此类也得调整
         $sms = apibus::init('sms');
         if (is_null($mobile)) {
             $mobile = C('SMS_MOBILE');
         }
         $mc = memcache_init();
         $obj = $sms->send($mobile, mb_substr(C('SMS_SIGN') . $msg, 0, 65, 'utf-8'), "UTF-8");
         if ($sms->isError($obj)) {
             $status = 'failed';
         } else {
             $status = 'success';
             $mc->set('think_sms_send', 'true', 0, C('SMS_INTERVAL'));
         }
     }
     //记录日志
     if (C('LOG_RECORD')) {
         Log::record($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS', true);
     } else {
         Log::write($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS');
     }
 }
Exemplo n.º 13
0
 /**
  * Runtime errors that do not require immediate action but
  * should typically be logged and monitored.
  *
  * @param string $classname
  * @param string $message
  */
 public static function error($classname, $message)
 {
     if (LOG_LEVEL <= 400) {
         $message = Log::format('ERROR', $classname, $message);
         Log::write($message);
     }
 }
Exemplo n.º 14
0
 public function searchWidget($vercode = 0)
 {
     if (!$this->_widgetFac) {
         Log::write("WidgetSearch::searchWidget():_widgetFac is null", "log");
         return false;
     }
     $sql = $this->_widgetFac->getWidgeMemSql($vercode);
     if (!$sql || empty($sql)) {
         Log::write('WidgetSearch::searchWidget():getWidgeMemSql() sql is empty', 'log');
         $result = get_rsp_result(false, 'get widget mem sql failed');
         return $result;
     }
     $result = $this->_memcached->getSearchResult($sql);
     if ($result) {
         return $result;
     }
     $result = $this->_widgetFac->getWidgetProtocol();
     if (!$result) {
         Log::write('WidgetSearch::searchWidget():getWidgetProtocol() failed', 'log');
         $result = get_rsp_result(false, 'get widget protocol failed');
         return $result;
     }
     $result = json_encode($result);
     $bResult = $this->_memcached->setSearchResult($sql, $result);
     if (!$bResult) {
         Log::write('WidgetSearch::setSearchResult() failed', 'log');
     }
     return $result;
 }
Exemplo n.º 15
0
function process_message($msg)
{
    echo "\n############ 信息日志开始 ###############\n";
    echo date('Y-m-d H:i:s') . "=====" . $msg->body;
    echo "\n############ 信息日志结束 ###############\n";
    //执行SQL语句
    $db_config = C("DB_CONFIG");
    $dbConn = new mysql();
    $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], '');
    $dbConn->select_db($db_config["master1"][4]);
    $sql = $msg->body;
    $query = $dbConn->query($sql);
    if (!$query) {
        Log::write($sql, Log::ERR);
    } else {
        echo date('Y-m-d H:i:s') . '===== [ok] ', '=====', $sql, "\n";
        //确认消费OK
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    }
    $dbConn->close();
    // Send a message with the string "quit" to cancel the consumer.
    if ($msg->body === 'quit') {
        $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
    }
}
Exemplo n.º 16
0
 /**
  * Check connection to soap server and return current timestamp on success. No authorization required - used simply for seting up the connection via proxy, firewall, http authentication etc...
  * @return string Current timestamp dd.mm.YYYY HH:ii:ss
  * @soap
  */
 public function connect()
 {
     $request = Yii::app()->request;
     $url = $request->getHostInfo() . $request->getUrl();
     Log::write('[' . __FUNCTION__ . '] OK - Connection succesfull via [' . $url . ']', self::LOGNAME);
     return 'OK - connection succesfull at [' . date('d.m.Y H:i:s') . ']';
 }
Exemplo n.º 17
0
 public static function error($data)
 {
     if (Log::$level < Log::ERROR) {
         return;
     }
     Log::write($data);
 }
Exemplo n.º 18
0
 /**
  * 开启调试输出
  * @method _initDebug
  * @author NewFuture
  */
 public function _initDebug()
 {
     if (Config::get('isdebug')) {
         /*加载 PHP Console Debug模块*/
         Yaf_Loader::import('PhpConsole/__autoload.php');
         $connector = PhpConsole\Connector::getInstance();
         if ($connector->isActiveClient()) {
             Log::write('PHP Console 已经链接', 'INFO');
             $handler = PhpConsole\Handler::getInstance();
             $dispatcher = $connector->getDebugDispatcher();
             $handler->start();
             $connector->setSourcesBasePath(APP_PATH);
             $connector->setServerEncoding('utf8');
             $dispatcher->detectTraceAndSource = true;
             //跟踪信息
             if ($pwd = Config::get('debug.auth')) {
                 $connector->setPassword($pwd);
                 $evalProvider = $connector->getEvalDispatcher()->getEvalProvider();
                 // $evalProvider->disableFileAccessByOpenBaseDir();             // means disable functions like include(), require(), file_get_contents() & etc
                 // $evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); // so you can access $_SERVER['REQUEST_URI'] just as $uri in terminal
                 // $evalProvider->addSharedVarReference('post', $_POST);
                 $connector->startEvalRequestsListener();
             }
         }
         PhpConsole\Helper::register();
     }
 }
Exemplo n.º 19
0
 /**
  * @param \String $image
  * @return resource
  * @throws Exception
  */
 private function create($image)
 {
     $mime = $this->info['mime'];
     $image = trim($image);
     try {
         if (!file_exists($image)) {
             throw new InvalidArgumentException("Image file '{$image}' doesn't exist");
         }
         if ($mime == 'image/gif') {
             $image = imagecreatefromgif($image);
         } elseif ($mime == 'image/png') {
             $image = @imagecreatefrompng($image);
         } elseif ($mime == 'image/jpeg') {
             $image = imagecreatefromjpeg($image);
         }
         return $image;
     } catch (Exception $exc) {
         $logger = new Log('error.log');
         $tmpExc = $exc;
         while ($tmpExc != null) {
             $logger->write($exc->getMessage());
             $tmpExc = $tmpExc->getPrevious();
         }
         throw $exc;
     }
 }
Exemplo n.º 20
0
 public function index($params = array())
 {
     if (empty($params[0])) {
         Log::write("Error en la subcategoria, no hay parametro para encontrar una.");
         return require VIEWS . 'error/404.php';
     }
     try {
         $subcatego = $this->subcategory->toArray($params[0]);
         if (empty($subcatego)) {
             Log::write("No existe la subcategoria que se esta buscando.");
             return require VIEWS . 'error/404.php';
         }
         try {
             $selectedSubcategory = $subcatego['idsubcategoria'];
             $productos = $this->product->selecWithCategorySubcatAndProduct(false, $subcatego['idsubcategoria'], 'idproducto');
             Log::write("Se muestra la categoria.");
             return require VIEWS . 'home/index.php';
         } catch (Exception $e) {
             echo $e->getMessage();
             return;
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
         Log::write("Se ha producido una excepción, " . $error);
         return require VIEWS . 'error/500.php';
     }
 }
Exemplo n.º 21
0
 /**
  * 写入工艺进程
  * @todo 判断是否当前生产计划及详情已完成
  */
 public function doProcess($data)
 {
     $this->startTrans();
     foreach ($data as $row) {
         $rs = $this->add($row);
         if (!$rs) {
             Log::write("SQL Error:" . $this->getLastSql(), Log::SQL);
             $this->rollback();
             return false;
         }
         $detailIds[] = $row['plan_detail_id'];
         $newAddIds[] = $rs;
     }
     if ($detailIds) {
         foreach ($detailIds as $id) {
             $this->where(array("plan_detail_id" => $id, "status" => 0, "id" => array("NOT IN", implode(",", $newAddIds))))->save(array("end_time" => CTS, "status" => 1));
         }
         $detailModel = D("ProducePlanDetail");
         //标识产品已进入生产工序
         $detailModel = D("ProducePlanDetail");
         $detailModel->where(array("id" => array("IN", $detailIds), "status" => array("LT", 1)))->save(array("status" => 1, "start_time" => CTS));
     }
     $this->commit();
     return true;
 }
Exemplo n.º 22
0
 public function logger($message)
 {
     if ($this->config->get('bluepay_hosted_debug') == 1) {
         $log = new Log('bluepay_hosted.log');
         $log->write($message);
     }
 }
Exemplo n.º 23
0
 public function query($query)
 {
     if (!empty($query) && trim($query) != "") {
         self::connect();
         self::$result = mysql_query($query, self::$connection) or Log::write("mysql", mysql_error());
     }
 }
Exemplo n.º 24
0
 /**
  * 执行SQL语句
  */
 public function query($sql, $link = null)
 {
     $link = $link ? $link : $this->db_link;
     $result = mysql_query($sql, $link);
     //file_put_contents('sql.txt', $sql . PHP_EOL, FILE_APPEND);
     //日志操作,当调试模式开启时,将所执行过的SQL写入SQL跟踪日志文件,便于DBA进行MYSQL优化。若调试模式关闭,当SQL语句执行错误时写入日志文件
     if (SYS_DEBUG === false) {
         if ($result == false) {
             //获取当前运行的namespace、controller及action名称
             $action_id = App::get_action_id();
             $namespace_id = App::get_namespace_id();
             $controller_id = App::get_controller_id();
             $namespace_code = $namespace_id ? '[' . $namespace_id . ']' : '';
             if (SYS_LOG === true) {
                 Log::write($namespace_code . '[' . $controller_id . '][' . $action_id . '] SQL execute failed :' . $sql . ' Error Code:' . $this->errno() . 'Error Message:' . $this->error());
             }
         }
     } else {
         //获取当前运行的namespace、controller及action名称
         $action_id = App::get_action_id();
         $namespace_id = App::get_namespace_id();
         $controller_id = App::get_controller_id();
         $sql_log_file = APP_ROOT . 'logs' . DIRECTORY_SEPARATOR . 'SQL_' . date('Y_m_d', $_SERVER['REQUEST_TIME']) . '.log';
         $namespace_code = $namespace_id ? '[' . $namespace_id . ']' : '';
         if ($result == true) {
             if (SYS_LOG === true) {
                 Log::write($namespace_code . '[' . $controller_id . '][' . $action_id . ']:' . $sql, 'Normal', $sql_log_file);
             }
         } else {
             Controller::halt($namespace_code . '[' . $controller_id . '][' . $action_id . '] SQL execute failed :' . $sql . '<br/>Error Message:' . $this->error() . '<br/>Error Code:' . $this->errno() . '<br/>Error SQL:' . $sql);
         }
     }
     return $result;
 }
Exemplo n.º 25
0
 public function logger($message)
 {
     if ($this->config->get('realex_debug') == 1) {
         $log = new Log('realex.log');
         $log->write($message);
     }
 }
Exemplo n.º 26
0
 /**
  * Convenience method to write a message to Log. See Log::write()
  * for more information on writing to logs.
  *
  * @param string $msg Log message.
  * @param int|string $level Error level.
  * @param string|array $scope The name of the log scope.
  * @return bool Success of log write.
  */
 public function log($msg, $level = LOG_ERR, $scope = [])
 {
     if (!is_string($msg)) {
         $msg = print_r($msg, true);
     }
     return Log::write($level, $msg, $scope);
 }
Exemplo n.º 27
0
 public function paymentIpn()
 {
     $this->load->model('payment/pp_payflow_iframe');
     $this->load->model('checkout/order');
     if ($this->config->get('pp_pro_iframe_debug')) {
         $log = new Log('pp_pro_iframe.log');
         $log->write('POST: ' . print_r($this->request->post, 1));
     }
     $order_id = $this->model_payment_pp_payflow_iframe->getOrderId($this->request->post['SECURETOKENID']);
     if ($order_id) {
         $order_info = $this->model_checkout_order->getOrder($order_id);
         $url_params = array('TENDER' => 'C', 'TRXTYPE' => 'I', 'ORIGID' => $this->request->post['PNREF']);
         $response_params = $this->model_payment_pp_payflow_iframe->call($url_params);
         if ($order_info['order_status_id'] == 0 && $response_params['RESULT'] == '0' && $this->request->post['RESULT'] == 0) {
             $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('pp_payflow_iframe_order_status_id'));
             if ($this->request->post['TYPE'] == 'S') {
                 $complete = 1;
             } else {
                 $complete = 0;
             }
             $data = array('secure_token_id' => $this->request->post['SECURETOKENID'], 'transaction_reference' => $this->request->post['PNREF'], 'transaction_type' => $this->request->post['TYPE'], 'complete' => $complete);
             $this->model_payment_pp_payflow_iframe->updateOrder($data);
             $data = array('order_id' => $order_id, 'type' => $this->request->post['TYPE'], 'transaction_reference' => $this->request->post['PNREF'], 'amount' => $this->request->post['AMT']);
             $this->model_payment_pp_payflow_iframe->addTransaction($data);
         }
     }
     $this->response->setOutput('Ok');
 }
Exemplo n.º 28
0
 public function newReturns($data)
 {
     if (!$data["rows"]) {
         return false;
     }
     if (!$this->checkFactoryCodeAll($data["rows"])) {
         $this->error = "factory_code_not_full";
         return false;
     }
     $this->startTrans();
     $returnsId = $this->add($data);
     if (!$returnsId) {
         Log::write("SQL Error:" . $this->getLastSql(), Log::SQL);
         $this->rollback();
         return false;
     }
     //        print_r($data["rows"]);exit;
     $detail = D("ReturnsDetail");
     foreach ($data["rows"] as $row) {
         $row["returns_id"] = $returnsId;
         if (!$detail->add($row)) {
             Log::write("SQL Error:" . $this->getLastSql(), Log::SQL);
             $this->rollback();
             break;
         }
     }
     $this->commit();
     return $returnsId;
 }
Exemplo n.º 29
0
 public function log($message)
 {
     if ($this->config->get('pp_pro_iframe_debug')) {
         $log = new Log('pp_pro_iframe.log');
         $log->write($message);
     }
 }
Exemplo n.º 30
0
 public function log($data)
 {
     if ($this->config->get('pilibaba_logging')) {
         $log = new Log('pilibaba.log');
         $log->write($data);
     }
 }