Phalcon Framework 3.0.4

Phalcon\Mvc\Model\Exception: Column 'is_online_register' doesn't belong to any of the selected models (1), when preparing: SELECT [System\Model\CompanyType].* FROM [System\Model\CompanyType] WHERE manage_company_id = :manage_company_id: AND active = :active: AND is_online_register = :is_online_register:

/var/www/html/app/modules/System/Model/CompanyType.php (205)
#0Phalcon\Mvc\Model\Query->_getQualified(Array([type] => 355, [name] => is_online_register))
#1Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 355, [name] => is_online_register), true)
#2Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 266, [left] => Array([type] => 274, [value] => active), [right] => Array([type] => 355, [name] => is_online_register)), true)
#3Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 61, [left] => Array([type] => 61, [left] => Array([type] => 355, [name] => manage_company_id), [right] => Array([type] => 266, [left] => Array(), [right] => Array())), [right] => Array([type] => 266, [left] => Array([type] => 274, [value] => active), [right] => Array([type] => 355, [name] => is_online_register))), true)
#4Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 61, [left] => Array([type] => 61, [left] => Array([type] => 61, [left] => Array(), [right] => Array()), [right] => Array([type] => 266, [left] => Array(), [right] => Array())), [right] => Array([type] => 274, [value] => is_online_register)))
#5Phalcon\Mvc\Model\Query->_prepareSelect()
#6Phalcon\Mvc\Model\Query->parse()
#7Phalcon\Mvc\Model\Query->execute()
#8Phalcon\Mvc\Model::find(Array([conditions] => manage_company_id = :manage_company_id: AND active = :active: AND is_online_register = :is_online_register:, [bind] => Array([manage_company_id] => 00001, [active] => 1, [is_online_register] => 1)))
/var/www/html/app/modules/System/Model/CompanyType.php (205)
<?php
 
namespace System\Model;
 
use Application\Mvc\Model\Config;
use Application\Mvc\Model\Model;
use Managements\Model\Companys;
use Phalcon\DI;
 
/***
 * Class CompanyType
 * @package System\Model
 
 */
class CompanyType extends Model
{
    public $company_type_id;
    public $title;
    public $note;
    public $active;
    public $allow_list;
    public $create_datetime;
    public $create_staff_id;
    public $create_staff_name;
    public $company_type_code;//公司类型
    public $manage_company_id;
    public $is_online_register;
 
    public function getSource()
    {
        return "erp_setting_company_type";
    }
 
    public function beforeValidationOnCreate()
    {
        $this->company_type_id = ukey_next_id();
        $this->create_datetime = date("Y-m-d H:i:s");
        $this->create_staff_id = $this->di->getShared('session')->get('auth')->staff_id;
        $this->create_staff_name = $this->di->getShared('session')->get('auth')->name;
    }
 
    public function getId()
    {
        return $this->company_type_id;
    }
 
    public function isActive()
    {
        return Config::getActive($this->active);
    }
 
    /**
     * 保存后更新缓存,更新权限列表
     */
    public function afterSave()
    {
        $this->saveCompanyTypeCodeToCache(); //保存公司类型是更新缓存
        $this->saveCompanyTypeAllowListToCache(); //更新公司类型的权限列表
    }
 
    /**
     * 根据公司id和模块数组判断该公司是否有对应功能权限
     * @param $company_id
     * @param array $module_codes
     * @return bool
     */
    public static function isAllowByCompanyId($company_id, $module_codes)
    {
        if (CompanyType::getCompanyTypeCodeByCompanyId($company_id) == '7') return true;
        else {
            $company = Companys::getCompanyFromCache(Companys::getTopParentCompanyIdFromCache($company_id));
            return self::isAllow( $company->company_type,$module_codes );
        }
    }
 
    /**
     * 公司类型是否用权限使用模块
     * @param $company_type_id
     * @param $module_codes
     * @return bool
     */
    public static function isAllow($company_type_id, $module_codes)
    {
        $data = self::getCompanyTypeAllowListById($company_type_id);
        if ($data !== false) {
            if (is_array($module_codes)) {
                foreach ($module_codes as $module_code) {
                    if (in_array($module_code, $data)) return true;
                }
            } else {
                if (in_array($module_codes, $data)) return true;
            }
        }
        return false;
    }
 
    /**
     * 保存公司类型是更新缓存
     */
    public function saveCompanyTypeCodeToCache()
    {
        $di = DI::getDefault();
        $cache = $di->get('cache');
        $cache->save('COMPANY_TYPE_'.$this->company_type_id, $this->company_type_code, 2592000);
    }
 
    /**
     * 获取公司类型编码,如果缓存没有数据则查询数据库,并更新缓存
     * @param $company_id
     * @return string
     */
    public static function getCompanyTypeCodeByCompanyId($company_id)
    {
        $di = DI::getDefault();
        $cache = $di->get('cache');
        $company = Companys::getCompanyFromCache($company_id);
        if (!$company) return "";
        $data_content = $cache->get("COMPANY_TYPE_".$company->company_type);
        if (empty($data_content)) {
            $model = CompanyType::findFirst("company_type_id = '$company->company_type' and active = '1'");
            if ($model) {
                $model->saveCompanyTypeCodeToCache();
                return $cache->get("COMPANY_TYPE_".$company->company_type);
            } else {
                return "";
            }
        } else return $data_content;
    }
 
    /**
     * 获取公司类型的授权模块
     * @param $company_type_id
     * @return bool|mixed
     */
    public static function getCompanyTypeAllowListById($company_type_id)
    {
        $di = DI::getDefault();
        $cache = $di->get('cache');
        $allow_list = $cache->get("COMPANY_ALLOW_LIST_".$company_type_id);
        if (empty($allow_list)) {
            $model = CompanyType::findFirst("company_type_id = '$company_type_id' and active = '1'");
            if ( $model ) {
                $model->saveCompanyTypeAllowListToCache();
                return json_decode($cache->get("COMPANY_ALLOW_LIST_".$company_type_id), true);
            } else {
                return false;
            }
        } else return json_decode($cache->get("COMPANY_ALLOW_LIST_".$company_type_id), true);
    }
 
    /**
     * 更新公司类型的权限列表
     */
    public function saveCompanyTypeAllowListToCache()
    {
        $di = DI::getDefault();
        $cache = $di->get('cache');
        $cache->save('COMPANY_ALLOW_LIST_'.$this->company_type_id, $this->allow_list, 2592000);
    }
 
    /**
     * 获取公司类型类别
     * @param string $manage_company_id
     * @return array
     */
    public static function getCompanyTypes($manage_company_id = '')
    {
        $di = DI::getDefault();
        $config = $di->get('config');
        $session = $di->getShared('session');
        $result = [];
        if ($manage_company_id == '') $manage_company_id = $session->get('auth')->manage_company_id;
        foreach (self::find("manage_company_id = '$manage_company_id' and active ='1'") as $item) {
            if ($item->company_type_code == '7') {
                if (isset($session->get('auth')->role)) {
                    if ($config->administrator == $session->get('auth')->role) {
                        $result[$item->company_type_id] = $item->title;
                    }
                }
            } else {
                $result[$item->company_type_id] = $item->title;
            }
        }
        return $result;
    }
 
    /**
     * 获取公司类型类别
     * @param string $manage_company_id
     * @return array
     */
    public static function getCompanyTypesForOnlineRegister($manage_company_id = '')
    {
        $di = DI::getDefault();
        $config = $di->get('config');
        $session = $di->getShared('session');
        $result = [];
        foreach (self::find([
            'conditions' => "manage_company_id = :manage_company_id: AND active = :active: AND is_online_register = :is_online_register:",
            'bind' => [
                'manage_company_id' => $manage_company_id,
                'active' => '1',
                'is_online_register' => '1'
            ]
        ]) as $item) {
            error_log($item->company_type_id);
            $result[$item->company_type_id] = $item->title;
        }
 
        return $result;
    }
 
    /**
     * 通过公司类型ID获取公司类型名
     * @param $company_type_id
     * @return mixed
     */
    public static function getCompanyTypeNameById($company_type_id)
    {
        $model = self::findFirst([
            'conditions' => "company_type_id = '$company_type_id' and active = '1'",
            'cache'      => [
                'key'      => HOST_HASH.md5('System\Model\CompanyType::getCompanyTypeById::'.$company_type_id),
                'lifetime' => 30,
            ]
        ]);
        if ($model) {
            return $model->title;
        }
    }
}
 
#9System\Model\CompanyType::getCompanyTypesForOnlineRegister(00001)
/var/www/html/app/modules/Admin/Form/CompanyRegisterForm.php (73)
<?php
 
/**
 * LoginForm
 * @copyright Copyright (c) 2020 markboo (http://zhixdl.com)
 * @author Aleksandr Torosh <webtorua@gmail.com>
 */
 
namespace Admin\Form;
 
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Password;
use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\StringLength;
use Phalcon\Forms\Element\Select;
use Phalcon\DI;
use System\Model\CompanyType;
use System\Model\AddressProvince;
 
class CompanyRegisterForm extends Form
{
    public function initialize()
    {
        $password = new Password('password', [
            'required' => true,
            'placeholder' => '请输入登录密码',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'value' => ''
        ]);
 
        $password->addValidator(new StringLength([
            "min" => 8,
            "messageMinimum" => "密码长度不得小于8位!",
        ]));
        $password->addValidator(new PresenceOf(['message' => '登录密码也是必需填的']))->setDefault('')->clear();
        $this->add($password);
 
        $captcha = new Text('captcha', [
            'required' => true,
            'placeholder' => '请输入图形验证码',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'maxlength' => 20,
            'value' => ''
        ]);
        $captcha->addValidator(new PresenceOf(['message' => '验证码是必需填的']))->setDefault('')->clear();
        $this->add($captcha);
 
        $name = new Text('name', [
            'required' => true,
            'placeholder' => '管理员姓名(10个字以内)',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'maxlength' => 10,
            'value' => ''
        ]);
        $name->addValidator(new PresenceOf(['message' => '管理员姓名是必需填的']));
        $this->add($name);
 
        $mobile = new Text('mobile', [
            'required' => true,
            'placeholder' => '管理员电话号码',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'maxlength'   => 11,
            'value' => ''
        ]);
        $mobile->addValidator(new PresenceOf(['message' => '电话号码是用来登录必需填写']));
        $this->add($mobile);
 
        $this->add((new Select('company_type',CompanyType::getCompanyTypesForOnlineRegister("00001"), [
            'useEmpty'   => true,
            'emptyText'  => '公司类型...',
            'emptyValue' => '',
            'class' => 'ui fluid dropdown'
        ]))->addValidator(new PresenceOf(['message' => '公司类型必需选择'])));
 
        $this->add((new Text('company_name', [
            'maxlength'   => 100,
            'placeholder' => '公司名称(100字以内)',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'value' => '',
            'index' => 0
        ]))->addValidator(new PresenceOf([
            'field'   => 'company_name',
            'message' => '公司名称是必须填的',
        ])));
 
        $this->add((new Text('company_nm_short', [
            'maxlength'   => 10,
            'placeholder' => '公司简称(10个字以内)',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'value' => ''
        ]))->addValidator(new PresenceOf([
            'field'   => 'company_nm_short',
            'message' => '公司简称是必须填的',
        ])));
 
        $this->add((new Text('company_address', [
            'maxlength'   => 200,
            'placeholder' => '公司地址(200字以内)',
            'autocomplete'=>'off',
            'autofocus' => 'autofocus',
            'value' => ''
        ]))->addValidator(new PresenceOf([
            'field'   => 'company_address',
            'message' => '公司地址是必需填的'
        ])));
 
        $this->add((new Select('address_province', AddressProvince::getProvinceModel(), [
            'using' => ['provinceID', 'province'],
            'useEmpty'   => true,
            'emptyText'  => '省份...',
            'emptyValue' => '',
            'required' => true,
            'class' => 'ui fluid dropdown'
        ]))->addValidator(new PresenceOf([
            'field'   => 'address_province',
            'message' => '公司地址——省份是必需填的'
        ])));
 
        $this->add((new Select('address_city', [], [
            'useEmpty'   => true,
            'emptyText'  => '城市...',
            'emptyValue' => '',
            'class' => 'ui fluid dropdown'
        ]))->addValidator(new PresenceOf([
            'field'   => 'address_city',
            'message' => '公司地址——城市是必需填的'
        ])));
 
        $this->add((new Select( 'address_area', [], [
            'useEmpty'   => true,
            'emptyText'  => '区县...',
            'emptyValue' => '',
            'class' => 'ui fluid dropdown'
        ]))->addValidator(new PresenceOf([
            'field'   => 'address_area',
            'message' => '公司地址——区县是必需填的'
        ])));
    }
}
#10Admin\Form\CompanyRegisterForm->initialize(null, null)
#11Phalcon\Forms\Form->__construct()
/var/www/html/app/modules/Admin/Controller/IndexController.php (369)
<?php
 
/**
 * IndexController
 * @copyright Copyright (c) 2020 Markboo (http://cnski.cn)
 * @author Markboo <markboo@foxmail.com>
 */
 
namespace Admin\Controller;
 
use Admin\Form\CompanyRegisterForm;
use Admin\Form\LoginForm;
use Admin\Form\RegisterForm;
use Admin\Model\UserVerify;
use Application\Mvc\Controller;
use Application\Utils\Captcha;
use Application\Utils\SendMail;
use Application\Utils\WeixinAuth\WeixinAuth;
use Distribution\Model\Shop;
use Finance\Model\Dealings;
use Managements\Model\AdminUser;
use Managements\Model\CompanyBranch;
use Managements\Model\Companys;
use Managements\Model\Role;
use Managements\Model\Staff;
use Phalcon\Cache\Backend\Redis;
use Phalcon\Cache\Frontend\Data as FrontData;
use Phalcon\Http\Response;
use Phalcon\Mvc\Model\Transaction\Failed as TransactionFailed;
use Phalcon\Mvc\Model\Transaction\Manager as TransactionManager;
use Phalcon\Mvc\View;
use stdClass;
use System\Model\BillingAccount;
use System\Model\InOutType;
use System\Model\RecPayDetailDefaultType;
use System\Model\RoleTemplate;
 
class IndexController extends Controller
{
    public $controller_title = '后台管理系统'; //控制器名称
    public $controller_role = false; //是否使用权限控制,true: 将展示在权限管理页面
    public $default_all_permission = true;  //默认全部用户授权,false: 将展示在权限管理页面
    private $timeout = 300;
 
    /**
     * 初始化登录画面
     */
    public function indexAction()
    {
        $this->session->set('frame', true);
        $this->setFrameEnvironment();
        $this->view->languages_disabled = true;
        $auth = $this->session->get('auth');
        if (!$auth || !isset($auth->admin_session) || !$auth->admin_session) {
            $this->redirect($this->url->get() . 'admin/index/login?f=frame');
            return;
        } else {
            $staff = Staff::getUserInfo($auth->user_id, $auth->company_id);
            if ($staff) {
                $this->session->set('auth', Staff::getAuthDataFromCache($auth->company_id, $auth->user_id));
            } else {
                $this->logoutAction();
            }
        }
        $this->helper->title($this->helper->at('控制面板'), true);
        $this->helper->activeMenu()->setActive('admin-home');
    }
 
    /**
     * 初始化登录画面
     */
    public function homeAction()
    {
        $this->setAdminEnvironment();
        $this->view->languages_disabled = true;
        $auth = $this->session->get('auth');
        if (!$auth) {
            if (isset($auth->company_id) && isset($auth->user_id)) {
                $this->session->set('auth', Staff::getAuthDataFromCache($auth->company_id, $auth->user_id));
            }
        }
        $company_id = $this->getAuthInfo('company_id');
        $res = BillingAccount::isWarningAccount($company_id);
        if ( $res !== false ) {
            $this->view->billing_warning = $res;
        } else {
            $this->view->billing_warning = '';
        }
        $this->view->company_id = $company_id;
        $this->helper->title($this->helper->at('首页面板'), true);
        $this->helper->activeMenu()->setActive('admin-home');
    }
 
    /**
     * isLogin 判断如果已经登录,则直接跳转至控制台首页
     */
    private function isLoginToIndex()
    {
        $auth = $this->session->get('auth');
        if (isset($auth) && isset($auth->admin_session) && $auth->admin_session) {
            $this->redirect($this->url->get() . 'admin/index?f=frame');
            return;
        }
    }
 
