@appserver/config/YiiRewriteMap.php
<?php
return [
/**
* \fecshop\models\mongodb\Category 为原来的类
* \appfront\local\local_models\mongodb\Category 为重写后的类
* 重写后的类可以集成原来的类。
*/
//'\fecshop\models\mongodb\Category' => '\appfront\local\local_models\mongodb\Category',
'\fecshop\models\mysqldb\customer\CustomerLogin' => '\appserver\local\local_models\mysqldb\customer\CustomerLogin',//这个重写有效
'\fecshop\models\mongodb\Category' => '\appserver\local\local_models\mongodb\Category',//重写有效
'\fecshop\models\mysqldb\Customer' => '\appserver\local\local_models\mysqldb\Customer'//重写无效
];
@appserver/local/local_models/mysqldb/Customer.php
<?php
namespace appserver\local\local_models\mysqldb;
use Yii;
class Customer extends \fecshop\models\mysqldb\Customer
{
/**
* 生成access_token
*/
public function generateAccessToken()
{
echo 'here';die;
$this->access_token = Yii::$app->security->generateRandomString();
}
}