<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;
/**
 * 机构
 */
class Jigou extends Api
{
    protected $noNeedLogin = ['jigoulist'];
    protected $noNeedRight = ['*'];


    //待绑定列表
    public function jigoulist(){
        $subject_id = 1;

        $map = [
            'subject_id' => $subject_id,
            'status' => 1,
        ];

        //搜索
        $keyword = input('keyword','');
        if($keyword){
            $map['title'] = ['LIKE','%'.$keyword.'%'];
        }

        $lists = Db::name('vote_jigou')->field('id,title')
            ->where($map)->order('weigh desc,id desc')->select();

        $this->success(1,$lists);
    }


    //用户绑定选手
    public function bind_jigou(){
        $this->error('接口作废');
        $jigou_id = input('jigou_id',0);

        $data = [
            'bind_jigou_id'   => $jigou_id,
            'bind_jigou_times' => 'bind_jigou_times + 1',
        ];
        Db::name('user')->where('id',$this->auth->id)->update($data);

        $this->success('绑定成功');
    }






}
