| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- /**
- *------Create thems Model------
- *------SCWPHP Version 1.0.0------
- *------Dev Model Jions------
- *------Create Time 2017-06-12 05:08:18------
- */
- namespace App\Api\Model;
- use \System\Model;
- use Biz\Account\AccountManager;
- class AccountDetail extends Model {
- protected $table = 'account_detailed';
- /**
- * 修改用户基本信息
- *
- * @access public
- * @return String
- */
- public function updateUserInfo()
- {
- // 获取用户信息
- $accountManagerClass = new AccountManager;
- $userInfo = $accountManagerClass -> getCurrentUser();
- if (empty($userInfo['identity'])) {
- Render([], '2001', lang('Common','Api') -> get('user does login'));
- }
- $updateWhere['account_identity'] = $userInfo['identity'];
- $updateData = [];
- // 提取修改数据
- if (!empty($_POST['email'])) {
- $updateData['email'] = $_POST['email'];
- }
- if (!empty($_POST['phone'])) {
- $updateData['phone'] = $_POST['phone'];
- }
- if (!empty($_POST['img_id'])) {
- $updateData['img_id'] = $_POST['img_id'];
- $updateData['img_url'] = '';
- }
- if (!empty($_POST['name'])) {
- $updateData['name'] = $_POST['name'];
- }
- if (empty($updateData)) {
- Render([], '4027', lang('Common','Api') -> get('please enter the modification'));
- }
- return lm('Account_detailed', 'commons') -> updateDetailed($updateWhere, $updateData);
- }
- /**
- * 上传用户基本信息头像
- *
- * @access public
- * @return String
- */
- public function updateHeader()
- {
- // 获取用户信息
- $accountManagerClass = new AccountManager;
- $userInfo = $accountManagerClass -> getCurrentUser();
- if (empty($userInfo['identity'])) {
- Render([], '2001', lang('Common','Api') -> get('user does login'));
- }
- $updateWhere['account_identity'] = $userInfo['identity'];
- $avatar = $request->file('avatar')->store('/public/' . date('Y-m-d') . '/avatars');
- echo json_encode($input);die;
- $updateData = [];
- // 提取修改数据
- if (!empty($_POST['email'])) {
- $updateData['email'] = $_POST['email'];
- }
- if (!empty($_POST['phone'])) {
- $updateData['phone'] = $_POST['phone'];
- }
- if (!empty($_POST['img_id'])) {
- $updateData['img_id'] = $_POST['img_id'];
- $updateData['img_url'] = '';
- }
- if (!empty($_POST['name'])) {
- $updateData['name'] = $_POST['name'];
- }
- if (empty($updateData)) {
- Render([], '4027', lang('Common','Api') -> get('please enter the modification'));
- }
- return lm('Account_detailed', 'commons') -> updateDetailed($updateWhere, $updateData);
- }
- }
|