    /**
     * 微信扫码登录
     * @return string|mixed|void
     */
    public function wxLoginAction()
    {
        $appid = "wx9f374e7d76d1ca4d"; //系统的公众号appid
        $secret = "9f620fa78b5ecb23c8eafb901e2f7c9b";
        $code = $this->request->getQuery('code', 'string', '');
        $state = $this->request->getQuery('state', 'string', '');
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        if (!empty($code) && !empty($state)) {
            $data = WeixinAuth::weixinAuthAccessToken($appid, $secret, $code);
            if ($data->openid && $data->unionid) {
                $conditions = "openid = :openid: OR unionid = :unionid:";
                $parameters = ["openid" => $data->openid, "unionid" => $data->unionid];
                $user = AdminUser::findFirst([$conditions, "bind" => $parameters]);
                if ($user) {
                    $staff_info = Staff::getFirstUserInfo($user->id);
                    if (!$staff_info) {
                        $this->view->error = true;
                        $this->view->message = $this->helper->translate("无效的登录名或密码!");
                    } else {
                        if ($staff_info->isActive()) {
                            $company_staffs = Staff::find([
                                "user_id = :user_id: and active = '1'",
                                "bind" => ["user_id" => $staff_info->user_id]
                            ]);
                            $company_ids = [];
                            foreach ($company_staffs as $item) {
                                $company_ids[] = strval($item->company_id);
                            }
                            if (sizeof(Companys::find([
                                "conditions" => "company_id IN ({company_ids:array}) AND active = :active:",
                                "bind" => [
                                    "company_ids" => $company_ids,
                                    "active" => '1'
                                ]
                            ])) == 0) {
                                $this->flash->clear();
                                $this->flash->error($this->helper->translate("无效的登录用户!"));
                            } else {
                                $this->session->set('auth', Staff::getAuthDataFromCache($staff_info->company_id, $staff_info->user_id));
                                $this->redirect($this->url->get().'admin?f=frame');
                                $this->view->disable();
                                return;
                            }
                        } else {
                            $this->flash->clear();
                            $this->flash->error($this->helper->translate("用户不是一个激活用户!"));
                        }
                    }
                } else {
                    $this->flash->clear();
                    $this->flash->error($this->helper->translate("没有绑定该微信的用户,请使用账号密码登录!"));
                }
            } else {
                $this->flash->clear();
                $this->flash->error($this->helper->translate("扫码授权失败,请刷新重试!"));
            }
        } else {
            $this->flash->clear();
            $this->flash->error($this->helper->translate("扫码失败,请刷新重试!"));
        }
        $this->redirect($this->url->get().'admin/index/login?f=frame');
        $this->view->disable();
        return;
    }
 
    /**
     * 绑定微信
     */
    public function wxbindAction()
    {
        $appid = "wx9f374e7d76d1ca4d";
        $secret = "9f620fa78b5ecb23c8eafb901e2f7c9b";
        $code = $this->request->getQuery('code', 'string', '');
        $state = $this->request->getQuery('state', 'string', '');
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        if (!empty($code) && !empty($state) && !empty($state)) {
            $data = WeixinAuth::weixinAuthAccessToken($appid, $secret, $code);
            if ($data->openid && $data->unionid) {
                $conditions = "openid = :openid: or unionid = :unionid:";
                $parameters = ["openid" => $data->openid, "unionid" => $data->unionid];
                $check_user = AdminUser::findFirst([$conditions, "bind" => $parameters]);
                if (!$check_user) {
                    $user_id = $state;
                    $conditions = "id = :id:";
                    $parameters = ["id" => $user_id];
                    $user = AdminUser::findFirst([$conditions, "bind" => $parameters]);
                    if ($user) {
                        $user->openid = $data->openid;
                        $user->unionid = $data->unionid;
                        if ($user->update()) {
                            $staff_info = Staff::getFirstUserInfo($user->id);
                            $this->session->set('auth', Staff::getAuthDataFromCache($staff_info->company_id, $staff_info->user_id));
                            $this->view->message = "绑定成功!";
                        } else {
                            $this->view->message = "绑定失败,请刷新重试!";
                        }
                    }
                } else {
                    $this->view->message = "绑定失败,该微信已经被其他账号绑定,请更换重试!";
                }
            } else {
                $this->view->message = "扫码授权失败,请刷新重试!";
            }
        } else {
            $this->view->message = "扫码失败,请刷新重试!";
        }
    }
 
    /**
     * 判断一个用用是否三次以上登录错误显示图形验证码
     * @param string $user_name 登录用户名
     * @return boolean
     */
    private function getCaptchaShow($user_name)
    {
        $config = $this->di->get('config');
        $frontCache = new FrontData(["lifetime" => 60]);
        $cache = new Redis(
            $frontCache,
            [
                "uniqueId" => $config->redis->uniqueid,
                "host" => $config->redis->host,
                "port" => $config->redis->port,
                "lifetime" => $config->redis->lifetime,
                "persistent" => $config->redis->persistent,
                "prefix" => $config->redis->prefix,
                "index" => 1
            ]
        );
        $captcha_count = $cache->get($user_name);
        $show_captcha = false;
        if ($captcha_count >= 3) {
            $show_captcha = true;
        }
        $cache->save($user_name, $captcha_count + 1);
        return $show_captcha;
    }
 
    /**
     * 登录动作
     * @return mixed|void
     */
    public function loginAction()
    {
        $this->isLoginToIndex();
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $ref = $this->request->getPost('r', 'string', '');
        if (empty($ref)) $ref = $this->request->getQuery('r', 'string', '');
        $this->view->ref = $ref;
        $form = new LoginForm();
        $this->view->form = $form;
        $this->view->show_captcha = false;
        $config = $this->di->get('config');
        $system_name = $config->system_name;
        $this->view->system_name = $system_name;
        $style_mode = isset($_COOKIE['style_mode']) ? true : false;
        if ($style_mode) {
            $this->view->main_style = "dark-body";
        } else {
            $this->view->main_style = "";
        }
        if ($this->request->isPost()) {
            if ($this->security->checkToken()) {
                if ($form->isValid($this->request->getPost())) {
                    $captcha = $this->request->getPost('captcha', 'string');
                    $login = $this->request->getPost('login', 'string');
                    $password = $this->request->getPost('password', 'string');
                    $show_captcha = $this->getCaptchaShow($login);
                    if (!empty($captcha)) {
                        //校验图形验证码
                        $check_captcha = $this->checkCaptcha($captcha);
                        if (!empty($check_captcha)) {
                            $this->flash->error($check_captcha);
                            $this->view->show_captcha = $show_captcha;
                            return;
                        }
                    }
                    $user = AdminUser::findFirst([
                        "login = :login: OR mobile = :mobile:",
                        "bind" => ["login" => $login, "mobile" => $login]
                    ]);
                    $this->view->show_captcha = $show_captcha;
                    if ($user) {
                        if ($user->checkPassword($password)) {
                            $staff_info = Staff::getFirstUserInfo($user->id);
                            if (!$staff_info) {
                                $this->flash->clear();
                                $this->flash->error($this->helper->translate("无效的登录名或密码!"));
                            } else {
                                if ($staff_info->isActive()) {
                                    $company_staffs = Staff::find([
                                        "user_id = :user_id: AND active = '1' AND is_online = '1'",
                                        "bind" => ["user_id" => $staff_info->user_id]
                                    ]);
                                    $company_ids = [];
                                    foreach ($company_staffs as $item) {
                                        $company_ids[] = strval($item->company_id);
                                    }
                                    if (empty($company_ids) or sizeof(Companys::find([
                                        "conditions" => "company_id IN ({company_ids:array}) AND active = :active:",
                                        "bind" => [
                                            "company_ids" => $company_ids,
                                            "active" => '1'
                                        ]
                                    ])) == 0) {
                                        $this->flash->clear();
                                        $this->flash->error($this->helper->translate("无效的登录用户"));
                                    }
                                    $staff_auth_data = $staff_info->saveAuthDataToCache();
                                    $this->session->set('auth', $staff_auth_data);
                                    $user->updateLastLoginDatetime();
                                    if ($ref == '') {
                                        $this->redirect($this->url->get() . 'admin?f=frame');
                                        $this->view->disable();
                                        return;
                                    } else {
                                        $ref = pack('H*', $ref);
                                        $this->redirect($ref);
                                        $this->view->disable();
                                        return;
                                    }
                                } else {
                                    $this->flash->clear();
                                    $this->flash->error($this->helper->translate("用户不是一个激活用户!"));
                                }
                            }
                        } else {
                            $this->flash->clear();
                            $this->flash->error($this->helper->translate("无效的登录名或密码!"));
                        }
                    } else {
                        $this->flash->clear();
                        $this->flash->error($this->helper->translate("无效的登录名!"));
                    }
                } else {
                    foreach ($form->getMessages() as $message) {
                        $this->flash->error($message);
                    }
                }
            } else {
                $clear = $this->request->getQuery('clear', 'string', '');
                if ($clear == 'true') {
                    $this->logoutAction();
                } else {
                    $this->flash->error($this->helper->translate("安全错误!登录页面禁止刷新!"));
                }
            }
        }
        return;
    }
 
    /**
     * 注册公司
     * @return mixed|void
     */
    public function companyRegisterAction()
    {
        $this->isLoginToIndex();
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new CompanyRegisterForm();
        $company_type = $this->request->getPost('company_type', 'string');
        $form->get("company_type")->setDefault($company_type);
        $this->view->form = $form;
        $config = $this->di->get('config');
        $system_name = $config->system_name;
        $this->view->system_name = $system_name;
        $manage_company_id = '00001';
        $ref = $this->request->getPost('r', 'string', '');
        if (empty($ref)) $ref = $this->request->getQuery('r', 'string', '');
        $this->view->ref = $ref;
        if ($this->request->isPost()) {
            if ($this->security->checkToken()) {
                if ($form->isValid($this->request->getPost())) {
                    $captcha = $this->request->getPost('captcha', 'string');
                    $company_name = $this->request->getPost('company_name', 'string');
                    $company_nm_short = $this->request->getPost('company_nm_short', 'string');
                    $company_address = $this->request->getPost('company_address', 'string');
                    $name = $this->request->getPost('name', 'string');
                    $mobile = $this->request->getPost('mobile', 'string');
                    $password = $this->request->getPost('password', 'string');
                    $address_select = $this->request->getPost('address_province', 'string');
                    $address_select_city = $this->request->getPost('address_city', 'string');
                    $address_select_area = $this->request->getPost('address_area', 'string');
                    //校验图形验证码
                    $check_captcha = $this->checkCaptcha($captcha);
                    if (!empty($check_captcha)) {
                        $this->flash->error($check_captcha);
                        return;
                    }
                    if (!preg_match("/^1[34578]\d{9}$/", $mobile)) {
                        $this->flash->error("电话号码格式不正确,请重新输入");
                        return;
                    }
                    //数据库查找用户
                    $conditions = "(login = :login: OR mobile = :mobile:)";
                    $company_conditions = "(company_telephone = :company_telephone:)";
                    $parameters = ["login" => $mobile, "mobile" => $mobile];
                    $company = Companys::findFirst([$company_conditions, "bind" => ["company_telephone" => $mobile]]);
                    //如果用户存在
                    if ($company) {
                        $this->flash->error($this->helper->translate("手机号已经被注册!"));
                    } else {
                        try {
                            //创建事务管理器
                            $transactionManager = new TransactionManager();
                            //获取事务
                            $transaction = $transactionManager->get();
                            //开始创建管用户id和保存密码
                            $admin_user = AdminUser::findFirst([$conditions, "bind" => $parameters]);
                            if (!$admin_user) {
                                $admin_user = new AdminUser();
                                $admin_user->setTransaction($transaction);
                                $admin_user->id = ukey_next_id();
                                $admin_user->login = $mobile;
                                $admin_user->name = $name;
                                $admin_user->mobile = $mobile;
                                $admin_user->setUserPassword($password);
                                if (!$admin_user->create()) {
                                    foreach ($admin_user->getMessages() as $message) {
                                        error_log($message);
                                    }
                                    $transaction->rollback();
                                }
                            } else {
                                $admin_user->setTransaction($transaction);
                                $admin_user->setUserPassword($password);
                                if (!$admin_user->update()) {
                                    $transaction->rollback($admin_user->getErrorMessage());
                                }
                            }
                            $authData = new stdClass();
                            $authData->id = $admin_user->id;
                            $authData->name = $name;
                            $authData->manage_company_id = $manage_company_id;
                            $this->session->set('auth', $authData);
                            //开始创建公司
                            $company_model = new Companys();
                            $company_model->manage_company_id = $manage_company_id;
                            $company_model->company_id = ukey_next_id();
                            $company_model->company_name = $company_name;
                            $company_model->company_nm_short = $company_nm_short;
                            $company_model->company_address = $company_address;
                            $company_model->company_liaison = $name;
                            $company_model->company_telephone = $mobile;
                            $company_model->company_type = $company_type;
                            $company_model->active = 1;
                            $company_model->address_select = $address_select;
                            $company_model->address_select_city = $address_select_city;
                            $company_model->address_select_district = $address_select_area;
                            $company_model->setTransaction($transaction);
                            if (!$company_model->create()) {
                                foreach ($company_model->getMessages() as $message) {
                                    error_log($message);
                                }
                                $transaction->rollback();
                            }
                            $dealing_model = new Dealings();
                            $dealing_model->manage_company_id = $company_model->manage_company_id;
                            $dealing_model->company_id = $company_model->manage_company_id;
                            $dealing_model->dealings_name = $company_name;
                            $dealing_model->dealings_nm_short = $company_nm_short;
                            $dealing_model->liaisons = $name;
                            $dealing_model->tel = $mobile;
                            $dealing_model->finance_type_id = '1';//固定客户
                            $dealing_model->active = '1';
                            $dealing_model->setTransaction($transaction);
                            if (!$dealing_model->create()) {
                                foreach ($dealing_model->getMessages() as $message) {
                                    error_log($message);
                                }
                                $transaction->rollback();
                            }
                            $billing_model = new BillingAccount();
                            $billing_model->manage_company_id = $manage_company_id; //管理公司ID
                            $billing_model->company_id = $company_model->company_id; //计费组织ID
                            $billing_model->billing_start_datetime = date("Y-m-d");  //开始日期
                            $billing_model->service_life = date("Y-m-d", strtotime("+15 days"));  //计费到期日期默认等于开始日期
                            $billing_model->price = 0.04; //计费到期日期默认等于开始日期
                            $billing_model->goods_max_qty = 1000;
                            $billing_model->dealings_id = $dealing_model->dealings_id;
                            $billing_model->balance = 200;
                            $billing_model->billing_mode = '2'; //按订单数量收费
                            $billing_model->setTransaction($transaction);
                            if (!$billing_model->create()) {
                                foreach ($billing_model->getMessages() as $message) {
                                    error_log($message);
                                }
                                $transaction->rollback();
                            }
                            //创建基础管理部门
                            $branch_model = new CompanyBranch();
                            $branch_model->setTransaction($transaction);
                            $branch_model->manage_company_id = $manage_company_id;
                            $branch_model->company_id = $company_model->company_id;
                            $branch_model->branch_id = ukey_next_id();
                            $branch_model->branch_name = '管理部门';
                            $branch_model->branch_liaison = $name;
                            $branch_model->branch_telephone = $mobile;
                            $branch_model->active = 1;
                            if (!$branch_model->create()) {
                                foreach ($branch_model->getMessages() as $message) {
                                    error_log($message);
                                }
                                $transaction->rollback();
                            }
                            //通过角色模板创建角色
                            $role_template_model = RoleTemplate::cloneRoleByRoleTemplateIdWithCompanyId($manage_company_id, $company_type);
                            $role_id = '';
                            if ($role_template_model) {
                                foreach ($role_template_model as $template) {
                                    $role_model = new Role();
                                    $role_model->setTransaction($transaction);
                                    $role_model->title = $template->title;
                                    $role_model->allow_list = $template->allow_list;
                                    $role_model->organization_permissions = $template->organization_permissions;
                                    $role_model->data_permissions = $template->data_permissions;
                                    $role_model->order_data_permissions = $template->order_data_permissions;
                                    $role_model->customer_data_permissions = $template->customer_data_permissions;
                                    $role_model->manage_company_id = $manage_company_id;
                                    $role_model->company_id = $company_model->company_id;
                                    if (!$role_model->create()) {
                                        foreach ($role_model->getMessages() as $message) {
                                            error_log($message);
                                        }
                                        $transaction->rollback();
                                    } else {
                                        if ($template->is_default_role_id == 1) {
                                            $role_id = $role_model->role_id;
                                        }
                                    }
                                }
                            }
                            //为公司创建收发明细项
                            $company_payment_type_ids = RecPayDetailDefaultType::createPaymentTypeForRegisterCompany($company_type, $company_model->company_id, $transaction);
                            //为公司创建出入库类型
                            InOutType::createInOutTypeForRegisterCompany($company_type, $company_model->company_id, $transaction, $company_payment_type_ids);
                            //开始创建管理员用户
                            $new_staff = new Staff();
                            $new_staff->setTransaction($transaction);
                            $new_staff->user_id = $admin_user->id;
                            $new_staff->role = $role_id;
                            $new_staff->name = $new_staff->nick_name = $name;
                            $new_staff->company_id = $company_model->company_id;
                            $new_staff->manage_company_id = $manage_company_id;
                            $new_staff->branch_id = $branch_model->branch_id;
                            $new_staff->active = 1;
                            $new_staff->mobile = $mobile;
                            $new_staff->staff_status = '2'; //审核状态:已审核
                            if (!$new_staff->create()) {
                                foreach ($new_staff->getMessages() as $message) {
                                    error_log($message);
                                }
                                $transaction->rollback();
                            } else {
                                $this->session->remove('auth');
                            }
                            $transaction->commit();
                            $company_model->saveCompanyToCacheForRegister();
                            Shop::createDefaultShop($company_model);
                            $this->flash->success($this->helper->at('企业注册成功!截止至'.strval($billing_model->service_life)."贵公司可体验试用".strval($billing_model->balance)."单"));
                            $this->redirect($this->url->get() . 'admin/index/finish');
                        } catch (TransactionFailed $e) {
                            $this->session->remove('auth');
                            error_log('[' . __METHOD__ . ']:' . "Failed, reason: Transaction Failed!" . $e->getMessage(), 0);
                            $this->flash->error($this->helper->at('企业注册失败!'));
                        }
                    }
                } else {
                    foreach ($form->getMessages() as $message) {
                        $this->flash->error($message);
                    }
                }
            } else {
                $this->flash->error($this->helper->translate("安全错误!登录页面禁止刷新!"));
            }
        }
    }
 
