예제 #1
0
    // 解封账号dst
    private OpRes startAcc(DestGmUser dst, GMUser user, ParamStartStopGmAcc p)
    {
        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("state", GmState.STATE_NORMAL, FieldType.TypeNumber);

        if (dst.m_accType == AccType.ACC_GENERAL_AGENCY ||
            dst.m_accType == AccType.ACC_AGENCY ||
            dst.m_accType == AccType.ACC_API)
        {
            string sql = gen.getResultSql(TableName.GM_ACCOUNT,
                                          string.Format(" createCode like '{0}%' ", dst.m_createCode));
            int count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

            // 解封账号之下的玩家
            gen.reset();
            gen.addField("enable", 1, FieldType.TypeNumber);
            sql = gen.getResultSql(TableName.PLAYER_ACCOUNT_XIANXIA,
                                   string.Format(" createCode like '{0}%' ", dst.m_createCode));
            user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);
            return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
        }
        else
        {
            string sql = gen.getResultSql(TableName.GM_ACCOUNT,
                                          string.Format(" acc= '{0}' ", p.m_acc));
            int count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);
            return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
        }
    }
예제 #2
0
    private OpRes updateWashRatio(ParamModifyGmProperty p, DestGmUser dst, GMUser user)
    {
        if (dst.m_owner != user.m_user)
        {
            return(OpRes.op_res_no_right);
        }

        ParamCreateGmAccount param = new ParamCreateGmAccount();

        param.m_washRatio = p.m_param;
        double washRatio = 0;

        if (!ItemHelp.isValidWashRatio(param, user, ref washRatio))
        {
            return(OpRes.op_res_param_not_valid);
        }

        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("washRatio", washRatio, FieldType.TypeNumber);

        string sql   = gen.getResultSql(TableName.GM_ACCOUNT, string.Format(" acc='{0}' ", p.m_acc));
        int    count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
    }
예제 #3
0
    public OpRes dispatch(ParamModifyGmRight p, GMUser user)
    {
        DestGmUser dst = new DestGmUser(p.m_acc, user);

        if (!dst.m_isExists)
        {
            return(OpRes.op_res_no_right);
        }

        bool res = DyOpModifyGmRight.canDispatchRight(user, dst.m_accType,
                                                      () => { return(dst.m_owner == user.m_user); });

        if (!res)
        {
            return(OpRes.op_res_no_right);
        }

        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("gmRight", p.m_right, FieldType.TypeString);
        string sql = gen.getResultSql(TableName.GM_ACCOUNT,
                                      string.Format("acc='{0}'", p.m_acc));
        int count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
    }
예제 #4
0
    // orderState OrderState类型
    public static string genUpdateSql(string orderId, int orderState)
    {
        SqlUpdateGenerator up = new SqlUpdateGenerator();

        up.addField("orderState", orderState, FieldType.TypeNumber);

        string cmd = up.getResultSql(TableName.PLAYER_ORDER_WAIT, string.Format("orderId='{0}' ", orderId));

        return(cmd);
    }
예제 #5
0
 public void addField(HttpRequest Request)
 {
     foreach (var key in Request.QueryString.AllKeys)
     {
         if (DbFieldSet.getInstance().hasField(key))
         {
             m_gen.addField(key, Request.QueryString[key], DbFieldSet.getInstance().getDbField(key).m_fieldType);
         }
     }
 }
예제 #6
0
    // 解封玩家账号
    int startPlayerAcc(ParamPlayerOp p)
    {
        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("enable", 1, FieldType.TypeNumber);
        string sql = gen.getResultSql(TableName.PLAYER_ACCOUNT_XIANXIA,
                                      string.Format(" acc='{0}' ", p.m_playerAcc));
        int count = m_gmUser.sqlDb.executeOp(sql, MySqlDbName.DB_XIANXIA);

        return(count > 0 ? RetCode.RET_SUCCESS : RetCode.RET_DB_ERROR);
    }
