Skip to content

Commit

Permalink
[Bug修复](1.1.5): 修复抽奖活动企业未上传Logo前端报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
maxincai committed Oct 21, 2021
1 parent f471d26 commit a9d27cc
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function handle(): array
// 接收参数
$params = $this->request->all();
// 查询数据
return $this->handleDate($params);
return $this->handleData($params);
}

/**
Expand Down Expand Up @@ -158,17 +158,17 @@ protected function messages(): array
* @param $params
* @throws \JsonException
*/
private function handleDate($params): array
private function handleData($params): array
{
$lottery = $this->lotteryService->getLotteryById((int)$params['id'], ['name', 'description', 'corp_id', 'time_type', 'start_time', 'end_time', 'contact_tags']);
$prize = $this->lotteryPrizeService->getLotteryPrizeByLotteryId((int)$params['id'], ['corp_card', 'prize_set', 'is_show', 'draw_set', 'exchange_set']);
// 企业名片
$corp = json_decode($prize['corpCard'], true, 512, JSON_THROW_ON_ERROR);
$corp['logo'] = file_full_url($corp['logo']);
$corp['logo'] = ! empty($corp['logo']) ? file_full_url((string) $corp['logo']) : '';
// 奖项设置
$prizeSet = json_decode($prize['prizeSet'], true, 512, JSON_THROW_ON_ERROR);
foreach ($prizeSet as $key => $val) {
$prizeSet[$key]['image'] = str_contains($val['image'], 'http') ? $val['image'] : file_full_url($val['image']);
$prizeSet[$key]['image'] = str_contains($val['image'], 'http') ? $val['image'] : file_full_url((string) $val['image']);
unset($prizeSet[$key]['num'], $prizeSet[$key]['rate']);
}
$prize['prizeSet'] = $prizeSet;
Expand Down

0 comments on commit a9d27cc

Please sign in to comment.