Example #1
0
        public override void SendCommand(EasyClientBase session, PackageInfo packageinfo)
        {
            AddFriendPackage p = packageinfo as AddFriendPackage;

            Util.Helpers.Async.Run(async() => await DAL.DALUserInfoHelper.InsertOrUpdateItem(p));
            base.SendCommand(session, packageinfo);
        }
Example #2
0
        public static async Task InsertOrUpdateItem(AddFriendPackage package)
        {
            var item = await SDKProperty.SQLiteConn.FindAsync <DB.ContactDB>(package.data.userId);

            if (item != null && item.UserId != 0)
            {
                item.State = 0;
                await SDKProperty.SQLiteConn.UpdateAsync(item);
            }
            else
            {
                item          = new DB.ContactDB();
                item.NickName = package.data.userName;
                item.Sex      = package.data.sex;
                item.Area     = package.data.province + "," + package.data.city;


                item.HeadImgMD5 = package.data.photo;
                item.UserId     = package.data.userId;
                item.State      = 0;
                try
                {
                    await SDKProperty.SQLiteConn.InsertAsync(item);
                }
                catch (Exception ex)
                {
                    SDKClient.logger.Error($"消息处理异常:error:{ex.Message},stack:{ex.StackTrace};\r\n");
                }
            }
        }
Example #3
0
        public override void ExecuteCommand(EasyClientBase session, PackageInfo packageInfo)
        {
            AddFriendPackage package = packageInfo as AddFriendPackage;

            //收到对方的好友申请
            if (package.code == 0 && package.data.userId != SDKClient.Instance.property.CurrentAccount.userID)
            {
                Util.Helpers.Async.Run(async() => await DAL.DALFriendApplyListHelper.InsertOrUpdateItem(package));
                Util.Helpers.Async.Run(async() => await DAL.DALUserInfoHelper.InsertOrUpdateItem(package));
                SDKClient.Instance.property.FriendApplyList = Util.Helpers.Async.Run(async() => await DAL.DALFriendApplyListHelper.GetFriendApplyList());
            }
            SDKClient.Instance.OnNewDataRecv(packageInfo);
            base.ExecuteCommand(session, packageInfo);
        }