优化脚本执行

master
chenzhi 4 years ago
parent 0e8730b810
commit 69615c1459

@ -25,7 +25,15 @@ class CompanyStatementSetController extends Controller {
}
$this->cpapihost = $cpapihost['value'];
}
public function setFreeDateCount($begin,$end='')
/**
* Undocumented function
*
* @param [type] $begin 开始时间 2020-04-01
* @param string $end 结束时间,默认今天
* @param string $company all/pc/cp/pu 全部 下游公司 上游 下游个人
* @return void
*/
public function setFreeDateCount($begin,$end='',$company='all')
{
if($end == '') $end = $begin;
//判断日期格式
@ -48,10 +56,10 @@ class CompanyStatementSetController extends Controller {
$datelist = get_date_list($starttime,$endtime,1);
$countdate = count($datelist);
for($i=0;$i<$countdate;$i++){
$this->setDailyCount($datelist[$i]);
$this->setDailyCount($datelist[$i],$company);
}
}
public function setDailyCount($stime="now")
public function setDailyCount($stime="now",$company='all')
{
if(!IS_CLI){
die("只支持脚本访问");
@ -67,33 +75,65 @@ class CompanyStatementSetController extends Controller {
if($w == 1 || $d == 1){
if($w == 1){
echo $nowdate.":".PHP_EOL;
echo "--周结begin".PHP_EOL;
$this->cpStatement(0,$stime);
echo "∟----CP周结统计ok".PHP_EOL;
$this->promoteCompanyStatement(0,$stime);
echo "∟----推广公司周结统计ok".PHP_EOL;
$this->promoteUserPool(0,$stime);
echo "∟----推广个人周结ok".PHP_EOL;
if($company == "all"){
echo $nowdate.":".PHP_EOL;
echo "--周结begin".PHP_EOL;
$this->cpStatement(0,$stime);
echo "∟----CP周结统计ok".PHP_EOL;
$this->promoteCompanyStatement(0,$stime);
echo "∟----推广公司周结统计ok".PHP_EOL;
$this->promoteUserPool(0,$stime);
echo "∟----推广个人周结ok".PHP_EOL;
}
if($company == "cp"){
$this->cpStatement(0,$stime);
echo "∟----CP周结统计ok".PHP_EOL;
}
if($company == "pc"){
$this->promoteCompanyStatement(0,$stime);
echo "∟----推广公司周结统计ok".PHP_EOL;
}
if($company == "pu"){
$this->promoteUserPool(0,$stime);
echo "∟----推广个人周结ok".PHP_EOL;
}
}
if($d == 1){
echo $nowdate.":".PHP_EOL;
echo "--月结&补点begin".PHP_EOL;
if($company == "all"){
echo $nowdate.":".PHP_EOL;
echo "--月结&补点begin".PHP_EOL;
$this->cpStatement(1,$stime);
$this->cpStatement(2,$stime);
echo "∟----CP月结&补点统计ok".PHP_EOL;
$this->cpStatement(1,$stime);
$this->cpStatement(2,$stime);
echo "∟----CP月结&补点统计ok".PHP_EOL;
$this->promoteCompanyStatement(1,$stime);
$this->promoteCompanyStatement(2,$stime);
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
$this->promoteCompanyStatement(1,$stime);
$this->promoteCompanyStatement(2,$stime);
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
$this->promoteUserPool(1,$stime);
$this->promoteUserPool(2,$stime);
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
$this->promoteUserPool(1,$stime);
$this->promoteUserPool(2,$stime);
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
}
if($company == "cp"){
$this->cpStatement(1,$stime);
$this->cpStatement(2,$stime);
echo "∟----CP月结&补点统计ok".PHP_EOL;
}
if($company == "pc"){
$this->promoteCompanyStatement(1,$stime);
$this->promoteCompanyStatement(2,$stime);
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
}
if($company == "pu"){
$this->promoteUserPool(1,$stime);
$this->promoteUserPool(2,$stime);
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
}
}
}else{
echo $nowdate."非周一和月初,无需任何处理".PHP_EOL;

Loading…
Cancel
Save