$val) { if ($val != 'bmmessage') { $tmp[$key]['title'] = $sysuserfield[$val]; $tmp[$key]['value'] = $value['ufielddata'][$val]; } } if ($setting['cost']) { $cost = array(); $cost['title'] = lang('plugin/xj_event', 'baomingleixing'); foreach ($setting['cost'] as $val) { $cost['value'] .= $val['cost_name'] . 'x' . $value['ufielddata']['cost' . $val['id']] . ' '; } $tmp[] = $cost; } $return[] = $tmp; } } else { $apply = DB::fetch_all("SELECT * FROM " . DB::table('xj_eventapply') . " WHERE tid = $tid and uid = $uid ORDER BY first DESC"); foreach ($apply as $value) { $tmp = array(); $value['ufielddata'] = unserialize($value['ufielddata']); foreach ($selectuserfield as $key => $val) { if ($val != 'bmmessage') { $tmp[$key]['title'] = $sysuserfield[$val]; $tmp[$key]['value'] = $value['ufielddata'][$val]; } } if ($setting['cost']) { $cost = array(); $cost['title'] = lang('plugin/xj_event', 'baomingleixing'); $cost['value'] = $setting['cost'][$value['ufielddata']['costclass']]['cost_name']; $tmp[] = $cost; } $return[] = $tmp; } } return $return; } public function GetYouHui($tid, $uid) { global $_G; $return = 0; $items = DB::fetch_first("SELECT * FROM " . DB::table('xj_event') . " WHERE tid = $tid"); $eventnumber = $items['event_number']; $setting = unserialize($items['setting']); $use_cost = $items['use_cost']; $item = DB::fetch_first("SELECT applyid,applynumber FROM " . DB::table('xj_eventapply') . " WHERE tid = $tid and uid=$uid"); //报名方式不同,计算人数 if ($setting['nodaibaoming']) { $applynumber = $item['applynumber']; } else { $applynumber = DB::result_first("SELECT count(*) FROM " . DB::table('xj_eventapply') . " WHERE tid = $tid and uid=$uid"); } $apply = DB::fetch_first("SELECT * FROM " . DB::table('xj_eventapply') . " WHERE first=1 AND tid = $tid AND uid=$uid"); $apply['ufielddata'] = unserialize($apply['ufielddata']); //VIP折扣 $vipgroup = unserialize($_G['cache']['plugin']['xj_event']['vipgroupid']); $_G['groupid'] = DB::result_first("SELECT groupid FROM " . DB::table('common_member') . " WHERE uid = $uid"); if (in_array($_G['groupid'], $vipgroup)) { //判断是否是VIP用户组 //优惠计算 $youhuiprice = 0; if ($setting['cost']) { //启用多项报名时 if ($setting['nodaibaoming']) { //代报名不填资料时 foreach ($setting['cost'] as $value) { if ($value['cost_youhui'] !== '') { if ($value['cost_youhui'] > 0) { $youhuiprice = $youhuiprice + ($apply['ufielddata']['cost' . $value['id']] * $value['cost_youhui']); } } } } else { //代报名填资料时 $apply_yh = DB::fetch_all("SELECT * FROM " . DB::table('xj_eventapply') . " WHERE tid = '$tid' and uid=" . $uid); foreach ($apply_yh as $value) { $value['ufielddata'] = unserialize($value['ufielddata']); if ($setting['cost'][$value['ufielddata']['costclass']]['cost_youhui'] !== '') { if ($setting['cost'][$value['ufielddata']['costclass']]['cost_youhui'] > 0) { $youhuiprice = $youhuiprice + $setting['cost'][$value['ufielddata']['costclass']]['cost_youhui']; } } } } } else { //不启用多项报名时 if ($setting['vip_discount'] !== '') { if ($setting['vip_discount'] > 0) { $youhuiprice = $setting['vip_discount'] * $applynumber; } } } $return = $youhuiprice; } return $return; } public function GetUserField($fields, $values) { global $_G; $return = array(); $myuserfield = DB::fetch_all("SELECT * FROM " . DB::table('xj_event_field') . " WHERE id in(" . implode(',', $fields) . ") ORDER BY id"); foreach ($myuserfield as $value) { if ($value['formtype'] == 'text') { $value['html'] = ''; } if ($value['formtype'] == 'textarea') { $value['html'] = ''; } if ($value['formtype'] == 'select') { $tmp = explode("\r\n", $value['choices']); if ($_G['mobile']) { $value['html'] = '
'; foreach ($tmp as $tmpkey => $tmpval) { if ($tmpval) { if ($tmpval == $values['myfield' . $value['id']]) { $tmpcolor = '#48bd46'; } else { $tmpcolor = '#cccccc'; } $value['html'] = $value['html'] . '' . $tmpval . ''; } } $value['html'] .= '
'; } else { $value['html'] = ''; } } if ($value['formtype'] == 'uploadfile') { $value['html'] = '
' . (!empty($values) ? '' : '') . '
+
'; } $return[] = $value; } return $return; } }