环信sdk
try {
$easemob->accreditRegister(compact('username', 'password'));
// 环信sdk注册成功
// 让小秘书成为他的粉丝,一来不至于让他粉丝为0,二来他可以新建群组邀请小秘书
$friendship = M('friendship');
$friendship_info = $friendship->create(array(
'userid' => C('SECRETARY_ID'),
'to_userid' => $new_id
));
if ($friendship_info) {
$friendship->add();
}
$this->successReturn($user->handle_usermodel($user->find($new_id)));
} catch (\Exception $ex) {
// 环信注册失败,就干掉刚才的注册记录
$user->where($user->getPk() . '=' . $new_id)
->delete();
$this->errorReturn('注册失败,请稍后再试');
}