Пример #1
0
 public function AddPurchase($storeID, $remark, $ary = array())
 {
     if (!isset($_SESSION['account_ID'])) {
         return new ExcuteResult(ResultStateLevel::ERROR, "账号已登出,请重新登录", "-1");
     }
     $account_id = $_SESSION['account_ID'];
     $purchaseID = sql_fetch_one_cell("SELECT IFNULL(MAX(purchase_id), 0) + 1 FROM bm_purchase_list;");
     $sql = "INSERT INTO bm_purchase_list(purchase_id,account_id,shop_id,add_time,purchase_state,return_time,purchase_price,purchase_remark)" . " VALUES ('{$purchaseID}','{$account_id}','{$storeID}',UNIX_TIMESTAMP(),0,0,0,'{$remark}')";
     $r = sql_query($sql);
     if ($r != 0) {
         return self::AddPurchaseInfo($purchaseID, $ary);
     } else {
         return new ExcuteResult(ResultStateLevel::EXCEPTION, "执行出错" . $r, $sql);
     }
 }
Пример #2
0
 /**
  * 获取受到服务器特殊限制的功能模块
  */
 public function ListServerMoudule($offer, $pageSize)
 {
     $sql = sprintf("SELECT * FROM bm_module where bm_ModuleState  = 3 ORDER BY bm_ModuleID DESC LIMIT {$offer}, {$pageSize}");
     $r = sql_fetch_rows($sql);
     if (!empty($r)) {
         $o = array();
         for ($i = 0; $i < $count; $i++) {
             $moduleMDL = $r[$i];
             $moduleMDL = new ModuleMDL($moduleMDL[0], $moduleMDL[1], $moduleMDL[2], $moduleMDL[3], $moduleMDL[4], $moduleMDL[5], $moduleMDL[6], $moduleMDL[7], $moduleMDL[8]);
             $o[] = $moduleMDL;
         }
         $count = sql_fetch_one_cell("SELECT COUNT(*) as num FROM bm_module where bm_ModuleState  = 3 ");
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $ary);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
     }
 }
Пример #3
0
 public function ListGoods($lv, $type3_id, $brand_id, $offer, $pageSize)
 {
     $brand_id = intval($brand_id);
     if ($brand_id > 0) {
         $where = sprintf(" a.brand_id = %d  and  ", $brand_id);
     } else {
         $where = "";
     }
     if ($lv == "1") {
         $from = " bm_goods a, bm_goods_type3 b, bm_goods_type2 c ";
         $where = $where . "c.type1_id = " . $type3_id . " and c.type2_id = b.type2_id and b.type3_id = a.type3_id and goods_state < 99 ";
     } else {
         if ($lv == "2") {
             $from = " bm_goods a, bm_goods_type3 b";
             $where = $where . "b.type2_id  = " . $type3_id . " and b.type3_id = a.type3_id and goods_state < 99 ";
         } else {
             if ($lv == "3") {
                 $from = " bm_goods a";
                 $where = $where . " a.type3_id  = " . $type3_id . "  and goods_state < 99 ";
             } else {
                 $from = " bm_goods a";
                 $where = $where . "goods_state < 99 ";
             }
         }
     }
     $sql = "SELECT a.* FROM" . $from . " where " . $where . "ORDER BY goods_id DESC LIMIT " . $offer . "," . $pageSize;
     $r = sql_fetch_rows($sql);
     if (!empty($r)) {
         $o = array();
         $count = count($r);
         for ($i = 0; $i < $count; $i++) {
             $goodsMDL = $r[$i];
             $goodsMDL = new GoodsMDL($goodsMDL[0], $goodsMDL[1], $goodsMDL[2], $goodsMDL[3], $goodsMDL[4], $goodsMDL[5], $goodsMDL[6], $goodsMDL[7], $goodsMDL[8], $goodsMDL[9], $goodsMDL[10], $goodsMDL[11], $goodsMDL[12], $goodsMDL[13], $goodsMDL[14], $goodsMDL[15]);
             $o[] = $goodsMDL;
         }
         $count = sql_fetch_one_cell("SELECT count() FROM " . $from . " where " . $where . ";");
         //return new DataResult(ResultStateLevel::ERROR,"0",$sql,NULL);
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $o);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
     }
 }
 /**
  * 获取卡批次列表
  * @param unknown_type $FormName 卡申请单名称
  * @param unknown_type $offer
  * @param unknown_type $pageSize
  */
 public function ListCardGroup($FormName, $offer, $pageSize)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['account_ID'])) {
         return new DataResult(ResultStateLevel::ERROR, "账号已登出,请重新登录", "-1", NULL);
     }
     $sql = "SELECT b.cd_CAFormName,b.cd_CardApplyer,b.cd_CAFormChecker,b.cd_CardPicker,a.*,c.cd_CardTypeName";
     $sql .= " FROM CD_CardGroup a,CD_CardApplyForm b,CD_CardType c";
     $sql .= " WHERE a.cd_CAFormID = b.cd_CAFormID AND a.cd_CardTypeID = c.cd_CardTypeID AND b.cd_CAFormName like '%" . $FormName . "%'  ORDER BY cd_Createtime DESC LIMIT {$offer}, {$pageSize}";
     $r = sql_fetch_rows($sql);
     if (!empty($r)) {
         $ary = array();
         foreach ($r as $k => $v) {
             $cardGroupMDL = new CardGroupMDL($v[4], $v[5], $v[6], $v[7], $v[8], $v[9], $v[10], $v[11], $v[12], $v[0], $v[1], $v[2], $v[3], $v[13]);
             $ary[] = $cardGroupMDL;
         }
         $count = sql_fetch_one_cell("SELECT COUNT(1) AS num FROM CD_CardGroup a,CD_CardApplyForm b WHERE a.cd_CAFormID = b.cd_CAFormID AND b.cd_CAFormName like '%" . $FormName . "%'");
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $ary);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
     }
 }
