public function getInterfaceData($epi_curl_manager) { $response = $epi_curl_manager->getResponse(); $temp = false; if ($response['code'] == 200) { $response_data = json_decode($response['data'], true); if ($response_data['rtn'] === 0) { $temp = isset($response_data['data']) ? $response_data['data'] : ''; if ($response['time'] > 0.2) { // 记录慢查询接口 Log::notice("CURL REQUEST ERROR : HTTP_CODE=" . $response['code'] . '; TOTAL_TIME=' . $response['time'] . "; EFFECTIVE_URL=" . $response['url'] . '; Data :' . $response['data']); } } else { // 记录接口返回错误数据 $this->errorCode = $response_data['rtn']; $this->serviceErrorInfo = $response_data; Log::warn("CURL REQUEST ERROR : HTTP_CODE=" . $response['code'] . '; TOTAL_TIME=' . $response['time'] . "; EFFECTIVE_URL=" . $response['url'] . '; Data :' . $response['data']); return false; } } else { // 记录接口请求错误 Log::error("CURL REQUEST ERROR : HTTP_CODE=" . $response['code'] . '; TOTAL_TIME=' . $response['time'] . "; EFFECTIVE_URL=" . $response['url'] . '; Data :' . $response['data']); return false; } return $temp; }
private function handleRequest() { Log::debug('Controller', 'Handle request'); $action = $this->request->action; if (empty($action)) { $this->index(); } else { if (method_exists($this, $action)) { $this->{$action}(); } else { throw new Exceptions\NotFoundException(); } } }
public static function authenticate($username, $password) { Log::info('HackableUser', sprintf('Authenticate user: "******"', $username)); $salt = self::retrieve_salt($username); Log::debug('HackableUser', sprintf('Salt: "%s"', $salt)); $hashed_password = self::generate_hash($password, $salt); try { $user = self::retrieve($username, $hashed_password); } catch (\Lib\Exceptions\NotFoundException $e) { Log::info('User', sprintf('User not found: "%s"', $username)); throw new \Lib\Exceptions\UnauthorizedException(); } $user->create_token(); return $user; }
public function NotifyProcess($data, &$msg) { Log::DEBUG("call back:" . json_encode($data)); $notfiyOutput = array(); if (!array_key_exists("transaction_id", $data)) { $msg = "输入参数不正确"; return false; } //查询订单,判断订单真实性 if (!$this->Queryorder($data["transaction_id"])) { $msg = "订单查询失败"; return false; } return true; }
public static function authenticate($username, $password) { Log::info('User', sprintf('Authenticate user: "******"', $username)); try { $user = self::retrieve($username); } catch (\Lib\Exceptions\NotFoundException $e) { Log::info('User', sprintf('User not found: "%s"', $username)); throw new \Lib\Exceptions\UnauthorizedException(); } $hashed_password = self::generate_hash($password, $user->salt); if ($user->password !== $hashed_password) { Log::info('User', sprintf('Password does not match for user: "******"', $username)); throw new \Lib\Exceptions\UnauthorizedException(); } $user->create_token(); return $user; }
/** * 图片缩略 * @param array $attach_info 附件信息 * @return array / boolean 缩略图集合或者false * @author 李志亮 <*****@*****.**> */ public static function createThumb($attach_info) { $attach_info['path'] = preg_replace('/\\/|\\\\/', DIRECTORY_SEPARATOR, $attach_info["path"]); try { $thumbs = array(); $image = new \Think\Image(1, UPLOAD_PATH . $attach_info['path']); foreach (static::$thumbs as $key => $thumb) { $thumb_url = str_replace('.' . $attach_info['ext'], $thumb['w'] . 'x' . $thumb['h'] . '.' . $attach_info['ext'], $attach_info['url']); $thumb_path = UPLOAD_PATH . str_replace('.' . $attach_info['ext'], $thumb['w'] . 'x' . $thumb['h'] . '.' . $attach_info['ext'], $attach_info['path']); $image->thumb($thumb['w'], $thumb['h'], \Think\Image::IMAGE_THUMB_FILLED)->save($thumb_path); $thumbs[$thumb['w'] . 'x' . $thumb['h']] = $thumb_url; } return $thumbs; } catch (Exception $e) { $result['message'] = $e->getMessage(); Log::info('缩略图生成失败; ' . json_encode($attach_info) . '; ' . $e->getMessage()); } }
public function execModelCreateSql($sql) { $sqls = $this->sql_split($sql); if (is_array($sqls)) { foreach ($sqls as $sql) { if (trim($sql) != '') { if ($this->execute($sql) === false) { \Lib\Log::error('sql 执行失败: ' . $sql); return false; } } } } else { if ($this->execute($sqls) === false) { \Lib\Log::error('sqls 执行失败: ' . $sqls); return false; } } return true; }
public function NotifyProcess($data, &$msg) { //echo "处理回调"; Log::DEBUG("call back:" . json_encode($data)); if (!array_key_exists("openid", $data) || !array_key_exists("product_id", $data)) { $msg = "回调数据异常"; return false; } $openid = $data["openid"]; $product_id = $data["product_id"]; //统一下单 $result = $this->unifiedorder($openid, $product_id); if (!array_key_exists("appid", $result) || !array_key_exists("mch_id", $result) || !array_key_exists("prepay_id", $result)) { $msg = "统一下单失败"; return false; } $this->SetData("appid", $result["appid"]); $this->SetData("mch_id", $result["mch_id"]); $this->SetData("nonce_str", WxPayApi::getNonceStr()); $this->SetData("prepay_id", $result["prepay_id"]); $this->SetData("result_code", "SUCCESS"); $this->SetData("err_code_des", "OK"); return true; }
</head> <?php ini_set('date.timezone', 'Asia/Shanghai'); error_reporting(E_ERROR); require '../conf.php'; require '../vendor/autoload.php'; use lib\WxPayApi; use lib\base\WxPayOrderQuery; //数据输入对象类 //use lib\base\WxPayConfig;//微信支付参数配置类 //use lib\NativePay;//微信扫码支付操作类 use lib\CLogFileHandler; use lib\Log; //初始化日志 $logHandler = new CLogFileHandler("./logs/" . date('Y-m-d') . '.log'); $log = Log::Init($logHandler, 15); function printf_info($data) { foreach ($data as $key => $value) { echo "<font color='#f00;'>{$key}</font> : {$value} <br/>"; } } if (isset($_REQUEST["transaction_id"]) && $_REQUEST["transaction_id"] != "") { $transaction_id = $_REQUEST["transaction_id"]; $input = new WxPayOrderQuery(); $input->SetTransaction_id($transaction_id); printf_info(WxPayApi::orderQuery($input)); exit; } if (isset($_REQUEST["out_trade_no"]) && $_REQUEST["out_trade_no"] != "") { $out_trade_no = $_REQUEST["out_trade_no"];
/** * index sayfası, site açıldığı anda ilk buradan başlar * * @return mixed */ private function login() { if (\Lib\Session::get('loggedin')) { \Lib\Url::redirect('hesapim'); } $data['baslik'] = 'Kullanıcı Girişi'; if ($this->request->getMethod() == 'POST') { // if (isset ( $_POST ['submit'] )) { $emailadres = $this->request->get('email'); $password = $this->request->get('password'); if ($emailadres == '') { $error[] = 'email alanı boş bırakılamaz'; } if (!filter_var($emailadres, FILTER_VALIDATE_EMAIL)) { $error[] = 'lütfen geçerli bir email adresi yazınız '; } if ($password == '') { $error[] = 'Şifre alanı boş bırakılamaz '; } if (!$error) { $emailadres = $this->request->get('email'); // $password = Sha1(md5($this->request->get('password'))); $password = $this->request->get('password'); $kullanici_bilgileri = $this->_model->getKullaniciBilgileri($emailadres); $parola = $kullanici_bilgileri['parola']; $id = $kullanici_bilgileri['id']; $email = $kullanici_bilgileri['email']; $ad_soyad = \Lib\Strings::adSoyadParcala($kullanici_bilgileri['unvan']); $ad = $ad_soyad['adi']; $soyad = $ad_soyad['soyadi']; $ad_soyad = $ad . ' ' . $soyad; $data['ad_soyad'] = $ad_soyad; $kullanici_bilgilerim = array(); if (strcmp($parola, $password) == 0) { \Lib\Session::set('loggedin', true); $kullanici_bilgilerim = array('kullanici_id' => $id, 'email' => $email, 'adi' => $ad, 'soyadi' => $soyad, 'ad_soyad' => $ad_soyad); \Lib\Session::set('kullanici_bilgileri', $kullanici_bilgilerim); // kullanıcı giriş yapmışsa sepetindeki ürünleri sepetine ekle $this->UyeninSepetindekiUrunler($id); \Lib\Url::redirect(''); } else { \Lib\Log::LogOlustur('hatali_giris', 'uyelik', '{"kullanıcıadı":"' . $emailadres . '", "şifre":"' . $password . '"}', $emailadres . '/' . $password); $hata = \Lib\Tools::message_ver('hata', 'Kullanıcı adı veya şifreyi yanlış girdiniz'); \Lib\Session::set('message', $hata); } } } return $error; }