Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
haishi
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
冷斌
haishi
Commits
04708fd3
Commit
04708fd3
authored
Feb 17, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
1e042ba4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
150 additions
and
143 deletions
+150
-143
api/Appapi/Model/Game.php
+111
-109
api/Appapi/Model/Guard.php
+2
-2
api/Appapi/Model/Live.php
+14
-8
api/Appapi/Model/Login.php
+1
-1
api/Appapi/Model/Red.php
+20
-21
api/Appapi/Model/User.php
+2
-2
No files found.
api/Appapi/Model/Game.php
View file @
04708fd3
...
@@ -7,7 +7,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -7,7 +7,7 @@ class Model_Game extends PhalApi_Model_NotORM {
->
where
(
'id=?'
,
$liveuid
)
->
where
(
'id=?'
,
$liveuid
)
->
fetchOne
();
->
fetchOne
();
if
(
$userinfo
[
'token'
]
!=
$token
||
$userinfo
[
'expiretime'
]
<
time
()){
if
(
$userinfo
[
'token'
]
!=
$token
||
$userinfo
[
'expiretime'
]
<
time
()){
return
700
;
return
700
;
}
}
$game
=
DI
()
->
notorm
->
game
$game
=
DI
()
->
notorm
->
game
->
select
(
"*"
)
->
select
(
"*"
)
...
@@ -15,20 +15,20 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -15,20 +15,20 @@ class Model_Game extends PhalApi_Model_NotORM {
->
fetchOne
();
->
fetchOne
();
if
(
$game
)
if
(
$game
)
{
{
return
1000
;
return
1000
;
}
}
$rs
=
DI
()
->
notorm
->
game
$rs
=
DI
()
->
notorm
->
game
->
insert
(
array
(
"liveuid"
=>
$liveuid
,
"stream"
=>
$stream
,
'action'
=>
$action
,
'state'
=>
'0'
,
'result'
=>
$result
,
"starttime"
=>
$time
,
"bankerid"
=>
$bankerid
,
"banker_card"
=>
$bankercrad
)
);
->
insert
(
array
(
"liveuid"
=>
$liveuid
,
"stream"
=>
$stream
,
'action'
=>
$action
,
'state'
=>
'0'
,
'result'
=>
$result
,
"starttime"
=>
$time
,
"bankerid"
=>
$bankerid
,
"banker_card"
=>
$bankercrad
)
);
if
(
!
$rs
)
if
(
!
$rs
)
{
{
return
1001
;
return
1001
;
}
}
DI
()
->
notorm
->
users_live
DI
()
->
notorm
->
users_live
->
where
(
'uid=?'
,
$liveuid
)
->
where
(
'uid=?'
,
$liveuid
)
->
update
(
array
(
"game_action"
=>
$action
));
->
update
(
array
(
"game_action"
=>
$action
));
return
$rs
;
return
$rs
;
}
}
public
function
endGame
(
$liveuid
,
$gameid
,
$type
,
$ifset
)
public
function
endGame
(
$liveuid
,
$gameid
,
$type
,
$ifset
)
{
{
...
@@ -37,14 +37,14 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -37,14 +37,14 @@ class Model_Game extends PhalApi_Model_NotORM {
->
where
(
'uid=?'
,
$liveuid
)
->
where
(
'uid=?'
,
$liveuid
)
->
update
(
array
(
"game_action"
=>
0
));
->
update
(
array
(
"game_action"
=>
0
));
/* 主播关闭游戏,清楚庄家列表,返还余额 */
/* 主播关闭游戏,清楚庄家列表,返还余额 */
/* $key='banker_'.$action.'_'.$stream;
/* $key='banker_'.$action.'_'.$stream;
$uidlist=array();
$uidlist=array();
$list=DI()->redis -> hVals($key);
$list=DI()->redis -> hVals($key);
foreach($list as $v){
foreach($list as $v){
$bankerinfo=json_decode($v,true);
$bankerinfo=json_decode($v,true);
} */
} */
}
}
//file_put_contents('./zhifu.txt',date('y-m-d H:i:s').' 提交参数信息 endGame:'.$liveuid.'--'.$gameid.'--'.$type."\r\n",FILE_APPEND);
//file_put_contents('./zhifu.txt',date('y-m-d H:i:s').' 提交参数信息 endGame:'.$liveuid.'--'.$gameid.'--'.$type."\r\n",FILE_APPEND);
$game
=
DI
()
->
notorm
->
game
$game
=
DI
()
->
notorm
->
game
...
@@ -63,12 +63,12 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -63,12 +63,12 @@ class Model_Game extends PhalApi_Model_NotORM {
$bankerid
=
$game
[
'bankerid'
];
$bankerid
=
$game
[
'bankerid'
];
$banker_profit
=
0
;
$banker_profit
=
0
;
$isintervene
=
0
;
$isintervene
=
0
;
$gameToken
=
$game
[
'stream'
]
.
"_"
.
$action
.
"_"
.
$game
[
'starttime'
]
.
"_Game"
;
$gameToken
=
$game
[
'stream'
]
.
"_"
.
$action
.
"_"
.
$game
[
'starttime'
]
.
"_Game"
;
$gameinfo
=
DI
()
->
redis
->
Get
(
$gameToken
);
$gameinfo
=
DI
()
->
redis
->
Get
(
$gameToken
);
$gameinfo
=
json_decode
(
$gameinfo
,
1
);
$gameinfo
=
json_decode
(
$gameinfo
,
1
);
DI
()
->
redis
->
delete
(
$gameToken
);
DI
()
->
redis
->
delete
(
$gameToken
);
if
(
$type
==
2
||
$type
==
3
)
if
(
$type
==
2
||
$type
==
3
)
{
{
$total
=
DI
()
->
notorm
->
users_gamerecord
$total
=
DI
()
->
notorm
->
users_gamerecord
...
@@ -81,30 +81,31 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -81,30 +81,31 @@ class Model_Game extends PhalApi_Model_NotORM {
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$v
[
'total'
]
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$v
[
'total'
]
}
"
)));
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$v
[
'uid'
])
->
fetchOne
();
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'game_return'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$v
[
'total'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'game_return'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$v
[
'total'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
/* 下庄处理 */
/* 下庄处理 */
//$action=4;
//$action=4;
if
(
$action
==
4
){
if
(
$action
==
4
){
$key
=
'banker_'
.
$action
.
'_'
.
$game
[
'stream'
];
$key
=
'banker_'
.
$action
.
'_'
.
$game
[
'stream'
];
$list
=
DI
()
->
redis
->
hGetAll
(
$key
);
$list
=
DI
()
->
redis
->
hGetAll
(
$key
);
foreach
(
$list
as
$k
=>
$v
){
foreach
(
$list
as
$k
=>
$v
){
$data
=
json_decode
(
$v
,
true
);
$data
=
json_decode
(
$v
,
true
);
$uid
=
$k
;
$uid
=
$k
;
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$uid
)
->
where
(
'id = ?'
,
$uid
)
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$data
[
'deposit'
]
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$data
[
'deposit'
]
}
"
)));
delcache
(
'userinfo_'
.
$uid
);
delcache
(
'userinfo_'
.
$uid
);
$addtime
=
time
();
$addtime
=
time
();
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'deposit_return'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$data
[
'deposit'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'deposit_return'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$data
[
'deposit'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
}
}
}
else
{
}
else
{
...
@@ -122,7 +123,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -122,7 +123,7 @@ class Model_Game extends PhalApi_Model_NotORM {
if
(
$action
==
4
){
if
(
$action
==
4
){
/* 开心牛仔 */
/* 开心牛仔 */
$intervene
=
rand
(
0
,
99
);
$intervene
=
rand
(
0
,
99
);
if
(
$bankerid
>
0
){
if
(
$bankerid
>
0
){
/* 用户坐庄 */
/* 用户坐庄 */
if
(
$intervene
>=
$configpri
[
'game_odds_u'
]){
if
(
$intervene
>=
$configpri
[
'game_odds_u'
]){
...
@@ -134,7 +135,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -134,7 +135,7 @@ class Model_Game extends PhalApi_Model_NotORM {
$isintervene
=
1
;
$isintervene
=
1
;
}
}
}
}
if
(
$isintervene
){
if
(
$isintervene
){
$data
[
1
]
=
$gameinfo
[
0
][
9
];
$data
[
1
]
=
$gameinfo
[
0
][
9
];
$data
[
2
]
=
$gameinfo
[
1
][
9
];
$data
[
2
]
=
$gameinfo
[
1
][
9
];
...
@@ -142,25 +143,25 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -142,25 +143,25 @@ class Model_Game extends PhalApi_Model_NotORM {
$data
[
4
]
=
$gameinfo
[
3
][
9
];
$data
[
4
]
=
$gameinfo
[
3
][
9
];
$pos
=
array_search
(
max
(
$data
),
$data
);
$pos
=
array_search
(
max
(
$data
),
$data
);
if
(
$pos
!=
4
){
if
(
$pos
!=
4
){
/* 庄的牌面不是最大的 */
/* 庄的牌面不是最大的 */
$zhuang
=
$gameinfo
[
$pos
-
1
];
$zhuang
=
$gameinfo
[
$pos
-
1
];
$tihuan
=
$gameinfo
[
3
];
$tihuan
=
$gameinfo
[
3
];
/* 调整数据 */
/* 调整数据 */
$tihuan
[
7
]
=
'0'
;
$tihuan
[
7
]
=
'0'
;
$tihuan
[
8
]
=
$zhuang
[
8
];
$tihuan
[
8
]
=
$zhuang
[
8
];
$zhuang
[
7
]
=
'2'
;
$zhuang
[
7
]
=
'2'
;
$zhuang
[
8
]
=
'0'
;
$zhuang
[
8
]
=
'0'
;
$gameinfo
[
$pos
-
1
]
=
$tihuan
;
$gameinfo
[
$pos
-
1
]
=
$tihuan
;
$gameinfo
[
3
]
=
$zhuang
;
$gameinfo
[
3
]
=
$zhuang
;
}
}
$result
=
'1,1,1'
;
$result
=
'1,1,1'
;
}
}
$coin
=
''
;
$coin
=
''
;
//file_put_contents('./endGame.txt',date('y-m-d H:i:s').' 提交参数信息 game_result:'.json_encode($result)."\r\n",FILE_APPEND);
//file_put_contents('./endGame.txt',date('y-m-d H:i:s').' 提交参数信息 game_result:'.json_encode($result)."\r\n",FILE_APPEND);
...
@@ -186,16 +187,16 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -186,16 +187,16 @@ class Model_Game extends PhalApi_Model_NotORM {
foreach
(
$total
as
$k
=>
$v
){
foreach
(
$total
as
$k
=>
$v
){
$gamecoin
=
$v
[
'total'
]
+
floor
(
$v
[
'total'
]
*
(
100
-
$game_pump
)
*
0.01
);
$gamecoin
=
$v
[
'total'
]
+
floor
(
$v
[
'total'
]
*
(
100
-
$game_pump
)
*
0.01
);
//file_put_contents('./endGame.txt',date('y-m-d H:i:s').' 提交参数信息 gamecoin:'.json_encode($gamecoin)."\r\n",FILE_APPEND);
//file_put_contents('./endGame.txt',date('y-m-d H:i:s').' 提交参数信息 gamecoin:'.json_encode($gamecoin)."\r\n",FILE_APPEND);
$win
+=
$v
[
'total'
]
*
2
;
$win
+=
$v
[
'total'
]
*
2
;
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$gamecoin
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$gamecoin
}
"
)));
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$v
[
'uid'
])
->
fetchOne
();
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'game_win'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$gamecoin
,
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
$action
,
"game_banker"
=>
$bankerid
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'game_win'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$gamecoin
,
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
$action
,
"game_banker"
=>
$bankerid
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
//file_put_contents('./endGame.txt',date('y-m-d H:i:s').' 提交参数信息 win:'.json_encode($win)."\r\n",FILE_APPEND);
//file_put_contents('./endGame.txt',date('y-m-d H:i:s').' 提交参数信息 win:'.json_encode($win)."\r\n",FILE_APPEND);
$banker_profit
-=
$win
;
$banker_profit
-=
$win
;
...
@@ -208,18 +209,18 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -208,18 +209,18 @@ class Model_Game extends PhalApi_Model_NotORM {
$key
=
'banker_'
.
$action
.
'_'
.
$stream
;
$key
=
'banker_'
.
$action
.
'_'
.
$stream
;
$isexist
=
DI
()
->
redis
->
hGet
(
$key
,
$bankerid
);
$isexist
=
DI
()
->
redis
->
hGet
(
$key
,
$bankerid
);
$bankerinfo
=
json_decode
(
$isexist
,
1
);
$bankerinfo
=
json_decode
(
$isexist
,
1
);
$bankerinfo
[
'deposit'
]
=
$bankerinfo
[
'deposit'
]
+
$banker_profit
;
$bankerinfo
[
'deposit'
]
=
$bankerinfo
[
'deposit'
]
+
$banker_profit
;
$bankerinfo
[
'coin'
]
=
NumberFormat
(
$bankerinfo
[
'deposit'
]);
$bankerinfo
[
'coin'
]
=
NumberFormat
(
$bankerinfo
[
'deposit'
]);
DI
()
->
redis
->
hSet
(
$key
,
$bankerid
,
json_encode
(
$bankerinfo
));
DI
()
->
redis
->
hSet
(
$key
,
$bankerid
,
json_encode
(
$bankerinfo
));
/* DI()->notorm->users
/* DI()->notorm->users
->where('id = ?', $bankerid)
->where('id = ?', $bankerid)
->update(array('coin' => new NotORM_Literal("coin + {$banker_profit}")));
->update(array('coin' => new NotORM_Literal("coin + {$banker_profit}")));
$insert=array("type"=>'income',"action"=>'game_banker',"uid"=>$bankerid,"touid"=>$bankerid,"giftid"=>$giftid,"giftcount"=>1,"totalcoin"=>$banker_profit,"showid"=>0,"addtime"=>$addtime,"game_action"=>$action,"game_banker"=>$bankerid ); */
$insert=array("type"=>'income',"action"=>'game_banker',"uid"=>$bankerid,"touid"=>$bankerid,"giftid"=>$giftid,"giftcount"=>1,"totalcoin"=>$banker_profit,"showid"=>0,"addtime"=>$addtime,"game_action"=>$action,"game_banker"=>$bankerid ); */
}
else
{
}
else
{
DI
()
->
notorm
->
users_live
DI
()
->
notorm
->
users_live
->
where
(
'uid = ?'
,
$liveuid
)
->
where
(
'uid = ?'
,
$liveuid
)
...
@@ -228,14 +229,14 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -228,14 +229,14 @@ class Model_Game extends PhalApi_Model_NotORM {
}
else
{
}
else
{
/* 其他游戏 */
/* 其他游戏 */
$data
=
array
();
$data
=
array
();
/* 干预 */
/* 干预 */
$intervene
=
rand
(
0
,
99
);
$intervene
=
rand
(
0
,
99
);
if
(
$intervene
>
$configpri
[
'game_odds'
]){
if
(
$intervene
>
$configpri
[
'game_odds'
]){
$isintervene
=
1
;
$isintervene
=
1
;
}
}
if
(
$isintervene
){
if
(
$isintervene
){
/* 进行干预 */
/* 进行干预 */
if
(
$action
==
1
){
if
(
$action
==
1
){
...
@@ -260,7 +261,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -260,7 +261,7 @@ class Model_Game extends PhalApi_Model_NotORM {
$data
[
2
]
=
$gameinfo
[
1
][
5
];
$data
[
2
]
=
$gameinfo
[
1
][
5
];
$data
[
3
]
=
$gameinfo
[
2
][
5
];
$data
[
3
]
=
$gameinfo
[
2
][
5
];
}
}
$pos
=
array_search
(
min
(
$data
),
$data
);
$pos
=
array_search
(
min
(
$data
),
$data
);
if
(
$pos
!=
$result
){
if
(
$pos
!=
$result
){
/* 当前中奖位置不是下注最少的位置 */
/* 当前中奖位置不是下注最少的位置 */
...
@@ -276,7 +277,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -276,7 +277,7 @@ class Model_Game extends PhalApi_Model_NotORM {
$gameinfo
[
$pos
-
1
]
=
$max
;
$gameinfo
[
$pos
-
1
]
=
$max
;
$result
=
$pos
;
$result
=
$pos
;
}
}
}
else
if
(
$action
==
3
){
}
else
if
(
$action
==
3
){
$max
=
$gameinfo
[
$result
];
$max
=
$gameinfo
[
$result
];
$gameinfo
[
$result
]
=
$gameinfo
[
$pos
];
$gameinfo
[
$result
]
=
$gameinfo
[
$pos
];
...
@@ -293,9 +294,9 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -293,9 +294,9 @@ class Model_Game extends PhalApi_Model_NotORM {
$gameinfo
[
$pos
-
1
]
=
$max
;
$gameinfo
[
$pos
-
1
]
=
$max
;
$result
=
$pos
;
$result
=
$pos
;
}
}
}
}
}
}
$coin
=
"coin_"
.
$result
;
$coin
=
"coin_"
.
$result
;
...
@@ -311,27 +312,27 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -311,27 +312,27 @@ class Model_Game extends PhalApi_Model_NotORM {
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$gamecoin
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$gamecoin
}
"
)));
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$v
[
'uid'
])
->
fetchOne
();
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'game_win'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$gamecoin
,
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
$action
,
"game_banker"
=>
$bankerid
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'game_win'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$gamecoin
,
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
$action
,
"game_banker"
=>
$bankerid
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
$banker_profit
-=
$win
;
$banker_profit
-=
$win
;
}
}
}
}
}
}
$gameToken
=
$game
[
'stream'
]
.
"_"
.
$game
[
'action'
]
.
"_"
.
$game
[
'starttime'
]
.
"_Game"
;
$gameToken
=
$game
[
'stream'
]
.
"_"
.
$game
[
'action'
]
.
"_"
.
$game
[
'starttime'
]
.
"_Game"
;
DI
()
->
redis
->
delete
(
$gameToken
);
DI
()
->
redis
->
delete
(
$gameToken
);
DI
()
->
notorm
->
game
DI
()
->
notorm
->
game
->
where
(
'id = ? and liveuid =?'
,
$gameid
,
$liveuid
)
->
where
(
'id = ? and liveuid =?'
,
$gameid
,
$liveuid
)
->
update
(
array
(
'state'
=>
$type
,
'result'
=>
$result
,
'banker_profit'
=>
$banker_profit
,
'isintervene'
=>
$isintervene
,
'endtime'
=>
time
()
)
);
->
update
(
array
(
'state'
=>
$type
,
'result'
=>
$result
,
'banker_profit'
=>
$banker_profit
,
'isintervene'
=>
$isintervene
,
'endtime'
=>
time
()
)
);
DI
()
->
notorm
->
users_gamerecord
DI
()
->
notorm
->
users_gamerecord
->
where
(
'gameid=?'
,
$gameid
)
->
where
(
'gameid=?'
,
$gameid
)
->
update
(
array
(
'status'
=>
'1'
));
->
update
(
array
(
'status'
=>
'1'
));
return
$gameinfo
;
return
$gameinfo
;
}
}
public
function
gameBet
(
$uid
,
$gameid
,
$coin
,
$action
,
$grade
)
public
function
gameBet
(
$uid
,
$gameid
,
$coin
,
$action
,
$grade
)
...
@@ -350,13 +351,13 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -350,13 +351,13 @@ class Model_Game extends PhalApi_Model_NotORM {
{
{
return
1001
;
return
1001
;
}
}
$bankerid
=
$game
[
'bankerid'
];
$bankerid
=
$game
[
'bankerid'
];
/* 下注总额 */
/* 下注总额 */
$total
=
DI
()
->
notorm
->
users_gamerecord
$total
=
DI
()
->
notorm
->
users_gamerecord
->
where
(
'action = ? and uid=? and gameid=? and liveuid=?'
,
$action
,
$uid
,
$gameid
,
$game
[
'liveuid'
])
->
where
(
'action = ? and uid=? and gameid=? and liveuid=?'
,
$action
,
$uid
,
$gameid
,
$game
[
'liveuid'
])
->
sum
(
"coin_1 + coin_2 + coin_3 + coin_4 + coin_5 + coin_6"
);
->
sum
(
"coin_1 + coin_2 + coin_3 + coin_4 + coin_5 + coin_6"
);
...
@@ -368,11 +369,11 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -368,11 +369,11 @@ class Model_Game extends PhalApi_Model_NotORM {
$total_all
=
DI
()
->
notorm
->
users_gamerecord
$total_all
=
DI
()
->
notorm
->
users_gamerecord
->
where
(
'action = ? and gameid=? and liveuid=?'
,
$action
,
$gameid
,
$game
[
'liveuid'
])
->
where
(
'action = ? and gameid=? and liveuid=?'
,
$action
,
$gameid
,
$game
[
'liveuid'
])
->
sum
(
"coin_1 + coin_2 + coin_3 + coin_4 + coin_5 + coin_6"
);
->
sum
(
"coin_1 + coin_2 + coin_3 + coin_4 + coin_5 + coin_6"
);
$total_all
=
$total_all
+
$coin
;
$total_all
=
$total_all
+
$coin
;
$key
=
'banker_'
.
$action
.
'_'
.
$game
[
'stream'
];
$key
=
'banker_'
.
$action
.
'_'
.
$game
[
'stream'
];
$bankerinfo
=
DI
()
->
redis
->
hget
(
$key
,
$bankerid
);
$bankerinfo
=
DI
()
->
redis
->
hget
(
$key
,
$bankerid
);
$bankerinfo_a
=
json_decode
(
$bankerinfo
,
1
);
$bankerinfo_a
=
json_decode
(
$bankerinfo
,
1
);
if
(
$total_all
>
$bankerinfo_a
[
'deposit'
]){
if
(
$total_all
>
$bankerinfo_a
[
'deposit'
]){
return
1003
;
return
1003
;
...
@@ -382,7 +383,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -382,7 +383,7 @@ class Model_Game extends PhalApi_Model_NotORM {
if
(
$total
>
500000
){
if
(
$total
>
500000
){
return
1003
;
return
1003
;
}
}
$ifok
=
DI
()
->
notorm
->
users
$ifok
=
DI
()
->
notorm
->
users
->
where
(
'id = ? and coin >=?'
,
$uid
,
$coin
)
->
where
(
'id = ? and coin >=?'
,
$uid
,
$coin
)
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$coin
}
"
),
'consumption'
=>
new
NotORM_Literal
(
"consumption +
{
$coin
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$coin
}
"
),
'consumption'
=>
new
NotORM_Literal
(
"consumption +
{
$coin
}
"
)));
...
@@ -390,55 +391,55 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -390,55 +391,55 @@ class Model_Game extends PhalApi_Model_NotORM {
if
(
!
$ifok
){
if
(
!
$ifok
){
return
1000
;
return
1000
;
}
}
$gamerecord
=
DI
()
->
notorm
->
users_gamerecord
$gamerecord
=
DI
()
->
notorm
->
users_gamerecord
->
select
(
'id'
)
->
select
(
'id'
)
->
where
(
'action = ? and uid=? and gameid=? and liveuid=?'
,
$action
,
$uid
,
$gameid
,
$game
[
'liveuid'
])
->
where
(
'action = ? and uid=? and gameid=? and liveuid=?'
,
$action
,
$uid
,
$gameid
,
$game
[
'liveuid'
])
->
fetchOne
();
->
fetchOne
();
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 gamerecord:'.json_encode($gamerecord)."\r\n",FILE_APPEND);
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 gamerecord:'.json_encode($gamerecord)."\r\n",FILE_APPEND);
$field
=
'coin_'
.
$grade
;
$field
=
'coin_'
.
$grade
;
if
(
$gamerecord
)
if
(
$gamerecord
)
{
{
$users_game
=
DI
()
->
notorm
->
users_gamerecord
$users_game
=
DI
()
->
notorm
->
users_gamerecord
->
where
(
'id = ? '
,
$gamerecord
[
'id'
])
->
where
(
'id = ? '
,
$gamerecord
[
'id'
])
->
update
(
array
(
$field
=>
new
NotORM_Literal
(
"
{
$field
}
+
{
$coin
}
"
)));
->
update
(
array
(
$field
=>
new
NotORM_Literal
(
"
{
$field
}
+
{
$coin
}
"
)));
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 更新 field:'.json_encode($field). '----coin:'.json_encode($coin)."\r\n",FILE_APPEND);
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 更新 field:'.json_encode($field). '----coin:'.json_encode($coin)."\r\n",FILE_APPEND);
}
else
{
}
else
{
$users_game
=
DI
()
->
notorm
->
users_gamerecord
$users_game
=
DI
()
->
notorm
->
users_gamerecord
->
insert
(
array
(
"action"
=>
$action
,
"uid"
=>
$uid
,
'gameid'
=>
$gameid
,
'liveuid'
=>
$game
[
'liveuid'
],
$field
=>
$coin
,
"addtime"
=>
time
())
);
->
insert
(
array
(
"action"
=>
$action
,
"uid"
=>
$uid
,
'gameid'
=>
$gameid
,
'liveuid'
=>
$game
[
'liveuid'
],
$field
=>
$coin
,
"addtime"
=>
time
())
);
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 新增 field:'.json_encode($field). '----coin:'.json_encode($coin)."\r\n",FILE_APPEND);
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 新增 field:'.json_encode($field). '----coin:'.json_encode($coin)."\r\n",FILE_APPEND);
}
}
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 users_game:'.json_encode($users_game)."\r\n",FILE_APPEND);
//file_put_contents('./gameBet.txt',date('Y-m-d H:i:s').' 提交参数信息 users_game:'.json_encode($users_game)."\r\n",FILE_APPEND);
if
(
!
$users_game
)
if
(
!
$users_game
)
{
{
return
1002
;
return
1002
;
}
}
$addtime
=
time
();
$addtime
=
time
();
$giftid
=
$game
[
'id'
];
$giftid
=
$game
[
'id'
];
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
"type"
=>
'expend'
,
"action"
=>
'game_bet'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$coin
,
"showid"
=>
0
,
"addtime"
=>
$addtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'expend'
,
"action"
=>
'game_bet'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
1
,
"totalcoin"
=>
$coin
,
"showid"
=>
0
,
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
delcache
(
'userinfo_'
.
$uid
);
delcache
(
'userinfo_'
.
$uid
);
$info
=
DI
()
->
notorm
->
users
$info
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
select
(
'coin'
)
->
where
(
'id = ?'
,
$uid
)
->
where
(
'id = ?'
,
$uid
)
->
fetchOne
();
->
fetchOne
();
$rs
[
'uid'
]
=
$uid
;
$rs
[
'uid'
]
=
$uid
;
$rs
[
'coin'
]
=
$info
[
'coin'
];
$rs
[
'coin'
]
=
$info
[
'coin'
];
$rs
[
'gametime'
]
=
$game
[
'starttime'
];
$rs
[
'gametime'
]
=
$game
[
'starttime'
];
$rs
[
'stream'
]
=
$game
[
'stream'
];
$rs
[
'stream'
]
=
$game
[
'stream'
];
return
$rs
;
return
$rs
;
}
}
public
function
checkGame
(
$liveuid
,
$stream
,
$uid
)
public
function
checkGame
(
$liveuid
,
$stream
,
$uid
)
{
{
...
@@ -458,7 +459,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -458,7 +459,7 @@ class Model_Game extends PhalApi_Model_NotORM {
->
select
(
"*"
)
->
select
(
"*"
)
->
where
(
'liveuid=? and stream=? and state=?'
,
$liveuid
,
$stream
,
0
)
->
where
(
'liveuid=? and stream=? and state=?'
,
$liveuid
,
$stream
,
0
)
->
fetchOne
();
->
fetchOne
();
if
(
$game
)
if
(
$game
)
{
{
$action
=
$game
[
"action"
];
$action
=
$game
[
"action"
];
...
@@ -475,7 +476,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -475,7 +476,7 @@ class Model_Game extends PhalApi_Model_NotORM {
$data
[]
=
$brand
[
0
][
8
];
$data
[]
=
$brand
[
0
][
8
];
$data
[]
=
$brand
[
1
][
8
];
$data
[]
=
$brand
[
1
][
8
];
$data
[]
=
$brand
[
2
][
8
];
$data
[]
=
$brand
[
2
][
8
];
}
else
if
(
$action
==
3
){
}
else
if
(
$action
==
3
){
$data
[]
=
$brand
[
1
];
$data
[]
=
$brand
[
1
];
$data
[]
=
$brand
[
2
];
$data
[]
=
$brand
[
2
];
...
@@ -490,7 +491,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -490,7 +491,7 @@ class Model_Game extends PhalApi_Model_NotORM {
$data
[]
=
$brand
[
1
][
5
];
$data
[]
=
$brand
[
1
][
5
];
$data
[]
=
$brand
[
2
][
5
];
$data
[]
=
$brand
[
2
][
5
];
}
}
$rs
[
'brand'
]
=
$data
;
$rs
[
'brand'
]
=
$data
;
$time
=
30
-
(
time
()
-
$game
[
'starttime'
])
+
3
;
$time
=
30
-
(
time
()
-
$game
[
'starttime'
])
+
3
;
if
(
$time
<
0
)
if
(
$time
<
0
)
...
@@ -500,11 +501,11 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -500,11 +501,11 @@ class Model_Game extends PhalApi_Model_NotORM {
$rs
[
'time'
]
=
(
string
)
$time
;
$rs
[
'time'
]
=
(
string
)
$time
;
$rs
[
'id'
]
=
(
string
)
$game
[
"id"
];
$rs
[
'id'
]
=
(
string
)
$game
[
"id"
];
$rs
[
'bankerid'
]
=
(
string
)
$game
[
"bankerid"
];
$rs
[
'bankerid'
]
=
(
string
)
$game
[
"bankerid"
];
if
(
$game
[
"bankerid"
]
>
0
){
if
(
$game
[
"bankerid"
]
>
0
){
$key
=
'banker_'
.
$action
.
'_'
.
$stream
;
$key
=
'banker_'
.
$action
.
'_'
.
$stream
;
$isexist
=
DI
()
->
redis
->
hGet
(
$key
,
$game
[
"bankerid"
]);
$isexist
=
DI
()
->
redis
->
hGet
(
$key
,
$game
[
"bankerid"
]);
$bankerinfo
=
json_decode
(
$isexist
,
1
);
$bankerinfo
=
json_decode
(
$isexist
,
1
);
$rs
[
'banker_name'
]
=
$bankerinfo
[
'user_nicename'
];
$rs
[
'banker_name'
]
=
$bankerinfo
[
'user_nicename'
];
...
@@ -517,11 +518,11 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -517,11 +518,11 @@ class Model_Game extends PhalApi_Model_NotORM {
->
fetchOne
();
->
fetchOne
();
$rs
[
'banker_coin'
]
=
NumberFormat
(
$userinfo
[
'banker_coin'
]);
$rs
[
'banker_coin'
]
=
NumberFormat
(
$userinfo
[
'banker_coin'
]);
}
}
$rs
[
'action'
]
=
(
string
)
$action
;
$rs
[
'action'
]
=
(
string
)
$action
;
/* DI()->redis -> set($BetToken,json_encode($data)); */
/* DI()->redis -> set($BetToken,json_encode($data)); */
/* 用户下注信息 */
/* 用户下注信息 */
$userbet
=
DI
()
->
notorm
->
users_gamerecord
$userbet
=
DI
()
->
notorm
->
users_gamerecord
->
select
(
"sum(coin_1) as bet1,sum(coin_2) as bet2,sum(coin_3) as bet3,sum(coin_4) as bet4"
)
->
select
(
"sum(coin_1) as bet1,sum(coin_2) as bet2,sum(coin_3) as bet3,sum(coin_4) as bet4"
)
...
@@ -547,7 +548,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -547,7 +548,7 @@ class Model_Game extends PhalApi_Model_NotORM {
->
fetchOne
();
->
fetchOne
();
$rs
[
'banker_coin'
]
=
NumberFormat
(
$userinfo
[
'banker_coin'
]);
$rs
[
'banker_coin'
]
=
NumberFormat
(
$userinfo
[
'banker_coin'
]);
}
}
return
$rs
;
return
$rs
;
}
}
/* 计算用户收益 */
/* 计算用户收益 */
public
function
settleGame
(
$uid
,
$gameid
)
public
function
settleGame
(
$uid
,
$gameid
)
...
@@ -565,7 +566,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -565,7 +566,7 @@ class Model_Game extends PhalApi_Model_NotORM {
$total
=
DI
()
->
notorm
->
users_gamerecord
$total
=
DI
()
->
notorm
->
users_gamerecord
->
where
(
'gameid=? and uid=?'
,
$gameid
,
$uid
)
->
where
(
'gameid=? and uid=?'
,
$gameid
,
$uid
)
->
sum
(
'coin_1 + coin_2 + coin_3 + coin_4 '
);
->
sum
(
'coin_1 + coin_2 + coin_3 + coin_4 '
);
$action
=
$game
[
'action'
];
$action
=
$game
[
'action'
];
$result
=
$game
[
'result'
];
$result
=
$game
[
'result'
];
$bankerid
=
$game
[
'bankerid'
];
$bankerid
=
$game
[
'bankerid'
];
...
@@ -594,18 +595,18 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -594,18 +595,18 @@ class Model_Game extends PhalApi_Model_NotORM {
}
}
$settle
[
'gamecoin'
]
=
(
string
)
$total_win
;
$settle
[
'gamecoin'
]
=
(
string
)
$total_win
;
$banker_profit
=
$game
[
'banker_profit'
];
$banker_profit
=
$game
[
'banker_profit'
];
if
(
$banker_profit
>=
0
){
if
(
$banker_profit
>=
0
){
$banker_profit
=
'+'
.
$banker_profit
;
$banker_profit
=
'+'
.
$banker_profit
;
}
}
$settle
[
'banker_profit'
]
=
(
string
)
$banker_profit
;
$settle
[
'banker_profit'
]
=
(
string
)
$banker_profit
;
$settle
[
'bankerid'
]
=
$bankerid
;
$settle
[
'bankerid'
]
=
$bankerid
;
$settle
[
'isshow'
]
=
'0'
;
$settle
[
'isshow'
]
=
'0'
;
/* 庄家处理 */
/* 庄家处理 */
$stream
=
$game
[
'stream'
];
$stream
=
$game
[
'stream'
];
$key
=
'banker_'
.
$action
.
'_'
.
$stream
;
$key
=
'banker_'
.
$action
.
'_'
.
$stream
;
...
@@ -623,20 +624,20 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -623,20 +624,20 @@ class Model_Game extends PhalApi_Model_NotORM {
$this
->
quietBanker
(
$uid
,
$bankerinfo
);
$this
->
quietBanker
(
$uid
,
$bankerinfo
);
DI
()
->
redis
->
hdel
(
$key
,
$uid
);
DI
()
->
redis
->
hdel
(
$key
,
$uid
);
}
}
}
}
$userinfo
=
DI
()
->
notorm
->
users
$userinfo
=
DI
()
->
notorm
->
users
->
select
(
"coin"
)
->
select
(
"coin"
)
->
where
(
'id=?'
,
$uid
)
->
where
(
'id=?'
,
$uid
)
->
fetchOne
();
->
fetchOne
();
$settle
[
'coin'
]
=
(
string
)
$userinfo
[
'coin'
];
$settle
[
'coin'
]
=
(
string
)
$userinfo
[
'coin'
];
//file_put_contents('./settleGame.txt',date('y-m-d H:i:s').' 提交参数信息 settle:'.json_encode($settle)."\r\n",FILE_APPEND);
//file_put_contents('./settleGame.txt',date('y-m-d H:i:s').' 提交参数信息 settle:'.json_encode($settle)."\r\n",FILE_APPEND);
return
$settle
;
return
$settle
;
}
}
/* 游戏记录 */
/* 游戏记录 */
public
function
getGameRecord
(
$action
,
$stream
){
public
function
getGameRecord
(
$action
,
$stream
){
$result
=
array
();
$result
=
array
();
...
@@ -651,7 +652,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -651,7 +652,7 @@ class Model_Game extends PhalApi_Model_NotORM {
if
(
$action
==
3
){
if
(
$action
==
3
){
$rs
=
array
(
'0'
,
'0'
,
'0'
,
'0'
);
$rs
=
array
(
'0'
,
'0'
,
'0'
,
'0'
);
}
}
if
(
$action
==
4
){
if
(
$action
==
4
){
$result_a
=
explode
(
","
,
$v
[
'result'
]);
$result_a
=
explode
(
","
,
$v
[
'result'
]);
foreach
(
$result_a
as
$k
=>
$v
){
foreach
(
$result_a
as
$k
=>
$v
){
...
@@ -662,14 +663,14 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -662,14 +663,14 @@ class Model_Game extends PhalApi_Model_NotORM {
}
else
{
}
else
{
$rs
[
$v
[
'result'
]
-
1
]
=
'1'
;
$rs
[
$v
[
'result'
]
-
1
]
=
'1'
;
}
}
$result
[]
=
$rs
;
$result
[]
=
$rs
;
}
}
return
$result
;
return
$result
;
}
}
/* 庄家流水 */
/* 庄家流水 */
public
function
getBankerProfit
(
$bankerid
,
$action
,
$stream
){
public
function
getBankerProfit
(
$bankerid
,
$action
,
$stream
){
...
@@ -680,7 +681,7 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -680,7 +681,7 @@ class Model_Game extends PhalApi_Model_NotORM {
->
limit
(
0
,
30
)
->
limit
(
0
,
30
)
->
fetchAll
();
->
fetchAll
();
return
$list
;
return
$list
;
}
}
/* 平台庄家 */
/* 平台庄家 */
...
@@ -694,14 +695,14 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -694,14 +695,14 @@ class Model_Game extends PhalApi_Model_NotORM {
}
else
{
}
else
{
$platform_coin
=
NumberFormat
(
10000000
);
$platform_coin
=
NumberFormat
(
10000000
);
}
}
$rs
=
array
(
$rs
=
array
(
'id'
=>
'0'
,
'id'
=>
'0'
,
'user_nicename'
=>
'吕布'
,
'user_nicename'
=>
'吕布'
,
'avatar'
=>
''
,
'avatar'
=>
''
,
'coin'
=>
$platform_coin
,
'coin'
=>
$platform_coin
,
);
);
return
$rs
;
return
$rs
;
}
}
/* 上庄 */
/* 上庄 */
...
@@ -721,13 +722,14 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -721,13 +722,14 @@ class Model_Game extends PhalApi_Model_NotORM {
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$deposit
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$deposit
}
"
)));
delcache
(
'userinfo_'
.
$uid
);
delcache
(
'userinfo_'
.
$uid
);
$addtime
=
time
();
$addtime
=
time
();
$insert
=
array
(
"type"
=>
'expend'
,
"action"
=>
'set_deposit'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$deposit
,
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'expend'
,
"action"
=>
'set_deposit'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$deposit
,
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
$info
=
DI
()
->
notorm
->
users
$info
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
select
(
'coin'
)
->
where
(
'id = ?'
,
$uid
)
->
where
(
'id = ?'
,
$uid
)
->
fetchOne
();
->
fetchOne
();
return
$info
;
return
$info
;
}
}
...
@@ -739,9 +741,10 @@ class Model_Game extends PhalApi_Model_NotORM {
...
@@ -739,9 +741,10 @@ class Model_Game extends PhalApi_Model_NotORM {
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$data
[
'deposit'
]
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$data
[
'deposit'
]
}
"
)));
delcache
(
'userinfo_'
.
$uid
);
delcache
(
'userinfo_'
.
$uid
);
$addtime
=
time
();
$addtime
=
time
();
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'deposit_return'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$data
[
'deposit'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'deposit_return'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$data
[
'deposit'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
return
1
;
return
1
;
}
}
}
}
\ No newline at end of file
api/Appapi/Model/Guard.php
View file @
04708fd3
...
@@ -147,8 +147,8 @@ class Model_Guard extends PhalApi_Model_NotORM {
...
@@ -147,8 +147,8 @@ class Model_Guard extends PhalApi_Model_NotORM {
$showid
=
0
;
$showid
=
0
;
}
}
}
}
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
'1'
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
'1'
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
$endtime
=
$addtime
+
$guardinfo
[
'length_time'
];
$endtime
=
$addtime
+
$guardinfo
[
'length_time'
];
...
...
api/Appapi/Model/Live.php
View file @
04708fd3
...
@@ -147,11 +147,11 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -147,11 +147,11 @@ class Model_Live extends PhalApi_Model_NotORM {
->
group
(
'uid'
)
->
group
(
'uid'
)
->
fetchAll
();
->
fetchAll
();
foreach
(
$total
as
$k
=>
$v
){
foreach
(
$total
as
$k
=>
$v
){
$u
=
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
where
(
'id = ?'
,
$v
[
'uid'
])
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$v
[
'total'
]
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$v
[
'total'
]
}
"
)));
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
delcache
(
'userinfo_'
.
$v
[
'uid'
]);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$v
[
'uid'
])
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'game_return'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$game
[
'id'
],
"giftcount"
=>
1
,
"totalcoin"
=>
$v
[
'total'
],
"showid"
=>
0
,
"addtime"
=>
$nowtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'game_return'
,
"uid"
=>
$v
[
'uid'
],
"touid"
=>
$v
[
'uid'
],
"giftid"
=>
$game
[
'id'
],
"giftcount"
=>
1
,
"totalcoin"
=>
$v
[
'total'
],
"showid"
=>
0
,
"addtime"
=>
$nowtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
...
@@ -178,7 +178,8 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -178,7 +178,8 @@ class Model_Live extends PhalApi_Model_NotORM {
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$data
[
'deposit'
]
}
"
)));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$data
[
'deposit'
]
}
"
)));
delcache
(
'userinfo_'
.
$uid
);
delcache
(
'userinfo_'
.
$uid
);
$addtime
=
time
();
$addtime
=
time
();
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'deposit_return'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$data
[
'deposit'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'deposit_return'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$data
[
'deposit'
],
"showid"
=>
0
,
"addtime"
=>
$addtime
,
"game_action"
=>
4
,
"game_banker"
=>
0
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
...
@@ -402,10 +403,10 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -402,10 +403,10 @@ class Model_Live extends PhalApi_Model_NotORM {
'addtime'
=>
time
(),
'addtime'
=>
time
(),
];
];
DI
()
->
notorm
->
users_voterecord
->
insert
(
$insert_votes
);
DI
()
->
notorm
->
users_voterecord
->
insert
(
$insert_votes
);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
/* 更新直播 映票 累计映票 */
/* 更新直播 映票 累计映票 */
DI
()
->
notorm
->
users_coinrecord
DI
()
->
notorm
->
users_coinrecord
->
insert
(
array
(
"type"
=>
'expend'
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
));
->
insert
(
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'expend'
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
));
$userinfo2
=
DI
()
->
notorm
->
users
$userinfo2
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
select
(
'coin'
)
...
@@ -555,7 +556,7 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -555,7 +556,7 @@ class Model_Live extends PhalApi_Model_NotORM {
$showid
=
$stream2
[
1
];
$showid
=
$stream2
[
1
];
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"mark"
=>
$giftinfo
[
'mark'
],
"addtime"
=>
$addtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"mark"
=>
$giftinfo
[
'mark'
],
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
...
@@ -630,6 +631,7 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -630,6 +631,7 @@ class Model_Live extends PhalApi_Model_NotORM {
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$uid
)
->
where
(
'id = ?'
,
$uid
)
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$luckcoin
}
"
)
));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$luckcoin
}
"
)
));
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
$insert
=
array
(
"type"
=>
'income'
,
"type"
=>
'income'
,
"action"
=>
'luckgift'
,
"action"
=>
'luckgift'
,
...
@@ -640,7 +642,8 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -640,7 +642,8 @@ class Model_Live extends PhalApi_Model_NotORM {
"totalcoin"
=>
$luckcoin
,
"totalcoin"
=>
$luckcoin
,
"showid"
=>
$showid
,
"showid"
=>
$showid
,
"mark"
=>
$giftinfo
[
'mark'
],
"mark"
=>
$giftinfo
[
'mark'
],
"addtime"
=>
$addtime
"addtime"
=>
$addtime
,
'coin'
=>
$u
[
'coin'
],
);
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
break
;
break
;
...
@@ -730,7 +733,9 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -730,7 +733,9 @@ class Model_Live extends PhalApi_Model_NotORM {
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$uid
)
->
where
(
'id = ?'
,
$uid
)
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$wincoin2
}
"
)
));
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$wincoin2
}
"
)
));
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"type"
=>
'income'
,
"action"
=>
'jackpotwin'
,
"action"
=>
'jackpotwin'
,
"uid"
=>
$uid
,
"uid"
=>
$uid
,
...
@@ -842,7 +847,8 @@ class Model_Live extends PhalApi_Model_NotORM {
...
@@ -842,7 +847,8 @@ class Model_Live extends PhalApi_Model_NotORM {
}
}
/* 写入记录 或更新 */
/* 写入记录 或更新 */
$insert
=
array
(
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$liveuid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
$isup
=
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
$isup
=
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
$userinfo2
=
DI
()
->
notorm
->
users
$userinfo2
=
DI
()
->
notorm
->
users
...
...
api/Appapi/Model/Login.php
View file @
04708fd3
...
@@ -99,7 +99,7 @@ class Model_Login extends PhalApi_Model_NotORM {
...
@@ -99,7 +99,7 @@ class Model_Login extends PhalApi_Model_NotORM {
}
}
$uid
=
$rs
[
'id'
];
$uid
=
$rs
[
'id'
];
if
(
$reg_reward
>
0
){
if
(
$reg_reward
>
0
){
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'reg_reward'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$reg_reward
,
"showid"
=>
0
,
"addtime"
=>
time
()
);
$insert
=
array
(
'coin'
=>
$data
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'reg_reward'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
0
,
"giftcount"
=>
1
,
"totalcoin"
=>
$reg_reward
,
"showid"
=>
0
,
"addtime"
=>
time
()
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
$code
=
$this
->
createCode
();
$code
=
$this
->
createCode
();
...
...
api/Appapi/Model/Red.php
View file @
04708fd3
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
class
Model_Red
extends
PhalApi_Model_NotORM
{
class
Model_Red
extends
PhalApi_Model_NotORM
{
/* 发布红包 */
/* 发布红包 */
public
function
sendRed
(
$data
)
{
public
function
sendRed
(
$data
)
{
$rs
=
array
(
'code'
=>
0
,
'msg'
=>
'发送成功'
,
'info'
=>
array
());
$rs
=
array
(
'code'
=>
0
,
'msg'
=>
'发送成功'
,
'info'
=>
array
());
$uid
=
$data
[
'uid'
];
$uid
=
$data
[
'uid'
];
$total
=
$data
[
'coin'
];
$total
=
$data
[
'coin'
];
$ifok
=
DI
()
->
notorm
->
users
$ifok
=
DI
()
->
notorm
->
users
...
@@ -13,18 +13,18 @@ class Model_Red extends PhalApi_Model_NotORM {
...
@@ -13,18 +13,18 @@ class Model_Red extends PhalApi_Model_NotORM {
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$total
}
"
)
,
'consumption'
=>
new
NotORM_Literal
(
"consumption +
{
$total
}
"
)
)
);
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin -
{
$total
}
"
)
,
'consumption'
=>
new
NotORM_Literal
(
"consumption +
{
$total
}
"
)
)
);
if
(
!
$ifok
){
if
(
!
$ifok
){
$rs
[
'code'
]
=
1009
;
$rs
[
'code'
]
=
1009
;
$rs
[
'msg'
]
=
'余额不足'
;
$rs
[
'msg'
]
=
'余额不足'
;
return
$rs
;
return
$rs
;
}
}
$result
=
DI
()
->
notorm
->
red
->
insert
(
$data
);
$result
=
DI
()
->
notorm
->
red
->
insert
(
$data
);
if
(
!
$result
){
if
(
!
$result
){
$rs
[
'code'
]
=
1009
;
$rs
[
'code'
]
=
1009
;
$rs
[
'msg'
]
=
'发送失败,请重试'
;
$rs
[
'msg'
]
=
'发送失败,请重试'
;
return
$rs
;
return
$rs
;
}
}
$type
=
'expend'
;
$type
=
'expend'
;
$action
=
'sendred'
;
$action
=
'sendred'
;
$uid
=
$data
[
'uid'
];
$uid
=
$data
[
'uid'
];
...
@@ -33,15 +33,14 @@ class Model_Red extends PhalApi_Model_NotORM {
...
@@ -33,15 +33,14 @@ class Model_Red extends PhalApi_Model_NotORM {
$total
=
$data
[
'coin'
];
$total
=
$data
[
'coin'
];
$showid
=
$data
[
'showid'
];
$showid
=
$data
[
'showid'
];
$addtime
=
$data
[
'addtime'
];
$addtime
=
$data
[
'addtime'
];
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
$insert
=
array
(
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
$rs
[
'info'
]
=
$result
;
$rs
[
'info'
]
=
$result
;
return
$rs
;
return
$rs
;
}
}
/* 红包列表 */
/* 红包列表 */
public
function
getRedList
(
$liveuid
,
$showid
){
public
function
getRedList
(
$liveuid
,
$showid
){
$list
=
DI
()
->
notorm
->
red
$list
=
DI
()
->
notorm
->
red
...
@@ -63,15 +62,15 @@ class Model_Red extends PhalApi_Model_NotORM {
...
@@ -63,15 +62,15 @@ class Model_Red extends PhalApi_Model_NotORM {
$showid
=
$data
[
'showid'
];
$showid
=
$data
[
'showid'
];
$addtime
=
$data
[
'addtime'
];
$addtime
=
$data
[
'addtime'
];
unset
(
$data
[
'showid'
]);
unset
(
$data
[
'showid'
]);
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
$insert
=
array
(
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
$type
,
"action"
=>
$action
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$giftid
,
"giftcount"
=>
$giftcount
,
"totalcoin"
=>
$total
,
"showid"
=>
$showid
,
"addtime"
=>
$addtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
$result
=
DI
()
->
notorm
->
red_record
->
insert
(
$data
);
$result
=
DI
()
->
notorm
->
red_record
->
insert
(
$data
);
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id = ?'
,
$uid
)
->
where
(
'id = ?'
,
$uid
)
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$total
}
"
)
)
);
->
update
(
array
(
'coin'
=>
new
NotORM_Literal
(
"coin +
{
$total
}
"
)
)
);
...
@@ -80,7 +79,7 @@ class Model_Red extends PhalApi_Model_NotORM {
...
@@ -80,7 +79,7 @@ class Model_Red extends PhalApi_Model_NotORM {
->
where
(
'id = ?'
,
$giftid
)
->
where
(
'id = ?'
,
$giftid
)
->
update
(
array
(
'coin_rob'
=>
new
NotORM_Literal
(
"coin_rob +
{
$total
}
"
)
,
'nums_rob'
=>
new
NotORM_Literal
(
"nums_rob + 1"
)
)
);
->
update
(
array
(
'coin_rob'
=>
new
NotORM_Literal
(
"coin_rob +
{
$total
}
"
)
,
'nums_rob'
=>
new
NotORM_Literal
(
"nums_rob + 1"
)
)
);
return
$result
;
return
$result
;
}
}
/* 抢红包列表 */
/* 抢红包列表 */
public
function
getRedRobList
(
$redid
){
public
function
getRedRobList
(
$redid
){
...
@@ -91,7 +90,7 @@ class Model_Red extends PhalApi_Model_NotORM {
...
@@ -91,7 +90,7 @@ class Model_Red extends PhalApi_Model_NotORM {
->
fetchAll
();
->
fetchAll
();
return
$list
;
return
$list
;
}
}
/* 红包信息 */
/* 红包信息 */
public
function
getRedInfo
(
$redid
){
public
function
getRedInfo
(
$redid
){
$redinfo
=
DI
()
->
notorm
->
red
$redinfo
=
DI
()
->
notorm
->
red
...
@@ -106,6 +105,6 @@ class Model_Red extends PhalApi_Model_NotORM {
...
@@ -106,6 +105,6 @@ class Model_Red extends PhalApi_Model_NotORM {
unset
(
$redinfo
[
'status'
]);
unset
(
$redinfo
[
'status'
]);
}
}
return
$redinfo
;
return
$redinfo
;
}
}
}
}
api/Appapi/Model/User.php
View file @
04708fd3
...
@@ -854,9 +854,9 @@ class Model_User extends PhalApi_Model_NotORM {
...
@@ -854,9 +854,9 @@ class Model_User extends PhalApi_Model_NotORM {
DI
()
->
notorm
->
users
DI
()
->
notorm
->
users
->
where
(
'id=?'
,
$uid
)
->
where
(
'id=?'
,
$uid
)
->
update
(
array
(
"coin"
=>
new
NotORM_Literal
(
"coin +
{
$coin
}
"
),
"consumption"
=>
new
NotORM_Literal
(
"consumption +
{
$loginCoin
}
"
)
));
->
update
(
array
(
"coin"
=>
new
NotORM_Literal
(
"coin +
{
$coin
}
"
),
"consumption"
=>
new
NotORM_Literal
(
"consumption +
{
$loginCoin
}
"
)
));
$u
=
DI
()
->
notorm
->
users
->
select
(
'coin'
)
->
where
(
'id = '
.
$uid
)
->
fetchOne
();
/* 记录 */
/* 记录 */
$insert
=
array
(
"type"
=>
'income'
,
"action"
=>
'loginbonus'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$bonus_day
,
"giftcount"
=>
'0'
,
"totalcoin"
=>
$coin
,
"showid"
=>
'0'
,
"addtime"
=>
$nowtime
);
$insert
=
array
(
'coin'
=>
$u
[
'coin'
],
"type"
=>
'income'
,
"action"
=>
'loginbonus'
,
"uid"
=>
$uid
,
"touid"
=>
$uid
,
"giftid"
=>
$bonus_day
,
"giftcount"
=>
'0'
,
"totalcoin"
=>
$coin
,
"showid"
=>
'0'
,
"addtime"
=>
$nowtime
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
DI
()
->
notorm
->
users_coinrecord
->
insert
(
$insert
);
}
}
$rs
=
1
;
$rs
=
1
;
...
...
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