commit
6cb78b80f4
@ -330,6 +330,19 @@ class ProductRepository extends BaseRepository
|
||||
|
||||
public function freeTrial(int $id, array $data, int $merId)
|
||||
{
|
||||
if (isset($data['mer_labels'])&& $data['mer_labels']!='') {
|
||||
$value = $data['mer_labels'];
|
||||
if (!empty($value)) {
|
||||
if (!is_array($value)) {
|
||||
$data['mer_labels'] = ',' . $value . ',';
|
||||
} else {
|
||||
$data['mer_labels'] = ',' . implode(',', $value) . ',';
|
||||
}
|
||||
}
|
||||
$ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type', [0, 98, 99])->find();
|
||||
app()->make(SpuRepository::class)->update($ret->spu_id, ['mer_labels' => $data['mer_labels']]);
|
||||
return false;
|
||||
}
|
||||
if (!$data['spec_type']) {
|
||||
$data['attr'] = [];
|
||||
if (count($data['attrValue']) > 1) throw new ValidateException('单规格商品属性错误');
|
||||
@ -344,15 +357,7 @@ class ProductRepository extends BaseRepository
|
||||
$ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type', [0, 98, 99])->find();
|
||||
Db::transaction(function () use ($id, $data, $settleParams, $ret) {
|
||||
$this->save($id, $settleParams, null, [], 0);
|
||||
$value = $data['mer_labels'];
|
||||
if (!empty($value)) {
|
||||
if (!is_array($value)) {
|
||||
$data['mer_labels'] = ',' . $value . ',';
|
||||
} else {
|
||||
$data['mer_labels'] = ',' . implode(',', $value) . ',';
|
||||
}
|
||||
}
|
||||
app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price'],'mer_labels'=>$data['mer_labels']]);
|
||||
app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price']]);
|
||||
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
||||
});
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ class StoreProduct extends BaseController
|
||||
return app('json')->fail('编辑免申商品参数错误');
|
||||
}
|
||||
$res=$this->repository->freeTrial($id, $data,$mer_id);
|
||||
if($res && $params['is_stock']==1){
|
||||
if($res && $data['is_stock']==1){
|
||||
$arr=[
|
||||
'mer_id'=>$mer_id,
|
||||
'uid'=>$uid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user