倒叙
This commit is contained in:
parent
20f62fe5a5
commit
60bc148a42
@ -77,7 +77,7 @@ class Billions extends Api
|
||||
// $id = WithdrawLogic::balanceapply($this->user_id, $post);
|
||||
// return JsonServer::success('申请成功', ['id' => $id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 百亿充值到本地余额
|
||||
*/
|
||||
@ -114,10 +114,10 @@ class Billions extends Api
|
||||
}
|
||||
// 微信零钱最小提现金额 1元
|
||||
if($price < 1) {
|
||||
return JsonServer::error('扣除手续费后提现金额不能小于1元');
|
||||
return JsonServer::error('扣除手续费后提现金额不能小于1元');
|
||||
}
|
||||
if($price > 500) {
|
||||
return JsonServer::error('提现金额不能大于500');
|
||||
return JsonServer::error('提现金额不能大于500');
|
||||
}
|
||||
// 每天最多可向同一用户付款7次
|
||||
$count = Db::name('withdraw_apply')
|
||||
@ -127,7 +127,7 @@ class Billions extends Api
|
||||
->where('status', '>=', 2) // 提现中、提现成功、提现失败
|
||||
->count();
|
||||
if($count >= 7) {
|
||||
return JsonServer::error('同一个用户一天最多可付款7次');
|
||||
return JsonServer::error('同一个用户一天最多可付款7次');
|
||||
}
|
||||
// 一个商户默认同一日付款总额限额10万元
|
||||
$sum = Db::name('withdraw_apply')
|
||||
@ -137,23 +137,23 @@ class Billions extends Api
|
||||
->sum('left_money');
|
||||
$sum = $sum + $price;
|
||||
if($sum > 20000) {
|
||||
return JsonServer::error('一个用户默认同一日付款总额限额2万元');
|
||||
return JsonServer::error('一个用户默认同一日付款总额限额2万元');
|
||||
}
|
||||
|
||||
// 用户授权信息(同一个用户可能有多条,取client最小的一条)
|
||||
$userAuth = Db::name('user_auth')->where('user_id', $user_id)->order('client', 'asc')->find();
|
||||
if(!$userAuth) {
|
||||
// 无授权记录
|
||||
return JsonServer::error('查询不到该用户的openid');
|
||||
return JsonServer::error('查询不到该用户的openid');
|
||||
}
|
||||
//提现手续费
|
||||
$poundage = 0;
|
||||
$poundage_config = 0;
|
||||
// if ($type != WithdrawEnum::TYPE_BALANCE) {
|
||||
$p_msg = Db::name("config")->where("type","withdraw")->where("name","poundage")->find();
|
||||
$poundage_config = $p_msg['value'];
|
||||
// $poundage_config = ConfigServer::get('withdraw', 'poundage', 0);
|
||||
$poundage = $price * $poundage_config / 100;
|
||||
$p_msg = Db::name("config")->where("type","withdraw")->where("name","poundage")->find();
|
||||
$poundage_config = $p_msg['value'];
|
||||
// $poundage_config = ConfigServer::get('withdraw', 'poundage', 0);
|
||||
$poundage = $price * $poundage_config / 100;
|
||||
// }
|
||||
|
||||
$data = [
|
||||
@ -181,10 +181,10 @@ class Billions extends Api
|
||||
|
||||
//请求URL
|
||||
$url = 'https://api.mch.weixin.qq.com/v3/transfer/batches';
|
||||
|
||||
//移除表情
|
||||
|
||||
//移除表情
|
||||
$user_msg['nickname'] = self::removeEmojiChar($user_msg['nickname']);
|
||||
//请求方式
|
||||
//请求方式
|
||||
$http_method = 'POST';
|
||||
//请求参数
|
||||
// $user_msg['nickname'] = mb_convert_encoding($user_msg['nickname'], "UTF-8", "auto");
|
||||
@ -217,18 +217,18 @@ class Billions extends Api
|
||||
$result_arr = json_decode($result,true);
|
||||
// var_dump($result_arr);
|
||||
// $result_arr['d'] = 1;
|
||||
if(!isset($result_arr['create_time'])) {//批次受理失败
|
||||
if(!isset($result_arr['create_time'])) {//批次受理失败
|
||||
// $result_arr['d'] = 0;
|
||||
Db::name('withdraw_apply')
|
||||
->where('id', $withdraw_msg['id'])
|
||||
->update([
|
||||
'status' => 4, // 提现中
|
||||
'update_time' => time(),
|
||||
'pay_desc' => $result
|
||||
]);
|
||||
return JsonServer::error('提现失败,请稍后再试');
|
||||
// throw new \Exception($result_arr['message']);
|
||||
}
|
||||
Db::name('withdraw_apply')
|
||||
->where('id', $withdraw_msg['id'])
|
||||
->update([
|
||||
'status' => 4, // 提现中
|
||||
'update_time' => time(),
|
||||
'pay_desc' => $result
|
||||
]);
|
||||
return JsonServer::error('提现失败,请稍后再试');
|
||||
// throw new \Exception($result_arr['message']);
|
||||
}
|
||||
|
||||
//批次受理成功,更新提现申请单为提现中状态
|
||||
Db::name('withdraw_apply')
|
||||
@ -253,7 +253,7 @@ class Billions extends Api
|
||||
$da['sn'] = $withdraw_msg['sn'];
|
||||
$da['create_time'] = date("Y-m-d H:i:s");
|
||||
Db::name("subsidy_withdrawal_record")->save($da);
|
||||
return JsonServer::success('零钱提现中');
|
||||
return JsonServer::success('零钱提现中');
|
||||
}
|
||||
|
||||
public function advance($billions_id,$money){
|
||||
@ -324,40 +324,41 @@ class Billions extends Api
|
||||
return JsonServer::error('返补余额增加失败');
|
||||
}
|
||||
}
|
||||
// $billions = new BillionsModel();
|
||||
// $type = "billions_use";
|
||||
// $order['id'] = 0;
|
||||
// // 6为提前消费金额
|
||||
// $order['type'] = 6;
|
||||
// $order['order_sn'] = "billions".time().$result['user_id'];
|
||||
// $order['order_amount'] = $money;
|
||||
// $billions_result = $billions->billions($order,$result['user_id'],$type);
|
||||
// if($billions_result){
|
||||
// return JsonServer::success('提现成功');
|
||||
// }else{
|
||||
// return JsonServer::error('参与返补失败');
|
||||
// }
|
||||
// $billions = new BillionsModel();
|
||||
// $type = "billions_use";
|
||||
// $order['id'] = 0;
|
||||
// // 6为提前消费金额
|
||||
// $order['type'] = 6;
|
||||
// $order['order_sn'] = "billions".time().$result['user_id'];
|
||||
// $order['order_amount'] = $money;
|
||||
// $billions_result = $billions->billions($order,$result['user_id'],$type);
|
||||
|
||||
// if($billions_result){
|
||||
// return JsonServer::success('提现成功');
|
||||
// }else{
|
||||
// return JsonServer::error('参与返补失败');
|
||||
// }
|
||||
return JsonServer::success('提现成功');
|
||||
}else{
|
||||
return JsonServer::error('提现失败');
|
||||
}
|
||||
}
|
||||
|
||||
public static function removeEmojiChar($str){
|
||||
$mbLen = mb_strlen($str);
|
||||
$strArr = [];
|
||||
for ($i = 0; $i < $mbLen; $i++) {
|
||||
$mbSubstr = mb_substr($str, $i, 1, 'utf-8');
|
||||
if (strlen($mbSubstr) >= 4) {
|
||||
continue;
|
||||
|
||||
}
|
||||
$strArr[] = $mbSubstr;
|
||||
|
||||
}
|
||||
return implode('', $strArr);
|
||||
|
||||
public static function removeEmojiChar($str){
|
||||
$mbLen = mb_strlen($str);
|
||||
$strArr = [];
|
||||
for ($i = 0; $i < $mbLen; $i++) {
|
||||
$mbSubstr = mb_substr($str, $i, 1, 'utf-8');
|
||||
if (strlen($mbSubstr) >= 4) {
|
||||
continue;
|
||||
|
||||
}
|
||||
$strArr[] = $mbSubstr;
|
||||
|
||||
}
|
||||
return implode('', $strArr);
|
||||
|
||||
}
|
||||
public static function token($url,$http_method,$data,$config)
|
||||
{
|
||||
$timestamp = time();//请求时间戳
|
||||
@ -388,7 +389,7 @@ class Billions extends Api
|
||||
$merchant_id, $nonce, $timestamp, $serial_no, $sign);//微信返回token
|
||||
return $schema.' '.$token;
|
||||
}
|
||||
|
||||
|
||||
public static function https_request($url,$data,$token)
|
||||
{
|
||||
$curl = curl_init();
|
||||
@ -414,7 +415,7 @@ class Billions extends Api
|
||||
curl_close($curl);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 百亿充值记录
|
||||
*/
|
||||
@ -428,7 +429,7 @@ class Billions extends Api
|
||||
$result = BillionsLogic::rechargeRecord($get);
|
||||
return JsonServer::success('', $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 百亿提现记录
|
||||
*/
|
||||
|
||||
@ -48,7 +48,7 @@ class BillionsLogic extends Logic
|
||||
$list = Billions::alias('b')->where($where)->order('billions_id', 'desc')
|
||||
->page($page,$size)->select();
|
||||
} else {
|
||||
$list = Billions::alias('b')->where($where)
|
||||
$list = Billions::alias('b')->where($where)->order('billions_id', 'desc')
|
||||
->page($page,$size)->select();
|
||||
}
|
||||
|
||||
@ -1089,7 +1089,7 @@ class BillionsLogic extends Logic
|
||||
*/
|
||||
public static function withdrawalRecord($get)
|
||||
{
|
||||
$list = SubsidyWithdrawalRecord::field('way,commission, take_money, money, sn, create_time')
|
||||
$list = SubsidyWithdrawalRecord::field('commission, take_money, money, sn, create_time')
|
||||
->where([
|
||||
'user_id' => $get['user_id']
|
||||
])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user