12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- require_once 'DB_PDO.class.php';
- require_once 'TBK.class.php';
- require_once 'confv2.class.php';
- /**
- * 判断新手任务是否完成,更新状态
- */
- #设置时区
- date_default_timezone_set('PRC');
- $_PDO=DB_PDO::getInstance( conf::$DB_CONF );
- $sql = "select user_id from red_user_mission where type=2 and status=0";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $total_num = 0;
- $update_num = 0;
- $isUps = '';
- foreach( $users as $k=>$v ){
- $total_num++;
- $sql = "select * from `order` where user_id={$v['user_id']} limit 1";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- $res = $stmt->fetch(PDO::FETCH_ASSOC);
- if(!empty($res)){
- $isUps .= $v['user_id'].',';
- }
- }
- if($isUps != ''){
- $isUps = rtrim($isUps, ',');
- $sql = " update red_user_mission set status=1 where user_id in({$isUps}) ";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- $update_num = $stmt->rowCount();
- }
- echo "\n总共".$total_num."条数据";
- echo "\n成功更新".$update_num."条数据";
|