Commit 8d2d9c84 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

Feature/optimize See merge request !396
parents 745be6d2 1990c78b
......@@ -110,7 +110,10 @@ class CrossChainController extends Controller
// 'port' => 8801
// ];
$service = new Chain33Service($node_params);
$result = $service->getHeight();
$payload = [
"data" => 'user.p.game',
];
$result = $service->chainQuery('paracross', 'GetHeight', $payload);
$consensHeight = $result['result']['consensHeight'];
$current_time = time();
......
......@@ -305,4 +305,57 @@ class UserController extends BaseController
}
return ['code' => 1, 'data' => $result['msg'], 'msg' => 'success'];
}
public function actionEditPwd()
{
if (!Yii::$app->request->isPut) {
$this->msg = '请求方式错误';
$this->code = -1;
goto doEnd;
}
$token = Yii::$app->request->headers->get('Token');
$user_info = Admin::verfication($token);
if (0 != $user_info['code']) {
$this->msg = $user_info['data'];
$this->code = -1;
goto doEnd;
}
$user_info = (array)$user_info['data'];
$user = Admin::findOne($user_info['uid']);
$old_password = Yii::$app->request->post('old_password', null);
$new_password = Yii::$app->request->post('new_password', null);
$new_password1 = Yii::$app->request->post('new_password1', null);
if (!$old_password) {
$this->msg = "请输入原始密码";
$this->code = -1;
goto doEnd;
}
if (!$new_password) {
$this->msg = "请输入新密码";
$this->code = -1;
goto doEnd;
}
if (!$new_password1) {
$this->msg = "请再次输入新密码";
$this->code = -1;
goto doEnd;
}
if ($new_password != $new_password1) {
$this->msg = "新密码输入不一致,请重新输入";
$this->code = -1;
goto doEnd;
}
if (!Yii::$app->security->validatePassword($old_password, $user->password)) {
$this->msg = "原始密码错误,请重新输入";
$this->code = -1;
goto doEnd;
}
$user->setPassword($new_password);
$user->save();
doEnd :
return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data];
}
}
\ No newline at end of file
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