更新
This commit is contained in:
parent
83b1f50e6c
commit
139eb47116
@ -18,6 +18,7 @@ use think\App;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\validate\merchant\StoreProductAdminValidate as validate;
|
||||
use app\common\repositories\store\product\ProductRepository as repository;
|
||||
use think\facade\Db;
|
||||
use think\facade\Queue;
|
||||
|
||||
class StoreProduct extends BaseController
|
||||
@ -302,13 +303,27 @@ class StoreProduct extends BaseController
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
//**复制商品 */
|
||||
public function copy($product_id=0,$mer_id=0){
|
||||
public function copy($product_id = 0, $mer_id = 0, $street_code = 0, $type_id = 0, $category_id = 0)
|
||||
{
|
||||
if ($product_id == 0) return app('json')->fail('参数错误');
|
||||
$product = $this->repository->getAdminOneProduct($product_id, 0);
|
||||
$product = $product->toArray();
|
||||
$product['mer_id'] = $mer_id;
|
||||
$product['old_product_id'] = $product['product_id'];
|
||||
return $this->repository->create($product, 0,1);
|
||||
|
||||
$productId = $this->repository->create($product, 0, 1);
|
||||
$data = [
|
||||
'product_id' => $productId,
|
||||
'mer_id' => $mer_id,
|
||||
'source_mer_id' => $product['mer_id'],
|
||||
'street_code' => $street_code,
|
||||
'weight' => 1,
|
||||
'status' => 1,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'type_id' => $type_id,
|
||||
'category_id' => $category_id,
|
||||
'cate_id' => $product['type']
|
||||
];
|
||||
Db::name('cloud_product')->insert($data);
|
||||
return $productId;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class Demo extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// Queue::push(ProductCopyJob::class, ['product_id' => 0, 'mer_id' =>0]);//短信通知
|
||||
Queue::push(ProductCopyJob::class, ['product_id' => 0, 'mer_id' =>0]);//短信通知
|
||||
|
||||
halt(1);
|
||||
$mer_id = 104;
|
||||
|
@ -24,7 +24,7 @@ class ProductCopyJob implements JobInterface
|
||||
public function fire($job, $data)
|
||||
{
|
||||
$make = app()->make(StoreProduct::class);
|
||||
$make->copyProduct($data['id'],$data['copy_id']);
|
||||
$make->copy($data['id'],$data['copy_id']);
|
||||
$job->delete();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user