更新逛逛
This commit is contained in:
parent
39be5320b5
commit
66ac64a05a
33
app/listener/CommunityAddress.php
Normal file
33
app/listener/CommunityAddress.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user