shish 4 лет назад
Родитель
Сommit
0c7aa83036

+ 3 - 3
app-hd/controllers/StatWorkCatItemController.php

@@ -26,7 +26,7 @@ class StatWorkCatItemController extends BaseController
                 if (empty($startTime) || empty($endTime)) {
                     util::fail('开始或结束时间错误');
                 }
-                $where['time'] = ['between', [date("Ymd",strtotime($startTime)), date("Ymd",strtotime($endTime))]];
+                $where['time'] = ['between', [date("Ymd", strtotime($startTime)), date("Ymd", strtotime($endTime))]];
             } else {
                 $startTime = $get['startTime'] ?? '';
                 $endTime = $get['endTime'] ?? '';
@@ -37,8 +37,8 @@ class StatWorkCatItemController extends BaseController
         $data = StatWorkCatItemClass::getList('*', $where, 'num DESC');
         if (!empty($data['list'])) {
             foreach ($data['list'] as $key => $val) {
-                $shortCover = $val['cover'] ?? '';
-                $data['list'][$key]['cover'] = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+                $shortCover = $val['itemCover'] ?? '';
+                $data['list'][$key]['itemCover'] = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
             }
         }
         util::success($data);

+ 3 - 1
biz-hd/stat/classes/StatWorkCatItemClass.php

@@ -19,11 +19,13 @@ class StatWorkCatItemClass extends BaseClass
         $ratio = $itemData['ratio'] ?? 0;
         $bigUnit = $itemData['bigUnit'] ?? '扎';
         $smallUnit = $itemData['smallUnit'] ?? '支';
+        $itemName = $itemData['itemName'] ?? '';
+        $itemCover = $itemData['itemCover'] ?? '';
         $where = ['mainId' => $mainId, 'catId' => $catId, 'itemId' => $itemId, 'time' => $time];
         $model = self::getByCondition($where, true);
         if (empty($model)) {
             $data = ['mainId' => $mainId, 'time' => $time, 'catId' => $catId, 'catName' => $catName, 'ptItemId' => $ptItemId, 'ratio' => $ratio,
-                'bigUnit' => $bigUnit, 'smallUnit' => $smallUnit];
+                'bigUnit' => $bigUnit, 'smallUnit' => $smallUnit,'itemName'=>$itemName,'itemCover'=>$itemCover];
             $model = self::add($data, true);
         }
         $id = $model->id;

+ 4 - 0
biz-hd/work/classes/WorkItemClass.php

@@ -220,12 +220,16 @@ class WorkItemClass extends BaseClass
             $ratio = $item->ratio ?? 0;
             $bigUnit = $item->bigName ?? '扎';
             $smallUnit = $item->smallName ?? '支';
+            $itemName = $item->name ?? '';
+            $cover = $item->cover ?? '';
             $itemData = [
                 'itemId' => $itemId,
                 'ptItemId' => $ptItemId,
                 'ratio' => $ratio,
                 'bigUnit' => $bigUnit,
                 'smallUnit' => $smallUnit,
+                'itemName' => $itemName,
+                'itemCover' => $cover,
             ];
             StatWorkCatItemClass::replace($shop, $catId, $catName, $itemData, $totalNum);
         }