diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index e18dd4f5..65740eee 100644 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -1251,7 +1251,6 @@ EOD; { $html .= ", searchList: " . $searchList; } - echo $datatype, "\n"; if (in_array($datatype, ['date', 'datetime']) || $formatter === 'datetime') { $html .= ", operate:'RANGE', addclass:'datetimerange'"; diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index 73d3bf55..2e214517 100644 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -61,6 +61,11 @@ class Admin extends Backend { if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('pkey_name')) + { + return $this->selectpage(); + } $childrenGroupIds = $this->childrenGroupIds; $groupName = AuthGroup::where('id', 'in', $childrenGroupIds) ->column('id,name'); @@ -246,4 +251,13 @@ class Admin extends Backend $this->error(); } + /** + * 下拉搜索 + */ + protected function selectpage() + { + $this->dataLimit = 'auth'; + return parent::selectpage(); + } + } diff --git a/application/admin/library/traits/Backend.php b/application/admin/library/traits/Backend.php index fbf60115..4e2627d8 100644 --- a/application/admin/library/traits/Backend.php +++ b/application/admin/library/traits/Backend.php @@ -78,14 +78,7 @@ trait Backend $params = $this->request->post("row/a"); if ($params) { - /* - * 已经弃用,如果为了兼容老版可取消注释 - foreach ($params as $k => &$v) - { - $v = is_array($v) ? implode(',', $v) : $v; - } - */ - if ($this->dataLimit) + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { $params[$this->dataLimitField] = $this->auth->id; } @@ -139,13 +132,6 @@ trait Backend $params = $this->request->post("row/a"); if ($params) { - /* - * 已经弃用,如果为了兼容老版可取消注释 - foreach ($params as $k => &$v) - { - $v = is_array($v) ? implode(',', $v) : $v; - } - */ try { //是否采用模型验证 diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index fe52d733..7eb308d0 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -61,6 +61,11 @@ class Backend extends Controller * 数据限制字段 */ protected $dataLimitField = 'admin_id'; + + /** + * 数据限制开启时自动填充限制字段值 + */ + protected $dataLimitFieldAutoFill = true; /** * 是否开启Validate验证 diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index b1259252..02c2a068 100644 --- a/application/common/library/Auth.php +++ b/application/common/library/Auth.php @@ -174,6 +174,23 @@ class Auth $params['password'] = $this->getEncryptPassword($password, $params['salt']); $params = array_merge($params, $extend); + ////////////////同步到Ucenter//////////////// + if (defined('UC_STATUS') && UC_STATUS) + { + $uc = new \addons\ucenter\library\client\Client(); + $user_id = $uc->uc_user_register($username, $password, $email); + // 如果小于0则说明发生错误 + if ($user_id <= 0) + { + $this->setError($user_id > -4 ? 'Username is incorrect' : 'Email is incorrect'); + return FALSE; + } + else + { + $params['id'] = $user_id; + } + } + //账号注册时需要开启事务,避免出现垃圾数据 Db::startTrans(); try @@ -299,9 +316,22 @@ class Auth $user = User::get($user_id); if ($user) { + ////////////////同步到Ucenter//////////////// + if (defined('UC_STATUS') && UC_STATUS) + { + $uc = new \addons\ucenter\library\client\Client(); + $re = $uc->uc_user_login($this->user->id, $this->user->password . '#split#' . $this->user->salt, 3); + // 如果小于0则说明发生错误 + if ($re <= 0) + { + $this->setError('Username or password is incorrect'); + return FALSE; + } + } + $ip = request()->ip(); $time = time(); - + //判断连续登录和最大连续登录 if ($user->logintime < \fast\Date::unixtime('day')) { @@ -320,7 +350,7 @@ class Auth $this->_token = Random::uuid(); Token::set($this->_token, $user->id); - + $this->_logined = TRUE; //登录成功的事件 @@ -454,6 +484,19 @@ class Auth return FALSE; } + ////////////////同步到Ucenter//////////////// + if (defined('UC_STATUS') && UC_STATUS) + { + $uc = new \addons\ucenter\library\client\Client(); + $re = $uc->uc_user_delete($user['id']); + // 如果小于0则说明发生错误 + if ($re <= 0) + { + $this->setError('Account is locked'); + return FALSE; + } + } + // 调用事务删除账号 $result = Db::transaction(function($db) use($user_id) { // 删除会员 diff --git a/application/common/library/Sms.php b/application/common/library/Sms.php index 59d5f17d..39d3a4b5 100644 --- a/application/common/library/Sms.php +++ b/application/common/library/Sms.php @@ -64,11 +64,18 @@ class Sms /** * 发送通知 * - * @param array $params 参数 + * @param mixed $mobile 手机号,多个以,分隔 + * @param string $msg 消息内容 + * @param string $template 消息模板 * @return boolean */ - public static function notice($params = []) + public static function notice($mobile, $msg = '', $template = NULL) { + $params = [ + 'mobile' => $mobile, + 'msg' => $msg, + 'template' => $template + ]; $result = Hook::listen('sms_notice', $params, null, true); return $result ? TRUE : FALSE; } diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 6b5d49ce..265c87f5 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -23,6 +23,12 @@ class User extends Frontend parent::_initialize(); $auth = $this->auth; + $ucenter = get_addon_info('ucenter'); + if ($ucenter && $ucenter['state']) + { + include ADDON_PATH . 'ucenter' . DS . 'uc.php'; + } + //监听注册登录注销的事件 Hook::add('user_login_successed', function($user) use($auth) { Cookie::set('uid', $user->id); @@ -109,8 +115,7 @@ class User extends Frontend $uc = new \addons\ucenter\library\client\Client(); $synchtml = $uc->uc_user_synregister($this->auth->id, $password); } - $referer = Cookie::get('referer_url'); - $this->success(__('Sign up successful') . $synchtml, $referer); + $this->success(__('Sign up successful') . $synchtml, $url); } else { diff --git a/application/index/lang/zh-cn.php b/application/index/lang/zh-cn.php index fd4cb9ec..2dc29336 100644 --- a/application/index/lang/zh-cn.php +++ b/application/index/lang/zh-cn.php @@ -96,6 +96,7 @@ return [ 'Donation' => '捐赠', 'Forum' => '社区', 'Docs' => '文档', + 'Please login first' => '请登录后再操作', 'Send verification code' => '发磅验证码', 'Redirect now' => '立即跳转', 'Operation completed' => '操作成功!', diff --git a/application/index/lang/zh-cn/user.php b/application/index/lang/zh-cn/user.php index cda5d167..8eae30b0 100644 --- a/application/index/lang/zh-cn/user.php +++ b/application/index/lang/zh-cn/user.php @@ -39,7 +39,7 @@ return [ 'Account can not be empty' => '账户不能为空', 'Username or password is incorrect' => '用户名或密码不正确', 'You are not logged in' => '你当前还未登录', - 'You\'ve logged in, do not login again' => '你已经存在,请不要重复登录', + 'You\'ve logged in, do not login again' => '你已经登录,请不要重复登录', 'Profile' => '个人资料', 'Old password' => '旧密码', 'New password' => '新密码', diff --git a/application/index/view/user/register.html b/application/index/view/user/register.html index 5a7b33d0..cbf43f8c 100644 --- a/application/index/view/user/register.html +++ b/application/index/view/user/register.html @@ -2,7 +2,7 @@