use main --select * from third_party_pay_config where mch_id = dbo.fnmchid('0351naisi') --select * from third_party_pay_cashier where mch_id = dbo.fnmchid('0351naisi') -- update third_party_pay_cashier set terminal_id = '72717113' where id = 5799332252816678542 and terminal_id = '' -- select * from third_party_pay_terminal_notify where terminal_id = '72717113' -- select * from third_party_pay_terminal_notify where mch_id = dbo.fnmchid('0351naisi') declare @mch_no varchar(100) declare @fuiou_mch_no varchar(100) declare @terminal_id varchar(50) declare @mch_id bigint declare @config_id bigint declare @new bit select @mch_no = '0915HM' select @fuiou_mch_no = '0008010F6069302' select @terminal_id = '' select @new = 0 select @mch_id = FMchId FROM TMerchantInfo WHERE FMchNo = @mch_no select @config_id = 0 if @new = 0 begin select @config_id = id from third_party_pay_config WHERE mch_id = @mch_id AND fuioupay_mch_code = @fuiou_mch_no end if isnull(@config_id,0) = 0 begin select @config_id = dbo.FNNewId() INSERT third_party_pay_config(id,mch_id,channel,wxpay_mch_id,wxpay_app_id,alipay_app_id,alipay_pid,allinpay_mch_id,allinpay_app_id,allinpay_app_key,fuioupay_inst_code,fuioupay_mch_code,fuioupay_key,trade_no_prefix,fuioupay_public_key,fuioupay_private_key,wxpay_key,wxpay_key_v3,wxpay_cert_serial_number,wxpay_cert_private_key,wxpay_sub_app_id,wxpay_sub_mch_id,fuioupay_fee_rate,wxpay_fee_rate,alipay_fee_rate,allinpay_fee_rate) SELECT @config_id,@mch_id,'FUIOU_INST',wxpay_mch_id = '',wxpay_app_id = '',alipay_app_id = '',alipay_pid = '',allinpay_mch_id = '',allinpay_app_id= '',allinpay_app_key = '',fuioupay_inst_code = '08M0029419',fuioupay_mch_code = @fuiou_mch_no,fuioupay_key = '',trade_no_prefix = '1863',fuioupay_public_key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyM+YKAqLjjaFuyVRm4xLDjFB8e0Lv97ar3y92j2+yrarftPDKtuEVKQ6jz0M9FdxByVNRN0Hj4zDNRNnWaTL17zyEkJhyGM0BG53NaxW0Jz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ElOrUg3jlOJMaf/iKJh2nk9FnZCmA7W3db1Q6qjl6HlLxMjMV0SjgtUYGmRuSrtJ1jA8rMCz4F3anLKO22n2wGVP2jvEbtuDdgiBU8lRIeYwMCgYAFO3i2zlgpoxlxOiyvf3clGoN36g/wb5gRj0yQqMABYWmhhQgIg6jTclOJmo4vl/ElHZaNzZ6GJZEnctYKAk/Wrisuoh82H2h7AFaRx01O9UoyfQgcdEj4UGeresIBCXzubxeJHAIMKoQp6plWXnbLuREXYrV9V8Y/0Zj5noA2GQKBgQCElQXaPFB+j0jmslnbQGE8PxTE2+BLxC6JTVpoP6uLmz03RjtkWvY+izDU9/1+7kEWzz1SaBHkism2RFcvx/EHihMDDQq7302exhkPxQ7Hhajfgx6y+DBBy/vJ7XkA8OCja203vvRvRv+BKGEe4k9kYmpqmGB27DUUvdbmBogmFQKBgGbrOwZvRCOMgS5hcn7xbPBRm4PRalV6aQ0aRqVsN1PqFSJ2gJvW2WagWkAAWelHCt9T9j8OFvdEmJ6V4nkPVZ9VoGXl4jVXWvzPacYRpIGwSEzfvjtWBD3w04A/nksH9TrZlW5TCzL5i48EBVkbouv4pbzcX7QX8HMFMThUIx+M',wxpay_key = '',wxpay_key_v3 = '',wxpay_cert_serial_number = '',wxpay_cert_private_key = '',wxpay_sub_app_id = '',wxpay_sub_mch_id = '',fuioupay_fee_rate = 0.38,wxpay_fee_rate = 0,alipay_fee_rate = 0,allinpay_fee_rate = 0 end declare @cashier_id bigint select @cashier_id = 0 if @new = 0 begin select @cashier_id = id from third_party_pay_cashier where mch_id = @Mch_id and config_id = @config_id end if isnull(@cashier_id,0) = 0 begin select @cashier_id = dbo.FNNewId() insert third_party_pay_cashier(id,mch_id,config_id,name,enabled,terminal_id) select @cashier_id,@mch_id,@config_id,'收银台',1,@terminal_id end select 'insert third_party_pay_config_map(comp_id,config_Id) select FId, '+cast(@config_id as varchar) +' FROM TCompany where FId > 0 ' union all select 'insert third_party_pay_cashier_map(cashier_id,comp_id) select top 1 '+cast(@cashier_id as varchar) +',FId FROM TCompany where FId > 0 ' select 'https://pay.isaidao.com/third-party-pay/cashier?id=' + cast(@cashier_id as varchar) exec usp_get_conn_info @mch_no -- exec usp_get_conn_info '0915HM'