This commit is contained in:
mkm 2024-01-23 12:27:09 +08:00
parent 8890972390
commit fa7e054bee
3 changed files with 100 additions and 16 deletions

View File

@ -306,6 +306,7 @@ class StoreProduct extends BaseController
public function copy($product_id = 0, $mer_id = 0, $street_code = 0, $type_id = 0, $category_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('参数错误'); if ($product_id == 0) return app('json')->fail('参数错误');
$find= Db::name('merchant')->where('mer_id',$mer_id)->find();
$products = $this->repository->getAdminOneProduct($product_id, 0); $products = $this->repository->getAdminOneProduct($product_id, 0);
$product = $products->toArray(); $product = $products->toArray();
$product['mer_id'] = $mer_id; $product['mer_id'] = $mer_id;
@ -321,7 +322,12 @@ class StoreProduct extends BaseController
'create_time' => date('Y-m-d H:i:s'), 'create_time' => date('Y-m-d H:i:s'),
'type_id' => $type_id, 'type_id' => $type_id,
'category_id' => $category_id, 'category_id' => $category_id,
'cate_id' => $product['cate_id'] 'cate_id' => 2244,
'long' => $find['long'],
'lat' => $find['lat'],
'lat' => $find['lat'],
'store_name' => $products['store_name'],
'activity_id' =>2,
]; ];
Db::name('cloud_product')->insert($data); Db::name('cloud_product')->insert($data);
return $productId; return $productId;

View File

@ -21,6 +21,7 @@ use Exception;
use ZipArchive; use ZipArchive;
use think\facade\Queue; use think\facade\Queue;
use crmeb\jobs\ProductCopyJob; use crmeb\jobs\ProductCopyJob;
/** /**
* Class Auth * Class Auth
* @package app\controller\api * @package app\controller\api
@ -34,14 +35,91 @@ class Demo extends BaseController
return app('json')->success('修改成功'); return app('json')->success('修改成功');
//[31,32,118,39,167,236,237,238,239] //[31,32,118,39,167,236,237,238,239]
// return app('json')->success('修改成功');>whereIn('mer_id',[110,116,149,227,226,35,117,148,156,104,137,151,136,183,140,229,79,133,235])-> // return app('json')->success('修改成功');>whereIn('mer_id',[110,116,149,227,226,35,117,148,156,104,137,151,136,183,140,229,79,133,235])->
// $merchant = Db::name('merchant')->where('mer_id', 31)->find();
// $arr = Db::name('cloud_product')->where('mer_id', $merchant['mer_id'])->select();
// $arr=Db::name('store_product')->whereIn('mer_id',[31,32,118,39,167,236,237,238,239])->where('is_show',1)->where('stock',0)->field('product_id')->select();
// foreach ($arr as $item) {
$arr=Db::name('store_product')->whereIn('mer_id',[31,32,118,39,167,236,237,238,239])->where('is_show',1)->where('stock',0)->field('product_id')->select(); // $store_name = Db::name('store_product')->where('product_id', $item['product_id'])->value('store_name');
foreach($arr as $item){ // if ($store_name) {
// Db::name('cloud_product')->where('mer_id', $merchant['mer_id'])->where(
Queue::push(ProductCopyJob::class, ['product_id' => $item['product_id']]);//短信通知 // 'product_id',
// $item['product_id']
// )->update(['store_name' => $store_name,'long'=>$merchant['long'],'lat'=>$merchant['lat']]);
// }
// // Queue::push(ProductCopyJob::class, ['product_id' => $item['product_id']]);//短信通知
// }
$arr=[
['product_id'=>171650,],
['product_id'=>171649,],
['product_id'=>171648,],
['product_id'=>171647],
];
$mer_id=167;//导入到的商户
$street_code=510521107;//导入到的商户
$type_id=17;//导入到的商户分类
$category_id=2566;//导入到的商户分类
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
} }
$mer_id=236;//导入到的商户
$street_code=510521123;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
$mer_id=237;//导入到的商户
$street_code=510521115;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
$mer_id=238;//导入到的商户
$street_code=510521105;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
$mer_id=239;//导入到的商户
$street_code=510521116;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
//江阳
$mer_id=31;//导入到的商户
$street_code=510502108;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
$mer_id=32;//导入到的商户
$street_code=510502107;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
$mer_id=118;//导入到的商户
$street_code=510502106;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
$mer_id=39;//导入到的商户
$street_code=510502105;//导入到的商户
foreach($arr as $k=>$v){
Queue::push(ProductCopyJob::class, ['product_id' => $v['product_id'], 'mer_id' =>$mer_id,'street_code'=>$street_code,'type_id'=>$type_id,'category_id'=>$category_id]);//短信通知
}
} }
public function transcoding($fileName) public function transcoding($fileName)
@ -55,9 +133,10 @@ class Demo extends BaseController
return $fileName; return $fileName;
} }
function createDirectories($path) { function createDirectories($path)
{
if (is_dir($path)) { if (is_dir($path)) {
return true ; return true;
} else { } else {
$parts = explode(DIRECTORY_SEPARATOR, $path); $parts = explode(DIRECTORY_SEPARATOR, $path);
$part = null; $part = null;
@ -73,8 +152,7 @@ class Demo extends BaseController
} }
} }
return true ; return true;
} }
} }
} }

View File

@ -34,8 +34,8 @@ class ProductCopyJob implements JobInterface
// } // }
// } // }
// $make = app()->make(StoreProduct::class); $make = app()->make(StoreProduct::class);
// $make->copy($data['product_id'],$data['mer_id'],$data['street_code'],$data['type_id'],$data['category_id']); $make->copy($data['product_id'],$data['mer_id'],$data['street_code'],$data['type_id'],$data['category_id']);
$job->delete(); $job->delete();
} }