@ -261,4 +261,66 @@ class TimingController extends AdminController {
return $mid;
}
//格式 starttime 20200229 endtime 20200230
public function setAvailableBalance() {
if (strtotime($_GET['endtime'])<strtotime($_GET['starttime'])&&$_GET['endtime']){
echo '错误,结束时间小于开始时间';
}
// $starttime = 1571587200;
$starttime = strtotime(date('Ymd',time()));
// var_dump($starttime);die();
if ($_GET['starttime']) {
$starttime = strtotime($_GET['starttime']);
}
$endtime = $starttime + 86399;
if ($_GET['endtime']) {
$endtime = strtotime($_GET['endtime']) + 86399;
}
for ($start = $starttime; $start<$endtime; $start=$start + 86400) {
// var_dump($starttime);die();
$data = M('spend','tab_')
->field("sum(`pay_amount`) as pay_amount,promote_id,promote_account,tab_spend.game_id,tab_spend.game_name,CASE WHEN old_value_ratio is NULL THEN 0 ELSE sum(`pay_amount`) * old_value_ratio END as available_balance")
->join('left join tab_resource_verify_config as config on tab_spend.game_id = config.game_id')