Ejemplo n.º 1
0
 public function InsertCharacterKickOff($KickOffArr)
 {
     $this->db->begin();
     $position = Base_Common::getUserDataPositionById($KickOffArr['UserId']);
     $table_user = Base_Common::getUserTable($this->character_kick_off, $position);
     $user = $this->db->insert($table_user, $KickOffArr);
     $Date = date("Ym", $KickOffArr['KickOffTime']);
     $table_date = $this->CreateCharacterKickOffLog($Date);
     $oSocketType = @(include __APP_ROOT_DIR__ . "/etc/SocketType.php");
     $oSocketQueue = new Config_SocketQueue();
     $uType = 60221;
     $TypeInfo = $oSocketType[$uType];
     if ($TypeInfo['Type']) {
         $DataArr = array('PackFormat' => $TypeInfo['PackFormat'], 'Length' => $TypeInfo['Length'], 'Length2' => 0, 'uType' => $uType, 'MsgLevel' => 0, 'Line' => 0, 'UserID' => $KickOffArr['UserId'], 'KickOffReason' => $KickOffArr['KickOffReason'], 'Serial' => $KickOffArr['KickOffId']);
     }
     $DataArr = array('ServerId' => $KickOffArr['ServerId'], 'uType' => $uType, 'UserId' => $DataArr['UserID'], 'MessegeContent' => serialize($DataArr), 'QueueTime' => time(), 'SendTime' => 0);
     $addQueue = $oSocketQueue->insert($DataArr);
     $log = $this->db->insert($table_date, $KickOffArr);
     if ($user && $log && $addQueue) {
         $this->db->commit();
         return true;
     } else {
         $this->db->rollBack();
         return false;
     }
 }
Ejemplo n.º 2
0
 public function getItemPickUpCount($StartTime, $EndTime, $UserId, $ServerId, $oWherePartnerPermission, $ItemListText)
 {
     //查询列
     $select_fields = array('PickUpCount' => 'count(*)');
     //初始化查询条件
     $whereStartTime = $StartTime ? " ItemPickUpTime >= '" . strtotime($StartTime) . "' " : "";
     $whereEndTime = $EndTime ? " ItemPickUpTime <= '" . strtotime($EndTime) . "' " : "";
     $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
     $whereItemID = $ItemListText ? " ItemID in ( " . $ItemListText . " )" : "";
     $whereUser = $UserId ? " UserId = " . $UserId . " " : "";
     $whereCondition = array($whereStartTime, $whereEndTime, $whereUser, $whereServer, $oWherePartnerPermission, $whereItemID);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     if ($UserId) {
         $position = Base_Common::getUserDataPositionById($UserId);
         $table_to_process = Base_Common::getUserTable($this->table_list['pickitem_user'], $position);
     } else {
         $Date = date("Ymd", strtotime($StartTime));
         $table_to_process = Base_Widget::getDbTable($this->table_list['pickitem']) . "_" . $Date;
     }
     $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where;
     $PickUpCount = $this->db->getOne($sql, false);
     if ($PickUpCount) {
         return $PickUpCount;
     } else {
         return 0;
     }
 }
Ejemplo n.º 3
0
 public function getPvpLogTotal($whereTime)
 {
     $table_to_process = Base_Widget::getDbTable($this->table_pvp_log_total);
     $sql = "truncate {$table_to_process}";
     $this->db->query($sql);
     for ($i = 0; $i <= 255; $i++) {
         $position = Base_Common::getUserDataPositionById(sprintf("%03d", $i));
         $table_to_get = Base_Common::getUserTable($this->table_pvp_log_user, $position);
         $sql = "replace into {$table_to_process} (ServerId,UserId,Won,PvpCount) select ServerId,UserId,Won,Count(*) from {$table_to_get} where {$whereTime} group by ServerId,UserId,Won";
         echo $this->db->query($sql) . "-";
     }
 }
Ejemplo n.º 4
0
 public function asignProductPackCode($UserName, $unsignedCode)
 {
     $oUser = new Lm_User();
     $UserInfo = $oUser->getUserByName($UserName);
     if ($UserInfo['UserId']) {
         if ($unsignedCode['ProductPackCode']) {
             $PackInfo = $this->getRow($unsignedCode['ProductPackId']);
             $CodeCount = $this->getUserProductPackCodeListCount($UserInfo['UserId'], 0, 0, $unsignedCode['GenId']);
             if ($CodeCount < $PackInfo['AsignCountLimit']) {
                 $this->db->begin();
                 $unsignedCode['AsignTime'] = time();
                 $unsignedCode['AsignUser'] = $UserInfo['UserId'];
                 $position = Base_Common::getUserDataPositionById($UserInfo['UserId']);
                 $table_user = Base_Common::getUserTable($this->table_code, $position);
                 $user = $this->db->replace($table_user, $unsignedCode);
                 $table_code = Base_Widget::getDbTable($this->table_code);
                 $bind = $unsignedCode;
                 unset($bind['ProductPackCode']);
                 $code = $this->db->update($table_code, $bind, '`ProductPackCode` = ?', $unsignedCode['ProductPackCode']);
                 if ($code && $user) {
                     $this->db->commit();
                     return true;
                 } else {
                     $this->db->rollback();
                     return false;
                 }
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 5
0
 public function getSendErrorList($UserId, $SendId, $fields = '*')
 {
     $position = Base_Common::getUserDataPositionById($UserId);
     $table_user = Base_Common::getUserTable($this->table_send_log_user, $position);
     $sql = "select {$fields} from {$table_user} where `SendStatus` = 2 and `UserId` = ? and `SendId` = ?";
     return $this->db->getAll($sql, array($UserId, $SendId));
 }
Ejemplo n.º 6
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);
 }