65 lines
1.9 KiB
PHP
65 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\controller\BaseCom;
|
|
|
|
class Friend extends BaseCom
|
|
{
|
|
//交友开始
|
|
public function start_friend(){
|
|
$key_name = "api:friend:start_friend:" . $this->uid;
|
|
redis_lock_exits($key_name);
|
|
$room_id = input('room_id', '');
|
|
$reslut = model('Friend')->start_friend($this->uid,$room_id);
|
|
redis_unlocks($key_name);
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//交友延时
|
|
public function delay(){
|
|
$friend_id = input('friend_id', '');
|
|
$room_id = input('room_id', '');
|
|
$delay_times = input('delay_times', '');//分钟
|
|
|
|
$reslut = model('Friend')->delay($this->uid,$room_id,$friend_id,$delay_times);
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//交友结束
|
|
public function end_friend(){
|
|
|
|
$friend_id = input('friend_id', '');
|
|
$room_id = input('room_id', '');
|
|
|
|
$result = model('Friend')->end_friend($this->uid,$room_id,$friend_id);
|
|
|
|
return V($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
|
|
//卡关系 创建关系
|
|
public function create_relation()
|
|
{
|
|
$key_name = "api:friend:create_relation:" . $this->uid;
|
|
redis_lock_exits($key_name);
|
|
$room_id = input('room_id', '');
|
|
$friend_id = input('friend_id', '');
|
|
$user1_id = input('user1_id', '');
|
|
$user2_id = input('user2_id', '');
|
|
$relation_id = input('relation_id', '');
|
|
$result = model('Friend')->createRelation($this->uid,$room_id,$friend_id,$user1_id,$user2_id,$relation_id);
|
|
redis_unlocks($key_name);
|
|
return V($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
|
|
//退出私密小屋
|
|
public function out_room()
|
|
{
|
|
$room_id = input('room_id', '');
|
|
|
|
$result = model('Friend')->outRoom($this->uid,$room_id);
|
|
|
|
return V($result['code'], $result['msg'], $result['data']);
|
|
}
|
|
} |