|
@@ -26,7 +26,7 @@ class InspectionAuth
|
|
//默认配置
|
|
//默认配置
|
|
protected $config = [];
|
|
protected $config = [];
|
|
protected $options = [];
|
|
protected $options = [];
|
|
- protected $allowFields = ['id', 'user_id', 'name', 'phone', 'supplier_id', 'audit_status', 'status', 'region_full', 'address'];
|
|
|
|
|
|
+ protected $allowFields = ['id', 'user_id', 'name', 'phone', 'supplier_id', 'audit_status', 'status', 'region_full', 'address', 'avatar'];
|
|
|
|
|
|
public function __construct($options = [])
|
|
public function __construct($options = [])
|
|
{
|
|
{
|
|
@@ -462,6 +462,43 @@ class InspectionAuth
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 更新头像
|
|
|
|
+ * @param string $avatar 头像路径
|
|
|
|
+ * @return boolean
|
|
|
|
+ */
|
|
|
|
+ public function updateAvatar($avatar)
|
|
|
|
+ {
|
|
|
|
+ if (!$this->_logined) {
|
|
|
|
+ $this->setError('您尚未登录');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ $this->_application->avatar = $avatar;
|
|
|
|
+ $this->_application->save();
|
|
|
|
+
|
|
|
|
+ //更新头像成功的事件
|
|
|
|
+ Hook::listen("inspection_update_avatar_successed", $this->_application);
|
|
|
|
+ return true;
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
+ $this->setError($e->getMessage());
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取头像完整URL
|
|
|
|
+ * @return string
|
|
|
|
+ */
|
|
|
|
+ public function getAvatar()
|
|
|
|
+ {
|
|
|
|
+ if (!$this->_application || !$this->_application->avatar) {
|
|
|
|
+ return '';
|
|
|
|
+ }
|
|
|
|
+ return cdnurl($this->_application->avatar, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 获取密码加密后的字符串
|
|
* 获取密码加密后的字符串
|
|
* @param string $password 密码
|
|
* @param string $password 密码
|
|
* @param string $salt 密码盐
|
|
* @param string $salt 密码盐
|