分销申请添加会员信息申请
This commit is contained in:
parent
1bafa8a098
commit
b2b73b4b92
@ -4,6 +4,7 @@ namespace app\admin\controller\distribution;
|
||||
use app\admin\logic\distribution\DistributionLevelLogic;
|
||||
use app\admin\logic\distribution\DistributionMemberLogic;
|
||||
use app\common\basics\AdminBase;
|
||||
use app\common\model\distribution\DistributionMemberApply;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
/**
|
||||
@ -89,7 +90,7 @@ class DistributionMember extends AdminBase
|
||||
$user = DistributionMemberLogic::getUser($params);
|
||||
$levels = DistributionLevelLogic::getLevels();
|
||||
return view('', [
|
||||
'procurement' => $user,
|
||||
'user' => $user,
|
||||
'levels' => $levels
|
||||
]);
|
||||
}
|
||||
@ -109,4 +110,16 @@ class DistributionMember extends AdminBase
|
||||
}
|
||||
return JsonServer::error(DistributionMemberLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查看会员资料
|
||||
*/
|
||||
public function see()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$user = DistributionMemberLogic::getMemberApply($params);
|
||||
return view('', [
|
||||
'user' => $user
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ use app\common\basics\Logic;
|
||||
use app\common\model\distribution\Distribution;
|
||||
use app\common\model\distribution\DistributionLevel;
|
||||
use app\common\model\distribution\DistributionOrderGoods;
|
||||
use app\common\model\distribution\DistributionMemberApply;
|
||||
use app\common\model\user\User;
|
||||
use app\common\server\UrlServer;
|
||||
|
||||
@ -52,7 +53,7 @@ class DistributionMemberLogic extends Logic
|
||||
'd.distribution_time',
|
||||
];
|
||||
$lists = Distribution::alias('d')
|
||||
->leftJoin('procurement u', 'u.id = d.user_id')
|
||||
->leftJoin('user u', 'u.id = d.user_id')
|
||||
->leftJoin('distribution_level dl', 'dl.id = d.level_id')
|
||||
->field($field)
|
||||
->where($where)
|
||||
@ -62,7 +63,7 @@ class DistributionMemberLogic extends Logic
|
||||
->toArray();
|
||||
|
||||
$count = Distribution::alias('d')
|
||||
->leftJoin('procurement u', 'u.id = d.user_id')
|
||||
->leftJoin('user u', 'u.id = d.user_id')
|
||||
->leftJoin('distribution_level dl', 'dl.id = d.level_id')
|
||||
->field($field)
|
||||
->where($where)
|
||||
@ -165,7 +166,7 @@ class DistributionMemberLogic extends Logic
|
||||
'dl.weights',
|
||||
];
|
||||
$info = Distribution::alias('d')
|
||||
->leftJoin('procurement u', 'u.id = d.user_id')
|
||||
->leftJoin('user u', 'u.id = d.user_id')
|
||||
->leftJoin('distribution_level dl', 'dl.id = d.level_id')
|
||||
->field($field)
|
||||
->where('d.user_id', $params['id'])
|
||||
@ -216,4 +217,12 @@ class DistributionMemberLogic extends Logic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取分销会员申请内容
|
||||
*/
|
||||
public static function getMemberApply($params)
|
||||
{
|
||||
return DistributionMemberApply::where(['user_id' => $params['id']])->find();
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,18 @@
|
||||
<label class="layui-form-label">联系手机:</label>
|
||||
<div class="layui-input-block">{$detail.mobile}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">身份证号码:</label>
|
||||
<div class="layui-input-block">{$detail.id_card}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手持身份证照片:</label>
|
||||
<img src="{$detail.hand_id_card}" style="width: 120px;height: 120px" alt="">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">现住区域:</label>
|
||||
<div class="layui-input-block">{$detail.region}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">现住区域:</label>
|
||||
<div class="layui-input-block">{$detail.region}</div>
|
||||
|
||||
@ -63,6 +63,11 @@
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--会员信息-->
|
||||
<script type="text/html" id="handIdCard">
|
||||
<img src="{{d.hand_id_card}}" style="height:80px;width: 80px" class="image-show">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -80,10 +85,18 @@
|
||||
,{field:"real_name", width:100, align:"center", title:"真实姓名"}
|
||||
,{field:"mobile", width:120, align:"center",title:"联系手机"}
|
||||
,{field:"region", width:150, align:"center", title:"现住区域"}
|
||||
,{field:"id_card", width:150, align:"center", title:"身份证号"}
|
||||
,{field:"hand_id_card", width:150, align:"center", title:"手持身份证照片", templet:'#handIdCard'}
|
||||
,{field:"reason", width:150, align:"center", title:"申请原因"}
|
||||
,{title:"操作", width:230, align:"center", fixed:"right", toolbar:"#table-operation"}
|
||||
]);
|
||||
|
||||
//图片放大
|
||||
$(document).on('click', '.image-show', function () {
|
||||
var src = $(this).attr('src');
|
||||
like.showImg(src,400);
|
||||
});
|
||||
|
||||
var active = {
|
||||
detail: function (obj) {
|
||||
layer.open({
|
||||
|
||||
@ -68,6 +68,7 @@
|
||||
{{# } else { }}
|
||||
<a class="layui-btn layui-bg-blue layui-btn-sm" lay-event="unfreeze">恢复资格</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn layui-btn-sm layui-bg-blue" lay-event="see">查看资料</a>
|
||||
</script>
|
||||
<!--自定义模板-->
|
||||
<script type="text/html" id="user-info">
|
||||
@ -147,7 +148,7 @@
|
||||
,{templet: '#earnings-fail', title: '已失效佣金', width:120}
|
||||
,{templet: '#user-distribution', title: '分销状态', width: 120}
|
||||
,{field: 'distribution_time', title: '成为分销会员时间', width: 200}
|
||||
,{title: '操作', toolbar: '#operate', width: 200}
|
||||
,{title: '操作', toolbar: '#operate', width: 300}
|
||||
]]
|
||||
, text: {none: '暂无数据!'}
|
||||
, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
|
||||
@ -236,6 +237,35 @@
|
||||
submit.trigger("click");
|
||||
}
|
||||
});
|
||||
} else if (layEvent === 'see') {
|
||||
id = obj.data.user_id;
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: "分销会员资料"
|
||||
,content: "{:url('distribution.distribution_member/see')}?id=" + id
|
||||
,area: ["90%", "90%"]
|
||||
,btn: ["确定", "取消"]
|
||||
,yes: function(index, layero){
|
||||
var iframeWindow = window["layui-layer-iframe" + index];
|
||||
var submit = layero.find("iframe").contents().find("#formSubmit");
|
||||
iframeWindow.layui.form.on("submit(formSubmit)", function(data){
|
||||
like.ajax({
|
||||
url: "{:url('distribution.distribution_member/see')}",
|
||||
data: data.field,
|
||||
type: "post",
|
||||
success:function(res) {
|
||||
if(res.code === 1) {
|
||||
layui.layer.msg(res.msg);
|
||||
layer.close(index);
|
||||
table.reload("lists");
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
submit.trigger("click");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
60
app/admin/view/distribution/distribution_member/see.html
Normal file
60
app/admin/view/distribution/distribution_member/see.html
Normal file
@ -0,0 +1,60 @@
|
||||
{layout name="layout1" /}
|
||||
|
||||
<style>
|
||||
.layui-input-block { line-height: 39px; }
|
||||
</style>
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">会员编号:</label>
|
||||
<div class="layui-input-block">{$user.user.sn}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">会员昵称:</label>
|
||||
<div class="layui-input-block">{$user.user.nickname}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">会员等级:</label>
|
||||
<div class="layui-input-block">{$user.user.level.name ?: '未知'}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机号码:</label>
|
||||
<div class="layui-input-block">{$user.user.mobile ?: '未知'}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">真实姓名:</label>
|
||||
<div class="layui-input-block">{$user.real_name}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">联系手机:</label>
|
||||
<div class="layui-input-block">{$user.mobile}</div>
|
||||
</div>
|
||||
{if $user.id_card}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">身份证号码:</label>
|
||||
<div class="layui-input-block">{$user.id_card}</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手持身份证照片:</label>
|
||||
<img src="{$user.hand_id_card}" style="width: 120px;height: 120px" alt="">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">现住区域:</label>
|
||||
<div class="layui-input-block">{$user.region}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">现住区域:</label>
|
||||
<div class="layui-input-block">{$user.region}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">申请状态:</label>
|
||||
<div class="layui-input-block">{$user.status_text}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">审核说明:</label>
|
||||
<div class="layui-input-block">{$user.reason}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -6,9 +6,20 @@ use app\api\validate\BillionsWithdrawValidate;
|
||||
use app\common\basics\Api;
|
||||
use app\api\logic\BillionsLogic;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
use app\common\server\WeChatServer;
|
||||
use EasyWeChat\Factory;
|
||||
use app\common\enum\WithdrawEnum;
|
||||
use app\common\model\WithdrawApply;
|
||||
use think\facade\Db;
|
||||
class Billions extends Api
|
||||
{
|
||||
|
||||
public static function getApp($client)
|
||||
{
|
||||
$config = WeChatServer::getPayConfigBySource($client)['config'];
|
||||
$app = Factory::payment($config);
|
||||
return $app;
|
||||
}
|
||||
public function lists()
|
||||
{
|
||||
$page = $this->request->get('page_no', $this->page_no);
|
||||
@ -39,8 +50,7 @@ class Billions extends Api
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$type = $this->request->get('type');
|
||||
$data = BillionsLogic::getSubsidyWithdraw($this->user_id, $type);
|
||||
$data = BillionsLogic::getSubsidyWithdraw($this->user_id);
|
||||
return JsonServer::success('', $data);
|
||||
}
|
||||
|
||||
@ -60,14 +70,246 @@ class Billions extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 百亿返补充值到余额
|
||||
* @notes 百亿充值到本地余额
|
||||
*/
|
||||
public function rechargeBalance()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = BillionsLogic::applyBillionsBalance($this->user_id, $post);
|
||||
if ($result['code'] == -1) {
|
||||
return JsonServer::error('操作失败');
|
||||
return JsonServer::error($result['msg']);
|
||||
}
|
||||
|
||||
if ($result['code'] == 1) {
|
||||
return JsonServer::success($result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
public function billionWithdrawal(){
|
||||
$user_id = $this->user_id;
|
||||
$price = $this->request->post("money");
|
||||
$type = 1;
|
||||
$user_msg = Db::name("user")->where("id",$user_id)->where("del",0)->find();
|
||||
if($user_msg == null){
|
||||
return JsonServer::error('无效账户');
|
||||
}
|
||||
$subsidy_withdrawal = Db::name("subsidy_withdrawal")->where("user_id",$user_id)->find();
|
||||
if($price > $subsidy_withdrawal['total_amount']){
|
||||
return JsonServer::error('提现金额不能大于佣金余额');
|
||||
}
|
||||
// 微信零钱最小提现金额 1元
|
||||
if($price < 1) {
|
||||
return JsonServer::error('扣除手续费后提现金额不能小于1元');
|
||||
}
|
||||
if($price > 500) {
|
||||
return JsonServer::error('提现金额不能大于500');
|
||||
}
|
||||
// 每天最多可向同一用户付款7次
|
||||
$count = Db::name('withdraw_apply')
|
||||
->whereTime('update_time', 'd') // 今天
|
||||
->where('user_id', $user_id)
|
||||
->where('type', 2) // 微信零钱
|
||||
->where('status', '>=', 2) // 提现中、提现成功、提现失败
|
||||
->count();
|
||||
if($count >= 7) {
|
||||
return JsonServer::error('同一个用户一天最多可付款7次');
|
||||
}
|
||||
// 一个商户默认同一日付款总额限额10万元
|
||||
$sum = Db::name('withdraw_apply')
|
||||
->whereTime('update_time', 'd') // 今天
|
||||
->where('type', 2) // 微信零钱
|
||||
->where('status', 'in', [2, 3]) // 提现中、提现成功
|
||||
->sum('left_money');
|
||||
$sum = $sum + $price;
|
||||
if($sum > 100000) {
|
||||
return JsonServer::error('一个商户默认同一日付款总额限额10万元');
|
||||
}
|
||||
|
||||
// 用户授权信息(同一个用户可能有多条,取client最小的一条)
|
||||
$userAuth = Db::name('user_auth')->where('user_id', $user_id)->order('client', 'asc')->find();
|
||||
if(!$userAuth) {
|
||||
// 无授权记录
|
||||
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;
|
||||
// }
|
||||
|
||||
$data = [
|
||||
'sn' => createSn('withdraw_apply', 'sn'),
|
||||
'batch_no' => createSn('withdraw_apply', 'batch_no','SJZZ'),
|
||||
'user_id' => $user_id,
|
||||
'type' => $type,
|
||||
'account' => $post['account'] ?? '',
|
||||
'real_name' => $user_msg['real_name'] ?? '',
|
||||
'money' => $price,
|
||||
'left_money' => $price - $poundage,
|
||||
'money_qr_code' => $post['money_qr_code'] ?? '',
|
||||
'remark' => $post['remark'] ?? '',
|
||||
'bank' => $post['bank'] ?? '',
|
||||
'subbank' => $post['subbank'] ?? '',
|
||||
'poundage' => $poundage,
|
||||
'status' => 1, // 待提现
|
||||
'create_time' => time(),
|
||||
];
|
||||
$withdraw_id = WithdrawApply::insertGetId($data);
|
||||
//获取配置信息
|
||||
$config = WeChatServer::getPayConfigBySource($userAuth['client'])['config'];
|
||||
$withdraw_msg = Db::name("withdraw_apply")->where("id",$withdraw_id)->find();
|
||||
|
||||
//请求URL
|
||||
$url = 'https://api.mch.weixin.qq.com/v3/transfer/batches';
|
||||
//请求方式
|
||||
$http_method = 'POST';
|
||||
//请求参数
|
||||
$user_msg['nickname'] = mb_convert_encoding($user_msg['nickname'], "UTF-8", "auto");
|
||||
$data = [
|
||||
'appid' => $config['app_id'],//申请商户号的appid或商户号绑定的appid(企业号corpid即为此appid)
|
||||
'out_batch_no' => $withdraw_msg['batch_no'],//商户系统内部的商家批次单号,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一
|
||||
'batch_name' => '提现至微信零钱',//该笔批量转账的名称
|
||||
'batch_remark' => '提现至微信零钱,昵称:'.$user_msg['nickname'],//转账说明,UTF8编码,最多允许32个字符
|
||||
'total_amount' => $withdraw_msg['left_money'] * 100,//转账金额单位为“分”。转账总金额必须与批次内所有明细转账金额之和保持一致,否则无法发起转账操作
|
||||
'total_num' => 1,//一个转账批次单最多发起三千笔转账。转账总笔数必须与批次内所有明细之和保持一致,否则无法发起转账操作
|
||||
'transfer_detail_list' => [
|
||||
[//发起批量转账的明细列表,最多三千笔
|
||||
'out_detail_no' => $withdraw_msg['sn'],//商户系统内部区分转账批次单下不同转账明细单的唯一标识,要求此参数只能由数字、大小写字母组成
|
||||
'transfer_amount' => $withdraw_msg['left_money'] * 100,//转账金额单位为分
|
||||
'transfer_remark' => '提现至微信零钱',//单条转账备注(微信用户会收到该备注),UTF8编码,最多允许32个字符
|
||||
'openid' => $userAuth['openid'],//openid是微信用户在公众号appid下的唯一用户标识(appid不同,则获取到的openid就不同),可用于永久标记一个用户
|
||||
]]
|
||||
];
|
||||
if ($withdraw_msg['left_money'] >= 2000) {
|
||||
if (empty($withdraw_msg['real_name'])) {
|
||||
throw new \Exception('转账金额 >= 2000元,收款用户真实姓名必填');
|
||||
}
|
||||
$data['transfer_detail_list'][0]['user_name'] = self::getEncrypt($withdraw_msg['real_name'],$config);
|
||||
}
|
||||
|
||||
$token = self::token($url,$http_method,$data,$config);//获取token
|
||||
// var_dump($token);
|
||||
$result = self::https_request($url,json_encode($data),$token);//发送请求
|
||||
// var_dump($result);
|
||||
$result_arr = json_decode($result,true);
|
||||
// var_dump($result_arr);
|
||||
// $result_arr['d'] = 1;
|
||||
// if(!isset($result_arr['create_time'])) {//批次受理失败
|
||||
// $result_arr['d'] = 0;
|
||||
// return $result_arr;
|
||||
// // throw new \Exception($result_arr['message']);
|
||||
// }
|
||||
|
||||
//批次受理成功,更新提现申请单为提现中状态
|
||||
Db::name('withdraw_apply')
|
||||
->where('id', $withdraw_msg['id'])
|
||||
->update([
|
||||
'status' => 2, // 提现中
|
||||
'update_time' => time(),
|
||||
'pay_desc' => $result
|
||||
]);
|
||||
Db::name('subsidy_withdrawal')
|
||||
->where('user_id', $user_id)
|
||||
->dec("total_amount",$price)
|
||||
->update();
|
||||
$da['subsidy_withdrawal_id'] = $subsidy_withdrawal['id'];
|
||||
$da['user_id'] = $user_id;
|
||||
$da['type'] = 2;
|
||||
$da['commission_money'] = $poundage;
|
||||
$da['commission'] = $poundage_config;
|
||||
$da['take_money'] = $withdraw_msg['left_money'];
|
||||
$da['money'] = $price;
|
||||
$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('零钱提现中');
|
||||
}
|
||||
public static function token($url,$http_method,$data,$config)
|
||||
{
|
||||
$timestamp = time();//请求时间戳
|
||||
$url_parts = parse_url($url);//获取请求的绝对URL
|
||||
$nonce = $timestamp.rand('10000','99999');//请求随机串
|
||||
$body = empty($data) ? '' : json_encode((object)$data);//请求报文主体
|
||||
$stream_opts = [
|
||||
"ssl" => [
|
||||
"verify_peer"=>false,
|
||||
"verify_peer_name"=>false,
|
||||
]
|
||||
];
|
||||
|
||||
$apiclient_cert_arr = openssl_x509_parse(file_get_contents($config['cert_path'],false, stream_context_create($stream_opts)));
|
||||
$serial_no = $apiclient_cert_arr['serialNumberHex'];//证书序列号
|
||||
$mch_private_key = file_get_contents($config['key_path'],false, stream_context_create($stream_opts));//密钥
|
||||
$merchant_id = $config['mch_id'];//商户id
|
||||
$canonical_url = ($url_parts['path'] . (!empty($url_parts['query']) ? "?${url_parts['query']}" : ""));
|
||||
$message = $http_method."\n".
|
||||
$canonical_url."\n".
|
||||
$timestamp."\n".
|
||||
$nonce."\n".
|
||||
$body."\n";
|
||||
openssl_sign($message, $raw_sign, $mch_private_key, 'sha256WithRSAEncryption');
|
||||
$sign = base64_encode($raw_sign);//签名
|
||||
$schema = 'WECHATPAY2-SHA256-RSA2048';
|
||||
$token = sprintf('mchid="%s",nonce_str="%s",timestamp="%d",serial_no="%s",signature="%s"',
|
||||
$merchant_id, $nonce, $timestamp, $serial_no, $sign);//微信返回token
|
||||
return $schema.' '.$token;
|
||||
}
|
||||
|
||||
public static function https_request($url,$data,$token)
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, (string)$url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
if (!empty($data)){
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
//添加请求头
|
||||
$headers = [
|
||||
'Authorization:'.$token,
|
||||
'Accept: application/json',
|
||||
'Content-Type: application/json; charset=utf-8',
|
||||
'User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
|
||||
];
|
||||
if(!empty($headers)){
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
$output = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 百亿充值记录
|
||||
*/
|
||||
public function rechargeRecord()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$get['page_no'] = $get['page_no'] ?? $this->page_no;
|
||||
$get['page_size'] = $get['page_size'] ?? $this->page_size;
|
||||
$get['user_id'] = $this->user_id;
|
||||
// $get['type'] = $get['type'] ?? 'balance'; 参数暂时不用
|
||||
$result = BillionsLogic::rechargeRecord($get);
|
||||
return JsonServer::success('', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 百亿提现记录
|
||||
*/
|
||||
public function withdrawalRecord()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$get['page_no'] = $get['page_no'] ?? $this->page_no;
|
||||
$get['page_size'] = $get['page_size'] ?? $this->page_size;
|
||||
$get['user_id'] = $this->user_id;
|
||||
// $get['type'] = $get['type'] ?? 'weixin'; 参数暂时不用
|
||||
$result = BillionsLogic::withdrawalRecord($get);
|
||||
return JsonServer::success('', $result);
|
||||
}
|
||||
}
|
||||
@ -24,12 +24,14 @@ use app\common\model\WithdrawApply;
|
||||
use app\common\server\ConfigServer;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
use app\common\enum\PayEnum;
|
||||
|
||||
|
||||
class BillionsLogic extends Logic
|
||||
{
|
||||
const COMMISSION = 10; // 手续费
|
||||
const MINIMUM_WITHDRAWAL = 1; // 最低提现
|
||||
const MIN_RECHARGE = 1; // 最低充值金额
|
||||
const MAXIMUM_WITHDRAWAL = 500; // 最高提现
|
||||
|
||||
// 获取数据
|
||||
@ -72,7 +74,7 @@ class BillionsLogic extends Logic
|
||||
$highSubsidy = Billions::where('user_id', $user_id)->sum('order_price', false);
|
||||
|
||||
// 已返补到的金额
|
||||
$get_subsidy = Billions::where(array(
|
||||
$getSubsidy = Billions::where(array(
|
||||
['user_id', '=', $user_id],
|
||||
['state', '>', 0]
|
||||
))->sum('subsidy_price', false);
|
||||
@ -86,7 +88,8 @@ class BillionsLogic extends Logic
|
||||
'count' => $count,
|
||||
'more' => $more,
|
||||
'historyOrder' => $historyOrder,
|
||||
'highSubsidy' => $highSubsidy
|
||||
'highSubsidy' => $highSubsidy,
|
||||
'getSubsidy' => $getSubsidy
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
@ -144,45 +147,31 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubsidyWithdraw($user_id, $type)
|
||||
public static function getSubsidyWithdraw($user_id)
|
||||
{
|
||||
$data['type'] = array();
|
||||
if ($type == 'weixin') {
|
||||
$data['type'] = array(
|
||||
0 => [
|
||||
'name' => '微信零钱',
|
||||
'value' => 1,
|
||||
],
|
||||
);
|
||||
} else if ($type == 'balance') {
|
||||
$data['type'] = array(
|
||||
0 => [
|
||||
'name' => '东龙汇余额账户',
|
||||
'value' => 3,
|
||||
],
|
||||
);
|
||||
}
|
||||
// $data['type'] = array(
|
||||
// 0 => [
|
||||
// 'name' => '微信零钱',
|
||||
// 'value' => 1,
|
||||
// ],
|
||||
// 1 => [
|
||||
// 'name' => '银行卡',
|
||||
// 'value' => 5,
|
||||
// ],
|
||||
// 2 => [
|
||||
// 'name' => '东龙汇余额账户',
|
||||
// 'value' => 3,
|
||||
// ]
|
||||
// );
|
||||
// 手续费
|
||||
$data['commission'] = self::COMMISSION . '%';
|
||||
// 提现规则
|
||||
$data['rule'] = '提现规则';
|
||||
|
||||
// 最小充值金额
|
||||
$data['min_recharge'] = self::MIN_RECHARGE;
|
||||
// 最小提现金额
|
||||
$data['min_withdraw'] = self::MINIMUM_WITHDRAWAL;
|
||||
|
||||
// 充值金额规则
|
||||
$data['recharge_rule'] =
|
||||
' <p>
|
||||
<b>充值规则</b>
|
||||
</p>
|
||||
';
|
||||
|
||||
// 提现金额规则
|
||||
$data['withdrawl_rule'] =
|
||||
' <p>
|
||||
<b>提现规则</b>
|
||||
</p>
|
||||
<p>提现手续费 10%</p>
|
||||
';
|
||||
|
||||
$subsidy = SubsidyWithdrawal::where(['user_id' => $user_id])->find();
|
||||
if (empty($subsidy)) {
|
||||
return [];
|
||||
@ -260,8 +249,9 @@ class BillionsLogic extends Logic
|
||||
|
||||
public static function applyBillionsBalance($user_id, $post)
|
||||
{
|
||||
|
||||
$money = $post['money'];
|
||||
$check = self::checkBalance($user_id, $post['money']);
|
||||
$check = self::checkBalance($user_id, $money);
|
||||
|
||||
if ($check['code'] == -1) {
|
||||
return $check;
|
||||
@ -324,14 +314,15 @@ class BillionsLogic extends Logic
|
||||
$data['order_id'] = $id;
|
||||
$data['dtime'] = date("Y-m-d H:i:s");
|
||||
$data['type'] = 3; // 类型是充值
|
||||
$data['subsidy_price'] = round($money * $user_subsidy / 100,5);
|
||||
$data['subsidy_price'] = round($money * $user_subsidy / 100,6);
|
||||
$res = Db::name("user_billions")->save($data);
|
||||
$billions_msg = Db::name("user_billions")->where("state",0)->select()->toArray();
|
||||
$subsidy = $money * $all_user_subsidy / 100;
|
||||
if($is_d != null){
|
||||
$ufl = round($subsidy*$user_first_leader/100,5);
|
||||
$subsidy_ufl = round($subsidy - $ufl,5);
|
||||
$ufl = round($subsidy*$user_first_leader/100,6);
|
||||
$subsidy_ufl = round($subsidy - $ufl,6);
|
||||
$first_billions_msg = Db::name("user_billions")->where("user_id",$user['first_leader'])->where("state",0)->select()->toArray();
|
||||
// var_dump($first_billions_msg);die;
|
||||
if(count($first_billions_msg) > 0){
|
||||
foreach($first_billions_msg as $k=>$v){
|
||||
if($ufl > 0){
|
||||
@ -384,15 +375,17 @@ class BillionsLogic extends Logic
|
||||
return -3;
|
||||
}
|
||||
// 剩余金额
|
||||
$ufl = round($ufl+$v['subsidy_price']-$v['order_price'],5);
|
||||
$ufl = round($ufl+$v['subsidy_price']-$v['order_price'],6);
|
||||
}else{
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$ufl)->update();
|
||||
$subsidy_price_sum = round($v['subsidy_price']+$ufl,6);
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->update(['subsidy_price'=>$subsidy_price_sum]);
|
||||
// Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$ufl)->update();
|
||||
$ufl = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$subsidy = round($subsidy_ufl + $ufl,5);
|
||||
$subsidy = round($subsidy_ufl + $ufl,6);
|
||||
}
|
||||
}
|
||||
// $first_msg = Db::name("user_billions")->where("user_id",$user['first_leader'])->where("state",0)->select()->toArray();
|
||||
@ -401,8 +394,8 @@ class BillionsLogic extends Logic
|
||||
// 数量超出前几位补贴用户
|
||||
if($count > $user_start_num) {
|
||||
$start_subsidy = $subsidy * $user_start_subsidy / 100;
|
||||
$average = round($start_subsidy / $user_start_num, 5);
|
||||
$last = round($start_subsidy - $average * ($user_start_num - 1), 5);
|
||||
$average = round($start_subsidy / $user_start_num, 6);
|
||||
$last = round($start_subsidy - $average * ($user_start_num - 1), 6);
|
||||
for ($i = 0; $i < $user_start_num; $i++) {
|
||||
if ($i + 1 == $user_start_num) {
|
||||
$arr[$i] = $last;
|
||||
@ -410,21 +403,27 @@ class BillionsLogic extends Logic
|
||||
$arr[$i] = $average;
|
||||
}
|
||||
}
|
||||
// var_dump($subsidy);
|
||||
// var_dump($start_subsidy);
|
||||
// var_dump($count-$user_start_num);
|
||||
|
||||
// 剩余人数补贴
|
||||
$end_average = round(($subsidy - $start_subsidy)/ ($count-$user_start_num), 5);
|
||||
$end_last = round($subsidy - $start_subsidy - $end_average * ($count-$user_start_num - 1), 5);
|
||||
$end_average = round(($subsidy - $start_subsidy)/ ($count-$user_start_num), 6);
|
||||
// var_dump($end_average);
|
||||
$end_last = round($subsidy - $start_subsidy - $end_average * ($count-$user_start_num - 1), 6);
|
||||
// var_dump($end_last);
|
||||
for ($y = 0; $y < $count-$user_start_num; $y++) {
|
||||
if ($y + 1 == $count-$user_start_num) {
|
||||
$arr1[$y] = $end_average;
|
||||
} else {
|
||||
$arr1[$y] = $end_last;
|
||||
} else {
|
||||
$arr1[$y] = $end_average;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$user_start_num = $count;
|
||||
// 数量不超出前几位补贴用户,按全部金额计算
|
||||
$average = round($subsidy/$count, 5);
|
||||
$last = round($subsidy - $average * ($count - 1), 5);
|
||||
$average = round($subsidy/$count, 6);
|
||||
$last = round($subsidy - $average * ($count - 1), 6);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($i + 1 == $count) {
|
||||
$arr[$i] = $last;
|
||||
@ -433,6 +432,10 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
// print_r("<pre>");
|
||||
// var_dump($arr);
|
||||
// var_dump($arr1);die;
|
||||
$billion_arr = $billion_arr_id = "";
|
||||
foreach($billions_msg as $k=>$v){
|
||||
if($k + 1 <= $user_start_num){
|
||||
// var_dump($v['order_price']);
|
||||
@ -493,15 +496,15 @@ class BillionsLogic extends Logic
|
||||
// 剩余数量
|
||||
$residue_count = $user_start_num - $k - 1;
|
||||
// 剩余金额
|
||||
$residue_price = round($arr[$k]+$v['subsidy_price']-$v['order_price'],5);
|
||||
$residue_price = round($arr[$k]+$v['subsidy_price']-$v['order_price'],6);
|
||||
foreach($arr as $k1=>$v1){
|
||||
if($k1 > $k){
|
||||
$residue_price+=$arr[$k1];
|
||||
}
|
||||
}
|
||||
|
||||
$average = round($residue_price/$residue_count,5);
|
||||
$last = round($residue_price - $average*($residue_count-1),5);
|
||||
$average = round($residue_price/$residue_count,6);
|
||||
$last = round($residue_price - $average*($residue_count-1),6);
|
||||
foreach($arr as $k1=>$v1){
|
||||
if($k1+1 == $user_start_num){
|
||||
$arr[$k1] = $last;
|
||||
@ -513,7 +516,14 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
|
||||
}else{
|
||||
Db::name("user_billions")->where("billions_id", $v['billions_id'])->inc("subsidy_price", $arr[$k])->update();
|
||||
$subp = round($v['subsidy_price']+$arr[$k],6);
|
||||
$billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
$billion_arr_id.=$v['billions_id'].",";
|
||||
// $dataSet[] = [
|
||||
// 'billions_id' => $v['billions_id'], // 假设每个模型数据都有一个ID字段
|
||||
// 'subsidy_price' => round($v['subsidy_price']+$arr[$k],6) // 其他字段数据
|
||||
// ];
|
||||
// Db::name("user_billions")->where("billions_id", $v['billions_id'])->inc("subsidy_price", $arr[$k])->update();
|
||||
}
|
||||
}else{
|
||||
if($v['order_price'] <= $arr1[$k - $user_start_num] + $v['subsidy_price']){
|
||||
@ -571,14 +581,14 @@ class BillionsLogic extends Logic
|
||||
// 剩余数量
|
||||
$residue_count = $count-$user_start_num - $k+$user_start_num - 1;
|
||||
// 剩余金额
|
||||
$residue_price = round($arr1[$k-$user_start_num]+$v['subsidy_price']-$v['order_price'],5);
|
||||
$residue_price = round($arr1[$k-$user_start_num]+$v['subsidy_price']-$v['order_price'],6);
|
||||
foreach($arr1 as $k1=>$v1){
|
||||
if($k1 > $k - $user_start_num){
|
||||
$residue_price+=$arr1[$k1];
|
||||
}
|
||||
}
|
||||
$average = round($residue_price/$residue_count,5);
|
||||
$last = round($residue_price - $average*($residue_count-1),5);
|
||||
$average = round($residue_price/$residue_count,6);
|
||||
$last = round($residue_price - $average*($residue_count-1),6);
|
||||
foreach($arr1 as $k1=>$v1){
|
||||
if($k1+1 == $count-$user_start_num){
|
||||
$arr1[$k1] = $last;
|
||||
@ -589,13 +599,33 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr1[$k-$user_start_num])->update();
|
||||
$subp = round($v['subsidy_price']+$arr1[$k-$user_start_num],6);
|
||||
$billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
$billion_arr_id.=$v['billions_id'].",";
|
||||
// $dataSet[] = [
|
||||
// 'billions_id' => $v['billions_id'], // 假设每个模型数据都有一个ID字段
|
||||
// 'subsidy_price' => round($v['subsidy_price']+$arr1[$k-$user_start_num],6) // 其他字段数据
|
||||
// ];
|
||||
// Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr1[$k-$user_start_num])->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
$billion_arr_id = explode(",",$billion_arr_id);
|
||||
array_pop($billion_arr_id);
|
||||
// print_r("<pre>");
|
||||
// var_dump($billion_arr_id);die;
|
||||
$billion_arr_id = implode(",",$billion_arr_id);
|
||||
$sql = "UPDATE `ls_user_billions`
|
||||
SET subsidy_price = CASE billions_id
|
||||
$billion_arr
|
||||
END
|
||||
WHERE billions_id IN ($billion_arr_id)";
|
||||
$query = Db::query($sql);
|
||||
|
||||
// Db::name("billions")->updateAll($dataSet,"billions_id");
|
||||
if($is_d!=null){
|
||||
if($user['first_leader']>0){
|
||||
$first_leader_percent = round($money * $first_leader / 100, 5);
|
||||
$first_leader_percent = round($money * $first_leader / 100, 6);
|
||||
// Order::where('id', $order['id'])
|
||||
// ->inc('distribution_money',$first_leader_percent)->update();
|
||||
UserDistribution::where('user_id', $user['first_leader'])
|
||||
@ -639,7 +669,7 @@ class BillionsLogic extends Logic
|
||||
}
|
||||
// 3%对公司
|
||||
if($user['divide_role_user_id'] > 0&&$state>0 ){
|
||||
$divide_percent = round($money * $other_leader / 100, 5);
|
||||
$divide_percent = round($money * $other_leader / 100, 6);
|
||||
// Order::where('id', $order['id'])
|
||||
// ->inc('distribution_money',$divide_percent)->update();
|
||||
// $shopDistribution_msg = UserShopDistribution::where('shop_id', $value['shop_id'])
|
||||
@ -683,34 +713,26 @@ class BillionsLogic extends Logic
|
||||
if ($money <= 0) {
|
||||
return [
|
||||
'code' => -1,
|
||||
'msg' => '提现金额需要大于0'
|
||||
'msg' => '充值金额需要大于0'
|
||||
];
|
||||
}
|
||||
|
||||
$able_withdraw = SubsidyWithdrawal::where('user_id', $user_id)->value('total_amount');
|
||||
// 1.如果提现金额大于余额
|
||||
|
||||
// 1.如果充值金额大于余额
|
||||
if ($money > $able_withdraw) {
|
||||
return [
|
||||
'code' => -1,
|
||||
'msg' => '可提现金额不足'
|
||||
'msg' => '可充值金额不足'
|
||||
];
|
||||
}
|
||||
|
||||
// 2.最低提现金额
|
||||
$min_withdraw = BillionsLogic::MINIMUM_WITHDRAWAL;
|
||||
if ($money < $min_withdraw) {
|
||||
$min_recharge = BillionsLogic::MIN_RECHARGE;
|
||||
if ($money < $min_recharge) {
|
||||
return [
|
||||
'code' => -1,
|
||||
'msg' => '最低提现' . $min_withdraw . '元'
|
||||
];
|
||||
}
|
||||
|
||||
// 3.最高提现金额
|
||||
$max_withdraw = BillionsLogic::MAXIMUM_WITHDRAWAL;
|
||||
if ($money > $max_withdraw) {
|
||||
return [
|
||||
'code' => -1,
|
||||
'msg' => '最高提现' . $max_withdraw . '元'
|
||||
'msg' => '最低充值' . $min_recharge . '元'
|
||||
];
|
||||
}
|
||||
|
||||
@ -724,4 +746,76 @@ class BillionsLogic extends Logic
|
||||
// }
|
||||
return ['code' => 1, 'msg' => ''];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 百亿充值记录
|
||||
*/
|
||||
public static function rechargeRecord($get)
|
||||
{
|
||||
$list = RechargeOrder::field('order_sn, order_amount, create_time')
|
||||
->where([
|
||||
'user_id' => $get['user_id'],
|
||||
'pay_status' => PayEnum::ISPAID, // 已支付的
|
||||
'pay_way' => 5 // 百亿返补充值
|
||||
])
|
||||
->order('create_time', 'desc')
|
||||
->page($get['page_no'], $get['page_size'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$count = RechargeOrder::where([
|
||||
'user_id' => $get['user_id'],
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_way' => 5 // 百亿返补充值
|
||||
])->count();
|
||||
|
||||
foreach($list as &$item) {
|
||||
$item['desc'] = '充值到余额¥'. clearZero($item['order_amount']);
|
||||
}
|
||||
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'lists' => $list,
|
||||
'more' => is_more($count, $get['page_no'], $get['page_size']),
|
||||
'page_no' => $get['page_no'],
|
||||
'page_size' => $get['page_size']
|
||||
];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 百亿提现微信记录
|
||||
*/
|
||||
public static function withdrawalRecord($get)
|
||||
{
|
||||
$list = SubsidyWithdrawalRecord::field('commission, take_money, money, sn, create_time')
|
||||
->where([
|
||||
'user_id' => $get['user_id'],
|
||||
'way' => 1
|
||||
])
|
||||
->order('create_time', 'desc')
|
||||
->page($get['page_no'], $get['page_size'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$count = SubsidyWithdrawalRecord::where([
|
||||
'user_id' => $get['user_id'],
|
||||
'way' => 1
|
||||
])->count();
|
||||
|
||||
foreach($list as &$item) {
|
||||
$item['desc'] = '提现微信¥' . number_format($item['money'], 2) . ', 手续费: ' . $item['commission'] . '%, 实际到账 ¥' . $item['take_money'];
|
||||
}
|
||||
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'lists' => $list,
|
||||
'more' => is_more($count, $get['page_no'], $get['page_size']),
|
||||
'page_no' => $get['page_no'],
|
||||
'page_size' => $get['page_size']
|
||||
];
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -1072,6 +1072,10 @@ class OrderLogic extends Logic
|
||||
$order_data['billions_type'] = $post['billions_type'];
|
||||
}
|
||||
|
||||
if (isset($post['balance_pay'])) {
|
||||
$order_data['is_balance_pay'] = 1;
|
||||
}
|
||||
|
||||
// 线下自提
|
||||
if ($goods[0]['delivery_type'] == OrderEnum::DELIVERY_TYPE_SELF) {
|
||||
$order_data['pickup_code'] = create_rand_number('order', 'pickup_code', 6);
|
||||
@ -1833,9 +1837,9 @@ class OrderLogic extends Logic
|
||||
$end_last = round($subsidy - $start_subsidy - $end_average * ($count-$user_start_num - 1), 5);
|
||||
for ($y = 0; $y < $count-$user_start_num; $y++) {
|
||||
if ($y + 1 == $count-$user_start_num) {
|
||||
$arr1[$y] = $end_average;
|
||||
} else {
|
||||
$arr1[$y] = $end_last;
|
||||
} else {
|
||||
$arr1[$y] = $end_average;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@ -1851,6 +1855,7 @@ class OrderLogic extends Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
$billion_arr = $billion_arr_id = "";
|
||||
foreach($billions_msg as $k=>$v){
|
||||
if($k+1 <= $user_start_num){
|
||||
// var_dump($v['order_price']);
|
||||
@ -1930,7 +1935,10 @@ class OrderLogic extends Logic
|
||||
}
|
||||
|
||||
}else{
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr[$k])->update();
|
||||
$subp = round($v['subsidy_price']+$arr[$k],6);
|
||||
$billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
$billion_arr_id.=$v['billions_id'].",";
|
||||
// Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr[$k])->update();
|
||||
}
|
||||
}else{
|
||||
if($v['order_price'] <= $arr1[$k-$user_start_num]+$v['subsidy_price']){
|
||||
@ -2005,11 +2013,24 @@ class OrderLogic extends Logic
|
||||
}
|
||||
|
||||
}else{
|
||||
Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr1[$k-$user_start_num])->update();
|
||||
$subp = round($v['subsidy_price']+$arr1[$k-$user_start_num],6);
|
||||
$billion_arr.=" when ".$v['billions_id']." then '".$subp."'";
|
||||
$billion_arr_id.=$v['billions_id'].",";
|
||||
// Db::name("user_billions")->where("billions_id",$v['billions_id'])->inc("subsidy_price",$arr1[$k-$user_start_num])->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$billion_arr_id = explode(",",$billion_arr_id);
|
||||
array_pop($billion_arr_id);
|
||||
// print_r("<pre>");
|
||||
// var_dump($billion_arr_id);die;
|
||||
$billion_arr_id = implode(",",$billion_arr_id);
|
||||
$sql = "UPDATE `ls_user_billions`
|
||||
SET subsidy_price = CASE billions_id
|
||||
$billion_arr
|
||||
END
|
||||
WHERE billions_id IN ($billion_arr_id)";
|
||||
$query = Db::query($sql);
|
||||
if($is_d!=null){
|
||||
if($user['first_leader']>0){
|
||||
$first_leader_percent = round($value['total_pay_price']*$first_leader / 100, 5);
|
||||
@ -2128,7 +2149,7 @@ class OrderLogic extends Logic
|
||||
'change_amount' => $divide_percent,
|
||||
'left_amount' => $earnings_buy + $divide_percent,
|
||||
'change_type' => 1,
|
||||
'remark' => '百亿返补佣金增加'
|
||||
'remark' => '百亿返补对公司佣金增加'
|
||||
]);
|
||||
DistributionOrderGoods::create([
|
||||
'sn' => $sn,
|
||||
@ -2912,19 +2933,23 @@ class OrderLogic extends Logic
|
||||
$payway = $payModel->where(['status' => 1])->order('sort')->hidden(['config'])->select()->toArray();
|
||||
|
||||
// 我的订单
|
||||
$is_billions = false;
|
||||
$where = [];
|
||||
if ($params['from'] == 'trade') {
|
||||
$where[] = ['trade_id', '=', $params['order_id']];
|
||||
} else if ($params['from'] == 'order') {
|
||||
$where[] = ['id', '=', $params['order_id']];
|
||||
}
|
||||
$is_billions = Order::where($where)->value('billions_type');
|
||||
// $is_billions = Order::where($where)->value('billions_type');
|
||||
$order = Order::where($where)->find();
|
||||
|
||||
foreach ($payway as $k => &$item) {
|
||||
// 如果下单的时候选择了余额支付则删除微信支付
|
||||
if ($item['code'] == 'wechat') {
|
||||
$item['extra'] = '微信快捷支付';
|
||||
$item['pay_way'] = PayEnum::WECHAT_PAY;
|
||||
if ($order->is_balance_type == 1) {
|
||||
unset($payway[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是百亿返补则不让其使用余额支付
|
||||
@ -2932,12 +2957,12 @@ class OrderLogic extends Logic
|
||||
$user_money = Db::name('user')->where(['id' => $user_id])->value('user_money');
|
||||
$item['extra'] = '可用余额:' . $user_money;
|
||||
$item['pay_way'] = PayEnum::BALANCE_PAY;
|
||||
if($params['from'] == 'recharge' || $is_billions) {
|
||||
if($params['from'] == 'recharge' || $order->billions_type == 1) {
|
||||
unset($payway[$k]);
|
||||
}
|
||||
|
||||
// 从我的订单进行支付,如果是百亿返补则不让其使用余额支付
|
||||
if ($params['from'] == 'order' && $is_billions) {
|
||||
if ($params['from'] == 'order' && $order->billions_type == 1) {
|
||||
unset($payway[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user