|
|
@@ -41,8 +41,10 @@ class Events
|
|
|
public static function onWorkerStart($worker)
|
|
|
{
|
|
|
if (empty(self::$db)) {
|
|
|
- //self::$db = new \Workerman\MySQL\Connection('192.168.2.168', '3306', 'vali', '123456', 'customer_service');
|
|
|
- self::$db = new \Workerman\MySQL\Connection('192.168.2.200', '3306', 'vali', '1234', 'customer_service');
|
|
|
+ $mds = DIRECTORY_SEPARATOR;
|
|
|
+ $dbcfg = realpath(dirname(__FILE__) . $mds . '..' . $mds . '..' . $mds . '..' . $mds . '..') . $mds . 'application' . $mds . 'database.php';
|
|
|
+ $conf = require($dbcfg);
|
|
|
+ self::$db = new \Workerman\MySQL\Connection($conf['hostname'], $conf['hostport'], $conf['username'], $conf['password'], $conf['database']);
|
|
|
}
|
|
|
|
|
|
|