public function processOrder(array $orderParams) { $order = $this->_getOrder($orderParams['app_order_id']); if (!$order) { error_log(FormatLogStr('qihoo', 'callback', ERROR_NEXIST, $orderParams['app_order_id'])); return false; } $config = (include dirname(__FILE__) . "/../../../utils/config.php"); global $centerPath; $url = $config['center'] . $centerPath . '?uin=' . $order["Uin"] . '&orderId=' . $order['OrderId'] . "&shopId=" . $order['ShopId']; $res = $this->notifyCenter($url); if ($res === "success") { $log = GetLogger($config['logger']); $log->writeFile(FormatLogStr('qihoo', 'callback', ERROR_0, $url)); //成功更新订单信息 $order['Status'] = "success"; //更新订单状态为success $order['ExtOrderID'] = $orderParams['order_id']; //保存第三方的订单号 $order['PayTime'] = time(); $this->redis->hSet(self::REDIS_HASH, $orderParams['app_order_id'], $order); return true; } else { error_log(FormatLogStr('qihoo', 'callback', ERROR_CENTER, $url)); return false; } }
function LoginValidate($inputMail, $inputValidateKey) { if (LoginSessionAntiCopyCheck() != 0) { return __LINE__; } if ($inputMail == "" || $inputValidateKey == "") { return __LINE__; } $sessionKey = ""; $sessionMail = ""; if (isset($_SESSION["login_validate_key"])) { $sessionKey = $_SESSION["login_validate_key"]; } if (isset($_SESSION["login_validate_mail"])) { $sessionMail = $_SESSION["login_validate_mail"]; } if ($inputMail == $sessionMail && $inputValidateKey == $sessionKey) { $_SESSION["login_user"] = $inputMail; GetLogger()->info("{$inputMail} {$inputValidateKey} {$sessionMail} {$sessionKey}"); return 0; } else { GetLogger()->error("{$inputMail} {$inputValidateKey} {$sessionMail} {$sessionKey}"); return __LINE__; } }
} $orderId = $param["exorderno"]; //updat redis $redis = new RedisHelper($config); $data = $redis->HGet("recharge_order", $orderId); if ($data === false) { error_log(FormatLogStr('lenovo', 'callback', ERROR_NEXIST, "order : {$orderId} is not exist")); die('FAILTURE'); } $cache = json_decode($data, true); $cache["ExtOrderId"] = $param["transid"]; $cache['PayTime'] = strtotime($param["transtime"]); $cache['Uin'] = intval($param["cpprivate"]); $url = $config['center'] . $centerPath . '?uin=' . $param["cpprivate"] . '&orderId=' . $orderId . "&shopId=" . $shopid; $res = https_get($url); if ($res === 'callback success') { error_log(FormatLogStr('lenovo', 'callback', ERROR_0, $transdata . "&sign={$sign}")); $log = GetLogger($config['logger']); $log->writeFile(FormatLogStr('lenovo', 'callback', ERROR_0, $url . ' ExtOrderId : ' . $cache['ExtOrderId'])); $cache["Status"] = "success"; $redis->HSet("recharge_order", $orderId, $cache); die('SUCCESS'); } else { $redis->HSet("recharge_order", $orderId, $cache); error_log(FormatLogStr('lenovo', 'callback', ERROR_CENTER, $url)); die('FAILTURE'); } } else { error_log(FormatLogStr('lenovo', 'callback', ERROR_SIGN, $transdata . "&sign={$sign}")); die('FAILTURE'); }
<?php require_once dirname(__FILE__) . "/" . "../common/GetLogger.php"; GetLogger()->warn("Warning");
function UpdateUserInformTime(Dao_UpdateUserInformTimeIn $in, Dao_UpdateUserInformTimeOut $out) { $query = array(); $query[] = "update series_update_reminder_subscribers "; $query[] = " set d_last_mail=now() "; $query[] = " where i_rule_id="; $query[] = DbWrapStr($in->ruleId); $query[] = " and s_subscriber="; $query[] = DbWrapStr($in->subscriber); $result = $this->db->Execute($query); if ($result->errorCode) { GetLogger()->error("execute sql error: " . $result->statement . " message:" . $result->errorMessage); $out->errorCode = $result->errorCode; $out->errorMessage = $result->errorMessage; return; } GetLogger()->info("executed: " . $result->statement); $out->errorCode = $result->errorCode; $out->errorMessage = $result->errorMessage; return; }
function SendMails($dao) { $mailUserName = ""; $mailPassword = ""; $dao->GetConfig("mail.user_name", $mailUserName); $dao->GetConfig("mail.password", $mailPassword); $getUsersIn = new Dao_GetUsersToInformUpdateIn(); $getUsersOut = new Dao_GetUsersToInformUpdateOut(); $dao->GetUsersToInformUpdate($getUsersIn, $getUsersOut); $users = $getUsersOut->users; GetLogger()->info(count($users) . " users need to inform."); foreach ($users as $user) { $from = $mailUserName; $passwrod = $mailPassword; $ruleId = $user["i_rule_id"]; $url = $user["s_url"]; $pattern = $user["s_pattern"]; $subscriber = $user["s_subscriber"]; // send mail $mail = new PHPMailer(); PHPMailerSendFromQqConfig($mail, $from, $passwrod); //Set who the message is to be sent to $mail->addAddress($subscriber, $subscriber); //Set the subject line $mail->Subject = 'update notify'; $mail->msgHTML(htmlspecialchars($url)); if (!$mail->send()) { GetLogger()->error("send mail to {$subscriber} error, url[{$url}]"); continue; } $updateInformTimeIn = new Dao_UpdateUserInformTimeIn(); $updateInformTimeIn->ruleId = $ruleId; $updateInformTimeIn->subscriber = $subscriber; $updateInformTimeOut = new Dao_UpdateUserInformTimeOut(); $dao->UpdateUserInformTime($updateInformTimeIn, $updateInformTimeOut); } }