|
|
@@ -102,7 +102,7 @@ class UserService extends BaseService
|
|
|
->where("mark", "=", 1)
|
|
|
->count();
|
|
|
if ($count > 0) {
|
|
|
- return message("系统中已存在相同的用户名", false);
|
|
|
+ return returnJson("系统中已存在相同的用户名", false);
|
|
|
}
|
|
|
} else {
|
|
|
if($password){
|
|
|
@@ -115,7 +115,7 @@ class UserService extends BaseService
|
|
|
->where("mark", "=", 1)
|
|
|
->count();
|
|
|
if ($count > 0) {
|
|
|
- return message("系统中已存在相同的用户名", false);
|
|
|
+ return returnJson("系统中已存在相同的用户名", false);
|
|
|
}
|
|
|
|
|
|
// 币商会员账号验证
|
|
|
@@ -127,7 +127,7 @@ class UserService extends BaseService
|
|
|
->where("mark", "=", 1)
|
|
|
->count();
|
|
|
if ($count > 0) {
|
|
|
- return message("系统中已存在相同的会员账号", false);
|
|
|
+ return returnJson("系统中已存在相同的会员账号", false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -157,7 +157,7 @@ class UserService extends BaseService
|
|
|
$result = $this->model->edit($data, $error);
|
|
|
if (!$result) {
|
|
|
$this->model->rollBack();
|
|
|
- return message($error, false);
|
|
|
+ return returnJson($error, false);
|
|
|
}
|
|
|
// 删除已存在的用户角色关系数据
|
|
|
$userRoleService = new UserRoleService();
|
|
|
@@ -189,7 +189,7 @@ class UserService extends BaseService
|
|
|
$data['trc_address'] = isset($trcAddress['address'])? $trcAddress['address'] : '';
|
|
|
}else{
|
|
|
$this->model->rollBack();
|
|
|
- return message('生成TRC钱包地址失败', false);
|
|
|
+ return returnJson('生成TRC钱包地址失败', false);
|
|
|
}
|
|
|
|
|
|
// 生erc2.0钱包地址
|
|
|
@@ -200,7 +200,7 @@ class UserService extends BaseService
|
|
|
$data['erc_address'] = isset($ercAddress['address'])? $ercAddress['address'] : '';
|
|
|
}else{
|
|
|
$this->model->rollBack();
|
|
|
- return message('生成ERC钱包地址失败', false);
|
|
|
+ return returnJson('生成ERC钱包地址失败', false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -208,14 +208,14 @@ class UserService extends BaseService
|
|
|
if($info){
|
|
|
if(!$this->memberModel->where(['id'=> $userId])->update($data)){
|
|
|
$this->model->rollBack();
|
|
|
- return message('修改交易员信息失败', false);
|
|
|
+ return returnJson('修改交易员信息失败', false);
|
|
|
}
|
|
|
$this->model->commit();
|
|
|
$this->model->where(['id'=> $adminId])->update(['user_id'=> $userId]);
|
|
|
}else{
|
|
|
if(!$userId = $this->memberModel->edit($data)){
|
|
|
$this->model->rollBack();
|
|
|
- return message($userId? '修改交易员信息失败':'创建交易员账号失败', false);
|
|
|
+ return returnJson($userId? '修改交易员信息失败':'创建交易员账号失败', false);
|
|
|
}
|
|
|
|
|
|
$this->model->commit();
|
|
|
@@ -228,7 +228,7 @@ class UserService extends BaseService
|
|
|
}
|
|
|
|
|
|
|
|
|
- return message();
|
|
|
+ return returnJson();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -247,7 +247,7 @@ class UserService extends BaseService
|
|
|
$menuService = new MenuService();
|
|
|
$permissionList = $menuService->getPermissionsList($userId);
|
|
|
$userInfo['permissionList'] = $permissionList;
|
|
|
- return message("操作成功", true, $userInfo);
|
|
|
+ return returnJson("操作成功", true, $userInfo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -288,9 +288,9 @@ class UserService extends BaseService
|
|
|
}
|
|
|
$result = $this->model->edit($data);
|
|
|
if (!$result) {
|
|
|
- return message("更新资料信息失败", false);
|
|
|
+ return returnJson("更新资料信息失败", false);
|
|
|
}
|
|
|
- return message("更新资料信息成功");
|
|
|
+ return returnJson("更新资料信息成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -307,27 +307,27 @@ class UserService extends BaseService
|
|
|
// 原始密码
|
|
|
$oldPassword = trim(getter($param, "oldPassword"));
|
|
|
if (!$oldPassword) {
|
|
|
- return message("旧密码不能为空", false);
|
|
|
+ return returnJson("旧密码不能为空", false);
|
|
|
}
|
|
|
// 新密码
|
|
|
$newPassword = trim(getter($param, "newPassword"));
|
|
|
if (!$newPassword) {
|
|
|
- return message("新密码不能为空", false);
|
|
|
+ return returnJson("新密码不能为空", false);
|
|
|
}
|
|
|
$userInfo = $this->model->getInfo($userId);
|
|
|
if (!$userInfo) {
|
|
|
- return message("用户信息不存在", false);
|
|
|
+ return returnJson("用户信息不存在", false);
|
|
|
}
|
|
|
if ($userInfo['password'] != get_password($oldPassword . md5($oldPassword.'otc'))) {
|
|
|
- return message("旧密码输入不正确", false);
|
|
|
+ return returnJson("旧密码输入不正确", false);
|
|
|
}
|
|
|
// 设置新密码
|
|
|
$userInfo['password'] = get_password($newPassword . md5($newPassword.'otc'));
|
|
|
$result = $this->model->edit($userInfo);
|
|
|
if (!$result) {
|
|
|
- return message("修改失败", false);
|
|
|
+ return returnJson("修改失败", false);
|
|
|
}
|
|
|
- return message("修改成功");
|
|
|
+ return returnJson("修改成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -345,28 +345,28 @@ class UserService extends BaseService
|
|
|
// 原始密码
|
|
|
$loginPassword = trim(getter($param, "loginPassword"));
|
|
|
if (!$loginPassword) {
|
|
|
- return message("登录密码不能为空", false);
|
|
|
+ return returnJson("登录密码不能为空", false);
|
|
|
}
|
|
|
// 新密码
|
|
|
$newPassword = trim(getter($param, "newPassword"));
|
|
|
if (!$newPassword) {
|
|
|
- return message("新密码不能为空", false);
|
|
|
+ return returnJson("新密码不能为空", false);
|
|
|
}
|
|
|
$userInfo = $this->model->getInfo($adminId);
|
|
|
$memberInfo = MemberService::make()->getInfo($userId);
|
|
|
if (!$userInfo || empty($memberInfo)) {
|
|
|
- return message("用户信息不存在", false);
|
|
|
+ return returnJson("用户信息不存在", false);
|
|
|
}
|
|
|
if ($userInfo['password'] != get_password($loginPassword . md5($loginPassword.'otc'))) {
|
|
|
- return message("登录密码输入不正确", false);
|
|
|
+ return returnJson("登录密码输入不正确", false);
|
|
|
}
|
|
|
// 设置新密码
|
|
|
$password = get_password($newPassword . md5($newPassword.'otc'));
|
|
|
$result = $this->memberModel->where(['id'=> $userId])->update(['trade_password'=> $password]);
|
|
|
if (!$result) {
|
|
|
- return message("交易密码更新设置失败", false);
|
|
|
+ return returnJson("交易密码更新设置失败", false);
|
|
|
}
|
|
|
- return message("交易密码更新设置成功");
|
|
|
+ return returnJson("交易密码更新设置成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -382,42 +382,42 @@ class UserService extends BaseService
|
|
|
$code = trim(getter($param, "code"));
|
|
|
$username = trim(getter($param, "username"));
|
|
|
if(empty($username)){
|
|
|
- return message("账号参数错误", false);
|
|
|
+ return returnJson("账号参数错误", false);
|
|
|
}
|
|
|
if (!$code) {
|
|
|
- return message("验证码不能为空", false);
|
|
|
+ return returnJson("验证码不能为空", false);
|
|
|
}
|
|
|
|
|
|
// 验证码
|
|
|
$validator = new MemberValidator();
|
|
|
if(!is_array($validator->check(['mobile'=> $username],'mobile'))){
|
|
|
if(!EmailService::make()->check($username, $code, 'google')){
|
|
|
- return message(EmailService::make()->getError(), false);
|
|
|
+ return returnJson(EmailService::make()->getError(), false);
|
|
|
}
|
|
|
}else{
|
|
|
if(!SmsService::make()->check($username, $code, 'google')){
|
|
|
- return message(SmsService::make()->getError(), false);
|
|
|
+ return returnJson(SmsService::make()->getError(), false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//
|
|
|
$googleCode = trim(getter($param, "google_code"));
|
|
|
if (!$googleCode) {
|
|
|
- return message("谷歌验证码不能为空", false);
|
|
|
+ return returnJson("谷歌验证码不能为空", false);
|
|
|
}
|
|
|
$userInfo = $this->model->getInfo($userId);
|
|
|
if (!$userInfo) {
|
|
|
- return message("用户信息不存在", false);
|
|
|
+ return returnJson("用户信息不存在", false);
|
|
|
}
|
|
|
|
|
|
// 谷歌验证码
|
|
|
$googleSecret = isset($userInfo['google_secret'])? $userInfo['google_secret'] : '';
|
|
|
if(empty($googleSecret)){
|
|
|
- return message("您尚未绑定谷歌验证码", false);
|
|
|
+ return returnJson("您尚未绑定谷歌验证码", false);
|
|
|
}
|
|
|
|
|
|
if (!GoogleAuthenticator::CheckCode($googleSecret, $googleCode)) {
|
|
|
- return message("谷歌验证码错误", false);
|
|
|
+ return returnJson("谷歌验证码错误", false);
|
|
|
}
|
|
|
|
|
|
// 设置新谷歌验证码
|
|
|
@@ -427,9 +427,9 @@ class UserService extends BaseService
|
|
|
$googleLimitTime = $googleLimitTime>0? $googleLimitTime : 1;
|
|
|
$result = $this->model->where(['id'=> $userId])->update(['google_secret'=> $googleSecret,'google_verify_time'=> time() + $googleLimitTime*3600]);
|
|
|
if (!$result) {
|
|
|
- return message("谷歌验证码更新设置失败", false);
|
|
|
+ return returnJson("谷歌验证码更新设置失败", false);
|
|
|
}
|
|
|
- return message("谷歌验证码更新设置成功");
|
|
|
+ return returnJson("谷歌验证码更新设置成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -445,19 +445,19 @@ class UserService extends BaseService
|
|
|
// 用户ID
|
|
|
$userId = getter($param, "id");
|
|
|
if (!$userId) {
|
|
|
- return message("用户ID不能为空", false);
|
|
|
+ return returnJson("用户ID不能为空", false);
|
|
|
}
|
|
|
$userInfo = $this->model->getInfo($userId);
|
|
|
if (!$userInfo) {
|
|
|
- return message("用户信息不存在", false);
|
|
|
+ return returnJson("用户信息不存在", false);
|
|
|
}
|
|
|
// 设置新密码
|
|
|
$userInfo['password'] = get_password("123456" . md5('123456'.'otc'));
|
|
|
$result = $this->model->edit($userInfo);
|
|
|
if (!$result) {
|
|
|
- return message("重置密码失败", false);
|
|
|
+ return returnJson("重置密码失败", false);
|
|
|
}
|
|
|
- return message("重置密码成功");
|
|
|
+ return returnJson("重置密码成功");
|
|
|
}
|
|
|
|
|
|
}
|