/**
  * 
  * 取消冻结积分
  */
 public function finalFrozenCredit($member_id = 0, $isRe = false, $where = array())
 {
     $isFrozen = array('member_id' => $member_id, 'credit' => 0, 'status' => 0);
     $is_update = false;
     $credit_type = $this->Members->get_trans_credits_type();
     if (empty($credit_type)) {
         $this->errorOutput(NO_CONSUME_CREDIT);
     }
     $member_id = !$member_id ? $this->get_condition() : $member_id;
     $relatedid = !$where['relatedid'] ? $this->input['relatedid'] ? trim($this->input['relatedid']) : 0 : $where['relatedid'];
     //消费订单id
     $app_uniqueid = !$where['app_uniqueid'] ? $this->input['app_uniqueid'] ? $this->input['app_uniqueid'] : APP_UNIQUEID : $where['app_uniqueid'];
     //应用id
     $mod_uniqueid = !$where['mod_uniqueid'] ? $this->input['mod_uniqueid'] ? $this->input['mod_uniqueid'] : MOD_UNIQUEID : $where['mod_uniqueid'];
     //模块id
     $method = !$where['method'] ? 'create' : $where['method'];
     //操作方法
     $_isFrozen = $this->input['isFrozen'] ? $this->input['isFrozen'] : 0;
     if ($this->settings['isFrozen'] || $_isFrozen) {
         if (empty($where)) {
             $where = array('member_id' => $member_id, 'app_uniqueid' => $app_uniqueid, 'mod_uniqueid' => $mod_uniqueid, 'method' => $method, 'relatedid' => $relatedid);
         }
         $_where['isFrozen'] = $this->settings['isFrozen'] ? 1 : $_isFrozen;
         $cond = $this->membersql->where(array_merge($where, $_where));
         $creditlog = $this->Members->getcreditlog($cond, 'id,' . $credit_type);
         //查询积分日志.
         if ($creditlog) {
             $isFrozen = $this->Members->finalFrozenCredit($member_id, abs_num($creditlog[$credit_type]));
             credit_log::updateCreditLogByIsFrozen($creditlog['id'], 0);
         }
     }
     if ($isRe) {
         return $isFrozen;
     }
     foreach ($isFrozen as $k => $v) {
         $this->addItem_withkey($k, $v);
     }
     $this->output();
 }
Exemple #2
0
 /**
  *
  * 获取积分日志
  */
 public function get_credit_log()
 {
     $outPutType = intval($this->input['outputtype']);
     if ($this->input['member_id']) {
         $condition = " AND member_id = " . intval($this->input['member_id']);
     } else {
         if ($this->user['user_id']) {
             $condition = " AND member_id = " . intval($this->user['user_id']);
         } else {
             $this->errorOutput(NO_MEMBER_ID);
         }
     }
     include CUR_CONF_PATH . "lib/member_credit_log.class.php";
     $credit_log = new credit_log();
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $credit_type = $this->Members->get_credit_type();
     $credit_type_field = '';
     if ($credit_type) {
         $credit_type_field = ',' . implode(',', array_keys($credit_type));
     }
     $info = $credit_log->show($condition, $offset, $count, 'icon,title,remark' . $credit_type_field . ',dateline');
     $outPut = array();
     if (!empty($info)) {
         if ($credit_type) {
             foreach ($info as $v) {
                 if ($credit_type && is_array($credit_type)) {
                     foreach ($credit_type as $kk => $vv) {
                         if ($v[$kk] > 0) {
                             $v[$kk] = '+' . $v[$kk] . $vv['title'];
                         } elseif ($v[$kk] < 0) {
                             $v[$kk] .= $vv['title'];
                         }
                     }
                 }
                 if (!$outPutType) {
                     $v['dateline'] = date('m/d', $v['dateline']);
                     $outPut[] = $v;
                 } elseif ($outPutType) {
                     $v['dateline'] = date('Y年m月d日', $v['dateline']);
                     $outPut[$v['dateline']]['dateline'] = $v['dateline'];
                     $outPut[$v['dateline']]['lists'][] = $v;
                 }
             }
         }
     }
     if ($outPut && is_array($outPut)) {
         foreach ($outPut as $k => $v) {
             $this->addItem($v);
         }
     }
     $this->output();
 }