Explorar el Código

用途目录删除

shish hace 6 años
padre
commit
1e35df5f7b

+ 0 - 12
biz/stat/classes/StatIncomeUsageClass.php

@@ -1,12 +0,0 @@
-<?php
-
-namespace biz\stat\classes;
-use Yii;
-use biz\base\classes\BaseClass;
-
-class StatIncomeUsageClass extends BaseClass
-{
-	
-	public static $baseFile = '\biz\stat\models\StatIncomeUsage';
-	
-}

+ 0 - 13
biz/stat/classes/StatIncomeUsageMonthClass.php

@@ -1,13 +0,0 @@
-<?php
-
-namespace biz\stat\classes;
-
-use Yii;
-use biz\base\classes\BaseClass;
-
-class StatIncomeUsageMonthClass extends BaseClass
-{
-	
-	public static $baseFile = '\biz\stat\models\StatIncomeUsageMonth';
-	
-}

+ 0 - 13
biz/stat/models/StatIncomeUsage.php

@@ -1,13 +0,0 @@
-<?php
-namespace biz\stat\models;
-use biz\base\models\Base;
-
-class StatIncomeUsage extends Base
-{
-
-	public static function tableName()
-	{
-		return 'xhStatIncomeUsage';
-	}
-
-}

+ 0 - 13
biz/stat/models/StatIncomeUsageMonth.php

@@ -1,13 +0,0 @@
-<?php
-namespace biz\stat\models;
-use biz\base\models\Base;
-
-class StatIncomeUsageMonth extends Base
-{
-
-	public static function tableName()
-	{
-		return 'xhStatIncomeUsageMonth';
-	}
-
-}

+ 0 - 36
biz/stat/services/StatIncomeUsageMonthService.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace biz\stat\services;
-
-use biz\base\services\BaseService;
-use common\components\business;
-use common\components\validate;
-use Yii;
-
-class StatIncomeUsageMonthService extends BaseService
-{
-	
-	public static $baseFile = '\biz\stat\classes\StatIncomeUsageMonthClass';
-	
-	//添加更新记录 shish 2019.9.16
-	public static function replaceData($data)
-	{
-		$valid = ['sourceType', 'amount', 'merchantId', 'payWay'];
-		validate::easyCheck($valid, $data);
-		$merchantId = $data['merchantId'];
-		$usageId = $data['usageId'];
-		$amount = $data['amount'];
-		$data['year'] = isset($data['year']) ? $data['year'] : date("Y");
-		$data['month'] = isset($data['month']) ? $data['month'] : date("n");
-		$income = self::getByCondition(['merchantId' => $merchantId, 'year' => $data['year'], 'month' => $data['month'], 'usageId' => $usageId], true);
-		if (empty($income)) {
-			$income = self::add($data, true);
-		} else {
-			$income->amount += $amount;
-		}
-		$income = business::savePayWayAmount($income, $amount, $data['payWay']);
-		$income->save();
-		return true;
-	}
-	
-}

+ 0 - 73
biz/stat/services/StatIncomeUsageService.php

@@ -1,73 +0,0 @@
-<?php
-
-namespace biz\stat\services;
-
-use biz\base\services\BaseService;
-use biz\goods\services\UsageRelationService;
-use common\components\business;
-use common\components\stringUtil;
-use common\components\validate;
-use common\components\util;
-use Yii;
-
-class StatIncomeUsageService extends BaseService
-{
-	
-	public static $baseFile = '\biz\stat\classes\StatIncomeUsageClass';
-	
-	//添加更新记录 shish 2010.8.20
-	public static function replaceData($data)
-	{
-		$valid = ['usageId', 'amount', 'merchantId', 'payWay'];
-		validate::easyCheck($valid, $data);
-		$time = date("Ymd");
-		if (isset($data['time'])) {
-			//如果传time参数必须是时间戳
-			if (strtotime(date('Y-m-d H:i:s', $data['time'])) != $data['time']) {
-				util::fail('time不是时间戳');
-			}
-			$time = date("Ymd", $data['time']);
-			$data['time'] = $time;
-		}
-		$merchantId = $data['merchantId'];
-		$usageId = $data['usageId'];
-		$amount = $data['amount'];
-		$payWay = $data['payWay'];
-		$income = self::getByCondition(['merchantId' => $merchantId, 'time' => $time, 'usageId' => $usageId], true);
-		if (empty($income)) {
-			$income = self::add($data, true);
-		} else {
-			$income->amount += $data['amount'];
-		}
-		business::savePayWayAmount($income, $amount, $payWay);
-		
-		/**每个月增加**/
-		StatIncomeUsageMonthService::replaceData($data);
-		
-		$income->save();
-	}
-
-	public static function getLatestIncome($start, $end)
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$list = self::getAllList('usageId,amount', ['merchantId' => $merchantId, 'time' => ['between', [$start, $end]]], 'time asc');
-		$totalAmount = 0;
-		$usageList = UsageRelationService::getMyUsage();
-		$data = [];
-		foreach ($usageList as $usageId => $category) {
-			$data[$usageId]['name'] = $category['showName'];
-			$data[$usageId]['value'] = 0;
-		}
-		if (!empty($list)) {
-			foreach ($list as $val) {
-				$usageId = $val['usageId'];
-				$amount = $val['amount'];
-				$data[$usageId]['value'] = stringUtil::calcAdd($data[$usageId]['value'], $amount);
-				$totalAmount = stringUtil::calcAdd($totalAmount, $amount);
-			}
-		}
-		$usageName = array_column($usageList, 'showName');
-		return ['data' => array_values($data), 'usageName' => $usageName, 'totalAmount' => $totalAmount];
-	}
-
-}