BEGIN
SET @nowtime = NOW();insert into publicity_hotspot(uid, pid, is_agree,agree_time) values (uid_as , pid_as ,1 ,@nowtime) on duplicate key update is_agree = 1^is_agree,agree_time=@nowtime ;
SELECT @is_agree_flag:=is_agree from publicity_hotspot where pid=pid_as and agree_time=@nowtime ;
insert into publicity_dynamic(pid, agree_count) values (pid_as,@is_agree_flag)on duplicate key update agree_count=agree_count+(@is_agree_flag*2-1);
COMMIT;
SELECT @is_agree_flag as resultdata from dual ;
END