Пример #5
0
 /**
  * 游龙意见收集  暂时放在这里
  * @param $offer
  * @param $pageSize
  * @param $start
  * @param $end
  */
 public function youlongLog($offer, $pageSize, $start, $end)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['account_ID'])) {
         return new DataResult(ResultStateLevel::ERROR, "The accounts have been logged out, please re-login account", "-1", NULL);
     }
     $where = "";
     if (!empty($start) || !empty($end)) {
         $where = " where log_date >= '" . $start . "' AND log_date <='" . $end . "'";
     }
     $sql = "SELECT log_date,log_title,log_remark FROM log_youlong " . $where . " ORDER BY log_date DESC LIMIT {$offer}, {$pageSize}";
     $r = sql_fetch_rows($sql);
     if (!empty($r)) {
         $count = sql_fetch_one_cell("SELECT COUNT(*) as num FROM log_youlong " . $where);
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $r);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
     }
 }
Пример #6
0
/**
 * 插入数据
 * @param $sql
 * @return unknown_type
 */
function sql_insert($sql)
{
    $stime = my_microtime_float();
    sql_query($sql);
    loginfo($stime, $sql);
    return sql_fetch_one_cell('select last_insert_id()');
}
Пример #7
0
 /**
  * 获取申请单列表信息
  * @param unknown_type $areaId
  * @param unknown_type $serverId
  * @param unknown_type $state
  * @param unknown_type $offer
  * @param unknown_type $pageSize
  * 申请单编号=0,服务器ID=1,服务器名称=2,标题=3,详情=4,
  * 发送类型=5 账号=6,账号条件=7,货币=8,道具=9,申请原因=10,申请状态=11
  * 申请时间=12,申请账号=13,审核账号=14,审核说明=15,审核时间=16
  */
 public static function dataMentods_ListApplyItem($areaId, $serverId, $state, $offer, $pageSize)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['user'])) {
         return new ExcuteResult(ResultStateLevel::ERROR, "The accounts have been logged out, please re-login account", "-1");
     }
     $accountName = $_SESSION['user'];
     $accountId = $_SESSION['account_ID'];
     $sql = 'SELECT bm_gameApplayId,a.bm_serverID,bm_serverName,bm_applyTitle,bm_applyDesc,';
     $sql .= ' bm_sendType,bm_sendUser,bm_condition,bm_moneyItem,bm_propItem,bm_applyRemark,bm_applyState,';
     $sql .= ' bm_applyTime,bm_applyAccount,bm_checkAccount,bm_checkRemark,bm_checkTime ';
     $sqlWhere = ' FROM bm_gameapply a,bm_accountgameserver b';
     if ($state == 0) {
         $sqlWhere .= ' WHERE a.bm_serverID = b.bm_ServerID AND b.bm_AccountID = ' . $accountId . ' AND bm_applyState = ' . $state;
     } else {
         $sqlWhere .= ' WHERE a.bm_serverID = b.bm_ServerID AND b.bm_AccountID = ' . $accountId . ' AND bm_applyState >= ' . $state;
     }
     if ($areaId != "") {
         $sqlWhere .= '  AND b.bm_AreaID = ' . $areaId;
     }
     if ($serverId != "") {
         $sqlWhere .= '  AND  b.bm_ServerID IN (' . $serverId . ')';
     }
     $sql .= $sqlWhere . " ORDER BY bm_applyTime DESC LIMIT {$offer}, {$pageSize}";
     $r = sql_fetch_rows($sql);
     if (!empty($r)) {
         $count = sql_fetch_one_cell("SELECT COUNT(*) as num " . $sqlWhere);
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $r);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
     }
 }
