feat: #10000 优化快团团店铺商品下载
This commit is contained in:
parent
73285afbc1
commit
011cbec842
@ -174,7 +174,12 @@ class ShopsController extends Controller
|
||||
$shop = Shop::query()->find($id);
|
||||
$business = BusinessFactory::init()->make($shop->plat_id);
|
||||
$business->setShop($shop);
|
||||
$business->downloadGoodsListAndBind();
|
||||
$res = $business->queryGroup();
|
||||
if (isset($res['ktt_group_query_list_response'])) {
|
||||
foreach ($res['ktt_group_query_list_response']['activity_list'] as $activity) {
|
||||
$business->downloadGoodsListAndBind($activity['activity_no']);
|
||||
}
|
||||
}
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
|
||||
@ -41,11 +41,6 @@ class BusinessGoodsSku extends Model
|
||||
'create_time'
|
||||
];
|
||||
|
||||
/**
|
||||
* 不可批量赋值的属性。为空则所有熟悉都可以批量赋值
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'shop_id',
|
||||
'business_order_id',
|
||||
|
||||
@ -4,11 +4,6 @@ namespace App\Models;
|
||||
|
||||
class BusinessOrder extends Model
|
||||
{
|
||||
/**
|
||||
* 不可批量赋值的属性。为空则所有熟悉都可以批量赋值
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'shop_id',
|
||||
'receiver_address_detail',
|
||||
|
||||
@ -4,11 +4,6 @@ namespace App\Models;
|
||||
|
||||
class BusinessOrderItem extends Model
|
||||
{
|
||||
/**
|
||||
* 不可批量赋值的属性。为空则所有熟悉都可以批量赋值
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'shop_id',
|
||||
'business_order_id',
|
||||
|
||||
@ -15,11 +15,6 @@ class GoodsSku extends Model
|
||||
'exclude_ids'
|
||||
];
|
||||
|
||||
/**
|
||||
* 不可批量赋值的属性。为空则所有熟悉都可以批量赋值
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'goods_id',
|
||||
'title',
|
||||
|
||||
@ -23,7 +23,7 @@ abstract class BusinessClient
|
||||
|
||||
abstract public function auth();
|
||||
|
||||
abstract public function downloadGoodsListAndBind();
|
||||
abstract public function downloadGoodsListAndBind($activityNo);
|
||||
|
||||
abstract public function downloadGoods($skuId);
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ class Goods
|
||||
{
|
||||
$type = 'pdd.ktt.goods.query.list';
|
||||
$appendParams = [
|
||||
// 'activity_no' => $activityNo, // 非必填,团号(团号和创建时间只能传一个)
|
||||
'activity_no' => $activityNo, // 非必填,团号(团号和创建时间只能传一个)
|
||||
'page' => $page,
|
||||
'size' => $size,
|
||||
// 'update_time_end' => '', // 非必填,结束最后更新时间(毫秒级时间戳)
|
||||
|
||||
@ -40,15 +40,15 @@ class KuaiTuanTuan extends BusinessClient
|
||||
return $this->shop;
|
||||
}
|
||||
|
||||
public function downloadGoodsListAndBind($page = 1)
|
||||
public function downloadGoodsListAndBind($activityNo, $page = 1)
|
||||
{
|
||||
[$type, $appendParams] = Goods::downloadGoods($this->shop->owner_id, $page);
|
||||
[$type, $appendParams] = Goods::downloadGoods($activityNo, $page);
|
||||
$res = $this->doRequest($type, $appendParams);
|
||||
$goods = $res['ktt_goods_query_list_response']['goods_list'];
|
||||
$this->bindGoods($goods);
|
||||
$pageNum = ceil($res['ktt_goods_query_list_response']['total'] / $appendParams['size']);
|
||||
if ($pageNum > $page && 60 >= $page) {
|
||||
$this->downloadGoodsListAndBind($page + 1);
|
||||
$this->downloadGoodsListAndBind($activityNo, $page + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,16 +221,16 @@ class KuaiTuanTuan extends BusinessClient
|
||||
{
|
||||
[$type, $appendParams] = Groups::queryGroup();
|
||||
$res = $this->doRequest($type, $appendParams);
|
||||
if (isset($res['ktt_group_query_list_response'])) {
|
||||
foreach ($res['ktt_group_query_list_response']['activity_list'] as $activity) {
|
||||
$group = GroupsModel::query()->where('activity_no', $activity['activity_no'])->first();
|
||||
if ($group) {
|
||||
$group->is_help_sell = $activity[''];
|
||||
$group->status = $activity[''];
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (isset($res['ktt_group_query_list_response'])) {
|
||||
// foreach ($res['ktt_group_query_list_response']['activity_list'] as $activity) {
|
||||
// $group = GroupsModel::query()->where('activity_no', $activity['activity_no'])->first();
|
||||
// if ($group) {
|
||||
// $group->is_help_sell = $activity[''];
|
||||
// $group->status = $activity[''];
|
||||
// $group->save();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ class MiaoXuan extends BusinessClient
|
||||
// TODO: Implement auth() method.
|
||||
}
|
||||
|
||||
public function downloadGoodsListAndBind()
|
||||
public function downloadGoodsListAndBind($activityNo)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user