123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- require_once 'DB_PDO.class.php';
- require_once 'TBK.class.php';
- require_once 'conf.class.php';
- #设置时区
- date_default_timezone_set('PRC');
- $_PDO=DB_PDO::getInstance( conf::$DB_CONF );
- $sql = " select u.user_id,uw.union_id from users u left join user_weixin uw on uw.user_id=u.id where (u.login_num=0 or (u.login_num=1 and uw.source in(3001,3000))) and u.origin=0 and uw.is_login=0 and uw.union_id like 'ovn%' ";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- $userIds = $stmt->fetchAll(PDO::FETCH_ASSOC);
- foreach($userIds as $k=>$v){
- $sql = " select id from red_user_mission where type=1 and user_id={$v['user_id']} ";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- $red_mission = $stmt->fetch(PDO::FETCH_ASSOC);
- $user_id = $v['user_id'];
- $union_id = $v['union_id'];
- $is_mission = 0;
- if(!empty($red_mission)) $is_mission = 1;
- $sql = "insert into red_nologin_users (user_id, union_id, is_mission) values({$user_id},'{$union_id}',{$is_mission}) ";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- }
|