Пример #8
0
 /**
  * 道具卡审核(通过)
  * @param unknown_type $FromCardID
  * @param unknown_type $Reamrk
  */
 public function DoPassCardInfo($FromCardID, $Reamrk)
 {
     AddBMAccountEventLog("道具卡申请审核通过订单号:" . $FromCardID . ",审核备注:" . $Reamrk, EventLogTypeEnum::CARDMANAGE);
     if (!isset($_SESSION['account_ID']) || !isset($_SESSION['user'])) {
         return new ExcuteResult(ResultStateLevel::ERROR, "账号已登出,请重新登陆!", "-1");
     }
     $Account = $_SESSION['user'];
     $sql = sprintf("CALL CreateCardGroup(%d,'%s','%s');", $FromCardID, $Account, $Reamrk);
     $r = sql_fetch_one_cell($sql);
     if ($r == 1) {
         return new ExcuteResult(ResultStateLevel::SUCCESS, "", NULL);
     } else {
         return new ExcuteResult(ResultStateLevel::EXCEPTION, "", NULL);
     }
 }
Пример #9
0
 /**
  * 获取卡种类列表 分页
  * @param unknown_type $offer
  * @param unknown_type $pageSize
  * @param unknown_type $cardName
  */
 public function ListCardType($offer, $pageSize, $cardName)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['account_ID'])) {
         return new DataResult(ResultStateLevel::ERROR, "账号已登出,请重新登录", "-1", NULL);
     }
     $where = "";
     if (!empty($cardName)) {
         $where = " AND cd_CardTypeName like '%" . $cardName . "%'";
     }
     $sql = "SELECT * FROM CD_CardType WHERE cd_CardTypeState < 99" . $where . " ORDER BY cd_CardTypeID DESC LIMIT {$offer}, {$pageSize}";
     $r = sql_fetch_rows($sql);
     if (!empty($r)) {
         $ary = array();
         foreach ($r as $k => $v) {
             $cardTypeMDL = new CardTypeMDL($v[0], $v[1], $v[2], $v[3], $v[4], $v[5], $v[6], $v[7]);
             $ary[] = $cardTypeMDL;
         }
         $count = sql_fetch_one_cell("SELECT COUNT(*) as num FROM CD_CardType WHERE cd_CardTypeState < 99 ");
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $ary);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "执行出错", NULL, NULL);
     }
 }
Пример #10
0
 /**
  * 根据条件获取物品列表。物品名称满足模糊查询,物品ID是精确查找
  * @param $offer
  * @param $pageSize
  * @param $GameID
  * @param $itemName
  * @param $type
  */
 public function GetAllGameItemByGameIDUpdate($offer, $pageSize, $GameID, $itemName, $type)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['account_ID'])) {
         return new DataResult(ResultStateLevel::ERROR, "账号已登出,请重新登录", "-1", NULL);
     }
     if ($type == "1") {
         $sql = "SELECT * FROM bm_item WHERE bm_GameID = " . $GameID . " AND bm_ItemGID > 100 AND bm_ItemName like '%" . $itemName . "%' ORDER BY bm_ItemID DESC LIMIT {$offer}, {$pageSize}";
         $r = sql_fetch_rows($sql);
         if (!empty($r)) {
             $ary = array();
             foreach ($r as $k => $v) {
                 $gameItemMDL = new GameItemMDL($v[0], $v[1], $v[2], $v[3], $v[4], $v[5]);
                 $ary[] = $gameItemMDL;
             }
             $count = sql_fetch_one_cell("SELECT COUNT(*) as num FROM bm_item WHERE bm_GameID = " . $GameID . " AND bm_ItemName like '%" . $itemName . "%'");
             return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $ary);
         } else {
             return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
         }
     } else {
         $sql_ = "SELECT * FROM bm_item WHERE bm_GameID = " . $GameID . " AND bm_ItemGID = '" . $itemName . "' ORDER BY bm_ItemID DESC LIMIT {$offer}, {$pageSize}";
         $r_ = sql_fetch_rows($sql_);
         if (!empty($r_)) {
             $ary_ = array();
             foreach ($r_ as $k => $v) {
                 $gameItemMDL_ = new GameItemMDL($v[0], $v[1], $v[2], $v[3], $v[4], $v[5]);
                 $ary_[] = $gameItemMDL_;
             }
             $count_ = sql_fetch_one_cell("SELECT COUNT(*) as num FROM bm_item WHERE bm_GameID = " . $GameID . " AND bm_ItemGID = '" . $itemName . "'");
             return new DataResult(ResultStateLevel::SUCCESS, "1", $count_, $ary_);
         } else {
             return new DataResult(ResultStateLevel::ERROR, "0", $sql, NULL);
         }
     }
 }
