| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace biz\stat\services;
- use biz\base\services\BaseService;
- use common\components\util;
- use Yii;
- class StatIncomeService extends BaseService
- {
-
- public static $baseFile = '\biz\stat\classes\StatIncomeClass';
-
- //取今天的数据 shish 2019.9.8
- public static function getTodayNum()
- {
- $merchantId = Yii::$app->params['merchantId'];
- $today = date("Ymd");
- return self::getByCondition(['merchantId' => $merchantId, 'time' => $today]);
- }
- public static function checkUp($id)
- {
- $merchantId = Yii::$app->params['merchantId'];
- $stat = self::getById($id, true);
- if ($stat->merchantId != $merchantId) {
- util::fail('你没有权限');
- }
- if ($stat->checkUp == 1) {
- util::fail('你已经对过帐了');
- }
- $stat->checkUp = 1;
- $stat->save();
- return true;
- }
-
- //获取最近的收入情况 shish 2019.9.21
- public static function getLatestIncome($start, $end)
- {
- $merchantId = Yii::$app->params['merchantId'];
- $list = self::getAllList('*', ['merchantId' => $merchantId, 'time' => ['between', [$start, $end]]], 'time asc');
- return $list;
- }
-
- }
|