UserInfo.php 918 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use app\common\model\UserRemark;
  5. use app\common\library\Keyworld;
  6. use think\Db;
  7. /**
  8. *
  9. */
  10. class UserInfo extends Api
  11. {
  12. protected $noNeedLogin = [];
  13. protected $noNeedRight = '*';
  14. // 设置备注
  15. public function setRemark()
  16. {
  17. $params = $this->request->param();
  18. $user_id = $this->auth->id;
  19. if (empty($params['to_user_id'])) {
  20. return $this->error('参数缺失');
  21. }
  22. $model = new UserRemark();
  23. if (!empty($params['remark'])) {
  24. [$res, $msg] = $model->setRemark($user_id, $params['to_user_id'], Keyworld::sensitive($params['remark']));
  25. } else {
  26. [$res, $msg] = $model->delRemark($user_id, $params['to_user_id']);
  27. }
  28. if (!$res) {
  29. return $this->error($msg);
  30. }
  31. return $this->success($msg);
  32. }
  33. }