mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
commit
e7915375f6
@ -177,7 +177,7 @@ class ShopsController extends Controller
|
|||||||
$res = $business->queryGroup();
|
$res = $business->queryGroup();
|
||||||
if (isset($res['ktt_group_query_list_response'])) {
|
if (isset($res['ktt_group_query_list_response'])) {
|
||||||
foreach ($res['ktt_group_query_list_response']['activity_list'] as $activity) {
|
foreach ($res['ktt_group_query_list_response']['activity_list'] as $activity) {
|
||||||
$business->downloadGoodsListAndBind($activity['activity_no']);
|
$business->downloadGoodsListAndBind($activity['activity_no'], $activity['title']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ class BusinessGoodsSku extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
'shop_id',
|
'shop_id',
|
||||||
'activity_no',
|
'activity_no',
|
||||||
'update_time',
|
'update_time',
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Goods
|
|||||||
return [$type, $appendParams];
|
return [$type, $appendParams];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function bindGoods(array $goodsList, $shopId)
|
public static function bindGoods(array $goodsList, $shopId, $title = '')
|
||||||
{
|
{
|
||||||
foreach ($goodsList as $businessGood) {
|
foreach ($goodsList as $businessGood) {
|
||||||
$skuList = $businessGood['sku_list'];
|
$skuList = $businessGood['sku_list'];
|
||||||
@ -35,6 +35,7 @@ class Goods
|
|||||||
$sku['is_sync'] = 0;
|
$sku['is_sync'] = 0;
|
||||||
}
|
}
|
||||||
$data = array_merge($businessGood, $sku);
|
$data = array_merge($businessGood, $sku);
|
||||||
|
$data['title'] = $title;
|
||||||
$businessGoodSku = BusinessGoodsSku::firstOrNew(
|
$businessGoodSku = BusinessGoodsSku::firstOrNew(
|
||||||
['shop_id' => $shopId, 'goods_id' => $businessGood['goods_id'], 'sku_id' => $sku['sku_id']],
|
['shop_id' => $shopId, 'goods_id' => $businessGood['goods_id'], 'sku_id' => $sku['sku_id']],
|
||||||
$data
|
$data
|
||||||
|
|||||||
@ -40,21 +40,21 @@ class KuaiTuanTuan extends BusinessClient
|
|||||||
return $this->shop;
|
return $this->shop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadGoodsListAndBind($activityNo, $page = 1)
|
public function downloadGoodsListAndBind($activityNo, $title = '', $page = 1)
|
||||||
{
|
{
|
||||||
[$type, $appendParams] = Goods::downloadGoods($activityNo, $page);
|
[$type, $appendParams] = Goods::downloadGoods($activityNo, $page);
|
||||||
$res = $this->doRequest($type, $appendParams);
|
$res = $this->doRequest($type, $appendParams);
|
||||||
$goods = $res['ktt_goods_query_list_response']['goods_list'];
|
$goods = $res['ktt_goods_query_list_response']['goods_list'];
|
||||||
$this->bindGoods($goods);
|
$this->bindGoods($goods, $title);
|
||||||
$pageNum = ceil($res['ktt_goods_query_list_response']['total'] / $appendParams['size']);
|
$pageNum = ceil($res['ktt_goods_query_list_response']['total'] / $appendParams['size']);
|
||||||
if ($pageNum > $page && 60 >= $page) {
|
if ($pageNum > $page && 60 >= $page) {
|
||||||
$this->downloadGoodsListAndBind($activityNo, $page + 1);
|
$this->downloadGoodsListAndBind($activityNo, $title, $page + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bindGoods($goods)
|
public function bindGoods($goods, $title = '')
|
||||||
{
|
{
|
||||||
Goods::bindGoods($goods, $this->shop->id);
|
Goods::bindGoods($goods, $this->shop->id, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function incrQuantity($businessGoodsSku, $num, $incremental)
|
public function incrQuantity($businessGoodsSku, $num, $incremental)
|
||||||
|
|||||||
@ -17,6 +17,7 @@ class CreateBusinessGoodsSkusTable extends Migration
|
|||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
$table->bigInteger('shop_id');
|
$table->bigInteger('shop_id');
|
||||||
$table->bigInteger('self_sku_id')->nullable();
|
$table->bigInteger('self_sku_id')->nullable();
|
||||||
|
$table->text('title')->nullable();
|
||||||
$table->string('activity_no')->nullable();
|
$table->string('activity_no')->nullable();
|
||||||
$table->string('category_name')->nullable();
|
$table->string('category_name')->nullable();
|
||||||
$table->bigInteger('create_time')->nullable();
|
$table->bigInteger('create_time')->nullable();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user