You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.9 KiB
53 lines
1.9 KiB
<?php
|
|
/**
|
|
* 自动扣减天数计算权益
|
|
*/
|
|
|
|
define('IN_UNIAPP', true);
|
|
header('Access-Control-Allow-Origin:*');
|
|
if(is_file('../../../wlversion.txt')){
|
|
$version = file_get_contents('../../../wlversion.txt');
|
|
define("MODULE_NAME",$version);
|
|
}else{
|
|
define("MODULE_NAME",'weliam_smartcity');
|
|
}
|
|
require '../../../framework/bootstrap.inc.php';
|
|
require '../../../addons/'.MODULE_NAME.'/core/common/defines.php';
|
|
require_once IA_ROOT . '/framework/bootstrap.inc.php';
|
|
require_once IA_ROOT . '/addons/'.MODULE_NAME.'/core/model/Rights.mod.php';
|
|
|
|
$start_time = time();
|
|
#error_reporting(-1);
|
|
#ini_set('display_errors',1);
|
|
$h = $_GET['h'] ? : date("H");
|
|
|
|
if (!in_array($h,['23','00','01'])) exit('时间未到');
|
|
|
|
$rights = pdo_getall(PDO_NAME.'rights',['status' => 1,'calculate_method' => 1],['id']);
|
|
|
|
foreach ($rights as $rightsValue) {
|
|
|
|
$rightsid = $rightsValue['id'];
|
|
|
|
$rightsUse = pdo_getall(PDO_NAME.'member_rights_use',['rightsid' => $rightsid, 'status' => [0,1]]);
|
|
if (!$rightsUse) continue;
|
|
|
|
foreach ($rightsUse as $rightsUseValue) {
|
|
if ($rightsid == 1 && $rightsUseValue['status'] == 0) continue; // 广告曝光未开始不计算天数
|
|
$isTopRes = 0;
|
|
if ($rightsid == 2) { // 置顶后开始计算天数
|
|
$isTopRes = Rights::recruitIsTop($rightsUseValue['relation_id'],$rightsUse['rights_memberid'],$rightsUse['use_total_amount']-$rightsUse['use_amount']);
|
|
if (!$isTopRes) continue;
|
|
}
|
|
$num = 1;
|
|
if ($isTopRes == 2) $num = 0;
|
|
$memberRights = pdo_get(PDO_NAME . 'member_rights',['id' => $rightsUseValue['member_rightsid']],['mid']);
|
|
Rights::useMemberRights($rightsid,$memberRights['mid'],$rightsUseValue['relation_id'],$rightsUseValue['relation_type'],$num);
|
|
}
|
|
|
|
}
|
|
|
|
$end_time = time();
|
|
|
|
echo ceil(($end_time - $start_time)*1000) . "s";
|
|
exit;
|