예제 #7
0
    OpRes autoForwardOrder(ParamPlayerOrder p, GMUser user)
    {
        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("forwardOrder", p.m_isAutoForward, FieldType.TypeNumber);
        string cond   = string.Format(" acc = '{0}' ", user.m_user);
        string sqlCmd = gen.getResultSql(TableName.GM_ACCOUNT, cond);
        int    count  = user.sqlDb.executeOp(sqlCmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
    }
예제 #8
0
    public override OpRes doDyop(object param, GMUser user)
    {
        ParamModifyGmProperty p   = (ParamModifyGmProperty)param;
        DestGmUser            dst = new DestGmUser(p.m_acc, user);

        if (!dst.m_isExists)
        {
            return(OpRes.op_res_no_right);
        }

        OpRes res   = OpRes.op_res_failed;
        int   count = 0;

        switch (p.m_whichProperty)
        {
        case ParamModifyGmProperty.MODIFY_ALIASNAME:
        {
            if (!dst.isDerivedFrom(user))
            {
                return(OpRes.op_res_no_right);
            }

            SqlUpdateGenerator gen = new SqlUpdateGenerator();
            gen.addField("aliasName", p.m_param, FieldType.TypeString);
            string sql = gen.getResultSql(TableName.GM_ACCOUNT, string.Format(" acc='{0}' ", p.m_acc));
            count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);
            res   = count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed;
        }
        break;

        case ParamModifyGmProperty.MODIFY_AGENT_RATION:
        {
            res = updateAgentRatio(p, dst, user);
        }
        break;

        case ParamModifyGmProperty.MODIFY_WASH_RATION:
        {
            res = updateWashRatio(p, dst, user);
        }
        break;

        case ParamModifyGmProperty.MODIFY_ACC_STATE:
        {
            res = modifyAccState(p, user);
        }
        break;
        }
        return(res);
    }
예제 #9
0
    private void save(string key)
    {
        long cur = m_count[key];

        m_count[key] = cur + 1;
        MySqlDb sql = new MySqlDb();

        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("curValue", cur + 1, FieldType.TypeNumber);

        string cmd = gen.getResultSql(TableName.CREATE_CONFIG, string.Format("appType='{0}' ", key));

        sql.executeOp(cmd, 0, MySqlDbName.DB_XIANXIA);
    }
