更新后台
This commit is contained in:
parent
a5f478d660
commit
901e977025
@ -37,6 +37,7 @@ use app\common\repositories\user\UserBrokerageRepository;
|
|||||||
use app\common\repositories\user\UserMerchantRepository;
|
use app\common\repositories\user\UserMerchantRepository;
|
||||||
use app\common\repositories\user\UserRepository;
|
use app\common\repositories\user\UserRepository;
|
||||||
use crmeb\jobs\PayGiveCouponJob;
|
use crmeb\jobs\PayGiveCouponJob;
|
||||||
|
use crmeb\jobs\ProductImportJob;
|
||||||
use crmeb\jobs\SendSmsJob;
|
use crmeb\jobs\SendSmsJob;
|
||||||
use crmeb\jobs\UserBrokerageLevelJob;
|
use crmeb\jobs\UserBrokerageLevelJob;
|
||||||
use crmeb\jobs\SupplyChainOrderBrokerAgeJob;
|
use crmeb\jobs\SupplyChainOrderBrokerAgeJob;
|
||||||
@ -2461,24 +2462,26 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$mer_cate['level']=1;
|
$mer_cate['level']=1;
|
||||||
$mer_cate_id=Db::name('store_category')->insertGetId($mer_cate);
|
$mer_cate_id=Db::name('store_category')->insertGetId($mer_cate);
|
||||||
}
|
}
|
||||||
$make = app()->make(ProductRepository::class);
|
|
||||||
$type=Db::name('merchant')->where('mer_id',$merId)->value('type_id');
|
$type=Db::name('merchant')->where('mer_id',$merId)->value('type_id');
|
||||||
$product_type=0;
|
$product_type=0;
|
||||||
if ($type==12){
|
if ($type==12){
|
||||||
$product_type=98;//供应链
|
$product_type=98;//供应链
|
||||||
}
|
}
|
||||||
foreach ($data as $datum) {
|
foreach ($data as $datum) {
|
||||||
$find=Db::name('store_product')->where('mer_id', $merId)->where('bar_code', $datum['where']['bar_code'])->find();
|
// $find=Db::name('store_product')->where('mer_id', $merId)->where('bar_code', $datum['where']['bar_code'])->find();
|
||||||
if ($find){
|
// if ($find){
|
||||||
Db::name('store_product')->where('product_id', $find['product_id'])->update($datum['value']);
|
// Db::name('store_product')->where('product_id', $find['product_id'])->update($datum['value']);
|
||||||
}else{
|
// }else{
|
||||||
$store_category_id=Db::name('store_category')->where('mer_id',0)->where('cate_name',$datum['value']['cate_id'])->value('store_category_id');
|
$store_category_id=Db::name('store_category')->where('mer_id',0)->where('cate_name',$datum['value']['cate_id'])->value('store_category_id');
|
||||||
|
if ($store_category_id==null){
|
||||||
|
$store_category_id=438;
|
||||||
|
}
|
||||||
$datas = [
|
$datas = [
|
||||||
"image" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/03d76202301101051502568.png",
|
"image" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/oa_app/23565656.png",
|
||||||
"slider_image" => [
|
"slider_image" => [
|
||||||
0 => "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3d80f202301101051438680.png",
|
0 => "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/oa_app/23565656.png",
|
||||||
],
|
],
|
||||||
"store_name" => $datum['value']['store_name'],
|
"store_name" => $datum['value']['store_name'].' '.$datum['value']['specifications'],
|
||||||
"store_info" => $datum['value']['store_name'],
|
"store_info" => $datum['value']['store_name'],
|
||||||
"keyword" => $datum['value']['keyword'],
|
"keyword" => $datum['value']['keyword'],
|
||||||
"bar_code" => $datum['value']['bar_code'],
|
"bar_code" => $datum['value']['bar_code'],
|
||||||
@ -2487,7 +2490,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
"mer_cate_id" => [
|
"mer_cate_id" => [
|
||||||
0 => $mer_cate_id//要修改
|
0 => $mer_cate_id//要修改
|
||||||
],
|
],
|
||||||
'product_type'=>98,
|
'product_type'=>$product_type,
|
||||||
"unit_name" => $datum['value']['unit_name'],
|
"unit_name" => $datum['value']['unit_name'],
|
||||||
"sort" => 0,
|
"sort" => 0,
|
||||||
"is_show" => "",
|
"is_show" => "",
|
||||||
@ -2513,10 +2516,10 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
"pay_limit" => 0,
|
"pay_limit" => 0,
|
||||||
"attrValue" => [
|
"attrValue" => [
|
||||||
[
|
[
|
||||||
"image" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/03d76202301101051502568.png",
|
"image" => "https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/oa_app/23565656.png",
|
||||||
"price" => $datum['value']['price'],
|
"price" => $datum['value']['price'],
|
||||||
"cost" => $datum['value']['price'],
|
"cost" => $datum['value']['price'],
|
||||||
"ot_price" => $datum['value']['cost'],
|
"ot_price" => $datum['value']['price'],
|
||||||
"svip_price" => null,
|
"svip_price" => null,
|
||||||
"stock" => $datum['value']['stock'],
|
"stock" => $datum['value']['stock'],
|
||||||
"bar_code" => $datum['value']['bar_code'],
|
"bar_code" => $datum['value']['bar_code'],
|
||||||
@ -2525,7 +2528,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
"give_coupon_ids" => [],
|
"give_coupon_ids" => [],
|
||||||
"type" => 0,//供应链商品
|
"type" => 0,
|
||||||
"svip_price" => 0,
|
"svip_price" => 0,
|
||||||
"svip_price_type" => 0,
|
"svip_price_type" => 0,
|
||||||
"params" => [],
|
"params" => [],
|
||||||
@ -2534,8 +2537,11 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
"mer_status" => 1,
|
"mer_status" => 1,
|
||||||
"rate" => 3,
|
"rate" => 3,
|
||||||
];
|
];
|
||||||
$make->create($datas,$product_type);
|
$data_list=[
|
||||||
}
|
'data'=>$datas,
|
||||||
|
'product_type'=>$product_type,
|
||||||
|
];
|
||||||
|
Queue::push(ProductImportJob::class,$data_list);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
27
crmeb/jobs/ProductImportJob.php
Normal file
27
crmeb/jobs/ProductImportJob.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace crmeb\jobs;
|
||||||
|
|
||||||
|
use app\common\repositories\store\product\ProductRepository;
|
||||||
|
use crmeb\interfaces\JobInterface;
|
||||||
|
use think\facade\Log;
|
||||||
|
|
||||||
|
class ProductImportJob implements JobInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function fire($job, $data)
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
$make = app()->make(ProductRepository::class);
|
||||||
|
$make->create($data['data'],$data['product_type']);
|
||||||
|
}catch (\Exception $e){
|
||||||
|
Log::error('商户ID:'.$data['mer_id'].' 导入文件 error : ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
$job->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function failed($data)
|
||||||
|
{
|
||||||
|
// TODO: Implement failed() method.
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user