function Order_clean() { $this->CheckAdminPrivs('rechargeorder','ajax'); $ckey = 'business.recharge.order.clean.lock'; fcache($ckey, dfTimer('com.recharge.order.clean')) && exit('no'); $cleans = logic('recharge')->Clean(); fcache($ckey, 'DNA.'.md5(time())); $rel = $cleans > 0 ? '(系统已经自动清理掉 '.$cleans.' 个过期的充值流水号)' : 'no'; exit($rel); }
public function status_ajax() { $this->CheckAdminPrivs('wips','ajax'); if (ini('wips.sql.enabled')) { $string = 'WIPS已开启'; if (ini('wips.sql.autoups') == 'true') { $lastc = fcache('wips.sql.rule.sync', 86400); if ($lastc) { } else { $server = base64_decode('aHR0cDovL3NxbC50dHR1YW5nb3UubmV0L3dpcHMvdXBkYXRlLnBocA=='); $r = dfopen($server, 10485760, '', '', true, 10, 'CENWOR.TTTG.WIPS.SYNC.AGENT.'.SYS_VERSION.'.'.SYS_BUILD); if ($r) { $data = (array)json_decode($r, true); if (isset($data['hash']) && $data['hash']) { foreach ($data['rules'] as $rk => $rv) { if (substr($rk, 0, -4) == '.md5') { continue; } if (md5($rv) == $data['rules'][$rk.'.md5']) { if (ini('wips.sql.'.$rk) != $rv) { ini('wips.sql.'.$rk, $rv); $updated = true; } } } } } fcache('wips.sql.rule.sync', 'lastCheck @ '.date('Y-m-d H:i:s', time())); if ($updated) { $string = 'WIPS自动升级完成'; } } } } else { $string = 'WIPS未开启,有风险'; } exit('<a href="admin.php?mod=wips">'.$string.'</a>'); }
private function __GetMsgFlags($flag, $msg, $data) { $fid = 'notify.msg.'.$flag; $flags = fcache($fid, dfTimer('com.notify.mf.cache')); if ($flags) { return $flags; } preg_match_all('/{([a-z0-9\._]+)}/i', $msg, $matchs); $flags = array(); foreach ($matchs[1] as $key) { $flags[] = $key; } fcache($fid, $flags); return $flags; }
public function Clears() { foreach (ini('notify.event') as $name => $val) { foreach ($this->notifys as $type => $conf) { fcache('notify.msg.'.$name.'.'.$type, 0); } } }
private function __field_clear() { $isCheck = rand(1, 13); if ($isCheck != 13) return; $ckey = 'logic.me.field.clear'; $lastClear = fcache($ckey, dfTimer('com.meta.expired.clean')); if ($lastClear) return; dbc(DBCMax)->delete('metas')->where('life != 0 AND uptime+life < '.time())->done(); fcache($ckey, 'UPS:'.time()); }
function check() { $this->CheckAdminPrivs('upgrade'); $rets = array(); $ck = 'upgrade_api.check.status'; if(false == ($rets = fcache($ck, 600))) { $rets = json_decode($this->request('check'), true); fcache($ck, $rets); } if(is_array($rets['data'])) { $url = 'admin.php?mod=upgrade_api&code=download'; foreach($rets['data'] as $k=>$v) { $url .= '&' . $k . '=' . urlencode($v); } if('ajax' != $this->OPC) { $this->Messager('请稍候,正在升级中……', $url, 0); } else { $av = $rets['data']['version']; exit("<a href='admin.php?mod=upgrade_api' title='点此进行API核心文件的升级'><font color='red'>[API版本]{$av}</font></a><img src='{$url}' width='0' />"); } } else { $avs = $av = ini('settings.api_version'); if($av) { $avs = '[API版本]' . $av; } if('ajax' == $this->OPC) { exit($avs); } else { $this->Messager('API核心文件暂时不需要升级 ' . $avs . self::$err_contactus_help, null); } } }
public function hot() { $ckey = 'catalog/hot'; if(false === ($class = fcache($ckey, 900))) { $class = dbc(DBCMax)->query("select * from " . table('catalog') . " where `hot`='1' order by `hotorder` ASC, `order` ASC")->done(); fcache($ckey, $class); } if (!$class) return array(); $icon_data = ini('catalog.icon'); foreach ($class as $i => $topclass) { $class[$i]['icon'] = $icon_data[$topclass['id']]['icon']; $class[$i]['script'] = stripcslashes($icon_data[$topclass['id']]['script']); $class[$i]['selected'] = $topclass['flag'] == $topcss ? true : false; $class[$i]['url'] = logic('url')->create('catalog', array('code' => $topclass['flag'])); } return $class; }
public function Publish($data) { logic('seller')->product_add($data['sellerid']); dbc()->SetTable(table('product')); $id = dbc()->Insert($data); zlog('product')->publish($id, $data); fcache('default.catalog.procount', 0); return $id; }
private function _list_cache_clean($product_id = 0) { fcache("tag/list_all", 0); fcache("tag/list_{$product_id}_0", 0); fcache("tag/list_{$product_id}_1", 0); handler('io')->ClearDir(CACHE_PATH . 'fcache/tag/'); }
private function __clear() { $flagKey = 'push.logic.clear.flag'; $timeInv = dfTimer('com.push.queue.clean'); $flag = fcache($flagKey, $timeInv); if (!$flag) { $timeBefore = time() - $timeInv; dbc()->SetTable(table('push_queue')); dbc()->Delete('', 'rund="true" AND `update`<'.$timeBefore); fcache($flagKey, 'mark'); } }
public function recent_buys() { $cache = fcache('logic.order.recentbuys', 3600); if (!$cache) { $buys = array(); $get_order_sql = 'select productid,userid from '.table('order').' where `process` not in ("__CREATE__","WAIT_BUYER_PAY") order by buytime desc limit 30'; $orders = dbc(DBCMax)->query($get_order_sql)->done(); $proids = array(); $usrids = array(); foreach ($orders as $order) { $proids[] = $order['productid']; $usrids[] = $order['userid']; } $pros = array(); $get_pro_sql = 'select id,flag from '.table('product').' where id in('.implode(',', $proids).')'; $result = dbc(DBCMax)->query($get_pro_sql)->done(); foreach ($result as $pro) { $pros[$pro['id']] = $pro['flag']; } $usrs = array(); $get_usr_sql = 'select uid,username,phone from '.table('members').' where uid in('.implode(',', $usrids).')'; $result = dbc(DBCMax)->query($get_usr_sql)->done(); foreach ($result as $usr) { $usrs[$usr['uid']] = array('name' => $usr['username'], 'phone' => $usr['phone']); } foreach ($orders as $order) { $buys[] = array( 'product_id' => $order['productid'], 'product_name' => $pros[$order['productid']], 'user_id' => $order['userid'], 'user_name' => $usrs[$order['userid']]['name'], 'user_phone' => $usrs[$order['userid']]['phone'] ); } foreach ($buys as $i => $buy) { $buys[$i]['user_name'] = $buy['user_name'] ? $this->recent_buys_mosaic($buy['user_name']) : '匿名用户'; $buys[$i]['user_phone'] = $this->recent_buys_mosaic($buy['user_phone'] ? $buy['user_phone'] : $this->recent_buys_g_phone()); } fcache('logic.order.recentbuys', $buys); $cache = $buys; } return $cache; }
function get_system_count(&$data) { $ckey = 'global.system.count.data'; $apdata = fcache($ckey, 86400); if (!$apdata) { $cMaps = array('members', 'address', 'city', 'express', 'finder', 'metas', 'order', 'paylog', 'payment', 'product', 'push_log', 'push_queue', 'question', 'seller', 'service', 'subscribe', 'ticket', 'uploads', 'usermoney', 'usermsg', 'catalog', 'recharge_order', 'recharge_card'); foreach ($cMaps as $i => $table) { $cct = dbc(DBCMax)->select($table)->in('count(1) AS DTCNT')->limit(1)->done(); $apdata['count_'.$table] = $cct['DTCNT']; } $file = CACHE_PATH.'misc/data_length.cache.php'; if (is_file($file)) { include $file; $apdata['count_data_length'] = $cache; } else { $apdata['count_data_length'] = false; } fcache($ckey, $apdata); } $data = array_merge($data, $apdata); return $data; }
function lrcmd_nt() { $lv = get('lv'); $ckey = 'home.console.lrcmd.nt'; $last = fcache($ckey, dfTimer('system.lrcmd.check')); $last && exit($last); $response = request('lrcmd', array('lv'=>$lv), $error); $error && exit('false'); $nt = $response['transfer'] ? $response['recommend'] : 'false'; exit(fcache($ckey, $nt)); }
public function structRepair() { list($cmpResult, $tables, $indexs) = $this->structAnalyze(); if ($cmpResult) { $results = array(); foreach ($cmpResult as $cmpi => $cmpData) { if ($cmpData['class'] == 'index') { if (stristr($cmpData['sql'], 'unique')) { if ($this->uniqueFilling($tables[$cmpData['table']], $indexs[$cmpData['table']], $cmpData['sql'], $cmpData['table'])) { $results[] = $this->sqlQuery($cmpData['sql']); } } else { $results[] = $this->sqlQuery($cmpData['sql']); } } else { $results[] = $this->sqlQuery($cmpData['sql']); } } fcache('logic.db.struct.analyze.data', 0); return $results; } else { return false; } }
public function hot($flag = 'product') { if (false == $this->place_enabled()) return ; $cityID = logic('misc')->City('id'); $ckey = 'city_place/hot-' . $cityID; if(false === ($class = fcache($ckey, 900))) { $places = logic('city')->get_places($cityID); $hs = $class = array(); foreach($places as $r) { if($r['hot']) { $hs[] = $r['id']; } if(is_array($r['streets']) && count($r['streets'])) { foreach($r['streets'] as $rr) { if($rr['hot']) { $hs[] = $rr['id']; } } } } if($hs) { $class = dbc(DBCMax)->query("select * from " . table('city_place') . " where `id` IN ('".implode("','", $hs)."') AND `hot`='1' order by `hotorder` ASC")->done(); foreach($class as $k=>$row) { if('street' == $row['type']) { $row['url'] = logic('url')->create($flag, array('region' => $row['parent_id'], 'street' => $row['id'])); } else { $row['url'] = logic('url')->create($flag, array('region' => $row['id'], 'street' => null)); } $class[$k] = $row; } } fcache($ckey, $class); } return $class; }
function ETS_iCheck($flag = false) { $ckey = 'notify.event.tags.lang.upcheck'; if ($flag) { fcache($ckey, $flag); return $flag; } $etsCheck = true; if (fcache($ckey, dfTimer('com.notify.etl.upcheck'))) { $etsCheck = false; } return $etsCheck; }
private function fcache($key, $mixed) { return fcache($key, $mixed, DATA_PATH.'fcache/'); }