diff --git a/app/admin/controller/Agreement.php b/app/admin/controller/Agreement.php index 05960ea92..0772b8550 100644 --- a/app/admin/controller/Agreement.php +++ b/app/admin/controller/Agreement.php @@ -52,6 +52,10 @@ class Agreement extends Base [ 'name' => '用户隐私政策', 'type' => 'privacy', + ], + [ + 'name' => '账号注销协议', + 'type' => 'logout', ] ]; $assign['nav_data'] = $nav_data; diff --git a/app/admin/view/default/agreement/logout.html b/app/admin/view/default/agreement/logout.html new file mode 100644 index 000000000..4c943e44f --- /dev/null +++ b/app/admin/view/default/agreement/logout.html @@ -0,0 +1,33 @@ +{{include file="public/header" /}} + + +
+ + {{include file="agreement/nav" /}} + + +
+ +
+
+
+ + 查看详情 +
+ +
+
+ + + + +
+
+ +
+
+ + + +{{include file="public/footer" /}} + \ No newline at end of file diff --git a/app/api/controller/Safety.php b/app/api/controller/Safety.php new file mode 100644 index 000000000..0e37d6137 --- /dev/null +++ b/app/api/controller/Safety.php @@ -0,0 +1,55 @@ +IsLogin(); + } + + /** + * 账号注销 + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-03-28T17:04:36+0800 + */ + public function Logout() + { + $params = $this->data_post; + $params['user'] = $this->user; + return ApiService::ApiDataReturn(SafetyService::AccountsLogout($params)); + } +} +?> \ No newline at end of file diff --git a/app/index/controller/Safety.php b/app/index/controller/Safety.php index f3af65e82..3d2f461f2 100755 --- a/app/index/controller/Safety.php +++ b/app/index/controller/Safety.php @@ -14,6 +14,7 @@ use app\service\ApiService; use app\service\SeoService; use app\service\SafetyService; use app\service\NavigationService; +use app\service\AgreementService; /** * 安全 @@ -155,6 +156,29 @@ class Safety extends Common return MyView(); } + /** + * 账号注销页面 + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-03-28T10:12:20+0800 + */ + public function LogoutInfo() + { + // 协议 + $document = AgreementService::AgreementData(['document'=>'userlogout']); + + // 模板数据 + $assign = [ + // 协议内容 + 'document_data' => $document['data'], + // 浏览器名称 + 'home_seo_site_title' => SeoService::BrowserSeoTitle('账号注销 - 安全设置', 1), + ]; + MyViewAssign($assign); + return MyView(); + } + /** * 验证码显示 * @author Devil @@ -218,7 +242,7 @@ class Safety extends Common } /** - * 账户更新 + * 账号更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -230,5 +254,19 @@ class Safety extends Common $params['user'] = $this->user; return ApiService::ApiDataReturn(SafetyService::AccountsUpdate($params)); } + + /** + * 账号注销 + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-03-28T17:04:36+0800 + */ + public function Logout() + { + $params = $this->data_post; + $params['user'] = $this->user; + return ApiService::ApiDataReturn(SafetyService::AccountsLogout($params)); + } } ?> \ No newline at end of file diff --git a/app/index/view/default/safety/email_info.html b/app/index/view/default/safety/email_info.html index 99dfdec1e..1ce200a42 100755 --- a/app/index/view/default/safety/email_info.html +++ b/app/index/view/default/safety/email_info.html @@ -25,8 +25,8 @@
- 原电子邮箱校验 - 返回 + 原电子邮箱校验 + 返回
diff --git a/app/index/view/default/safety/index.html b/app/index/view/default/safety/index.html index d5a18f9ff..8779d301a 100755 --- a/app/index/view/default/safety/index.html +++ b/app/index/view/default/safety/index.html @@ -23,7 +23,7 @@
{{foreach $safety_panel_list as $v}} -
+

{{$v.title}}

@@ -33,9 +33,11 @@ {{$v.msg}} {{/if}} {{if empty($data[$v['type']]) and !empty($v['tips'])}} - {{$v.no_msg}} + {{if !empty($v['no_msg'])}} + {{$v.no_msg}} + {{/if}} {{else /}} - {{if !empty($data[$v['type']])}} + {{if !empty($v['ok_msg']) and !empty($data[$v['type']])}} {{:str_replace('#accounts#', $data[$v['type']], $v['ok_msg'])}} {{/if}} {{/if}} @@ -43,11 +45,7 @@

{{$v.tips}}

{{/if}}
- {{if empty($data[$v['type']]) and empty($v['msg'])}} - 绑定 - {{else /}} - 修改 - {{/if}} + {{if empty($v['submit_text'])}}{{if empty($data[$v['type']]) and empty($v['msg'])}}绑定{{else /}}修改{{/if}}{{else /}}{{$v.submit_text}}{{/if}}
{{/foreach}} diff --git a/app/index/view/default/safety/login_pwd_info.html b/app/index/view/default/safety/login_pwd_info.html index 737d22e39..4a40b6d4d 100755 --- a/app/index/view/default/safety/login_pwd_info.html +++ b/app/index/view/default/safety/login_pwd_info.html @@ -25,8 +25,8 @@ - 登录密码修改 - 返回 + 登录密码修改 + 返回
diff --git a/app/index/view/default/safety/logout_info.html b/app/index/view/default/safety/logout_info.html new file mode 100644 index 000000000..1dc63bb66 --- /dev/null +++ b/app/index/view/default/safety/logout_info.html @@ -0,0 +1,51 @@ +{{include file="public/header" /}} + + +{{include file="public/header_top_nav" /}} + + +{{include file="public/nav_search" /}} + + +{{include file="public/header_nav" /}} + + +{{include file="public/goods_category" /}} + + +
+ + + {{include file="public/user_menu" /}} + + + +
+
+ + 账号注销 + 返回 + + +
+

{{$document_data.name}}

+

{{$document_data.upd_time_time}}

+
+ +
+
{{$document_data.value|raw}}
+
+ +
+ + 取消 +
+
+
+ +
+ + +{{include file="public/footer" /}} + + \ No newline at end of file diff --git a/app/index/view/default/safety/mobile_info.html b/app/index/view/default/safety/mobile_info.html index da8f963ca..0d5c830d8 100755 --- a/app/index/view/default/safety/mobile_info.html +++ b/app/index/view/default/safety/mobile_info.html @@ -25,8 +25,8 @@ - 原手机号码校验 - 返回 + 原手机号码校验 + 返回
diff --git a/app/index/view/default/safety/new_email_info.html b/app/index/view/default/safety/new_email_info.html index b6c705f5c..8816ece93 100755 --- a/app/index/view/default/safety/new_email_info.html +++ b/app/index/view/default/safety/new_email_info.html @@ -25,8 +25,8 @@ - 新电子邮箱校验 - 返回 + 新电子邮箱校验 + 返回
diff --git a/app/index/view/default/safety/new_mobile_info.html b/app/index/view/default/safety/new_mobile_info.html index 982d0b7e4..a1ca269dd 100755 --- a/app/index/view/default/safety/new_mobile_info.html +++ b/app/index/view/default/safety/new_mobile_info.html @@ -25,8 +25,8 @@ - 新手机号码校验 - 返回 + 新手机号码校验 + 返回
diff --git a/app/lang/zh-cn.php b/app/lang/zh-cn.php index 226b5467b..401fa99ad 100755 --- a/app/lang/zh-cn.php +++ b/app/lang/zh-cn.php @@ -119,6 +119,8 @@ return [ 'loading_success' => '加载成功', 'request_fail' => '请求失败', 'request_success' => '请求成功', + 'logout_fail' => '注销失败', + 'logout_success' => '注销成功', 'no_data' => '没有相关数据', ], ]; diff --git a/app/service/ConfigService.php b/app/service/ConfigService.php index dcb526bdb..fa4e88e30 100755 --- a/app/service/ConfigService.php +++ b/app/service/ConfigService.php @@ -27,12 +27,14 @@ class ConfigService public static $not_cache_field_list = [ 'common_agreement_userregister', 'common_agreement_userprivacy', + 'common_agreement_userlogout', ]; // 富文本,不实例化的字段 public static $rich_text_list = [ 'common_agreement_userregister', 'common_agreement_userprivacy', + 'common_agreement_userlogout', 'common_email_currency_template', 'home_footer_info', 'home_email_user_reg', diff --git a/app/service/NavigationService.php b/app/service/NavigationService.php index b9abfb44e..615f2afc3 100755 --- a/app/service/NavigationService.php +++ b/app/service/NavigationService.php @@ -800,26 +800,33 @@ class NavigationService { $data = [ [ - 'title' => '登录密码', - 'msg' => '互联网存在被盗风险,建议您定期更改密码以保护安全。', - 'url' => MyUrl('index/safety/loginpwdinfo'), - 'type' => 'loginpwd', + 'title' => '登录密码', + 'msg' => '互联网存在被盗风险,建议您定期更改密码以保护安全。', + 'url' => MyUrl('index/safety/loginpwdinfo'), + 'type' => 'loginpwd', ], [ - 'title' => '手机号码', - 'no_msg' => '您还没有绑定手机号码', - 'ok_msg' => '已绑定手机 #accounts#', - 'tips' => '可用于登录,密码找回,账户安全管理校验,接受账户提醒通知。', - 'url' => MyUrl('index/safety/mobileinfo'), - 'type' => 'mobile', + 'title' => '手机号码', + 'no_msg' => '您还没有绑定手机号码', + 'ok_msg' => '已绑定手机 #accounts#', + 'tips' => '可用于登录,密码找回,账户安全管理校验,接受账户提醒通知。', + 'url' => MyUrl('index/safety/mobileinfo'), + 'type' => 'mobile', ], [ - 'title' => '电子邮箱', - 'no_msg' => '您还没有绑定电子邮箱', - 'ok_msg' => '已绑定电子邮箱 #accounts#', - 'tips' => '可用于登录,密码找回,账户安全管理校验,接受账户提醒邮件。', - 'url' => MyUrl('index/safety/emailinfo'), - 'type' => 'email', + 'title' => '电子邮箱', + 'no_msg' => '您还没有绑定电子邮箱', + 'ok_msg' => '已绑定电子邮箱 #accounts#', + 'tips' => '可用于登录,密码找回,账户安全管理校验,接受账户提醒邮件。', + 'url' => MyUrl('index/safety/emailinfo'), + 'type' => 'email', + ], + [ + 'title' => '账号注销', + 'tips' => '不可存在未完成的订单', + 'url' => MyUrl('index/safety/logoutinfo'), + 'type' => 'logout', + 'submit_text' => '注销', ], ]; @@ -937,7 +944,7 @@ class NavigationService [ 'name' => '安全设置', 'url' => MyUrl('index/safety/index'), - 'contains' => ['indexsafetyindex', 'indexsafetyloginpwdinfo', 'indexsafetymobileinfo', 'indexsafetynewmobileinfo', 'indexsafetyemailinfo', 'indexsafetynewemailinfo'], + 'contains' => ['indexsafetyindex', 'indexsafetyloginpwdinfo', 'indexsafetymobileinfo', 'indexsafetynewmobileinfo', 'indexsafetyemailinfo', 'indexsafetynewemailinfo', 'indexsafetylogoutinfo'], 'is_show' => 1, 'icon' => 'am-icon-user-secret', 'is_system' => 1, diff --git a/app/service/SafetyService.php b/app/service/SafetyService.php index 4dab45509..be4b4fea5 100755 --- a/app/service/SafetyService.php +++ b/app/service/SafetyService.php @@ -349,7 +349,7 @@ class SafetyService } /** - * 账户更新 + * 账号更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -455,5 +455,55 @@ class SafetyService } return DataReturn(MyLang('common.operate_fail'), -100); } + + /** + * 账号注销 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-11-20 + * @desc description + * @param [array] $params [输入参数] + */ + public static function AccountsLogout($params = []) + { + // 数据验证 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'user', + 'error_msg' => '用户信息有误', + ], + ]; + $ret = ParamsChecked($params, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // 是否还有未完成的订单 + $where = [ + ['user_id', '=', $params['user']['id']], + ['status', '<=', 3] + ]; + $count = Db::name('Order')->where($where)->count(); + if($count > 0) + { + return DataReturn('存在'.$count.'个订单未完成', -1); + } + + // 账号注销 + $data = [ + 'status' => 2, + 'is_logout_time' => time(), + 'upd_time' => time(), + ]; + if(Db::name('User')->where(['id'=>$params['user']['id']])->update($data)) + { + UserService::Logout(); + return DataReturn(MyLang('common.logout_success'), 0); + } + return DataReturn(MyLang('common.logout_fail'), -1); + } } ?> \ No newline at end of file diff --git a/app/service/SystemBaseService.php b/app/service/SystemBaseService.php index a23c16820..5dd3616e9 100644 --- a/app/service/SystemBaseService.php +++ b/app/service/SystemBaseService.php @@ -45,9 +45,10 @@ class SystemBaseService 'common_site_type' => self::SiteTypeValue(), 'common_shop_notice' => MyC('common_shop_notice', null, true), - // 协议、注册协议、隐私协议 + // 协议、注册协议、隐私协议、注销协议 'agreement_userregister_url' => MyUrl('index/agreement/index', ['document'=>'userregister', 'is_content'=>1]), 'agreement_userprivacy_url' => MyUrl('index/agreement/index', ['document'=>'userprivacy', 'is_content'=>1]), + 'agreement_userlogout_url' => MyUrl('index/agreement/index', ['document'=>'userlogout', 'is_content'=>1]), // 手机端相关配置 'common_app_is_enable_search' => (int) MyC('common_app_is_enable_search', 1), diff --git a/app/service/UserService.php b/app/service/UserService.php index d571f8816..7b3bb22f5 100755 --- a/app/service/UserService.php +++ b/app/service/UserService.php @@ -2202,11 +2202,12 @@ class UserService { return ''; } - + $where = [ ['system_type', '=', SystemService::SystemTypeValue()], [$where_field, '=', $where_value], ['is_delete_time', '=', 0], + ['is_logout_time', '=', 0], ]; return Db::name('User')->where($where)->field($field)->find(); } @@ -2444,13 +2445,13 @@ class UserService // 手机号码格式 if(!CheckMobile($params['mobile'])) { - return DataReturn('手机号码格式错误', -2); + return DataReturn('手机号码格式错误', -2); } // 验证码校验 $verify_params = [ - 'key_prefix' => 'user_bind_'.md5($params['mobile']), - 'expire_time' => MyC('common_verify_expire_time') + 'key_prefix' => 'user_bind_'.md5($params['mobile']), + 'expire_time' => MyC('common_verify_expire_time') ]; $obj = new \base\Sms($verify_params); diff --git a/public/static/app/yellow/common/gear-icon.png b/public/static/app/yellow/common/gear-icon.png new file mode 100644 index 000000000..0a21681d0 Binary files /dev/null and b/public/static/app/yellow/common/gear-icon.png differ diff --git a/public/static/app/yellow/common/notification-icon.png b/public/static/app/yellow/common/notification-icon.png new file mode 100644 index 000000000..dd526dc70 Binary files /dev/null and b/public/static/app/yellow/common/notification-icon.png differ diff --git a/public/static/app/yellow/common/qrcode-icon.png b/public/static/app/yellow/common/qrcode-icon.png new file mode 100644 index 000000000..1fdb28af8 Binary files /dev/null and b/public/static/app/yellow/common/qrcode-icon.png differ diff --git a/public/static/index/default/css/common.css b/public/static/index/default/css/common.css index d45ceb02d..02e0b8ce5 100755 --- a/public/static/index/default/css/common.css +++ b/public/static/index/default/css/common.css @@ -1012,6 +1012,7 @@ legend .legend-title { legend a.am-fr { color: #e7747f; margin-top: 10px; + text-decoration: none; } .items-value-empty { color: #999; diff --git a/public/static/index/default/css/safety.css b/public/static/index/default/css/safety.css index 45db8060a..c4c7c73b1 100755 --- a/public/static/index/default/css/safety.css +++ b/public/static/index/default/css/safety.css @@ -13,14 +13,9 @@ .user-content-body #verify-win .am-modal-bd .base .verify-tips { font-size: 12px; } .user-content-body #verify-img { vertical-align: middle; border: 1px solid #ccc; } -.user-content-body legend { - padding-bottom: 0.2rem; - margin-bottom: 1rem; - border-bottom: 1px solid #e5e5e5; -} -.user-content-body .legend-title { - font-size: 16px; -} -.user-content-body a { - color: #e7747f; +/** + * 协议内容 + */ +.user-content-body .document-content { + height: 350px; } \ No newline at end of file