table_common_member_field_home.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_common_member_field_home.php 28405 2012-02-29 03:47:50Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_member_field_home extends discuz_table_archive
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_member_field_home';
  15. $this->_pk = 'uid';
  16. $this->_pre_cache_key = 'common_member_field_home_';
  17. parent::__construct();
  18. }
  19. public function increase($uids, $creditarr) {
  20. $uids = array_map('intval', (array)$uids);
  21. $sql = array();
  22. $allowkey = array('addsize', 'addfriend');
  23. foreach($creditarr as $key => $value) {
  24. if(($value = intval($value)) && in_array($key, $allowkey)) {
  25. $sql[] = "`$key`=`$key`+'$value'";
  26. }
  27. }
  28. if(!empty($sql)){
  29. DB::query("UPDATE ".DB::table($this->_table)." SET ".implode(',', $sql)." WHERE uid IN (".dimplode($uids).")", 'UNBUFFERED');
  30. $this->increase_cache($uids, $creditarr);
  31. }
  32. }
  33. }
  34. ?>