<?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; } }