You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.1 KiB

7 years ago
  1. <?php
  2. /**
  3. * Class Member_model
  4. * ----------------------------------------------------------
  5. * 회원 관련 모델
  6. */
  7. class Member_model extends WB_Model
  8. {
  9. /**
  10. * 회원목록
  11. * @param array $param
  12. * @return mixed
  13. */
  14. function member_list($param=array())
  15. {
  16. $social_table = $this->db->dbprefix('member_social');
  17. $param['from'] = "member";
  18. $param['limit'] = TRUE;
  19. $param['page_rows'] = element('page_rows', $param, 20);
  20. $param['page'] = element('page', $param, 1);
  21. $param['order_by'] = "member.mem_idx DESC";
  22. $param['join'][] = array("(SELECT mem_idx AS social_naver FROM {$social_table} WHERE soc_provider = 'naver') AS SN","SN.social_naver=member.mem_idx","left");
  23. $param['join'][] = array("(SELECT mem_idx AS social_facebook FROM {$social_table} WHERE soc_provider = 'facebook') AS SF","SF.social_facebook=member.mem_idx","left");
  24. $param['join'][] = array("(SELECT mem_idx AS social_google FROM {$social_table} WHERE soc_provider = 'google') AS SG","SG.social_google=member.mem_idx","left");
  25. $param['join'][] = array("(SELECT mem_idx AS social_kakao FROM {$social_table} WHERE soc_provider = 'kakao') AS SK","SK.social_kakao=member.mem_idx","left");
  26. $list = $this->get_list($param);
  27. // 데이타 가공
  28. foreach($list['list'] as $i=>&$row)
  29. {
  30. $row['nums'] = $list['total_count'] - $i - (($param['page'] - 1) * $param['page_rows']);
  31. }
  32. return $list;
  33. }
  34. function log_list($param=array())
  35. {
  36. $member_table = $this->db->dbprefix('member');
  37. $member_log_table = $this->db->dbprefix('member_log');
  38. $param['select'] = "{$member_log_table}.*, {$member_table}.mem_userid, {$member_table}.mem_nickname, {$member_table}.mem_status";
  39. $param['from'] = "member_log";
  40. $param['limit'] = TRUE;
  41. $param['page_rows'] = element('page_rows', $param, 20);
  42. $param['page'] = element('page', $param, 1);
  43. $param['order_by'] = "member_log.mlg_idx DESC";
  44. $param['join'][] = array("member", "member.mem_idx=member_log.mem_idx","inner");
  45. $list = $this->get_list($param);
  46. return $list;
  47. }
  48. /**
  49. * 포인트 목록
  50. * @param $mem_idx
  51. * @param $param
  52. * @return mixed
  53. */
  54. function point_list($mem_idx, $param)
  55. {
  56. $param['from'] = "member_point";
  57. $param['limit'] = TRUE;
  58. $param['where']['mem_idx'] = $mem_idx;
  59. $param['page_rows'] = element('page_rows', $param, 20);
  60. $param['page'] = element('page', $param, 1);
  61. $param['order_by'] = "mem_idx DESC";
  62. if( element('startdate', $param)) $param['where']['mpo_regtime >='] = $param['startdate'] . " 00:00:00";
  63. if( element('enddate', $param) ) $param['where']['mpo_regtime <='] = $param['enddate'] . " 23:59:59";
  64. $list = $this->get_list($param);
  65. // 데이타 가공
  66. foreach($list['list'] as $i=>&$row)
  67. {
  68. $row['nums'] = $list['total_count'] - $i - (($param['page'] - 1) * $param['page_rows']);
  69. }
  70. return $list;
  71. }
  72. }