    /**
     * 注册完成
     */
    public function finishAction()
    {
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $config = $this->di->get('config');
        $system_name = $config->system_name;
        $this->view->system_name = $system_name;
    }
 
    /**
     * 注册用户
     * @return mixed|void
     */
    public function registerAction()
    {
        $this->isLoginToIndex();
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new RegisterForm();
        $this->view->form = $form;
        $config = $this->di->get('config');
        $system_name = $config->system_name;
        $this->view->system_name = $system_name;
        $ref = $this->request->getPost('r', 'string', '');
        if ($ref == '') $ref = $this->request->getQuery('r', 'string', '');
        $this->view->ref = $ref;
        if ($this->request->isPost()) {
            $post = $this->request->getPost();
            if ($this->security->checkToken()) {
                if ($form->isValid($this->request->getPost())) {
                    $captcha = $this->request->getPost('captcha', 'string');
                    $login = $this->request->getPost('login', 'string');
                    $email = $this->request->getPost('email', 'string');
                    $mobile = $this->request->getPost('mobile', 'string');
                    //校验图形验证码
                    $check_captcha = $this->checkCaptcha($captcha);
                    if ($check_captcha !== '') {
                        $this->flash->error($check_captcha);
                        return;
                    }
                    if (!preg_match("/^1[34578]\d{9}$/", $mobile)) {
                        $this->flash->error("电话号码格式不正确,请重新输入");
                        return;
                    }
                    //数据库查找用户
                    $conditions = "(login = :login: OR mobile = :mobile:)";
                    $parameters = ["login" => $login, "mobile" => $mobile];
                    $user = AdminUser::findFirst([$conditions, "bind" => $parameters]);
                    //如果用户存在
                    if ($user) {
                        $this->flash->error($this->helper->translate("登陆用户名或者手机号/Email已经被注册!"));
                    } else {
                        $conditions = "(email = :email: OR mobile = :mobile:)";
                        $parameters = ["email" => $email, "mobile" => $mobile];
                        $staff = Staff::findFirst([$conditions, "bind" => $parameters]);
                        if ($staff) {
                            $this->flash->error($this->helper->translate("登陆用户名或者手机号/Email已经被注册!"));
                        } else {
                            $new_staff = new Staff();
                            $form->bind($post, $new_staff);
                            $new_staff->id = ukey_next_id();
                            $new_staff->page_limit = 15;
                            if ($new_staff->save()) {
                                $this->flash->success($this->helper->at('创建用户成功,请登录!'));
                                $this->redirect($this->url->get().'admin/index/login');
                                return;
                            } else {
                                $this->flashErrors($new_staff);
                            }
                        }
                    }
                } else {
                    foreach ($form->getMessages() as $message) {
                        $this->flash->error($message);
                    }
                }
            } else {
                $this->flash->error($this->helper->translate("安全错误!登录页面禁止刷新!"));
            }
        }
    }
 
    /**
     * 登出
     **/
    public function logoutAction()
    {
        if ($this->request->isPost()) {
            if ($this->security->checkToken()) {
                $this->session->remove('auth');
            } else {
                $this->flash->error("安全错误!");
            }
        } else {
            $this->session->remove('auth');
        }
        return $this->redirect($this->url->get() . 'admin?f=frame');
    }
 
    /**
     * 忘记密码
     * @return mixed|void
     */
    public function forgetAction()
    {
        $this->isLoginToIndex();
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new RegisterForm();
        $this->view->form = $form;
        $ref = $this->request->getPost('r', 'string', '');
        if ($ref == '') $ref = $this->request->getPost('r', 'string', '');
        $this->view->ref = $ref;
        if ($this->request->isPost()) {
            if ($this->security->checkToken()) {
                $captcha = $this->request->getPost('captcha', 'string');
                $login = $this->request->getPost('login', 'string');
                $email = $this->request->getPost('email', 'string');
                //校验图形验证码
                $check_captcha = $this->checkCaptcha($captcha);
                if ($check_captcha !== '') {
                    $this->flash->error($check_captcha);
                    return;
                }
                //数据库查找用户
                $conditions = "login = :login: and email = :email:";
                $parameters = ["login" => $login, "email" => $email];
                $user = AdminUser::findFirst([$conditions, "bind" => $parameters]);
                //如果用户存在
                if ($user) {
                    $randStr = str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
                    $rand = hash('sha512', substr($randStr, 0, 32));
                    $verify = UserVerify::findFirst([$conditions, "bind" => $parameters]);
                    //是否已经发送过验证码
                    if ($verify) {
                        $verify->verify_code = $rand;
                    } else {
                        $verify = new UserVerify();
                        $verify->id = ukey_next_id();
                        $verify->login = $login;
                        $verify->email = $email;
                        $verify->verify_code = $rand;
                    }
                    //更新验证码,并发送验证码邮件
                    if ($verify->save()) {
                        $this->sendForgotMail($email, $rand);
                        $this->session->set('forget', 'true');
                        $this->redirect($this->url->get() . 'admin/index/confirm');
                    } else {
                        $this->flash->error("发送验证码失败!");
                        foreach ($verify->getMessages() as $message) {
                            error_log($message->getMessage());
                        }
                    }
                } else {
                    $this->flash->error($this->helper->translate("该用户名或者Email不存在!"));
                }
            } else {
                $this->flash->error($this->helper->translate("安全错误!登录页面禁止刷新!"));
            }
        }
    }
 
    /**
     * 去确认邮件
     */
    public function confirmAction()
    {
        $this->isLoginToIndex();
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new RegisterForm();
        $this->view->form = $form;
        if ($this->session->has("forget")) {
            $this->view->title = 'STEP 2 去确认邮件';
            $this->flash->success("向指定的邮件地址发送邮件成功,请您去邮箱确认邮件,如果您没有收到,可以试着去邮箱的垃圾桶里翻翻看,也许或者被被您的邮箱系统拦截了!");
            $this->session->remove("forget");
        } else {
            $this->view->title = '验证信息';
        }
    }
 
    /**
     * 报告页面
     */
    public function reportAction()
    {
        $this->view->company_id = $this->getAuthInfo('company_id');
        $this->setBlankEnvironment();
        $this->helper->title($this->helper->at('数据看板'), true);
    }
 
    /**
     * 校验邮箱,并修改密码
     * @return mixed|void
     */
    public function verifyAction()
    {
        $this->isLoginToIndex();
        $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
        $form = new RegisterForm();
        $this->view->form = $form;
        //校验表单
        $verify_code = $this->request->getQuery('email_verify', 'string', '') ?: $this->request->getPost('email_verify', 'string');
        if (!empty($verify_code)) {
            //数据库查找用户
            $conditions = "verify_code = :verify_code:";
            $parameters = ["verify_code" => $verify_code];
            $verify = UserVerify::findFirst([$conditions, "bind" => $parameters]);
            if ($verify) {
                $password = $this->request->getPost('password', 'string', '');
                if (!empty($password)) {
                    $user = AdminUser::findFirst([
                        "login = :login: AND email = :email:",
                        "bind" => ["login" => $verify->login, "email" => $verify->email]
                    ]);
                    $user->setUserPassword($password);
                    if ($user->update()) {
                        if ($verify->delete()) {
                            $this->view->success = true;
                            $this->flash->success('修改密码成功,请返回重新登录!');
                            $this->dispatcher->forward(["action" => "confirm"]);
                            return;
                        }
                    } else {
                        $this->flash->error('密码修改失败,原因可能发生在写入数据库时,请试着重新验证邮箱!');
                        $this->dispatcher->forward(["action" => "confirm"]);
                        return;
                    }
                } else {
                    return;
                }
                if ($verify->getDatetimeValidity()) {
                    $user = AdminUser::findFirst([
                        "login = :login: AND email = :email:",
                        "bind" => ["login" => $verify->login, "email" => $verify->email]
                    ]);
                    if ($user) {
                        $this->flash->success('邮箱验证成功,请输入新密码!');
                        $this->view->email_verify = $verify_code;
                        return;
                    } else {
                        $this->flash->error('没有找到该用户,无法完成修改密码!');
                        $this->dispatcher->forward(["action" => "confirm"]);
                        return;
                    }
                } else {
                    $this->flash->error('验证码时间失效,无法使用!');
                    $this->dispatcher->forward(["action" => "confirm"]);
                    return;
                }
            } else {
                $this->flash->error('邮箱验证失败,无效的邮箱验证码!');
                $this->dispatcher->forward(["action" => "confirm"]);
                return;
            }
        } else {
            $this->flash->error('邮箱验证失败,无效的请求!');
            $this->dispatcher->forward(["action" => "login"]);
            return;
        }
    }
 
    /**
     * 发行图形验证码
     */
    public function captchaAction()
    {
        $this->view->disable();
        $response = new Response();
        $captcha = new Captcha();
        $response->setHeader("Content-Type", "image/png");
        $response->setContent($captcha->CreateImage($this->session)->asImage());
        return $response;
    }
 
    /**
     * 获取角色列表接口
     */
    public function ajaxGetRoleListAction()
    {
        $response = ['success' => false, 'message' => '系统参数有误', 'data' => []];
        //获取post表单
        if ($this->request->getPost()) {
            $company_type = $this->request->getPost('company_type', 'string', '');
            if ($company_type != '') {
                $model = RoleTemplate::getRoleListByCompanyType($company_type);
                if ($model) {
                    $response['data'] = $model;
                    $response['success'] = true;
                    $response['message'] = $this->helper->translate("数据获取成功!");
                } else {
                    $response['message'] = $this->helper->translate("暂无数据!");
                }
            } else {
                $response['message'] = $this->helper->translate("暂无数据!");
            }
        } else {
            $response['message'] = $this->helper->translate("提交数据格式错误!");
        }
        $this->returnJSON($response);
    }
 
    /**
     * 发行图形验证码
     */
    public function changeCompanyAction()
    {
        $response = ['success' => false, 'message' => '系统参数有误', 'data' => []];
        //获取post表单
        if ($this->request->getPost()) {
            $company_id = $this->request->getPost('company_id', 'string', '');
            //查找角色数据
            if ($company_id) {
                $user_id = $this->getAuthInfo('id');
                $staff_info = Staff::changeUserInfo($user_id, $company_id);
                if ($staff_info) {
                    if ($staff_info->isActive()) {
                        $auth_data = Staff::getAuthDataFromCache($company_id, $user_id);
                        $this->session->set('auth', $auth_data);
                        $cache = $this->di->get('cache');
                        $cache->save('last_login_company_' . $user_id, $company_id);
                        $response['success'] = true;
                        $response['data'] = $auth_data;
                        $response['message'] = $this->helper->translate("切换成功!");
                    } else {
                        $response['message'] = $this->helper->translate("当前用户无效!");
                    }
                } else {
                    $response['message'] = $this->helper->translate("当前用户无效!");
                }
            } else {
                $response['message'] = $this->helper->translate("切换失败!");
            }
        } else {
            $response['message'] = $this->helper->translate("验证表单时出现错误!");
        }
        $this->returnJSON($response);
    }
 
    /**
     * 验证验证码
     * @param $captcha
     * @return string
     */
    private function checkCaptcha($captcha)
    {
        $captcha_session = $this->session->get(Captcha::$session_var);
        $message = '';
        $re = preg_match('/\d{10}/', $captcha_session, $matches);
        if (!$re) {
            $message = $this->helper->translate("验证码获取错误!!");
        }
        if (strtotime('now') - $matches[0] > $this->timeout) {
            $message = $this->helper->translate("验证码超时,请刷新验证码!");
        }
        $captcha_word = explode("_", $captcha_session);
        if ($captcha_word[0] !== $captcha) {
            $message = $this->helper->translate("验证码验证错误!");
        }
        return $message;
    }
 
