StatIncomeMonthService.php 889 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace bizMall\stat\services;
  3. use bizMall\base\services\BaseService;
  4. use bizMall\stat\classes\StatIncomeMonthClass;
  5. use Yii;
  6. class StatIncomeMonthService extends BaseService
  7. {
  8. public static $baseFile = '\bizMall\stat\classes\StatIncomeMonthClass';
  9. //获取当前月份的收入 ssh 2020.2.2
  10. public static function getCurrentMonthIncome($sjId)
  11. {
  12. $month = date("Ym");
  13. $return = StatIncomeMonthClass::getByCondition(['sjId' => $sjId, 'time' => $month]);
  14. $income = isset($return['amount']) ? $return['amount'] : 0;
  15. return $income;
  16. }
  17. //上个月收入 ssh 2020.2.2
  18. public static function getPreviousMonthIncome($sjId)
  19. {
  20. $month = date("Ym", mktime(0, 0, 0, date("m") - 1, 1, date("Y")));
  21. $return = StatIncomeMonthClass::getByCondition(['sjId' => $sjId, 'time' => $month]);
  22. $income = isset($return['amount']) ? $return['amount'] : 0;
  23. return $income;
  24. }
  25. }