更新
This commit is contained in:
parent
29360e5153
commit
22c4cb8518
@ -313,13 +313,13 @@ class ProductRepository extends BaseRepository
|
|||||||
$res = $this->dao->get($id);
|
$res = $this->dao->get($id);
|
||||||
$data['svip_price_type'] = $res['svip_price_type'];
|
$data['svip_price_type'] = $res['svip_price_type'];
|
||||||
$settleParams = $this->setAttrValue($data, $id, 0, 1, $merId);
|
$settleParams = $this->setAttrValue($data, $id, 0, 1, $merId);
|
||||||
// $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
||||||
// $settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
||||||
$data['price'] = $settleParams['data']['price'];
|
$data['price'] = $settleParams['data']['price'];
|
||||||
unset($data['attrValue'], $data['attr'], $data['mer_cate_id']);
|
unset($data['attrValue'], $data['attr'], $data['mer_cate_id']);
|
||||||
$ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type', [0, 98, 99])->find();
|
$ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type', [0, 98, 99])->find();
|
||||||
Db::transaction(function () use ($id, $data, $settleParams, $ret) {
|
Db::transaction(function () use ($id, $data, $settleParams, $ret) {
|
||||||
$this->save($id, $settleParams, null, [], 0,false);
|
$this->save($id, $settleParams, null, [], 0);
|
||||||
app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price']]);
|
app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price']]);
|
||||||
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
||||||
});
|
});
|
||||||
@ -349,13 +349,11 @@ class ProductRepository extends BaseRepository
|
|||||||
* @param $content
|
* @param $content
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function save($id, $settleParams, $content, $data = [], $productType = 0,$is_phone=true)
|
public function save($id, $settleParams, $content, $data = [], $productType = 0)
|
||||||
{
|
{
|
||||||
if($is_phone==true){
|
|
||||||
(app()->make(ProductAttrRepository::class))->clearAttr($id);
|
(app()->make(ProductAttrRepository::class))->clearAttr($id);
|
||||||
(app()->make(ProductAttrValueRepository::class))->clearAttr($id);
|
(app()->make(ProductAttrValueRepository::class))->clearAttr($id);
|
||||||
(app()->make(ProductCateRepository::class))->clearAttr($id);
|
(app()->make(ProductCateRepository::class))->clearAttr($id);
|
||||||
}
|
|
||||||
if (isset($settleParams['cate'])) (app()->make(ProductCateRepository::class)->insert($settleParams['cate']));
|
if (isset($settleParams['cate'])) (app()->make(ProductCateRepository::class)->insert($settleParams['cate']));
|
||||||
if (isset($settleParams['attr'])) (app()->make(ProductAttrRepository::class))->insert($settleParams['attr']);
|
if (isset($settleParams['attr'])) (app()->make(ProductAttrRepository::class))->insert($settleParams['attr']);
|
||||||
|
|
||||||
@ -456,7 +454,6 @@ class ProductRepository extends BaseRepository
|
|||||||
$integral_rate = $data['integral_rate'];
|
$integral_rate = $data['integral_rate'];
|
||||||
if ($data['integral_rate'] < 0) $integral_rate = -1;
|
if ($data['integral_rate'] < 0) $integral_rate = -1;
|
||||||
if ($data['integral_rate'] > 100) $integral_rate = 100;
|
if ($data['integral_rate'] > 100) $integral_rate = 100;
|
||||||
|
|
||||||
}
|
}
|
||||||
$result = [
|
$result = [
|
||||||
'store_name' => $data['store_name'],
|
'store_name' => $data['store_name'],
|
||||||
@ -670,7 +667,8 @@ class ProductRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function getAdminOneProduct(int $id, ?int $activeId, $conType = 0)
|
public function getAdminOneProduct(int $id, ?int $activeId, $conType = 0)
|
||||||
{
|
{
|
||||||
$with = ['attr', 'attrValue', 'oldAttrValue', 'merCateId.category', 'storeCategory', 'brand', 'temp', 'seckillActive',
|
$with = [
|
||||||
|
'attr', 'attrValue', 'oldAttrValue', 'merCateId.category', 'storeCategory', 'brand', 'temp', 'seckillActive',
|
||||||
'content',
|
'content',
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
$query->field('mer_id,mer_avatar,mer_name,is_trader');
|
$query->field('mer_id,mer_avatar,mer_name,is_trader');
|
||||||
@ -774,12 +772,10 @@ class ProductRepository extends BaseRepository
|
|||||||
$content .= '<img src=' . $v . '></br>';
|
$content .= '<img src=' . $v . '></br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$content = $arr;
|
$content = $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
unset($data['content']);
|
unset($data['content']);
|
||||||
$data['content'] = $content;
|
$data['content'] = $content;
|
||||||
@ -1268,7 +1264,6 @@ class ProductRepository extends BaseRepository
|
|||||||
// $img =$img. '<img src="'.$v.'"/>';
|
// $img =$img. '<img src="'.$v.'"/>';
|
||||||
// }
|
// }
|
||||||
$res['content']['content'] = ['image' => $image];
|
$res['content']['content'] = ['image' => $image];
|
||||||
|
|
||||||
} elseif (is_object($content)) {
|
} elseif (is_object($content)) {
|
||||||
$image = $content->image ?? [];
|
$image = $content->image ?? [];
|
||||||
// $img='<p>';
|
// $img='<p>';
|
||||||
@ -1276,8 +1271,7 @@ class ProductRepository extends BaseRepository
|
|||||||
// $img =$img. '<img src="'.$v.'"/>';
|
// $img =$img. '<img src="'.$v.'"/>';
|
||||||
// }
|
// }
|
||||||
$res['content']['content'] = ['image' => $image];
|
$res['content']['content'] = ['image' => $image];
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
if (is_Array($content)) {
|
if (is_Array($content)) {
|
||||||
$res['content']['content'] = ['image' => $content];
|
$res['content']['content'] = ['image' => $content];
|
||||||
} else {
|
} else {
|
||||||
@ -1697,7 +1691,6 @@ class ProductRepository extends BaseRepository
|
|||||||
app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
||||||
event('product.sell', ['product_id' => [$id]]);
|
event('product.sell', ['product_id' => [$id]]);
|
||||||
$this->switchShow($id, $status, 'is_used', 0);
|
$this->switchShow($id, $status, 'is_used', 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1726,7 +1719,6 @@ class ProductRepository extends BaseRepository
|
|||||||
if ($data['status'] == 1) {
|
if ($data['status'] == 1) {
|
||||||
$this->switchShow($product['product_id'], 1, 'is_used', 0);
|
$this->switchShow($product['product_id'], 1, 'is_used', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->dao->updates($id, $data);
|
$this->dao->updates($id, $data);
|
||||||
Queue(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product_type]);
|
Queue(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product_type]);
|
||||||
@ -2088,7 +2080,8 @@ class ProductRepository extends BaseRepository
|
|||||||
$query->field('guarantee_id,guarantee_name,guarantee_info');
|
$query->field('guarantee_id,guarantee_name,guarantee_info');
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
])->find();
|
]
|
||||||
|
)->find();
|
||||||
return $data ?? [];
|
return $data ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2220,8 +2213,7 @@ class ProductRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function getPreview(array $data)
|
public function getPreview(array $data)
|
||||||
{
|
{
|
||||||
switch($data['product_type'])
|
switch ($data['product_type']) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
case 98:
|
case 98:
|
||||||
case 99:
|
case 99:
|
||||||
@ -2398,7 +2390,6 @@ class ProductRepository extends BaseRepository
|
|||||||
$productId = $this->import($params['order_product_id'], request()->userInfo());
|
$productId = $this->import($params['order_product_id'], request()->userInfo());
|
||||||
$product = $this->get($productId);
|
$product = $this->get($productId);
|
||||||
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $productId)->find();
|
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $productId)->find();
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//有商品有规格
|
//有商品有规格
|
||||||
@ -2548,5 +2539,4 @@ class ProductRepository extends BaseRepository
|
|||||||
);
|
);
|
||||||
return compact('count', 'list');
|
return compact('count', 'list');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user