public ServiceResult <bool> BindNoticeRegId(BindNoticeRegIdIM im)
        {
            var result = new ServiceResult <bool>();

            new UserAccountComponent().BindNoticeRegId(this.GetUser().Id, im);
            result.Data = true;

            return(result);
        }
Exemple #2
0
        public ServiceResult <bool> BindNoticeRegId(BindNoticeRegIdIM im)
        {
            ServiceResult <bool> result = new ServiceResult <bool>();

            if (!ModelState.IsValid)
            {
                result.Code = ReasonCode.MISSING_REQUIRED_FIELDS;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }

                return(result);
            }

            result.Data = new MerchantAccountComponent().BindNoticeRegId(this.GetMerchantAccountId(), im);
            return(result);
        }
Exemple #3
0
        public void BindNoticeRegId(Guid userId, BindNoticeRegIdIM im)
        {
            var agent = new JPushAgent();

            RemoveTagsByUserId(userId);

            var tags = new List <string> {
                Constant.JPUSH_TAG
            };
            var result = agent.UpdateDeviceInfo(im.NoticeRegId, new DevicePayload
            {
                Tags = new Dictionary <string, object> {
                    { "add", tags.ToArray() }
                }
            });

            var redisKey = $"FiiiPay:Notice:UserId:{userId}";

            RedisHelper.StringSet(redisKey, im.NoticeRegId);
        }
        public bool BindNoticeRegId(Guid accountId, BindNoticeRegIdIM im)
        {
            RemoveRegInfoByUserId(accountId);

            var agent = new JPushAgent();

            var tags = new List <string> {
                Constant.JPUSH_TAG
            };

            agent.UpdateDeviceInfo(im.NoticeRegId, new DevicePayload
            {
                Tags = new Dictionary <string, object> {
                    { "add", tags.ToArray() }
                }
            });

            string keyOfNotice = $"{RedisKeys.FiiiPOS_APP_Notice_MerchantId}:{accountId}";

            RedisHelper.StringSet(keyOfNotice, im.NoticeRegId);

            return(true);
        }