Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -4,6 +4,7 @@ namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use app\common\service\RedpacketService;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 红包接口
|
||||
@@ -32,14 +33,13 @@ class Redpacket extends BaseCom
|
||||
public function grab()
|
||||
{
|
||||
$redpacketId = $this->request->post('redpacket_id');
|
||||
$password = $this->request->post('password', '');
|
||||
|
||||
if (empty($redpacketId)) {
|
||||
return V(0, '红包ID不能为空');
|
||||
}
|
||||
|
||||
$service = new RedpacketService();
|
||||
$reslut = $service->grabWithResult($redpacketId, $this->uid, $password);
|
||||
$reslut = $service->grabWithResult($redpacketId, $this->uid);
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -49,21 +49,20 @@ class Redpacket extends BaseCom
|
||||
*/
|
||||
public function grabResult()
|
||||
{
|
||||
$user = $this->auth->getUser();
|
||||
$redpacketId = $this->request->get('redpacket_id');
|
||||
|
||||
if (empty($redpacketId)) {
|
||||
$this->error('红包ID不能为空');
|
||||
return V(0, '红包ID不能为空');
|
||||
}
|
||||
|
||||
$service = new RedpacketService();
|
||||
$result = $service->getGrabResult($redpacketId, $user->id);
|
||||
$result = $service->getGrabResult($redpacketId, $this->uid);
|
||||
|
||||
if (!$result) {
|
||||
$this->error('红包不存在');
|
||||
return V(0, '红包不存在');
|
||||
}
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
return V(1, '获取成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,25 +71,19 @@ class Redpacket extends BaseCom
|
||||
public function detail()
|
||||
{
|
||||
$redpacketId = $this->request->get('redpacket_id');
|
||||
$currentUserId = $this->auth->isLogin() ? $this->auth->id : 0;
|
||||
|
||||
if (empty($redpacketId)) {
|
||||
$this->error('红包ID不能为空');
|
||||
return V(0, '红包ID不能为空');
|
||||
}
|
||||
|
||||
try {
|
||||
$service = new RedpacketService();
|
||||
$detail = $service->getDetail($redpacketId, $currentUserId);
|
||||
$service = new RedpacketService();
|
||||
$detail = $service->getDetail($redpacketId, $this->uid);
|
||||
|
||||
if (!$detail) {
|
||||
$this->error('红包不存在');
|
||||
}
|
||||
|
||||
$this->success('获取成功', $detail);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
if (!$detail) {
|
||||
return V(0, '红包不存在');
|
||||
}
|
||||
|
||||
return V(1, '获取成功', $detail);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,4 +94,12 @@ class Redpacket extends BaseCom
|
||||
$options = \app\common\model\Redpacket::$countdownOptions;
|
||||
$this->success('获取成功', $options);
|
||||
}
|
||||
|
||||
// 获取房间内红包列表
|
||||
public function roomRedPackets()
|
||||
{
|
||||
$roomId = $this->request->get('room_id');
|
||||
$result = Db::name('redpacket')->where(['room_id' => $roomId, 'status' => ['<=',1]])->select();
|
||||
return V(1, '获取成功', $result);
|
||||
}
|
||||
}
|
||||
@@ -119,6 +119,8 @@ class Chat extends Model
|
||||
|
||||
//清空个人魅力
|
||||
// ClearUserCharm = 1059,
|
||||
//发红包
|
||||
// RedPacket = 1060,
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,18 +50,18 @@ class UserWallet extends Model
|
||||
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
|
||||
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
|
||||
// 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益,20.发布头条扣除余额,21.公会长收益,22.提现驳回或提现失败返还,23.财富等级奖励金币领取,24.删除关系扣金币
|
||||
//27.小时榜获得
|
||||
//27.小时榜获得,28-新人充值好礼,32-发红包(金币),29-发红包(钻石),30-抢红包(金币),31-抢红包(钻石)
|
||||
if($gift_type == 1){ //1金币,2收益(钻石)
|
||||
if($in_out_type == 1){//1收入
|
||||
$in_out_types = [2,5,6,8,13,14,15,16,22,23,26,27];
|
||||
$in_out_types = [2,5,6,8,13,14,15,16,22,23,26,27,30,28];
|
||||
}elseif($in_out_type == 2){//2支出
|
||||
$in_out_types = [4,7,10,17,20,24,25];
|
||||
$in_out_types = [4,7,10,17,20,24,25,32];
|
||||
}
|
||||
}elseif($gift_type == 2){ //1金币,2收益(钻石)
|
||||
if($in_out_type == 1){//1收入
|
||||
$in_out_types = [6,9,11,12,18,19,21,22];
|
||||
$in_out_types = [6,9,11,12,18,19,21,22,31,28];
|
||||
}elseif($in_out_type == 2){//2支出
|
||||
$in_out_types = [3,14];
|
||||
$in_out_types = [3,14,29];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user