    /**
     * 发送密码找回邮件模板
     * @param $email
     * @param $rand
     * @noinspection ALL
     * @return void
     */
    public function sendForgotMail($email, $rand)
    {
        $config = $this->di->get('config');
        $server_name = $config->server_name;
        $mail = new SendMail();
        $mail->setServer("localhost", "u-center@eqiyu.com", "wodi67775");
        $mail->setFrom("u-center@eqiyu.com");
        $mail->setReceiver($email);
        $mail->setMailInfo(
            "[系统]安全中心 - 找回密码",
        '<div id="mailContentContainer" class="qmbox qm_con_body_content"><style type="text/css">
      .qmbox *{ margin:0; padding:0; color:#333;}
      .qmbox body{ margin:0; padding:0; font:12px Verdana, Arial, Helvetica, sans-serif;}
      .qmbox a,.qmbox a:link,.qmbox a:visited{color:#80C1E5;font-size:12px;text-decoration:none;}
      .qmbox a:hover{color:#80C1E5;font-size:12px;text-decoration:underline}
      .qmbox a:active{color:#80C1E5;font-size:12px;text-decoration:none;}
      .qmbox ul{list-style:none;}
      .qmbox .marginTop10{margin-top:10px;}
      .qmbox .marginTop15{margin-top:15px;}
      .qmbox .marginTop20{margin-top:20px;}
      .qmbox .marginTop30{margin-top:30px;}
      .qmbox .marginTop40{margin-top:40px;}
      .qmbox .largefont{font-size:20px}
      .qmbox .blackFont{color:#000}
      .qmbox .smallFont{font-size:12px;}
      .qmbox .gray9{color:#999}
      .qmbox #main{width:850px;height:600px;margin:0 auto;}
      .qmbox .linktowb{display:block;width:179px;height:86px;padding:105px 0 0 102px}
      .qmbox .top_div{width:850px;height:85px;background:rgba(24, 149, 232, 0.58) url() no-repeat 0 0;_margin-bottom:-6px}
      .qmbox .bottom_div{width:850px;height:515px;background:rgba(24, 149, 232, 0.58) url() no-repeat 0 0;}
      .qmbox .middle_content{width:630px;height:402px; margin-left:105px;}
      .qmbox .information{margin-left:30px;padding-bottom:105px}
      .qmbox #main2{width:850px;height:600px;margin:0 auto;}
      .qmbox #main2 .bottom_div{width:850px;height:515px;background:rgba(24, 149, 232, 0.58) url() no-repeat 0 0;}
      .qmbox .information2{margin-left:30px;padding-right:30px;width:570px}
      .qmbox .information2 a,.qmbox .information2 a:link,.qmbox .information2 a:visited{color:#0081CB;font-size:14px;text-decoration:none;}
      .qmbox .information2 a:hover{color:#0081CB;font-size:14px;text-decoration:underline}
      .qmbox .information2 a:active{color:#0081CB;font-size:14px;text-decoration:none;}
      .qmbox .aboutMy{width: 565px;padding-bottom:25px;border-bottom:1px dashed #ccc;}
      .qmbox .aboutMy h1{font:bold 18px "微软雅黑",宋体;color:#F98100}
      .qmbox .aboutMy p{font-size:14px;}
      .qmbox .aboutMy .currentInfo .redNomber{font-size:20px;color:#cb0000;}
      .qmbox .aboutMy .currentInfo p{margin-top:20px}
      .qmbox .information2 .links{font-family:Arial, Helvetica, sans-serif}
      .qmbox .shuming{text-align:right;line-height:20px;color:#656565;}
      .qmbox information2 .mailAddr{font-size:20px;color:#000}
      .qmbox .aboutMy2{width: 565px;padding-bottom:25px;border-bottom:1px dashed #ccc;}
      .qmbox .aboutMy2 h1{font:bold 18px "微软雅黑",宋体;color:#F98100}
      .qmbox .aboutMy2 p{font-size:14px;}
      .qmbox .aboutMy2 .currentInfo2{padding:30px 0;}
      .qmbox .aboutMy2 .currentInfo2 p{margin-top:10px;}
      .qmbox .information2 .info2 p{font:12px 宋体;color:#656565;margin:15px 0;}
      .qmbox .foot{text-align:center;margin-top:90px;color:#656565}
      .qmbox .foot3{text-align:center;margin-top:100px;color:#656565}
      .qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {display: none !important;}
      </style>
      <div id="main2"> 
    <div class="top_div"><a target="_blank" href="'.$server_name.'" class="linktowb"></a></div>
    <div class="bottom_div">
        <div class="middle_content">
      <div class="information2">
          <div class="aboutMy2">
        <h1>Hi,亲爱的用户!</h1>
        <div class="currentInfo2">
            <p>您在设置找回密码操作的验证链接地址为:</p>
            <p>
            <span style="color:#F98100;font:bold 18px &quot;微软雅黑&quot;,宋体;">
            <span style="border-bottom:1px dashed #ccc;z-index:1" t="7" onclick="return false;" data="270241">
            <a href="'.$server_name . '/admin/index/verify?email_verify='.$rand.'">'.$rand.'</a>
            </span>
            </span>
            </p>
            <p style="font-size:12px;color:#656565">(请在30分钟内完成验证,30分钟后验证码失效,你需要重新进行验证。)</p>
        </div>
          </div>
          <div class="info2">
        <div class="marginTop20">
            <p>此验证码只能使用一次,验证成功自动失效;</p>
            <p>如果你错误的收到了本电子邮件,请您忽略上述内容</p>
        </div>
          </div>
          <p class="shuming marginTop40">系统<br>
             <span style="border-bottom:1px dashed #ccc;" t="5" times="">' . date('Y-m-d', time()) . '</span></p>
      </div>
      <div class="foot3">本邮件是系统发出的邮件,请勿直接回复。</div>
        </div>
    </div>
    </div></div>',
            ""
        );
        $mail->sendMail();
    }
 
    /**
     * 初始化登录画面
     */
    public function checkdataAction()
    {
        $this->setAdminEnvironment();
    }
}
#12Admin\Controller\IndexController->companyRegisterAction()
#13Phalcon\Dispatcher->callActionMethod(Object(Admin\Controller\IndexController), companyregisterAction, Array())
#14Phalcon\Dispatcher->_dispatch()
#15Phalcon\Dispatcher->dispatch()
/var/www/html/app/Bootstrap.php (630)
<?php
 
namespace MookeCMS;
 
use Phalcon\Logger\Adapter\File as FileAdapter;
use Phalcon\Http\Response;
use Phalcon\Flash\Session;
use Phalcon\DI\FactoryDefault;
use Phalcon\Registry;
use Phalcon\Loader;
use Phalcon\Db\Adapter\Pdo\Mysql;
use Phalcon\Session\Adapter\Redis;
use Phalcon\Mvc\Url;
use Phalcon\Mvc\Application;
use Phalcon\Assets\Filters\Jsmin;
use Phalcon\Session\Adapter\Files;
use Phalcon\Cache\Backend\Redis as BackendRedis;
use Application\Mvc\Helper;
use Application\Acl\DefaultAcl;
use Application\Assets\Manager;
use Application\Mvc\Router\DefaultRouter;
use Application\Assets\Filter\Less;
use System\Model\Configuration;
use Application\Mvc\Config;
 
use Phalcon\Mvc\Collection\Manager as MongodbManager;
 
/**
 * Bootstrap
 * @copyright Copyright (c) 2020 Markboo (http://cnski.cn)
 * @author Markboo <markboo@foxmail.com>
 */
class Bootstrap
{
    /**
     * 监控脚本运行用
    **/
    private $running;
 
    /**
    * 启动函数
    **/
    public function run()
    {
        //开始监测是否程序中断
        $this->running = true;
 
        //创建di
        $di = new FactoryDefault();
 
        //载入配置
        require_once APPLICATION_PATH . '/modules/Application/Mvc/Config.php';
 
        $config = Config::get();
        $di->set( 'config', $config );
 
        //检查系统状态,各依赖关系是否可用
        $this->checkSystemStatus( $di );
 
        //创建注册器
        $registry = new Registry();
        $di->set('registry', $registry );
 
        //创建载入器
        $loader = new Loader();
        $loader->registerNamespaces($config->loader->namespaces->toArray());
 
        //通过配置文件注册目录
        $loader->registerDirs([APPLICATION_PATH . "/plugins/"]);
        $loader->register();
 
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
 
        try {
            //创建mysql数据库连接
            $db = new Mysql([
                "host"     => $config->database->host,
                "username" => $config->database->username,
                "password" => $config->database->password,
                "dbname"   => $config->database->dbname,
                "charset"  => $config->database->charset,
            ]);
            $di->set('db', $db);
 
        } catch (\Exception $e) {
            $this->exceptionExit($e, "数据库访问出错!<br>返回错误信息:");
        }
 
        //设置mongo连接
        $di->set("mongo", function() use ($config) {
                $mongo = new \MongoClient(
                    $config->mongodb->server, ["db" => $config->mongodb->db]
                );
                $db = $mongo->selectDB("manage");
                $db->setSlaveOkay();
                $isMaster = $db->command(["isMaster" => 1]);
                if ($isMaster["ismaster"] == false) {
                    $mongo = new \MongoClient(
                        'mongodb://' . $isMaster['primary'], ["db" => $config->mongodb->db]
                    );
                    $db = $mongo->selectDB("manage");
                    $db->setSlaveOkay();
                }
                return $db;
            },
            true
        );
 
        //new MongoClient("mongodb://localhost:27017", array("username" => "joe", "password" => "test"));
 
        //设置collectionManager
        $di->set('collectionManager', function() {
            return new MongodbManager();
        });
 
        //初始化图
        $this->initView($di);
 
        //创建url
        $url = new Url();
        $url->setBasePath( $config->base_path );
        $url->setBaseUri( $config->base_path) ;
        $di->set( 'url', $url );
 
        //初始化缓存Cache
        $this->initCache($di);
 
        //读取CMS配置模块的配置
        $cmsModel = new Configuration();
        $registry->cms = $cmsModel->getConfig();
 
        //Application
        $application = new Application();
        $application->registerModules( $config->modules->toArray() );
 
        //事务管理器
        $this->initEventManager($di);
 
        //初始化Session
        $this->initSession($di);
 
        //初始化log记录
        try {
            $paylogger = new FileAdapter( APPLICATION_PATH . $config->work_path->pay_log_file );
            $di->set( 'paylogger', $paylogger );
 
            $kingdeelogger = new FileAdapter( APPLICATION_PATH . $config->work_path->kingdee_log_file );
            $di->set( 'kinglogger', $kingdeelogger );
 
            $weixinlogger = new FileAdapter( APPLICATION_PATH . $config->work_path->weixin_log_file );
            $di->set( 'weixinlogger', $weixinlogger );
 
            $launchLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/launch_log.log' );
            $di->set( 'launchLogger', $launchLogger );
 
            $debugLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/debug_log.log' );
            $di->set( 'debugLogger', $debugLogger );
 
            $kingdeeStockLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/kingdee_stock_logger.log' );
            $di->set( 'kingdeeStockLogger', $kingdeeStockLogger );
 
            $inventorycostLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/inventorycost_logger.log' );
            $di->set( 'inventorycostLogger', $inventorycostLogger );
 
        } catch ( \Exception $e ) {
            $this->exceptionExit($e, '支付日志写入出错!<br>返回错误信息:');
        }
 
        //JS Assets
        $this->initAssetsManager($di);
 
        //提示框标签
        $flash = new Session([
            'error'   => 'ui orange inverted flash segment',
            'success' => 'ui green inverted flash segment',
            'notice'  => 'ui blue inverted flash segment',
            'warning' => 'ui orange inverted flash segment',
        ]);
 
        $di->set('flash', $flash);
        $di->set('helper', new Helper());
        $di->set('modules', function() use ($application) { return $application->getModules(); }, true);
 
        //载入访问控制策略
        $acl = new DefaultAcl();
        $di->set('acl', $acl);
 
        //初始化路由
        $this->initRouting($application, $di);
 
        $application->setDI($di);
 
        //主调度进程开始
        $this->dispatch($di);
 
        //结束监测是否程序中断
        $this->running = false;
    }
 
    /**
     * 检查系统状态,各依赖关系是否可用
     * @param $di
     * @return void
     */
    private function checkSystemStatus($di)
    {
        $config = $di->get('config');
 
        //创建mongodb数据库连接,检查
        try {
            $mongo = new \MongoClient( $config->mongodb->server, array(
                "db" => $config->mongodb->db//,
//                "username" => $config->mongodb->username,
//                "password" => $config->mongodb->password
            ));
        } catch ( \Exception $exception ) {
            $this->exceptionExit( $exception, 'MongoDB连接出现错误!' );
        }
 
        if ( !isset($config->work_path->pay_log_file) ) $this->exceptionExit( null, '环境配置中pay_log_file支付日志参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->pay_log_file ) ) $this->exceptionExit( null, '支付日志文件不可写!' );
 
        if ( !isset($config->work_path->data_path) ) $this->exceptionExit( null, '环境配置中data_path数据目录志参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->data_path ) ) $this->exceptionExit( null, 'data数据目录不可写!' );
 
        if ( !isset($config->work_path->qrcode_path) ) $this->exceptionExit( null, '环境配置中qrcode_path二维码存储目录参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->qrcode_path ) ) $this->exceptionExit( null, 'public/static/payqrcode二维码存储目录不可写!' );
 
        if ( !isset($config->work_path->upload_file) ) $this->exceptionExit( null, '环境配置中upload_file上传图片目录参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->upload_file ) ) $this->exceptionExit( null, 'public/static/files上传图片目录不可写!' );
    }
 
    /**
     * 初始化路由
     * @param $application
     * @param $di
     * @return void
     */
    private function initRouting($application, $di)
    {
        $router = new DefaultRouter();
        $router->setDi($di);
        foreach ($application->getModules() as $module) {
            $routesClassName = str_replace('Module', 'Routes', $module['className']);
            if (class_exists($routesClassName)) {
                $routesClass = new $routesClassName();
                $router = $routesClass->init($router);
            }
            $initClassName = str_replace('Module', 'Init', $module['className']);
            if (class_exists($initClassName)) {
                new $initClassName();
            }
        }
        $di->set('router', $router);
    }
 
    /**
     * 初始化资源文件管理
     * @param $di
     * @return void
     **/
    private function initAssetsManager( $di )
    {
        $config = $di->get('config');
        $assetsManager = new Manager();
 
        $js_collection = $assetsManager->collection('js')
            ->setLocal(true)
            ->addFilter(new Jsmin())
            ->setTargetPath(ROOT . '/assets/js.js')
            ->setTargetUri('assets/js.js')
            ->join(true);
 
        if ($config->assets->js) {
            foreach ($config->assets->js as $js) {
                $js_collection->addJs(ROOT . '/' . $js);
            }
        }
 
        //Admin JS Assets
        $assetsManager->collection('modules-admin-js')
            ->setLocal(true)
            ->addFilter(new Jsmin())
            ->setTargetPath(ROOT . '/assets/modules-admin.js')
            ->setTargetUri('assets/modules-admin.js')
            ->join(true);
 
        $less = '/modules/Admin/assets/admin.less';
 
        //Admin LESS Assets
        $assetsManager->collection('modules-admin-less')
            ->setLocal(true)
            ->addFilter(new Less())
            ->setTargetPath(ROOT . '/assets/modules-admin.less')
            ->setTargetUri('assets/modules-admin.less')
            ->join(true)
            ->addCss(APPLICATION_PATH . $less);
 
        $di->set('assets', $assetsManager);
    }
 
    /**
     * 初始化事件管理器
     * @param $di
     * @return void
     **/
    private function initEventManager( $di )
    {
        $eventsManager = new \Phalcon\Events\Manager();
        $dispatcher = new \Phalcon\Mvc\Dispatcher();
 
        /** @var TYPE_NAME $eventsManager */
        /** (前置拦截)在调度器开始分发循环之前触发,此时控制器和动作尚未执行,适合做前置处理:权限检查、本地化设置、移动端检测等 */
        $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \MookeCMS\Plugin\CheckPoint($di->get('request'));
            new \MookeCMS\Plugin\Localization($dispatcher);
            new \MookeCMS\Plugin\AdminLocalization($di->get('config'));
            new \MookeCMS\Plugin\Acl($di->get('acl'), $dispatcher, $di->get('view'));
            new \MookeCMS\Plugin\MobileDetect($di->get('session'), $di->get('view'), $di->get('request'));
            new \MookeCMS\Plugin\Role($di->get('session'), $di->get('view'));
        });
 
        /** @var TYPE_NAME $eventsManager */
        /** (后置处理)在调度器完成分发循环之后触发,此时控制器和动作已经执行完毕,适合做后置处理:修改响应内容、添加全局标题等*/
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \MookeCMS\Plugin\Title($di);
        });
 
        //Profiler
        $registry = $di->get( 'registry' );
 
        if ($registry->cms['PROFILER']) {
            $profiler = new \Phalcon\Db\Profiler();
            $di->set('profiler', $profiler);
 
            /** @var TYPE_NAME $eventsManager */
            $eventsManager->attach('db', function ($event, $db) use ($profiler) {
                if ($event->getType() == 'beforeQuery') {
                    $profiler->startProfile($db->getSQLStatement());
                }
                if ($event->getType() == 'afterQuery') {
                    $profiler->stopProfile();
                }
            });
        }
 
        $db = $di->get('db');
        $db->setEventsManager($eventsManager);
 
        $dispatcher->setEventsManager($eventsManager);
        $di->set('dispatcher', $dispatcher);
    }
 
    /**
     * 初始化视图引擎
     * @param $di
     * @return mixed $view
     **/
    private function initView( $di )
    {
        $view = new \Phalcon\Mvc\View();
 
        define('MAIN_VIEW_PATH', '../../../views/');
        $view->setMainView(MAIN_VIEW_PATH . 'main');
        $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
        $view->setLayout('main');
        $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
 
        //Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
        $volt->setOptions(['compiledPath' => APPLICATION_PATH . '/../data/cache/volt/']);
        $volt->initCompiler();
 
        $compiler = $volt->getCompiler();
        //加入md5过滤器,用在供货管理页面的时间验证上
        $compiler->addFilter('hash', 'md5');
 
        $compiler->addFunction(
            'contains_text',
            function ( $resolvedArgs, $exprArgs ) {
                return 'stripos(' . $resolvedArgs . ')';
            }
        );
 
        $compiler->addFunction(
            'number_format',
            function ( $resolvedArgs ) {
                return 'number_format(' . $resolvedArgs . ', 2 )';
            }
        );
 
        $compiler->addFunction(
            'is_numeric',
            function ( $resolvedArgs ) {
                return 'is_numeric(' . $resolvedArgs . ')';
            }
        );
 
        $compiler->addFunction(
            'number',
            function ( $resolvedArgs ) {
                return 'number_format(' . $resolvedArgs . ', 0 )';
            }
        );
 
        $compiler->addFunction(
            'date_format',
            function ($resolvedArgs) {
                return 'date(' . $resolvedArgs . ')';
            }
        );
 
        $compiler->addFunction(
            'strtotime',
            function ( $resolvedArgs ) {
                return 'strtotime('.$resolvedArgs.')';
            }
        );
 
        $compiler->addFunction(
            'isset',
            function ( $arg ) {
                return 'isset('.$arg.')';
            }
        );
 
        $compiler->addFunction(
            'date_ymd',
            function ( $resolvedArgs ) {
                return 'date(\'Y年m月d日 H:i:s\', '.$resolvedArgs.')';
            }
        );
 
        $compiler->addFunction(
            'allow_check',
            function( $arg ) use ($di) {
            return 0;
        });
 
        $compiler->addFunction(
            'replace_json',
            function( $arg ) {
            return 11;
        });
 
        $compiler->addFunction('mb_substr', 'mb_substr');
        $compiler->addFilter('mb_substr', 'mb_substr');
        $compiler->addFunction('timestamp', 'mktime');
        $compiler->addFunction("dump", "print_r");
        $compiler->addFunction('in_array', 'in_array');
        $compiler->addFunction('phpinfo', 'phpinfo');
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
        $view->timestamp = time();
 
        $ajax = $di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $di->set('view', $view);
        return $view;
    }
 
    /**
     * 初始化Session
     * @desc
     * @param $di
     */
    private function initSession( $di )
    {
        $config = $di->get('config');
        $session = null;
 
        switch ( $config->session ) {
            case 'redis':
                //初始化session并保存至redis里
                $session = new Redis([
                    "uniqueId" => $config->redis->uniqueid,
                    "host" => $config->redis->host,
                    "port" => $config->redis->port,
                    "lifetime" => $config->redis->lifetime,
                    "persistent" => $config->redis->persistent,
                    "prefix" => $config->redis->prefix
                ]);
                break;
            case 'file':
                //初始化session并保存至file里
                $session = new Files();
                break;
        }
 
        if ( !$session ) {
            error_log( 'init session exception exit;' );
            $this->exceptionExit(null, $config->session.'初始化Session保存服务访问出错、Session保存位置检查异常!<br>返回错误信息:');
        }
 
        try {
            $session->start();
        } catch ( \Exception $e ) {
            error_log( '--- session exception ---' );
            $this->exceptionExit($e, $config->session.'初始化Session保存服务访问出错、Session启动异常<br>返回错误信息:');
        }
 
        $di->set('session', $session);
    }
 
    /**
     * 初始化缓存,file类型、memcached类型
     * @param $di
     * @return void
     */
    private function initCache( $di )
    {
        $config = $di->get('config');
        $cache = null;
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 31536000,
            "prefix" => HOST_HASH,
        ]);
 
        switch ($config->cache) {
            case 'file':
                $cache = new \Phalcon\Cache\Backend\File($cacheFrontend, [
                    "cacheDir" => APPLICATION_PATH . "/../data/cache/backend/"
                ]);
                break;
            case 'memcache':
                $cache = new \Phalcon\Cache\Backend\Memcache(
                    $cacheFrontend, [
                    "host" => $config->memcache->host,
                    "port" => $config->memcache->port,
                ]);
                break;
            case 'mongodb':
                $cache = new \Phalcon\Cache\Backend\Mongo($cacheFrontend, [
                    'server'     => $config->mongodb->full_url, //$config->mongodb->server, //"mongodb://localhost:22222",
                    'db'         => $config->mongodb->db, //'caches',
                    'collection' => $config->mongodb->collection, //'images'
                ]);
                break;
        }
 
        $frontCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 31536000]);
        $search_cache = new BackendRedis($frontCache, [
            "uniqueId" => $config->redis->uniqueid,
            "host" => $config->redis->host,
            "port" => $config->redis->port,
            "lifetime" => 31536000,
            "persistent" => $config->redis->persistent,
            "prefix" => 'SearchMapping_',
            "index"   => 2
        ]);
 
        $lockCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 300]);
        $lock_cache = new BackendRedis($lockCache, [
            "uniqueId" => $config->redis->uniqueid,
            "host" => $config->redis->host,
            "port" => $config->redis->port,
            "lifetime" => 300,
            "persistent" => $config->redis->persistent,
            "prefix" => 'Business_Lock_',
            "index"   => 2
        ]);
 
        //d订单序列号生成
        $codeCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 300]);
        $code_cache = new BackendRedis($codeCache, [
            "uniqueId" => $config->redis->uniqueid,
            "host" => $config->redis->host,
            "port" => $config->redis->port,
            "lifetime" => 300,
            "persistent" => $config->redis->persistent,
            "prefix" => 'Mnemonic_Code_',
            "index"   => 2
        ]);
 
        $di->set('cache', $cache, true);
        $di->set('modelsCache', $cache, true);
        $di->set('search_cache', $search_cache, true);
        $di->set('lock_cache', $lock_cache, true);
        $di->set('mnemonic_code_cache', $code_cache, true);
 
        \Application\Widget\Proxy::$cache = $cache; // Modules Widget System
 
        $modelsMetadata = new \Phalcon\Mvc\Model\Metadata\Memory();
        $di->set('modelsMetadata', $modelsMetadata);
    }
 
    /**
     * 调度器管理
     * @param $di
     * @return void
     **/
    private function dispatch($di)
    {
        $router = $di['router'];
        $router->handle();
        $view = $di['view'];
        $dispatcher = $di['dispatcher'];
        $response = $di['response'];
 
        $dispatcher->setModuleName($router->getModuleName());
        $dispatcher->setControllerName($router->getControllerName());
        $dispatcher->setActionName($router->getActionName());
        $dispatcher->setParams($router->getParams());
 
        $moduleName = \Application\Utils\ModuleName::camelize($router->getModuleName());
 
        $ModuleClassName = $moduleName . '\Module';
        if (class_exists($ModuleClassName)) {
            $module = new $ModuleClassName;
            $module->registerAutoloaders();
            $module->registerServices($di);
        }
 
        $view->start();
 
        $registry = $di['registry'];
        if ($registry->cms['DEBUG_MODE']) {
            $debug = new \Phalcon\Debug();
            $debug->listen();
            $dispatcher->dispatch();
        } else {
            try {
                $dispatcher->dispatch();
            } catch (\Phalcon\Exception $e) {
                $view->setViewsDir(__DIR__ . '/modules/Index/views/');
                $view->setPartialsDir('');
                $view->e = $e;
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setHeader(404, 'Not Found');
                    $view->title = '错误页面';
                    $view->partial('error/error404');
                } else {
                    $response->setHeader(503, 'Service Unavailable');
                    $view->title = '错误页面';
                    $view->partial('error/error503');
                }
                $response->sendHeaders();
                echo $response->getContent();
                return;
            }
        }
 
        $view->render(
            $dispatcher->getControllerName(),
            $dispatcher->getActionName(),
            $dispatcher->getParams()
        );
 
        $view->finish();
        $response = $di['response'];
 
        //AJAX
        $request = $di['request'];
        $_ajax = $request->getQuery('_ajax');
 
        if ($_ajax) {
            $contents = $view->getContent();
            $return = new \stdClass();
            $return->html = $contents;
            $return->title = $di->get('helper')->title()->get();
            $return->success = true;
            if ($view->bodyClass) {
                $return->bodyClass = $view->bodyClass;
            }
            $headers = $response->getHeaders()->toArray();
            if (isset($headers[404]) || isset($headers[503])) {
                $return->success = false;
            }
            $response->setContentType('application/json', 'UTF-8');
            $response->setContent(json_encode($return));
        } else {
            $response->setContent($view->getContent());
        }
        $response->sendHeaders();
        echo $response->getContent();
    }
 
    /**
     * @desc 处理异常,并结束脚本
     * @param $exception
     * @param $msg
     * @param $is_exit
     */
    private function exceptionExit( $exception, $msg, $is_exit = true )
    {
        $message = ($exception) ? $msg . $exception->getMessage() : $msg;
        $response = new Response();
        $response->setContent($message . '<br>');
        $response->send();
        if ($is_exi) exit();
    }
 
    /**
     * 程序中断都会触发用此方法注册的函数
     */
    public function shutdown_handler()
    {
        if ($this->running) {
            //echo '<br>这是一个影响系统运行的严重错误!<br>';
            //error_log('这是一个影响系统运行的严重错误!');
            //exit();
        }
    }
 
    /**
     * @desc 捕获Warring错误
     * @param $error
     * @param $error_string
     * @param $filename
     * @param $line
     * @param $symbols
     **/
    public function displayErrorHandler( $error, $error_string, $filename, $line, $symbols )
    {
        /* 错误种类对应列表
        $error_no_arr = array(
            1       => 'ERROR',
            2       => 'WARNING',
            4       => 'PARSE',
            8       => 'NOTICE',
            16      => 'CORE_ERROR',
            32      => 'CORE_WARNING',
            64      => 'COMPILE_ERROR',
            128     => 'COMPILE_WARNING',
            256     => 'USER_ERROR',
            512     => 'USER_WARNING',
            1024    => 'USER_NOTICE',
            2047    => 'ALL',
            2048    => 'STRICT'
        ); */
        if (in_array($error, [1, 2, 4])) {
            $msg = "<br>系统出现严重的错误,请联系系统管理员解决问题。<br>".$error_string."错误内容和错误发生文件名和行数,请检查ERROR的日志文件!<br>";
            $this->exceptionExit(null, $msg, false);
        }
    }
}
#16MookeCMS\Bootstrap->dispatch(Object(Phalcon\Di\FactoryDefault))
/var/www/html/app/Bootstrap.php (194)
<?php
 
namespace MookeCMS;
 
use Phalcon\Logger\Adapter\File as FileAdapter;
use Phalcon\Http\Response;
use Phalcon\Flash\Session;
use Phalcon\DI\FactoryDefault;
use Phalcon\Registry;
use Phalcon\Loader;
use Phalcon\Db\Adapter\Pdo\Mysql;
use Phalcon\Session\Adapter\Redis;
use Phalcon\Mvc\Url;
use Phalcon\Mvc\Application;
use Phalcon\Assets\Filters\Jsmin;
use Phalcon\Session\Adapter\Files;
use Phalcon\Cache\Backend\Redis as BackendRedis;
use Application\Mvc\Helper;
use Application\Acl\DefaultAcl;
use Application\Assets\Manager;
use Application\Mvc\Router\DefaultRouter;
use Application\Assets\Filter\Less;
use System\Model\Configuration;
use Application\Mvc\Config;
 
use Phalcon\Mvc\Collection\Manager as MongodbManager;
 
/**
 * Bootstrap
 * @copyright Copyright (c) 2020 Markboo (http://cnski.cn)
 * @author Markboo <markboo@foxmail.com>
 */
class Bootstrap
{
    /**
     * 监控脚本运行用
    **/
    private $running;
 
    /**
    * 启动函数
    **/
    public function run()
    {
        //开始监测是否程序中断
        $this->running = true;
 
        //创建di
        $di = new FactoryDefault();
 
        //载入配置
        require_once APPLICATION_PATH . '/modules/Application/Mvc/Config.php';
 
        $config = Config::get();
        $di->set( 'config', $config );
 
        //检查系统状态,各依赖关系是否可用
        $this->checkSystemStatus( $di );
 
        //创建注册器
        $registry = new Registry();
        $di->set('registry', $registry );
 
        //创建载入器
        $loader = new Loader();
        $loader->registerNamespaces($config->loader->namespaces->toArray());
 
        //通过配置文件注册目录
        $loader->registerDirs([APPLICATION_PATH . "/plugins/"]);
        $loader->register();
 
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
 
        try {
            //创建mysql数据库连接
            $db = new Mysql([
                "host"     => $config->database->host,
                "username" => $config->database->username,
                "password" => $config->database->password,
                "dbname"   => $config->database->dbname,
                "charset"  => $config->database->charset,
            ]);
            $di->set('db', $db);
 
        } catch (\Exception $e) {
            $this->exceptionExit($e, "数据库访问出错!<br>返回错误信息:");
        }
 
        //设置mongo连接
        $di->set("mongo", function() use ($config) {
                $mongo = new \MongoClient(
                    $config->mongodb->server, ["db" => $config->mongodb->db]
                );
                $db = $mongo->selectDB("manage");
                $db->setSlaveOkay();
                $isMaster = $db->command(["isMaster" => 1]);
                if ($isMaster["ismaster"] == false) {
                    $mongo = new \MongoClient(
                        'mongodb://' . $isMaster['primary'], ["db" => $config->mongodb->db]
                    );
                    $db = $mongo->selectDB("manage");
                    $db->setSlaveOkay();
                }
                return $db;
            },
            true
        );
 
        //new MongoClient("mongodb://localhost:27017", array("username" => "joe", "password" => "test"));
 
        //设置collectionManager
        $di->set('collectionManager', function() {
            return new MongodbManager();
        });
 
        //初始化图
        $this->initView($di);
 
        //创建url
        $url = new Url();
        $url->setBasePath( $config->base_path );
        $url->setBaseUri( $config->base_path) ;
        $di->set( 'url', $url );
 
        //初始化缓存Cache
        $this->initCache($di);
 
        //读取CMS配置模块的配置
        $cmsModel = new Configuration();
        $registry->cms = $cmsModel->getConfig();
 
        //Application
        $application = new Application();
        $application->registerModules( $config->modules->toArray() );
 
        //事务管理器
        $this->initEventManager($di);
 
        //初始化Session
        $this->initSession($di);
 
        //初始化log记录
        try {
            $paylogger = new FileAdapter( APPLICATION_PATH . $config->work_path->pay_log_file );
            $di->set( 'paylogger', $paylogger );
 
            $kingdeelogger = new FileAdapter( APPLICATION_PATH . $config->work_path->kingdee_log_file );
            $di->set( 'kinglogger', $kingdeelogger );
 
            $weixinlogger = new FileAdapter( APPLICATION_PATH . $config->work_path->weixin_log_file );
            $di->set( 'weixinlogger', $weixinlogger );
 
            $launchLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/launch_log.log' );
            $di->set( 'launchLogger', $launchLogger );
 
            $debugLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/debug_log.log' );
            $di->set( 'debugLogger', $debugLogger );
 
            $kingdeeStockLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/kingdee_stock_logger.log' );
            $di->set( 'kingdeeStockLogger', $kingdeeStockLogger );
 
            $inventorycostLogger = new FileAdapter( APPLICATION_PATH . '/../data/logs/inventorycost_logger.log' );
            $di->set( 'inventorycostLogger', $inventorycostLogger );
 
        } catch ( \Exception $e ) {
            $this->exceptionExit($e, '支付日志写入出错!<br>返回错误信息:');
        }
 
        //JS Assets
        $this->initAssetsManager($di);
 
        //提示框标签
        $flash = new Session([
            'error'   => 'ui orange inverted flash segment',
            'success' => 'ui green inverted flash segment',
            'notice'  => 'ui blue inverted flash segment',
            'warning' => 'ui orange inverted flash segment',
        ]);
 
        $di->set('flash', $flash);
        $di->set('helper', new Helper());
        $di->set('modules', function() use ($application) { return $application->getModules(); }, true);
 
        //载入访问控制策略
        $acl = new DefaultAcl();
        $di->set('acl', $acl);
 
        //初始化路由
        $this->initRouting($application, $di);
 
        $application->setDI($di);
 
        //主调度进程开始
        $this->dispatch($di);
 
        //结束监测是否程序中断
        $this->running = false;
    }
 
    /**
     * 检查系统状态,各依赖关系是否可用
     * @param $di
     * @return void
     */
    private function checkSystemStatus($di)
    {
        $config = $di->get('config');
 
        //创建mongodb数据库连接,检查
        try {
            $mongo = new \MongoClient( $config->mongodb->server, array(
                "db" => $config->mongodb->db//,
//                "username" => $config->mongodb->username,
//                "password" => $config->mongodb->password
            ));
        } catch ( \Exception $exception ) {
            $this->exceptionExit( $exception, 'MongoDB连接出现错误!' );
        }
 
        if ( !isset($config->work_path->pay_log_file) ) $this->exceptionExit( null, '环境配置中pay_log_file支付日志参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->pay_log_file ) ) $this->exceptionExit( null, '支付日志文件不可写!' );
 
        if ( !isset($config->work_path->data_path) ) $this->exceptionExit( null, '环境配置中data_path数据目录志参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->data_path ) ) $this->exceptionExit( null, 'data数据目录不可写!' );
 
        if ( !isset($config->work_path->qrcode_path) ) $this->exceptionExit( null, '环境配置中qrcode_path二维码存储目录参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->qrcode_path ) ) $this->exceptionExit( null, 'public/static/payqrcode二维码存储目录不可写!' );
 
        if ( !isset($config->work_path->upload_file) ) $this->exceptionExit( null, '环境配置中upload_file上传图片目录参数未设定!' );
        if ( !is_writeable( APPLICATION_PATH . $config->work_path->upload_file ) ) $this->exceptionExit( null, 'public/static/files上传图片目录不可写!' );
    }
 
    /**
     * 初始化路由
     * @param $application
     * @param $di
     * @return void
     */
    private function initRouting($application, $di)
    {
        $router = new DefaultRouter();
        $router->setDi($di);
        foreach ($application->getModules() as $module) {
            $routesClassName = str_replace('Module', 'Routes', $module['className']);
            if (class_exists($routesClassName)) {
                $routesClass = new $routesClassName();
                $router = $routesClass->init($router);
            }
            $initClassName = str_replace('Module', 'Init', $module['className']);
            if (class_exists($initClassName)) {
                new $initClassName();
            }
        }
        $di->set('router', $router);
    }
 
    /**
     * 初始化资源文件管理
     * @param $di
     * @return void
     **/
    private function initAssetsManager( $di )
    {
        $config = $di->get('config');
        $assetsManager = new Manager();
 
        $js_collection = $assetsManager->collection('js')
            ->setLocal(true)
            ->addFilter(new Jsmin())
            ->setTargetPath(ROOT . '/assets/js.js')
            ->setTargetUri('assets/js.js')
            ->join(true);
 
        if ($config->assets->js) {
            foreach ($config->assets->js as $js) {
                $js_collection->addJs(ROOT . '/' . $js);
            }
        }
 
        //Admin JS Assets
        $assetsManager->collection('modules-admin-js')
            ->setLocal(true)
            ->addFilter(new Jsmin())
            ->setTargetPath(ROOT . '/assets/modules-admin.js')
            ->setTargetUri('assets/modules-admin.js')
            ->join(true);
 
        $less = '/modules/Admin/assets/admin.less';
 
        //Admin LESS Assets
        $assetsManager->collection('modules-admin-less')
            ->setLocal(true)
            ->addFilter(new Less())
            ->setTargetPath(ROOT . '/assets/modules-admin.less')
            ->setTargetUri('assets/modules-admin.less')
            ->join(true)
            ->addCss(APPLICATION_PATH . $less);
 
        $di->set('assets', $assetsManager);
    }
 
    /**
     * 初始化事件管理器
     * @param $di
     * @return void
     **/
    private function initEventManager( $di )
    {
        $eventsManager = new \Phalcon\Events\Manager();
        $dispatcher = new \Phalcon\Mvc\Dispatcher();
 
        /** @var TYPE_NAME $eventsManager */
        /** (前置拦截)在调度器开始分发循环之前触发,此时控制器和动作尚未执行,适合做前置处理:权限检查、本地化设置、移动端检测等 */
        $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \MookeCMS\Plugin\CheckPoint($di->get('request'));
            new \MookeCMS\Plugin\Localization($dispatcher);
            new \MookeCMS\Plugin\AdminLocalization($di->get('config'));
            new \MookeCMS\Plugin\Acl($di->get('acl'), $dispatcher, $di->get('view'));
            new \MookeCMS\Plugin\MobileDetect($di->get('session'), $di->get('view'), $di->get('request'));
            new \MookeCMS\Plugin\Role($di->get('session'), $di->get('view'));
        });
 
        /** @var TYPE_NAME $eventsManager */
        /** (后置处理)在调度器完成分发循环之后触发,此时控制器和动作已经执行完毕,适合做后置处理:修改响应内容、添加全局标题等*/
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \MookeCMS\Plugin\Title($di);
        });
 
        //Profiler
        $registry = $di->get( 'registry' );
 
        if ($registry->cms['PROFILER']) {
            $profiler = new \Phalcon\Db\Profiler();
            $di->set('profiler', $profiler);
 
            /** @var TYPE_NAME $eventsManager */
            $eventsManager->attach('db', function ($event, $db) use ($profiler) {
                if ($event->getType() == 'beforeQuery') {
                    $profiler->startProfile($db->getSQLStatement());
                }
                if ($event->getType() == 'afterQuery') {
                    $profiler->stopProfile();
                }
            });
        }
 
        $db = $di->get('db');
        $db->setEventsManager($eventsManager);
 
        $dispatcher->setEventsManager($eventsManager);
        $di->set('dispatcher', $dispatcher);
    }
 
    /**
     * 初始化视图引擎
     * @param $di
     * @return mixed $view
     **/
    private function initView( $di )
    {
        $view = new \Phalcon\Mvc\View();
 
        define('MAIN_VIEW_PATH', '../../../views/');
        $view->setMainView(MAIN_VIEW_PATH . 'main');
        $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
        $view->setLayout('main');
        $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
 
        //Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $di);
        $volt->setOptions(['compiledPath' => APPLICATION_PATH . '/../data/cache/volt/']);
        $volt->initCompiler();
 
        $compiler = $volt->getCompiler();
        //加入md5过滤器,用在供货管理页面的时间验证上
        $compiler->addFilter('hash', 'md5');
 
        $compiler->addFunction(
            'contains_text',
            function ( $resolvedArgs, $exprArgs ) {
                return 'stripos(' . $resolvedArgs . ')';
            }
        );
 
        $compiler->addFunction(
            'number_format',
            function ( $resolvedArgs ) {
                return 'number_format(' . $resolvedArgs . ', 2 )';
            }
        );
 
        $compiler->addFunction(
            'is_numeric',
            function ( $resolvedArgs ) {
                return 'is_numeric(' . $resolvedArgs . ')';
            }
        );
 
        $compiler->addFunction(
            'number',
            function ( $resolvedArgs ) {
                return 'number_format(' . $resolvedArgs . ', 0 )';
            }
        );
 
        $compiler->addFunction(
            'date_format',
            function ($resolvedArgs) {
                return 'date(' . $resolvedArgs . ')';
            }
        );
 
        $compiler->addFunction(
            'strtotime',
            function ( $resolvedArgs ) {
                return 'strtotime('.$resolvedArgs.')';
            }
        );
 
        $compiler->addFunction(
            'isset',
            function ( $arg ) {
                return 'isset('.$arg.')';
            }
        );
 
        $compiler->addFunction(
            'date_ymd',
            function ( $resolvedArgs ) {
                return 'date(\'Y年m月d日 H:i:s\', '.$resolvedArgs.')';
            }
        );
 
        $compiler->addFunction(
            'allow_check',
            function( $arg ) use ($di) {
            return 0;
        });
 
        $compiler->addFunction(
            'replace_json',
            function( $arg ) {
            return 11;
        });
 
        $compiler->addFunction('mb_substr', 'mb_substr');
        $compiler->addFilter('mb_substr', 'mb_substr');
        $compiler->addFunction('timestamp', 'mktime');
        $compiler->addFunction("dump", "print_r");
        $compiler->addFunction('in_array', 'in_array');
        $compiler->addFunction('phpinfo', 'phpinfo');
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
        $view->timestamp = time();
 
        $ajax = $di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $di->set('view', $view);
        return $view;
    }
 
    /**
     * 初始化Session
     * @desc
     * @param $di
     */
    private function initSession( $di )
    {
        $config = $di->get('config');
        $session = null;
 
        switch ( $config->session ) {
            case 'redis':
                //初始化session并保存至redis里
                $session = new Redis([
                    "uniqueId" => $config->redis->uniqueid,
                    "host" => $config->redis->host,
                    "port" => $config->redis->port,
                    "lifetime" => $config->redis->lifetime,
                    "persistent" => $config->redis->persistent,
                    "prefix" => $config->redis->prefix
                ]);
                break;
            case 'file':
                //初始化session并保存至file里
                $session = new Files();
                break;
        }
 
        if ( !$session ) {
            error_log( 'init session exception exit;' );
            $this->exceptionExit(null, $config->session.'初始化Session保存服务访问出错、Session保存位置检查异常!<br>返回错误信息:');
        }
 
        try {
            $session->start();
        } catch ( \Exception $e ) {
            error_log( '--- session exception ---' );
            $this->exceptionExit($e, $config->session.'初始化Session保存服务访问出错、Session启动异常<br>返回错误信息:');
        }
 
        $di->set('session', $session);
    }
 
    /**
     * 初始化缓存,file类型、memcached类型
     * @param $di
     * @return void
     */
    private function initCache( $di )
    {
        $config = $di->get('config');
        $cache = null;
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 31536000,
            "prefix" => HOST_HASH,
        ]);
 
        switch ($config->cache) {
            case 'file':
                $cache = new \Phalcon\Cache\Backend\File($cacheFrontend, [
                    "cacheDir" => APPLICATION_PATH . "/../data/cache/backend/"
                ]);
                break;
            case 'memcache':
                $cache = new \Phalcon\Cache\Backend\Memcache(
                    $cacheFrontend, [
                    "host" => $config->memcache->host,
                    "port" => $config->memcache->port,
                ]);
                break;
            case 'mongodb':
                $cache = new \Phalcon\Cache\Backend\Mongo($cacheFrontend, [
                    'server'     => $config->mongodb->full_url, //$config->mongodb->server, //"mongodb://localhost:22222",
                    'db'         => $config->mongodb->db, //'caches',
                    'collection' => $config->mongodb->collection, //'images'
                ]);
                break;
        }
 
        $frontCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 31536000]);
        $search_cache = new BackendRedis($frontCache, [
            "uniqueId" => $config->redis->uniqueid,
            "host" => $config->redis->host,
            "port" => $config->redis->port,
            "lifetime" => 31536000,
            "persistent" => $config->redis->persistent,
            "prefix" => 'SearchMapping_',
            "index"   => 2
        ]);
 
        $lockCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 300]);
        $lock_cache = new BackendRedis($lockCache, [
            "uniqueId" => $config->redis->uniqueid,
            "host" => $config->redis->host,
            "port" => $config->redis->port,
            "lifetime" => 300,
            "persistent" => $config->redis->persistent,
            "prefix" => 'Business_Lock_',
            "index"   => 2
        ]);
 
        //d订单序列号生成
        $codeCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 300]);
        $code_cache = new BackendRedis($codeCache, [
            "uniqueId" => $config->redis->uniqueid,
            "host" => $config->redis->host,
            "port" => $config->redis->port,
            "lifetime" => 300,
            "persistent" => $config->redis->persistent,
            "prefix" => 'Mnemonic_Code_',
            "index"   => 2
        ]);
 
        $di->set('cache', $cache, true);
        $di->set('modelsCache', $cache, true);
        $di->set('search_cache', $search_cache, true);
        $di->set('lock_cache', $lock_cache, true);
        $di->set('mnemonic_code_cache', $code_cache, true);
 
        \Application\Widget\Proxy::$cache = $cache; // Modules Widget System
 
        $modelsMetadata = new \Phalcon\Mvc\Model\Metadata\Memory();
        $di->set('modelsMetadata', $modelsMetadata);
    }
 
    /**
     * 调度器管理
     * @param $di
     * @return void
     **/
    private function dispatch($di)
    {
        $router = $di['router'];
        $router->handle();
        $view = $di['view'];
        $dispatcher = $di['dispatcher'];
        $response = $di['response'];
 
        $dispatcher->setModuleName($router->getModuleName());
        $dispatcher->setControllerName($router->getControllerName());
        $dispatcher->setActionName($router->getActionName());
        $dispatcher->setParams($router->getParams());
 
        $moduleName = \Application\Utils\ModuleName::camelize($router->getModuleName());
 
        $ModuleClassName = $moduleName . '\Module';
        if (class_exists($ModuleClassName)) {
            $module = new $ModuleClassName;
            $module->registerAutoloaders();
            $module->registerServices($di);
        }
 
        $view->start();
 
        $registry = $di['registry'];
        if ($registry->cms['DEBUG_MODE']) {
            $debug = new \Phalcon\Debug();
            $debug->listen();
            $dispatcher->dispatch();
        } else {
            try {
                $dispatcher->dispatch();
            } catch (\Phalcon\Exception $e) {
                $view->setViewsDir(__DIR__ . '/modules/Index/views/');
                $view->setPartialsDir('');
                $view->e = $e;
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setHeader(404, 'Not Found');
                    $view->title = '错误页面';
                    $view->partial('error/error404');
                } else {
                    $response->setHeader(503, 'Service Unavailable');
                    $view->title = '错误页面';
                    $view->partial('error/error503');
                }
                $response->sendHeaders();
                echo $response->getContent();
                return;
            }
        }
 
        $view->render(
            $dispatcher->getControllerName(),
            $dispatcher->getActionName(),
            $dispatcher->getParams()
        );
 
        $view->finish();
        $response = $di['response'];
 
        //AJAX
        $request = $di['request'];
        $_ajax = $request->getQuery('_ajax');
 
        if ($_ajax) {
            $contents = $view->getContent();
            $return = new \stdClass();
            $return->html = $contents;
            $return->title = $di->get('helper')->title()->get();
            $return->success = true;
            if ($view->bodyClass) {
                $return->bodyClass = $view->bodyClass;
            }
            $headers = $response->getHeaders()->toArray();
            if (isset($headers[404]) || isset($headers[503])) {
                $return->success = false;
            }
            $response->setContentType('application/json', 'UTF-8');
            $response->setContent(json_encode($return));
        } else {
            $response->setContent($view->getContent());
        }
        $response->sendHeaders();
        echo $response->getContent();
    }
 
