<?php
namespace Smi\Controller;

use Think\Controller;

header("Content-Type:text/html;CharSet=UTF-8");
class ApiCityMyController extends Controller{
	/**
	 * 我的
	 */
	//获取小程序用户信息:昵称、头像
	public function getUserInfo(){
		$openid = $_GET['openid'];	//小程序openid
		if(!$openid || $openid == "null" || $openid == "undefined"){
			$result = array("status" => -1,"msg" => "小程序openid有误");
		}else{
			$info = M("users")->where(array("openid"=>$openid))->find();//查询用户信息
			if($info){
				$result = array("status" =>  1,"nickname" => $info['nickname'],"avatarurl" => $info['avatarurl']);
			}else{
				$result = array("status" => -1,"msg" => "查无此用户");
			}
		}
		apiReturn($result);
	}
}