Browse Source

完善审核

15954078560 3 years ago
parent
commit
9eb86236cc

+ 79 - 9
application/admin/controller/applys/Avatar.php

@@ -91,25 +91,95 @@ class Avatar extends Backend
         }
         if ($this->request->isPost()) {
             $params = $this->request->post("row/a");
+            $params['status'] = 1;
             if ($params) {
                 $params = $this->preExcludeFields($params);
                 $result = false;
                 Db::startTrans();
                 try {
-                    if($row['status'] == 0 && $row['status'] != $params['status']) {
-                        if($params['status'] == 1) {
-                            \app\common\model\User::update(['avatar'=>$params['avatar']],['id'=>$params['user_id']]);
+//                    if($row['status'] == 0 && $row['status'] != $params['status']) {
+//                        if($params['status'] == 1) {
+                            \app\common\model\User::update(['avatar'=>$row['avatar']],['id'=>$row['user_id']]);
                             $title = '头像审核成功!';
                             $content = '恭喜您,您的头像修改审核成功!';
                             \app\common\model\SysMsg::sendSysMsg($row['user_id'],2,$title,$content);
-                        }
-                        if($params['status'] == -1) {
-                            \app\common\model\User::update(['avatar'=>$params['old_avatar']],['id'=>$params['user_id']]);
+//                        }
+//                        if($params['status'] == -1) {
+//                            \app\common\model\User::update(['avatar'=>$params['old_avatar']],['id'=>$params['user_id']]);
+//                            $title = '头像审核失败!';
+//                            $content = '非常抱歉,您的头像由于不符合平台规范,管理员已审核拒绝!';
+//                            \app\common\model\SysMsg::sendSysMsg($row['user_id'],2,$title,$content);
+//                        }
+//                    }
+
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                        $row->validateFailException(true)->validate($validate);
+                    }
+                    $result = $row->allowField(true)->save($params);
+                    delUserInfo($row['user_id']);
+                    Db::commit();
+                } catch (ValidateException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (PDOException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were updated'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 拒绝
+     */
+    public function del($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $params['status'] = -1;
+            if ($params) {
+                $params = $this->preExcludeFields($params);
+                $result = false;
+                Db::startTrans();
+                try {
+//                    if($row['status'] == 0 && $row['status'] != $params['status']) {
+//                        if($params['status'] == 1) {
+//                            \app\common\model\User::update(['avatar'=>$params['avatar']],['id'=>$params['user_id']]);
+//                            $title = '头像审核成功!';
+//                            $content = '恭喜您,您的头像修改审核成功!';
+//                            \app\common\model\SysMsg::sendSysMsg($row['user_id'],2,$title,$content);
+//                        }
+//                        if($params['status'] == -1) {
+                            \app\common\model\User::update(['avatar'=>$row['old_avatar']],['id'=>$row['user_id']]);
                             $title = '头像审核失败!';
                             $content = '非常抱歉,您的头像由于不符合平台规范,管理员已审核拒绝!';
                             \app\common\model\SysMsg::sendSysMsg($row['user_id'],2,$title,$content);
-                        }
-                    }
+//                        }
+//                    }
 
                     //是否采用模型验证
                     if ($this->modelValidate) {
@@ -118,7 +188,7 @@ class Avatar extends Backend
                         $row->validateFailException(true)->validate($validate);
                     }
                     $result = $row->allowField(true)->save($params);
-                    delUserInfo($params['user_id']);
+                    delUserInfo($row['user_id']);
                     Db::commit();
                 } catch (ValidateException $e) {
                     Db::rollback();

+ 78 - 8
application/admin/controller/applys/Declarationauth.php

@@ -89,25 +89,95 @@ class Declarationauth extends Backend
         }
         if ($this->request->isPost()) {
             $params = $this->request->post("row/a");
+            $params['status'] = 1;
             if ($params) {
                 $params = $this->preExcludeFields($params);
                 $result = false;
                 Db::startTrans();
                 try {
-                    if($row['status'] == 0 && $row['status'] != $params['status']) {
-                        if($params['status'] == 1) {
-                            \app\common\model\User::update(['declaration'=>$params['declaration']],['id'=>$params['user_id']]);
+//                    if($row['status'] == 0 && $row['status'] != $params['status']) {
+//                        if($params['status'] == 1) {
+                            \app\common\model\User::update(['declaration'=>$row['declaration']],['id'=>$row['user_id']]);
                             $title = '交友宣言审核成功!';
                             $content = '恭喜您,您的交友宣言修改审核成功!';
                             \app\common\model\SysMsg::sendSysMsg($row['user_id'],8,$title,$content);
-                        }
-                        if($params['status'] == -1) {
+//                        }
+//                        if($params['status'] == -1) {
 //                            \app\common\model\User::update(['declaration'=>$params['old_declaration']],['id'=>$params['user_id']]);
+//                            $title = '交友宣言审核失败!';
+//                            $content = '非常抱歉,您的交友宣言由于不符合平台规范,管理员已审核拒绝!';
+//                            \app\common\model\SysMsg::sendSysMsg($row['user_id'],8,$title,$content);
+//                        }
+//                    }
+
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                        $row->validateFailException(true)->validate($validate);
+                    }
+                    $result = $row->allowField(true)->save($params);
+                    delUserInfo($row['user_id']);
+                    Db::commit();
+                } catch (ValidateException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (PDOException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were updated'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 拒绝
+     */
+    public function del($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $params['status'] = -1;
+            if ($params) {
+                $params = $this->preExcludeFields($params);
+                $result = false;
+                Db::startTrans();
+                try {
+//                    if($row['status'] == 0 && $row['status'] != $params['status']) {
+//                        if($params['status'] == 1) {
+//                            \app\common\model\User::update(['declaration'=>$params['declaration']],['id'=>$params['user_id']]);
+//                            $title = '交友宣言审核成功!';
+//                            $content = '恭喜您,您的交友宣言修改审核成功!';
+//                            \app\common\model\SysMsg::sendSysMsg($row['user_id'],8,$title,$content);
+//                        }
+//                        if($params['status'] == -1) {
+                            \app\common\model\User::update(['declaration'=>$row['old_declaration']],['id'=>$row['user_id']]);
                             $title = '交友宣言审核失败!';
                             $content = '非常抱歉,您的交友宣言由于不符合平台规范,管理员已审核拒绝!';
                             \app\common\model\SysMsg::sendSysMsg($row['user_id'],8,$title,$content);
-                        }
-                    }
+//                        }
+//                    }
 
                     //是否采用模型验证
                     if ($this->modelValidate) {
@@ -116,7 +186,7 @@ class Declarationauth extends Backend
                         $row->validateFailException(true)->validate($validate);
                     }
                     $result = $row->allowField(true)->save($params);
-                    delUserInfo($params['user_id']);
+                    delUserInfo($row['user_id']);
                     Db::commit();
                 } catch (ValidateException $e) {
                     Db::rollback();

+ 78 - 9
application/admin/controller/applys/Wechat.php

@@ -91,24 +91,94 @@ class Wechat extends Backend
         }
         if ($this->request->isPost()) {
             $params = $this->request->post("row/a");
+            $params['status'] = 1;
             if ($params) {
                 $params = $this->preExcludeFields($params);
                 $result = false;
                 Db::startTrans();
                 try {
-                    if($row['status'] == 0) {
-                        if($params['status'] == 1) {
+//                    if($row['status'] == 0) {
+//                        if($params['status'] == 1) {
                             $title = '微信号审核成功!';
                             $content = '恭喜您,您的微信号修改审核成功!';
                             \app\common\model\SysMsg::sendSysMsg($row['user_id'],1,$title,$content);
-                            \app\common\model\User::update(['wechat'=>$params['wechat']],['id'=>$row['user_id']]);
-                        }
-                        if($params['status'] == 0) {
+                            \app\common\model\User::update(['wechat'=>$row['wechat']],['id'=>$row['user_id']]);
+//                        }
+//                        if($params['status'] == -1) {
+//                            $title = '微信号审核失败!';
+//                            $content = '非常抱歉,您的微信号由于查询不到具体微信账号,管理员已审核拒绝!';
+//                            \app\common\model\SysMsg::sendSysMsg($row['user_id'],1,$title,$content);
+//                        }
+//                    }
+
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                        $row->validateFailException(true)->validate($validate);
+                    }
+                    $result = $row->allowField(true)->save($params);
+                    delUserInfo($row['user_id']);
+                    Db::commit();
+                } catch (ValidateException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (PDOException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were updated'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 拒绝
+     */
+    public function del($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $params['status'] = -1;
+            if ($params) {
+                $params = $this->preExcludeFields($params);
+                $result = false;
+                Db::startTrans();
+                try {
+//                    if($row['status'] == 0) {
+//                        if($params['status'] == 1) {
+//                            $title = '微信号审核成功!';
+//                            $content = '恭喜您,您的微信号修改审核成功!';
+//                            \app\common\model\SysMsg::sendSysMsg($row['user_id'],1,$title,$content);
+//                            \app\common\model\User::update(['wechat'=>$params['wechat']],['id'=>$row['user_id']]);
+//                        }
+//                        if($params['status'] == -1) {
                             $title = '微信号审核失败!';
                             $content = '非常抱歉,您的微信号由于查询不到具体微信账号,管理员已审核拒绝!';
                             \app\common\model\SysMsg::sendSysMsg($row['user_id'],1,$title,$content);
-                        }
-                    }
+                            \app\common\model\User::update(['wechat'=>$row['old_wechat']],['id'=>$row['user_id']]);
+//                        }
+//                    }
 
                     //是否采用模型验证
                     if ($this->modelValidate) {
@@ -117,7 +187,7 @@ class Wechat extends Backend
                         $row->validateFailException(true)->validate($validate);
                     }
                     $result = $row->allowField(true)->save($params);
-                    delUserInfo($params['user_id']);
+                    delUserInfo($row['user_id']);
                     Db::commit();
                 } catch (ValidateException $e) {
                     Db::rollback();
@@ -140,5 +210,4 @@ class Wechat extends Backend
         $this->view->assign("row", $row);
         return $this->view->fetch();
     }
-
 }

+ 10 - 4
public/assets/js/backend/applys/avatar.js

@@ -40,16 +40,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     name: 'edit',
                                     text: '同意',
                                     icon: 'fa fa-pencil',
-                                    title: __('Edit'),
+                                    title: __('同意'),
                                     extend: 'data-toggle="tooltip"',
-                                    classname: 'btn btn-xs btn-success btn-editone'
+                                    classname: 'btn btn-xs btn-success btn-ajax',
+                                    // confirm: '确认通过?',
+                                    url: 'applys/avatar/edit',
+                                    refresh: true,
                                 }, {
                                     name: 'del',
                                     text: '拒绝',
                                     icon: 'fa fa-trash',
-                                    title: __('Del'),
+                                    title: __('拒绝'),
                                     extend: 'data-toggle="tooltip"',
-                                    classname: 'btn btn-xs btn-danger btn-delone'
+                                    classname: 'btn btn-xs btn-danger btn-ajax',
+                                    // confirm: '确认拒绝?',
+                                    url: 'applys/avatar/del',
+                                    refresh: true,
                                 },
                             ]}
                     ]

+ 10 - 4
public/assets/js/backend/applys/declarationauth.js

@@ -40,16 +40,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     name: 'edit',
                                     text: '同意',
                                     icon: 'fa fa-pencil',
-                                    title: __('Edit'),
+                                    title: __('同意'),
                                     extend: 'data-toggle="tooltip"',
-                                    classname: 'btn btn-xs btn-success btn-editone'
+                                    classname: 'btn btn-xs btn-success btn-ajax',
+                                    // confirm: '确认通过?',
+                                    url: 'applys/declarationauth/edit',
+                                    refresh: true,
                                 }, {
                                     name: 'del',
                                     text: '拒绝',
                                     icon: 'fa fa-trash',
-                                    title: __('Del'),
+                                    title: __('拒绝'),
                                     extend: 'data-toggle="tooltip"',
-                                    classname: 'btn btn-xs btn-danger btn-delone'
+                                    classname: 'btn btn-xs btn-danger btn-ajax',
+                                    // confirm: '确认拒绝?',
+                                    url: 'applys/declarationauth/del',
+                                    refresh: true,
                                 },
                             ]
 

+ 2 - 2
public/assets/js/backend/applys/nickname.js

@@ -42,7 +42,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     title: __('同意'),
                                     extend: 'data-toggle="tooltip"',
                                     classname: 'btn btn-xs btn-success btn-ajax',
-                                    confirm: '确认通过?',
+                                    // confirm: '确认通过?',
                                     url: 'applys/nickname/edit',
                                     refresh: true,
                                 }, {
@@ -52,7 +52,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     title: __('拒绝'),
                                     extend: 'data-toggle="tooltip"',
                                     classname: 'btn btn-xs btn-danger btn-ajax',
-                                    confirm: '确认拒绝?',
+                                    // confirm: '确认拒绝?',
                                     url: 'applys/nickname/del',
                                     refresh: true,
                                 },

+ 10 - 4
public/assets/js/backend/applys/wechat.js

@@ -40,16 +40,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     name: 'edit',
                                     text: '同意',
                                     icon: 'fa fa-pencil',
-                                    title: __('Edit'),
+                                    title: __('同意'),
                                     extend: 'data-toggle="tooltip"',
-                                    classname: 'btn btn-xs btn-success btn-editone'
+                                    classname: 'btn btn-xs btn-success btn-ajax',
+                                    // confirm: '确认通过?',
+                                    url: 'applys/wechat/edit',
+                                    refresh: true,
                                 }, {
                                     name: 'del',
                                     text: '拒绝',
                                     icon: 'fa fa-trash',
-                                    title: __('Del'),
+                                    title: __('拒绝'),
                                     extend: 'data-toggle="tooltip"',
-                                    classname: 'btn btn-xs btn-danger btn-delone'
+                                    classname: 'btn btn-xs btn-danger btn-ajax',
+                                    // confirm: '确认拒绝?',
+                                    url: 'applys/wechat/del',
+                                    refresh: true,
                                 },
                             ]
                         }