Exemple #1
0
    // 是否可以对GM账号进行上分下分操作
    private OpRes canDoScoreToGM(string acc, long score, bool isAddScore, GMUser user)
    {
        DestGmUser dstUser = new DestGmUser(acc, user);

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

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

        if (dstUser.isAccStop())
        {
            return(OpRes.op_res_acc_block);
        }

        if (!isAddScore)
        {
            if (dstUser.m_money < score)
            {
                return(OpRes.op_res_money_not_enough);
            }
        }
        return(OpRes.opres_success);
    }
Exemple #2
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);
    }
Exemple #3
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);
    }
Exemple #4
0
    public override OpRes doDyop(object param, GMUser user)
    {
        ParamStartStopGmAcc p   = (ParamStartStopGmAcc)param;
        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 (p.isStart())
        {
            return(startAcc(dst, user, p));
        }

        return(stopAcc(dst, user, p));
    }
Exemple #5
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);
    }