<?php

namespace App\Http\Controllers\API\H5;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class LoginController extends Controller
{
    public function Login()
    {
      $openid =request('openid');
      if(!isset($openid)) return \Yz::echoError1("openid不能为空");
      $user=DB::table('web_users')->where(['openid'=>$openid])->first();
      if(!$user){
        $user=DB::table('web_users')->insert(['openid'=>$openid]);
      }
      if($user){
        return \Yz::Return(true,"登录成功",['openid'=>$openid]);
      }else{
        return \Yz::echoError1("登录失败");
      }
    }
}
