/****** Object: StoredProcedure [dbo].[P_OptCallRecords] Script Date: 05/21/2018 16:49:18 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[P_OptCallRecords] ( @Tel NVARCHAR(50), --来电号码 @Callid NVARCHAR(50),--callid @type int,--1.插入通话记录;2.更新挂机时间;3.更新排队开始时间;4.插入留言;5.更新满意度 @bustype int, --安图特殊,0客服部,1市场部 @mydkey NVARCHAR(5), @recfile nvarchar(50) --留言的录音文件 ) AS BEGIN SET NOCOUNT ON; if @type=1 begin--1.插入通话记录; INSERT INTO T_Call_CallRecords(CallId,CallNumber,CallType,CallState,DealType,BeginTime,IvrStartTime,IvrEndTime,EndTime,LongTime,IsDeal,OperateType,MYD,BusinessType) VALUES(@Callid,@Tel,0,0,0,GETDATE(),GETDATE(),GETDATE(),GETDATE(),0,0,0,@mydkey,@bustype) end else if @type=2 begin--2.更新挂机时间; update T_Call_CallRecords set EndTime=GETDATE() where CallId=@Callid end else if @type=3 begin--3.更新排队开始时间; update T_Call_CallRecords set WaitStartTime=GETDATE() where callid=@Callid --update T_Call_CallRecords set BusinessType=@bustype, WaitStartTime=GETDATE() where callid=@Callid end else if @type=4 begin--4.插入留言; INSERT INTO T_Call_LeaveRecord(F_CallId,F_Phone,F_LeaveTime,F_Status,F_RecFileUrl) VALUES(@Callid,@Tel,GETDATE(),0,@recfile) end else if @type=5 begin--5.更新满意度 update T_Call_CallRecords set MYD=@mydkey where CallId=@Callid end END