|
@@ -9,9 +9,44 @@ use think\Db;
|
|
|
*/
|
|
|
class Player extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = [];
|
|
|
+ protected $noNeedLogin = ['playerlist'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
+ //选手列表
|
|
|
+ public function playerlist(){
|
|
|
+ $subject_id = 1;
|
|
|
+
|
|
|
+ $map = [
|
|
|
+ 'subject_id' => $subject_id,
|
|
|
+ 'status' => 1,
|
|
|
+ ];
|
|
|
+
|
|
|
+ //搜索
|
|
|
+ $keyword = input('keyword','');
|
|
|
+ if($keyword){
|
|
|
+ $map['title|suozaidanwei|tuijiangonghui'] = ['LIKE','%'.$keyword.'%'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $lists = Db::name('vote_player')->field('id,title')
|
|
|
+ ->where($map)->order('votes desc,id desc')->autopage()->select();
|
|
|
+
|
|
|
+ $this->success(1,$lists);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //用户绑定选手
|
|
|
+ public function bind_player(){
|
|
|
+ $player_id = input('player_id',0);
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'bind_player_id' => $player_id,
|
|
|
+ 'bind_player_date' => strtotime(date('Y-m-d')),
|
|
|
+ ];
|
|
|
+ Db::name('user')->where('id',$this->auth->id)->update($data);
|
|
|
+
|
|
|
+ $this->success('绑定成功');
|
|
|
+ }
|
|
|
+
|
|
|
//给选手投票
|
|
|
public function record(){
|
|
|
$player_id = input('player_id','');
|