48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\api\controller;
|
||
|
|
|
||
|
|
use app\common\controller\BaseCom;
|
||
|
|
use think\Controller;
|
||
|
|
use think\Db;
|
||
|
|
|
||
|
|
class Gift extends BaseCom
|
||
|
|
{
|
||
|
|
//初始化
|
||
|
|
protected function initialize()
|
||
|
|
{
|
||
|
|
//允许跨域
|
||
|
|
header('Access-Control-Allow-Origin: *');
|
||
|
|
}
|
||
|
|
//获取礼物标签列表
|
||
|
|
public function get_gift_label()
|
||
|
|
{
|
||
|
|
$reslut = model('Gift')->get_gift_label();
|
||
|
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||
|
|
}
|
||
|
|
|
||
|
|
//获取礼物列表
|
||
|
|
public function get_gift_list()
|
||
|
|
{
|
||
|
|
$label = input('label',0);
|
||
|
|
$reslut = model('Gift')->get_gift_list($label);
|
||
|
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||
|
|
}
|
||
|
|
//聊天送礼物 (音信)
|
||
|
|
public function chat_gift_send()
|
||
|
|
{
|
||
|
|
$user_id = input('user_id',$this->uid);
|
||
|
|
$gid = input('gid',0);
|
||
|
|
$num = input('num',0);
|
||
|
|
$to_uid = input('to_uid',0);
|
||
|
|
$gift_type = input('gift_type',1);
|
||
|
|
if(empty($user_id) || empty($gid) || empty($num) || empty($to_uid)){
|
||
|
|
return V(0,'参数错误', []);
|
||
|
|
}
|
||
|
|
$reslut = model('GiveGift')->chat_give_gift($user_id,$gid,$num,$to_uid,$gift_type);
|
||
|
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|