Commit bdc14446 by 冷斌

fix bug

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