Пример #11
0
 /**
  * 服务器列表
  * @param unknown_type $offer
  * @param unknown_type $pageSize
  * @param unknown_type $bm_GameID
  * @param unknown_type $bm_AreaID
  */
 public function gameServList($offer, $pageSize, $bm_GameID = -1, $bm_AreaID = -1)
 {
     $where = "";
     if ($bm_GameID != -1) {
         $where = " AND g.bm_GameID = {$bm_GameID} ";
     }
     if ($bm_AreaID != -1) {
         $where .= " AND a.bm_AreaID = {$bm_AreaID} ";
     }
     $sql = "SELECT s.*, g.bm_GameName, a.bm_AreaName FROM bm_gameserver s LEFT JOIN bm_game g ";
     $sql .= " ON s.bm_GameID = g.bm_GameID LEFT JOIN bm_gamearea a ON a.bm_AreaID = s.bm_AreaID WHERE bm_ServerState != 99 " . $where;
     $sql .= " ORDER BY bm_ServerPRI LIMIT {$offer}, {$pageSize}";
     $rs = sql_fetch_rows($sql);
     if (!empty($rs)) {
         $ary = array();
         foreach ($rs as $k => $v) {
             $bm_Server = new GameServerMDL($v[0], $v[1], $v[2], $v[3], $v[4], json_decode($v[5]), $v[6], $v[7], $v[8], $v[9], $v[10], $v[11], $v[12]);
             $ary[] = $bm_Server;
         }
         $count = sql_fetch_one_cell("SELECT COUNT(*) AS num FROM bm_gameserver WHERE bm_ServerState < 99 " . $where);
         return new DataResult(ResultStateLevel::SUCCESS, "1", $count, $ary);
     } else {
         return new DataResult(ResultStateLevel::ERROR, "0", NULL, NULL);
     }
 }
Пример #12
0
/**
 * 插入数据
 * @param $sql
 * @return unknown_type
 */
function sql_insert($sql)
{
    sql_query($sql);
    return sql_fetch_one_cell('select last_insert_id()');
}
Пример #13
0
 /**
  * 修改密码
  * @param unknown_type $accountID
  * @param unknown_type $oldPwd
  * @param unknown_type $newPwd
  */
 public function EditPassWord($oldPwd, $newPwd)
 {
     AddBMAccountEventLog("修改账号密码,原先密码:" . $oldPwd, EventLogTypeEnum::BASEMANGE);
     if ($newPwd == "a00000") {
         return new ExcuteResult(ResultStateLevel::ERROR, "密码不能修改成初始化密码", NULL);
     }
     if (!isset($_SESSION['account_ID'])) {
         return new ExcuteResult(ResultStateLevel::ERROR, "账号已登出,请重新登录", "-1");
     }
     $accountID = $_SESSION['account_ID'];
     $sqlCheck = "SELECT bm_AccountID FROM bm_account WHERE account_id = " . $accountID . " AND account_pasword = '" . md5($oldPwd) . "'";
     $check = sql_fetch_one_cell($sqlCheck);
     if ($check == "") {
         return new ExcuteResult(ResultStateLevel::EXCEPTION, "原密码不正确", NULL);
     }
     $password = md5($newPwd);
     $sql = "UPDATE bm_account SET account_pasword = '" . $password . "' WHERE account_id = {$accountID}";
     $r = sql_query($sql);
     if ($r != 0) {
         $tag = $oldPwd == "a00000" ? true : false;
         return new ExcuteResult(ResultStateLevel::SUCCESS, "", $tag);
     } else {
         return new ExcuteResult(ResultStateLevel::EXCEPTION, "执行出错", NULL);
     }
 }
Пример #14
0
require_once DATACONTROL . '/BMAccount/EventLog.php';
require_once 'UtilsProvider.php';
$cardSN = '';
$userName = '';
$ip = '';
$serverId = 0;
if (isset($_GET['cardSN']) && isset($_GET['userName']) && isset($_GET['ip']) && isset($_GET['serverId'])) {
    $cardSN = $_GET['cardSN'];
    $userName = $_GET['userName'];
    $ip = $_GET['ip'];
    $serverId = $_GET['serverId'];
    $sql = sprintf("CALL CheckCard('%s','%s','%s',%d);", $cardSN, $userName, $ip, $serverId);
    $r = sql_fetch_one_cell($sql);
} else {
    $r = 0;
}
if ($r > 0) {
    $result = UtilsProvider::dataMentods_sendCardItem($r, $userName, $serverId);
    if ($result->Success) {
        $sql = sprintf("CALL ChargeCard('%s','%s','%s',%d);", $cardSN, $userName, $ip, $serverId);
        $r = sql_fetch_one_cell($sql);
        echo 1;
    } else {
        $sql = sprintf("CALL BreakCard('%s','%s',%d);", $cardSN, $userName, $serverId);
        $r = sql_fetch_one_cell($sql);
        echo 0;
        //echo json_encode($result);
    }
} else {
    echo 0;
}