|
|
@@ -11,52 +11,52 @@ use Yii;
|
|
|
class StatIncomeService extends BaseService
|
|
|
{
|
|
|
|
|
|
- public static $baseFile = '\bizHd\stat\classes\StatIncomeClass';
|
|
|
-
|
|
|
- //取今天的数据 ssh 2019.9.8
|
|
|
- public static function getTodayNum($shopId)
|
|
|
- {
|
|
|
- $today = date("Ymd");
|
|
|
- return StatIncomeClass::getByCondition([ 'time' => $today,'shopId'=>$shopId]);
|
|
|
- }
|
|
|
-
|
|
|
- public static function checkUp($id, $sjId)
|
|
|
- {
|
|
|
- $stat = self::getById($id, true);
|
|
|
- if ($stat->sjId != $sjId) {
|
|
|
- util::fail('你没有权限');
|
|
|
- }
|
|
|
- if ($stat->checkUp == 1) {
|
|
|
- util::fail('你已经对过帐了');
|
|
|
- }
|
|
|
- $stat->checkUp = 1;
|
|
|
- $stat->save();
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- //获取最近的收入情况 ssh 2019.9.21
|
|
|
- public static function getLatestIncome($start, $end, $shopId)
|
|
|
- {
|
|
|
- $list = self::getAllList('*', ['shopId' => $shopId, 'time' => ['between', [$start, $end]]], 'time asc');
|
|
|
- return $list;
|
|
|
- }
|
|
|
-
|
|
|
- //最近7天收入情况 ssh 2020.2.2
|
|
|
- public static function getLatestSevenDay($shopId)
|
|
|
- {
|
|
|
- $return = dateUtil::getDate(2);
|
|
|
- $start = $return[0];
|
|
|
- $end = $return[1];
|
|
|
- $list = self::getLatestIncome($start, $end, $shopId);
|
|
|
- $data = [];
|
|
|
- if (!empty($list)) {
|
|
|
- foreach ($list as $key => $val) {
|
|
|
- $date = $val['time'];
|
|
|
- $income = $val['amount'];
|
|
|
- $data[$date] = $income;
|
|
|
- }
|
|
|
- }
|
|
|
- return $data;
|
|
|
- }
|
|
|
+ public static $baseFile = '\bizHd\stat\classes\StatIncomeClass';
|
|
|
+
|
|
|
+ //取今天的数据 ssh 2019.9.8
|
|
|
+ public static function getTodayNum($shopId)
|
|
|
+ {
|
|
|
+ $today = date("Ymd");
|
|
|
+ return StatIncomeClass::getByCondition(['time' => $today, 'shopId' => $shopId]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function checkUp($id, $sjId)
|
|
|
+ {
|
|
|
+ $stat = self::getById($id, true);
|
|
|
+ if ($stat->sjId != $sjId) {
|
|
|
+ util::fail('你没有权限');
|
|
|
+ }
|
|
|
+ if ($stat->checkUp == 1) {
|
|
|
+ util::fail('你已经对过帐了');
|
|
|
+ }
|
|
|
+ $stat->checkUp = 1;
|
|
|
+ $stat->save();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取最近的收入情况 ssh 2019.9.21
|
|
|
+ public static function getLatestIncome($start, $end, $shopId)
|
|
|
+ {
|
|
|
+ $list = self::getAllList('*', ['shopId' => $shopId, 'time' => ['between', [$start, $end]]], 'time asc');
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //最近7天收入情况 ssh 2020.2.2
|
|
|
+ public static function getLatestSevenDay($shopId)
|
|
|
+ {
|
|
|
+ $return = dateUtil::getDate(2);
|
|
|
+ $start = $return[0];
|
|
|
+ $end = $return[1];
|
|
|
+ $list = self::getLatestIncome($start, $end, $shopId);
|
|
|
+ $data = [];
|
|
|
+ if (!empty($list)) {
|
|
|
+ foreach ($list as $key => $val) {
|
|
|
+ $date = date('n-j', strtotime($val['time']));
|
|
|
+ $income = $val['amount'];
|
|
|
+ $data[$date] = $income;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
|
|
|
}
|