diff --git a/application/api/controller/Redpacket.php b/application/api/controller/Redpacket.php index b22222e..8597b4b 100644 --- a/application/api/controller/Redpacket.php +++ b/application/api/controller/Redpacket.php @@ -100,6 +100,11 @@ class Redpacket extends BaseCom { $roomId = $this->request->get('room_id'); $result = Db::name('redpacket')->where(['room_id' => $roomId, 'status' => ['<=',1]])->select(); + if($result){ + foreach ($result as $item) { + $item['redpacket_id'] = $item['id']; + } + } return V(1, '获取成功', $result); } } \ No newline at end of file diff --git a/application/common/model/Redpacket.php b/application/common/model/Redpacket.php index 3401869..0796a9e 100644 --- a/application/common/model/Redpacket.php +++ b/application/common/model/Redpacket.php @@ -121,6 +121,7 @@ class Redpacket extends Model //给前端推送信息 $data['nickname'] = Db::name('user')->where('id', $data['user_id'])->value('nickname'); + $data['redpacket_id'] = $redpacketId; $text = [ 'redpacketInfo' => $data, 'text' => '' @@ -147,6 +148,7 @@ class Redpacket extends Model $redpacket = $redpacket->toArray(); $redpacket['nickname'] = Db::name('user')->where('id', $redpacket['user_id'])->value('nickname'); + $redpacket['redpacket_id'] = $redpacket['id']; return $redpacket; }