Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
xiaozhan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
xiaozhan
Commits
f410096d
Commit
f410096d
authored
Feb 19, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
2d89333a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
315 additions
and
24 deletions
+315
-24
api/Appapi/Api/Live.php
+60
-0
api/Appapi/Domain/Live.php
+27
-20
api/Appapi/Model/Home.php
+5
-4
api/Appapi/Model/Live.php
+223
-0
No files found.
api/Appapi/Api/Live.php
View file @
f410096d
...
@@ -109,6 +109,13 @@ class Api_Live extends PhalApi_Api {
...
@@ -109,6 +109,13 @@ class Api_Live extends PhalApi_Api {
'giftcount'
=>
array
(
'name'
=>
'giftcount'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'礼物数量'
),
'giftcount'
=>
array
(
'name'
=>
'giftcount'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'礼物数量'
),
),
),
'sendWelfare'
=>
array
(
'uid'
=>
array
(
'name'
=>
'uid'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'用户ID'
),
'token'
=>
array
(
'name'
=>
'token'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'用户token'
),
'liveuid'
=>
array
(
'name'
=>
'liveuid'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'主播ID'
),
'stream'
=>
array
(
'name'
=>
'stream'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'流名'
),
),
'sendBarrage'
=>
array
(
'sendBarrage'
=>
array
(
'uid'
=>
array
(
'name'
=>
'uid'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'用户ID'
),
'uid'
=>
array
(
'name'
=>
'uid'
,
'type'
=>
'int'
,
'min'
=>
1
,
'require'
=>
true
,
'desc'
=>
'用户ID'
),
'token'
=>
array
(
'name'
=>
'token'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'用户token'
),
'token'
=>
array
(
'name'
=>
'token'
,
'type'
=>
'string'
,
'require'
=>
true
,
'desc'
=>
'用户token'
),
...
@@ -1621,6 +1628,59 @@ class Api_Live extends PhalApi_Api {
...
@@ -1621,6 +1628,59 @@ class Api_Live extends PhalApi_Api {
return
$rs
;
return
$rs
;
}
}
public
function
sendWelfare
()
{
$rs
=
array
(
'code'
=>
0
,
'msg'
=>
''
,
'info'
=>
array
());
$uid
=
$this
->
uid
;
$token
=
$this
->
token
;
$liveuid
=
$this
->
liveuid
;
$stream
=
checkNull
(
$this
->
stream
);
$checkToken
=
checkToken
(
$uid
,
$token
);
if
(
$checkToken
==
700
){
$rs
[
'code'
]
=
$checkToken
;
$rs
[
'msg'
]
=
'您的登陆状态失效,请重新登陆!'
;
return
$rs
;
}
$domain
=
new
Domain_Live
();
$result
=
$domain
->
sendWelfare
(
$uid
,
$liveuid
,
$stream
);
if
(
$result
==
1000
){
$rs
[
'code'
]
=
1000
;
$rs
[
'msg'
]
=
'福利袋未配置'
;
return
$rs
;
}
elseif
(
$result
==
1001
){
$rs
[
'code'
]
=
1001
;
$rs
[
'msg'
]
=
'余额不足'
;
return
$rs
;
}
else
if
(
$result
==
1002
){
$rs
[
'code'
]
=
1002
;
$rs
[
'msg'
]
=
'礼物信息不存在'
;
return
$rs
;
}
$info
=
getUserInfo
(
$liveuid
);
$rs
[
'info'
][
0
]
=
[
//welfare
'gifttoken'
=>
[
'welfare'
=>
$result
[
'welfare'
][
'gifttoken'
],
'gift'
=>
$result
[
'gift'
][
'gifttoken'
],
],
'level'
=>
$result
[
'welfare'
][
'level'
],
'coin'
=>
$result
[
'welfare'
][
'coin'
],
'liveuinfo'
=>
$info
];
unset
(
$result
[
'welfare'
][
'gifttoken'
]);
unset
(
$result
[
'gift'
][
'gifttoken'
]);
DI
()
->
redis
->
set
(
$rs
[
'info'
][
0
][
'gifttoken'
][
'welfare'
],
json_encode
(
$result
[
'welfare'
]));
DI
()
->
redis
->
set
(
$rs
[
'info'
][
0
][
'gifttoken'
][
'gift'
],
json_encode
(
$result
[
'gift'
]));
return
$rs
;
}
/**
/**
* 发送弹幕
* 发送弹幕
* @desc 用于发送弹幕
* @desc 用于发送弹幕
...
...
api/Appapi/Domain/Live.php
View file @
f410096d
<?php
<?php
class
Domain_Live
{
class
Domain_Live
{
public
function
checkBan
(
$uid
)
{
public
function
checkBan
(
$uid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -17,7 +17,7 @@ class Domain_Live {
...
@@ -17,7 +17,7 @@ class Domain_Live {
$rs
=
$model
->
createRoom
(
$uid
,
$data
);
$rs
=
$model
->
createRoom
(
$uid
,
$data
);
return
$rs
;
return
$rs
;
}
}
public
function
getFansIds
(
$touid
)
{
public
function
getFansIds
(
$touid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -25,7 +25,7 @@ class Domain_Live {
...
@@ -25,7 +25,7 @@ class Domain_Live {
$rs
=
$model
->
getFansIds
(
$touid
);
$rs
=
$model
->
getFansIds
(
$touid
);
return
$rs
;
return
$rs
;
}
}
public
function
changeLive
(
$uid
,
$stream
,
$status
)
{
public
function
changeLive
(
$uid
,
$stream
,
$status
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -33,7 +33,7 @@ class Domain_Live {
...
@@ -33,7 +33,7 @@ class Domain_Live {
$rs
=
$model
->
changeLive
(
$uid
,
$stream
,
$status
);
$rs
=
$model
->
changeLive
(
$uid
,
$stream
,
$status
);
return
$rs
;
return
$rs
;
}
}
public
function
changeLiveType
(
$uid
,
$stream
,
$data
)
{
public
function
changeLiveType
(
$uid
,
$stream
,
$data
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -49,7 +49,7 @@ class Domain_Live {
...
@@ -49,7 +49,7 @@ class Domain_Live {
$rs
=
$model
->
stopRoom
(
$uid
,
$stream
);
$rs
=
$model
->
stopRoom
(
$uid
,
$stream
);
return
$rs
;
return
$rs
;
}
}
public
function
stopInfo
(
$stream
)
{
public
function
stopInfo
(
$stream
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -57,7 +57,7 @@ class Domain_Live {
...
@@ -57,7 +57,7 @@ class Domain_Live {
$rs
=
$model
->
stopInfo
(
$stream
);
$rs
=
$model
->
stopInfo
(
$stream
);
return
$rs
;
return
$rs
;
}
}
public
function
checkLive
(
$uid
,
$liveuid
,
$stream
)
{
public
function
checkLive
(
$uid
,
$liveuid
,
$stream
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -65,7 +65,7 @@ class Domain_Live {
...
@@ -65,7 +65,7 @@ class Domain_Live {
$rs
=
$model
->
checkLive
(
$uid
,
$liveuid
,
$stream
);
$rs
=
$model
->
checkLive
(
$uid
,
$liveuid
,
$stream
);
return
$rs
;
return
$rs
;
}
}
public
function
roomCharge
(
$uid
,
$token
,
$liveuid
,
$stream
)
{
public
function
roomCharge
(
$uid
,
$token
,
$liveuid
,
$stream
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -73,7 +73,7 @@ class Domain_Live {
...
@@ -73,7 +73,7 @@ class Domain_Live {
$rs
=
$model
->
roomCharge
(
$uid
,
$token
,
$liveuid
,
$stream
);
$rs
=
$model
->
roomCharge
(
$uid
,
$token
,
$liveuid
,
$stream
);
return
$rs
;
return
$rs
;
}
}
public
function
getUserCoin
(
$uid
)
{
public
function
getUserCoin
(
$uid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -81,7 +81,7 @@ class Domain_Live {
...
@@ -81,7 +81,7 @@ class Domain_Live {
$rs
=
$model
->
getUserCoin
(
$uid
);
$rs
=
$model
->
getUserCoin
(
$uid
);
return
$rs
;
return
$rs
;
}
}
public
function
isZombie
(
$uid
)
{
public
function
isZombie
(
$uid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -89,15 +89,15 @@ class Domain_Live {
...
@@ -89,15 +89,15 @@ class Domain_Live {
$rs
=
$model
->
isZombie
(
$uid
);
$rs
=
$model
->
isZombie
(
$uid
);
return
$rs
;
return
$rs
;
}
}
public
function
getZombie
(
$stream
,
$where
)
{
public
function
getZombie
(
$stream
,
$where
)
{
$rs
=
array
();
$rs
=
array
();
$model
=
new
Model_Live
();
$model
=
new
Model_Live
();
$rs
=
$model
->
getZombie
(
$stream
,
$where
);
$rs
=
$model
->
getZombie
(
$stream
,
$where
);
return
$rs
;
return
$rs
;
}
}
public
function
getPop
(
$touid
)
{
public
function
getPop
(
$touid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -114,7 +114,7 @@ class Domain_Live {
...
@@ -114,7 +114,7 @@ class Domain_Live {
$rs
=
$model
->
getGiftList
();
$rs
=
$model
->
getGiftList
();
return
$rs
;
return
$rs
;
}
}
public
function
sendGift
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
)
{
public
function
sendGift
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -123,6 +123,13 @@ class Domain_Live {
...
@@ -123,6 +123,13 @@ class Domain_Live {
return
$rs
;
return
$rs
;
}
}
public
function
sendWelfare
(
$uid
,
$liveuid
,
$stream
)
{
$model
=
new
Model_Live
();
$rs
=
$model
->
sendWelfare
(
$uid
,
$liveuid
,
$stream
);
return
$rs
;
}
public
function
sendBarrage
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
,
$content
)
{
public
function
sendBarrage
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
,
$content
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -130,7 +137,7 @@ class Domain_Live {
...
@@ -130,7 +137,7 @@ class Domain_Live {
$rs
=
$model
->
sendBarrage
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
,
$content
);
$rs
=
$model
->
sendBarrage
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
,
$content
);
return
$rs
;
return
$rs
;
}
}
public
function
setAdmin
(
$liveuid
,
$touid
)
{
public
function
setAdmin
(
$liveuid
,
$touid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -138,7 +145,7 @@ class Domain_Live {
...
@@ -138,7 +145,7 @@ class Domain_Live {
$rs
=
$model
->
setAdmin
(
$liveuid
,
$touid
);
$rs
=
$model
->
setAdmin
(
$liveuid
,
$touid
);
return
$rs
;
return
$rs
;
}
}
public
function
getAdminList
(
$liveuid
)
{
public
function
getAdminList
(
$liveuid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -146,7 +153,7 @@ class Domain_Live {
...
@@ -146,7 +153,7 @@ class Domain_Live {
$rs
=
$model
->
getAdminList
(
$liveuid
);
$rs
=
$model
->
getAdminList
(
$liveuid
);
return
$rs
;
return
$rs
;
}
}
public
function
getUserHome
(
$uid
,
$touid
)
{
public
function
getUserHome
(
$uid
,
$touid
)
{
$rs
=
array
();
$rs
=
array
();
...
@@ -154,7 +161,7 @@ class Domain_Live {
...
@@ -154,7 +161,7 @@ class Domain_Live {
$rs
=
$model
->
getUserHome
(
$uid
,
$touid
);
$rs
=
$model
->
getUserHome
(
$uid
,
$touid
);
return
$rs
;
return
$rs
;
}
}
public
function
getReportClass
()
{
public
function
getReportClass
()
{
$rs
=
array
();
$rs
=
array
();
...
@@ -178,14 +185,14 @@ class Domain_Live {
...
@@ -178,14 +185,14 @@ class Domain_Live {
$rs
=
$model
->
getVotes
(
$liveuid
);
$rs
=
$model
->
getVotes
(
$liveuid
);
return
$rs
;
return
$rs
;
}
}
public
function
checkShut
(
$uid
,
$liveuid
)
{
public
function
checkShut
(
$uid
,
$liveuid
)
{
$rs
=
array
();
$rs
=
array
();
$model
=
new
Model_Live
();
$model
=
new
Model_Live
();
$rs
=
$model
->
checkShut
(
$uid
,
$liveuid
);
$rs
=
$model
->
checkShut
(
$uid
,
$liveuid
);
return
$rs
;
return
$rs
;
}
}
public
function
setShutUp
(
$uid
,
$liveuid
,
$touid
,
$showid
)
{
public
function
setShutUp
(
$uid
,
$liveuid
,
$touid
,
$showid
)
{
$rs
=
array
();
$rs
=
array
();
$model
=
new
Model_Live
();
$model
=
new
Model_Live
();
...
@@ -199,7 +206,7 @@ class Domain_Live {
...
@@ -199,7 +206,7 @@ class Domain_Live {
$rs
=
$model
->
kicking
(
$uid
,
$liveuid
,
$touid
);
$rs
=
$model
->
kicking
(
$uid
,
$liveuid
,
$touid
);
return
$rs
;
return
$rs
;
}
}
public
function
superStopRoom
(
$uid
,
$token
,
$liveuid
,
$type
)
{
public
function
superStopRoom
(
$uid
,
$token
,
$liveuid
,
$type
)
{
$rs
=
array
();
$rs
=
array
();
$model
=
new
Model_Live
();
$model
=
new
Model_Live
();
...
...
api/Appapi/Model/Home.php
View file @
f410096d
...
@@ -1212,16 +1212,17 @@ class Model_Home extends PhalApi_Model_NotORM {
...
@@ -1212,16 +1212,17 @@ class Model_Home extends PhalApi_Model_NotORM {
$users
=
array_column
(
$users
,
"uid"
);
$users
=
array_column
(
$users
,
"uid"
);
$userids
=
implode
(
","
,
$users
);
$userids
=
implode
(
","
,
$users
);
$where
.=
" type='expend' and action in ('sendgift','sendbarrage') and uid in (
{
$userids
}
) "
;
$where
.=
" type='expend' and action in ('sendgift','sendbarrage') and
to
uid in (
{
$userids
}
) "
;
$result
=
DI
()
->
notorm
->
users_coinrecord
$result
=
DI
()
->
notorm
->
users_coinrecord
->
select
(
'sum(totalcoin) as totalcoin, uid'
)
->
select
(
'sum(totalcoin) as totalcoin,
to
uid'
)
->
where
(
$where
)
->
where
(
$where
)
->
group
(
'uid'
)
->
group
(
'
to
uid'
)
->
order
(
'totalcoin desc'
)
->
order
(
'totalcoin desc'
)
->
limit
(
100
)
->
limit
(
100
)
->
fetchAll
();
->
fetchAll
();
foreach
(
$result
as
$k
=>
$v
)
{
foreach
(
$result
as
$k
=>
$v
)
{
$userinfo
=
getUserInfo
(
$v
[
'uid'
]);
$userinfo
=
getUserInfo
(
$v
[
'touid'
]);
$v
[
'uid'
]
=
$userinfo
[
'touid'
];
$v
[
'avatar'
]
=
$userinfo
[
'avatar'
];
$v
[
'avatar'
]
=
$userinfo
[
'avatar'
];
$v
[
'avatar_thumb'
]
=
$userinfo
[
'avatar_thumb'
];
$v
[
'avatar_thumb'
]
=
$userinfo
[
'avatar_thumb'
];
$v
[
'user_nicename'
]
=
$userinfo
[
'user_nicename'
];
$v
[
'user_nicename'
]
=
$userinfo
[
'user_nicename'
];
...
...
api/Appapi/Model/Live.php
View file @
f410096d
...
@@ -468,6 +468,229 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -468,6 +468,229 @@ class Model_Live extends PhalApi_Model_NotORM {
return
$rs
;
return
$rs
;
}
}
public
function
getWelfare
()
{
$key
=
'welfare_rate'
;
$rs
=
getcaches
(
$key
);
if
(
empty
(
$rs
))
{
$rs
=
DI
()
->
notorm
->
welfare_rate
->
where
(
'id!=1'
)
->
order
(
"rate desc"
)
->
fetchAll
();
if
(
!
empty
(
$rs
)){
setcaches
(
$key
,
$rs
);
}
}
return
$rs
;
}
public
function
randomGift
()
{
$data
=
[];
$rand
=
rand
(
1
,
100
);
$welfareRates
=
$this
->
getWelfare
();
if
(
empty
(
$welfareRates
))
{
return
[];
}
foreach
(
$welfareRates
as
$welfareRate
)
{
if
(
$welfareRate
[
'rate'
]
>
$rand
)
{
$data
[]
=
$welfareRate
;
}
}
if
(
!
empty
(
$data
))
{
$gift
=
array_pop
(
$data
);
}
else
{
$gift
=
array_shift
(
$welfareRates
);
}
if
(
empty
(
$gift
))
{
return
[];
}
/* 礼物信息 */
$giftinfo
=
DI
()
->
notorm
->
gift
->
select
(
"type,mark,giftname,gifticon,needcoin,swftype,swf,swftime"
)
->
where
(
'id=?'
,
$gift
[
'giftid'
])
->
fetchOne
();
if
(
!
$giftinfo
){
/* 礼物信息不存在 */
return
[];
}
$giftinfo
[
'id'
]
=
$gift
[
'giftid'
];
return
$giftinfo
;
}
public
function
sendWelfare
(
$uid
,
$liveuid
,
$stream
)
{
$randomGift
=
$this
->
randomGift
();
if
(
empty
(
$randomGift
))
{
/* 福利袋未配置 */
return
1000
;
}
$welfare
=
DI
()
->
notorm
->
welfare_rate
->
select
(
'rate'
)
->
where
(
'id=1'
)
->
fetchOne
();
$giftinfo
=
[
'type'
=>
0
,
'mark'
=>
0
,
'giftname'
=>
'福利袋'
,
'gifticon'
=>
'http://qiniu.huad.leacho.cn/20190723/5d367483cb9ac.png'
,
'needcoin'
=>
$welfare
[
'rate'
],
'swftype'
=>
0
,
'swf'
=>
'http://qiniu.huad.leacho.cn/20190723/5d3674994f0b4.gif'
,
'swftime'
=>
'11.10'
,
];
$addtime
=
time
();
$type
=
'expend'
;
$action
=
'sendgift'
;
$total
=
$giftinfo
[
'needcoin'
];
$set
=
DI
()
->
notorm
->
experlevel_set
->
where
(
'id=1'
)
->
fetchOne
();
//用户 经验
$send_gift
=
!
empty
(
$set
[
'send_gift'
])
?
$set
[
'send_gift'
]
:
0
;
$send_gift2
=
!
empty
(
$set
[
'send_gift2'
])
?
$set
[
'send_gift2'
]
:
0
;
$total2
=
$total
;
if
(
$send_gift
>
0
)
{
$send_gift3
=
(
int
)(
$total
/
$send_gift
);
$total2
+=
(
$send_gift3
*
$send_gift2
);
}
/* 更新用户余额 消费 */
$ifok
=
DI
()
->
notorm
->
users
->
where
(
'id = ? and coin >=?'
,
$uid
,
$total
)
->
update
([
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$total
}
"
),
'consumption'
=>
new
NotORM_Literal
(
"consumption +
{
$total2
}
"
),
]);
if
(
!
$ifok
)
{
/* 余额不足 */
return
1001
;
}
/* 分销 */
setAgentProfit
(
$uid
,
$total
);
/* 分销 */
$anthor_total
=
$total
;
/* 家族分成之后的金额 */
$anthor_total
=
setFamilyDivide
(
$liveuid
,
$anthor_total
);
//主播 经验
$get_gift
=
!
empty
(
$set
[
'get_gift'
])
?
$set
[
'get_gift'
]
:
0
;
$get_gift2
=
!
empty
(
$set
[
'get_gift2'
])
?
$set
[
'get_gift2'
]
:
0
;
$total3
=
$randomGift
[
'needcoin'
];
if
(
$get_gift
>
0
)
{
$get_gif3
=
(
int
)(
$total
/
$get_gift
);
$total3
+=
(
$get_gif3
*
$get_gift2
);
}
/* 更新直播 魅力值 累计魅力值 */
$istouid
=
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$liveuid
)
->
update
(
array
(
'votes'
=>
new
NotORM_Literal
(
"votes +
{
$randomGift
[
'needcoin'
]
}
"
),
'votestotal'
=>
new
NotORM_Literal
(
"votestotal +
{
$total3
}
"
)
));
if
(
$anthor_total
){
$insert_votes
=
[
'type'
=>
'income'
,
'action'
=>
$action
,
'uid'
=>
$liveuid
,
'votes'
=>
$anthor_total
,
'addtime'
=>
time
(),
];
DI
()
->
notorm
->
users_voterecord
->
insert
(
$insert_votes
);
}
$stream2
=
explode
(
'_'
,
$stream
);
$showid
=
$stream2
[
1
];
$insert
=
array
(
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>-
1
,
"giftcount"
=>
1
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"mark"
=>
$giftinfo
[
'mark'
],
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
/* 更新主播热门 */
if
(
$giftinfo
[
'mark'
]
==
1
){
DI
()
->
notorm
->
users_live
->
where
(
'uid = ?'
,
$liveuid
)
->
update
(
array
(
'hotvotes'
=>
new
NotORM_Literal
(
"hotvotes +
{
$total
}
"
)
));
}
DI
()
->
redis
->
zIncrBy
(
'user_'
.
$stream
,
$total
,
$uid
);
/* 清除缓存 */
delCache
(
"userinfo_"
.
$uid
);
delCache
(
"userinfo_"
.
$liveuid
);
$votestotal
=
$this
->
getVotes
(
$liveuid
);
$gifttoken
=
md5
(
md5
(
$action
.
$uid
.
$liveuid
.
'-1'
.
'1'
.
$total
.
$showid
.
$addtime
.
rand
(
100
,
999
)));
$gifttoken2
=
md5
(
md5
(
$action
.
$uid
.
$liveuid
.
$randomGift
[
'id'
]
.
'1'
.
$total
.
$showid
.
$addtime
.
rand
(
100
,
999
)));
$swf
=
$giftinfo
[
'swf'
]
?
get_upload_path
(
$giftinfo
[
'swf'
])
:
''
;
$isluck
=
'0'
;
$isluckall
=
'0'
;
$luckcoin
=
'0'
;
$lucktimes
=
'0'
;
$isup
=
'0'
;
$uplevel
=
'0'
;
$upcoin
=
'0'
;
$iswin
=
'0'
;
$wincoin
=
'0'
;
$userinfo2
=
DI
()
->
notorm
->
users
->
select
(
'consumption,coin'
)
->
where
(
'id = ?'
,
$uid
)
->
fetchOne
();
$level
=
getLevel
(
$userinfo2
[
'consumption'
]);
$result
=
array
(
"uid"
=>
$uid
,
"giftid"
=>-
1
,
"type"
=>
$giftinfo
[
'type'
],
"mark"
=>
$giftinfo
[
'mark'
],
"giftcount"
=>
1
,
"totalcoin"
=>
$total
,
"giftname"
=>
$giftinfo
[
'giftname'
],
"gifticon"
=>
get_upload_path
(
$giftinfo
[
'gifticon'
]),
"swftime"
=>
$giftinfo
[
'swftime'
],
"swftype"
=>
$giftinfo
[
'swftype'
],
"swf"
=>
$swf
,
"level"
=>
$level
,
"coin"
=>
$userinfo2
[
'coin'
],
"votestotal"
=>
$votestotal
,
"gifttoken"
=>
$gifttoken
,
"isluck"
=>
$isluck
,
"isluckall"
=>
$isluckall
,
"luckcoin"
=>
$luckcoin
,
"lucktimes"
=>
$lucktimes
,
"isup"
=>
$isup
,
"uplevel"
=>
$uplevel
,
"upcoin"
=>
$upcoin
,
"iswin"
=>
$iswin
,
"wincoin"
=>
$wincoin
,
);
$result2
=
array
(
"uid"
=>
$uid
,
"giftid"
=>
$randomGift
[
'id'
],
"type"
=>
$randomGift
[
'type'
],
"mark"
=>
$randomGift
[
'mark'
],
"giftcount"
=>
1
,
"totalcoin"
=>
$randomGift
[
'needcoin'
],
"giftname"
=>
$randomGift
[
'giftname'
],
"gifticon"
=>
get_upload_path
(
$randomGift
[
'gifticon'
]),
"swftime"
=>
$randomGift
[
'swftime'
],
"swftype"
=>
$randomGift
[
'swftype'
],
"swf"
=>
$randomGift
[
'swf'
]
?
get_upload_path
(
$randomGift
[
'swf'
])
:
''
,
"level"
=>
$level
,
"coin"
=>
$userinfo2
[
'coin'
],
"votestotal"
=>
$votestotal
,
"gifttoken"
=>
$gifttoken2
,
"isluck"
=>
$isluck
,
"isluckall"
=>
$isluckall
,
"luckcoin"
=>
$luckcoin
,
"lucktimes"
=>
$lucktimes
,
"isup"
=>
$isup
,
"uplevel"
=>
$uplevel
,
"upcoin"
=>
$upcoin
,
"iswin"
=>
$iswin
,
"wincoin"
=>
$wincoin
,
);
return
[
'welfare'
=>
$result
,
'gift'
=>
$result2
,
];
}
/* 赠送礼物 */
/* 赠送礼物 */
public
function
sendGift
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
)
{
public
function
sendGift
(
$uid
,
$liveuid
,
$stream
,
$giftid
,
$giftcount
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment