Phalcon Framework 3.2.2

Phalcon\Di\Exception: Service 'db' wasn't found in the dependency injection container

/data/apps/tank/releases/20180712135829/app/Controllers/Base/WebControllerBase.php (53)
#08776644434->get(db, null)
#1Phalcon\Di->getShared(db)
#2Phalcon\Mvc\Model\Manager->_getConnection(Object(Carter\Modules\SiteContent\Models\SiteContent: ), null)
#3Phalcon\Mvc\Model\Manager->getReadConnection(Object(Carter\Modules\SiteContent\Models\SiteContent: ))
#4310-349-7577->getReadConnection()
#5Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Carter\Modules\SiteContent\Models\SiteContent: ), Object(Phalcon\Di\FactoryDefault))
#6Phalcon\Mvc\Model\MetaData->_initialize(Object(Carter\Modules\SiteContent\Models\SiteContent: ), carter\modules\sitecontent\models\sitecontent-site_contents, site_contents, )
#7Phalcon\Mvc\Model\MetaData->readMetaDataIndex(Object(Carter\Modules\SiteContent\Models\SiteContent: ), 4)
#8289-755-5533->getDataTypes(Object(Carter\Modules\SiteContent\Models\SiteContent: ))
#9Phalcon\Mvc\Model::_invokeFinder(findFirstByName, Array([0] => bottom))
#10Phalcon\Mvc\Model::__callStatic(findFirstByName, Array([0] => bottom))
/data/apps/tank/releases/20180712135829/app/Controllers/Base/WebControllerBase.php (53)
<?php
 
namespace Carter\Controllers\Base;
 
use Carter\Modules\SiteContent\Models\SiteContent;
use Carter\Modules\Member\Models\Member;
 
abstract class WebControllerBase extends ViewControllerBase
{
    protected $member_id = null;
 
    /**
     * @var Member
     */
    protected $currentMember = false;
 
    public function onConstruct()
    {
        parent::onConstruct();
 
        $referer = $_SERVER['HTTP_REFERER'];
        $session = di("session");
        if ($referer && strpos($referer, 'miitbeian.gov.cn') !== false) {
            $this->view->pick('temp/index');
            $session->set('r', $referer);
            return;
        }
 
        if ($session->get('r')) {
            $this->view->pick('temp/index');
            return;
        }
 
        / 如果用户已经登录,给成员变量初始化赋值
        if (service('member/session')->isLogin()) {
            $this->currentMember = service('member/session')->getCurrentMember();
            $this->member_id = $this->currentMember->getId();
        }
 
        / 设置全局视图参数
        $this->setBottomViewVars();
        $this->setMemberViewVars();
 
        /当前导航高亮需要的参数
        $this->view->setVars([
            'request_uri' => $this->request->getURI(),
            'app_name' => "找油罐"
        ]);
    }
 
    private function setBottomViewVars()
    {
        $siteContent = SiteContent::findFirstByName('bottom');
        $this->view->setVars([
            'bottom' => $siteContent->getText(),
            'hostname' => gethostname()
        ]);
    }
 
    private function setMemberViewVars()
    {
        if ($this->currentMember) {
            $memberToken = service('member/token')->get();
            if (!$memberToken) {
                service('member/session')->logout();
                return $this->response->redirect('/');
            }
            $vipExpenseSum = service("loan/query")->getExpenseSum($this->currentMember->getId());
            $vipGrade = service("member/query")->getVipGrade($vipExpenseSum);
            if ($vipGrade == 7) {
                $vipDistance = 0;
            } else {
                $vipDistance = service("member/query")->getVipNextGradeDistance($vipGrade, $vipExpenseSum);
            }
            $unreadMsgCount = service('message/query')->getCountReadingMessages($this->member_id);
            $this->view->setVar('sessionToken', $memberToken->getToken());
 
            $chinapnrUnactived = 0;
            $chinaPnr = $this->currentMember->getChinapnr();
            if ($chinaPnr) {
                if ($chinaPnr->getStatus() == 3) {
                    $chinapnrUnactived = 1;
                }
            }
            $this->view->setVars([
                'member' => $this->currentMember,
                'name' => $this->currentMember->getMobile(),
                'vipGrade' => $vipGrade,
                'vipDistance' => $vipDistance,
                'vipExpenseSum' => $vipExpenseSum,
                'unreadMsgCount' => $unreadMsgCount,
                'chinapnrUnactived' => $chinapnrUnactived
            ]);
        } else {
            $this->view->setVar('sessionToken', '');
        }
    }
}
#11Carter\Controllers\Base\WebControllerBase->setBottomViewVars()
/data/apps/tank/releases/20180712135829/app/Controllers/Base/WebControllerBase.php (41)
<?php
 
namespace Carter\Controllers\Base;
 
use Carter\Modules\SiteContent\Models\SiteContent;
use Carter\Modules\Member\Models\Member;
 
abstract class WebControllerBase extends ViewControllerBase
{
    protected $member_id = null;
 
    /**
     * @var Member
     */
    protected $currentMember = false;
 
    public function onConstruct()
    {
        parent::onConstruct();
 
        $referer = $_SERVER['HTTP_REFERER'];
        $session = di("session");
        if ($referer && strpos($referer, 'miitbeian.gov.cn') !== false) {
            $this->view->pick('temp/index');
            $session->set('r', $referer);
            return;
        }
 
        if ($session->get('r')) {
            $this->view->pick('temp/index');
            return;
        }
 
        / 如果用户已经登录,给成员变量初始化赋值
        if (service('member/session')->isLogin()) {
            $this->currentMember = service('member/session')->getCurrentMember();
            $this->member_id = $this->currentMember->getId();
        }
 
        / 设置全局视图参数
        $this->setBottomViewVars();
        $this->setMemberViewVars();
 
        /当前导航高亮需要的参数
        $this->view->setVars([
            'request_uri' => $this->request->getURI(),
            'app_name' => "找油罐"
        ]);
    }
 
    private function setBottomViewVars()
    {
        $siteContent = SiteContent::findFirstByName('bottom');
        $this->view->setVars([
            'bottom' => $siteContent->getText(),
            'hostname' => gethostname()
        ]);
    }
 
    private function setMemberViewVars()
    {
        if ($this->currentMember) {
            $memberToken = service('member/token')->get();
            if (!$memberToken) {
                service('member/session')->logout();
                return $this->response->redirect('/');
            }
            $vipExpenseSum = service("loan/query")->getExpenseSum($this->currentMember->getId());
            $vipGrade = service("member/query")->getVipGrade($vipExpenseSum);
            if ($vipGrade == 7) {
                $vipDistance = 0;
            } else {
                $vipDistance = service("member/query")->getVipNextGradeDistance($vipGrade, $vipExpenseSum);
            }
            $unreadMsgCount = service('message/query')->getCountReadingMessages($this->member_id);
            $this->view->setVar('sessionToken', $memberToken->getToken());
 
            $chinapnrUnactived = 0;
            $chinaPnr = $this->currentMember->getChinapnr();
            if ($chinaPnr) {
                if ($chinaPnr->getStatus() == 3) {
                    $chinapnrUnactived = 1;
                }
            }
            $this->view->setVars([
                'member' => $this->currentMember,
                'name' => $this->currentMember->getMobile(),
                'vipGrade' => $vipGrade,
                'vipDistance' => $vipDistance,
                'vipExpenseSum' => $vipExpenseSum,
                'unreadMsgCount' => $unreadMsgCount,
                'chinapnrUnactived' => $chinapnrUnactived
            ]);
        } else {
            $this->view->setVar('sessionToken', '');
        }
    }
}
#12Carter\Controllers\Base\WebControllerBase->onConstruct()
#13(805) 223-4906->__construct()
#14Phalcon\Di->get(Carter\Controllers\Web\IndexController, null)
#15980-498-1690->getShared(Carter\Controllers\Web\IndexController)
#16909-387-4382->_dispatch()
#17Phalcon\Dispatcher->dispatch()
#18250-483-3885->handle()
/data/apps/tank/releases/20180712021322/public/index.php (22)
<?php
error_reporting(E_ALL^E_NOTICE);
/* @var $response Phalcon\Http\Response */
try {
    define('FRONT_SITE_LOCAL', '/local.Carter.com.cn');
    define('FRONT_SITE_DEV', '/dev.Carter.com.cn');
    define('FRONT_SITE_DEMO', '/qa.Carter.com.cn');
    define('BACK_SITE_DEV', '/dev-vendor.Carter.com.cn');
    define('BACK_SITE_DEMO', '/qa-vendor.Carter.com.cn');
    define('FRONT_SITE_PRO', '\:/www.Carter.com.cn');
    define('BACK_SITE_PRO', '/vendor.Carter.com.cn');
    define('DOLPHIN_VENDOR_ID', 5);
    define('DOLPHIN_PRODUCT_ID', 2);
    define('DOLPHIN_TYPE_ID', 2);
    define('PIAOJU_VENDOR_ID', 3);
    define('PIAOJU_PRODUCT_ID', 3);
 
    / 将引导加载也放入try内,以便捕获异常
    require '../bootstrap/bootstrap.php';
 
    / 正常的处理流程,由Application调度分发,捕获所有期间抛出的异常
    app()->handle()->send();
 
} catch (\Exception $e) {
    if (in_array(app_env(), ['production', 'qa',])) {
        $class = get_class($e);
        $line = $e->getLine();
        $file = $e->getFile();
        error_log("[$class] $file on line $line");
 
        $renderLevel = di('view')->getRenderLevel();
        $response = new \Phalcon\Http\Response();
        if (\Phalcon\Mvc\View::LEVEL_LAYOUT == $renderLevel) {
            / Api接口
            $response->setJsonContent([
                'status' => false,
                'msg' => $e->getMessage()
            ]);
        } else {
            / View视图
            $response->redirect("/route404");
        }
        $response->send();
    } else {
        $debug = new \Phalcon\Debug();
        $debug->onUncaughtException($e);
    }
}
KeyValue
KeyValue
USERcarter
HOME/home/carter
HTTP_USER_AGENTMozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
HTTP_ACCEPT_ENCODINGgzip
HTTP_CONNECTIONclose
HTTP_HOST118.31.18.247:443
HTTP_ORIGIN
APP_ENVmobile
SCRIPT_FILENAME/data/apps/tank/current/public/index.php
PATH_TRANSLATED/data/apps/tank/current/public
PATH_INFO
REDIRECT_STATUS200
SERVER_NAMEm.zhaoyouguan.com
SERVER_PORT443
SERVER_ADDR172.16.78.168
REMOTE_PORT42714
REMOTE_ADDR54.67.41.57
SERVER_SOFTWAREnginx/1.10.3
GATEWAY_INTERFACECGI/1.1
HTTPSon
REQUEST_SCHEMEhttps
SERVER_PROTOCOLHTTP/1.1
DOCUMENT_ROOT/data/apps/tank/current/public
DOCUMENT_URI/index.php
REQUEST_URI/
SCRIPT_NAME/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHODGET
QUERY_STRING
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1542703746.5764
REQUEST_TIME1542703746
#Path
0/data/apps/tank/releases/20180712021322/public/index.php
1/data/apps/tank/releases/20180712135829/bootstrap/bootstrap.php
2/data/apps/tank/shared/vendor/autoload.php
3/data/apps/tank/shared/vendor/composer/autoload_real.php
4/data/apps/tank/shared/vendor/composer/ClassLoader.php
5/data/apps/tank/shared/vendor/composer/autoload_static.php
6/data/apps/tank/shared/vendor/symfony/polyfill-ctype/bootstrap.php
7/data/apps/tank/shared/vendor/symfony/polyfill-mbstring/bootstrap.php
8/data/apps/tank/shared/vendor/ircmaxell/password-compat/lib/password.php
9/data/apps/tank/shared/vendor/guzzlehttp/promises/src/functions_include.php
10/data/apps/tank/shared/vendor/guzzlehttp/promises/src/functions.php
11/data/apps/tank/shared/vendor/guzzlehttp/psr7/src/functions_include.php
12/data/apps/tank/shared/vendor/guzzlehttp/psr7/src/functions.php
13/data/apps/tank/shared/vendor/symfony/polyfill-php55/bootstrap.php
14/data/apps/tank/shared/vendor/symfony/polyfill-php54/bootstrap.php
15/data/apps/tank/shared/vendor/guzzlehttp/guzzle/src/functions_include.php
16/data/apps/tank/shared/vendor/guzzlehttp/guzzle/src/functions.php
17/data/apps/tank/shared/vendor/qiniu/php-sdk/src/Qiniu/functions.php
18/data/apps/tank/shared/vendor/qiniu/php-sdk/src/Qiniu/Config.php
19/data/apps/tank/shared/vendor/swiftmailer/swiftmailer/lib/swift_required.php
20/data/apps/tank/shared/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
21/data/apps/tank/shared/vendor/cn-carter-lee/core/src/Core/helpers.php
22/data/apps/tank/releases/20180712135829/app/Modules/Helpers/helpers.php
23/data/apps/tank/releases/20180712135829/libs/aliyun-php-sdkv2-20130815/aliyun.php
24/data/apps/tank/releases/20180712135829/libs/aliyun-php-sdkv2-20130815/libs/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php
25/data/apps/tank/releases/20180712135829/bootstrap/cache/config.php
26/data/apps/tank/releases/20180712135829/app/Controllers/Web/AboutController.php
27/data/apps/tank/releases/20180712135829/app/Controllers/Base/WebControllerBase.php
28/data/apps/tank/releases/20180712135829/app/Controllers/Base/ViewControllerBase.php
29/data/apps/tank/releases/20180712135829/app/Controllers/Base/ControllerBase.php
30/data/apps/tank/shared/vendor/cn-carter-lee/core/src/Core/Mvc/Controller.php
31/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/CaptchaController.php
32/data/apps/tank/releases/20180712135829/app/Controllers/Base/ApiControllerBase.php
33/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/DisclosureController.php
34/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/ForgetController.php
35/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/MemberController.php
36/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/MobileController.php
37/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/ProvinceController.php
38/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/RegisterController.php
39/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/TestController.php
40/data/apps/tank/releases/20180712135829/app/Controllers/Web/Api/WechatController.php
41/data/apps/tank/releases/20180712135829/app/Controllers/Web/ArticleController.php
42/data/apps/tank/releases/20180712135829/app/Controllers/Web/ContainerController.php
43/data/apps/tank/releases/20180712135829/app/Controllers/Web/ForgetController.php
44/data/apps/tank/releases/20180712135829/app/Controllers/Web/IndexController.php
45/data/apps/tank/releases/20180712135829/app/Controllers/Web/LogoutController.php
46/data/apps/tank/releases/20180712135829/app/Controllers/Base/WebAuthControllerBase.php
47/data/apps/tank/releases/20180712135829/app/Controllers/Web/Member/BorrowerController.php
48/data/apps/tank/releases/20180712135829/app/Controllers/Web/Member/IndexController.php
49/data/apps/tank/releases/20180712135829/app/Controllers/Web/Member/ScheduleController.php
50/data/apps/tank/releases/20180712135829/app/Controllers/Web/Member/SecureController.php
51/data/apps/tank/releases/20180712135829/app/Controllers/Web/Oil/PriceController.php
52/data/apps/tank/releases/20180712135829/app/Controllers/Web/Product/ImageController.php
53/data/apps/tank/releases/20180712135829/app/Controllers/Web/Product/IndexController.php
54/data/apps/tank/releases/20180712135829/app/Controllers/Web/RegisterController.php
55/data/apps/tank/releases/20180712135829/app/Controllers/Web/SiteController.php
56/data/apps/tank/releases/20180712135829/app/Controllers/Web/TransportController.php
57/data/apps/tank/releases/20180712135829/app/Controllers/Web/WechatController.php
58/data/apps/tank/releases/20180712135829/app/Modules/Member/Services/Session.php
59/data/apps/tank/shared/vendor/cn-carter-lee/core/src/Core/Service.php
60/data/apps/tank/releases/20180712135829/app/Modules/SiteContent/Models/SiteContent.php
61/data/apps/tank/releases/20180712135829/app/Entities/SiteContents.php
62/data/apps/tank/shared/vendor/cn-carter-lee/core/src/Core/Mvc/Model.php
63/data/apps/tank/shared/vendor/cn-carter-lee/core/src/Core/Mvc/Model/Behavior/CheckCode.php
Memory
Usage2097152