# tp5
## 放入队列

## 队列配置

## 队列消费

## 命令行

#tp6
## 队列配置

## 放入队列

## 消费队列
```
~~~
/**
* 抖音开放平台-获取达人橱窗商品信息
*/
public function showcaseGoodList(Job $job, $data)
{
list($authority_id, $access_token, $open_id) = $data;
$data['attempts'] = $job->attempts();
if ($job->attempts() > 2) {
Log::error('TalentJob->showcaseGoodList failed after max times! ' . \json_encode($data));
$job->delete();
return;
}
try {
$page = $totalPage = 1;
$tool = new UserRequst($authority_id);
app()->make(UserDao::class)->setTiktokSyncStatusOne($authority_id, 'goods_status', 2);
do {
$data['page'] = $page;
$res = $tool->getStoreGoodsList($access_token, $open_id, $page);
if (empty($res['results'])) {
Log::error('TalentJob->showcaseGoodList results empty! '
. \json_encode(['res' => $res, 'data' => $data], \JSON_UNESCAPED_UNICODE));
$job->delete();
return;
}
$showcaseDao = new ShowcaseDao();
$showcaseDao->updateTalentGood($authority_id, ['status' => 0]);
foreach ($res['results'] as &$value) {
$value['authority_id'] = $authority_id;
$value['status'] = 1;
TalentGoods::updateOrCreate(['authority_id' => $authority_id, 'product_id' => $value['product_id']], $value);
}
$page++;
if ($page == 1) {
$totalPage = ceil($res['total'] / 20);
$data['total'] = $res['total'] ?? 0;
}
} while ($page <= $totalPage);
// 修改账户信息为已同步完成橱窗商品
app()->make(UserDao::class)->setTiktokSyncStatusOne($authority_id, 'goods_status', 3);
Log::info('TalentJob->showcaseGoodList success! '
. \json_encode($data, \JSON_UNESCAPED_UNICODE));
$job->delete();
} catch (Throwable $e) {
if (stripos($e->getMessage(), 'access_token过期')) {
$job->delete();
Log::error('TalentJob->showcaseGoodList Exception! ' . \json_encode($data) . ' ' . $e->getMessage() . ' ' . substr($e->getTraceAsString(), 0, 1000));
return '';
}
$job->release(20); // 延迟时间
Log::error('TalentJob->showcaseGoodList exception! ' . $e->getMessage() . ' '
. \json_encode($data) . substr($e->getTraceAsString(), 0, 1000));
}
}
~~~
```

