| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295 |
- <?php
- namespace App\Http\Controllers\Admin;
- use App\Http\Controllers\Controller;
- use App\Models\Withdraw_rule;
- use Illuminate\Support\Facades\DB;
- use Request;
- /**
- *
- */
- class MoneyController extends Controller
- {
- /**
- * @return 账务管理
- */
- function index()
- {
- return view('admin.MoneyManage/Index');
- }
- //用户存取反水列表
- function moneyList()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $order_id = Request::has('order_id') ? Request::get('order_id') : '';
- $trade_type = Request::has('trade_type') ? Request::get('trade_type') : '';
- $star_time = Request::get('star_time') ? Request::get('star_time') . ' 00:00:00' : '';
- $end_time = Request::get('end_time') ? Request::get('end_time') . ' 23:59:59' : '';
- $money_small = Request::has('money_small') ? Request::get('money_small') : '';
- $money_big = Request::has('money_big') ? Request::get('money_big') : '';
- $sureblur = Request::has('sureblur') ? Request::get('sureblur') : '';
- $status = Request::has('status') ? Request::get('status') : '';
- $where = array();
- if (is_numeric($status)) {
- $where[] = array('money_details.status', '=', $status);
- }
- if (!empty($trade_type)) {
- $where[] = array('trade_type', '=', $trade_type);
- }
- if (!empty($star_time)) {
- $star_time = date('Y-m-d H:i:s', strtotime($star_time));
- $where[] = array('money_time', '>=', $star_time);
- }
- if (!empty($end_time)) {
- $end_time = date('Y-m-d H:i:s', strtotime($end_time));
- $where[] = array('money_time', '<=', $end_time);
- }
- if (!empty($money_small)) {
- $where[] = array('money', '>=', $money_small);
- }
- if (!empty($money_big)) {
- $where[] = array('money', '<=', $money_big);
- }
- if (!empty($account_name)) {
- if (empty($sureblur) || $sureblur == '模糊') {
- $where[] = array('account_name', 'like', '%' . $account_name . '%');
- } else {
- $where[] = array('money_details.account_name', '=', $account_name);
- }
- }
- if (!empty($order_id)) {
- $where = array(array('trade_id', '=', $order_id));
- }
- $moneydetails = new \App\Models\Money_details;
- $data = $moneydetails->getPartlist($where, 1, $limit, $field, $order);
- if ($data < 0) {
- return responseToJson($data);
- }
- $data['data'] = arrayToNumber($data['data'], ['money']);
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
- }
- //用户账务日志
- function fundLog()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $loss_name = Request::has('loss_name') ? Request::get('loss_name') : '';
- $agent_name = Request::has('agent_name') ? Request::get('agent_name') : '';
- $startime = Request::get('startime') ? Request::get('startime') . ' 00:00:00' : '';
- $endtime = Request::get('endtime') ? Request::get('endtime') . ' 23:59:59' : '';
- if (empty($account_name) && !empty($agent_name)) {
- $db = new \App\Models\NagentChild;
- $account_name = $db->getChildStr($agent_name);
- }
- /*$whereIn = array();
- $whereNotin = array();
- $where = array();
- if (!empty($account_name)) {
- $whereIn[] = array('account_name', explode(',', $account_name));
- }
- if (!empty($loss_name)) {
- $whereNotin[] = array('account_name', explode(',', $loss_name));
- }
- if (!empty($startime)) {
- $startime = date('Y-m-d H:i:s', strtotime($startime));
- $where[] = array('money_time', '>=', $startime);
- }
- if (!empty($endtime)) {
- $endtime = date('Y-m-d H:i:s', strtotime($endtime));
- $where[] = array('money_time', '<=', $endtime);
- }*/
- $where = '';
- if (!empty($account_name)) {
- $account_name = explode(',', $account_name);
- $account_name = implode("','", $account_name);
- $where .= " where account_name in ('" . $account_name . "') ";
- }
- if (!empty($loss_name)) {
- $loss_name = explode(',', $loss_name);
- $loss_name = implode("','", $loss_name);
- $where .= empty($where) ? ' where ' : ' and ';
- $where .= "account_name not in ('" . $loss_name . "')";
- }
- if (!empty($startime)) {
- $startime = date('Y-m-d H:i:s', strtotime($startime));
- $where .= empty($where) ? ' where ' : ' and ';
- $where .= "money_time>='" . $startime . "'";
- }
- if (!empty($endtime)) {
- $endtime = date('Y-m-d H:i:s', strtotime($endtime));
- $where .= empty($where) ? ' where ' : ' and ';
- $where .= "money_time<='" . $endtime . "'";
- }
- $moneydetails = new \App\Models\Money_details();
- $data = $moneydetails->getFundlog($where, 1, $limit, $field, $order, $page);
- if ($data < 0) {
- return responseToJson($data);
- }
- $data['data'] = arrayToNumber($data['data'], ['sendmoney', 'savemoney', 'getmoney', 'winmoney', 'adminadd', 'adminpull', 'recharge_send', 'back_return']);
- /*$uwhere = array();
- $uwhere = $where;
- $countmoney = $moneydetails->getPatlog($where, 4);
- foreach ($data['data'] as $k => $v) {
- $data['data'][$k]['sendmoney'] = 0;
- $data['data'][$k]['savemoney'] = 0;
- $data['data'][$k]['getmoney'] = 0;
- $data['data'][$k]['winmoney'] = 0;
- $data['data'][$k]['adminadd'] = 0;
- $data['data'][$k]['adminpull'] = 0;
- $data['data'][$k]['recharge_send'] = 0;
- $data['data'][$k]['back_return'] = 0;
- $data['data'][$k]['countmoney'] = $countmoney;
- if (is_array($countmoney) && count($countmoney) > 0) {
- foreach ($countmoney as $sk => $sv) {
- if ($v['account_name'] == $sv['account_name']) {
- $data['data'][$k]['sendmoney'] = ($sv['trade_type'] == 14) ? ($data['data'][$k]['sendmoney'] + $sv['summoney']) : $data['data'][$k]['sendmoney'];
- $data['data'][$k]['savemoney'] = ($sv['trade_type'] == 6 || $sv['trade_type'] == 11 || $sv['trade_type'] == 14) ? ($data['data'][$k]['savemoney'] + $sv['summoney']) : $data['data'][$k]['savemoney'];
- $data['data'][$k]['getmoney'] = ($sv['trade_type'] == 5 || $sv['trade_type'] == 9) ? ($data['data'][$k]['getmoney'] + $sv['summoney']) : $data['data'][$k]['getmoney'];
- $data['data'][$k]['adminadd'] = ($sv['trade_type'] == 12 && $sv['money_type'] == 1) ? ($data['data'][$k]['adminadd'] + $sv['summoney']) : $data['data'][$k]['adminadd'];
- $data['data'][$k]['adminpull'] = ($sv['trade_type'] == 12 && $sv['money_type'] == 2) ? ($data['data'][$k]['adminpull'] + $sv['summoney']) : $data['data'][$k]['adminpull'];
- $data['data'][$k]['recharge_send'] = ($sv['trade_type'] == 13) ? ($data['data'][$k]['recharge_send'] + $sv['summoney']) : $data['data'][$k]['recharge_send'];
- $data['data'][$k]['back_return'] = ($sv['trade_type'] == 7 || $sv['trade_type'] == 8) ? ($data['data'][$k]['back_return'] + $sv['summoney']) : $data['data'][$k]['back_return'];
- }
- }
- }
- $data['data'][$k]['winmoney'] = $data['data'][$k]['sendmoney'] + $data['data'][$k]['savemoney'] - $data['data'][$k]['getmoney'];
- }
- $data['data'] = arrayToNumber($data['data'], ['sendmoney', 'savemoney', 'getmoney', 'winmoney', 'adminadd', 'adminpull', 'recharge_send', 'back_return']);*/
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
- }
- //用户资金流水列表
- function moneyWaterList()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $field = $field == 'change_cash' ? 'money_details.money' : $field;
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $order_id = Request::has('order_id') ? Request::get('order_id') : '';
- $trade_type = Request::has('trade_type') ? Request::get('trade_type') : '';
- $star_time = Request::get('star_time') ? Request::get('star_time') . ' 00:00:00' : '';
- $end_time = Request::get('end_time') ? Request::get('end_time') . ' 23:59:59' : '';
- $money_small = Request::has('money_small') ? Request::get('money_small') : '';
- $money_big = Request::has('money_big') ? Request::get('money_big') : '';
- $sureblur = Request::has('sureblur') ? Request::get('sureblur') : '';
- $status = Request::has('status') ? Request::get('status') : '';
- $isuser = Request::has('isuser') ? Request::get('isuser') : 2;
- if ($isuser == 1) {
- $star_time = '';
- $end_time = '';
- }
- $where = array();
- if (!empty($account_name)) {
- if (empty($sureblur) || $sureblur == '模糊') {
- $where[] = array('money_details.account_name', 'like', '%' . $account_name . '%');
- } else {
- $where[] = array('money_details.account_name', '=', $account_name);
- }
- }
- if (!empty($trade_type)) {
- $where[] = array('trade_type', '=', $trade_type);
- }
- if (!empty($status)) {
- $where[] = array('money_details.status', '=', $status);
- }
- if (!empty($star_time)) {
- $star_time = date('Y-m-d H:i:s', strtotime($star_time));
- $where[] = array('money_time', '>=', $star_time);
- }
- if (!empty($end_time)) {
- $end_time = date('Y-m-d H:i:s', strtotime($end_time));
- $where[] = array('money_time', '<=', $end_time);
- }
- if (!empty($money_small)) {
- $where[] = array('money_details.money', '>=', $money_small);
- }
- if (!empty($money_big)) {
- $where[] = array('money_details.money', '<=', $money_big);
- }
- if (!empty($order_id)) {
- $where = array(array('trade_id', '=', $order_id));
- }
- if (count($where) == 0) {
- return \App\Lib\DataTable\DataTable::init()->toJson(array(), 0, 0, $where);
- }
- $moneydetails = new \App\Models\Money_details();
- $data = $moneydetails->getMoneylist($where, 1, $limit, $field, $order);
- if ($data < 0) {
- return responseToJson($data);
- }
- $usercash = array();
- $data['data'] = arrayToNumber($data['data'], ['money']);
- foreach ($data['data'] as $k => $v) {
- /*if(isset($usercash[$v['account_name']])){
- if($v['money_type'] == 1){
- $ccash = $usercash[$v['account_name']] + $v['money'];
- }else{
- $ccash = $usercash[$v['account_name']] - $v['money'];
- }
- //$usercash[$v['account_name']] = $ccash;
- if($v['money_cash'] != $ccash){
- $data['data'][$k]['money_cash'] = $ccash;
- }
- }else{
- $usercash[$v['account_name']] = $v['money_cash'];
- }*/
- if ($v['trade_type'] == 9 && strpos($v['trade_desc'], '撤销') !== false) {
- if (strpos($v['trade_desc'], '重新开奖') !== false) {
- $data['data'][$k]['isdel'] = 2;
- } else {
- $data['data'][$k]['isdel'] = 1;
- }
- } else {
- $data['data'][$k]['isdel'] = 2;
- }
- $data['data'][$k]['money_time'] = date('Y-m-d H:i:s', strtotime($v['money_time']));
- }
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
- }
- //交易订单详情
- function moneyDetails()
- {
- $tradeid = Request::has('tradeid') ? Request::get('tradeid') : '';
- if (empty($tradeid)) {
- return responseToJson(-3021000202); //未提交对应订单号
- }
- $moneydetails = new \App\Models\Money_details();
- $data = $moneydetails->getOrderDetails($tradeid, 3, 'account_bank', 'account_identity', 'account_identity');
- return responseToJson($data);
- }
- //充值记录
- function recharge()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $order_id = Request::has('order_id') ? Request::get('order_id') : '';
- $recharge_type = Request::has('recharge_type') ? Request::get('recharge_type') : '';
- $status = Request::has('status') ? Request::get('status') : '';
- $apply_startime = Request::get('apply_startime') ? Request::get('apply_startime') . ' 00:00:00' : '';
- $apply_endtime = Request::get('apply_endtime') ? Request::get('apply_endtime') . ' 23:59:59' : '';
- $haddle_startime = Request::get('haddle_startime') ? Request::get('haddle_startime') . ' 00:00:00' : '';
- $haddle_endtime = Request::get('haddle_endtime') ? Request::get('haddle_endtime') . ' 23:59:59' : '';
- $money_small = Request::has('money_small') ? Request::get('money_small') : '';
- $money_big = Request::has('money_big') ? Request::get('money_big') : '';
- $sureblur = Request::has('sureblur') ? Request::get('sureblur') : '';
- if($status==-1)$status='';
- $where = array();
- $whereIn = array();
- $sql = '';
- if (!empty($recharge_type) && empty($status)) {
- $where[] = array('recharge_type', '=', $recharge_type);
- }
- if (!empty($recharge_type)) {
- $where[] = array('recharge_type', '=', $recharge_type);
- }
- if ($status || $status === '0') $where[] = array('status', '=', $status);
- if (!empty($apply_startime)) {
- $apply_startime = date('Y-m-d H:i:s', strtotime($apply_startime));
- $where[] = array('apply_time', '>=', $apply_startime);
- }
- if (!empty($apply_endtime)) {
- $apply_endtime = date('Y-m-d H:i:s', strtotime($apply_endtime));
- $where[] = array('apply_time', '<=', $apply_endtime);
- }
- if (!empty($haddle_startime)) {
- $haddle_startime = date('Y-m-d H:i:s', strtotime($haddle_startime));
- $where[] = array('complete_time', '>=', $haddle_startime);
- }
- if (!empty($haddle_endtime)) {
- $haddle_endtime = date('Y-m-d H:i:s', strtotime($haddle_endtime));
- $where[] = array('complete_time', '<=', $haddle_endtime);
- }
- if (!empty($money_small)) {
- $where[] = array('money', '>=', $money_small);
- }
- if (!empty($money_big)) {
- $where[] = array('money', '<=', $money_big);
- }
- if (!empty($account_name)) {
- if (empty($sureblur) || $sureblur == '模糊') {
- $where[] = array('account_name', 'like', '%' . $account_name . '%');
- } else {
- $where[] = array('account_name', '=', $account_name);
- }
- }
- if (!empty($order_id)) {
- $where = array(array('order_id', '=', $order_id));
- }
- $moneydetails = new \App\Models\Money_recharge();
- if ($status || (int)$status < -1) {
- $sql = "status={$status}";
- }
- $data = $moneydetails->getRechargelist($where, 1, $limit, $field, $order, '', '', '', $whereIn, $sql);
- if ($data < 0) {
- return $data;
- }
- $data['data'] = arrayToNumber($data['data'], ['money', 'money_cash']);
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
- }
- //待审核充值记录量获取
- function getRechargeNum()
- {
- $recharge = new \App\Models\Money_recharge();
- $status = Request::has('status') ? Request::get('status') : 1;
- $data = $recharge->getCount($status);
- return responseToJson(1, '', $data);
- }
- //充值订单详情
- function rechargeDetails()
- {
- $orderid = Request::has('orderid') ? Request::get('orderid') : '';
- if (empty($orderid)) {
- return responseToJson(-3020000202); //未提交对应订单号
- }
- $rechargedetails = new \App\Models\Money_recharge();
- $data = $rechargedetails->getOrderDetails($orderid, 3, 'account_bank', 'account_identity', 'account_identity');
- return responseToJson($data);
- }
- //提现记录
- function withdraw()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 'id';
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $grade = Request::has('grade') ? Request::get('grade') : '-1';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $order_id = Request::has('order_id') ? Request::get('order_id') : '';
- $bank_user = Request::has('bank_user') ? Request::get('bank_user') : '';
- $money_small = Request::has('money_small') ? Request::get('money_small') : '';
- $money_big = Request::has('money_big') ? Request::get('money_big') : '';
- $apply_startime = Request::get('apply_startime') ? Request::get('apply_startime') . ' 00:00:00' : '';
- $apply_endtime = Request::get('apply_endtime') ? Request::get('apply_endtime') . ' 23:59:59' : '';
- $haddle_startime = Request::get('haddle_startime') ? Request::get('haddle_startime') . ' 00:00:00' : '';
- $haddle_endtime = Request::get('haddle_endtime') ? Request::get('haddle_endtime') . ' 23:59:59' : '';
- $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'on';
- $status = Request::has('status') ? Request::get('status') : '';
- $where = array();
- if ($grade < 0) {
- // $where .= ' AND grade=';
- $grade = '';
- } else {
- $grade = ($grade == 10) ? '' : $grade;
- $where[] = array('grade', '=', $grade);
- }
- if (!empty($bank_user)) {
- $where[] = array('bank_user', 'like', '%' . $bank_user . '%');
- }
- if (!empty($money_small)) {
- $where[] = array('money', '>=', $money_small);
- }
- if (!empty($money_big)) {
- $where[] = array('money', '<=', $money_big);
- }
- if (!empty($apply_startime)) {
- $apply_startime = date('Y-m-d H:i:s', strtotime($apply_startime));
- $where[] = array('apply_time', '>=', $apply_startime);
- }
- if (!empty($apply_endtime)) {
- $apply_endtime = date('Y-m-d H:i:s', strtotime($apply_endtime));
- $where[] = array('apply_time', '<=', $apply_endtime);
- }
- if (!empty($haddle_startime)) {
- $haddle_startime = date('Y-m-d H:i:s', strtotime($haddle_startime));
- $where[] = array('pass_time', '>=', $haddle_startime);
- }
- if (!empty($haddle_endtime)) {
- $haddle_endtime = date('Y-m-d H:i:s', strtotime($haddle_endtime));
- $where[] = array('pass_time', '<=', $haddle_endtime);
- }
- if (!empty($status) && $status != 4) {
- if ($status == 3) {
- $where[] = array('status', '=', '0');
- } else {
- $where[] = array('status', '=', $status);
- }
- }
- if (!empty($account_name)) {
- if (empty($sureblur) || $sureblur == 'off') {
- $where = array(array('account_name', 'like', '%' . $account_name . '%'));
- } else {
- $where = array(array('account_name', '=', $account_name));
- }
- }
- if (!empty($order_id)) {
- $where = array(array('order_id', '=', $order_id));
- }
- $takedetails = new \App\Models\Money_take();
- $jointable = '';
- if (is_numeric($grade)) {
- $jointable = 'account_detailed';
- }
- $data = $takedetails->getTakelist($where, 1, $limit, $field, $order, $jointable, $grade);
- if ($data < 0) {
- return responseToJson($data);
- }
- $take_status = trans('status.money_take.status');
- $has_root = 0;
- if (\App\Models\Role::hasRoot('/enable/show/bankcard') < 0) {
- $has_root = 1;
- }
- foreach ($data['data'] as $k => $v) {
- $data['data'][$k]['apply_time'] = $v['order_id'] . '<br>' . $v['apply_time'];
- $data['data'][$k]['status'] = ($v['status'] == 0) ? $take_status[3] : $take_status[$v['status']];
- // $data['data'][$k]['bank_info_no'] = $v['bank_info'] . '<br>' . bankHide($v['bank_no']);
- $has_root == 1 ? $data['data'][$k]['bank_no'] = bankHide($v['bank_no']) : null;
- $data['data'][$k]['bank_user_address'] = $v['bank_user'] . '<br>' . $v['bank_address'];
- // $data['data'][$k]['pass_time'] = '<p style="color:red;">'.$data['data'][$k]['status'] . '<br>' . $v['pass_time'];
- }
- $data['data'] = arrayToNumber($data['data'], ['money']);
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
- }
- //待审核提现记录量获取
- function getTakeNum()
- {
- $take = new \App\Models\Money_take();
- $status = Request::has('status') ? Request::get('status') : 3;
- $data = $take->getCountnum($status);
- return responseToJson(1, '', $data);
- }
- //提现订单详情
- function withdrawDetails()
- {
- $orderid = Request::has('orderid') ? Request::get('orderid') : '';
- if (empty($orderid)) {
- return responseToJson(-3020100202); //未提交对应订单号
- }
- $takedetails = new \App\Models\Money_take();
- $data = $takedetails->getOrderDetails($orderid, 3, '', '', '', 2);
- if ($data < 0) {
- return responseToJson($data);
- }
- $data['trade_type'] = 5;
- return responseToJson($data);
- }
- //回水记录
- function returnList()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $order_id = Request::has('order_id') ? Request::get('order_id') : '';
- $haddle_startime = Request::get('haddle_startime') ? Request::get('haddle_startime') . ' 00:00:00' : '';
- $haddle_endtime = Request::get('haddle_endtime') ? Request::get('haddle_endtime') . ' 23:59:59' : '';
- $money_small = Request::has('money_small') ? Request::get('money_small') : '';
- $money_big = Request::has('money_big') ? Request::get('money_big') : '';
- $lossmoney_small = Request::has('lossmoney_small') ? Request::get('lossmoney_small') : '';
- $lossmoney_big = Request::has('lossmoney_big') ? Request::get('lossmoney_big') : '';
- $sureblur = Request::has('sureblur') ? Request::get('sureblur') : '';
- $where = array();
- if (!empty($account_name)) {
- if (empty($sureblur) || $sureblur == '模糊') {
- $where[] = array('account_name', 'like', '%' . $account_name . '%');
- } else {
- $where[] = array('account_name', '=', $account_name);
- }
- }
- if (!empty($haddle_startime)) {
- $haddle_startime = date('Y-m-d H:i:s', strtotime($haddle_startime));
- $where[] = array('processing_time', '>=', $haddle_startime);
- }
- if (!empty($haddle_endtime)) {
- $haddle_endtime = date('Y-m-d H:i:s', strtotime($haddle_endtime));
- $where[] = array('processing_time', '<=', $haddle_endtime);
- }
- if (!empty($money_small)) {
- $where[] = array('money', '>=', $money_small);
- }
- if (!empty($money_big)) {
- $where[] = array('money', '<=', $money_big);
- }
- if (!empty($lossmoney_small)) {
- $where[] = array('total_money', '>=', $lossmoney_small);
- }
- if (!empty($lossmoney_big)) {
- $where[] = array('total_money', '<=', $lossmoney_big);
- }
- if (!empty($order_id)) {
- $where = array(array('order_id', '=', $order_id));
- }
- $moneydetails = new \App\Models\Money_return();
- $data = $moneydetails->getReturnlist($where, 1, $limit, $field, $order);
- if ($data < 0) {
- return responseToJson($data);
- }
- foreach ($data['data'] as $k => $v) {
- $data['data'][$k]['orderid_time'] = $v['order_id'] . '<br>' . $v['processing_time'];
- }
- $data['data'] = arrayToNumber($data['data'], array('return_money', 'total_money'));
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total'], 0, $where);
- }
- //回水订单详情
- function returnDetails()
- {
- $orderid = Request::has('orderid') ? Request::get('orderid') : '';
- if (empty($orderid)) {
- return responseToJson(-3020200202); //未提交对应订单号
- }
- $returndetails = new \App\Models\Money_return();
- $data = $returndetails->getOrderDetails($orderid, 3, 'account_bank', 'account_identity', 'account_identity');
- if ($data < 0) {
- return responseToJson($data);
- }
- $data['trade_type'] = 8;
- return responseToJson($data);
- }
- //加款扣款
- function moneyChange()
- {
- $changeType = Request::has('changetype') ? Request::get('changetype') : '';
- $account_identity = Request::has('account_identity') ? Request::get('account_identity') : '';
- $money = Request::has('money') ? Request::get('money') : '';
- $bili = Request::has('bili') ? Request::get('bili') : 0;
- $reson = Request::has('reson') ? Request::get('reson') : 0;
- $orderid = Request::has('orderid') ? Request::get('orderid') : '';
- $status = Request::has('status') ? Request::get('status') : 1; //1:成功 2:失败
- if (empty($changeType)) {
- return responseToJson(-3020300302); //未提交加款扣款类型 1:加款,2:扣款
- }
- if (empty($money)) {
- return responseToJson(-3020300402); //操作金额不能为空
- }
- if (empty($account_identity)) {
- return responseToJson(-3020300502); //未提交用户ID
- }
- if ($bili > 0) {
- $money = $money * $bili;
- }
- //第三方充值
- if (empty($orderid)) {
- $res = $status; //加款扣款
- if ($res == 1) {
- return responseToJson($res);
- }
- return responseToJson(-3020300602); //加款扣款失败
- }
- //活动加款扣款
- $res = $status; //加款扣款
- if ($res == 1) {
- return responseToJson($res);
- }
- return responseToJson(-3020300702); //加款扣款失败
- }
- //加款扣款用户信息获取
- function getUser()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 'id';
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account = Request::has('account_name') ? Request::get('account_name') : '';
- $sureblur = Request::has('sureblur') ? Request::get('sureblur') : '';
- if (empty($account)) {
- $data = array(
- array(
- 'account_name' => '',
- 'account_identity' => '',
- 'cash' => '',
- ),
- );
- return \App\Lib\DataTable\DataTable::init()->toJson($data, 1);
- }
- $account = strtolower($account);
- $where = array();
- if (!empty($account)) {
- // if (empty($sureblur) || $sureblur == '模糊') {
- // $where[] = array('account', 'like', '%' . $account . '%');
- // } else {
- $where[] = array('account', '=', $account);
- // }
- }
- $userdetails = new \App\Models\Account();
- $data = $userdetails->getUserDetails($where, 3, 'account_detailed', 'identity', 'account_identity', $page, $limit, $field, $order);
- if ($data < 0) {
- return responseToJson($data); //没有用户数据
- }
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
- }
- //回水管理
- function returnInfo()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- // $field = Request::has('field') ? Request::get('field') : '';
- // $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- // $account_name = 'gust17687';
- $gametype = Request::has('gametype') ? Request::get('gametype') : '';
- $lossmoney_small = Request::has('lossmoney_small') ? Request::get('lossmoney_small') : '';
- $lossmoney_big = Request::has('lossmoney_big') ? Request::get('lossmoney_big') : '';
- $sureblur = Request::has('sureblur') ? Request::get('sureblur') : '';
- $star_time = Request::get('star_time') ? Request::get('star_time') . ' 00:00:00' : '';
- $end_time = Request::get('end_time') ? Request::get('end_time') . ' 23:59:59' : '';
- $total_money = Request::has('total_money') ? Request::get('total_money') : '';
- $where = array();
- $user_where = array();
- $wheregame = array();
- $orwhere = array();
- $having = '';
- if (!empty($total_money)) {
- $having = 'sum("get_money")<=' . (-$total_money);
- }
- if (!empty($account_name)) {
- if (empty($sureblur) || $sureblur == '模糊') {
- $where[] = array('account_name', 'like', '%' . $account_name . '%');
- } else {
- $where[] = array('account_name', '=', $account_name);
- }
- $user_where = array('account' => $account_name, 'status' => 4);
- }
- if (!empty($gametype) || $gametype != 0) {
- $where[] = array('game_name', '=', $gametype);
- } else {
- // $wheregame[] = array('game_name', '=', 'xy28');
- // $orwhere[] = array('game_name', '=', 'jnd28');
- $wheregame = array('xy28', 'jnd28');
- }
- if (!empty($lossmoney_small)) {
- $where[] = array('total_money', '>=', $lossmoney_small);
- }
- if (!empty($lossmoney_big)) {
- $where[] = array('total_money', '<=', $lossmoney_big);
- }
- if (!empty($star_time)) {
- $star_time = date('Y-m-d H:i:s', strtotime($star_time));
- $where[] = array('money_time', '>=', $star_time);
- }
- if (!empty($end_time)) {
- $end_time = date('Y-m-d H:i:s', strtotime($end_time));
- $where[] = array('money_time', '<=', $end_time);
- }
- // $user= new \App\Model\Account;
- // $users=$user->Accounta($user_where);
- $moneyreturn = new \App\Models\MoneyBuy();
- // if ($users > 0){
- // return responseToJson(-3020400202);
- // }
- $data = $moneyreturn->getMoneyReturn($where, 1, $limit, $wheregame, $orwhere, $having);
- if ($data < 0) {
- return responseToJson($data);
- }
- // $game = trans('money');
- // var_dump($data['data']);
- // $gamearr = $game['gametype'];
- foreach ($data['data'] as $k => $v) {
- // $data['data'][$k]['game_name'] = $gamearr[$v['game_name']];
- if ($v['total_money'] < 0) {
- $data['data'][$k]['total_money'] = floatval(abs($v['total_money']));
- } else {
- unset($data['data'][$k]);
- }
- // $data['data'][$k]['total_money'] = floatval($v['total_money']);
- }
- // var_dump($data['data'])
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
- }
- //回水
- function returnAct()
- {
- $status = Request::has('status') ? Request::get('status') : 1; //1:成功 2:失败
- $systemUser = Request::has('systemuser') ? Request::get('systemuser') : ''; //管理员名
- $data = Request::has('data') ? Request::get('data') : '';
- //$data = '{"data":[{"account_name":"147ceshi","account_identity":"3df48c6c-f805-ed8b-1d2f-e4e95f09242f","total_money":200,"status":2,"game_name":"\u5e78\u8fd028","ratio":0.1},{"account_name":"123daili","account_identity":"f243a05d-f0b4-6eee-e8ad-53472612230e","total_money":0,"status":1,"game_name":"\u5e78\u8fd028","ratio":0.1}]}';
- if (empty($data)) {
- return Rens(-3020400202); //未提交回水信息
- }
- if (empty($systemUser)) {
- return Rens(-3020400302); //未提交操作管理员信息
- }
- $data = json_decode($data);
- $data = $data->data;
- $addData = array();
- foreach ($data as $k => $v) {
- $addData[] = array(
- 'info_identity' => '',
- 'order_id' => '',
- 'account_name' => $v->account_name,
- 'account_identity' => $v->account_identity,
- 'money' => $v->total_money * $v->ratio,
- 'total_money' => $v->total_money,
- 'sysetem_user' => $systemUser,
- 'processing_time' => date('Y-m-d H:i:s', time()),
- 'ratio' => $v->ratio,
- 'reason' => '',
- );
- }
- foreach ($addData as $v) {
- if (!empty($v)) {
- $res = $status;
- }
- }
- if ($res == 1) {
- return Rens($res);
- }
- return Rens(-3020400402); //回水操作失败
- }
- //提现账单详情
- function stateDetails()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $account_identity = Request::has('account_identity') ? Request::get('account_identity') : '';
- $status = Request::has('status') ? Request::get('status') : '';
- if (empty($account_name) && empty($account_identity)) {
- return responseToJson(-3020200102); //未提交对应用户信息
- }
- if (empty($status)) {
- return responseToJson(-3020200202); //未提交对应信息状态
- }
- $where = array();
- if (!empty($account_name)) {
- $where[] = array('account_name', '=', $account_name);
- } else {
- $where[] = array('account_identity', '=', $account_identity);
- }
- if ($status == 3) {
- $where[] = array('money_take.status', '=', '0');
- } else {
- $where[] = array('money_take.status', '=', $status);
- }
- $takedetails = new \App\Models\Money_take();
- $data = $takedetails->getTotalDetails($where, 1, $limit, $page, $field, $order);
- if ($data < 0) {
- return responseToJson($data);
- }
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
- }
- //充值账单详情
- function rechargesDetails()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 6;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $account_identity = Request::has('account_identity') ? Request::get('account_identity') : '';
- $status = Request::has('status') ? Request::get('status') : '';
- if (empty($account_name) && empty($account_identity)) {
- return responseToJson(-3020200102); //未提交对应用户信息
- }
- if (empty($status)) {
- return responseToJson(-3020200202); //未提交对应信息状态
- }
- $where = array();
- if (!empty($account_name)) {
- $where[] = array('money_recharge.account_name', '=', $account_name);
- } else {
- $where[] = array('money_recharge.account_identity', '=', $account_identity);
- }
- $where[] = array('money_recharge.status', '=', $status);
- $takedetails = new \App\Models\Money_recharge();
- $data = $takedetails->getTotalDetails($where, 1, $limit, $page, $field, $order);
- if ($data < 0) {
- return responseToJson($data);
- }
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
- }
- //用户回水详情列表
- function userreturnList()
- {
- $page = Request::has('page') ? Request::get('page') : 1;
- $limit = Request::has('limit') ? Request::get('limit') : 10;
- $field = Request::has('field') ? Request::get('field') : 13;
- $order = Request::has('order') ? Request::get('order') : 'desc';
- $account_name = Request::has('account_name') ? Request::get('account_name') : '';
- $game_name = Request::has('game_name') ? Request::get('game_name') : '';
- if (empty($account_name) && empty($account_identity)) {
- return responseToJson(-3020300102); //未提交对应用户信息
- }
- $game_name = ($game_name == '幸运28') ? 'xy28' : ($game_name == '加拿大28' ? 'jnd28' : '');
- if (empty($game_name)) {
- return responseToJson(-3020300202); //未提交对应游戏信息
- }
- $where = array();
- $where[] = array('account_name', '=', $account_name);
- $where[] = array('game_name', '=', $game_name);
- $moneybuy = new \App\Models\MoneyBuy();
- $data = $moneybuy->getUserReturndetail($where, 1, $limit, $field, $order);
- if ($data < 0) {
- return responseToJson($data);
- }
- foreach ($data['data'] as $k => $v) {
- $data['data'][$k]['money_time'] = $v['order_id'] . '<br>' . $v['money_time'];
- }
- return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
- }
- //统计
- /**
- * 充值金额统计
- * 'money description'
- * @return 'type' 'description'
- */
- function rechargeMoneyCount()
- {
- $where = Request::has('where') ? Request::get('where') : '';
- $db = new \App\Models\Money_recharge;
- $data = $db->rechargeMoneyCount($where);
- return responseToJson($data);
- }
- /**
- * 提款金额统计
- * 'money description'
- * @return 'type' 'description'
- */
- function takeMoneyCount()
- {
- $where = Request::has('where') ? Request::get('where') : '';
- $db = new \App\Models\Money_take;
- $data = $db->takeMoneyCount($where);
- return responseToJson($data);
- }
- /**
- * 汇款金额统计
- * 'money description'
- * @return 'type' 'description'
- */
- function sendMoneyCount()
- {
- $where = Request::has('where') ? Request::get('where') : '';
- $db = new \App\Models\Money_recharge;
- $data = $db->sendMoneyCount($where);
- return responseToJson($data);
- }
- /**
- * 回水金额统计
- * 'money description'
- * @return 'type' 'description'
- */
- function returnMoneyCount()
- {
- $where = Request::has('where') ? Request::get('where') : '';
- $db = new \App\Models\Money_return;
- $data = $db->returnMoneyCount($where);
- return responseToJson($data);
- }
- //获取交易表名后缀
- private function getTradetable($num)
- {
- $type = array(
- '1' => 'buy',
- '2' => 'buy',
- '3' => 'buy',
- '4' => 'prize',
- '5' => 'take',
- '6' => 'recharge',
- '7' => 'back',
- '8' => 'return',
- '11' => 'recharge',
- '12' => 'recharge',
- '13' => 'recharge',
- '14' => 'recharge',
- );
- return $type[$num];
- }
- //汇款
- function Rimit($order_id, $rale)
- {
- DB::beginTransaction();
- $db = new \App\Models\Money_recharge;
- $accountDB = new \App\Models\Account_detailed(); //用户详情
- $info = $db->getRimitDetails($order_id);
- if ($info < 0) {
- return $info;
- }
- $limitroot = new \App\Models\System_user();
- $limitmoney = $limitroot->checkActMoney($info['money']);
- if ($limitmoney < 0) {
- return $limitmoney;
- }
- //更新统计数据
- $data = $info;
- $info['complete_time'] = date('Y-m-d H:i:s');
- $data['pass_time'] = $info['complete_time'];
- $res = \App\Models\Money_count::AddCountinfo($data, 'save');
- if ($res < 0) {
- DB::rollback();//事务回滚
- return responseToJson($res);
- }
- //更新数据状态
- $res = $db->updateStatus($order_id, 1);
- if ($res < 0) {
- DB::rollBack();
- return $res;
- }
- $acount = new \App\Models\Account_detailed;
- $acount_info = $acount->getInfoBy($info['account_identity']);
- $prize_moeny = 0;
- //添加汇款详情
- unset($info['apply_time']);
- unset($info['complete_time']);
- unset($info['status']);
- unset($info['recharge_type']);
- unset($info['recharge_type']);
- unset($info['id']);
- unset($info['info_identity']);
- unset($info['money_cash']);
- unset($info['order_id']);
- unset($info['remark']);
- $rate = $info['rate'] ?? 1;
- if (isset($info['rate']))
- unset($info['rate']);
- //获取充值备注信息
- $remarkinfo = \App\Models\Recharge_Remark::where('order_id', $order_id)->first();
- if (!$remarkinfo) {
- return -30010102;
- }
- $remarkinfo = $remarkinfo->toArray();
- //添加汇款详情
- $info["sysetem_user"] = session('adminInfo.admin_name');
- $res = $this->addLog($info, 14, $acount_info['cash'], $rate, $order_id);
- if ($res < 0) {
- DB::rollBack();
- return $res;
- }
- //更新余额
- $rimt_res = $accountDB->addMoney($acount_info['account_identity'], $info['money']);
- if ($rimt_res < 0) {
- DB::rollBack();
- return $rimt_res;
- }
- //含赠送金额时插入赠送新数据
- if (!empty($rale)) {
- $order_id2 = OrderID();
- $prize_moeny = $info['money'] * $rale; //奖励金额
- $money_cash = $prize_moeny + $acount_info['cash'] + $info['money'];
- $data = array(
- 'money' => $prize_moeny,
- "account_name" => $info['account_name'],
- "account_identity" => $info['account_identity'],
- "sysetem_user" => session('adminInfo.admin_name'),
- "reason" => '汇款赠送1',
- "money_cash" => $money_cash,
- );
- $re_data = $data;
- $data['order_id'] = $order_id2;
- $data['apply_time'] = date('Y-m-d H:i:s');
- $data['complete_time'] = date('Y-m-d H:i:s');
- $data['status'] = 1;
- $data['recharge_type'] = '汇款赠送';
- //添加充值赠送备注信息
- $remarkdata = array(
- 'order_id' => $order_id2,
- 'name' => $remarkinfo['name'],
- 'recharge_time' => $remarkinfo['recharge_time'],
- 'money' => $prize_moeny,
- );
- $rminfo = \App\Models\Recharge_Remark::insert($remarkdata);
- if (!$rminfo) {
- DB::rollBack();
- return -30010202;
- }
- $order_id2 = $db->addMoney($data);
- if ($order_id2 < 0) {
- DB::rollBack();
- return $order_id2;
- }
- //添加充值详情
- $res2 = $this->addLog($re_data, 13, ($acount_info['cash'] + $info['money']));
- if ($res2 < 0) {
- DB::rollBack();
- return $res2;
- }
- $rimt_res = $accountDB->addMoney($data['account_identity'], $data['money']);
- if ($rimt_res < 0) {
- DB::rollBack();
- return $rimt_res;
- }
- }
- $uinfo = $accountDB->getInfoBy($acount_info['account_identity']);
- $data = array('money_cash' => $uinfo['cash'] - $prize_moeny);
- $res5 = $db->updateInfo($data, 'order_id', $order_id);
- if ($res5 < 0) {
- DB::rollBack();
- return $res5;
- }
- DB::commit();
- return 1;
- }
- //详情记录
- function addLog($data, $type, $cash, int $rate = 1, $order_id = '')
- {
- $data['money_cash'] = $data['money'] + $cash;
- $data['trade_id'] = !empty($order_id) ? $order_id : OrderID();
- $data['trade_type'] = $type;
- $data['money_time'] = date('Y-m-d H:i:s');
- $data['money_type'] = 1;
- $admin_name = session('adminInfo.admin_name');
- $detailsinfo = \App\Models\Money_details::where('trade_id', $order_id)->where('trade_id', '<>', '')->first();
- if ($detailsinfo) {
- return -3020035022;
- }
- if ($type == 13) {
- $data['trade_desc'] = sprintf(trans('trade.admin_prize_money'), $admin_name, $data['account_name'], $data['money'], $data['trade_id'], $rate);
- $data['reason'] = '汇款赠送';
- } else if ($type == 14) {
- $data['trade_desc'] = sprintf(trans('trade.admin_rimit_money'), $admin_name, $data['account_name'], $data['money'], $data['trade_id'], $rate);
- $data['reason'] = '汇款';
- }
- $db_money = new \App\Models\Money_details;
- $res = $db_money->insertData($data);
- return $res;
- }
- //获取提现,汇款,充值待处理内容
- function getNum()
- {
- $model = new \App\Models\Money_recharge();
- $data['rimit'] = $model::where('status', 0)->where('recharge_type', '汇款')->count();
- $data['take'] = \App\Models\Money_take::where('status', 0)->count();
- $data['vip'] = \App\Models\Uservip::where('status', 1)->count();
- // $data['back'] = \App\Model\Oggame_transfer_record::where('type', 3)->count();
- // $data['lotteryMoney'] = \App\Model\LotteryMoneyLog::where('status', 0)->count();//待审核彩金条数
- // $msg_db = new \App\Model\MessageRead;
- // $data['msg'] = $msg_db->countNoReade (session ('adminInfo.admin_id'));
- // $data['agent'] = \App\Model\Agent_detailed::where ('status', 0)->count ('id');
- return responseToJson($data);
- }
- /**
- *检查用户提现规则
- * @param $idd
- * @param null $money
- * @return int
- */
- public function checkWithdrawRule()
- {
- $idd = Request::has('idd') ? Request::get('idd') : '';
- if (!$idd)
- return responseToJson(-1, '非法操作,用户账户不能为空', '');
- $ret = Withdraw_rule::check($idd);
- return responseToJson($ret ? 1 : -1, $ret ? 'success' : '无结果', $ret);
- }
- /**
- * 更新用户提现规则
- * @param $idd
- * @param $data
- * @return array
- */
- public function changeWithDrawRule()
- {
- $idd = Request::has('idd') ? Request::get('idd') : '';
- $start_time = Request::has('start_time') ? Request::post('start_time') : '';
- $end_time = Request::has('end_time') ? Request::post('end_time') : '';
- $bettingMoney = Request::has('bettingMoney') ? Request::post('bettingMoney') : 0;
- $rate = Request::has('rate') ? Request::post('rate') : 1;
- $needBettingMoney = Request::has('needBettingMoney') ? Request::post('needBettingMoney') : 0;
- if (!$idd)
- return responseToJson(-1, '非法操作,用户账户不能为空', '');
- $ret = Withdraw_rule::updateRule($idd, $bettingMoney, $rate);
- return responseToJson($ret ? 1 : -1, $ret ? '修改规则成功' : '修改规则失败', '');
- }
- /**
- *添加用户提现规则
- * @return array|int
- */
- public function addRule()
- {
- $idd = Request::has('idd') ? Request::get('idd') : '';
- $startTime = Request::has('startTime') ? Request::post('startTime') : '';
- $endTime = Request::has('endTime') ? Request::post('endTime') : '';
- $bettingMoney = Request::has('bettingMoney') ? Request::post('bettingMoney') : 0;
- $needBettingMoney = Request::has('needBettingMoney') ? Request::post('needBettingMoney') : 0;
- if (!$idd)
- return responseToJson(-1, '非法操作,用户账户不能为空', '');
- if (!$startTime)
- $startTime = time();
- if (!$endTime)
- $endTime = time();
- if (!$bettingMoney || !$needBettingMoney) {
- //return responseToJson (-1, '金额不能为空或0', '');
- }
- if ($bettingMoney) $data['bettingMoney'] = $bettingMoney;
- if ($needBettingMoney) $data['needBettingMoney'] = $needBettingMoney;
- //$ret = Withdraw_rule::setRule ($idd, $startTime, $endTime, $bettingMoney, $needBettingMoney);
- $ret = Withdraw_rule::setRule($idd, time(), time(), 1000, 1200);
- return responseToJson($ret ? 1 : -1, $ret ? '添加规则成功' : '添加规则失败', $ret);
- }
- /**
- * 删除用户提现规则
- * @return mixed
- */
- public function rmWithdrawRule()
- {
- $idd = Request::has('idd') ? Request::post('idd') : '';
- if (!$idd)
- return responseToJson('', '非法操作', '');
- $ret = Withdraw_rule::rmRule($idd);
- return responseToJson($ret ? 1 : -1, $ret ? '删除规则成功' : '删除规则失败', '');
- }
- public function getWithdrawList()
- {
- $data = Withdraw_rule::get();
- //return responseToJson (1,'',$data);
- return ['code' => 0, 'count' => count($data), 'data' => $data, 'msg' => 'success'];
- }
- /**
- * 用户提现规则表页面
- */
- public function withdrawRules(Request $req)
- {
- $request['title'] = isset($req->title) ? trim($req->title) : '提现规则表';
- $request['type'] = isset($req->type) ? trim($req->type) : null;
- $dt = \App\Lib\DataTable\DataTable::init();
- $dt->setDataSource('/admin/money/getWithdrawList');
- $dt->setLang('withdrawRule');
- $dt->addColsFields('account_identity', ['templet' => '#account_identity']);
- $dt->addColsFields('bettingMoney');
- $dt->addColsFields('needBettingMoney');
- $dt->addColsFields('start_time');
- $dt->addColsFields('end_time');
- //$dt->enableCheckBox ();
- $arr[] = 'editRule';
- $dt->setToolBar($arr, array('width' => 140));
- return view('admin.withdraw/rules', $dt->render($request));
- }
- /**
- * 修改用户提现规则页面
- * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
- */
- public function editRule()
- {
- $id = Request::has('id') ? Request::get('id') : '';
- if ($id) {
- $data = Withdraw_rule::getRule($id);
- return view('admin.withdraw.editRule', ['data' => $data]);
- }
- die('error');
- }
- }
- function test()
- {
- $db = new \App\Models\Money_recharge;
- $data = $db->text();
- print_r($data);
- }
|