UserBindInfo.php 834 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * 用户绑定信息
  4. * @author solu
  5. */
  6. class UserBindInfo extends Model {
  7. protected $tableName = 'user_bind_info';
  8. protected $dbKey = 'dw_chat';
  9. /**
  10. * 通过第三方账号获取用户id
  11. * @param string $account
  12. * @param string $type
  13. *
  14. * @return int
  15. */
  16. public function getUserIdBy($account, $type = 'eos') {
  17. $userId = $this->objTable->getOne(compact('account', 'type'), ['_field' => 'user_id']);
  18. return $userId;
  19. }
  20. /**
  21. * 通过用户id获取第三方账号
  22. * @param int $user_id
  23. * @param string $type
  24. *
  25. * @return string
  26. */
  27. public function getAccountByUserId($user_id, $type = 'eos') {
  28. $account = $this->objTable->getOne(compact('user_id', 'type'), ['_field' => 'account']);
  29. return $account;
  30. }
  31. }