Esempio n. 1
0
        public void Test1()
        {
            var userList = new List <UserInfo>();

            for (int i = 0; i < 3; i++)
            {
                var id = NumHelper.SnowNum().ToString();

                userList.Add(new UserInfo()
                {
                    id   = id,
                    name = $"test_name_{id}"
                });
            }

            var addRes = MysqlUserInfoRep.Instance.AddList(userList).Result;

            Assert.IsTrue(addRes.IsSuccess());

            //var updateRes = MysqlUserInfoRep.Instance.UpdateName(id,$"test_update_name{id}").Result;
            //Assert.IsTrue(updateRes.IsSuccess());


            //var getRes = MysqlUserInfoRep.Instance.Get(id).Result;
            //Assert.IsTrue(getRes.IsSuccess());

            //var getListRes = UserInfoRep.Instance.GetList().Result;
            //Assert.True(getListRes.IsSuccess());
        }
Esempio n. 2
0
        public async Task Test1()
        {
            var id = NumHelper.SnowNum();

            var userList = new List <UserInfo>();

            for (int i = 0; i < 3; i++)
            {
                id += i;
                userList.Add(new UserInfo()
                {
                    id   = id,
                    name = $"test_name_{id}"
                });
            }

            var addRes = await MysqlUserInfoRep.Instance.AddList(userList);

            Assert.IsTrue(addRes.IsSuccess());

            var updateRes = await MysqlUserInfoRep.Instance.UpdateName(id, $"test_update_name{id}");

            Assert.IsTrue(updateRes.IsSuccess());


            var getRes = await MysqlUserInfoRep.Instance.Get(id);

            Assert.IsTrue(getRes.IsSuccess());
        }
Esempio n. 3
0
        /// <summary>
        ///  从上下文中初始化基础信息
        /// </summary>
        /// <param name="t"></param>
        public static void InitialBaseFromContext(this BaseOwnerMo t)
        {
            if (string.IsNullOrEmpty(t.id))
            {
                t.id = NumHelper.SnowNum().ToString();
            }

            var appIdentity = AppReqContext.Identity;

            t.owner_uid = UserContext.Identity?.id;

            t.owner_tid   = appIdentity.tenant_id;
            t.add_time    = DateTime.Now.ToUtcSeconds();
            t.from_app_id = appIdentity.app_id;
        }
Esempio n. 4
0
        /// <summary>
        ///  通知实体转化为上传实体对象
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public static UploadFileMo ConvertToMo(this UploadNotifyReq req)
        {
            var mo = new UploadFileMo();

            mo.mime_type = req.mime_type;
            mo.size      = req.size;
            mo.bucket    = req.bucket;


            mo.add_time    = DateTime.Now.ToUtcSeconds();
            mo.from_app_id = AppReqContext.Identity.app_id;
            mo.status      = CommonStatus.Original;
            mo.id          = NumHelper.SnowNum().ToString();

            return(mo);
        }
Esempio n. 5
0
        public void Test1()
        {
            var id   = NumHelper.SnowNum().ToString();
            var time = DateTime.Now.ToUtcSeconds();

            //var addRes = PgUserInfoRep.Instance.Add(new UserInfo()
            //{
            //    id = id,
            //    user_name = $"test_name_{id}"
            //}).Result;
            //Assert.IsTrue(addRes.IsSuccess());

            //var updateRes = PgUserInfoRep.Instance.UpdateName(id,$"test_update_name{id}").Result;
            //Assert.IsTrue(updateRes.IsSuccess());


            //var getRes = PgUserInfoRep.Instance.Get(id).Result;
            //Assert.IsTrue(getRes.IsSuccess());

            //var getListRes = UserInfoRep.Instance.GetList().Result;
            //Assert.True(getListRes.IsSuccess());
        }