示例#1
0
	function savePassenger()
	{
$logger = Logger::getLogger("airticket");
$logger->info("保存用户信息");
		$authorid = trim($this->arr_channelinfo['authorid']);									// 必填
		if($authorid == "")	ErrorReponse :: reponError(array("retcode" => "200", "retmsg" => "用户输入信息不完整"));
		
		$arr_body = $this->arr_body;
		$name = trim($arr_body["name"]);														// 必填
		$cardType = trim($arr_body["cardType"]);												// 添加乘机人必填
		$cardId = trim($arr_body["cardId"]);													// 添加乘机人必填
		$phoneNumber = trim($arr_body["phoneNumber"]);											// 添加联系人必填
		$passengerType = intval($arr_body["passengerType"]);									// 添加乘机人必填
		
		if($cardId != "")
		{
			// 添加乘机人
			$sql = "INSERT ignore INTO ctrip_airticket_passenger (user_id, name, card_type, card_id, phone, gender, type) VALUES ('$authorid', '$name', '$cardType', '$cardId', '$phoneNumber', 'M', '$passengerType')";
		}
		else if($phoneNumber != "")
		{
			// 添加联系人
			$sql = "INSERT ignore INTO ctrip_airticket_contacter (user_id, name, phone) VALUES ('$authorid', '$name', '$phoneNumber')";
		}
		else
			ErrorReponse :: reponError(array("retcode" => "200", "retmsg" => "用户输入信息不完整"));
			
		if(isset($sql))
		{
			$sql = auto_charset($sql, 'utf-8', 'gbk');
			$db = new DB_test();
			$result = $db->query($sql);
			if($db->affected_rows() > 0)
			{
				$retcode = "0";
			$arr_message = array("result" => "success", "message" => "信息保存成功");
			}
			else
			{
				$retcode = "200";
			$arr_message = array("result" => "success", "message" => "请勿重复添加信息");
			}
		}
		
		$arr_msg['msgbody']['result'] = $arr_message['result'];
		$arr_msg['msgbody']['message'] = $arr_message['message'];
		$returnvalue = array ("msgbody" => $arr_msg['msgbody']);
		$returnval = TfbxmlResponse :: ResponsetoApp($retcode, $returnvalue);
		return $returnval;
	}
 private function changePayPawdUsingOld($authorid, $aunewpwd, $auoldpwd)
 {
     $logger = Logger::getLogger('AuthorInfo');
     $logger->debug("开始通过旧密码修改登录密码");
     $db = new DB_test();
     $query = "UPDATE tb_author SET fd_author_paypassword = '******' WHERE fd_author_id = '{$authorid}' AND fd_author_paypassword = '******'";
     $logger->debug("sql语句(" . $query . ")");
     $db->query($query);
     $result = $db->affected_rows();
     $logger->debug("sql语句的执行影响了(" . $result . ")条数据");
     if ($result == 1) {
         return true;
     } else {
         if ($result > 1) {
             $logger->ERR("sql语句(" . $query . ")的执行影响了(" . $result . ")条数据");
         }
     }
     return false;
 }