新增商城直播打赏接口
This commit is contained in:
parent
9c0e7645f8
commit
f537c3b18c
@ -65,9 +65,9 @@ class Zhibo extends BaseController
|
||||
$userBillRepository->decBill($user['uid'], 'now_money', 'zhibo_reward', [
|
||||
'link_id' => $orderId,
|
||||
'status' => 1,
|
||||
'title' => '直播打赏支出',
|
||||
'title' => '直播送礼支出',
|
||||
'number' => $params['amount'],
|
||||
'mark' => '余额打赏',
|
||||
'mark' => '余额送礼',
|
||||
'balance' => $user->now_money
|
||||
]);
|
||||
//主播加钱
|
||||
@ -77,16 +77,52 @@ class Zhibo extends BaseController
|
||||
$userBillRepository->incBill($master['uid'], 'now_money', 'zhibo_reward', [
|
||||
'link_id' => $orderId,
|
||||
'status' => 1,
|
||||
'title' => '直播打赏收入',
|
||||
'title' => '直播送礼收入',
|
||||
'number' => $params['amount'],
|
||||
'mark' => '直播打赏收入',
|
||||
'mark' => '直播送礼收入',
|
||||
'balance' => $master['now_money']
|
||||
]);
|
||||
});
|
||||
} catch (Exception $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
return app('json')->success('送礼成功');
|
||||
}
|
||||
|
||||
return app('json')->success($params);
|
||||
public function rewardList()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['type']);
|
||||
if (empty($params['type'])) {
|
||||
return app('json')->fail('类型不能为空');
|
||||
}
|
||||
$user = $this->request->userInfo();
|
||||
$where = [];
|
||||
if ($params['type'] == 1) {
|
||||
// 送出的礼物
|
||||
$where['ub.pm'] = 0;
|
||||
$where['ub.type'] = 'zhibo_reward';
|
||||
$where['uzo.uid'] = $user['uid'];
|
||||
} elseif ($params['type'] == 2){
|
||||
// 收到的礼物
|
||||
$where['ub.pm'] = 1;
|
||||
$where['ub.type'] = 'zhibo_reward';
|
||||
$where['uzo.master_id'] = $user['uid'];
|
||||
} else {
|
||||
return app('json')->fail('类型错误');
|
||||
}
|
||||
$count = Db::name('user_bill')->alias('ub')->leftJoin('user_zhibo_order uzo','uzo.order_id = ub.link_id')->where($where)->count();
|
||||
$list = Db::name('user_bill')->alias('ub')->leftJoin('user_zhibo_order uzo','uzo.order_id = ub.link_id')->where($where)->limit(($page-1) * $limit, $limit)->field([
|
||||
'uzo.order_id',
|
||||
'uzo.live_stream_id',
|
||||
'uzo.live_name',
|
||||
'uzo.gift_id',
|
||||
'uzo.gift_name',
|
||||
'uzo.order_sn',
|
||||
'uzo.amount',
|
||||
'ub.title',
|
||||
'uzo.create_time'
|
||||
])->fetchSql(false)->select();
|
||||
return app('json')->success(compact('count', 'list'));
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,9 @@ Route::group('api/', function () {
|
||||
Route::post('user/margin', 'api.Auth/doMargin');
|
||||
Route::get('user/margin/list', 'api.Auth/marginList');
|
||||
|
||||
//绑定推荐人
|
||||
|
||||
Route::post('zhibo/reward', 'api.user.Zhibo/reward');
|
||||
Route::get('zhibo/rewardList', 'api.user.Zhibo/rewardList');
|
||||
|
||||
//优惠券
|
||||
Route::group('coupon', function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user