USE [gmg_account]GO/****** Object: StoredProcedure [dbo].[uspn_buy_goods_game_log] Script Date: 3/8/2022 12:18:53 PM ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: -- Create date: -- Description: -- =============================================CREATE PROCEDURE [dbo].[uspn_buy_goods_game_log] [USER=162874]account[/USER]_code int -- 구매 유저uid, [USER=162874]account[/USER]_gid varchar(18) -- 구매 유저id, [USER=336895]goods[/USER]_code int -- 상품 코드, [USER=336895]goods[/USER]_name varchar(50) -- GoodsName , [USER=2000321279]Buy[/USER]_price int -- 구매 금액, [USER=551894]Char[/USER]_uid int = 0 -- 구매 캐릭uid, [USER=734115]Gift[/USER]_char_uid int = null -- 선물 캐릭uidasset nocount onset lock_timeout 10000 declare [USER=551894]Char[/USER]_level smallint , [USER=551894]Char[/USER]_name varchar(17) , @tm_level smallint , [USER=551894]Char[/USER]_type smallint , [USER=551894]Char[/USER]_job smallint , [USER=551894]Char[/USER]_f_type tinyint , [USER=854225]chk[/USER]_awakening tinyint -- 각성 여부 0: 미각성, 1: 각성 , [USER=854225]chk[/USER]_guild tinyint -- 길드 가입 여부 체크 0: 미가입, 1: 가입 , [USER=2000145700]Gen[/USER]_time smalldatetime , [USER=734115]Gift[/USER]_user_uid int , [USER=734115]Gift[/USER]_user_id varchar(17) , [USER=734115]Gift[/USER]_char_level smallint , [USER=734115]Gift[/USER]_char_name varchar(17) , [USER=734115]Gift[/USER]_tm_level smallint , [USER=734115]Gift[/USER]_char_type smallint , [USER=734115]Gift[/USER]_char_job smallint , [USER=734115]Gift[/USER]_char_f_type tinyint , [USER=734115]Gift[/USER]_chk_awakening tinyint -- 각성 여부 0: 미각성, 1: 각성 , [USER=734115]Gift[/USER]_chk_guild tinyint -- 길드 가입 여부 체크 0: 미가입, 1: 가입 , [USER=734115]Gift[/USER]_gen_time smalldatetime , [USER=2000321279]Buy[/USER]_access_ip char(15) set [USER=551894]Char[/USER]_uid = 0 set [USER=551894]Char[/USER]_level = 1 set [USER=551894]Char[/USER]_name = '' set @tm_level = 1 set [USER=551894]Char[/USER]_type = 1 set [USER=551894]Char[/USER]_job = 1 set [USER=551894]Char[/USER]_f_type = 0 set [USER=854225]chk[/USER]_awakening = 0 set [USER=854225]chk[/USER]_guild = 0 set [USER=2000145700]Gen[/USER]_time = getdate() set [USER=2000321279]Buy[/USER]_access_ip = '' set [USER=734115]Gift[/USER]_user_uid = null set [USER=734115]Gift[/USER]_user_id = null set [USER=734115]Gift[/USER]_char_level = null set [USER=734115]Gift[/USER]_char_name = null set [USER=734115]Gift[/USER]_tm_level = null set [USER=734115]Gift[/USER]_char_type = null set [USER=734115]Gift[/USER]_char_job = null set [USER=734115]Gift[/USER]_char_f_type = null set [USER=734115]Gift[/USER]_chk_awakening = null set [USER=734115]Gift[/USER]_chk_guild = null set [USER=734115]Gift[/USER]_gen_time = null select [USER=551894]Char[/USER]_uid = C.uid -- 캐릭터 UID , [USER=551894]Char[/USER]_type = C.type -- 캐릭터 종류 (1 ~ 8) , [USER=551894]Char[/USER]_name = C.name -- 캐릭터 이름 , [USER=551894]Char[/USER]_job = case when job_3 > 0 then job_3 when job_2 > 0 then job_2 else job end -- 캐릭터 직업 , [USER=551894]Char[/USER]_f_type = C.f_type -- 캐릭터 기본타입 (0 ~ 3) , [USER=551894]Char[/USER]_level = CT.level -- 캐릭터 레벨 , @tm_level = CT.tm_level -- 캐릭터 TM Level , [USER=854225]chk[/USER]_awakening = case when isnull(CA.awakening_flag, 0) = 1 then 1 else 0 end , [USER=854225]chk[/USER]_guild = case when isnull(G.guild_code, 0) > 1 then 1 else 0 end , [USER=2000145700]Gen[/USER]_time = C.gen_time , [USER=2000321279]Buy[/USER]_access_ip = U.ip from [WINSERVER].trickster.dbo.char_attr as C inner join [WINSERVER].trickster.dbo.char_state as CS on C.uid = CS.uid and C.owner = [USER=162874]account[/USER]_code and CS.authority 2 and CS.state = 1 inner join [WINSERVER].trickster.dbo.char_status as CT on CS.uid = CT.uid inner join [WINSERVER].trickster.dbo.user_info as U on C.owner = U.uid left outer join [WINSERVER].trickster.dbo.tbl_char_awakening as CA on C.uid = CA.char_uid left outer join [WINSERVER].trickster.dbo.tbl_guild_member as G on C.uid = G.char_uid where C.uid = (cast [USER=551894]Char[/USER]_uid as bit) ^ 1) * C.uid + [USER=551894]Char[/USER]_uid --写入商城记录 if [USER=551894]Char[/USER]_uid!=0) begin insert into dbo._stt_Cash_buy_log ([buy_account_gid] ,[buy_char_id] ,[buy_char_name] ,[goods_code] ,[goods_name] ,[buy_price] ,[buy_time]) values [USER=162874]account[/USER]_gid [USER=551894]Char[/USER]_uid [USER=551894]Char[/USER]_name [USER=336895]goods[/USER]_code [USER=336895]goods[/USER]_name [USER=2000321279]Buy[/USER]_price,GETDATE()) endGO