Commit 811138fb by 杨苏杭

验证码校验6位

parent 7845f07b
...@@ -39,7 +39,7 @@ class StationController extends Controller ...@@ -39,7 +39,7 @@ class StationController extends Controller
'station_id' => 'required|exists:stations,id', 'station_id' => 'required|exists:stations,id',
]); ]);
if ($validator->fails()) { if ( $validator->fails() ) {
abort(400, $validator->errors()->first()); abort(400, $validator->errors()->first());
} else { } else {
...@@ -62,7 +62,7 @@ class StationController extends Controller ...@@ -62,7 +62,7 @@ class StationController extends Controller
}); });
if (count($portState) != 0) { if ( count($portState) != 0 ) {
$portState = json_decode(json_encode($portState)); $portState = json_decode(json_encode($portState));
} else { } else {
...@@ -82,14 +82,15 @@ class StationController extends Controller ...@@ -82,14 +82,15 @@ class StationController extends Controller
[ [
'data' => [ 'data' => [
'port_info' => $portCollection, 'port_info' => $portCollection,
'port_state' => $portState, 'port_state' => $portState,
'enable_port_count' => $enablePortCount, 'enable_port_count' => $enablePortCount,
'station_name' => $stationCollection->name, 'station_name' => $stationCollection->name,
'port_count' => $stationCollection->port_count, 'port_count' => $stationCollection->port_count,
]]); ]
]);
} }
...@@ -103,14 +104,12 @@ class StationController extends Controller ...@@ -103,14 +104,12 @@ class StationController extends Controller
public function getPayRule(Request $request) public function getPayRule(Request $request)
{ {
Log::debug('he');
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'station_id' => 'required|exists:stations,id', 'station_id' => 'required|exists:stations,id',
'port_id' => 'required|exists:devices,id', 'port_id' => 'required|exists:devices,id',
]); ]);
if ($validator->fails()) { if ( $validator->fails() ) {
abort(400, $validator->errors()->first()); abort(400, $validator->errors()->first());
} else { } else {
...@@ -123,12 +122,12 @@ class StationController extends Controller ...@@ -123,12 +122,12 @@ class StationController extends Controller
$template = $stationCollection->billing_template; $template = $stationCollection->billing_template;
if (blank($stationCollection->billing_template) === true) { if ( blank($stationCollection->billing_template) === true ) {
$ruleId = $stationCollection->billingTpl_id; $ruleId = $stationCollection->billingTpl_id;
$template = BillingTplModel::where('id', $ruleId)->first(['context']); $template = BillingTplModel::where('id', $ruleId)->first(['context']);
if (blank($template) === true) { if ( blank($template) === true ) {
abort(500, 'can not find template'); abort(500, 'can not find template');
} }
...@@ -144,17 +143,15 @@ class StationController extends Controller ...@@ -144,17 +143,15 @@ class StationController extends Controller
return $this->response->array($this->getResponseCode() + ['data' => [ return $this->response->array($this->getResponseCode() + ['data' => [
'pay_rule' => json_decode($template), 'pay_rule' => json_decode($template),
'station_name' => $stationCollection->name, 'station_name' => $stationCollection->name,
'port_state' => $portState, 'port_state' => $portState,
'port_name' => $portName->name, 'port_name' => $portName->name,
'wallet_balance' => number_format(Auth::user()->wallet_balance / 100.0, 2), 'wallet_balance' => number_format(Auth::user()->wallet_balance / 100.0, 2),
'max_cep' => $stationCollection->max_cep, 'max_cep' => $stationCollection->max_cep,
]]);
// return $this->response->collection($stationCollection, new CustomTransformer); ]
]);
} }
...@@ -169,9 +166,9 @@ class StationController extends Controller ...@@ -169,9 +166,9 @@ class StationController extends Controller
{ {
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'longitude' => 'required', 'longitude' => 'required',
'latitude' => 'required', 'latitude' => 'required',
]); ]);
if ($validator->fails()) { if ( $validator->fails() ) {
abort(400, $validator->errors()->first()); abort(400, $validator->errors()->first());
} }
$geohash = new GeoHashServices(); $geohash = new GeoHashServices();
......
...@@ -45,7 +45,7 @@ class AccessController extends Controller ...@@ -45,7 +45,7 @@ class AccessController extends Controller
'code' => 'required', 'code' => 'required',
]); ]);
if ($validator->fails()) { if ( $validator->fails() ) {
abort(400, $validator->errors()->first()); abort(400, $validator->errors()->first());
...@@ -55,21 +55,21 @@ class AccessController extends Controller ...@@ -55,21 +55,21 @@ class AccessController extends Controller
// 旧系统存在用户将旧系统用户余额 // 旧系统存在用户将旧系统用户余额
if ($wxWebGrant->requestAccessToken($code) === true) { //获取access_token if ( $wxWebGrant->requestAccessToken($code) === true ) { //获取access_token
if ($wxWebGrant->requestUserInfo() === true) { //token换取微信用户信息 if ( $wxWebGrant->requestUserInfo() === true ) { //token换取微信用户信息
$wxUser = $wxWebGrant->getWxUser();//创建微信用户对象 $wxUser = $wxWebGrant->getWxUser();//创建微信用户对象
$openid = $wxUser->getOpenid(); $openid = $wxUser->getOpenid();
if ($wxUser->getSubscribe() === 0) { if ( $wxUser->getSubscribe() === 0 ) {
abort(403, '请先关注微信公众号'); abort(403, '请先关注微信公众号');
} }
$wxUserModel = WxUserModel::where('openid', $openid)->first(); $wxUserModel = WxUserModel::where('openid', $openid)->first();
if (empty($wxUserModel)) { //openid是否已经存在 if ( empty($wxUserModel) ) { //openid是否已经存在
$balance = $this->syncUserBalance($openid); $balance = $this->syncUserBalance($openid);
...@@ -77,7 +77,7 @@ class AccessController extends Controller ...@@ -77,7 +77,7 @@ class AccessController extends Controller
$wxUserModel = new WxUserModel(); $wxUserModel = new WxUserModel();
if (!$wxUserModel->addUser($wxUser)) { if ( !$wxUserModel->addUser($wxUser) ) {
Log::error('add user fail'); Log::error('add user fail');
...@@ -88,7 +88,7 @@ class AccessController extends Controller ...@@ -88,7 +88,7 @@ class AccessController extends Controller
} else { } else {
// 更新用户信息 // 更新用户信息
if ($wxUserModel->nickname != $wxUser->getNickname()) { if ( $wxUserModel->nickname != $wxUser->getNickname() ) {
$wxUserModel->nickname = $wxUser->getNickname(); $wxUserModel->nickname = $wxUser->getNickname();
......
...@@ -22,7 +22,7 @@ class CodeController extends Controller ...@@ -22,7 +22,7 @@ class CodeController extends Controller
/** /**
* @param Request $request * @param Request $request
* @param SendCode $sendCode * @param SendCode $sendCode
* @return mixed * @return mixed
* @throws \ErrorException * @throws \ErrorException
...@@ -36,7 +36,7 @@ class CodeController extends Controller ...@@ -36,7 +36,7 @@ class CodeController extends Controller
'type' => 'required|in:WITHDRAW,REGISTER', 'type' => 'required|in:WITHDRAW,REGISTER',
]); ]);
if ($validator->failed()) { if ( $validator->failed() ) {
abort(400, $validator->errors()->first()); abort(400, $validator->errors()->first());
} }
...@@ -45,7 +45,7 @@ class CodeController extends Controller ...@@ -45,7 +45,7 @@ class CodeController extends Controller
$type = $request->get('type'); $type = $request->get('type');
if ($sendCode->send($phone, $type) !== true) { if ( $sendCode->send($phone, $type) !== true ) {
$this->resultCode = 'FAIL'; $this->resultCode = 'FAIL';
$this->resultMessage = $sendCode->getMessage(); $this->resultMessage = $sendCode->getMessage();
...@@ -58,7 +58,7 @@ class CodeController extends Controller ...@@ -58,7 +58,7 @@ class CodeController extends Controller
/** /**
* @param Request $request * @param Request $request
* @param SendCode $sendCode * @param SendCode $sendCode
* @return mixed * @return mixed
* @throws \ErrorException * @throws \ErrorException
...@@ -69,11 +69,11 @@ class CodeController extends Controller ...@@ -69,11 +69,11 @@ class CodeController extends Controller
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'phone' => 'required|digits:11', 'phone' => 'required|digits:11',
'code' => 'required|digits:11', 'code' => 'required|digits:6',
'type' => 'required|in:WITHDRAW,REGISTER', 'type' => 'required|in:WITHDRAW,REGISTER',
]); ]);
if ($validator->failed()) { if ( $validator->failed() ) {
abort(400, $validator->errors()->first()); abort(400, $validator->errors()->first());
} }
...@@ -81,11 +81,11 @@ class CodeController extends Controller ...@@ -81,11 +81,11 @@ class CodeController extends Controller
$type = $request->get('type'); $type = $request->get('type');
if ($sendCode->hasCode($phone, $type) === true) { if ( $sendCode->hasCode($phone, $type) === true ) {
$rightCode = $sendCode->getCode($phone, $type); $rightCode = $sendCode->getCode($phone, $type);
if ((int)$rightCode === (int)$request->get('code')) { if ( (int)$rightCode === (int)$request->get('code') ) {
$wxUserModel = new WxUserModel(); $wxUserModel = new WxUserModel();
...@@ -116,7 +116,7 @@ class CodeController extends Controller ...@@ -116,7 +116,7 @@ class CodeController extends Controller
$response = $this->getResponseCode(); $response = $this->getResponseCode();
if ($this->resultCode === 'SUCCESS') { if ( $this->resultCode === 'SUCCESS' ) {
$response = $response + [ $response = $response + [
'data' => [ 'data' => [
'token' => $token, 'token' => $token,
......
...@@ -125,6 +125,7 @@ $app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); ...@@ -125,6 +125,7 @@ $app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
$app->register(Overtrue\LaravelLang\TranslationServiceProvider::class); $app->register(Overtrue\LaravelLang\TranslationServiceProvider::class);
$app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class); $app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
$app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class); $app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class);
......
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