更新逛逛

This commit is contained in:
mkm 2023-01-16 09:30:52 +08:00
parent 39be5320b5
commit 66ac64a05a

View File

@ -0,0 +1,33 @@
<?php
declare (strict_types=1);
namespace app\listener;
use think\facade\Db;
class CommunityAddress
{
/**
* 逛逛社区写入区域中间表
*
* @return mixed
*/
public function handle($event)
{
$find = Db::name('nk_user')->where('user_id', $event['uid'])->find();
if ($find && $find['village_id'] != 0) {
$data = [
'user_id' => $event['uid'],
'area_id' => $find['area_id'],
'street_id' => $find['street_id'],
'village_id' => $find['village_id'],
'village_code' => $find['village_code'],
'brigade_id' => $find['brigade_id'],
'community_id' => $event['community_id']
];
Db::name('community_address')->insert($data);
return true;
}
return false;
}
}