Commit bdc14446 by 冷斌

fix bug

parent f35762db
...@@ -924,67 +924,49 @@ class Api_User extends PhalApi_Api ...@@ -924,67 +924,49 @@ class Api_User extends PhalApi_Api
return $rs; return $rs;
} }
if (!$accountid) { if($cashvote <= 0){
$rs['code'] = 1001;
$rs['msg'] = '请选择提现账号';
return $rs;
}
if (!$cashvote) {
$rs['code'] = 1002; $rs['code'] = 1002;
$rs['msg'] = '请输入有效的提现票数'; $rs['msg'] = '请输入有效的提现票数';
return $rs; return $rs;
} }
$data = [ $data=array(
'uid' => $uid, 'uid'=>$uid,
'accountid' => $accountid, 'accountid'=>$accountid,
'cashvote' => $cashvote, 'cashvote'=>$cashvote,
]; );
$config = getConfigPri(); $config=getConfigPri();
$domain = new Domain_User(); $domain = new Domain_User();
$info = $domain->setCash($data); $info = $domain->setCash($data);
if ($info == 1001) { if($info==1001){
$rs['code'] = 1001; $rs['code'] = 1001;
$rs['msg'] = '余额不足'; $rs['msg'] = '余额不足';
return $rs; return $rs;
} else { }else if($info==1003){
if ($info == 1003) {
$rs['code'] = 1003; $rs['code'] = 1003;
$rs['msg'] = '请先进行身份认证'; $rs['msg'] = '请先进行身份认证';
return $rs; return $rs;
} else { }else if($info==1004){
if ($info == 1004) {
$rs['code'] = 1004; $rs['code'] = 1004;
$rs['msg'] = '提现最低额度为' . $config['cash_min'] . '元'; $rs['msg'] = '提现最低额度为'.$config['cash_min'].'元';
return $rs; return $rs;
} else { }else if($info==1005){
if ($info == 1005) {
$rs['code'] = 1005; $rs['code'] = 1005;
$rs['msg'] = '不在提现期限内,不能提现'; $rs['msg'] = '不在提现期限内,不能提现';
return $rs; return $rs;
} else { }else if($info==1006){
if ($info == 1006) {
$rs['code'] = 1006; $rs['code'] = 1006;
$rs['msg'] = '每月只可提现' . $config['cash_max_times'] . '次,已达上限'; $rs['msg'] = '每月只可提现'.$config['cash_max_times'].'次,已达上限';
return $rs; return $rs;
} else { }else if($info==1007){
if ($info == 1007) {
$rs['code'] = 1007; $rs['code'] = 1007;
$rs['msg'] = '提现账号信息不正确'; $rs['msg'] = '提现账号信息不正确';
return $rs; return $rs;
} else { }else if(!$info){
if (!$info) {
$rs['code'] = 1002; $rs['code'] = 1002;
$rs['msg'] = '提现失败,请重试'; $rs['msg'] = '提现失败,请重试';
return $rs; return $rs;
} }
}
}
}
}
}
}
$rs['info'][0]['msg'] = '提现成功'; $rs['info'][0]['msg'] = '提现成功';
return $rs; return $rs;
......
...@@ -154,7 +154,7 @@ class Model_User extends PhalApi_Model_NotORM { ...@@ -154,7 +154,7 @@ class Model_User extends PhalApi_Model_NotORM {
$uid=$data['uid']; $uid=$data['uid'];
$accountid=$data['accountid']; $accountid=$data['accountid'];
$cashvote=$data['cashvote']; $money=$data['cashvote'];
$config=getConfigPri(); $config=getConfigPri();
$cash_start=$config['cash_start']; $cash_start=$config['cash_start'];
...@@ -174,30 +174,21 @@ class Model_User extends PhalApi_Model_NotORM { ...@@ -174,30 +174,21 @@ class Model_User extends PhalApi_Model_NotORM {
//本月最后一天 //本月最后一天
$month_end=strtotime("{$month} +1 month"); $month_end=strtotime("{$month} +1 month");
if($cash_max_times){ if ($cash_max_times) {
$isexist=DI()->notorm->users_cashrecord $isexist = DI()->notorm->users_cashrecord->where('uid=? and addtime > ? and addtime < ?', $uid, $month_start, $month_end)->count();
->where('uid=? and addtime > ? and addtime < ?',$uid,$month_start,$month_end) if ($isexist >= $cash_max_times) {
->count();
if($isexist >= $cash_max_times){
return 1006; return 1006;
} }
} }
$isrz=DI()->notorm->users_auth $isrz = DI()->notorm->users_auth->select("status")->where('uid=?', $uid)->fetchOne();
->select("status") if (!$isrz || $isrz['status'] != 1) {
->where('uid=?',$uid)
->fetchOne();
if(!$isrz || $isrz['status']!=1){
return 1003; return 1003;
} }
/* 钱包信息 */ /* 钱包信息 */
$accountinfo=DI()->notorm->cmf_users_info_auth $accountinfo = DI()->notorm->users_info_auth->where("uid={$uid} and status=1")->fetchOne();
->select("*") if (!$accountinfo) {
->where('uid=? and status=?',$uid, 1)
->andWhere()
->fetchOne();
if(!$accountinfo){
return 1007; return 1007;
} }
...@@ -208,7 +199,7 @@ class Model_User extends PhalApi_Model_NotORM { ...@@ -208,7 +199,7 @@ class Model_User extends PhalApi_Model_NotORM {
$cash_min=$config['cash_min']; $cash_min=$config['cash_min'];
//提现钱数 //提现钱数
$money=floor($cashvote/$cash_rate); // $money = floor($cashvote / $cash_rate);
if($money < $cash_min){ if($money < $cash_min){
return 1004; return 1004;
...@@ -216,53 +207,47 @@ class Model_User extends PhalApi_Model_NotORM { ...@@ -216,53 +207,47 @@ class Model_User extends PhalApi_Model_NotORM {
$cashvotes=$money*$cash_rate; $cashvotes=$money*$cash_rate;
$ifok = DI()->notorm->users->where('id = ? and votes>=?', $uid, $cashvotes)->update(['votes' => new NotORM_Literal("votes - {$cashvotes}")]);
$ifok=DI()->notorm->users if (!$ifok) {
->where('id = ? and votes>=?', $uid,$cashvotes)
->update(array('votes' => new NotORM_Literal("votes - {$cashvotes}")) );
if(!$ifok){
return 1001; return 1001;
} }
$name = $account = $account_bank = ''; $name = $account = $account_bank = '';
if ($accountid == 1) { if ($accountid == 0) {
$account = $accountinfo['account']; $account = $accountinfo['account'];
$name = $accountinfo['username']; $name = $accountinfo['username'];
} }
//
// if ($accountid == 2) {
// return 1007;
// }
if ($accountid == 2) { if ($accountid == 1) {
return 1007;
}
if ($accountid == 3) {
$name = $accountinfo['name']; $name = $accountinfo['name'];
$account = $accountinfo['bank_card']; $account = $accountinfo['bank_card'];
$account_bank = $accountinfo['bank_province'] . $accountinfo['bank_city']; $account_bank = $accountinfo['bank_province'] . $accountinfo['bank_city'];
} }
$data=array( $data = [
"uid"=>$uid, "uid" => $uid,
"money"=>$money, "money" => $money,
"votes"=>$cashvotes, "votes" => $cashvotes,
"orderno"=>$uid.'_'.$nowtime.rand(100,999), "orderno" => $uid . '_' . $nowtime . rand(100, 999),
"status"=>0, "status" => 0,
"addtime"=>$nowtime, "addtime" => $nowtime,
"uptime"=>$nowtime, "uptime" => $nowtime,
"type"=>$accountid, "type" => $accountid,
"account_bank"=>$account_bank, "account_bank" => $account_bank,
"account"=>$account, "account" => $account,
"name"=>$name, "name" => $name,
); ];
$rs=DI()->notorm->users_cashrecord->insert($data); $rs = DI()->notorm->users_cashrecord->insert($data);
if(!$rs){ if (!$rs) {
return 1002; return 1002;
} }
return $rs; return $rs;
} }
......
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