| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace bizHd\stat\services;
- use bizHd\base\services\BaseService;
- use bizHd\stat\classes\StatIncomeMonthClass;
- use Yii;
- class StatIncomeMonthService extends BaseService
- {
-
- public static $baseFile = '\bizHd\stat\classes\StatIncomeMonthClass';
-
- //获取当前月份的收入 ssh 2020.2.2
- public static function getCurrentMonthIncome($shopId)
- {
- $month = date("Ym");
- $return = StatIncomeMonthClass::getByCondition(['shopId' => $shopId, 'time' => $month]);
- $income = isset($return['amount']) ? $return['amount'] : 0;
- return $income;
- }
- //上个月收入 ssh 2020.2.2
- public static function getPreviousMonthIncome($shopId)
- {
- $month = date("Ym", mktime(0, 0, 0, date("m") - 1, 1, date("Y")));
- $return = StatIncomeMonthClass::getByCondition(['shopId' => $shopId, 'time' => $month]);
- $income = isset($return['amount']) ? $return['amount'] : 0;
- return $income;
- }
- }
|