Commit ce05fe6f authored by twj's avatar twj

首页隐藏部分信息,提现审核和接口调整

parent 45f25511
...@@ -103,6 +103,8 @@ class Esop extends Common ...@@ -103,6 +103,8 @@ class Esop extends Common
$data['money'] = $this->request->param("money"); $data['money'] = $this->request->param("money");
//期权计划id //期权计划id
$data['esop_plan_id'] = $this->request->param("esop_plan_id"); $data['esop_plan_id'] = $this->request->param("esop_plan_id");
//密码
$data['paywd']=$this->request->param('paywd');
if (!$data['esop_plan_id']) { if (!$data['esop_plan_id']) {
ajaxmsg('请选择要提现的期权!', 0); ajaxmsg('请选择要提现的期权!', 0);
} }
...@@ -111,13 +113,18 @@ class Esop extends Common ...@@ -111,13 +113,18 @@ class Esop extends Common
if (true !== $result) { if (true !== $result) {
ajaxmsg($result, 0); ajaxmsg($result, 0);
} }
if ($data['money'] < 0) { if ($data['money'] <= 0) {
ajaxmsg('提现金额错误!', 0); ajaxmsg('提现金额错误!', 0);
} }
//判断是否是最低金额的整数倍
$minimum = config('withdraw_minimum');
if ($data['money'] % $minimum != 0) {
ajaxmsg('提现金额必须是最低金额的整数倍!', 0);
}
//校验当前期权计划余额 //校验当前期权计划余额
$money_res = EsopPlanModel::where(['id' => $data['esop_plan_id']])->find(); $money_res = EsopPlanModel::where(['id' => $data['esop_plan_id']])->find();
if (empty($money_res['account']) || ($money_res['account'] <= 0)) { if (empty($money_res['account']) || ($money_res['account'] <= 0)) {
ajaxmsg('查询账户资金出错!', 0); ajaxmsg('查询账户资金出错!'.$data['esop_plan_id'], 0);
} }
if (isset($money_res['account']) && $money_res['account'] < $data['money']) { if (isset($money_res['account']) && $money_res['account'] < $data['money']) {
ajaxmsg('提现金额已经大于可用余额!', 0); ajaxmsg('提现金额已经大于可用余额!', 0);
...@@ -143,4 +150,54 @@ class Esop extends Common ...@@ -143,4 +150,54 @@ class Esop extends Common
ajaxmsg('提现申请提交失败', 0); ajaxmsg('提现申请提交失败', 0);
} }
} }
/**
* 自动任务,根据设定的期权计划执行释放期权
*/
public function releaseEsop()
{
$where = [];
//正在执行的期权计划
$where['status'] = 1;
//开始释放期权日期不大于当前日期
$where['release_time'] = ['<=', date("Y-m-d")];
//待行权值大于0
$where['remain_account'] = ['>', 0];
//已释放天数小于总天数,已释放期权小于期权总值
$esop_plan_list = EsopPlanModel::where($where)->where("release_account<plan_account and days<duration")->select();
foreach ($esop_plan_list as $k => $v) {
//更加明细记录判断执行的当天是否已释放过
$esop_plan_record_today = EsopPlanRecordModel::where("FROM_UNIXTIME(create_time,'%Y-%m-%d')=curdate()")
->where(['type' => 1, 'esop_plan_id' => $v['id']])->find();
if (!$esop_plan_record_today) {
//计算释放期权金额
$affect = intval($v['plan_account'] / $v['duration']);
//如果是最后一天,取余数
if ($v['duration'] - $v['days'] == 1) {
$affect = $v['plan_account'] % $v['duration'];
}
//释放期权,更新期权表
$updateData = [
'account' => $v['account'] + $affect,
'days' => $v['days'] + 1,
'remain_account' => $v['plan_account'] - $affect,
'release_account' => $v['release_account'] + $affect
];
EsopPlanModel::where(['id' => $v['id']])->update($updateData);
//写入明细表
$arr = [
'mid' => $v['mid'],
'stock_id' => $v['stock_id'],
'esop_plan_id' => $v['id'],
'affect' => $affect,
'surplus' => $v['account'] + $affect,
'heatos' => 1,
'type' => 1,
'info' => "自动行权,期权增加" . ($affect / 100),
'create_time' => time(),
'create_ip' => get_client_ip(0)
];
EsopPlanRecordModel::create($arr);
}
}
}
} }
...@@ -64,8 +64,9 @@ class Withdraw extends Common ...@@ -64,8 +64,9 @@ class Withdraw extends Common
$rule = []; $rule = [];
$rule[0] = "1.单笔提现最低金额:" . $minimum; $rule[0] = "1.单笔提现最低金额:" . $minimum;
$rule[1] = "2.单笔提现最高金额:" . $maximum; $rule[1] = "2.单笔提现最高金额:" . $maximum;
$rule[2] = "3.提现手续费" . $rate . "%"; $rule[2] = "3.提现金额必须是最低金额的整数倍";
$rule[4] = "4.提现审核时间" . $withdraw_audit_time; $rule[3] = "4.提现手续费" . $rate . "%";
$rule[4] = "5.提现审核时间" . $withdraw_audit_time;
ajaxmsg('提现规则说明', 1, $rule); ajaxmsg('提现规则说明', 1, $rule);
} }
/* /*
......
...@@ -80,9 +80,12 @@ class Esopplan extends Admin ...@@ -80,9 +80,12 @@ class Esopplan extends Admin
// 保存数据 // 保存数据
if ($this->request->isPost()) { if ($this->request->isPost()) {
$data = $this->request->post(); $data = $this->request->post();
if ($data['duration'] < 1000) {
$this->error("最低释放天数为1000天");
}
$data['create_time'] = time(); $data['create_time'] = time();
$data['plan_account'] = $data['plan_account'] * 100; $data['plan_account'] = $data['plan_account'] * 100;
$data['remain_account'] = $data['plan_account'] * 100; $data['remain_account'] = $data['plan_account'];
$data['create_ip'] = get_client_ip(0); $data['create_ip'] = get_client_ip(0);
//业务逻辑处理 //业务逻辑处理
$result_up = Db::name("esop_plan")->insert($data); $result_up = Db::name("esop_plan")->insert($data);
...@@ -97,7 +100,7 @@ class Esopplan extends Admin ...@@ -97,7 +100,7 @@ class Esopplan extends Admin
->setPageTitle('新增') // 设置页面标题 ->setPageTitle('新增') // 设置页面标题
->addFormItems([ // 批量添加表单项 ->addFormItems([ // 批量添加表单项
['select:5', 'mid', '请选择用户', '', MemberModel::getMemberList(), '', url('get_mid'), 'mid'], ['select:5', 'mid', '请选择用户', '', MemberModel::getMemberList(), '', url('get_mid'), 'mid'],
['select:5', 'stock_id', '请选择股票', '', StockListModel::getStockList(), '', url('get_stock_id'), 'stock_id'], ['select:5', 'stock_id', '请选择股票', '', StockListModel::getEsopStockList(), '', url('get_stock_id'), 'stock_id'],
['number', 'plan_account', '期权总值', '期权总的价值(港元)', '0'], ['number', 'plan_account', '期权总值', '期权总的价值(港元)', '0'],
['number', 'duration', '总释放天数', '总释放天数', '1000'], ['number', 'duration', '总释放天数', '总释放天数', '1000'],
['datetime', 'release_time', '开始时间', '从哪天开始释放期权', '', 'YYYY-MM-DD HH:mm:ss'], ['datetime', 'release_time', '开始时间', '从哪天开始释放期权', '', 'YYYY-MM-DD HH:mm:ss'],
......
...@@ -68,54 +68,5 @@ class EsopplanRecord extends Admin ...@@ -68,54 +68,5 @@ class EsopplanRecord extends Admin
->fetch(); // 渲染模板 ->fetch(); // 渲染模板
} }
/**
* 自动任务,根据设定的期权计划执行释放期权
*/
public function releaseEsop()
{
$where = [];
//正在执行的期权计划
$where['status'] = 1;
//开始释放期权日期不大于当前日期
$where['release_time'] = ['<=', date("Y-m-d")];
//待行权值大于0
$where['remain_account'] = ['>', 0];
//已释放天数小于总天数,已释放期权小于期权总值
$esop_plan_list = EsopPlanModel::where($where)->where("release_account<plan_account and days<duration")->select();
foreach ($esop_plan_list as $k => $v) {
//更加明细记录判断执行的当天是否已释放过
$esop_plan_record_today = EsopPlanRecordModel::where("FROM_UNIXTIME(create_time,'%Y-%m-%d')=curdate()")
->where(['type' => 1, 'esop_plan_id' => $v['id']])->find();
if (!$esop_plan_record_today) {
//计算释放期权金额
$affect = intval($v['plan_account'] / $v['duration']);
//如果是最后一天,取余数
if ($v['duration'] - $v['days'] == 1) {
$affect = $v['plan_account'] % $v['duration'];
}
//释放期权,更新期权表
$updateData = [
'account' => $v['account'] + $affect,
'days' => $v['days'] + 1,
'remain_account' => $v['plan_account'] - $affect,
'release_account' => $v['release_account'] + $affect
];
EsopPlanModel::where(['id' => $v['id']])->update($updateData);
//写入明细表
$arr = [
'mid' => $v['mid'],
'stock_id' => $v['stock_id'],
'esop_plan_id' => $v['id'],
'affect' => $affect,
'surplus' => $v['account'] + $affect,
'heatos' => 1,
'type' => 1,
'info' => "自动行权,期权增加" . ($affect / 100),
'create_time' => time(),
'create_ip' => get_client_ip(0)
];
EsopPlanRecordModel::create($arr);
}
}
}
} }
...@@ -14,8 +14,9 @@ namespace app\money\admin; ...@@ -14,8 +14,9 @@ namespace app\money\admin;
use app\admin\controller\Admin; use app\admin\controller\Admin;
use app\common\builder\ZBuilder; use app\common\builder\ZBuilder;
use app\money\model\Withdraw as WithdrawModel; use app\money\model\Withdraw as WithdrawModel;
use app\money\model\EsopPlan as EsopPlanModel;
use think\Db; use think\Db;
use think\Hook; use think\Hook;
use think\Cache; use think\Cache;
/** /**
...@@ -37,39 +38,37 @@ class Withdraw extends Admin ...@@ -37,39 +38,37 @@ class Withdraw extends Admin
$noCheck = $this->request->get('noCheck'); $noCheck = $this->request->get('noCheck');
if(isset($noCheck)){ if (isset($noCheck)) {
$map['money_withdraw.status']= $noCheck; $map['money_withdraw.status'] = $noCheck;
} }
$order = $this->getOrder(); $order = $this->getOrder();
empty($order) && $order = 'id desc'; empty($order) && $order = 'id desc';
// 数据列表 // 数据列表
$data_list = WithdrawModel::getAll($map, $order); $data_list = WithdrawModel::getAll($map, $order);
// 分页数据 // 分页数据
$page = $data_list->render(); $page = $data_list->render();
if(empty($_SERVER["QUERY_STRING"])){ if (empty($_SERVER["QUERY_STRING"])) {
$excel_url=substr(http().$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"],0,- $excel_url = substr(http() . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"], 0, -5) . "_export";
5)."_export"; } else {
}else{ $excel_url = substr(http() . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"], 0, -5) . "_export?" . $_SERVER["QUERY_STRING"];
$excel_url=substr(http().$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"],0,-
5)."_export?".$_SERVER["QUERY_STRING"];
} }
$btn_excel = [ $btn_excel = [
'title' => '导出EXCEL表', 'title' => '导出EXCEL表',
'icon' => 'fa fa-fw fa-download', 'icon' => 'fa fa-fw fa-download',
'href' => url($excel_url,'','') 'href' => url($excel_url, '', '')
]; ];
return ZBuilder::make('table') return ZBuilder::make('table')
->setSearch(['order_no'=>'订单号', 'member.name' => '姓名', 'member.mobile' => '手机号']) // 设置搜索框 ->setSearch(['order_no' => '订单号', 'member.name' => '姓名', 'member.mobile' => '手机号']) // 设置搜索框
->addColumns([ // 批量添加数据列 ->addColumns([ // 批量添加数据列
['order_no', '订单号'], ['order_no', '订单号'],
['mobile', '手机号'], ['mobile', '手机号'],
['name', '姓名'], ['name', '姓名'],
['money', '申请金额'], ['money', '申请金额'],
['fee','手续费'], ['fee', '手续费'],
['real_money','到账金额'], ['real_money', '到账金额'],
['bank', '银行信息'], ['bank', '银行信息'],
['status', '状态'], ['status', '状态'],
['create_time', '申请时间', 'datetime'], ['create_time', '申请时间', 'datetime'],
...@@ -77,67 +76,74 @@ class Withdraw extends Admin ...@@ -77,67 +76,74 @@ class Withdraw extends Admin
]) ])
->hideCheckbox() ->hideCheckbox()
->addTopButton('custem',$btn_excel) ->addTopButton('custem', $btn_excel)
->addRightButton('edit',[],['area' => ['800px', '90%'], 'title' => '提现审核']) // 批量添加右侧按钮 ->addRightButton('edit', [], ['area' => ['800px', '90%'], 'title' => '提现审核']) // 批量添加右侧按钮
->replaceRightButton(['status' => '成功'], '<button class="btn btn-danger btn-xs" type="button" disabled>不可操作</button>') ->replaceRightButton(['status' => '成功'], '<button class="btn btn-danger btn-xs" type="button" disabled>不可操作</button>')
->addOrder('id,create_time,status,money,order_no') ->addOrder('id,create_time,status,money,order_no')
->setRowList($data_list) ->setRowList($data_list)
->fetch(); // 渲染模板 ->fetch(); // 渲染模板
} }
public function index_export(){ public function index_export()
{
$map = $this->getMap(); $map = $this->getMap();
$noCheck = $this->request->get('noCheck'); $noCheck = $this->request->get('noCheck');
if(isset($noCheck)){ if (isset($noCheck)) {
$map['money_withdraw.status']= $noCheck; $map['money_withdraw.status'] = $noCheck;
} }
$order = $this->getOrder(); $order = $this->getOrder();
empty($order) && $order = 'id desc'; empty($order) && $order = 'id desc';
// 数据列表 // 数据列表
$xlsData = WithdrawModel::getAll($map, $order); $xlsData = WithdrawModel::getAll($map, $order);
//$type_arr=['transfer'=>"线下转账","alipay"=>"支付宝"]; //$type_arr=['transfer'=>"线下转账","alipay"=>"支付宝"];
foreach ($xlsData as $k=>$v){ foreach ($xlsData as $k => $v) {
// $v['type']=$type_arr[$v['type']]; // $v['type']=$type_arr[$v['type']];
// $v['status']=$status_arr[$v['status']]; // $v['status']=$status_arr[$v['status']];
$xlsData[$k]['create_times']=date('Y-m-d H:i:s',$v["create_time"]); $xlsData[$k]['create_times'] = date('Y-m-d H:i:s', $v["create_time"]);
} }
$title="提现管理"; $title = "提现管理";
$arrHeader = array('订单号','手机号','姓名','金额','银行信息','状态','申请时间'); $arrHeader = array('订单号', '手机号', '姓名', '金额', '银行信息', '状态', '申请时间');
$fields = array('order_no','mobile','name','money','bank','status','create_times'); $fields = array('order_no', 'mobile', 'name', 'money', 'bank', 'status', 'create_times');
export($arrHeader,$fields,$xlsData,$title); export($arrHeader, $fields, $xlsData, $title);
} }
public function edit($id = null) public function edit($id = null)
{ {
if ($id === null) $this->error('缺少参数', null , '_close_pop'); if ($id === null) $this->error('缺少参数', null, '_close_pop');
// 保存数据 // 保存数据
if ($this->request->isPost()) { if ($this->request->isPost()) {
$data = $this->request->post(); $data = $this->request->post();
$result = $this->validate($data, 'Withdraw.update'); $result = $this->validate($data, 'Withdraw.update');
// 验证失败 输出错误信息 // 验证失败 输出错误信息
if(true !== $result) $this->error($result); if (true !== $result) $this->error($result);
$result_up = WithdrawModel::saveAudit(); $money_withdraw = WithdrawModel::where(['id' => $data['id']])->find();
if(true !== $result_up){ if (strpos($money_withdraw['order_no'], 'estx')) {
$this->error($result_up); //余额提现审核
}else { $result_up = WithdrawModel::saveAudit();
} else {
//期权提现审核
$result_up = EsopPlanModel::saveAudit();
}
if (true !== $result_up) {
$this->error($result_up);
} else {
$this->success('审核处理成功', null, '_parent_reload'); $this->success('审核处理成功', null, '_parent_reload');
} }
} }
$info = WithdrawModel::where('id', $id)->find(); $info = WithdrawModel::where('id', $id)->find();
// dump($info);exit; // dump($info);exit;
$ishides =''; $ishides = '';
$info->money = money_convert($info->money); $info->money = money_convert($info->money);
if($info->getData('status')==0){ if ($info->getData('status') == 0) {
$status_arr = [1=>'成功', 2=>'失败']; $status_arr = [1 => '成功', 2 => '失败'];
}elseif($info->getData('status')==1){ } elseif ($info->getData('status') == 1) {
$status_arr = [3=>'退回']; $status_arr = [3 => '退回'];
}else{ } else {
$status_arr = [2=>'失败']; $status_arr = [2 => '失败'];
} }
if($info->getData('status')==2) { if ($info->getData('status') == 2) {
return ZBuilder::make('form') return ZBuilder::make('form')
->setPageTitle('提现审核')// 设置页面标题 ->setPageTitle('提现审核') // 设置页面标题
->addFormItems([ // 批量添加表单项 ->addFormItems([ // 批量添加表单项
['hidden', 'id'], ['hidden', 'id'],
['static', 'order_no', '订单号'], ['static', 'order_no', '订单号'],
...@@ -147,11 +153,11 @@ class Withdraw extends Admin ...@@ -147,11 +153,11 @@ class Withdraw extends Admin
['textarea', 'remark', '备注', ''] ['textarea', 'remark', '备注', '']
]) ])
->hideBtn('submit') ->hideBtn('submit')
->setFormData($info)// 设置表单数据 ->setFormData($info) // 设置表单数据
->fetch(); ->fetch();
}else{ } else {
return ZBuilder::make('form') return ZBuilder::make('form')
->setPageTitle('提现审核')// 设置页面标题 ->setPageTitle('提现审核') // 设置页面标题
->addFormItems([ // 批量添加表单项 ->addFormItems([ // 批量添加表单项
['hidden', 'id'], ['hidden', 'id'],
['static', 'order_no', '订单号'], ['static', 'order_no', '订单号'],
...@@ -160,10 +166,8 @@ class Withdraw extends Admin ...@@ -160,10 +166,8 @@ class Withdraw extends Admin
['radio', 'status', '状态', '', $status_arr], ['radio', 'status', '状态', '', $status_arr],
['textarea', 'remark', '备注', ''] ['textarea', 'remark', '备注', '']
]) ])
->setFormData($info)// 设置表单数据 ->setFormData($info) // 设置表单数据
->fetch(); ->fetch();
} }
} }
}
}
\ No newline at end of file
...@@ -7,6 +7,7 @@ use app\money\model\Role as RoleModel; ...@@ -7,6 +7,7 @@ use app\money\model\Role as RoleModel;
use app\money\model\EsopPlanRecord as EsopPlanRecordModel; use app\money\model\EsopPlanRecord as EsopPlanRecordModel;
use app\money\model\Withdraw as MoneyWithdrawModel; use app\money\model\Withdraw as MoneyWithdrawModel;
use app\member\model\Bank as BankModel; use app\member\model\Bank as BankModel;
use app\money\model\Record;
use app\member\model\MemberMessage as MemberMessageModel; use app\member\model\MemberMessage as MemberMessageModel;
use think\model; use think\model;
use think\Db; use think\Db;
...@@ -42,7 +43,7 @@ class EsopPlan extends Model ...@@ -42,7 +43,7 @@ class EsopPlan extends Model
*/ */
public static function getEsopPlanList($where = [], $order = 'id asc', $offset, $pagesize = 15) public static function getEsopPlanList($where = [], $order = 'id asc', $offset, $pagesize = 15)
{ {
$esop_plan_list = self::view('esop_plan ep', 'id,mid,account,plan_account,release_account,remain_account,release_time') $esop_plan_list = self::view('esop_plan ep', 'id,mid,account,plan_account,release_account,remain_account,release_time,duration,days')
->view("stock_list sl", 'title,code', 'sl.id=ep.stock_id', 'left') ->view("stock_list sl", 'title,code', 'sl.id=ep.stock_id', 'left')
->field(["CONCAT(ROUND(release_account / plan_account * 100, 2), ' % ')" => 'accuracy']) ->field(["CONCAT(ROUND(release_account / plan_account * 100, 2), ' % ')" => 'accuracy'])
->field(["FROM_UNIXTIME(ep.create_time,'%Y-%m-%d %T')" => 'create_time']) ->field(["FROM_UNIXTIME(ep.create_time,'%Y-%m-%d %T')" => 'create_time'])
...@@ -53,7 +54,7 @@ class EsopPlan extends Model ...@@ -53,7 +54,7 @@ class EsopPlan extends Model
return $esop_plan_list; return $esop_plan_list;
} }
/** /**
* 期权提现 * 期权提现申请
*/ */
public static function esopWithdraw($parameter) public static function esopWithdraw($parameter)
{ {
...@@ -66,14 +67,14 @@ class EsopPlan extends Model ...@@ -66,14 +67,14 @@ class EsopPlan extends Model
$data['bank'] = $bank['bank'] . "|" . $bank['card'] . '|' . $bank['province'] . $bank['city'] . $bank['branch'] . "|" . $names['name']; $data['bank'] = $bank['bank'] . "|" . $bank['card'] . '|' . $bank['province'] . $bank['city'] . $bank['branch'] . "|" . $names['name'];
$data['mid'] = $parameter['mid']; $data['mid'] = $parameter['mid'];
$data['money'] = $parameter['money'] * 100; $data['money'] = $parameter['money'] * 100;
$data['fee'] = $parameter['money'] * 100 * config('withdraw_rate'); $data['fee'] = $parameter['money'] * config('withdraw_rate');
$data['order_no'] = 'tx' . generate_rand_str(10, 3); $data['order_no'] = 'estx' . generate_rand_str(10, 3);
$data['create_time'] = time(); $data['create_time'] = time();
$data['create_ip'] = get_client_ip(0); $data['create_ip'] = get_client_ip(0);
Db::startTrans(); Db::startTrans();
//查看当前期权的信息 //查看当前期权的信息
$money_info = self::where(['id' => $data['esop_plan_id']])->find(); $money_info = self::where(['id' => $parameter['esop_plan_id']])->find();
//计算余额 //计算余额
$account = bcsub($money_info['account'], $data['money']); $account = bcsub($money_info['account'], $data['money']);
...@@ -82,8 +83,9 @@ class EsopPlan extends Model ...@@ -82,8 +83,9 @@ class EsopPlan extends Model
//写入期权变化明细表 //写入期权变化明细表
$arr = [ $arr = [
'mid' => $parameter['mid'], 'mid' => $parameter['mid'],
'stock_id' => $parameter['stock_id'], 'stock_id' => $money_info['stock_id'],
'esop_plan_id' => $parameter['esop_plan_id'], 'esop_plan_id' => $parameter['esop_plan_id'],
'stock_trust_id' => 0,
'affect' => $parameter['money'], 'affect' => $parameter['money'],
'surplus' => $account, 'surplus' => $account,
'heatos' => -1, 'heatos' => -1,
...@@ -94,7 +96,7 @@ class EsopPlan extends Model ...@@ -94,7 +96,7 @@ class EsopPlan extends Model
]; ];
$res2 = EsopPlanRecordModel::create($arr); $res2 = EsopPlanRecordModel::create($arr);
//更新期权信息 //更新期权信息
$res3 = self::where('id', $parameter['esop_plan_id'])->update('account', $account); $res3 = self::where('id', $parameter['esop_plan_id'])->update(['account' => $account]);
if ($res1 && $res2 && $res3) { if ($res1 && $res2 && $res3) {
Db::commit(); Db::commit();
return ['status' => 1, 'message' => '提交成功']; return ['status' => 1, 'message' => '提交成功'];
...@@ -107,4 +109,110 @@ class EsopPlan extends Model ...@@ -107,4 +109,110 @@ class EsopPlan extends Model
return ['status' => 0, 'message' => '数据异常']; return ['status' => 0, 'message' => '数据异常'];
} }
} }
/**
* 提现审核信息保存
* @return [type] [description]
*/
public static function saveAudit()
{
$res1 = $res2 = $res3 = true;
$status = input('post.status');
$id = input('post.id');
$remark = input('post.remark');
if (!$id) {
return false;
}
$withdraw = Db('money_withdraw')->where('id', $id)->find();
$user_mobile = Db('member')->where('id', $withdraw['mid'])->value('mobile');
$up_withdraw['status'] = $status;
$up_withdraw['id'] = $id;
Db::startTrans();
try {
$record = new record;
$money_info = Db('esop_plan')->where('id', $withdraw['esop_plan_id'])->lock(true)->find();
if ($status == 1) { // 提现通过 减去冻结金额
MoneyWithdrawModel::sms_withdraw('stock_withdraw_auditing_success', $user_mobile, $withdraw['money']);
$contents = "提现审核通过";
$info = "提现单号:" . $withdraw['order_no'];
$affect = $withdraw['money'];
$type = 3;
$account = $withdraw['money'] / 100;
$res1 = true;
} elseif ($status == 2) { // 提现失败 解冻冻结金额
MoneyWithdrawModel::sms_withdraw('stock_withdraw_auditing_fail', $user_mobile, $withdraw['money']);
$contents = "提现审核未通过";
$up_money['account'] = bcadd($money_info['account'], $withdraw['money']);
$info = "退回金额" . ($withdraw['money'] / 100) . "元,提现单号:" . $withdraw['order_no'];
$affect = $withdraw['money'];
$type = 4;
$account = $up_money['account'];
//更新期权表
$res1 = self::where(['id' => $withdraw['esop_plan_id']])->update(['account' => $account]);
//写入期权变化明细表
$arr = [
'mid' => $withdraw['mid'],
'stock_id' => $money_info['stock_id'],
'esop_plan_id' => $withdraw['esop_plan_id'],
'stock_trust_id' => 0,
'affect' => $withdraw['money'],
'surplus' => $account,
'heatos' => -1,
'type' => 3,
'info' => "提现驳回,退回期权金额:" . ($withdraw['money'] / 100),
'create_time' => time(),
'create_ip' => get_client_ip(0)
];
EsopPlanRecordModel::create($arr);
} elseif ($status == 3) { // 提现退回 补充可用金额
$up_money['account'] = bcadd($money_info['account'], $withdraw['money']);
$info = "退回金额" . ($withdraw['money'] / 100) . "元,提现单号:" . $withdraw['order_no'];
$affect = $withdraw['money'];
$type = 6;
$account = $up_money['account'];
//更新期权表
$res1 = self::where(['id' => $withdraw['esop_plan_id']])->update(['account' => $account]);
//写入期权变化明细表
$arr = [
'mid' => $withdraw['mid'],
'stock_id' => $money_info['stock_id'],
'esop_plan_id' => $withdraw['esop_plan_id'],
'stock_trust_id' => 0,
'affect' => $withdraw['money'],
'surplus' => $account,
'heatos' => -1,
'type' => 3,
'info' => "提现驳回,退回期权金额:" . ($withdraw['money'] / 100),
'create_time' => time(),
'create_ip' => get_client_ip(0)
];
EsopPlanRecordModel::create($arr);
} else {
return '状态有误';
}
//审核记录
$res3 = $record->saveData($withdraw['mid'], $affect, $account, $type, $info);
//更新提现记录
$res2 = MoneyWithdrawModel::update($up_withdraw);
if ($res1 && $res2 && $res3) {
Db::commit();
//添加站内信信息
$MemberMessageModel = new MemberMessageModel();
$MemberMessageModel->addInnerMsg($withdraw['mid'], '提现审核通知', $contents); //站内信
} else {
Db::rollback();
return '数据更新失败';
}
} catch (\Exception $e) {
Db::rollback();
return $e->getMessage();
}
$mobile = Db('member')->where('id', $withdraw['mid'])->value('mobile');
$details = $mobile . ' 字段(status),原值:(0)新值:(' . $status . ') 备注:' . $remark . $info;
action_log('withdraw_edit', 'money_withdraw', $id, UID, $details);
return true;
}
} }
...@@ -38,7 +38,7 @@ class Withdraw extends Model ...@@ -38,7 +38,7 @@ class Withdraw extends Model
public static function getAll($map = [], $order = '') public static function getAll($map = [], $order = '')
{ {
$data_list = self::view('money_withdraw', 'id,mid,order_no,money,fee,(money-fee) as real_money,status,create_time') $data_list = self::view('money_withdraw', true)->field("(money_withdraw.money-money_withdraw.fee) as real_money")
->view('member', 'mobile, name, id_card', 'member.id=money_withdraw.mid', 'left') ->view('member', 'mobile, name, id_card', 'member.id=money_withdraw.mid', 'left')
->where($map) ->where($map)
->order($order) ->order($order)
...@@ -46,6 +46,7 @@ class Withdraw extends Model ...@@ -46,6 +46,7 @@ class Withdraw extends Model
->each(function ($item, $key) { ->each(function ($item, $key) {
$item->money = money_convert($item->money); $item->money = money_convert($item->money);
$item->fee = money_convert($item->fee); $item->fee = money_convert($item->fee);
$item->real_money = money_convert($item->real_money);
}); });
return $data_list; return $data_list;
} }
......
...@@ -39,4 +39,27 @@ class StockList extends Model ...@@ -39,4 +39,27 @@ class StockList extends Model
} }
return $list; return $list;
} }
/**
* 获取期权列表(下拉选择时使用)
* @param
* @author 路人甲乙
* @return mixed
*/
public static function getEsopStockList()
{
$list = [];
$where['status'] = 1;
$where['id'] = ['in', [6263, 6264]];
$data_list = Db::name('stock_list')->where($where)->column(true, 'id');
if (!is_null($data_list)) {
foreach ($data_list as $v) {
$list[$v['id']] = $v['title'];
}
} else {
$list = [];
}
return $list;
}
} }
<div class="col-md-{$width|default=6}"> <div class="col-md-{$width|default=6}">
<div class="block block-bordered"> <!-- <div class="block block-bordered">
<div class="block-header bg-gray-lighter"> <div class="block-header bg-gray-lighter">
<h3 class="block-title">系统信息</h3> <h3 class="block-title">系统信息</h3>
</div> </div>
...@@ -34,5 +34,5 @@ ...@@ -34,5 +34,5 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div> -->
</div> </div>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="block-content"> <div class="block-content">
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <!-- <tr>
<td>免息体验待审核</td> <td>免息体验待审核</td>
<td><a href="__ROOT__/admin.php/stock/borrow/index?type=5">{$experience_apply}</a></td> <td><a href="__ROOT__/admin.php/stock/borrow/index?type=5">{$experience_apply}</a></td>
...@@ -35,20 +35,20 @@ ...@@ -35,20 +35,20 @@
<td>充值待审核</td> <td>充值待审核</td>
<td><a href="__ROOT__/admin.php/money/recharge/index.html">{$transfer_nodo}</a></td> <td><a href="__ROOT__/admin.php/money/recharge/index.html">{$transfer_nodo}</a></td>
</tr> </tr> -->
<tr> <tr>
<td>终止操盘待审核</td> <td>实名认证待审核</td>
<td><a href="__ROOT__/admin.php/stock/borrow/stop.html">{$advance_termination_apply_count}</a></td> <td><a href="__ROOT__/admin.php/member/identity/index.html">{$idAuth_noDo}</a></td>
<td>提现待审核</td> <td>提现待审核</td>
<td><a href="__ROOT__/admin.php/money/withdraw/index?noCheck=0">{$withdraw_noDo}</a></td> <td><a href="__ROOT__/admin.php/money/withdraw/index?noCheck=0">{$withdraw_noDo}</a></td>
</tr> </tr>
<tr> <!-- <tr>
<td>到期配资待结算</td> <td>到期配资待结算</td>
<td><a href="__ROOT__/admin.php/stock/borrow/endlist.html">{$expire_stock_count} </a></td> <td><a href="__ROOT__/admin.php/stock/borrow/endlist.html">{$expire_stock_count} </a></td>
<td>实名认证待审核</td> <td>终止操盘待审核</td>
<td><a href="__ROOT__/admin.php/member/identity/index.html">{$idAuth_noDo}</a></td> <td><a href="__ROOT__/admin.php/stock/borrow/stop.html">{$advance_termination_apply_count}</a></td>
</tr> </tr> -->
</tbody> </tbody>
</table> </table>
</div> </div>
......
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