onlineUserId = $onlineUserId; $this->onlineEnterpriseId = $onlineEnterpriseId; $this->objDSku = new DSku('default'); $this->objDSku->setTable($this->objDSku->get_Table() . '_' . $onlineEnterpriseId); $this->objSkuCache = new SkuCache($this->onlineEnterpriseId); $this->objGoodsBasicRelevantCache = new GoodsBasicRelevant($this->onlineEnterpriseId); } /** * 增加规格 * @param $params * @param bool $multiple * @return ResultWrapper */ public function addSku($params, $multiple = false) { $last = $this->objDSku->select([], 'id', 'id DESC', 1);//获取最后一条数据的id $dbResult = $this->objDSku->insert($params, $multiple); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } //写缓存 self::updateCacheSku($last); $this->isUpdateSku = true; $this->updateSku = (array) $dbResult; return ResultWrapper::success($dbResult); } /** * 带有属性的比那集 * @param $specMultiple * @param $goodsId * @param $delUnitIds * @param $delSpecSkuIds * @param $unitData * @return ResultWrapper */ public function editMultipleSku($specMultiple, $goodsId, $delUnitIds, $delSpecSkuIds, $unitData) { $dbResult = self::commonMerge($specMultiple, $unitData, ['goodsId' => $goodsId], $goodsId); if (!$dbResult->isSuccess()) { return ResultWrapper::fail($dbResult->getData(), $dbResult->getErrorCode()); } $data = $dbResult->getData(); if (empty($data)) { $insert = self::commonSpec($specMultiple, $unitData, $goodsId);//组装数据 if (!empty($insert)) { $dbResult = $this->objDSku->insert($insert, true); } $this->updateSku = array_merge($this->updateSku,$dbResult); unset($insert); } if (!empty($data['insert'])) { $dbResult = $this->objDSku->insert($data['insert'], true); $this->updateSku = array_merge($this->updateSku,$dbResult); } if (!empty($data['update'])) { foreach ($data['update'] as &$spec) { $this->updateSku = array_merge($this->updateSku,[$spec['id']]); unset($spec['hash']); $dbResult = $this->objDSku->update($spec, ['id' => $spec['id']]); } } if (!empty($data['delete'])) { $dbResult = $this->objDSku->update( [ 'deleteStatus' => StatusCode::$delete ], [ 'id' => array_column($data['delete'], 'id') ]); } if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } $this->isUpdateSku = true; return ResultWrapper::success($dbResult); } /** * 组合spec * @param $specMultiple * @param $unitData * @param $goodsId * @return array */ public function commonSpec($specMultiple, $unitData, $goodsId) { $isNew = StatusCode::$standard; $isNewResult = self::getIsNewByGoodsId($goodsId); if ($isNewResult->isSuccess()){ $isNew = $isNewResult->getData(); } //属性新增操作 $insert = []; foreach ($unitData as $unit) { foreach ($specMultiple as $spec) { if (!isset($spec['specGroupHash'])) { $specGroupIds = array_column($spec['specGroup'], 'specValueId'); $hash = md5(implode('|', $specGroupIds)); //属性新增操作 $insert[] = [ 'goodsId' => $goodsId, 'specData' => json_encode($spec['specGroup']), 'specImage' => json_encode($spec['specImage']), 'specType' => StatusCode::$specType['multiple'], 'unitId' => $unit['unitId'], 'isMaster' => $unit['isMaster'], 'unitName' => $unit['unitName'], 'conversion' => $unit['conversion'], 'specGroupHash' => $hash, 'isNew' => $isNew ]; } } } return $insert; } /** * @param $specMultiple * @param $unitData * @param $selectParams * @param $goodsId * @return ResultWrapper */ public function commonMerge($specMultiple, $unitData, $selectParams, $goodsId) { // 判断sku是否新版的规则标识 $isNewResult = self::getIsNewByGoodsId($goodsId); if (!$isNewResult->isSuccess()){ return ResultWrapper::fail($isNewResult->getData(),$isNewResult->getErrorCode()); } $isNew = $isNewResult->getData(); // 查询当前商品的所有sku数据 $dbResult = self::getSpecQuery($selectParams); if (!$dbResult->isSuccess()) { return ResultWrapper::fail($dbResult->getData(), $dbResult->getErrorCode()); } $oldData = $dbResult->getData(); if (empty($oldData)) { return ResultWrapper::success([]); } $mapping = []; $allHash = []; foreach ($oldData as &$value) { $hash = md5($value['goodsId'] . $value['unitId'] . $value['isMaster'] . $value['specGroupHash']); $value['hash'] = $hash; $mapping[$value['hash']] = $value; $allHash[] = $value['hash']; } //比对数据库就数据和新数据 $nowData = []; foreach ($unitData as $unit) { foreach ($specMultiple as $spec) { //生成hash值 $specGroupIds = array_column($spec['specGroup'], 'specValueId'); $specGroupHash = md5(implode('|', $specGroupIds));//属性hash值 $hash = md5($goodsId . $unit['unitId'] . $unit['isMaster'] . $specGroupHash);//对单行数据生成hash值 $nowData[] = [ 'goodsId' => $goodsId, 'specData' => json_encode($spec['specGroup']), 'specImage' => json_encode($spec['specImage']), 'specType' => StatusCode::$specType['multiple'], 'unitId' => $unit['unitId'], 'isMaster' => $unit['isMaster'], 'unitName' => $unit['unitName'], 'conversion' => $unit['conversion'], 'specGroupHash' => $specGroupHash, 'hash' => $hash, 'barCode' => isset($spec['barCode'][$unit['unitId']]) ? $spec['barCode'][$unit['unitId']] : '', 'isDefault' => isset($spec['isDefault'][$unit['unitId']]) ? $spec['isDefault'][$unit['unitId']] : StatusCode::$delete, 'weight' => isset($spec['weight'][$unit['unitId']]) ? $spec['weight'][$unit['unitId']] : 0, 'isNew' => $isNew ];//新的数据 } } $insert = []; $update = []; $delete = []; foreach ($nowData as &$spec) { if (in_array($spec['hash'], $allHash)) { $spec['id'] = $mapping[$spec['hash']]['id']; $update[] = $spec; unset($mapping[$spec['hash']]); } else { unset($spec['hash']); $insert[] = $spec; } } $delete = $mapping; return ResultWrapper::success([ 'insert' => $insert, 'update' => $update, 'delete' => array_values($delete), ]); } public function getSpecQuery($selectParams) { $selectParams['deleteStatus'] = StatusCode::$standard; $dbResult = $this->objDSku->select($selectParams); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } return ResultWrapper::success($dbResult); } /** * 修改sku * @param $unitData * @param $goodsId * @param $delUnitIds * @return ResultWrapper */ public function editSku($unitData, $goodsId, $delUnitIds, $delSpecSkuIds) { $isNewResult = self::getIsNewByGoodsId($goodsId); if (!$isNewResult->isSuccess()){ return ResultWrapper::fail($isNewResult->getData(),ErrorCode::$dberror); } $isNew = $isNewResult->getData(); $objGoodsBasicRelevant = new GoodsBasicRelevant($this->onlineEnterpriseId); //有删除的 if (!empty($delUnitIds)) { $dbResult = $this->objDSku->update( ['deleteStatus' => StatusCode::$delete, 'updateTime' => time()], [ 'unitId' => $delUnitIds, 'goodsId' => $goodsId, ]); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } } // 删除带属性的sku if(!empty($delSpecSkuIds)){ $dbResult = $this->objDSku->update(['deleteStatus' => StatusCode::$delete, 'updateTime' => time()], ['specGroupHash'=>$delSpecSkuIds]); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } } //有更新 if (!empty($unitData)) { $insert = []; foreach ($unitData as $unit) { if (!isset($unit['id'])) { $insert[] = [ 'conversion' => $unit['conversion'], 'unitName' => $unit['unitName'], 'isMaster' => $unit['isMaster'], 'unitId' => $unit['unitId'], 'specType' => StatusCode::$specType['single'],//无属性 'goodsId' => $goodsId, 'barCode' => isset($unit['barCode']) ? $unit['barCode'] : '', 'isDefault' => isset($unit['isDefault']) ? $unit['isDefault'] : StatusCode::$delete, 'weight' => isset($unit['weight']) ? $unit['weight'] : 0, 'isNew' => $isNew, ]; } else { $dbResult = $this->objDSku->update([ 'conversion' => $unit['conversion'], 'unitName' => $unit['unitName'], 'isMaster' => $unit['isMaster'], 'unitId' => $unit['unitId'], 'barCode' => isset($unit['barCode']) ? $unit['barCode'] : '', 'isDefault' => isset($unit['isDefault']) ? $unit['isDefault'] : StatusCode::$delete, 'weight' => isset($unit['weight']) ? $unit['weight'] : 0, 'isNew' => $isNew ], $unit['id']); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } $this->updateSku = array_merge($this->updateSku,[$unit['id']]); $objGoodsBasicRelevant->cacheSkuIdRelationName($unit['unitName'], $unit['id']); } } if (!empty($insert)) { $last = $this->objDSku->select([], 'id', 'id DESC', 1);//获取最后一条数据的id $dbResult = $this->objDSku->insert($insert, true); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } $this->updateSku = array_merge($this->updateSku,$dbResult); if (isset($last)) { self::updateCacheSku($last);//写缓存 } } } $this->isUpdateSku = true; return ResultWrapper::success(true); } /** * Doc: (des="获取最新单位的isNew") * User: XMing * Date: 2020/10/23 * Time: 11:46 上午 */ public function getIsNewByGoodsId($goodsId): ResultWrapper { $result = $this->objDSku->get(['goodsId' => $goodsId,'isMaster' => StatusCode::$standard],'isNew'); if ($result === false){ return ResultWrapper::fail($this->objDSku->error(),ErrorCode::$dberror); } return ResultWrapper::success(isset($result['isNew']) ? $result['isNew'] : StatusCode::$standard); } /** * 批量设置sku * @param $params * @return ResultWrapper */ public function setSku($params) { if (!is_array($params['goodsId'])) return ResultWrapper::fail('参数格式错误', ErrorCode::$paramError); $last = $this->objDSku->select([], 'id', 'id DESC', 1);//获取最后一条数据的id if (is_array($params['goodsId'])) { $skuData = []; foreach ($params['goodsId'] as $key => $val) { foreach ($params['branchData'] as $sku) { $skuData[] = [ 'id' => '', 'goodsId' => $val, 'conversion' => $sku['conversion'], 'unitName' => $sku['unitName'], 'unitId' => $sku['unitId'], 'isMaster' => $sku['isMaster'], ]; } } $dbResult = $this->objDSku->replace($skuData, true); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } self::updateCacheSku($last); return ResultWrapper::success($dbResult); } } /** * @param $sql * @return ResultWrapper */ public function getQuery($sql) { $dbResult = $this->objDSku->query($sql); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } return ResultWrapper::success($dbResult); } /** * 根据goodsId获取sku信息 根据主单位辅单位区分 * @param $params * @param string $fields * @param bool $group * @return ResultWrapper */ public function getSkuInfo($params, $fields = 'id,goodsId,conversion,unitName,unitId,isMaster', $group = true) { $params['deleteStatus'] = StatusCode::$standard; $dbResult = $this->objDSku->select($params, $fields); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } if ($group) { foreach ($dbResult as $key => &$val) { $isMaster = $val['isMaster']; $goodsId = $val['goodsId']; //unset($val['isMaster']); unset($val['goodsId']); if ($isMaster == StatusCode::$standard) { $data[$goodsId]['masterUnit'] = $val; } else { $data[$goodsId]['branchUnit'][] = $val; } } } else { $data = $dbResult; } return ResultWrapper::success(isset($data) ? $data : []); } /** * 根据ids数组获取name * @param $ids * @param bool $type * @return array|ResultWrapper */ public function getNameByIds($ids, $type = false) { $dbResult = $this->objDSku->select($ids, '*'); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } if (empty($dbResult)) { return ResultWrapper::fail('skuIds错误', ErrorCode::$dberror); } $returnData = []; foreach ($dbResult as $key => $value) { if ($type) { $returnData[$value['id']] = $value; } else { $returnData[$value['id']]['id'] = $value['id']; $returnData[$value['id']]['unitName'] = $value['unitName']; } } return ResultWrapper::success($returnData); } /** * 根据ids数组获取name * @param $GoodsIds * @param bool $isMaster * @return array|ResultWrapper */ public function getSkuDataByGoodsIds($GoodsIds, $isMaster = false) { $skuData = []; $falseResult = []; foreach ($GoodsIds as $value){ $cacheResult = $this->objSkuCache->getGoodsBasicSku($value); if($cacheResult) { $skuData[$value] = $cacheResult; }else{ $falseResult[] = $value; } } if(empty($falseResult)){ if($isMaster){ $return = []; foreach($skuData as $goodsId => $sku){ foreach($sku as $skuId => $v){ if($v['isMaster'] == StatusCode::$standard){ $return[$goodsId][$skuId] = $v; } } } return ResultWrapper::success($return); } return ResultWrapper::success($skuData); } $where = ['goodsId' => $falseResult]; $where['deleteStatus'] = StatusCode::$standard; $dbResult = $this->objDSku->select($where); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } $data = $dbResult; unset($dbResult); $format = []; foreach($data as $value){ $format[$value['goodsId']][$value['id']] = $value; } foreach($format as $goodsId => $value){ $this->objSkuCache->addGoodsBasicSku($goodsId,$value); $skuData[$goodsId] = $value; } if($isMaster){ $return = []; foreach($skuData as $goodsId => $sku){ foreach($sku as $skuId => $v){ if($v['isMaster'] == StatusCode::$standard){ $return[$goodsId][$skuId] = $v; } } } return ResultWrapper::success($return); } return ResultWrapper::success($skuData); } /** * @param $skuIds * @return array */ public function getSku($skuIds) { $return = []; if (!$skuIds) { return $return; } $dbResult = $this->objDSku->select($skuIds, '*'); if ($dbResult === false) { return $return; } foreach ($dbResult as $sku) { $return[$sku['id']] = $sku; } return $return; } /** * 获取单个sku数据 * @param $where * @return array */ public function getSkuData($where = []) { $dbResult = $this->objDSku->get($where); if ($dbResult === false) { return []; } return $dbResult; } /** * @param $selectParams * @return ResultWrapper */ public function getMaterSkuId($selectParams) { $dbResult = $this->objDSku->select($selectParams, 'id,goodsId'); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } $mapping = []; foreach ($dbResult as $val) { $mapping[$val['goodsId']] = $val['id']; } return ResultWrapper::success($mapping); } /** * todo(这个缓存方法废弃了,但是好像很多地方用,暂时没删除) * @param $last * @param string $action * @return bool */ public function updateCacheSku($last) { $lastId = isset($last[0]['id']) ? $last[0]['id'] : 0; $objGoodsBasicRelevant = new GoodsBasicRelevant($this->onlineEnterpriseId); $dbResult = $this->objDSku->select("id > {$lastId}", 'id,unitName'); if ($dbResult == false) { return false; } foreach ($dbResult as $key => $val) { $objGoodsBasicRelevant->cacheSkuIdRelationName($val['unitName'], $val['id']); } return true; } /** * @param $selectParams * @return ResultWrapper */ public function getSkuByGoodsBasicId($selectParams) { $selectParams['deleteStatus'] = StatusCode::$standard; $dbResult = $this->objDSku->select($selectParams, 'id,unitName,specData,unitId,specImage,conversion,isMaster,specType'); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } return ResultWrapper::success($dbResult); } /** * 获取sku数据 * @param $skuIds * @return ResultWrapper * @throws \Exception */ public function getSkuDataBySkuIds($skuIds) { if (empty($skuIds)) return ResultWrapper::success([]); $skuData = []; $falseResult = []; if(!is_array($skuIds)){ $skuIds = [$skuIds]; } foreach ($skuIds as $value){ $cacheResult = $this->objSkuCache->getSku($value,true); if($cacheResult && isset($cacheResult['specType'])) { $skuData[] = $cacheResult; }else{ $falseResult[] = $value; } } if(!empty($falseResult)){ $where = ['id' => $falseResult]; $dbResult = $this->objDSku->select($where); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } if(!empty($dbResult)){ foreach ($dbResult as $value){ $skuData[] = $value; $cacheMap = self::cacheMappersSku($value); $this->objSkuCache->delSku($value['id']); $cacheResult = $this->objSkuCache->cacheSku($value['id'], $cacheMap); if(!$cacheResult->isSuccess()){ return ResultWrapper::fail($cacheResult->getData(), $cacheResult->getErrorCode()); } } } } $returnData = []; foreach ($skuData as $value) { //单规格 $returnData[$value['id']]['unitId'] = $value['unitId']; $returnData[$value['id']]['unitName'] = $value['unitName']; $returnData[$value['id']]['barCode'] = $value['barCode']; $returnData[$value['id']]['isMaster'] = $value['isMaster']; $returnData[$value['id']]['skuName'] = ''; $returnData[$value['id']]['conversion'] = $value['conversion']; $returnData[$value['id']]['specData'] = []; if ($value['specType'] == StatusCode::$specType['multiple']) { //多规格 $returnData[$value['id']]['skuName'] = ''; $specData = json_decode($value['specData'], true); foreach ($specData as $vv) { $returnData[$value['id']]['specData'][$vv['specId']]['specName'] = $vv['specName']; $returnData[$value['id']]['specData'][$vv['specId']]['specValue'][$vv['specValueId']] = $vv['specValueName']; $returnData[$value['id']]['skuName'] = empty($returnData[$value['id']]['skuName']) ? $vv['specValueName'] : $returnData[$value['id']]['skuName'].';'. $vv['specValueName']; } } } return ResultWrapper::success($returnData); } /** * 通过skuIds获取规格名 * @param $skuIds * @return ResultWrapper */ public function getSpecNameBySkuId($skuIds) { if (empty($skuIds)){ return ResultWrapper::success([]); } $dbResult = $this->objDSku->select(['id' => $skuIds]); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } if (empty($dbResult)) { return ResultWrapper::success([]); } $mapping = []; foreach ($dbResult as $row) { $unitName = $row['unitName']; $specData = []; $specName = ''; if ($row['specType'] == StatusCode::$specType['multiple']) { $specData = json_decode($row['specData'], true); $arrSpecName = array_column($specData, 'specValueName'); $specName = rtrim(implode('_', $arrSpecName), '_'); } if (isset($specName) && empty($specName)) { $unitName .= ' ' . $specName; } $mapping[$row['id']] = [ 'specGroup' => empty($specData) ? [] : $specData,//属性组 'unitName' => $row['unitName'],//单位名称 'nameFields' => $unitName,//拼接好的名字 'isMaster' => $row['isMaster'],//是否是主单位 'conversion' => $row['conversion'],//换算比率 'specImages' => empty($row['specImage']) ? [] : json_decode($row['specImage'], true), 'barCode' => empty($row['barCode']) ? '' : $row['barCode'], 'weight' => empty($row['weight']) ? 0 : $row['weight'], 'isNew' => $row['isNew'] ]; } return ResultWrapper::success($mapping); } /** * 传入skuIds 获取sku对应主单位skuId及换算比例 * @param $skuIds * @return ResultWrapper */ public function getConversion($skuIds) { if (empty($skuIds)){ return ResultWrapper::success([]); } $dbResult = $this->objDSku->select(['id' => $skuIds], 'id,isMaster,unitName,goodsId,specType,conversion,specGroupHash,isNew'); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } if (empty($dbResult)) { return ResultWrapper::success([]); } $mapping = []; foreach ($dbResult as $item) { if ($item['isMaster'] == StatusCode::$standard) { $mapping[$item['id']] = [ 'masterSkuId' => $item['id'], 'conversion' => 0, 'isMaster' => StatusCode::$standard, 'deleteStatus' => StatusCode::$standard, 'masterUnitName' => $item['unitName'], 'conversionStr' => $item['unitName'].'(主)', 'isNew' => $item['isNew'] ]; } else { //获取当前属性主单位skuID $masterSku = $this->objDSku->get( [ 'isMaster' => StatusCode::$standard, 'goodsId' => $item['goodsId'], 'specGroupHash' => $item['specGroupHash'], 'deleteStatus' => StatusCode::$standard ],'id,unitName'); $mapping[$item['id']] = [ 'masterSkuId' => $masterSku['id'], 'conversion' => $item['conversion'], 'isMaster' => StatusCode::$delete, 'isNew' => $item['isNew'], 'conversionStr' => '1'.$item['unitName'].'='.floatval($item['conversion']).$masterSku['unitName'], 'masterUnitName' => $masterSku['unitName'], ]; } } return ResultWrapper::success($mapping); } /** * Doc: (des="删除基础资料下sku缓存") * User: XMing * Date: 2020/10/21 * Time: 7:42 下午 * @param $goodsBasicId * @return ResultWrapper */ public function delSkuCache($goodsBasicId): ResultWrapper { $result = $this->objSkuCache->delGoodsBasicSku($goodsBasicId); return ResultWrapper::success($result); } /** * @param array $select * @return ResultWrapper */ public function getSkuByParams(array $select) { $dbResult = $this->objDSku->select($select); if ($dbResult === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } return ResultWrapper::success($dbResult); } /** * Doc: (des="") * User: XMing * Date: 2020/12/19 * Time: 9:51 上午 * @param $ids * @return ResultWrapper */ public function getSkuMapByIds($ids): ResultWrapper { if (empty($ids)){ return ResultWrapper::success([]); } $lists = $this->objDSku->select(['id' => $ids],'id,unitName,specData as specGroup'); if ($lists === false) { return ResultWrapper::fail($this->objDSku->error(), ErrorCode::$dberror); } $map = []; foreach ($lists as $list){ $list['specGroup'] = !empty($list['specGroup']) ? json_decode($list['specGroup'],true) : []; $map[$list['id']] = $list; } return ResultWrapper::success($map); } /** * Doc: (des="") * User: XMing * Date: 2021/3/4 * Time: 4:29 下午 * @param array $ids * @return ResultWrapper */ public function getMasterUnitNameByMaterielIds(array $ids): ResultWrapper { if (empty($ids)){ return ResultWrapper::success([]); } $lists = $this->objDSku->select([ 'goodsId' => $ids, 'deleteStatus' => StatusCode::$standard, 'isMaster' => StatusCode::$standard ],'unitName,goodsId'); if ($lists === false){ Logger::logs(E_USER_ERROR,'sql error',__CLASS__,__LINE__,$this->objDSku->error()); return ResultWrapper::fail($this->objDSku->error(),ErrorCode::$dberror); } $map = []; foreach ($lists as $value){ if (!isset($map[$value['goodsId']]) || empty($map[$value['goodsId']])){ $map[$value['goodsId']] = $value['unitName']; } } return ResultWrapper::success($map); } /** * Doc: (des="") * User: XMing * Date: 2021/3/13 * Time: 4:14 下午 * @param int $id * @return ResultWrapper */ public function getMasterById(int $id): ResultWrapper { $result = $this->objDSku->get(['goodsId' => $id,'deleteStatus' => StatusCode::$standard,'isMaster' => StatusCode::$standard]); if ($result === false){ return ResultWrapper::fail($this->objDSku->error(),ErrorCode::$dberror); } return ResultWrapper::success($result); } /** * @After */ public function __destruct() { // TODO: Implement __destruct() method. self::cacheSku(); } }