Commit a5d8bd78 authored by twj's avatar twj

余额提现和期权提现

parent 9fa88147
......@@ -34,20 +34,39 @@ class Withdraw extends Common
public function index()
{
$money = \app\money\model\Money::getMoney(MID);
$money['account'] =bcdiv($money['account'],100,2);
$money['operate_account'] = bcdiv($money['operate_account'],100,2);
$money['operate_account'] = bcdiv($money['operate_account'],100,2);
$money['account'] = bcdiv($money['account'], 100, 2);
$money['operate_account'] = bcdiv($money['operate_account'], 100, 2);
$money['operate_account'] = bcdiv($money['operate_account'], 100, 2);
$banks = BankModel::getBank(MID);
if(empty($banks)) ajaxmsg('您未绑定银行卡,请先绑定银行卡',0);
if (empty($banks)) ajaxmsg('您未绑定银行卡,请先绑定银行卡', 0);
$data['money'] = $money;
$data['banks'] = $banks;
$data['default_bank'] = $banks[0];
$data['bankSetting'] = preg_replace('/\|img/', '',config("web_bank"));
ajaxmsg('线下提现信息',1,$data);
$data['bankSetting'] = preg_replace('/\|img/', '', config("web_bank"));
ajaxmsg('线下提现信息', 1, $data);
}
/**
* 提现规则说明
*/
public function withdrawRule()
{
//最低提现金额
$minimum = config('withdraw_minimum');
//最高提现金额
$maximum = config('withdraw_maximum');
//提现手续费比例
$rate = config('withdraw_rate');
//提现审核时间
$withdraw_audit_time = config('withdraw_audit_time');
$rule = [];
$rule[0] = "1.单笔提现最低金额:" . $minimum;
$rule[1] = "2.单笔提现最高金额:" . $maximum;
$rule[2] = "3.提现手续费" . $rate . "%";
$rule[4] = "4.提现审核时间" . $withdraw_audit_time;
ajaxmsg('提现规则说明', 1, $rule);
}
/*
* 操作提现操作
......@@ -58,37 +77,37 @@ class Withdraw extends Common
$data = $this->request->post();
$data['mid'] = MID;
$result = $this->validate($data, "Withdraw.create");
if(true !== $result){
ajaxmsg($result,0);
if (true !== $result) {
ajaxmsg($result, 0);
//$this->error($result);
}
if($data['money']<0){
ajaxmsg('提现金额错误!',0);
if ($data['money'] < 0) {
ajaxmsg('提现金额错误!', 0);
}
$money_res=Db::name('money')->where(['mid'=>MID])->find();
if(empty($money_res['account'])){
ajaxmsg('查询账户资金出错!',0);
$money_res = Db::name('money')->where(['mid' => MID])->find();
if (empty($money_res['account'])) {
ajaxmsg('查询账户资金出错!', 0);
}
if(isset($money_res['account'])&&$money_res['account']<$data['money']){
ajaxmsg('提现金额已经大于可用余额!',0);
if (isset($money_res['account']) && $money_res['account'] < $data['money']) {
ajaxmsg('提现金额已经大于可用余额!', 0);
}
$withdraw_info=Db::name('money_withdraw')
->where(['mid'=>MID])
->where(['status'=>0])
$withdraw_info = Db::name('money_withdraw')
->where(['mid' => MID])
->where(['status' => 0])
->find();
if(!empty($withdraw_info)){
ajaxmsg('您已有提现申请,请耐心等待审核。',0);
if (!empty($withdraw_info)) {
ajaxmsg('您已有提现申请,请耐心等待审核。', 0);
}
$c = Db::name('member')->where(["id"=>MID])->find();
if(Hash::check((string)$data['paywd'], $c['paywd'])){
$c = Db::name('member')->where(["id" => MID])->find();
if (Hash::check((string)$data['paywd'], $c['paywd'])) {
$res = WithdrawModel::saveData($data);
}else{
ajaxmsg('支付密码错误',0);
} else {
ajaxmsg('支付密码错误', 0);
}
if($res['status']){
ajaxmsg('提现申请已提交,请耐心等待审核',1);
}else{
ajaxmsg('提现申请提交失败',0);
if ($res['status']) {
ajaxmsg('提现申请已提交,请耐心等待审核', 1);
} else {
ajaxmsg('提现申请提交失败', 0);
}
}
}
\ No newline at end of file
}
......@@ -83,7 +83,7 @@ class Esopplan extends Admin
$data['create_time'] = time();
$data['plan_account'] = $data['plan_account'] * 100;
$data['remain_account'] = $data['plan_account'] * 100;
$data['create_ip'] = get_client_ip(1);
$data['create_ip'] = get_client_ip(0);
//业务逻辑处理
$result_up = Db::name("esop_plan")->insert($data);
if ($result_up === 1) {
......
......@@ -112,7 +112,7 @@ class EsopplanRecord extends Admin
'type' => 1,
'info' => "自动行权,期权增加" . ($affect / 100),
'create_time' => time(),
'create_ip' => get_client_ip(1)
'create_ip' => get_client_ip(0)
];
EsopPlanRecordModel::create($arr);
}
......
......@@ -67,7 +67,9 @@ class Withdraw extends Admin
['order_no', '订单号'],
['mobile', '手机号'],
['name', '姓名'],
['money', '金额'],
['money', '申请金额'],
['fee','手续费'],
['real_money','到账金额'],
['bank', '银行信息'],
['status', '状态'],
['create_time', '申请时间', 'datetime'],
......
......@@ -66,9 +66,10 @@ class EsopPlan extends Model
$data['bank'] = $bank['bank'] . "|" . $bank['card'] . '|' . $bank['province'] . $bank['city'] . $bank['branch'] . "|" . $names['name'];
$data['mid'] = $parameter['mid'];
$data['money'] = $parameter['money'] * 100;
$data['fee'] = $parameter['money'] * 100 * config('withdraw_rate');
$data['order_no'] = 'tx' . generate_rand_str(10, 3);
$data['create_time'] = time();
$data['create_ip'] = get_client_ip(1);
$data['create_ip'] = get_client_ip(0);
Db::startTrans();
//查看当前期权的信息
......@@ -89,7 +90,7 @@ class EsopPlan extends Model
'type' => 3,
'info' => "期权申请提现,金额:" . $parameter['money'],
'create_time' => time(),
'create_ip' => get_client_ip(1)
'create_ip' => get_client_ip(0)
];
$res2 = EsopPlanRecordModel::create($arr);
//更新期权信息
......
This diff is collapsed.
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