|
@@ -97,7 +97,7 @@ class UserExtractController
|
|
|
// $commissionCount = $data['brokerage_price'] - $data['broken_commission'];
|
|
|
// if ($extractInfo['money'] > $commissionCount) return app('json')->fail('可提现佣金不足');
|
|
|
if (!$extractInfo['cardnum'] == '')
|
|
|
- if (!preg_match('/^([1-9]{1})(\d{14}|\d{18})$/', $extractInfo['cardnum']))
|
|
|
+ if (!$this->checkbank($extractInfo['cardnum']))
|
|
|
return app('json')->fail('银行卡号输入有误');
|
|
|
cache($request->uid(), 1, 5);
|
|
|
if (UserExtract::userExtract($request->user(), $extractInfo))
|
|
@@ -105,4 +105,37 @@ class UserExtractController
|
|
|
else
|
|
|
return app('json')->fail(UserExtract::getErrorInfo('提现失败'));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function checkbank($no = "")
|
|
|
+ {
|
|
|
+
|
|
|
+ if (empty($no)) return false;
|
|
|
+ $arr_no = str_split($no);
|
|
|
+ $last_n = $arr_no[count($arr_no) - 1];
|
|
|
+ krsort($arr_no);
|
|
|
+ $i = 1;
|
|
|
+ $total = 0;
|
|
|
+ foreach ($arr_no as $n) {
|
|
|
+ if ($i % 2 == 0) {
|
|
|
+ $ix = $n * 2;
|
|
|
+ if ($ix >= 10) {
|
|
|
+ $nx = 1 + ($ix % 10);
|
|
|
+ $total += $nx;
|
|
|
+ } else {
|
|
|
+ $total += $ix;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $total += $n;
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ $total -= $last_n;
|
|
|
+ $x = 10 - ($total % 10);
|
|
|
+ if ($x == $last_n) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|