public async Task <string> CreateSpreadPoster(IdInput input) { UserIdentifier userIdentifier = new UserIdentifier(InfrastructureSession.TenantId, InfrastructureSession.UserId.Value); string path = await SpreadPosterManager.CreateSpreadPosterAsync(input.Id, userIdentifier); return(path); }
public async Task <string> ReCreateDefaultSpreadPoster() { UserIdentifier userIdentifier = new UserIdentifier(InfrastructureSession.TenantId, InfrastructureSession.UserId.Value); string path = await SpreadPosterManager.ReCreateDefaultSpreadPosterAsync(userIdentifier); return(path); }
private void SendSpreadPoster(string openid) { if (_user == null) { return; } AsyncHelper.RunSync(async() => { _accessToken = await _wechatCommonManager.GetAccessTokenAsync(_tenant.Id); try { SpreadPosterManager spreadPosterManager = IocManager.Instance.Resolve <SpreadPosterManager>(); string path = await spreadPosterManager.GetDefaultSpreadPosterAsync(_user.ToUserIdentifier()); string serverPath = HttpContext.Current.Server.MapPath(path); UploadTemporaryMediaResult uploadTemporaryMediaResult = await MediaApi.UploadTemporaryMediaAsync( _accessToken, UploadMediaFileType.image, serverPath); _customerServiceMessageHelper.SendImage(_accessToken, openid, uploadTemporaryMediaResult.media_id); } catch (Exception exception) { _customerServiceMessageHelper.SendText(_accessToken, openid, exception.Message); } }); }
public async Task <SpreadPosterOutput> GetSpreadPosters() { await SpreadManager.CanSpreadAsync(InfrastructureSession.ToUserIdentifier()); List <SpreadPosterTemplate> spreadPosterTemplates = SpreadPosterTemplateRespository.GetAll().ToList(); List <SpreadPosterDto> spreadPosterDtos = new List <SpreadPosterDto>(); SpreadPosterOutput spreadPosterOutput = new SpreadPosterOutput(); foreach (SpreadPosterTemplate spreadPosterTemplate in spreadPosterTemplates) { SpreadPosterDto spreadPosterDto = new SpreadPosterDto(); spreadPosterDto.SpreadPosterTemplate = spreadPosterTemplate.MapTo <SpreadPosterTemplateDto>(); spreadPosterDto.Path = await SpreadPosterManager.GetSpreadPosterAsync(spreadPosterTemplate.Id, InfrastructureSession.ToUserIdentifier()); spreadPosterDtos.Add(spreadPosterDto); } spreadPosterOutput.SpreadPosters = spreadPosterDtos; return(spreadPosterOutput); }