<?php
require_once(dirname(dirname(__FILE__)) . '/inc/cron.header.php');
$db_other = new common_db('caiyun_v02_other');
$total = 0;
$index = 0;
$limit = 5000;
$stime = time();
while (TRUE) {
if (empty($score_list)) {
echo '没有数据了\n\r';
break;
}
foreach ($score_list as $value) {
$id = $value['id'];
$lender_id = $value['lender_id'];
$table_name = $table_name = 'shop_user_score_logs_'.$lender_id%20;
echo 'shop_user_score_log_3 log_id='.$id.'%%%lender_id ='.$lender_id.'%%%table_name='.$table_name."\n\r";
$sql = "insert into {$table_name} (lender_id,oprate_type,action,relation_id,state,score,pre_score,post_score,day,create_time) "
. "values('$lender_id','{$value['oprate_type']}','{$value['action']}','{$value['relation_id']}','{$value['state']}','{$value['score']}','{$value['pre_score']}','{$value['post_score']}','{$value['day']}','{$value['create_time']}')";
$db_other->execute($sql);
$total+=1;
}
$index += $limit;
}
$total_time = time()-$stime;
echo '一共发送' . $total . '条数据最后ID是('.$id.')共计时间:'.$total_time;
require_once(dirname(dirname(__FILE__)) . '/inc/cron.header.php');
$db_other = new common_db('caiyun_v02_other');
$total = 0;
$index = 0;
$limit = 5000;
$stime = time();
while (TRUE) {
$sql = "select * from shop_user_score_log_4 where id > 5912498 order by id asc limit $index,$limit";//最后一次跑的时候
$sql = "select * from shop_user_score_log_4 order by id asc limit $index,$limit"//第一次跑的时候
$score_list = $db_other->execute($sql);if (empty($score_list)) {
echo '没有数据了\n\r';
break;
}
foreach ($score_list as $value) {
$id = $value['id'];
$lender_id = $value['lender_id'];
$table_name = $table_name = 'shop_user_score_logs_'.$lender_id%20;
echo 'shop_user_score_log_3 log_id='.$id.'%%%lender_id ='.$lender_id.'%%%table_name='.$table_name."\n\r";
$sql = "insert into {$table_name} (lender_id,oprate_type,action,relation_id,state,score,pre_score,post_score,day,create_time) "
. "values('$lender_id','{$value['oprate_type']}','{$value['action']}','{$value['relation_id']}','{$value['state']}','{$value['score']}','{$value['pre_score']}','{$value['post_score']}','{$value['day']}','{$value['create_time']}')";
$db_other->execute($sql);
$total+=1;
}
$index += $limit;
}
$total_time = time()-$stime;
echo '一共发送' . $total . '条数据最后ID是('.$id.')共计时间:'.$total_time;