Ejemplo n.º 1
0
 public function resetMail($UserId)
 {
     $this->db->begin();
     $UserCommunication = $this->GetUserCommunication($UserId);
     $UserMail = $UserCommunication['UserMail'];
     $updateMail = $this->updateUserCommunication($UserId, array('UserMail' => ''));
     $position = Base_Common::getUserDataPositionByName($UserMail);
     $table_to_delete = Base_Common::getUserTable($this->table_mail, $position);
     $deleteMail = $this->db->delete($table_to_delete, '`UserId`=? and `UserMail`=?', array($UserId, $UserMail));
     if ($updateMail && $deleteMail) {
         $this->db->commit();
         return true;
     } else {
         $this->db->rollback();
         return false;
     }
 }
Ejemplo n.º 2
0
 public function getCharacterInfoByCharacter($CharacterName, $ServerId, $fields = '*')
 {
     $position = Base_Common::getUserDataPositionByName($CharacterName);
     $table_to_process = Base_Common::getUserTable($this->table_character, $position);
     if ($ServerId) {
         $sql = "select {$fields} from {$table_to_process} where `CharacterName` = ? and `ServerId` = ?";
         return $this->db->getAll($sql, array($CharacterName, $ServerId));
     } else {
         $sql = "select {$fields} from {$table_to_process} where `CharacterName` = ?";
         return $this->db->getAll($sql, $CharacterName);
     }
 }
Ejemplo n.º 3
0
 public function LogoutByTime($DataArr, $UserName)
 {
     $this->db->begin();
     $Date = date("Ym", $DataArr['LoginTime']);
     $bind = array('LogoutTime' => $DataArr['LogoutTime']);
     $LoginTime = $DataArr['LoginTime'];
     unset($DataArr['LoginTime']);
     $table_to_update = Base_Widget::getDbTable($this->table_date);
     $table_to_update .= "_" . $Date;
     $param = array($DataArr['UserId'], $DataArr['ServerId'], $LoginTime);
     $date = $this->db->update($table_to_update, $bind, '`LogoutTime` = 0 and `UserId` = ? and `ServerId` = ? and `LoginTime` = ?', $param);
     $position = Base_Common::getUserDataPositionByName($UserName);
     $table_to_update = Base_Widget::getDbTable($this->table_user) . "_" . $position['db_fix'];
     $user = $this->db->update($table_to_update, $bind, '`LogoutTime` = 0 and `UserId` = ? and `ServerId` = ? and `LoginTime` = ?', $param);
     if ($date && $user) {
         $this->db->commit();
         $LoginLog = $this->getLoginLogByTime($DataArr['UserId'], $DataArr['ServerId'], $LoginTime);
         $LoginLog['LoginId'] = $LoginLog['LoginId'] . $Date;
         $last_table = Base_Widget::getDbTable($this->table_last);
         $last = $this->db->replace($last_table, $LoginLog);
         $Online = $this->getLogOnlineDate($LoginLog);
         return true;
     } else {
         $this->db->rollback();
         return false;
     }
 }
Ejemplo n.º 4
0
 public function DelUserMailAndCommunication($UserArr)
 {
     $table_communication = "user_info_communication";
     $table_mail = "user_mail";
     $delCommunicationCount = $delMailCount = 0;
     $UpComCount = $UpMailCount = 0;
     $table_to_update = Base_Widget::getDbTable($this->table_del);
     $CommunicationArr = array("Communication" => 1);
     $MailArr = array("Mail" => 1);
     foreach ($UserArr as $k => $v) {
         $position = Base_Common::getUserDataPositionByName($v["UserName"]);
         $table_to_communication = Base_Common::getUserTable($table_communication, $position);
         $sql = "SELECT UserMail from {$table_to_communication} WHERE `UserId`=" . $v["UserId"];
         $Usermail = $this->db->getOne($sql);
         if ($Usermail) {
             //user_mail表是通过mail来定位的
             $position = Base_Common::getUserDataPositionByName($Usermail);
             $table_to_mail = Base_Common::getUserTable($table_mail, $position);
             if ($this->db->delete($table_to_mail, '`UserId` = ?', $v["UserId"])) {
                 if ($this->db->update($table_to_update, $MailArr, '`UserId` = ?', $v["UserId"])) {
                     $UpMailCount++;
                 }
                 $delMailCount++;
             }
         }
         if ($this->db->delete($table_to_communication, '`UserId` = ?', $v["UserId"])) {
             if ($this->db->update($table_to_update, $CommunicationArr, '`UserId` = ?', $v["UserId"])) {
                 $UpComCount++;
             }
             $delCommunicationCount++;
         }
     }
     return array("DelMailCount" => $delMailCount, "DelCommunicationCount" => $delCommunicationCount, "UpMailCount" => $UpMailCount, "UpComCount" => $UpComCount);
 }