AccountDetail.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. *------Create thems Model------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2017-06-12 05:08:18------
  7. */
  8. namespace App\Api\Model;
  9. use \System\Model;
  10. use Biz\Account\AccountManager;
  11. class AccountDetail extends Model {
  12. protected $table = 'account_detailed';
  13. /**
  14. * 修改用户基本信息
  15. *
  16. * @access public
  17. * @return String
  18. */
  19. public function updateUserInfo()
  20. {
  21. // 获取用户信息
  22. $accountManagerClass = new AccountManager;
  23. $userInfo = $accountManagerClass -> getCurrentUser();
  24. if (empty($userInfo['identity'])) {
  25. Render([], '2001', lang('Common','Api') -> get('user does login'));
  26. }
  27. $updateWhere['account_identity'] = $userInfo['identity'];
  28. $updateData = [];
  29. // 提取修改数据
  30. if (!empty($_POST['email'])) {
  31. $updateData['email'] = $_POST['email'];
  32. }
  33. if (!empty($_POST['phone'])) {
  34. $updateData['phone'] = $_POST['phone'];
  35. }
  36. if (!empty($_POST['img_id'])) {
  37. $updateData['img_id'] = $_POST['img_id'];
  38. }
  39. if (!empty($_POST['name'])) {
  40. $updateData['name'] = $_POST['name'];
  41. }
  42. if (empty($updateData)) {
  43. Render([], '4027', lang('Common','Api') -> get('please enter the modification'));
  44. }
  45. lm('Account_detailed', 'commons') -> updateDetailed($updateWhere, $updateData);
  46. }
  47. }