You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

<?php
namespace app\base\model\wechat;
use app\base\model\Base;
use think\model\concern\SoftDelete;
class WechatUser extends Base
{
use SoftDelete;
// 设置当前模型对应的完整数据表名称
protected $table = 'base_wechat_user';
protected $type = [
'tagid_list' => 'serialize'
];
/**
* 更新微信用户信息
* @param array $data 用户信息
* @date 2021-03-01
*/
public function updateUser($data)
{
$where = [
['openid', '=', $data['openid']]
];
$id = $this->getOneData($where, 'id');
if (!empty($id)) {
$data['id'] = $id;
}
return $this->dataUpdate($data);
}
/**
* 解除平台用户绑定
* @param integer $user_id USER_ID
* @date 2021-03-01
*/
public function unbindPlatform($user_id)
{
$where = [
['user_id', '=', $user_id]
];
$id = $this->getOneData($where, 'id');
if (!empty($id)) {
$data['id'] = $id;
$data['user_id'] = 0;
return $this->dataUpdate($data);
} else {
return true;
}
}
}