慕森卡
$process = new swoole_process(function (swoole_process $process) {
$db = new swoole_mysql;
$db->connect($this->mysqlConf, function ($db, $r) {
if ($r === false) {
var_dump($db->connect_errno, $db->connect_error);
die;
}
$sql = "xxxxxxx";
$db->query($sql, function(swoole_mysql $db, $r) {
if ($r === false){
var_dump($db->error, $db->errno);
}
elseif ($r === true ){
var_dump($db->affected_rows, $db->insert_id);
}
var_dump($r);
$db->close();
foreach($r as $index=>$value){
$this->groupTable->set($value['groupId'], ['userIds'=>json_encode(explode(',', $value['members']))]);
}
echo "data loaded\n\n";
});
});
});
$process->start();
echo "initial success\n\n";
$this->server->start();