You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
sql-tools/提醒规则.sql

108 lines
3.5 KiB

SELECT master.dbo.FNGetIPLocation(FIPAddress),*
FROM SaiDaoDNS..TClientLoginLog
WHERE 1=1
AND FUserType = 'PCClient'
AND FTime >= '2015-11-05'
AND FMachineId != 'A8K9K2AS456FUK00F058614H'
ORDER BY FTime DESC
SELECT A.FClientNo,' UPDATE ' + A.FDatabase + '..TWeChatAccount SET FAppSecret = ''' + B.FValue + '''' ,b.FKey,B.FValue
FROM TClientSettings AS B,TClient AS A
WHERE B.FClientId = A.FClientId
AND B.FKey IN('WeChatAppId_',
'WeChatAppSecret')
AND B.FValue != ''
delete TRemindRule
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCard1','储值卡提醒规则1','MemberCard',1,
'在有效期内,卡内余额大于 {Balance},
间隔 {IntervalDays} 天没有来店消费,提醒一次,
如果接着隔 {IntervalDays2} 天还没有来消费,再提醒一次,
如果接着隔 {IntervalDays3} 天还没有来消费,再提醒一次。
最多连续提醒三次',
''
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCard2','储值卡提醒规则2','MemberCard', 2,
'在有效期内,卡内余额大于 {Balance},
会员卡离到期还有 {ExpiredDays} 天到期,提醒一次,
如果接着隔 {IntervalDays} 天还没来消费,再提醒一次,
如果接着隔 {IntervalDays2} 天还没来消费,再提醒一次。
最多连续提醒三次',
''
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCard3','储值卡提醒规则3','MemberCard', 3,
'在有效期内,卡内余额小于 {Balance},提醒一次。',
''
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCard4','储值卡提醒规则4','MemberCard', 4,
'卡内余额大于 {Balance} ,卡过期后提醒一次。',
''
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCourse1','疗程卡提醒规则1','MemberCourse', 5,
'在有效期内,卡内项目大于或等于{Times}次,
距离上次消费 {IntervalDays} 天没有来店消费,提醒一次,
如果接着 {IntervalDays2} 天还没有来消费,再提醒一次,
如果接着 {IntervalDays3} 天还没有来消费,再提醒一次。
最多连续提醒三次',
''
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCourse2','疗程卡提醒规则2','MemberCourse', 6,
'卡内项目大于或等于 {Times} 次的,到期前 {ExpiredDays} 天,提醒一次,
如果接着隔 {IntervalDays} 天还没来消费,再提醒一次,
如果接着隔 {IntervalDays2} 天还没来消费,再提醒一次。
最多连续提醒三次',
''
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberCourse3','疗程卡提醒规则3','MemberCourse', 6,
'卡剩余项目次数大于或等于 {Times} 次的,过期后提醒一次。',
''
DELETE TRemindRule WHERE FRuleId = 'MemberBrithday'
INSERT TRemindRule(FRuleId,FName,FCategory,FOrder,FContent,FMessage)
SELECT 'MemberBirthday','会员生日提醒','MemberBirthday', 6,
'会员过生日前 {Days} 天,提醒一次。',
''
SELECT * FROM TUser
1
2
3
4
1
2
3
, {Balance} , {IntervalDays} , {RemindTimes}
, {Balance} , {ExpiredDays} , {RemindTimes}
, {Balance} ,, {RemindTimes}
{Balance} , {RemindTimes}
, {RemainTimes} , {IntervalDays} , {RemindTimes}
, {RemainTimes} , {ExpiredDays} ,
{RemainTimes} ,, {RemindTimes}
SELECT * FROM TUser
SELECT * FROM TOrderBill