Checkacc.php 870 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace WY\app\model;
  3. use WY\app\libs\Model;
  4. if (!defined('WY_ROOT')) {
  5. exit;
  6. }
  7. class Checkacc extends Model
  8. {
  9. public function isAccExist($userid, $code)
  10. {
  11. $data = $this->model()->select('a.id')->from('acc a')->left('acw b')->on('b.id=a.acwid')->join()->where(array('fields' => 'a.is_state=? and b.code=?', 'values' => array(0, $code)))->fetchAll();
  12. if ($data) {
  13. $userprice = $this->model()->select('channelid')->from('userprice')->where(array('fields' => 'is_state=? and userid=?', 'values' => array(0, $userid)))->fetchAll();
  14. foreach ($data as $key => $val) {
  15. foreach ($userprice as $key2 => $val2) {
  16. if ($val['id'] == $val2['channelid']) {
  17. return true;
  18. }
  19. }
  20. }
  21. }
  22. return false;
  23. }
  24. }