User.php
942 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/10/23
* Time: 13:07
*/
namespace app\home\model;
use think\Db;
use think\Model;
class User extends Model
{
public function findData($where){
$data = $this->where($where)->find();
return $data;
}
public function updateData($where,$data){
$result = $this->where($where)->update($data);
return $result;
}
public function getUserInfo($where=[]){
if(empty($where)){
$userId=get_current_user_id();
$appId=config('wx_app_id');
$where=['user_id'=>$userId,'app_id'=>$appId];
}
if(empty($where)){
redirect('/');
}
$user= Db::name("third")->alias('b')
->join('__USER__ a','a.id=b.user_id','LEFT')
->field('a.*,b.openid,b.union_id')
->where($where)
->find();
return $user;
}
}