StatIncomeService.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace biz\stat\services;
  3. use biz\base\services\BaseService;
  4. use common\components\util;
  5. use Yii;
  6. class StatIncomeService extends BaseService
  7. {
  8. public static $baseFile = '\biz\stat\classes\StatIncomeClass';
  9. //取今天的数据 shish 2019.9.8
  10. public static function getTodayNum()
  11. {
  12. $merchantId = Yii::$app->params['merchantId'];
  13. $today = date("Ymd");
  14. return self::getByCondition(['merchantId' => $merchantId, 'time' => $today]);
  15. }
  16. public static function checkUp($id)
  17. {
  18. $merchantId = Yii::$app->params['merchantId'];
  19. $stat = self::getById($id, true);
  20. if ($stat->merchantId != $merchantId) {
  21. util::fail('你没有权限');
  22. }
  23. if ($stat->checkUp == 1) {
  24. util::fail('你已经对过帐了');
  25. }
  26. $stat->checkUp = 1;
  27. $stat->save();
  28. return true;
  29. }
  30. //获取最近的收入情况 shish 2019.9.21
  31. public static function getLatestIncome($start, $end)
  32. {
  33. $merchantId = Yii::$app->params['merchantId'];
  34. $list = self::getAllList('*', ['merchantId' => $merchantId, 'time' => ['between', [$start, $end]]], 'time asc');
  35. return $list;
  36. }
  37. }