|
|
@@ -0,0 +1,61 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace bizGhs\item\classes;
|
|
|
+
|
|
|
+use bizGhs\base\classes\BaseClass;
|
|
|
+use bizGhs\order\classes\PurchaseOrderClass;
|
|
|
+use bizGhs\shop\classes\ShopClass;
|
|
|
+use common\components\imgUtil;
|
|
|
+
|
|
|
+class GhsClass extends BaseClass
|
|
|
+{
|
|
|
+
|
|
|
+ public static $baseFile = '\bizGhs\ghs\models\Ghs';
|
|
|
+
|
|
|
+ //供货商列表 ssh 20221220
|
|
|
+ public static function getGhsList($where)
|
|
|
+ {
|
|
|
+ $data = self::getList('*', $where, 'inTurn DESC,addTime DESC');
|
|
|
+ $data['list'] = self::groupBaseInfo($data['list']);
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function groupBaseInfo($list)
|
|
|
+ {
|
|
|
+ if (empty($list)) {
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+ $ids = array_column($list, 'shopId');
|
|
|
+ $shopInfo = ShopClass::getByIds($ids, null, 'id');
|
|
|
+ foreach ($list as $key => $val) {
|
|
|
+ $avatar = $val['avatar'] ?? '';
|
|
|
+ $list[$key]['shortAvatar'] = $avatar;
|
|
|
+ $list[$key]['avatar'] = imgUtil::groupImg($avatar);
|
|
|
+ $currentShopId = $val['shopId'] ?? 0;
|
|
|
+ //新人福利和推荐福利
|
|
|
+ $xrFl = $shopInfo[$currentShopId]['xrFl'] ?? 0;
|
|
|
+ $xrFlAmount = $shopInfo[$currentShopId]['xrFlAmount'] ?? 0;
|
|
|
+ $tjFl = $shopInfo[$currentShopId]['tjFl'] ?? 0;
|
|
|
+ $tjFlAmount = $shopInfo[$currentShopId]['tjFlAmount'] ?? 0;
|
|
|
+ $list[$key]['xrFl'] = $xrFl;
|
|
|
+ $list[$key]['xrFlAmount'] = $xrFlAmount;
|
|
|
+ $list[$key]['tjFl'] = $tjFl;
|
|
|
+ $list[$key]['tjFlAmount'] = $tjFlAmount;
|
|
|
+ $list[$key]['miniKilo'] = $shopInfo[$currentShopId]['miniKilo'] ?? 0;
|
|
|
+ $list[$key]['kiloFee'] = $shopInfo[$currentShopId]['kiloFee'] ?? 0;
|
|
|
+ $list[$key]['presell'] = $shopInfo[$currentShopId]['presell'] ?? 0;
|
|
|
+ $isOpen = 0;
|
|
|
+ $list[$key]['isOpen'] = $isOpen;
|
|
|
+ $list[$key]['openStartTime'] = $shopInfo[$currentShopId]['openStartTime'] ?? '';
|
|
|
+ $list[$key]['openEndTime'] = $shopInfo[$currentShopId]['openEndTime'] ?? '';
|
|
|
+
|
|
|
+ $count = PurchaseOrderClass::getCount(['ghsId' => $val['id'], 'debt' => PurchaseOrderClass::DEBT_YES]);
|
|
|
+ $debtAmount = PurchaseOrderClass::sum(['ghsId' => $val['id'], 'debt' => PurchaseOrderClass::DEBT_YES], 'actPrice');
|
|
|
+ $list[$key]['debtNum'] = $count;
|
|
|
+ $list[$key]['debtAmount'] = $debtAmount;
|
|
|
+
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|