    /**
     * @desc 处理异常,并结束脚本
     * @param $exception
     * @param $msg
     * @param $is_exit
     */
    private function exceptionExit( $exception, $msg, $is_exit = true )
    {
        $message = ($exception) ? $msg . $exception->getMessage() : $msg;
        $response = new Response();
        $response->setContent($message . '<br>');
        $response->send();
        if ($is_exi) exit();
    }
 
    /**
     * 程序中断都会触发用此方法注册的函数
     */
    public function shutdown_handler()
    {
        if ($this->running) {
            //echo '<br>这是一个影响系统运行的严重错误!<br>';
            //error_log('这是一个影响系统运行的严重错误!');
            //exit();
        }
    }
 
    /**
     * @desc 捕获Warring错误
     * @param $error
     * @param $error_string
     * @param $filename
     * @param $line
     * @param $symbols
     **/
    public function displayErrorHandler( $error, $error_string, $filename, $line, $symbols )
    {
        /* 错误种类对应列表
        $error_no_arr = array(
            1       => 'ERROR',
            2       => 'WARNING',
            4       => 'PARSE',
            8       => 'NOTICE',
            16      => 'CORE_ERROR',
            32      => 'CORE_WARNING',
            64      => 'COMPILE_ERROR',
            128     => 'COMPILE_WARNING',
            256     => 'USER_ERROR',
            512     => 'USER_WARNING',
            1024    => 'USER_NOTICE',
            2047    => 'ALL',
            2048    => 'STRICT'
        ); */
        if (in_array($error, [1, 2, 4])) {
            $msg = "<br>系统出现严重的错误,请联系系统管理员解决问题。<br>".$error_string."错误内容和错误发生文件名和行数,请检查ERROR的日志文件!<br>";
            $this->exceptionExit(null, $msg, false);
        }
    }
}
#17MookeCMS\Bootstrap->run()
/var/www/html/public/index.php (30)
<?php
chdir(dirname(__DIR__));
define('ROOT', __DIR__);
isset($_SERVER['HTTP_HOST']) ?
    define('HOST_HASH', substr(md5($_SERVER['HTTP_HOST']), 0, 12)) :
    define('HOST_HASH', substr(md5('erp.eqiyu.com'), 0, 12));
defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production_zhixdl'));
define('APPLICATION_PATH', __DIR__ . '/../app');
// 注册自动加载器
spl_autoload_register(function($className) {
    if ($className === 'Application\\Mvc\\Model\\Config') {
        $lang = detectUserLanguage();
        $langConfigClass = "Application\\Mvc\\Model\\Config" . strtoupper($lang);
        //如果存在对应语言的配置类,则加载它
        if (class_exists($langConfigClass)) {
            class_alias($langConfigClass, $className);
            return true;
        }
    }
});
// 语言检测函数
function detectUserLanguage()
{
    $lang = 'zh';
    if (isset($_SESSION['user_language'])) $lang = $_SESSION['user_language'];
    return $lang;
}
require_once APPLICATION_PATH . '/Bootstrap.php';
$bootstrap = new MookeCMS\Bootstrap();
$bootstrap->run();
//设置读取url中的语言设置
$lang = 'zh';
if (isset($_GET['lang'])) $lang = $_GET['lang'];
elseif (isset($_SESSION['user_language'])) $lang = $_SESSION['user_language'];
if ($lang) $_SESSION['user_language'] = $lang;
KeyValue
_url/admin/index/companyregister
KeyValue
REDIRECT_REDIRECT_LANGen_US.UTF-8
REDIRECT_REDIRECT_LC_ALLen_US.UTF-8
REDIRECT_REDIRECT_PYTHONIOENCODINGutf-8
REDIRECT_REDIRECT_HTTPSon
REDIRECT_REDIRECT_SSL_TLS_SNItest.eqiyu.com
REDIRECT_REDIRECT_STATUS200
REDIRECT_LANGen_US.UTF-8
REDIRECT_LC_ALLen_US.UTF-8
REDIRECT_PYTHONIOENCODINGutf-8
REDIRECT_APPLICATION_ENVtest
REDIRECT_HTTPSon
REDIRECT_SSL_TLS_SNItest.eqiyu.com
REDIRECT_STATUS200
LANGen_US.UTF-8
LC_ALLen_US.UTF-8
PYTHONIOENCODINGutf-8
APPLICATION_ENVtest
HTTPSon
SSL_TLS_SNItest.eqiyu.com
SSL_SERVER_S_DN_CNtest.eqiyu.com
SSL_SERVER_I_DN_CUS
SSL_SERVER_I_DN_ODigiCert Inc
SSL_SERVER_I_DN_OUwww.digicert.com
SSL_SERVER_I_DN_CNEncryption Everywhere DV TLS CA - G2
SSL_VERSION_INTERFACEmod_ssl/2.2.15
SSL_VERSION_LIBRARYOpenSSL/1.0.1e-fips
SSL_PROTOCOLTLSv1.2
SSL_SECURE_RENEGtrue
SSL_COMPRESS_METHODNULL
SSL_CIPHERECDHE-RSA-AES256-GCM-SHA384
SSL_CIPHER_EXPORTfalse
SSL_CIPHER_USEKEYSIZE256
SSL_CIPHER_ALGKEYSIZE256
SSL_CLIENT_VERIFYNONE
SSL_SERVER_M_VERSION3
SSL_SERVER_M_SERIAL0A3D028A74F527EF5EEBE5F541B3AE29
SSL_SERVER_V_STARTJun 15 00:00:00 2026 GMT
SSL_SERVER_V_ENDSep 12 23:59:59 2026 GMT
SSL_SERVER_S_DN/CN=test.eqiyu.com
SSL_SERVER_I_DN/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=Encryption Everywhere DV TLS CA - G2
SSL_SERVER_A_KEYrsaEncryption
SSL_SERVER_A_SIGsha256WithRSAEncryption
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_HOSTtest.eqiyu.com
PATH/sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE<address>Apache/2.2.15 (CentOS) Server at test.eqiyu.com Port 443</address>\n
SERVER_SOFTWAREApache/2.2.15 (CentOS)
SERVER_NAMEtest.eqiyu.com
SERVER_ADDR10.162.198.80
SERVER_PORT443
REMOTE_ADDR216.73.216.230
DOCUMENT_ROOT/var/www/html
SERVER_ADMINadmin@zhixdl.com
SCRIPT_FILENAME/var/www/html/public/index.php
REMOTE_PORT29448
REDIRECT_QUERY_STRING_url=/admin/index/companyregister
REDIRECT_URL/public/admin/index/companyregister
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
QUERY_STRING_url=/admin/index/companyregister
REQUEST_URI/admin/index/companyregister
SCRIPT_NAME/public/index.php
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1781695131.253
REQUEST_TIME1781695131
#Path
0/var/www/html/public/index.php
1/var/www/html/app/Bootstrap.php
2/var/www/html/app/modules/Application/Mvc/Config.php
3/var/www/html/app/config/environment/test.php
4/var/www/html/app/config/global.php
5/var/www/html/app/config/modules.php
6/var/www/html/app/modules/Application/Loader/Modules.php
7/var/www/html/vendor/autoload.php
8/var/www/html/vendor/composer/autoload_real.php
9/var/www/html/vendor/composer/platform_check.php
10/var/www/html/vendor/composer/ClassLoader.php
11/var/www/html/vendor/composer/include_paths.php
12/var/www/html/vendor/composer/autoload_static.php
13/var/www/html/vendor/guzzlehttp/promises/src/functions_include.php
14/var/www/html/vendor/guzzlehttp/promises/src/functions.php
15/var/www/html/vendor/guzzlehttp/psr7/src/functions_include.php
16/var/www/html/vendor/guzzlehttp/psr7/src/functions.php
17/var/www/html/vendor/adbario/php-dot-notation/src/helpers.php
18/var/www/html/vendor/guzzlehttp/guzzle/src/functions_include.php
19/var/www/html/vendor/guzzlehttp/guzzle/src/functions.php
20/var/www/html/vendor/paragonie/random_compat/lib/random.php
21/var/www/html/vendor/paragonie/random_compat/lib/byte_safe_strings.php
22/var/www/html/vendor/paragonie/random_compat/lib/cast_to_int.php
23/var/www/html/vendor/paragonie/random_compat/lib/error_polyfill.php
24/var/www/html/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php
25/var/www/html/vendor/paragonie/random_compat/lib/random_int.php
26/var/www/html/vendor/symfony/polyfill-mbstring/bootstrap.php
27/var/www/html/vendor/markbaker/complex/classes/src/functions/abs.php
28/var/www/html/vendor/markbaker/complex/classes/src/functions/acos.php
29/var/www/html/vendor/markbaker/complex/classes/src/functions/acosh.php
30/var/www/html/vendor/markbaker/complex/classes/src/functions/acot.php
31/var/www/html/vendor/markbaker/complex/classes/src/functions/acoth.php
32/var/www/html/vendor/markbaker/complex/classes/src/functions/acsc.php
33/var/www/html/vendor/markbaker/complex/classes/src/functions/acsch.php
34/var/www/html/vendor/markbaker/complex/classes/src/functions/argument.php
35/var/www/html/vendor/markbaker/complex/classes/src/functions/asec.php
36/var/www/html/vendor/markbaker/complex/classes/src/functions/asech.php
37/var/www/html/vendor/markbaker/complex/classes/src/functions/asin.php
38/var/www/html/vendor/markbaker/complex/classes/src/functions/asinh.php
39/var/www/html/vendor/markbaker/complex/classes/src/functions/atan.php
40/var/www/html/vendor/markbaker/complex/classes/src/functions/atanh.php
41/var/www/html/vendor/markbaker/complex/classes/src/functions/conjugate.php
42/var/www/html/vendor/markbaker/complex/classes/src/functions/cos.php
43/var/www/html/vendor/markbaker/complex/classes/src/functions/cosh.php
44/var/www/html/vendor/markbaker/complex/classes/src/functions/cot.php
45/var/www/html/vendor/markbaker/complex/classes/src/functions/coth.php
46/var/www/html/vendor/markbaker/complex/classes/src/functions/csc.php
47/var/www/html/vendor/markbaker/complex/classes/src/functions/csch.php
48/var/www/html/vendor/markbaker/complex/classes/src/functions/exp.php
49/var/www/html/vendor/markbaker/complex/classes/src/functions/inverse.php
50/var/www/html/vendor/markbaker/complex/classes/src/functions/ln.php
51/var/www/html/vendor/markbaker/complex/classes/src/functions/log2.php
52/var/www/html/vendor/markbaker/complex/classes/src/functions/log10.php
53/var/www/html/vendor/markbaker/complex/classes/src/functions/negative.php
54/var/www/html/vendor/markbaker/complex/classes/src/functions/pow.php
55/var/www/html/vendor/markbaker/complex/classes/src/functions/rho.php
56/var/www/html/vendor/markbaker/complex/classes/src/functions/sec.php
57/var/www/html/vendor/markbaker/complex/classes/src/functions/sech.php
58/var/www/html/vendor/markbaker/complex/classes/src/functions/sin.php
59/var/www/html/vendor/markbaker/complex/classes/src/functions/sinh.php
60/var/www/html/vendor/markbaker/complex/classes/src/functions/sqrt.php
61/var/www/html/vendor/markbaker/complex/classes/src/functions/tan.php
62/var/www/html/vendor/markbaker/complex/classes/src/functions/tanh.php
63/var/www/html/vendor/markbaker/complex/classes/src/functions/theta.php
64/var/www/html/vendor/markbaker/complex/classes/src/operations/add.php
65/var/www/html/vendor/markbaker/complex/classes/src/operations/subtract.php
66/var/www/html/vendor/markbaker/complex/classes/src/operations/multiply.php
67/var/www/html/vendor/markbaker/complex/classes/src/operations/divideby.php
68/var/www/html/vendor/markbaker/complex/classes/src/operations/divideinto.php
69/var/www/html/vendor/markbaker/matrix/classes/src/Functions/adjoint.php
70/var/www/html/vendor/markbaker/matrix/classes/src/Functions/antidiagonal.php
71/var/www/html/vendor/markbaker/matrix/classes/src/Functions/cofactors.php
72/var/www/html/vendor/markbaker/matrix/classes/src/Functions/determinant.php
73/var/www/html/vendor/markbaker/matrix/classes/src/Functions/diagonal.php
74/var/www/html/vendor/markbaker/matrix/classes/src/Functions/identity.php
75/var/www/html/vendor/markbaker/matrix/classes/src/Functions/inverse.php
76/var/www/html/vendor/markbaker/matrix/classes/src/Functions/minors.php
77/var/www/html/vendor/markbaker/matrix/classes/src/Functions/trace.php
78/var/www/html/vendor/markbaker/matrix/classes/src/Functions/transpose.php
79/var/www/html/vendor/markbaker/matrix/classes/src/Operations/add.php
80/var/www/html/vendor/markbaker/matrix/classes/src/Operations/directsum.php
81/var/www/html/vendor/markbaker/matrix/classes/src/Operations/subtract.php
82/var/www/html/vendor/markbaker/matrix/classes/src/Operations/multiply.php
83/var/www/html/vendor/markbaker/matrix/classes/src/Operations/divideby.php
84/var/www/html/vendor/markbaker/matrix/classes/src/Operations/divideinto.php
85/var/www/html/vendor/wzhih/guomi/src/overwrite.php
86/var/www/html/app/modules/Application/Mvc/View/Engine/Volt.php
87/var/www/html/app/modules/Application/Widget/Proxy.php
88/var/www/html/app/modules/System/Model/Configuration.php
89/var/www/html/app/modules/Application/Assets/Manager.php
90/var/www/html/app/modules/Application/Assets/Filter/Less.php
91/var/www/html/app/modules/Application/Mvc/Helper.php
92/var/www/html/app/modules/Menu/Helper/Menu.php
93/var/www/html/app/modules/Application/Acl/DefaultAcl.php
94/var/www/html/app/modules/Managements/Model/Staff.php
95/var/www/html/app/modules/Application/Mvc/Model/Model.php
96/var/www/html/app/modules/Managements/Model/Companys.php
97/var/www/html/app/modules/Application/Mvc/Modules.php
98/var/www/html/app/modules/Admin/Controller/AdminUserController.php
99/var/www/html/app/modules/Application/Mvc/Controller.php
100/var/www/html/app/modules/Admin/Controller/IndexController.php
101/var/www/html/app/modules/Analysis/Controller/ApiController.php
102/var/www/html/app/modules/Eshop/Controller/CartController.php
103/var/www/html/app/modules/Eshop/Controller/IndexController.php
104/var/www/html/app/modules/Goods/Controller/AdminController.php
105/var/www/html/app/modules/Goods/Controller/ApiController.php
106/var/www/html/app/modules/Goods/Controller/IndexController.php
107/var/www/html/app/modules/Index/Controller/BarcodeController.php
108/var/www/html/app/modules/Index/Controller/IndexController.php
109/var/www/html/app/modules/Import/Controller/ApiController.php
110/var/www/html/app/modules/Import/Controller/ExporterController.php
111/var/www/html/app/modules/Import/Controller/FeeController.php
112/var/www/html/app/modules/Import/Controller/LogisticsController.php
113/var/www/html/app/modules/Import/Controller/LogisticsGoodsController.php
114/var/www/html/app/modules/Import/Controller/NetworkController.php
115/var/www/html/app/modules/Import/Controller/NetworkCustomerController.php
116/var/www/html/app/modules/Import/Controller/NetworkCustomerFeeController.php
117/var/www/html/app/modules/Import/Controller/NetworkCustomerStaffController.php
118/var/www/html/app/modules/Import/Controller/NetworkSettlePriceController.php
119/var/www/html/app/modules/Import/Controller/PackageController.php
120/var/www/html/app/modules/Import/Controller/PrintController.php
121/var/www/html/app/modules/Import/Controller/ReviewNoticeController.php
122/var/www/html/app/modules/Import/Controller/StaffController.php
123/var/www/html/app/modules/Import/Controller/TransportController.php
124/var/www/html/app/modules/Managements/Controller/ApiController.php
125/var/www/html/app/modules/Managements/Controller/BranchController.php
126/var/www/html/app/modules/Managements/Controller/CompanyController.php
127/var/www/html/app/modules/Managements/Controller/RoleController.php
128/var/www/html/app/modules/Managements/Controller/StaffController.php
129/var/www/html/app/modules/Distribution/Controller/AgentController.php
130/var/www/html/app/modules/Distribution/Controller/ApiController.php
131/var/www/html/app/modules/Distribution/Controller/RetailerController.php
132/var/www/html/app/modules/Distribution/Controller/ShopController.php
133/var/www/html/app/modules/Mobile/Controller/ActivityController.php
134/var/www/html/app/modules/Mobile/Controller/AdminController.php
135/var/www/html/vendor/wechatdeveloper/include.php
136/var/www/html/app/modules/Mobile/Controller/ApiController.php
137/var/www/html/app/modules/Mobile/Controller/AuthController.php
138/var/www/html/app/modules/Mobile/Controller/AutomatController.php
139/var/www/html/app/modules/Mobile/Controller/BlockController.php
140/var/www/html/app/modules/Mobile/Controller/CommercialController.php
141/var/www/html/app/modules/Mobile/Controller/CommonController.php
142/var/www/html/app/modules/Mobile/Controller/DevelController.php
143/var/www/html/app/modules/Mobile/Controller/DominoController.php
144/var/www/html/app/modules/Mobile/Controller/GushiciController.php
145/var/www/html/app/modules/Mobile/Controller/IndexController.php
146/var/www/html/app/modules/Mobile/Controller/LogisticsController.php
147/var/www/html/app/modules/Mobile/Controller/MessageController.php
148/var/www/html/app/modules/Mobile/Controller/NetworkerController.php
149/var/www/html/app/modules/Mobile/Controller/PaymentController.php
150/var/www/html/app/modules/Mobile/Controller/PiccController.php
151/var/www/html/app/modules/Mobile/Controller/PostsController.php
152/var/www/html/app/modules/Mobile/Controller/RetailController.php
153/var/www/html/app/modules/Mobile/Controller/ShopController.php
154/var/www/html/app/modules/Mobile/Controller/SxbController.php
155/var/www/html/app/modules/Mobile/Controller/TestController.php
156/var/www/html/app/modules/Mobile/Controller/WechatController.php
157/var/www/html/app/modules/Mobile/Controller/WeixinworkController.php
158/var/www/html/app/modules/Mobile/Controller/WmsController.php
159/var/www/html/app/modules/Open/Controller/ApiController.php
160/var/www/html/app/modules/Open/Controller/CassMallController.php
161/var/www/html/app/modules/Open/Controller/CompanyCustomizeServiceController.php
162/var/www/html/app/modules/Open/Controller/GjpqqdController.php
163/var/www/html/app/modules/Open/Controller/LunjuanfengController.php
164/var/www/html/app/modules/Open/Controller/WeixinopenController.php
165/var/www/html/app/modules/Sales/Controller/ApiController.php
166/var/www/html/app/modules/Sales/Controller/BarcodeController.php
167/var/www/html/app/modules/Sales/Controller/CartController.php
168/var/www/html/app/modules/Sales/Controller/ImportController.php
169/var/www/html/app/modules/Sales/Controller/LogisticsProfitController.php
170/var/www/html/app/modules/Sales/Controller/OrderController.php
171/var/www/html/app/modules/Sales/Controller/PromoBudgetController.php
172/var/www/html/app/modules/Sales/Controller/SuborderController.php
173/var/www/html/app/modules/Purchase/Controller/AdminController.php
174/var/www/html/app/modules/Purchase/Controller/ApiController.php
175/var/www/html/app/modules/Purchase/Controller/GoodsPriceController.php
176/var/www/html/app/modules/Purchase/Controller/ManageController.php
177/var/www/html/app/modules/Purchase/Controller/PurchaseRefundController.php
178/var/www/html/app/modules/Purchase/Controller/RequestController.php
179/var/www/html/app/modules/Purchase/Controller/SupplierController.php
180/var/www/html/app/modules/Reports/Controller/AdminController.php
181/var/www/html/app/modules/Reports/Controller/ApiController.php
182/var/www/html/app/modules/Shipment/Controller/ApiController.php
183/var/www/html/app/modules/Shipment/Controller/BillingController.php
184/var/www/html/app/modules/Shipment/Controller/CustomerController.php
185/var/www/html/app/modules/Shipment/Controller/CustomerLevelController.php
186/var/www/html/app/modules/Shipment/Controller/DriverController.php
187/var/www/html/app/modules/Shipment/Controller/ExpectController.php
188/var/www/html/app/modules/Shipment/Controller/ExpressController.php
189/var/www/html/app/modules/Shipment/Controller/FeeController.php
190/var/www/html/app/modules/Shipment/Controller/FreightController.php
191/var/www/html/app/modules/Shipment/Controller/FreightRuleController.php
192/var/www/html/app/modules/Shipment/Controller/NetworkController.php
193/var/www/html/app/modules/Shipment/Controller/OperatorController.php
194/var/www/html/app/modules/Shipment/Controller/PlanController.php
195/var/www/html/app/modules/Shipment/Controller/RegionController.php
196/var/www/html/app/modules/Shipment/Controller/RotasController.php
197/var/www/html/app/modules/Shipment/Controller/RouteCarrierController.php
198/var/www/html/app/modules/Shipment/Controller/RouteController.php
199/var/www/html/app/modules/Shipment/Controller/ServiceMatrixController.php
200/var/www/html/app/modules/Shipment/Controller/ServiceProductController.php
201/var/www/html/app/modules/Shipment/Controller/SettlementController.php
202/var/www/html/app/modules/Shipment/Controller/ShippingOrderController.php
203/var/www/html/app/modules/Shipment/Controller/StationController.php
204/var/www/html/app/modules/Shipment/Controller/TransportAccountController.php
205/var/www/html/app/modules/Shipment/Controller/TransportController.php
206/var/www/html/app/modules/Shipment/Controller/TransportOrderController.php
207/var/www/html/app/modules/Shipment/Controller/VehicleController.php
208/var/www/html/app/modules/Shipment/Controller/VehicleTypeController.php
209/var/www/html/app/modules/Shop/Controller/ApiController.php
210/var/www/html/app/modules/Shop/Controller/ClientAddressController.php
211/var/www/html/app/modules/Shop/Controller/ClientController.php
212/var/www/html/app/modules/Shop/Controller/CustomerFlagController.php
213/var/www/html/app/modules/Shop/Controller/CustomerLevelController.php
214/var/www/html/app/modules/Shop/Controller/CustomerTypeController.php
215/var/www/html/app/modules/Shop/Controller/InviteController.php
216/var/www/html/app/modules/Shop/Controller/PointController.php
217/var/www/html/app/modules/Shop/Controller/SearchHistoryController.php
218/var/www/html/app/modules/Shop/Controller/ShopsController.php
219/var/www/html/app/modules/Shop/Controller/VisitController.php
220/var/www/html/app/modules/Stock/Controller/ApiController.php
221/var/www/html/app/modules/Stock/Controller/CapacityController.php
222/var/www/html/app/modules/Stock/Controller/CategoryController.php
223/var/www/html/app/modules/Stock/Controller/DeliveryController.php
224/var/www/html/app/modules/Stock/Controller/DispatchBillController.php
225/var/www/html/app/modules/Stock/Controller/DropShippingController.php
226/var/www/html/app/modules/Stock/Controller/GoodsTrackController.php
227/var/www/html/app/modules/Stock/Controller/ImportController.php
228/var/www/html/app/modules/Stock/Controller/InOutTypeController.php
229/var/www/html/app/modules/Stock/Controller/InboundController.php
230/var/www/html/app/modules/Stock/Controller/InventoryController.php
231/var/www/html/app/modules/Stock/Controller/MovingController.php
232/var/www/html/app/modules/Stock/Controller/OperatorController.php
233/var/www/html/app/modules/Stock/Controller/OutboundController.php
234/var/www/html/app/modules/Stock/Controller/PickingController.php
235/var/www/html/app/modules/Stock/Controller/PositionController.php
236/var/www/html/app/modules/Stock/Controller/ProductOwnerController.php
237/var/www/html/app/modules/Stock/Controller/ReceiptController.php
238/var/www/html/app/modules/Stock/Controller/SereSummaryController.php
239/var/www/html/app/modules/Stock/Controller/ShelveBatchController.php
240/var/www/html/app/modules/Stock/Controller/StockHistoryController.php
241/var/www/html/app/modules/Stock/Controller/TakeController.php
242/var/www/html/app/modules/Stock/Controller/TransferController.php
243/var/www/html/app/modules/Stock/Controller/WarehouseAreaController.php
244/var/www/html/app/modules/Stock/Controller/WarehouseController.php
245/var/www/html/app/modules/Stock/Controller/WarningController.php
246/var/www/html/app/modules/Stock/Controller/WaveOrderController.php
247/var/www/html/app/modules/Stock/Controller/WaveRuleController.php
248/var/www/html/app/modules/Weixin/Controller/IndexController.php
249/var/www/html/app/modules/Content/Controller/ApiController.php
250/var/www/html/app/modules/Content/Controller/HotkeyController.php
251/var/www/html/app/modules/Content/Controller/PosterController.php
252/var/www/html/app/modules/Content/Controller/ServicerController.php
253/var/www/html/app/modules/Content/Controller/SmallappController.php
254/var/www/html/app/modules/Content/Controller/WeixinController.php
255/var/www/html/app/modules/Content/Controller/WorkServicerController.php
256/var/www/html/app/modules/Finance/Controller/AbstractController.php
257/var/www/html/app/modules/Finance/Controller/AccountController.php
258/var/www/html/app/modules/Finance/Controller/AgentProfitController.php
259/var/www/html/app/modules/Finance/Controller/ApiController.php
260/var/www/html/app/modules/Finance/Controller/AssistantResourceController.php
261/var/www/html/app/modules/Finance/Controller/BankdaybookController.php
262/var/www/html/app/modules/Finance/Controller/BillController.php
263/var/www/html/app/modules/Finance/Controller/CashoutlistController.php
264/var/www/html/app/modules/Finance/Controller/ClearingformController.php
265/var/www/html/app/modules/Finance/Controller/CollectionAccountController.php
266/var/www/html/app/modules/Finance/Controller/CostAdjustController.php
267/var/www/html/app/modules/Finance/Controller/CreditController.php
268/var/www/html/app/modules/Finance/Controller/CurrencyController.php
269/var/www/html/app/modules/Finance/Controller/DaybookController.php
270/var/www/html/app/modules/Finance/Controller/DealingsController.php
271/var/www/html/app/modules/Finance/Controller/DisburseController.php
272/var/www/html/app/modules/Finance/Controller/FinanceAccountController.php
273/var/www/html/app/modules/Finance/Controller/HistoryController.php
274/var/www/html/app/modules/Finance/Controller/InboundCostController.php
275/var/www/html/app/modules/Finance/Controller/IncomeController.php
276/var/www/html/app/modules/Finance/Controller/InventoryCostController.php
277/var/www/html/app/modules/Finance/Controller/NoticeController.php
278/var/www/html/app/modules/Finance/Controller/PayableController.php
279/var/www/html/app/modules/Finance/Controller/PaybackController.php
280/var/www/html/app/modules/Finance/Controller/PaymentTypeController.php
281/var/www/html/app/modules/Finance/Controller/PaymoneyController.php
282/var/www/html/app/modules/Finance/Controller/RebateController.php
283/var/www/html/app/modules/Finance/Controller/ReceiptController.php
284/var/www/html/app/modules/Finance/Controller/ReceivableController.php
285/var/www/html/app/modules/Finance/Controller/ReceiveController.php
286/var/www/html/app/modules/Finance/Controller/RecpayTypeController.php
287/var/www/html/app/modules/Finance/Controller/SalesReportController.php
288/var/www/html/app/modules/Finance/Controller/SereSummaryController.php
289/var/www/html/app/modules/Finance/Controller/SettingsController.php
290/var/www/html/app/modules/Finance/Controller/ShophistoryController.php
291/var/www/html/app/modules/Finance/Controller/StatementAccountController.php
292/var/www/html/app/modules/Finance/Controller/SuppliercashoutController.php
293/var/www/html/app/modules/Finance/Controller/SupplierhistoryController.php
294/var/www/html/app/modules/Finance/Controller/TitleController.php
295/var/www/html/app/modules/Finance/Controller/TransferController.php
296/var/www/html/app/modules/Finance/Controller/VerificationController.php
297/var/www/html/app/modules/Finance/Controller/WithdrawalAccountController.php
298/var/www/html/app/modules/Aftersale/Controller/AgencyclaimController.php
299/var/www/html/app/modules/Aftersale/Controller/ApiController.php
300/var/www/html/app/modules/Aftersale/Controller/AppraisalsController.php
301/var/www/html/app/modules/Aftersale/Controller/CategoryController.php
302/var/www/html/app/modules/Aftersale/Controller/FactoryController.php
303/var/www/html/app/modules/Aftersale/Controller/IdentifyController.php
304/var/www/html/app/modules/Aftersale/Controller/NumberController.php
305/var/www/html/app/modules/Aftersale/Controller/ProcessController.php
306/var/www/html/app/modules/Aftersale/Controller/RefundsController.php
307/var/www/html/app/modules/Aftersale/Controller/RegisterController.php
308/var/www/html/app/modules/Aftersale/Controller/RequestController.php
309/var/www/html/app/modules/Aftersale/Controller/ReturnAddressController.php
310/var/www/html/app/modules/Aftersale/Controller/SymptomController.php
311/var/www/html/app/modules/Setting/Controller/AddressController.php
312/var/www/html/app/modules/Setting/Controller/AdminappConfigController.php
313/var/www/html/app/modules/Setting/Controller/ApiController.php
314/var/www/html/app/modules/Setting/Controller/BaseGoodsController.php
315/var/www/html/app/modules/Setting/Controller/CategoryController.php
316/var/www/html/app/modules/Setting/Controller/CompanyBrandController.php
317/var/www/html/app/modules/Setting/Controller/CountryController.php
318/var/www/html/app/modules/Setting/Controller/CurrencyController.php
319/var/www/html/app/modules/Setting/Controller/FloorController.php
320/var/www/html/app/modules/Setting/Controller/JobController.php
321/var/www/html/app/modules/Setting/Controller/PackController.php
322/var/www/html/app/modules/Setting/Controller/PaymentController.php
323/var/www/html/app/modules/Setting/Controller/PrintTemplateController.php
324/var/www/html/app/modules/Setting/Controller/RoomController.php
325/var/www/html/app/modules/Setting/Controller/SearchMappingController.php
326/var/www/html/app/modules/Setting/Controller/SmsTemplateController.php
327/var/www/html/app/modules/Setting/Controller/SystemGoodsController.php
328/var/www/html/app/modules/Setting/Controller/TariffController.php
329/var/www/html/app/modules/Setting/Controller/UnitsController.php
330/var/www/html/app/modules/Setting/Controller/WorkflowController.php
331/var/www/html/app/modules/Operation/Controller/ApiController.php
332/var/www/html/app/modules/Operation/Controller/DominoController.php
333/var/www/html/app/modules/Operation/Controller/EvaluateController.php
334/var/www/html/app/modules/Operation/Controller/GoodsCollectionController.php
335/var/www/html/app/modules/Operation/Controller/LotteryController.php
336/var/www/html/app/modules/Operation/Controller/PriceReviewController.php
337/var/www/html/app/modules/Operation/Controller/PromotionController.php
338/var/www/html/app/modules/Operation/Controller/ShareController.php
339/var/www/html/app/modules/Operation/Controller/ShopGoodsController.php
340/var/www/html/app/modules/Operation/Controller/SpuController.php
341/var/www/html/app/modules/System/Controller/ApiController.php
342/var/www/html/app/modules/System/Controller/AppConfigController.php
343/var/www/html/app/modules/System/Controller/BillingController.php
344/var/www/html/app/modules/System/Controller/CompanyTypeController.php
345/var/www/html/app/modules/System/Controller/ConfigurationController.php
346/var/www/html/app/modules/System/Controller/CrontabLogController.php
347/var/www/html/app/modules/System/Controller/DownloadTaskController.php
348/var/www/html/app/modules/System/Controller/FilesController.php
349/var/www/html/app/modules/System/Controller/InOutTypeController.php
350/var/www/html/app/modules/System/Controller/LanguageController.php
351/var/www/html/app/modules/System/Controller/MessageController.php
352/var/www/html/app/modules/System/Controller/MissionController.php
353/var/www/html/app/modules/System/Controller/NotifyController.php
354/var/www/html/app/modules/System/Controller/ProfileController.php
355/var/www/html/app/modules/System/Controller/RecPayDetailDefaultTypeController.php
356/var/www/html/app/modules/System/Controller/RoleController.php
357/var/www/html/app/modules/System/Controller/ThirdController.php
358/var/www/html/app/modules/System/Controller/TranslateController.php
359/var/www/html/app/modules/Platform/Controller/AlibabaController.php
360/var/www/html/app/modules/Platform/Controller/GuanjiapoController.php
361/var/www/html/app/modules/Platform/Controller/JingdongController.php
362/var/www/html/app/modules/Platform/Controller/PinduoduoController.php
363/var/www/html/app/modules/Platform/Controller/TaobaoController.php
364/var/www/html/app/modules/Platform/Controller/ToutiaoController.php
365/var/www/html/app/modules/Platform/Controller/VipshopController.php
366/var/www/html/app/modules/Automat/Controller/ApiController.php
367/var/www/html/app/modules/Automat/Controller/DeviceController.php
368/var/www/html/app/modules/Automat/Controller/IndexController.php
369/var/www/html/app/modules/Automat/Controller/ManagerController.php
370/var/www/html/app/modules/Automat/Controller/OrdersController.php
371/var/www/html/app/modules/Automat/Controller/SiteController.php
372/var/www/html/app/modules/Automat/Controller/StaffController.php
373/var/www/html/app/modules/Automat/Controller/StockController.php
374/var/www/html/app/modules/Automat/Controller/TaskController.php
375/var/www/html/app/modules/Support/Controller/ActivityController.php
376/var/www/html/app/modules/Support/Controller/ApiController.php
377/var/www/html/app/modules/Support/Controller/HoubeixiangController.php
378/var/www/html/app/modules/Support/Controller/IndexController.php
379/var/www/html/app/modules/Support/Controller/OrdersController.php
380/var/www/html/app/modules/Support/Controller/ShopsController.php
381/var/www/html/app/modules/Support/Controller/StaffController.php
382/var/www/html/app/modules/Support/Controller/SuixinbaoController.php
383/var/www/html/app/modules/Support/Controller/TrucksController.php
384/var/www/html/app/modules/Hotel/Controller/ApiController.php
385/var/www/html/app/modules/Hotel/Controller/CleanCheckController.php
386/var/www/html/app/modules/Hotel/Controller/CleanWorkController.php
387/var/www/html/app/modules/Hotel/Controller/FloorRoomController.php
388/var/www/html/app/modules/Hotel/Controller/HotelOrderController.php
389/var/www/html/app/modules/Hotel/Controller/RoomRepairController.php
390/var/www/html/app/config/allow.php
391/var/www/html/app/config/deny.php
392/var/www/html/app/modules/Application/Mvc/Router/DefaultRouter.php
393/var/www/html/app/modules/Admin/Routes.php
394/var/www/html/app/modules/Analysis/Routes.php
395/var/www/html/app/modules/Eshop/Routes.php
396/var/www/html/app/modules/Goods/Routes.php
397/var/www/html/app/modules/Application/Mvc/Helper/CmsCache.php
398/var/www/html/app/modules/Index/Routes.php
399/var/www/html/app/modules/Import/Routes.php
400/var/www/html/app/modules/Managements/Routes.php
401/var/www/html/app/modules/Distribution/Routes.php
402/var/www/html/app/modules/Mobile/Routes.php
403/var/www/html/app/modules/Open/Routes.php
404/var/www/html/app/modules/Sales/Routes.php
405/var/www/html/app/modules/Purchase/Routes.php
406/var/www/html/app/modules/Reports/Routes.php
407/var/www/html/app/modules/Shipment/Routes.php
408/var/www/html/app/modules/Shop/Routes.php
409/var/www/html/app/modules/Stock/Routes.php
410/var/www/html/app/modules/Weixin/Routes.php
411/var/www/html/app/modules/Content/Routes.php
412/var/www/html/app/modules/Finance/Routes.php
413/var/www/html/app/modules/Aftersale/Routes.php
414/var/www/html/app/modules/Setting/Routes.php
415/var/www/html/app/modules/Operation/Routes.php
416/var/www/html/app/modules/System/Routes.php
417/var/www/html/app/modules/Platform/Routes.php
418/var/www/html/app/modules/Automat/Routes.php
419/var/www/html/app/modules/Support/Routes.php
420/var/www/html/app/modules/Hotel/Routes.php
421/var/www/html/app/modules/Application/Utils/ModuleName.php
422/var/www/html/app/modules/Admin/Module.php
423/var/www/html/app/plugins/CheckPoint.php
424/var/www/html/app/plugins/Localization.php
425/var/www/html/app/modules/System/Model/Translate.php
426/var/www/html/app/plugins/AdminLocalization.php
427/var/www/html/data/translations/admin/cn.php
428/var/www/html/app/plugins/Acl.php
429/var/www/html/app/plugins/MobileDetect.php
430/var/www/html/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php
431/var/www/html/app/plugins/Role.php
432/var/www/html/app/modules/Admin/Form/CompanyRegisterForm.php
433/var/www/html/app/modules/System/Model/CompanyType.php
Memory
Usage11272192