<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/4/15
 * Time: 16:33
 */
namespace app\index\controller;
use app\index\logic\recuitlogic;

use think\Controller;

class Recuit extends Controller{
    /*
 * 20200302
 * steelxu
 * 标准输出检查找包
 * 测试成功后，再看是做到扩展的基础类，还是
 */
    public function stdout($arr){
        $res_r=array();
        if (empty($arr)){
            $res_r['code']=0;
            $res_r['errmsg']='无数据';
        }else{
            $res_r['code']=200;
            $res_r['resultData']=$arr;
        }

        return $res_r;
    }

    public function appout($arr){
        $res_r=array();
        if (empty($arr)){
            $res_r['code']=0;
            $res_r['msg']='无数据';
            $res_r['data']=$arr;
        }else{
            $res_r['code']=200;
            $res_r['msg']="请求成功";
            $res_r['data']=$arr;
        }

        return $res_r;
    }
    /*
     * 20200415
     */

    public function submitrecuit(){
        $queryinfo=request() -> param();
        $l_r=new recuitlogic();
        $rid=$l_r->savenewrecuit($queryinfo);
        return json_encode($this->stdout($rid),320);
    }

    /*
     * 20200415
     */
    public function queryrecuitrelation(){
        $queryinfo=request() -> param();
        $l_r=new recuitlogic();
        $rlist=$l_r->getulistbyrecuit($queryinfo);
        return json_encode($this->stdout($rlist),320);
    }

    /*
     * 20200416
     */
    public function qureyallrlist(){
        $queryinfo=request() -> param();
        $l_r=new recuitlogic();
        $rlist=$l_r->getallrecuit($queryinfo);
        return json_encode($this->stdout($rlist),320);
    }

    /*
     * 20200417
     */
    public function queryinfobytel(){
        $queryinfo=request() -> param();
        $l_r=new recuitlogic();
        $rec=$l_r->getnamebytl($queryinfo);
        return json_encode($this->stdout($rec),320);
    }

    /*
     * 20200419
     * 获取某用户的最新的数据
     */
    public  function querynewawardbyid(){
        $queryinfo=request() -> param();
        $l_r=new recuitlogic();
        $rec=$l_r->getawardbyrid($queryinfo);
        return json_encode($this->stdout($rec),320);
    }

    /*
     * 20230222
     */
    public  function querynewawardbyidforapp(){
        $queryinfo=request() -> param();
        $l_r=new recuitlogic();
        $rec=$l_r->getawardbyrid($queryinfo);
        return json_encode($this->appout($rec),320);
    }
}