<?php
namespace Home\Controller;
vendor('tencentsdk.TCloudAutoLoader');

use Think\Controller;
use SignedCookie;
use Zhida\OAuthHelperV3;
use Think\Upload\Driver\Qiniu\QiniuStorage;

use Think\Log;

class IndexController extends Controller
{
    private $auth_type = OAuthHelperV3::SCOPE_USERINFO;
    private $cookie_uid_key = 'skp-rotor-v1';
    private $debug = 1;
    private $today;
    use ControllerTrait;
    
    public function index()
    {
      $this->display();
    }

    public function getInfo(){
      $this->ajaxReturn(array(
        'status' => 1,
        'poster' => 1,
        'msg' => '查询成功',
        'branch'=> '广东',
        'step' => 1
    ));
      $referer = $_SERVER['HTTP_REFERER'];
      $refererInfo = parse_url( $referer );
      if( $refererInfo['host'] != $_SERVER['HTTP_HOST'] )
      {
          header("HTTP/1.0 404 Not Found");
          exit;
      }
      $name = $_POST['name'];
      $code = $_POST['code'];
      $job_number = M('list')->where(array(
        'code' => $code
      ))->find();

      if($job_number)
      {
        if($job_number['name'] == $name)
        {
          $this->ajaxReturn(array(
              'status' => 1,
              'poster' => $job_number['level'],
              'msg' => '查询成功',
              'branch'=> $job_number['branch'],
              'step' => 1
          ));
          return;
        }
        else {
          $this->ajaxReturn(array(
              'status' => 0,
              'msg' => '您填写的姓名有误',
              'step' => 1
          ));
          return;
        }
      }else {
        $this->ajaxReturn(array(
            'status' => 0,
            'msg' => '您填写的工号有误',
            'step' => 1
        ));
        return;
      }
    }
}