lszyh
parent
a2b22afafc
commit
f32e982a13
@ -0,0 +1,49 @@ |
|||||||
|
<?php |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Author: 萤火科技 <admin@yiovo.com> |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
declare (strict_types=1); |
||||||
|
|
||||||
|
namespace app\job\controller\goods; |
||||||
|
|
||||||
|
use app\job\service\goods\GoodsDelete as GoodsDeleteService; |
||||||
|
use cores\BaseJob; |
||||||
|
use cores\traits\QueueTrait; |
||||||
|
use cores\exception\BaseException; |
||||||
|
use think\db\exception\DataNotFoundException; |
||||||
|
use think\db\exception\DbException; |
||||||
|
use think\db\exception\ModelNotFoundException; |
||||||
|
|
||||||
|
/** |
||||||
|
* 队列任务:商品批量导入 |
||||||
|
* Class Import |
||||||
|
* @package app\job\controller |
||||||
|
*/ |
||||||
|
class GoodsDelete extends BaseJob |
||||||
|
{ |
||||||
|
use QueueTrait; |
||||||
|
|
||||||
|
/** |
||||||
|
* 消费队列任务:商品导入 |
||||||
|
* @param array $data 参数 [index队列顺序;totalCount商品总数量;list商品列表;storeId商城ID] |
||||||
|
* @return bool 返回结果 |
||||||
|
* @throws BaseException |
||||||
|
* @throws DataNotFoundException |
||||||
|
* @throws DbException |
||||||
|
* @throws ModelNotFoundException |
||||||
|
*/ |
||||||
|
public function handle(array $data): bool |
||||||
|
{ |
||||||
|
$time = date('H:i:s'); |
||||||
|
echo "\n ---- GoodsDelete ---- {$time} ---- \n"; |
||||||
|
|
||||||
|
$service = new GoodsDeleteService; |
||||||
|
return $service->batch($data['list']); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
<?php |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Author: 萤火科技 <admin@yiovo.com> |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
declare (strict_types=1); |
||||||
|
|
||||||
|
namespace app\job\controller\goods; |
||||||
|
|
||||||
|
use app\job\service\goods\GoodsOffline as GoodsOfflineService; |
||||||
|
use cores\BaseJob; |
||||||
|
use cores\traits\QueueTrait; |
||||||
|
use cores\exception\BaseException; |
||||||
|
use think\db\exception\DataNotFoundException; |
||||||
|
use think\db\exception\DbException; |
||||||
|
use think\db\exception\ModelNotFoundException; |
||||||
|
|
||||||
|
/** |
||||||
|
* 队列任务:商品批量导入 |
||||||
|
* Class Import |
||||||
|
* @package app\job\controller |
||||||
|
*/ |
||||||
|
class GoodsOffline extends BaseJob |
||||||
|
{ |
||||||
|
use QueueTrait; |
||||||
|
|
||||||
|
/** |
||||||
|
* 消费队列任务:商品导入 |
||||||
|
* @param array $data 参数 [index队列顺序;totalCount商品总数量;list商品列表;storeId商城ID] |
||||||
|
* @return bool 返回结果 |
||||||
|
* @throws BaseException |
||||||
|
* @throws DataNotFoundException |
||||||
|
* @throws DbException |
||||||
|
* @throws ModelNotFoundException |
||||||
|
*/ |
||||||
|
public function handle(array $data): bool |
||||||
|
{ |
||||||
|
$time = date('H:i:s'); |
||||||
|
echo "\n ---- GoodsOffline ---- {$time} ---- \n"; |
||||||
|
|
||||||
|
$service = new GoodsOfflineService; |
||||||
|
return $service->batch($data['list']); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
<?php |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
// | Author: 萤火科技 <admin@yiovo.com> |
||||||
|
// +---------------------------------------------------------------------- |
||||||
|
declare (strict_types=1); |
||||||
|
|
||||||
|
namespace app\job\controller\goods; |
||||||
|
|
||||||
|
use app\job\service\goods\GoodsOnline as GoodsOnlineService; |
||||||
|
use cores\BaseJob; |
||||||
|
use cores\traits\QueueTrait; |
||||||
|
use cores\exception\BaseException; |
||||||
|
use think\db\exception\DataNotFoundException; |
||||||
|
use think\db\exception\DbException; |
||||||
|
use think\db\exception\ModelNotFoundException; |
||||||
|
|
||||||
|
/** |
||||||
|
* 队列任务:商品批量导入 |
||||||
|
* Class Import |
||||||
|
* @package app\job\controller |
||||||
|
*/ |
||||||
|
class GoodsOnline extends BaseJob |
||||||
|
{ |
||||||
|
use QueueTrait; |
||||||
|
|
||||||
|
/** |
||||||
|
* 消费队列任务:商品导入 |
||||||
|
* @param array $data 参数 [index队列顺序;totalCount商品总数量;list商品列表;storeId商城ID] |
||||||
|
* @return bool 返回结果 |
||||||
|
* @throws BaseException |
||||||
|
* @throws DataNotFoundException |
||||||
|
* @throws DbException |
||||||
|
* @throws ModelNotFoundException |
||||||
|
*/ |
||||||
|
public function handle(array $data): bool |
||||||
|
{ |
||||||
|
$time = date('H:i:s'); |
||||||
|
echo "\n ---- GoodsOnline ---- {$time} ---- \n"; |
||||||
|
|
||||||
|
$service = new GoodsOnlineService; |
||||||
|
return $service->batch($data['list']); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
<?php |
||||||
|
declare (strict_types=1); |
||||||
|
|
||||||
|
namespace app\job\service\goods; |
||||||
|
|
||||||
|
use app\common\library\helper; |
||||||
|
use app\common\service\BaseService; |
||||||
|
use app\common\model\Goods as GoodsModel; |
||||||
|
use app\common\model\GoodsSku; |
||||||
|
use app\store\model\GoodsCategoryRel; |
||||||
|
use cores\exception\BaseException; |
||||||
|
use think\facade\Log; |
||||||
|
use app\common\model\Channel; |
||||||
|
use app\common\model\Region; |
||||||
|
/** |
||||||
|
* 服务类:商品批量导入 |
||||||
|
* Class Import |
||||||
|
* @package app\job\service\goods |
||||||
|
*/ |
||||||
|
class GoodsDelete extends BaseService |
||||||
|
{ |
||||||
|
/** |
||||||
|
* 批量导入商品 |
||||||
|
* @param array $list |
||||||
|
* @param int $recordId |
||||||
|
* @param int $storeId |
||||||
|
* @return bool |
||||||
|
* @throws BaseException |
||||||
|
* @throws \think\db\exception\DataNotFoundException |
||||||
|
* @throws \think\db\exception\DbException |
||||||
|
* @throws \think\db\exception\ModelNotFoundException |
||||||
|
*/ |
||||||
|
public function batch(array $goodsIds): bool |
||||||
|
{ |
||||||
|
$goods_list = GoodsModel::whereIn('goods_id', $goodsIds) |
||||||
|
->where('is_delete',1) |
||||||
|
->field(['goods_id','is_sale','is_pool']) |
||||||
|
->select(); |
||||||
|
if ($goods_list->isEmpty()) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
$goodsIds = array_column($goods_list->toArray(), "goods_id"); |
||||||
|
GoodsModel::whereIn('origin_goods_id', $goodsIds)->update(['is_delete' => 1, 'update_time' => time()]); |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
<?php |
||||||
|
declare (strict_types=1); |
||||||
|
|
||||||
|
namespace app\job\service\goods; |
||||||
|
|
||||||
|
use app\common\library\helper; |
||||||
|
use app\common\service\BaseService; |
||||||
|
use app\common\model\Goods as GoodsModel; |
||||||
|
use app\common\model\GoodsSku; |
||||||
|
use app\store\model\GoodsCategoryRel; |
||||||
|
use cores\exception\BaseException; |
||||||
|
use think\facade\Log; |
||||||
|
use app\common\model\Channel; |
||||||
|
use app\common\model\Region; |
||||||
|
/** |
||||||
|
* 服务类:商品批量导入 |
||||||
|
* Class Import |
||||||
|
* @package app\job\service\goods |
||||||
|
*/ |
||||||
|
class GoodsOffline extends BaseService |
||||||
|
{ |
||||||
|
/** |
||||||
|
* 批量导入商品 |
||||||
|
* @param array $list |
||||||
|
* @param int $recordId |
||||||
|
* @param int $storeId |
||||||
|
* @return bool |
||||||
|
* @throws BaseException |
||||||
|
* @throws \think\db\exception\DataNotFoundException |
||||||
|
* @throws \think\db\exception\DbException |
||||||
|
* @throws \think\db\exception\ModelNotFoundException |
||||||
|
*/ |
||||||
|
public function batch(array $goodsIds): bool |
||||||
|
{ |
||||||
|
$goods_list = GoodsModel::whereIn('goods_id', $goodsIds) |
||||||
|
->where('is_delete',0) |
||||||
|
->where(function($query){ |
||||||
|
$query->where('is_pool',2)->whereOr('is_sale',0); |
||||||
|
}) |
||||||
|
->field(['goods_id','is_sale','is_pool']) |
||||||
|
->select(); |
||||||
|
if ($goods_list->isEmpty()) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
$goodsIds = array_column($goods_list->toArray(), "goods_id"); |
||||||
|
GoodsModel::whereIn('origin_goods_id', $goodsIds)->update(['status' => 20, 'is_jd_remove' => 1, 'update_time' => time()]); |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
<?php |
||||||
|
declare (strict_types=1); |
||||||
|
|
||||||
|
namespace app\job\service\goods; |
||||||
|
|
||||||
|
use app\common\library\helper; |
||||||
|
use app\common\service\BaseService; |
||||||
|
use app\common\model\Goods as GoodsModel; |
||||||
|
use app\common\model\GoodsSku; |
||||||
|
use app\store\model\GoodsCategoryRel; |
||||||
|
use cores\exception\BaseException; |
||||||
|
use think\facade\Log; |
||||||
|
use app\common\model\Channel; |
||||||
|
use app\common\model\Region; |
||||||
|
/** |
||||||
|
* 服务类:商品批量导入 |
||||||
|
* Class Import |
||||||
|
* @package app\job\service\goods |
||||||
|
*/ |
||||||
|
class GoodsOnline extends BaseService |
||||||
|
{ |
||||||
|
/** |
||||||
|
* 批量导入商品 |
||||||
|
* @param array $list |
||||||
|
* @param int $recordId |
||||||
|
* @param int $storeId |
||||||
|
* @return bool |
||||||
|
* @throws BaseException |
||||||
|
* @throws \think\db\exception\DataNotFoundException |
||||||
|
* @throws \think\db\exception\DbException |
||||||
|
* @throws \think\db\exception\ModelNotFoundException |
||||||
|
*/ |
||||||
|
public function batch(array $goodsIds): bool |
||||||
|
{ |
||||||
|
$goods_list = GoodsModel::whereIn('goods_id', $goodsIds) |
||||||
|
->where('is_delete',0) |
||||||
|
->where('is_sale',1) |
||||||
|
->where('is_pool',1) |
||||||
|
->field(['goods_id','is_sale','is_pool']) |
||||||
|
->select(); |
||||||
|
if ($goods_list->isEmpty()) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
$goodsIds = array_column($goods_list->toArray(), "goods_id"); |
||||||
|
GoodsModel::whereIn('origin_goods_id', $goodsIds)->update(['status' => 10, 'is_jd_remove' => 0, 'update_time' => time()]); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue