|
@@ -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();
|