Browse Source

账号失效检查自动任务无效错误修复

沈静伟 3 years ago
parent
commit
c5073873ac
1 changed files with 3 additions and 12 deletions
  1. 3 12
      src/dsb/com/cnd3b/service/SQL/失效账号查询.sql

+ 3 - 12
src/dsb/com/cnd3b/service/SQL/失效账号查询.sql

@@ -1,15 +1,6 @@
 select distinct t1.tenterprise_userid as userid,t1.tagentsid
 from tenterprise_users t1
          inner join tenterprise t2 on t1.siteid = t2.siteid and (fenddate is null or fenddate > getdate())
-         --inner join tuserrequestlog t3 on t1.siteid=t3.siteid and t1.tenterprise_userid=t3.tenterprise_userid
-         inner join tappmodelauth t5 on t1.siteid = t5.siteid and t5.fisdefault = 1
-where  ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
-       (t1.fusertype = '企业' and t5.fenterpriseuseramount > 0))
-       and not exists(
-		   select siteid,tpayinfoid,tagentsid,tenterprise_userid from tpayinfo
-		   where (fbegdate <= GETDATE() and fenddate >= GETDATE()) and t1.siteid=tpayinfo.siteid and (
-		   (t1.fusertype = '经销商' and t1.tagentsid = tpayinfo.tagentsid) or
-                                                             (t1.fusertype = '企业' and t1.tenterprise_userid = tpayinfo.tenterprise_userid)
-		   )
-        )and isnull(t1.accesstoken,'') !=''
---group by t1.tenterprise_userid,t1.tagentsid  --having max(t3.flastrequestdate)>DATEADD(DAY,-3, GETDATE())
+         inner join tappmodelauth t5 on t1.siteid = t5.siteid and t5.fisdefault = 1 and((t1.fusertype = '经销商' and t5.fagentamount > 0) or (t1.fusertype = '企业' and t5.fenterpriseuseramount > 0))
+		 left join tpayinfo t6 on  t6.fbegdate <= GETDATE() and t6.fenddate >= GETDATE() and t1.siteid=t6.siteid and (( t1.fusertype = '经销商' and t1.tagentsid = t6.tagentsid) or (t1.fusertype = '企业' and t1.tenterprise_userid = t6.tenterprise_userid))
+where  isnull(t1.accesstoken,'') !='' and t6.tpayinfoid is null