Record: 更新当前用户资料

@param array|\ArrayAccess $data
@return array
194486
public function updateData($data)
    {
        $isMobileVerified = $this->isMobileVerified();

        $validator = wei()->validate([
            'data' => $data,
            'rules' => [
                'mobile' => [
                    'required' => !$isMobileVerified,
                    'mobileCn' => true,
                ],
                'name' => [
                    'required' => false,
                ],
                'address' => [
                    'required' => false,
                    'minLength' => 3,
                ],
            ],
            'names' => [
                'mobile' => '手机号码',
                'name' => '姓名',
                'address' => '详细地址',
            ],
        ]);
        if (!$validator->isValid()) {
            return $this->err($validator->getFirstMessage());
        }

        if (!$isMobileVerified) {
            // 手机号未认证时,检查手机号,根据配置检查是否重复
            if (wei()->setting('user.check_mobile_unique') && $this->isMobileExists($data['mobile'])) {
                return $this->err('手机号码已存在');
            }
            $this['mobile'] = $data['mobile'];
        }

        $result = $this->event->until('preUserUpdate', [$data, $this]);
        if ($result) {
            return $result;
        }

        $this->save([
            'name' => $data['name'],
            'address' => $data['address'],
        ]);

        return $this->suc();
    }
460921
public function updateOrInsert($data)
    {
        if ($this->first()) {
            return $this->update($data);
        } else {
            return $this->insert($data);
        }
    }
28164
public function updateWhereData($data) {
        $this->performed = false;
        $this->whereData = array_merge($this->whereData, $data);

        return $this;
    }
639762
public function updateDepartment(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_DEPARTMENT_CREATE_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'];
    }
1339131
public function update(array $data)
    {
        if (empty($data)) {
            return null;
        }

        if (!array_key_exists('id', $data) || !array_key_exists('email', $data)) {
            return null;
        }

        $data['api_action'] = 'contact_edit';
        $response = $this->request($data, 'POST');

        if ($response === null || $response->getStatusCode() !== 200) {
            return null;
        }

        $json = $response->getBody()->getContents();

        return $this->serializer->deserialize(
            $this->removeResultInformation($json),
            \FondOfPHP\ActiveCampaign\DataTransferObject\Contact::class,
            'json'
        );
    }
810427
public function update($id, array $data)
    {
        $model = $this->model->find($id);
        $model->fill($data);
        $model->save();

        return $model;
    }
242003
public function update($q, $data)
    {
        $q['table'] = $this->table;
        return $this->db->update($q, $data);
    }
798777
public function update(array $data)
    {
        $this->compileData($data);
        $arguments      = $this->arguments;
        $sql            = 'UPDATE '.$this->getFrom().' SET '.$this->setString;
        //设置了条件
        if ($this->condition->count() > 0) {
            $whereStr       = (string)$this->condition->compile();
            $whereArguments = $this->condition->arguments();
            $sql            = $sql.' where '.$whereStr;
            $arguments      = ArrayLib::array_add($arguments, $whereArguments);
        }
        return $this->connection->executeUpdate($sql, $arguments);
    }
422017
final public function update(array $data)
    {
        $this->query->setStartUpdate($data);

        $this->query->prepare()->bindSetForUpdate($data)->bindWhere()->bindLimit()->execute();

        $this->setRowCount();

        $this->query->close();
    }
545578
public function update(array $data)
    {
        return $this->forge->updateMysqlDatabase($this->serverId, $this->id, $data);
    }
1207321
public function update(array $data)
    {
        $template = Basecamp::templates()->update($this->id, $data);

        $this->setAttributes($template);

        return $template;
    }
980584
private function prepareDataForUpdate(array $data)
	{
		$result = array();
		foreach ($data as $key => $value) {
			$result[$key] = array(
				'Action' => AttributeAction::PUT,
				'Value' => array(
					$this->getValueType($value) => $value
				)
			);
		}
		Debugger::barDump($result);
		return $result;
	}
749520
public function update($data = null): IResult
    {
        $query = static::query($this);
        $query = $this->parseWhereId($query);
        if(null === $data)
        {
            $data = static::parseSaveData($this);
        }
        else if(!$data instanceof \ArrayAccess)
        {
            $data = new LazyArrayObject($data);
        }

        // 更新前
        $this->trigger(ModelEvents::BEFORE_UPDATE, [
            'model' => $this,
            'data'  => $data,
            'query' => $query,
        ], $this, \Imi\Model\Event\Param\BeforeUpdateEventParam::class);

        if(!isset($query->getOption()->where[0]))
        {
            throw new \RuntimeException('use Model->update(), primary key can not be null');
        }

        $result = $query->update($data);

        // 更新后
        $this->trigger(ModelEvents::AFTER_UPDATE, [
            'model' => $this,
            'data'  => $data,
            'result'=> $result,
        ], $this, \Imi\Model\Event\Param\AfterUpdateEventParam::class);

        // 子模型更新
        ModelRelationManager::updateModel($this);

        return $result;
    }
1107865
public function update($data = null)
    {
        $fields = $this->getFields();
        $sql1 = '';
        $args = array();
        foreach ($fields as $field) {
            if (in_array($field, $this->updated_at_fileds)) {
                $this->{$field} = now();
            }
            $value = $this->getFieldValue($field, $data);
            if (isset($value) && !$this->isIndex($field)) {
                $args[] = $value;
                $sql1 .= "`$field` = ?, ";
            }
        }
        if (!empty($sql1)) {
            $sql1 = substr($sql1, 0, -2);
            $index = $this->getIndex();
            $indexValue = $this->db->escape_string($this->getFieldValue($index, $data));
            if (!$indexValue) {
                return false;
            }
            $args[] = $indexValue;
            return $this->db->exec("UPDATE `{$this->table_name}` SET $sql1 WHERE `$index` = ?", $args, $this->getCacheId($indexValue));
        }
        return false;
    }
1139892
public function updateProduct(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_PRODUCT_UPDATE_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success';
    }
976730
protected function _insert(array $data = array())
    {
        if (!is_null($this->_table)) {
            $this->_affectedRows = $this->_db->insert($this->_table, $data);
            if ($this->_affectedRows > 0) {
                $this->id = $this->_db->lastInsertId();
            }
            return $this->_affectedRows;
        }
    }
964831
public function update(array $data): int
    {
        $row = $this->queryRelate->getQuery()->update($data);

        $this->resetQueryRelate();

        return $row;
    }