|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
namespace Service\Goods;
|
|
|
|
|
|
|
|
|
|
use BizConst;
|
|
|
|
|
use CheckClient;
|
|
|
|
|
use CommonTool;
|
|
|
|
|
use Dao\Goods\GoodsDao;
|
|
|
|
|
use Dao\Goods\OpGoodsShortDao;
|
|
|
|
@ -171,6 +172,17 @@ class GoodsShortService extends AbstractService {
|
|
|
|
|
return $affRow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function revertSkuShort($mallId, $skuId) {
|
|
|
|
|
$skuShort = $this->opSkuShortDao->getBySkuId($mallId, $skuId);
|
|
|
|
|
if (empty($skuShort)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$ret = $this->opSkuShortDao->delete('sku_id = %i and mall_id = %s', $skuId, $mallId);
|
|
|
|
|
if ($ret === false) {
|
|
|
|
|
throw new BizException('商品简称还原失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function revertGoodsShort($mallId, $goodsId) {
|
|
|
|
|
$goodsInfo = $this->goodsDao->getById($goodsId);
|
|
|
|
|
if (empty($goodsInfo)) {
|
|
|
|
@ -526,7 +538,37 @@ class GoodsShortService extends AbstractService {
|
|
|
|
|
'short_title' => $skuShortInfo['title'],
|
|
|
|
|
'short_title_source' => OrderPrintConst::shortTitleSourceEdit
|
|
|
|
|
];
|
|
|
|
|
if (isset($skuShortInfo['weight'])) {
|
|
|
|
|
$insertData['weight'] = $skuShortInfo['weight'] ?: null;
|
|
|
|
|
}
|
|
|
|
|
$this->opSkuShortDao->save($skuShortInfo['mallId'], $skuShortInfo['skuId'], $skuShortInfo['goodsId'], $insertData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function saveSkuShortFieldValue($mallId, $params) {
|
|
|
|
|
$skuId = $params['skuId'] ?: null;
|
|
|
|
|
$goodsId = $params['goodsId'] ?: null;
|
|
|
|
|
$field = $params['field'];
|
|
|
|
|
$value = trim($params['value']);
|
|
|
|
|
if (CommonTool::anyEmpty($skuId, $goodsId) || !in_array($field, array('shortTitle', 'weight'))) {
|
|
|
|
|
throw new CheckClientException('参数错误');
|
|
|
|
|
}
|
|
|
|
|
if ($field == 'weight') {
|
|
|
|
|
$value = ZcNumberHelper::numFormat($value, 2);
|
|
|
|
|
}
|
|
|
|
|
$data = [];
|
|
|
|
|
if ($field == 'shortTitle') {
|
|
|
|
|
$data['short_title'] = $value;
|
|
|
|
|
$data['short_title_source'] = OrderPrintConst::shortTitleSourceEdit;
|
|
|
|
|
}
|
|
|
|
|
if ($field == 'weight') {
|
|
|
|
|
$data['weight'] = $value ?: null;
|
|
|
|
|
}
|
|
|
|
|
$goodsInfo = $this->goodsDao->getById($goodsId);
|
|
|
|
|
CheckClient::checkEmpty($goodsInfo, null, '商品信息错误');
|
|
|
|
|
PermissionTool::checkMultiShopValid($mallId, $goodsInfo);
|
|
|
|
|
$authMallId = $goodsInfo['mallId'];
|
|
|
|
|
$aff = $this->opSkuShortDao->save($authMallId, $skuId, $goodsId, $data);
|
|
|
|
|
CheckClient::checkIsFalse($aff, '保存SKU信息失败');
|
|
|
|
|
}
|
|
|
|
|
}
|