Advertisement
Ruslan_Rayanov

fm_watch_textru2_saveItem

Apr 5th, 2022
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.51 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[fm_watch_textru2_saveItem]
  2.    @username nvarchar(256),
  3.    @itemID int,
  4.    @parameters ExtendedDictionaryParameter readonly
  5. AS
  6. BEGIN
  7.     declare @uid nvarchar(128)= (select value2 from @parameters where [key] = 'uid')
  8.     declare @result nvarchar(max) = ''
  9.     select @result = json_result from textru_responses
  10.     where uid = @uid
  11.  
  12.     declare @msg nvarchar(max) = '', @type nvarchar(128) = 'success'
  13.     if(len(@result)>0 and ISJSON( @result )=1) begin
  14.         print @result
  15.         set @msg = '<h2 class=" text-white">Уникальность текста: ' + isnull(JSON_VALUE(@result,'$.unique'), '--') + '%</h2>'  
  16.        
  17.         declare @p1 ExtendedDictionaryParameter
  18.  
  19.         insert into @p1 (Value2)
  20.         select  '<span class="font-weight-bold">'+ JSON_VALUE(value,'$.plagiat') + '%</span> - <a href="'+JSON_VALUE(value,'$.url')+'" target="_blank">' + JSON_VALUE(value,'$.url') + '</a>' Value2
  21.          from OPENJSON(@result,'$.urls')
  22.         declare @plagiat nvarchar(max) =  isnull( dbo.as_agg(@p1, '<br>'), '')
  23.         if(len(@plagiat)>0) begin
  24.             set @msg = @msg + '<h5 class="mt-2 mb-1 text-white">C каких сайтов плагиат (url и % плагиата)</h5>' + @plagiat
  25.         end
  26.        
  27.     end else begin
  28.         set @type = 'warning'
  29.         set @msg = 'Пока нет результата, попробуйте нажать кнопку через 20-30 сек.'
  30.     end
  31.     -- 1 SELECT (Result, Msg)
  32.     select 1 Result, @msg Msg, 1 EnableSaveAlert, @type type, 100000 delay
  33. END
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement