Ejemplo n.º 1
0
        /// <summary>
        /// 添加点券
        /// </summary>
        /// <param name="bond"></param>
        /// <param name="eType"></param>
        /// <param name="des"></param>
        /// <returns></returns>
        public bool AddBond(int bond, FinanceType ft, string remark = null)
        {
            if (bond != 0)
            {
                BsonDocument modified = PlayerAccess.Instance.SafeUpdate(_id, "Bond", bond);
                if (modified == null)
                {
                    return false;
                }
                long newBond = Convert.ToInt64(modified["Bond"]);
                this.Bond = newBond;
                Variant v = new Variant(2);
                v.Add("Bond", this.Bond);

                this.UpdataActorR(v);
                //写日志
                PayLog log = new PayLog(ServerLogger.zoneid, Actiontype.Bond);
                log.modifyfee = bond;
                log.totalfee = newBond;
                log.toopenid = UserID;
                log.touid = PID;
                log.reserve_1 = (int)ft;
                log.remark = remark;
                this.WriteLog(log);
            }
            return true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加晶币
        /// </summary>
        /// <param name="coin"></param>
        /// <param name="ft"></param>
        /// <returns></returns>
        public bool AddCoin(int coin, FinanceType ft, string remark = null)
        {
            BsonDocument modified = PlayerAccess.Instance.UpdateFinance(_id, coin);
            if (modified == null)
            {
                return false;
            }
            Int64 newCoin = Convert.ToInt64(modified["Coin"]);
            this.Coin = newCoin;

            if (coin == 0)
            {
                //更新值
                return true;
            }

            if (coin < 0)
            {
                this.GCE = Convert.ToInt64(modified["GCE"]);
            }
            else
            {
                this.GCI = Convert.ToInt64(modified["GCI"]);
            }
            Variant v = new Variant(2);
            v.Add("Coin", this.Coin);
            UpdataActorR(v);
            //写日志
            PayLog log = new PayLog(ServerLogger.zoneid, Actiontype.Consumption);
            log.modifycoin = coin;
            log.totalcoin = newCoin;
            log.toopenid = UserID;
            log.touid = PID;
            log.reserve_1 = (int)ft;
            log.remark = remark;
            this.WriteLog(log);
            if (coin > 0)
            {
                this.FinishNote(FinishCommand.MaxMoney, coin, 0);
            }
            else
            {
                //发送消费通知
                UserNote note2 = new UserNote(this, SocialCommand.ConsumeCoin, new object[] { coin, ft });
                Sinan.Observer.Notifier.Instance.Publish(note2);
            }
            return true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加游戏币
        /// </summary>
        /// <param name="score"></param>
        /// <param name="ft"></param>
        /// <returns></returns>
        public bool AddScore(int score, FinanceType ft, string remark = null)
        {
            if (score != 0)
            {
                BsonDocument modified = PlayerAccess.Instance.SafeUpdate(_id, "Score", score);
                if (modified == null)
                {
                    return false;
                }
                Int64 newScore = Convert.ToInt64(modified["Score"]);
                this.Score = newScore;
                Variant v = new Variant(2);
                v.Add("Score", this.Score);
                this.UpdataActorR(v);
                //写日志
                PayLog log = new PayLog(ServerLogger.zoneid, Actiontype.Score);
                log.modifyfee = score;
                //log.modifycoin = coin;
                //log.totalcoin = this.Coin;
                log.totalfee = newScore;
                log.toopenid = UserID;
                log.touid = PID;
                log.reserve_1 = (int)ft;
                log.remark = remark;
                this.WriteLog(log);

                if (score > 0)
                {
                    this.FinishNote(FinishCommand.MaxMoney, 0, score);
                }
            }
            return true;
        }