예제 #10
0
    // 修改玩家别名
    public OpRes modifyPlayerAliasName(string acc, string newName, GMUser user)
    {
        if (!canOpPlayer(acc, user))
        {
            return(OpRes.op_res_no_right);
        }

        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("aliasName", newName, FieldType.TypeString);
        string cmd = gen.getResultSql(TableName.PLAYER_ACCOUNT_XIANXIA,
                                      string.Format("acc='{0}'", acc));

        int count = user.sqlDb.executeOp(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
    }
예제 #11
0
    bool updateChildNodeNumber(GMUser user, CreateInfo info)
    {
        GMUser dstUser = AccountSys.getInstance().getUser(info.m_acc);

        if (dstUser != null)
        {
            dstUser.m_childCount++;
        }

        info.m_childCount++;
        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("childNodeNumber", info.m_childCount, FieldType.TypeNumber);
        string sqlCmd = gen.getResultSql(TableName.GM_ACCOUNT, string.Format(" acc='{0}' ", info.m_acc));
        int    count  = user.sqlDb.executeOp(sqlCmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0);
    }
        protected void onModifyHome(object sender, EventArgs e)
        {
            GMUser             user = (GMUser)Session["user"];
            SqlUpdateGenerator gen  = new SqlUpdateGenerator();

            gen.addField("home", m_home.Text, FieldType.TypeString);
            string sql = gen.getResultSql(TableName.GM_ACCOUNT, string.Format(" acc='{0}' ", m_acc.Text));

            int count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

            if (count > 0)
            {
                m_res.InnerText = OpResMgr.getInstance().getResultString(OpRes.opres_success);
            }
            else
            {
                m_res.InnerText = OpResMgr.getInstance().getResultString(OpRes.op_res_db_failed);
            }
        }
예제 #13
0
    public override OpRes doDyop(object param, GMUser user)
    {
        if (!user.isAPIAcc())
        {
            return(OpRes.op_res_no_right);
        }

        string gameCloseList = (string)param;
        string gameList      = ItemHelp.getReverseGameList(gameCloseList);

        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("gameClose", gameList, FieldType.TypeString);
        string sql = gen.getResultSql(TableName.GM_ACCOUNT,
                                      string.Format("acc='{0}'", user.m_user));
        int count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
    }
예제 #14
0
    private OpRes delGmAcc(ParamDelAcc p, GMUser user)
    {
        DestGmUser dst = new DestGmUser(p.m_acc, user);

        if (dst.m_isSelf)
        {
            return(OpRes.op_res_no_right);
        }

        if (!dst.m_isExists)
        {
            return(OpRes.op_res_no_right);
        }

        if (!dst.isDerivedFrom(user))
        {
            return(OpRes.op_res_no_right);
        }

        int childCount = (int)user.sqlDb.getRecordCount(TableName.GM_ACCOUNT,
                                                        string.Format("owner='{0}' ", dst.m_owner), 0, MySqlDbName.DB_XIANXIA);
        SqlUpdateGenerator up = new SqlUpdateGenerator();

        up.addField("childNodeNumber", childCount, FieldType.TypeNumber);
        string sql   = up.getResultSql(TableName.GM_ACCOUNT, string.Format("acc='{0}' and childNodeNumber=0 ", dst.m_owner));
        int    count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        if (count >= 0)
        {
            SqlDeleteGenerator gen  = new SqlDeleteGenerator();
            string             cmd1 = gen.getResultSql(TableName.GM_ACCOUNT,
                                                       string.Format(" createCode like '{0}%' ", dst.m_createCode));
            user.sqlDb.executeOp(cmd1, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

            string cmd2 = gen.getResultSql(TableName.PLAYER_ACCOUNT_XIANXIA,
                                           string.Format(" createCode like '{0}%' ", dst.m_createCode));
            count = user.sqlDb.executeOp(cmd2, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

            return(count >= 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
        }

        return(OpRes.op_res_db_failed);
    }
예제 #15
0
    /*
     *      gm给玩家上分,先扣gm的钱,若订单处理失败,需要把钱返还gm
     *      gm给玩家下分,先处理订单,若订单处理成功,则需要给gm钱
     */
    private void returnMoneyToGM(OrderInfo info)
    {
        if (info.m_gmAcc == "admin") // 操作者是管理员,不用返还
        {
            return;
        }

        long retMoney = 0;

        switch (info.m_orderState)
        {
        case PlayerReqOrderState.STATE_FINISH:     // 处理成功了,若是下分,需要返还
        {
            if (!ScropOpType.isAddScore(info.m_orderType))
            {
                retMoney = info.m_money;
            }
        }
        break;

        case PlayerReqOrderState.STATE_FAILED:     // 处理失败了,若是上分,需要返还
        {
            if (ScropOpType.isAddScore(info.m_orderType))
            {
                retMoney = info.m_money;
            }
        }
        break;
        }

        if (retMoney > 0)
        {
            SqlUpdateGenerator up = new SqlUpdateGenerator();
            up.addField("money",
                        string.Format("money+{0}", retMoney),
                        FieldType.TypeNumber);

            // 可以通知到web后台
            string cmd = up.getResultSql(TableName.GM_ACCOUNT, string.Format("acc='{0}'", info.m_gmAcc));
            m_sqlDb.executeOp(cmd, CMySqlDbName.DB_XIANXIA);
        }
    }
예제 #16
0
    public override OpRes doDyop(object param, GMUser user)
    {
        ParamModifyGmRight p = (ParamModifyGmRight)param;

        if (p.m_op == 1)
        {
            return(dispatch(p, user));
        }

        DestGmUser dst = new DestGmUser(p.m_acc, user);

        if (!dst.m_isExists)
        {
            return(OpRes.op_res_no_right);
        }

        if (!dst.isDerivedFrom(user))
        {
            return(OpRes.op_res_no_right);
        }

        if (!dst.isAccType(AccType.ACC_AGENCY) &&
            !dst.isAccType(AccType.ACC_GENERAL_AGENCY) &&
            !dst.isAccType(AccType.ACC_SUPER_ADMIN_SUB))
        {
            return(OpRes.op_res_no_right);
        }

        SqlUpdateGenerator gen = new SqlUpdateGenerator();

        gen.addField("gmRight", p.m_right, FieldType.TypeString);
        string sql = gen.getResultSql(TableName.GM_ACCOUNT,
                                      string.Format("acc='{0}'", p.m_acc));
        int count = user.sqlDb.executeOp(sql, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        return(count > 0 ? OpRes.opres_success : OpRes.op_res_db_failed);
    }
예제 #17
0
    public bool insertData(string playerAcc, DateTime now)
    {
        ResultStatWinLose result = (ResultStatWinLose)m_stat.getStatResult();

        if (result.empty())
        {
            //LogMgr.log.InfoFormat("{0}, {1}, 数据空", now, playerAcc);
            return(true);
        }

        int count = 0;
        // string playerAcc = Convert.ToString(exitGamePlayer["playerAcc"]);

        //DateTime now = DateTime.Now.Date;
        string cond = string.Format(" date='{0}' and playerAcc='{1}' ", now.Date.ToString(ConstDef.DATE_TIME24),
                                    playerAcc);
        // 判定当天的记录是否存在
        bool exists = m_sqlDb.keyExists(TableName.PLAYER_WIN_LOSE, cond, MySqlDbName.DB_XIANXIA);

        if (exists) // 该玩家当天记录存在,更新
        {
            SqlUpdateGenerator gen = new SqlUpdateGenerator();
            gen.addField("playerOutlay", string.Format("playerOutlay+{0}", result.m_playerOutlay), FieldType.TypeNumber);
            gen.addField("playerIncome", string.Format("playerIncome+{0}", result.m_playerIncome), FieldType.TypeNumber);
            gen.addField("washCount", string.Format("washCount+{0}", result.m_washCount), FieldType.TypeNumber);
            string sql = gen.getResultSql(TableName.PLAYER_WIN_LOSE, cond);
            count = m_sqlDb.executeOp(sql, MySqlDbName.DB_XIANXIA);
        }
        else // 插入一条新的记录
        {
            string createCode = null;
            string creator    = null;
            string sql        = string.Format("select createCode, creator from {0} where acc='{1}' ",
                                              TableName.PLAYER_ACCOUNT_XIANXIA, playerAcc);

            Dictionary <string, object> data = m_sqlDb.queryOne(sql, MySqlDbName.DB_XIANXIA);
            if (data != null)
            {
                creator    = Convert.ToString(data["creator"]);
                createCode = Convert.ToString(data["createCode"]);
            }
            else
            {
                createCode = "noPlayer";
                creator    = "noPlayer";
            }

            SqlInsertGenerator gen = new SqlInsertGenerator();
            gen.addField("date", now.Date.ToString(ConstDef.DATE_TIME24), FieldType.TypeString);
            gen.addField("playerAcc", playerAcc, FieldType.TypeString);
            gen.addField("playerCreator", creator, FieldType.TypeString);
            gen.addField("playerCreateCode", createCode, FieldType.TypeString);
            gen.addField("playerOutlay", result.m_playerOutlay, FieldType.TypeNumber);
            gen.addField("playerIncome", result.m_playerIncome, FieldType.TypeNumber);
            gen.addField("washCount", result.m_washCount, FieldType.TypeNumber);
            sql   = gen.getResultSql(TableName.PLAYER_WIN_LOSE);
            count = m_sqlDb.executeOp(sql, MySqlDbName.DB_XIANXIA);
        }

        return(count > 0);
    }
예제 #18
0
    // 返回处理后订单的新状态
    public int process(OrderInfo info)
    {
        if (info.m_money <= 0)
        {
            info.m_failReason = RetCode.RET_MONEY_NOT_VALID;
            return(PlayerReqOrderState.STATE_FAILED);
        }

        bool exist = query(info.m_playerAcc);

        if (!exist)
        {
            info.m_failReason = RetCode.RET_NO_PLAYER;
            return(PlayerReqOrderState.STATE_FAILED);
        }

        Dictionary <string, object> data =
            MongodbPlayer.Instance.ExecuteGetBykey(TableName.PLAYER_INFO, "account", info.m_playerAcc, new string[] { "SyncLock" });

        if (data == null)
        {
            info.m_failReason = RetCode.RET_NO_PLAYER;
            return(PlayerReqOrderState.STATE_FAILED);
        }

        if (data.ContainsKey("SyncLock"))
        {
            int LockS = Convert.ToInt32(data["SyncLock"]);
            if (LockS == 2) // 玩家被锁了
            {
                info.m_failReason = RetCode.RET_PLYAER_LOCKED;
                return(PlayerReqOrderState.STATE_FAILED);
            }
        }

        if (m_state == PlayerState.STATE_GAME) // 订单返回到这里,发现玩家又上线了,订单重发。
        {
            info.m_failReason = RetCode.RET_PLYAER_LOCKED;
            return(PlayerReqOrderState.STATE_WAIT);
        }

        SqlUpdateGenerator up = new SqlUpdateGenerator();

        switch (info.m_orderType)
        {
        case ScropOpType.ADD_SCORE:     // 上分订单
        {
            up.addField("money",
                        string.Format("money+{0}", info.m_money),
                        FieldType.TypeNumber);
        }
        break;

        case ScropOpType.EXTRACT_SCORE:     // 下分订单
        {
            if (m_money < info.m_money)
            {
                info.m_failReason = RetCode.RET_MONEY_NOT_ENOUGH;
                return(PlayerReqOrderState.STATE_FAILED);
            }

            up.addField("money",
                        string.Format("money-{0}", info.m_money),
                        FieldType.TypeNumber);
        }
        break;
        }

        // 可以通知到web后台
        string cmd = up.getResultSql(TableName.PLAYER_ACCOUNT_XIANXIA,
                                     string.Format("acc='{0}' and state={1} ", info.m_playerAcc, PlayerState.STATE_IDLE));

        int count = m_sqlDb.executeOp(cmd, CMySqlDbName.DB_XIANXIA);

        if (count > 0)
        {
            info.m_playerRemainMoney = getRemainMoney(info.m_playerAcc);
            return(PlayerReqOrderState.STATE_FINISH);
        }

        info.m_failReason = RetCode.RET_DB_ERROR;
        return(PlayerReqOrderState.STATE_FAILED);
    }