Commit 3eca25a4 by 刘海龙

Merge branch 'master' of http://132.232.91.252:9999/ice/quxiu

parents 25d5e62e 32efbcec
...@@ -244,6 +244,7 @@ class Api_Linkmic extends PhalApi_Api { ...@@ -244,6 +244,7 @@ class Api_Linkmic extends PhalApi_Api {
); );
@$result = curl_exec($ch); @$result = curl_exec($ch);
if(curl_errno($ch)){ if(curl_errno($ch)){
//print curl_error($ch); //print curl_error($ch);
file_put_contents('./MergeVideoStream.txt',date('y-m-d H:i:s').' 提交参数信息 ch:'.json_encode(curl_error($ch))."\r\n",FILE_APPEND); file_put_contents('./MergeVideoStream.txt',date('y-m-d H:i:s').' 提交参数信息 ch:'.json_encode(curl_error($ch))."\r\n",FILE_APPEND);
......
...@@ -90,6 +90,7 @@ class Api_User extends PhalApi_Api { ...@@ -90,6 +90,7 @@ class Api_User extends PhalApi_Api {
'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'),
'id' => array('name' => 'id', 'type' => 'string', 'require' => true, 'desc' => 'id'), 'id' => array('name' => 'id', 'type' => 'string', 'require' => true, 'desc' => 'id'),
'source' => array('name' => 'source', 'type' => 'int', 'require' => true, 'desc' => '类型,1主播,2邀请,3家族'),
), ),
'setCash' => array( 'setCash' => array(
...@@ -920,7 +921,7 @@ class Api_User extends PhalApi_Api { ...@@ -920,7 +921,7 @@ class Api_User extends PhalApi_Api {
} }
$domain = new Domain_User(); $domain = new Domain_User();
$info = $domain->rechange($this->uid, $this->id); $info = $domain->rechange($this->uid, $this->id, $this->source);
if($info === 1){ if($info === 1){
$rs['code']=1001; $rs['code']=1001;
...@@ -930,7 +931,7 @@ class Api_User extends PhalApi_Api { ...@@ -930,7 +931,7 @@ class Api_User extends PhalApi_Api {
if($info === 2){ if($info === 2){
$rs['code']=1002; $rs['code']=1002;
$rs['msg']='积分不足'; $rs['msg']='魅力值不足';
return $rs; return $rs;
} }
......
...@@ -92,11 +92,11 @@ class Domain_User { ...@@ -92,11 +92,11 @@ class Domain_User {
return $rs; return $rs;
} }
public function rechange($uid, $id) { public function rechange($uid, $id, $source) {
$rs = array(); $rs = array();
$model = new Model_User(); $model = new Model_User();
$rs = $model->rechange($uid, $id); $rs = $model->rechange($uid, $id, $source);
return $rs; return $rs;
} }
......
...@@ -73,7 +73,7 @@ class Model_Home extends PhalApi_Model_NotORM { ...@@ -73,7 +73,7 @@ class Model_Home extends PhalApi_Model_NotORM {
$result=DI()->notorm->users_live $result=DI()->notorm->users_live
->select("uid,thumb,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway") ->select("uid,thumb,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway")
->where($where) ->where($where)
->order('hotvotes desc,starttime desc') ->order('hotvotes desc, starttime desc')
->limit($start,$pnum) ->limit($start,$pnum)
->fetchAll(); ->fetchAll();
...@@ -603,11 +603,11 @@ class Model_Home extends PhalApi_Model_NotORM { ...@@ -603,11 +603,11 @@ class Model_Home extends PhalApi_Model_NotORM {
public function getRecommend(){ public function getRecommend(){
$configpri=getConfigPri(); $configpri=getConfigPri();
$where=" isrecommend = '1' and islive= '1' and ishot='1' "; $where="islive= '1'";
$result=DI()->notorm->users_live $result=DI()->notorm->users_live
->select("uid,thumb,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway") ->select("uid,thumb,title,city,stream,pull,thumb,isvideo,type,type_val,game_action,goodnum,anyway")
->where($where) ->where($where)
->order('starttime desc') ->order(' isrecommend desc, starttime desc')
->limit(50) ->limit(50)
->fetchAll(); ->fetchAll();
......
...@@ -857,12 +857,10 @@ class Model_Live extends PhalApi_Model_NotORM { ...@@ -857,12 +857,10 @@ class Model_Live extends PhalApi_Model_NotORM {
$anthor_total=floor($anthor_total*$jackpotset['luck_anchor']*0.01); $anthor_total=floor($anthor_total*$jackpotset['luck_anchor']*0.01);
} }
/* 幸运礼物分成 */ /* 幸运礼物分成 */
/* 家族分成之后的金额 */ /* 家族分成之后的金额 */
$anthor_total=setFamilyDivide($liveuid,$anthor_total); $anthor_total=setFamilyDivide($liveuid,$anthor_total);
//主播 经验 //主播 经验
$get_gift = !empty($set['get_gift']) ? $set['get_gift'] : 0; $get_gift = !empty($set['get_gift']) ? $set['get_gift'] : 0;
$get_gift2 = !empty($set['get_gift2']) ? $set['get_gift2'] : 0; $get_gift2 = !empty($set['get_gift2']) ? $set['get_gift2'] : 0;
...@@ -871,7 +869,6 @@ class Model_Live extends PhalApi_Model_NotORM { ...@@ -871,7 +869,6 @@ class Model_Live extends PhalApi_Model_NotORM {
$get_gif3 = (int)($total / $get_gift); $get_gif3 = (int)($total / $get_gift);
$total3 += ($get_gif3 * $get_gift2); $total3 += ($get_gif3 * $get_gift2);
} }
/* 更新直播 魅力值 累计魅力值 */ /* 更新直播 魅力值 累计魅力值 */
$istouid =DI()->notorm->users $istouid =DI()->notorm->users
->where('id = ?', $liveuid) ->where('id = ?', $liveuid)
...@@ -894,8 +891,6 @@ class Model_Live extends PhalApi_Model_NotORM { ...@@ -894,8 +891,6 @@ class Model_Live extends PhalApi_Model_NotORM {
$insert=array("type"=>$type,"action"=>$action,"uid"=>$uid,"touid"=>$liveuid,"giftid"=>$giftid,"giftcount"=>$giftcount,"totalcoin"=>$totalcoin,"showid"=>$showid,"mark"=>$giftinfo['mark'],"addtime"=>$addtime ); $insert=array("type"=>$type,"action"=>$action,"uid"=>$uid,"touid"=>$liveuid,"giftid"=>$giftid,"giftcount"=>$giftcount,"totalcoin"=>$totalcoin,"showid"=>$showid,"mark"=>$giftinfo['mark'],"addtime"=>$addtime );
DI()->notorm->users_coinrecord->insert($insert); DI()->notorm->users_coinrecord->insert($insert);
/* 更新主播热门 */ /* 更新主播热门 */
// if($giftinfo['mark']==1){ // if($giftinfo['mark']==1){
DI()->notorm->users_live DI()->notorm->users_live
...@@ -986,26 +981,26 @@ class Model_Live extends PhalApi_Model_NotORM { ...@@ -986,26 +981,26 @@ class Model_Live extends PhalApi_Model_NotORM {
); );
DI()->notorm->users_coinrecord->insert($insert); DI()->notorm->users_coinrecord->insert($insert);
$luckcoin2 = (int)($luckcoin*0.05 * 100); // $luckcoin2 = (int)($luckcoin*0.05 * 100);
$luckcoin3 = $luckcoin2 / 100; // $luckcoin3 = $luckcoin2 / 100;
if ($luckcoin3 > 0) { // if ($luckcoin3 > 0) {
DI()->notorm->users // DI()->notorm->users
->where('id = ?', $liveuid) // ->where('id = ?', $liveuid)
->update( array('votes' => new NotORM_Literal("votes + {$luckcoin3}"),'votestotal' => new NotORM_Literal("votestotal + {$luckcoin3}") )); // ->update( array('votes' => new NotORM_Literal("votes + {$luckcoin3}"),'votestotal' => new NotORM_Literal("votestotal + {$luckcoin3}") ));
$insert=array( // $insert=array(
"type"=>'income', // "type"=>'income',
"action"=>'luckgift', // "action"=>'luckgift',
"uid"=>$liveuid, // "uid"=>$liveuid,
"touid"=>$liveuid, // "touid"=>$liveuid,
"giftid"=>$giftid, // "giftid"=>$giftid,
"giftcount"=>$lucktimes, // "giftcount"=>$lucktimes,
"totalcoin"=>$luckcoin, // "totalcoin"=>$luckcoin,
"showid"=>$showid, // "showid"=>$showid,
"mark"=>$giftinfo['mark'], // "mark"=>$giftinfo['mark'],
"addtime"=>$addtime // "addtime"=>$addtime
); // );
DI()->notorm->users_coinrecord->insert($insert); // DI()->notorm->users_coinrecord->insert($insert);
} // }
break; break;
} else { } else {
$rateSum -= $ratePre; $rateSum -= $ratePre;
......
...@@ -337,26 +337,60 @@ class Model_User extends PhalApi_Model_NotORM ...@@ -337,26 +337,60 @@ class Model_User extends PhalApi_Model_NotORM
]; ];
} }
public function rechange($uid, $id) public function rechange($uid, $id, $source)
{ {
$rechange = DI()->notorm->recharge_rules->where('id=?', $id)->fetchOne(); $rechange = DI()->notorm->recharge_rules->where('id=?', $id)->fetchOne();
if (empty($rechange)) { if (empty($rechange)) {
return 1; return 1;
} }
$cashvotes = $rechange['money'];
$user = DI()->notorm->users->select('votes')->where('id=?', $uid)->fetchOne(); $user = DI()->notorm->users->select('votes')->where('id=?', $uid)->fetchOne();
if ($rechange['money'] > $user['votes']) { if ($source == 1 && $cashvotes > $user['votes']) {
return 2;
}
if ($source == 2 && $cashvotes > $user['i_votes']) {
return 2;
}
if ($source == 3 && $cashvotes > $user['f_votes']) {
return 2; return 2;
} }
$total = $rechange['money'] + $rechange['give']; $total = $rechange['money'] + $rechange['give'];
DI()->notorm->users->where('id = ?', $uid)->update([ $ifok = 0;
if ($source == 1) {
$ifok = DI()->notorm->users->where('id = ? and votes>=?', $uid, $cashvotes)->update([
'coin' => new NotORM_Literal("coin + {$total}"), 'coin' => new NotORM_Literal("coin + {$total}"),
'votes' => new NotORM_Literal("votes - {$rechange['money']}"), 'votes' => new NotORM_Literal("votes - {$cashvotes}")
]); ]);
}
return 0; if ($source == 2) {
$ifok = DI()->notorm->users->where('id = ? and i_votes>=?', $uid, $cashvotes)->update([
'coin' => new NotORM_Literal("coin + {$total}"),
'i_votes' => new NotORM_Literal("i_votes - {$cashvotes}")
]);
}
if ($source == 3) {
$ifok = DI()->notorm->users->where('id = ? and f_votes>=?', $uid, $cashvotes)->update([
'coin' => new NotORM_Literal("coin + {$total}"),
'f_votes' => new NotORM_Literal("f_votes - {$cashvotes}")
]);
}
// DI()->notorm->users->where('id = ?', $uid)->update([
// 'coin' => new NotORM_Literal("coin + {$total}"),
// 'votes' => new NotORM_Literal("votes - {$rechange['money']}"),
// ]);
return !$ifok ? 2 : 0;
} }
/* 关注 */ /* 关注 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment