后台权限点

@param array $data 数组
@return array
966432
public function getCommonRoleUri($data)
    {
        $data['manageHookIndex'] = [
            'name' => hst_lang('hstcms::public.manage'),
            'remark' => 'HOOK',
            'ename' => 'manageHookIndex',
            'uri' => 'hook',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookAdd'] = [
            'name' => hst_lang('hstcms::public.add'),
            'remark' => 'HOOK',
            'ename' => 'manageHookAdd',
            'uri' => 'hook/add',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookAddSave'] = [
            'name' => hst_lang('hstcms::public.add', 'hstcms::public.save'),
            'remark' => 'HOOK',
            'ename' => 'manageHookAddSave',
            'uri' => 'hook/add/save',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookEdit'] = [
            'name' => hst_lang('hstcms::public.edit'),
            'remark' => 'HOOK',
            'ename' => 'manageHookEdit',
            'uri' => 'hook/edit/{name}',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookEditSave'] = [
            'name' => hst_lang('hstcms::public.edit', 'hstcms::public.save'),
            'remark' => 'HOOK',
            'ename' => 'manageHookEditSave',
            'uri' => 'hook/edit/save',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookDelete'] = [
            'name' => hst_lang('hstcms::public.delete'),
            'remark' => 'HOOK',
            'ename' => 'manageHookDelete',
            'uri' => 'hook/delete/{name}',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookCache'] = [
            'name' => hst_lang('hstcms::public.cache'),
            'remark' => 'HOOK',
            'ename' => 'manageHookCache',
            'uri' => 'hook/cache',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookInjectIndex'] = [
            'name' => hst_lang('hstcms::public.manage'),
            'remark' => 'Hook Inject',
            'ename' => 'manageHookInjectIndex',
            'uri' => 'hook/inject/{name}',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookInjectIndex'] = [
            'name' => hst_lang('hstcms::public.add'),
            'remark' => 'Hook Inject',
            'ename' => 'manageHookInjectIndex',
            'uri' => 'hook/inject/{name}/add',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookInjectIndex'] = [
            'name' => hst_lang('hstcms::public.add', 'hstcms::public.save'),
            'remark' => 'Hook Inject',
            'ename' => 'manageHookInjectIndex',
            'uri' => 'hook/inject/{name}/add/save',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookInjectIndex'] = [
            'name' => hst_lang('hstcms::public.edit'),
            'remark' => 'Hook Inject',
            'ename' => 'manageHookInjectIndex',
            'uri' => 'hook/inject/{name}/edit/{id}',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookInjectIndex'] = [
            'name' => hst_lang('hstcms::public.edit', 'hstcms::public.save'),
            'remark' => 'Hook Inject',
            'ename' => 'manageHookInjectIndex',
            'uri' => 'hook/inject/{name}/edit/save',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageHookInjectDelete'] = [
            'name' => hst_lang('hstcms::public.delete'),
            'remark' => 'Hook Inject',
            'ename' => 'manageHookInjectDelete',
            'uri' => 'hook/inject/{name}/delete/{id}',
            'parent' => 'manageHookIndex',
            'module' => 'manage'
        ];
        $data['manageSms'] = [
            'name' => hst_lang('hstcms::manage.sms.service'),
            'remark' => 'hstcms',
            'ename' => 'manageSms',
            'uri' => 'sms',
            'parent' => 'manageSms',
            'module' => 'hstcms'
        ];
        $data['manageSmsSave'] = [
            'name' => hst_lang('hstcms::manage.sms.service').hst_lang('hstcms::public.save'),
            'remark' => 'hstcms',
            'ename' => 'manageSmsSave',
            'uri' => 'sms/save',
            'parent' => 'manageSms',
            'module' => 'hstcms'
        ];
        $data['manageAttach'] = [
            'name' => hst_lang('hstcms::manage.attach.service'),
            'remark' => 'hstcms',
            'ename' => 'manageAttach',
            'uri' => 'attachments',
            'parent' => 'manageAttach',
            'module' => 'hstcms'
        ];
        $data['manageAttachSave'] = [
            'name' => hst_lang('hstcms::manage.attach.service').hst_lang('hstcms::public.save'),
            'remark' => 'hstcms',
            'ename' => 'manageAttachSave',
            'uri' => 'attachments/save',
            'parent' => 'manageAttach',
            'module' => 'hstcms'
        ];
        $data['manageApi'] = [
            'name' => hst_lang('hstcms::manage.api.service'),
            'remark' => 'hstcms',
            'ename' => 'manageApi',
            'uri' => 'api',
            'parent' => 'manageApi',
            'module' => 'hstcms'
        ];
        $data['manageApiSave'] = [
            'name' => hst_lang('hstcms::manage.api.service').hst_lang('hstcms::public.save'),
            'remark' => 'hstcms',
            'ename' => 'manageApiSave',
            'uri' => 'api/save',
            'parent' => 'manageApi',
            'module' => 'hstcms'
        ];
        $data['manageConfigIndex'] = [
            'name' => hst_lang('hstcms::manage.config.site'),
            'remark' => 'hstcms',
            'ename' => 'manageConfigIndex',
            'uri' => 'index',
            'parent' => 'manageConfigIndex',
            'module' => 'hstcms'
        ];
        $data['mymanageConfigSave'] = [
            'name' => hst_lang('hstcms::manage.config.site').hst_lang('hstcms::public.save'),
            'remark' => 'hstcms',
            'ename' => 'mymanageConfigSave',
            'uri' => 'save',
            'parent' => 'manageConfigIndex',
            'module' => 'hstcms'
        ];
        $data['manageConfigGlobal'] = [
            'name' => hst_lang('hstcms::manage.config.global'),
            'remark' => 'hstcms',
            'ename' => 'manageConfigGlobal',
            'uri' => 'index',
            'parent' => 'manageConfigGlobal',
            'module' => 'hstcms'
        ];
        $data['manageConfigGlobalSave'] = [
            'name' => hst_lang('hstcms::manage.config.global').hst_lang('hstcms::public.save'),
            'remark' => 'hstcms',
            'ename' => 'manageConfigGlobalSave',
            'uri' => 'index',
            'parent' => 'manageConfigGlobal',
            'module' => 'hstcms'
        ];
        $data['manageModules'] = [
            'name' => hst_lang('hstcms::public.manage'),
            'remark' => 'hstcms',
            'ename' => 'manageModules',
            'uri' => 'modules',
            'parent' => 'manageModules',
            'module' => 'hstcms'
        ];
        $data['manageModulesUninstalls'] = [
            'name' => hst_lang('hstcms::manage.modules.uninstalls'),
            'remark' => 'hstcms',
            'ename' => 'manageModulesUninstalls',
            'uri' => 'modules/uninstalls',
            'parent' => 'manageModules',
            'module' => 'hstcms'
        ];
        $data['manageModulesDoinstalls'] = [
            'name' => hst_lang('hstcms::public.install'),
            'remark' => 'hstcms',
            'ename' => 'manageModulesDoinstalls',
            'uri' => 'modules/doinstalls',
            'parent' => 'manageModules',
            'module' => 'hstcms'
        ];
        $data['manageModulesEnableds'] = [
            'name' => hst_lang('hstcms::public.operation'),
            'remark' => 'hstcms',
            'ename' => 'manageModulesEnableds',
            'uri' => 'modules/enableds',
            'parent' => 'manageModules',
            'module' => 'hstcms'
        ];
        $data['manageModulesDouninstall'] = [
            'name' => hst_lang('hstcms::public.uninstall'),
            'remark' => 'hstcms',
            'ename' => 'manageModulesDouninstall',
            'uri' => 'modules/douninstall',
            'parent' => 'manageModules',
            'module' => 'hstcms'
        ];
        $data['manageModulesCache'] = [
            'name' => hst_lang('hstcms::public.cache'),
            'remark' => 'hstcms',
            'ename' => 'manageModulesCache',
            'uri' => 'modules/cache',
            'parent' => 'manageModules',
            'module' => 'hstcms'
        ];
        $data['manageCaches'] = [
            'name' => hst_lang('hstcms::manage.caches.manage'),
            'remark' => 'hstcms',
            'ename' => 'manageCaches',
            'uri' => 'caches',
            'parent' => 'manageCaches',
            'module' => 'hstcms'
        ];
        $data['manageCachesSave'] = [
            'name' => hst_lang('hstcms::public.save'),
            'remark' => 'hstcms',
            'ename' => 'manageCachesSave',
            'uri' => 'caches/save',
            'parent' => 'manageCaches',
            'module' => 'hstcms'
        ];
        $data['manageCachesMemcachedConfig'] = [
            'name' => hst_lang('hstcms::manage.caches.memcached.setting'),
            'remark' => 'hstcms',
            'ename' => 'manageCachesMemcachedConfig',
            'uri' => '/caches/memcached/config',
            'parent' => 'manageCaches',
            'module' => 'hstcms'
        ];
        $data['manageCachesMemcachedConfigSave'] = [
            'name' => hst_lang('hstcms::public.save', 'hstcms::manage.caches.memcached.setting'),
            'remark' => 'hstcms',
            'ename' => 'manageCachesMemcachedConfigSave',
            'uri' => 'index',
            'parent' => 'manageCaches',
            'module' => 'hstcms'
        ];
        $data['manageCaptchaIndex'] = [
            'name' => hst_lang('hstcms::captcha.name'),
            'remark' => 'captcha',
            'ename' => 'manageCaptchaIndex',
            'uri' => 'captcha/index',
            'parent' => 'manageCaptchaIndex',
            'module' => 'hstcms'
        ];
        $data['manageCaptchaSave'] = [
            'name' => hst_lang('hstcms::captcha.save'),
            'remark' => 'captcha',
            'ename' => 'manageCaptchaSave',
            'uri' => 'captcha/save',
            'parent' => 'manageCaptchaIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormIndex'] = [
            'name' => hst_lang('hstcms::public.manage'),
            'remark' => 'form',
            'ename' => 'manageFormIndex',
            'uri' => 'form/index',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormAdd'] = [
            'name' => hst_lang('hstcms::public.add'),
            'remark' => 'form',
            'ename' => 'manageFormAdd',
            'uri' => 'form/add',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormAddSave'] = [
            'name' => hst_lang('hstcms::public.add').hst_lang('hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFormAddSave',
            'uri' => 'form/save',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormEdit'] = [
            'name' => hst_lang('hstcms::public.edit'),
            'remark' => 'form',
            'ename' => 'manageFormEdit',
            'uri' => 'form/edit/{id}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormEditSave'] = [
            'name' => hst_lang('hstcms::public.edit').hst_lang('hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFormEditSave',
            'uri' => 'form/edit/save',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormDelete'] = [
            'name' => hst_lang('hstcms::public.delete'),
            'remark' => 'form',
            'ename' => 'manageFormDelete',
            'uri' => 'form/delete/{id}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormContent'] = [
            'name' => hst_lang('hstcms::manage.form.content').hst_lang('hstcms::public.manage'),
            'remark' => 'form',
            'ename' => 'manageFormContent',
            'uri' => 'form/content/{formid}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormContentAdd'] = [
            'name' => hst_lang('hstcms::manage.form.content').hst_lang('hstcms::public.add'),
            'remark' => 'form',
            'ename' => 'manageFormContentAdd',
            'uri' => 'form/content/add/{formid}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormContentAddSave'] = [
            'name' => hst_lang('hstcms::manage.form.content').hst_lang('hstcms::public.add', 'hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFormContentAddSave',
            'uri' => 'form/content/add/save/{formid}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormContentEdit'] = [
            'name' => hst_lang('hstcms::manage.form.content').hst_lang('hstcms::public.edit'),
            'remark' => 'form',
            'ename' => 'manageFormContentEdit',
            'uri' => 'form/content/edit/{formid}/{id}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormContentEditSave'] = [
            'name' => hst_lang('hstcms::manage.form.content').hst_lang('hstcms::public.edit', 'hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFormContentEditSave',
            'uri' => 'form/content/edit/save/{formid}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFormContentDelete'] = [
            'name' => hst_lang('hstcms::manage.form.content').hst_lang('hstcms::public.delete'),
            'remark' => 'form',
            'ename' => 'manageFormContentDelete',
            'uri' => 'form/content/delete/{formid}/{id}',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsIndex'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.manage'),
            'remark' => 'form',
            'ename' => 'manageFieldsIndex',
            'uri' => 'fields',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsSave'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFieldsSave',
            'uri' => 'fields/save',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsAdd'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.add'),
            'remark' => 'form',
            'ename' => 'manageFieldsAdd',
            'uri' => 'fields/add',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsAddSave'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.add','hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFieldsAddSave',
            'uri' => 'fields/add/save',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsEdit'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.edit'),
            'remark' => 'form',
            'ename' => 'manageFieldsEdit',
            'uri' => 'fields/edit',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsEditSave'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.edit','hstcms::public.save'),
            'remark' => 'form',
            'ename' => 'manageFieldsEditSave',
            'uri' => 'fields/edit/save',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsCache'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.cache'),
            'remark' => 'form',
            'ename' => 'manageFieldsCache',
            'uri' => 'fields/cache',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageFieldsDelete'] = [
            'name' => hst_lang('hstcms::public.field').hst_lang('hstcms::public.delete'),
            'remark' => 'form',
            'ename' => 'manageFieldsDelete',
            'uri' => 'fields/delete',
            'parent' => 'manageFormIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialIndex'] = [
            'name' => hst_lang('hstcms::manage.special.manage'),
            'remark' => 'special',
            'ename' => 'manageSpecialIndex',
            'uri' => 'special',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialCache'] = [
            'name' => hst_lang('hstcms::public.cache'),
            'remark' => 'special cache',
            'ename' => 'manageSpecialCache',
            'uri' => 'special/cache',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialAdd'] = [
            'name' => hst_lang('hstcms::public.add'),
            'remark' => 'special add',
            'ename' => 'manageSpecialAdd',
            'uri' => 'special/add',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialAddSave'] = [
            'name' => hst_lang('hstcms::public.add','hstcms::public.save'),
            'remark' => 'special add save',
            'ename' => 'manageSpecialAddSave',
            'uri' => 'special/add/save',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialEdit'] = [
            'name' => hst_lang('hstcms::public.edit'),
            'remark' => 'special edit',
            'ename' => 'manageSpecialEdit',
            'uri' => 'special/edit/{id}',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialEditSave'] = [
            'name' => hst_lang('hstcms::public.edit','hstcms::public.save'),
            'remark' => 'special edit save',
            'ename' => 'manageSpecialEditSave',
            'uri' => 'special/edit/save',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialDelete'] = [
            'name' => hst_lang('hstcms::public.delete'),
            'remark' => 'special delete',
            'ename' => 'manageSpecialDelete',
            'uri' => 'special/delete/{id}',
            'parent' => 'manageSpecialIndex',
            'module' => 'hstcms'
        ];
        $data['manageAreaIndex'] = [
            'name' => hst_lang('hstcms::manage.area.manage'),
            'remark' => 'area',
            'ename' => 'manageAreaIndex',
            'uri' => 'area',
            'parent' => 'manageAreaIndex',
            'module' => 'hstcms'
        ];
        $data['manageAreaAdd'] = [
            'name' => hst_lang('hstcms::public.add'),
            'remark' => 'area add',
            'ename' => 'manageAreaAdd',
            'uri' => 'area/add',
            'parent' => 'manageAreaIndex',
            'module' => 'hstcms'
        ];
        $data['manageAreaAddSave'] = [
            'name' => hst_lang('hstcms::public.add','hstcms::public.save'),
            'remark' => 'area add save',
            'ename' => 'manageAreaAddSave',
            'uri' => 'area/add/save',
            'parent' => 'manageAreaIndex',
            'module' => 'hstcms'
        ];
        $data['manageAreaEdit'] = [
            'name' => hst_lang('hstcms::public.edit'),
            'remark' => 'area edit',
            'ename' => 'manageAreaEdit',
            'uri' => 'area/edit/{areaid}',
            'parent' => 'manageAreaIndex',
            'module' => 'hstcms'
        ];
        $data['manageAreaEditSave'] = [
            'name' => hst_lang('hstcms::public.edit','hstcms::public.save'),
            'remark' => 'area edit save',
            'ename' => 'manageAreaEditSave',
            'uri' => 'area/edit/save',
            'parent' => 'manageAreaIndex',
            'module' => 'hstcms'
        ];
        $data['manageSpecialDelete'] = [
            'name' => hst_lang('hstcms::public.delete'),
            'remark' => 'area delete',
            'ename' => 'manageAreaDelete',
            'uri' => 'area/delete/{areaid}',
            'parent' => 'manageAreaIndex',
            'module' => 'hstcms'
        ];
        return $data;
    }
96033
public function parse($data)
    {
        if ($data === null || !is_string($data)) {
            return array();
        }

        if (substr($data, 0, 1) !== '{' &&
            substr($data, 0, 1) !== '[') {
            return array();
        }

        return (array) json_decode($data, true);
    }
1239851
public function arraySerialize(array $Data)
    {
        $Result = "";
        foreach ($Data as $Value) {
            if ($Result == "") {
                $Result = floor($Value);
            } else {
                $Result = $Result . "," . floor($Value);
            }
        }

        return $Result;
    }
172261
private static function toArray($data) : array
    {
        if (($data instanceof ArrayObject)) {
            return $data->getArrayCopy();
        }
        if (is_null($data) || empty($data)) {
            return array();
        }

        return $data;
    }
1258794
public function redislizeArray(array $data)
    {
        $result = [];
        foreach ($data as $key => $value) {
            if (!is_array($value)) {
                $result[$key] = $this->redislize($value);
            }
        }

        return $result;
    }
191288
private function itemsFromArray(array $data): array
    {
        $objects = [];
        foreach ($data[$this->key()] as $objectData) {
            $objects[] = $this->item->from($objectData);
        }
        return $objects;
    }
982240
protected function asArray($data = []): array
    {
        if ($data instanceof Collection) {
            $data = $data->all();
        } elseif ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        return $data;
    }
564230
private function convertObjectToArray($data)
    {
        $converted = [];
        foreach($data as $key => $value) {
            if(is_object($value)) {
                $converted[$key] = $this->convertObjectToArray($value);
            } else {
                $converted[$key] = $value;
            }
        }

        return $converted;
    }
1036926
public static function arrayColumns(array $data)
    {
        // Count the amount of values from the source input
        $count = count($data);

        if ($count === 0) {
            return false;
        }

        if ($count === 1) {
            return array_keys($data[0]);
        }

        if (isset($data[0])) {
            return array_keys($data[0]);
        } else {
            return false;
        }
    }
1176901
public function register($data)
    {
        // 1. 校验额外数据
        if (isset($data['mobile'])) {
            $validator = wei()->validate([
                'data' => $data,
                'rules' => [
                    'mobile' => [
                        'required' => true,
                        'mobileCn' => true,
                    ],
                    'verifyCode' => [
                        'required' => true,
                    ],
                ],
                'names' => [
                    'mobile' => '手机号码',
                    'verifyCode' => '验证码',
                ],
                'messages' => [
                    'mobile' => [
                        'required' => '请输入手机号码',
                    ],
                    'verifyCode' => [
                        'required' => '请输入验证码',
                    ],
                ],
            ]);
            if (!$validator->isValid()) {
                return ['code' => -1, 'message' => $validator->getFirstMessage()];
            }

            $ret = wei()->verifyCode->check($data['mobile'], $data['verifyCode']);
            if ($ret['code'] !== 1) {
                return $ret + ['verifyCodeErr' => true];
            }
        } else {
            $validator = wei()->validate([
                'data' => $data,
                'rules' => [
                    'email' => [
                        'required' => true,
                    ],
                ],
                'names' => [
                    'email' => '邮箱',
                ],
                'messages' => [
                    'email' => [
                        'required' => '请输入邮箱',
                    ],
                ],
            ]);
            if (!$validator->isValid()) {
                return ['code' => -1, 'message' => $validator->getFirstMessage()];
            }
        }

        // 2. 统一校验
        $validator = wei()->validate([
            'data' => $data,
            'rules' => [
                'email' => [
                    'required' => false,
                    'email' => true,
                    'notRecordExists' => ['user', 'email'],
                ],
                'password' => [
                    'minLength' => 6,
                ],
                'passwordConfirm' => [
                    'equalTo' => $data['password'],
                ],
            ],
            'names' => [
                'email' => '邮箱',
                'password' => '密码',
            ],
            'messages' => [
                'passwordConfirm' => [
                    'required' => '请再次输入密码',
                    'equalTo' => '两次输入的密码不相等',
                ],
            ],
        ]);
        if (!$validator->isValid()) {
            return ['code' => -7, 'message' => $validator->getFirstMessage()];
        }

        if ($data['mobile']) {
            $user = wei()->user()->mobileVerified()->find(['mobile' => $data['mobile']]);
            if ($user) {
                return ['code' => -8, 'message' => '手机号码已存在'];
            }
        }

        $ret = $this->event->until('userRegisterValidate', [$this]);
        if ($ret) {
            return $ret;
        }

        // 3. 保存到数据库
        $this->setPlainPassword($data['password']);

        if ($data['mobile']) {
            $this->setMobileVerified();
        }

        $this->save([
            'email' => (string) $data['email'],
            'mobile' => (string) $data['mobile'],
            'username' => (string) $data['username'],
            'source' => isset($data['source']) ? $data['source'] : '',
        ]);

        return ['code' => 1, 'message' => '注册成功'];
    }
872221
protected function _getData(array $data): array
    {
        // Stringify empty values
        if (!empty($data)) {
            foreach ($data as $fieldName => $value) {
                $data[$fieldName] = $this->_stringifyEmptyValue($value);
            }
        }

        return $data;
    }
563717
public function to_array($data = null)
	{
		if ($data === null)
		{
			$data = $this->_data;
		}

		$array = array();

		if (is_object($data) and ! $data instanceof \Iterator)
		{
			$data = get_object_vars($data);
		}

		if (empty($data))
		{
			return array();
		}

		foreach ($data as $key => $value)
		{
			if (is_object($value) or is_array($value))
			{
				$array[$key] = $this->to_array($value);
			}
			else
			{
				$array[$key] = $value;
			}
		}

		return $array;
	}
270433
public function getData($data)
    {
        if ($this->hasData($data)) {
            return $this->getAttribute(sprintf('data-%s', $data));
        } else {
            return false;
        }
    }
1251789
public function json(array $data)
    {
        $data = json_encode($data);
        $response = $this->withHeader('Content-Type', 'application/json');
        $response->getBody()->write($data);

        return $response;
    }
845606
private static function separate(array $data)
    {
        $array = [];

        foreach ($data as $provider) {

            if(($bool = self::isDelim($provider)) === false) {
                $array['required'][] = $provider;
            }
            else {
                if ($bool[1] === 'true') {
                    $array['required'][] = strval($bool[0]);
                } else {
                    $array['hidden'][] = strval($bool[0]);
                }
            }
        }

        return $array;

    }
54841
private function hydrateIfJsonToArray($data)
    {
        if (is_array($data)) {
            return $data;
        }
        elseif (is_string($data)) {
            $attempt = json_decode($data, true);
            return empty($attempt) ? $data : $attempt;
        }

        return [];
    }
113026
public function process(array $data)
    {
        $processedData = [
            'meta' => Hash::get($data, 'meta'),
            'data' => []
        ];
        $processedData['meta']['type'] = 'Module';
        $processedData['meta']['title'] = $this->name();
        unset($data['meta']);
        foreach ($data as $attr => $value) {
            $processedData['data'][$attr] = $value;
        }
        return $processedData;
    }