Exemplo n.º 1
0
 function insert($arr, $id)
 {
     global $_G;
     if (!$arr) {
         return false;
     }
     $arr['nick'] = $arr['nick'] ? trim($arr['nick']) : '';
     $arr['sid'] = $arr['sid'] ? trim($arr['sid']) : '';
     $arr['title'] = $arr['title'] ? trim($arr['title']) : '';
     $arr['desc'] = $arr['desc'] ? trim($arr['desc']) : '';
     $arr['pic_path'] = $arr['pic_path'] ? trim($arr['pic_path']) : '';
     $arr['picurl'] = $arr['picurl'] ? trim($arr['picurl']) : '';
     $arr['banner'] = $arr['banner'] ? trim($arr['banner']) : '';
     $arr['url'] = $arr['url'] ? trim($arr['url']) : '';
     $arr['start_time'] = dmktime($arr['start_time']);
     $arr['end_time'] = dmktime($arr['end_time']);
     $arr['zk'] = floatval($arr['zk']);
     $arr['cate'] = intval($arr['cate']);
     $arr['shop_type'] = intval($arr['shop_type']);
     $arr['hide'] = intval($arr['hide']);
     $arr['sort'] = intval($arr['sort']);
     if ($id > 0) {
         $id = DB::update('shop', $arr, 'id=' . $id);
         api_post(array('a' => 'update', 'table' => 'shop', 'data' => $arr, 'pre_key' => 'sid', 'id' => $arr['sid'], 'cache' => 'channels,all_channel'));
     } else {
         $arr['dateline'] = TIMESTAMP;
         $id = DB::insert('shop', $arr, 1);
         if ($id > 0) {
             api_post(array('a' => 'insert', 'table' => 'shop', 'data' => $arr, 'cache' => 'shop,shop_type', 'id' => $id));
         }
     }
     return $id;
 }
Exemplo n.º 2
0
 function post()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         $ad = get_filed(__CLASS__, $_GET['postdb'], $_GET['id']);
         $ad['start_time'] = dmktime($ad['start_time']);
         $ad['end_time'] = dmktime($ad['end_time']);
         $ad['width'] = intval($ad['width']);
         $ad['height'] = intval($ad['height']);
         $ad['hide'] = intval($ad['hide']);
         $ad['type'] = intval($ad['type']);
         $ad['target'] = intval($ad['target']);
         if ($_FILES[file]) {
             $pic = upload();
             if ($pic) {
                 $ad[picurl] = $pic;
             }
         }
         $url = '';
         if ($_GET['id']) {
             $id = intval($_GET['id']);
             DB::update(__CLASS__, $ad, "id=" . $id);
             $url = '&id=' . $id;
             $msg = '修改';
             api_post(array('a' => 'update', 'table' => 'ad', 'data' => $ad, 'pre_key' => 'id', 'id' => $id, 'cache' => 'ad'));
         } else {
             $msg = '添加';
             $ad['dateline'] = TIMESTAMP;
             $r = DB::insert(__CLASS__, $ad, true);
             if ($r > 0) {
                 api_post(array('a' => 'insert', 'table' => 'ad', 'data' => $ad, 'cache' => 'ad', 'id' => $r));
             }
         }
         loadcache(__CLASS__, 'update');
         cpmsg($msg . '成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__ . $url);
     } elseif ($_GET['id']) {
         $id = intval($_GET['id']);
         $ad = $_G['ad']['k' . $id];
     } else {
         $ad = get_filed(__CLASS__);
     }
     $ad_types = array(1 => '文字', 2 => '图片', 3 => 'HTML代码');
     $this->add(array('ad' => $ad, 'ad_types' => $ad_types));
     $this->show();
 }
Exemplo n.º 3
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         $page = $_G[page] > 1 ? '&page=' . $_G[page] : '';
         foreach ($_GET[ids] as $k => $v) {
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             $id = intval($v);
             $arr = array();
             $arr['start_time'] = $_GET['start_time'][$k] ? dmktime($_GET['start_time'][$k]) : 0;
             $arr['end_time'] = $_GET['end_time'][$k] ? dmktime($_GET['end_time'][$k]) : 0;
             $arr['sort'] = intval($_GET['sort'][$k]);
             $arr['hide'] = intval($_GET['hide'][$k]);
             $arr['cate'] = intval($_GET['cate'][$k]);
             if ($_GET['hide_in'] == 1) {
                 $arr['hide'] = 1;
             }
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 DB::delete("duihuan", "id=" . $id);
             } else {
                 DB::update("duihuan", $arr, "id=" . $id);
             }
         }
         cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__ . $page);
         return false;
     }
     $url = '';
     $and = '';
     if (isset($_GET['cate'])) {
         $cate = intval($_GET['cate']);
         $and .= " AND `cate` =" . $cate;
         $url .= "&cate=" . $cate;
     }
     $goods = D(array('table' => 'duihuan', 'and' => $and, 'order' => ' `sort` DESC,id DESC '), array('size' => 40, 'url' => $url));
     $this->add($goods);
     $this->show();
 }
Exemplo n.º 4
0
 function index_task()
 {
     global $_G;
     if (!$_G[uid]) {
         return array();
     }
     $today = dmktime(dgmdate(TIMESTAMP, 'd'));
     $tomorrow = dmktime(dgmdate(TIMESTAMP + 86400, 'd'));
     $and = " AND dateline > {$today} AND dateline < {$tomorrow}   AND type = 'sign' ";
     $time = TIMESTAMP - 86400;
     $sign = DB::fetch_first("SELECT * FROM " . DB::table('sign') . " WHERE uid=" . $_G[uid] . $and);
     $share = get_jf($_G[uid]);
     return array('sign' => $sign, 'share' => $share);
 }
Exemplo n.º 5
0
 function post()
 {
     global $_G;
     $goods = get_filed(__CLASS__);
     $page = $_G[page] > 1 ? '&page=' . $_G[page] : '';
     $field = array();
     if ($_GET['onsubmit'] && check()) {
         //发布商品
         $arr = array();
         $arr = get_filed(__CLASS__, $_GET['postdb'], $_GET['aid']);
         $arr['images'] = $_GET['images'];
         $aid = '';
         $url = '&fid=' . $arr['fid'];
         $msg = '发布';
         if ($_FILES[file]) {
             $src = upload();
             if ($src) {
                 $arr[picurl] = $src;
             }
         }
         if ($_GET['aid']) {
             $aid = intval($_GET['aid']);
             $url = '&aid=' . $aid;
             $msg = '修改';
             $id = top('goods', 'update', $arr, $aid);
         } else {
             $id = top('goods', 'insert', $arr);
             $url .= '&aid=' . $id;
         }
         if (CURMODULE == 'goods') {
             $ext = "<p><a href='" . URL . "m=goods&a=post&fid=" . $arr['fid'] . $page . "'>继续发布</a>&nbsp;&nbsp;&nbsp;&nbsp;";
             $ext .= "<a href='" . URL . "m=goods&a=main" . $page . "'>返回列表页</a>&nbsp;&nbsp;&nbsp;&nbsp;";
             $ext .= "<a href='" . URL . "m=goods&a=main&fid=" . $arr[fid] . $page . "'>返回栏目列表页</a>";
         } elseif (CURMODULE == 'apply') {
             $ext .= "<a href='" . URL . "m=apply&a=main" . $page . "'>返回待审核列表</a>&nbsp;&nbsp;&nbsp;&nbsp;";
         }
         $ext .= "</p>";
         if ($id === false) {
             cpmsg('发布失败,不能重复发布同一商品', 'error', 'm=' . __CLASS__ . '&a=' . __FUNCTION__ . '&fid=' . $_G[fid]);
         } else {
             cpmsg($msg . '成功', 'success', 'm=' . CURMODULE . '&a=' . __FUNCTION__ . $url, '编辑此商品', $ext);
         }
         return false;
     } elseif ($_GET['get_submit'] && check() && $_GET['goods_id']) {
         //提交ID采集商品
         $goods_id = get_goods_id($_GET['goods_id']);
         if (!$goods_id) {
             cpmsg('抓取失败,商品ID或链接不存在或填写错误', 'error', 'm=' . __CLASS__ . '&a=' . __FUNCTION__);
             return false;
         }
         if ($_GET['goods_aid'] > 0) {
             $goods = D(array('and' => " AND aid = " . intval($_GET['goods_aid']), 'limit' => 1, 'all' => true));
         }
         $gd = top('goods', 'get_goods', $goods_id);
         $gd[goods_id] = $goods_id;
         //上线-下线时间默认为5天
         $tomorrow2 = dmktime(dgmdate(TIMESTAMP + 86400, 'd') . ' 10:00');
         $tomorrow5 = dmktime(dgmdate(TIMESTAMP + 86400 * 6, 'd') . ' 10:00');
         $goods['start_time'] = dgmdate($tomorrow2, 'dt');
         $goods['end_time'] = dgmdate($tomorrow5, 'dt');
         $goods['keywords'] = get_keywords($goods['title']);
         if ($gd['yh_price'] != $gd['price'] && $gd['yh_price'] && $gd['price']) {
             $gd[zhekou_shu] = sprintf("%.1f", $gd['yh_price'] / $gd['price'] * 10);
         }
         foreach ($gd as $k => $v) {
             $goods[$k] = $v;
         }
         if (!$goods[yh_price]) {
             echo '<h1 class="admin_msg">商品优惠价格采集失败,请注意手动填写</h1>';
         }
     } elseif ($_GET['aid']) {
         $aid = intval($_GET['aid']);
         $gd = D(array('and' => " AND aid = " . $aid, 'limit' => 1, 'all' => true));
         if (!$gd[aid]) {
             cpmsg('抱歉,未找到任何信息', 'error');
             return false;
         }
         $_GET['goods_id'] = $gd['num_iid'];
         foreach ($gd as $k => $v) {
             $goods[$k] = $v;
         }
         if ($_G['setting']['get_message'] && !$goods['message']) {
             $message = top('m_taobao', 'get_message', $goods[num_iid]);
             if ($message) {
                 $goods['message'] = $message;
             }
         }
     } else {
         $_GET[goods_id] = '';
         $goods = get_filed(__CLASS__);
         //上线-下线时间默认为5天
         $tomorrow2 = dmktime(dgmdate(TIMESTAMP + 86400, 'd') . ' 10:00');
         $tomorrow5 = dmktime(dgmdate(TIMESTAMP + 86400 * 6, 'd') . ' 10:00');
         $goods['start_time'] = dgmdate($tomorrow2, 'dt');
         $goods['end_time'] = dgmdate($tomorrow5, 'dt');
     }
     if ($_G[setting][bm_status_text]) {
         if (!is_array($_G[setting][bm_status_text])) {
             $bm_status_text = array();
             $tmp = explode("\r\n", $_G[setting][bm_status_text]);
             foreach ($tmp as $k => $v) {
                 $v = explode("|", $v);
                 $bm_status_text[$v[0]] = array('status' => $v[0], 'name' => $v[1], 'content' => $v[2]);
             }
         } else {
             $bm_status_text = $_G[setting][bm_status_text];
         }
     }
     $this->add(array('goods' => $goods, 'field' => $field, 'bm_status_text' => $bm_status_text));
     $tpl = '';
     if (!$_GET[fid] && !$_GET['aid']) {
         $tpl = "goods/select_post";
     }
     $this->show($tpl);
 }
Exemplo n.º 6
0
 function init_taobakke($data)
 {
     $table = get_filed('order_list');
     //创建时间0	商品信息1	商品数2		商品单价3	订单状态4	收入比率5	付款金额6	效果预估7	结算金额8
     //预估收入9	成交平台10	所属店铺11	结算时间12	补贴金额13	补贴类型14	补贴比率15	商品ID16	订单编号17	分成比率18	第三方服务来源19
     //$write_status = array( '订单付款', '订单结算');
     foreach ($data as $k => $v) {
         if (!$v || !$v[1] || !$v[5] || !$v[6] || !$v[7] || !$v[18] || !$v[19]) {
             continue;
         }
         //if(!in_array($v[5],$write_status)) continue;
         $arr = array();
         $arr['title'] = $v[2];
         $arr['num'] = $v[3];
         $arr['price'] = $v[7];
         $arr['yongjin'] = $v[8];
         $arr['bili'] = str_replace(' %', '', $v[6]);
         $arr['pingtai'] = $v[11];
         $num_iid = $arr['num_iid'] = $v[17];
         $order_number = $arr['order_number'] = $v[18];
         $arr['create_time'] = dmktime($v[1]);
         if ($arr['price'] == 0 || $arr['yongjin'] == 0) {
             continue;
         }
         $text = $v[5];
         //阿里妈妈订单状态
         //  0 = 订单付款  1 =订单结算   2 = 订单失效
         if ($text == '订单付款') {
             $arr['status'] = 0;
         } else {
             if ($text == '订单结算') {
                 $arr['status'] = 1;
             } else {
                 if ($text == '订单失效') {
                     $arr['status'] = 2;
                 } else {
                     continue;
                 }
             }
         }
         //已经导入过的,再导就是更新了
         $rs = DB::fetch_first("SELECT * FROM " . DB::table('order_list') . " WHERE  order_number = '{$order_number}'  AND num_iid = '{$num_iid}' ");
         if ($rs['id'] > 0) {
             $res = $this->update_check($rs, $arr);
             if ($res === true) {
                 $this->update++;
             }
         } else {
             if ($arr['status'] == 2) {
                 continue;
             }
             //已经失效的, 就不用入库了.
             $arr['status'] = 1;
             //默认,全是待认领
             $arr['dateline'] = TIMESTAMP;
             $arr['id'] = DB::insert('order_list', $arr, true);
             //if($arr['status'] == 1){
             unset($arr['status']);
             $this->check_order($arr);
             //}
             $this->count++;
         }
     }
 }
Exemplo n.º 7
0
 function makesql($condition, $onlyCount = false)
 {
     $tables = $wheres = array();
     $fields = membersearch::getfield();
     foreach ($fields as $key => $value) {
         $return = array();
         if (isset($condition[$key])) {
             $return = membersearch::makeset($key, $condition[$key], membersearch::gettype($key));
         } elseif (isset($condition[$key . '_low']) || isset($condition[$key . '_high'])) {
             $return = membersearch::makerange($key, $condition[$key . '_low'], $condition[$key . '_high'], membersearch::gettype($key));
         } elseif (isset($condition[$key . '_after']) || isset($condition[$key . '_before'])) {
             $condition[$key . '_after'] = dmktime($condition[$key . '_after']);
             $condition[$key . '_before'] = dmktime($condition[$key . '_before']);
             $return = membersearch::makerange($key, $condition[$key . '_after'], $condition[$key . '_before'], membersearch::gettype($key));
         }
         if ($return) {
             $tables[$return['table']] = true;
             $wheres[] = $return['where'];
         }
     }
     if ($tables && $wheres) {
         $parts = array();
         $table1 = '';
         foreach ($tables as $key => $value) {
             $value = membersearch::gettable($key);
             $parts[] = "{$value} as {$key}";
             if (!$table1) {
                 $table1 = $key;
             } else {
                 $wheres[] = $table1 . '.uid = ' . $key . '.uid';
             }
         }
         $selectsql = $onlyCount ? 'SELECT COUNT(' . $table1 . '.uid) as cnt ' : 'SELECT ' . $table1 . '.uid';
         return $selectsql . ' FROM ' . implode(', ', $parts) . ' WHERE ' . implode(' AND ', $wheres);
     } else {
         $selectsql = $onlyCount ? 'SELECT COUNT(uid) as cnt ' : 'SELECT uid';
         return $selectsql . ' FROM ' . DB::table('common_member') . " WHERE 1";
     }
 }
Exemplo n.º 8
0
 function share()
 {
     global $_G;
     $type = $_GET[type];
     if ($_GET[id] || $_GET[aid]) {
         $aid = $_GET[id] ? intval($_GET[id]) : intval($_GET[aid]);
         $goods = D(array('and' => 'and aid = ' . $aid));
         if ($goods[aid] > 0) {
             $share = get_share($goods);
         }
         $desc = '分享商品-' . $goods[title] . '-' . $type . '-aid=' . $aid;
         $share_type = 'share_goods';
     } else {
         $share = get_share($goods);
         $desc = '分享站点';
         $share_type = 'share_web';
     }
     if (isset($share[$type]) && $share[$type]) {
         $url = $share[$type];
         if ($_G[uid]) {
             $count = getcount('sign', " uid = " . $_G[uid] . " AND `desc`='" . $desc . "' AND type = '" . $share_type . "'");
             $is_add = false;
             if ($count == 0) {
                 $is_add = true;
             }
             $today = dmktime(dgmdate(TIMESTAMP, 'd'));
             $count_day = getcount('sign', " uid = " . $_G[uid] . " AND type = '" . $share_type . "' AND dateline >=" . $today);
             if ($share_type == 'web' || $share_type == 'share_web') {
                 if ($count_day > $_G[setting][share_web_num]) {
                     $is_add = false;
                 }
             } elseif ($share_type == 'share_goods') {
                 if ($count_day > $_G[setting][share_goods_num]) {
                     $is_add = false;
                 }
             }
             if ($is_add) {
                 $jf = $_G[setting][share_goods];
                 $add_jf = $_G['member']['jf'] + $jf;
                 $sid = insert_sign(array('desc' => $desc, 'type' => 'share_goods', 'org_jf' => $add_jf, 'jf' => $jf));
                 if ($sid) {
                     update_member(array('jf' => $_G[member][jf] + $jf), $_G[uid]);
                 }
             }
         }
     } else {
         $url = $share['weibo'];
     }
     _header("Location:" . $url);
 }
Exemplo n.º 9
0
 function makesql($condition, $onlyCount = false)
 {
     $tables = $wheres = array();
     $isarchive = $condition['tablename'] === 'archive' ? true : false;
     if ($condition['verify']) {
         foreach ($condition['verify'] as $key => $value) {
             $condition[$value] = 1;
         }
         unset($condition['verify']);
     }
     if ($condition['fid']) {
         $condition['level'] = '1,2,3,4';
     }
     if ($condition['tagid']) {
         $condition['idtype'] = 'uid';
     }
     $fields = membersearch::getfield();
     foreach ($fields as $key => $value) {
         $return = array();
         if (isset($condition[$key])) {
             $return = membersearch::makeset($key, $condition[$key], membersearch::gettype($key));
         } elseif (isset($condition[$key . '_low']) || isset($condition[$key . '_high'])) {
             $return = membersearch::makerange($key, $condition[$key . '_low'], $condition[$key . '_high'], membersearch::gettype($key));
         } elseif (isset($condition[$key . '_noempty'])) {
             $return = membersearch::makeset($key, $condition[$key . '_noempty'], membersearch::gettype($key));
         } elseif (isset($condition[$key . '_after']) || isset($condition[$key . '_before'])) {
             $condition[$key . '_after'] = dmktime($condition[$key . '_after']);
             $condition[$key . '_before'] = dmktime($condition[$key . '_before']);
             $return = membersearch::makerange($key, $condition[$key . '_after'], $condition[$key . '_before'], membersearch::gettype($key));
         }
         if ($return) {
             $tables[$return['table']] = true;
             $wheres[] = $return['where'];
         }
     }
     if ($tables && $wheres) {
         $parts = array();
         $table1 = $asuid = '';
         $uidfield = 'uid';
         foreach ($tables as $key => $value) {
             $value = membersearch::gettable($key, $isarchive);
             $parts[] = "{$value} as {$key}";
             if (!$table1) {
                 $table1 = $key;
                 if ($table1 == 'tag') {
                     $uidfield = 'itemid';
                     $asuid = ' as uid';
                 }
             } else {
                 if ($key == 'tag') {
                     $keyuid = 'itemid';
                 } else {
                     $keyuid = 'uid';
                 }
                 $wheres[] = $table1 . '.' . $uidfield . ' = ' . $key . '.' . $keyuid;
             }
         }
         $selectsql = $onlyCount ? 'SELECT COUNT(DISTINCT ' . $table1 . '.' . $uidfield . ') as cnt ' : 'SELECT DISTINCT ' . $table1 . '.' . $uidfield . $asuid;
         return $selectsql . ' FROM ' . implode(', ', $parts) . ' WHERE ' . implode(' AND ', $wheres);
     } else {
         $selectsql = $onlyCount ? 'SELECT COUNT(uid) as cnt ' : 'SELECT uid';
         return $selectsql . ' FROM ' . DB::table('common_member' . ($isarchive ? '_archive' : '')) . " WHERE 1";
     }
 }
Exemplo n.º 10
0
    function update_goods()
    {
        global $_G;
        $url = '?m=' . __CLASS__ . '&a=' . __FUNCTION__;
        $main_url = URL . 'm=' . __CLASS__ . '&a=main';
        //			include_once libfile('api/m_taobao');
        //			$m = new m_taobao();
        $m = top('m_taobao');
        $size = $_GET[size] > 0 ? intval($_GET[size]) : 50;
        $start = ($_G[page] - 1) * $size;
        if ($_GET[onsubmit]) {
            $and . '';
            $url .= '&onsubmit=1&page=' . ($_G[page] + 1) . '&size=' . $size;
            if ($_GET[posttime1]) {
                $posttime1 = dmktime($_GET[posttime1]);
                $and .= " AND posttime >=" . $posttime1;
                $url .= "&posttime1=" . $posttime1;
            }
            if ($_GET[posttime2]) {
                $posttime2 = dmktime($_GET[posttime2]);
                $and .= " AND posttime <=" . $posttime2;
                $url .= "&posttime2=" . $posttime2;
            }
            if ($_GET['time'] > 0) {
                $time = TIMESTAMP - intval($_GET['time']) * 3600;
                $and .= " AND dateline <=" . $time;
                $url .= "&time=" . $time;
            }
            $field = $_GET[field];
            foreach ($_GET[field] as $k => $v) {
                $url .= "&field[" . $k . "]=1";
            }
            $count = getcount('goods', $and);
            if ($count == 0) {
                cpmsg('未找到任何商品信息,请修改更新条件后再试...' . $msg, 'success', 'm=tools&a=main');
                return false;
            }
            $page_size = intval(ceil($count / $size));
            $rs = '<p>共找到' . $count . '条商品,每页' . $size . '条,共' . $page_size . '页,当前正在更新' . $_G[page] . '页</p>';
            $rs .= '<p><b>本更新比较费资源,请勿关闭本页面或胡乱点击本页面....</b></p>';
            $list = DB::fetch_all("SELECT aid,num_iid,title,posttime FROM " . DB::table('goods') . " WHERE 1 " . $and . " ORDER BY aid DESC LIMIT {$start},{$size}");
            if ($_G[page] == 1) {
                $_SESSION[update_goods][start_time] = TIMESTAMP;
                $_SESSION[update_goods][page_size] = $page_size;
            }
            $_SESSION[update_goods][page] = intval($_G[page]);
            $_SESSION[update_goods][url] = $url;
            if ($_G[page] < $page_size) {
                $rs .= '准备更新下一页....
						<script type="text/javascript">
						var timer = null;
						function start(){
							var url  = "' . $url . '"
							timer =setTimeout(function(){
							window.location.href = url;
							},5000);	
						};
						function stop(t){
							clearTimeout(timer);
							t.value = "继续更新请刷新页面";
						}
						start();
						</script>;
						<input type="button" value="停止" onClick="stop(this);" style="height:24px;line-height:24px;color:#f00">';
            } else {
                $rs .= "<p style='color:#F00;'>更新完毕,成功: " . $_SESSION[update_goods][success_len] . ' 条,用时 ' . (TIMESTAMP - $_SESSION[update_goods][start_time]) / 60 . ' 分钟</p>';
            }
            foreach ($list as $k => $v) {
                $goods = $m->get($v[num_iid], false);
                //先获取商品信息,再来更新
                //肯定是没有获取成功
                if ($goods[sum] == 0 && $goods[num] == 0) {
                    $rs .= '<p>id=' . $v[aid] . ',销量和库存获取失败,跳过  ' . $v[title] . '</p>';
                    continue;
                }
                //只更新10天前的商品,一般上线时间是5天,可能5天后卖家没有修改价格..
                if ($_GET[field][yh_price] == 1 && $v[posttime] + 864000 > TIMESTAMP) {
                    unset($goods[yh_price]);
                }
                $data = array();
                foreach ($field as $k1 => $v1) {
                    if ($v1 == 1) {
                        $data[$k1] = $goods[$k1];
                    }
                }
                $data[dateline] = TIMESTAMP;
                $len = DB::update('goods', $data, 'aid=' . $v[aid]);
                if ($len) {
                    $rs .= '<p>id=' . $v[aid] . ',更新成功 ' . $v[title] . '</p>';
                    $_SESSION[update_goods][success_len] = intval($_SESSION[update_goods][success_len]) + 1;
                }
            }
            if ($_G[page] >= $page_size) {
                $msg = "更新完毕,成功: " . $_SESSION[update_goods][success_len] . ' 条,用时 ' . (TIMESTAMP - $_SESSION[update_goods][start_time]) / 60 . ' 分钟';
                unset($_SESSION[update_goods]);
                msg($msg, 'success', 'm=tools&a=update_goods');
                return false;
            }
            echo $rs;
            return false;
        }
        $field = array('picurl' => array('key' => 'picurl', 'name' => '主图', 'check' => 0), 'title' => array('key' => 'title', 'name' => '标题', 'check' => 0), 'num' => array('key' => 'num', 'name' => '库存数量', 'check' => 0), 'yh_price' => array('key' => 'yh_price', 'name' => '优惠价', 'check' => 0), 'sum' => array('key' => 'sum', 'name' => '销量', 'check' => 0), 'views' => array('key' => 'views', 'name' => '收藏', 'check' => 0));
        if ($_G['setting']['filter_field']) {
            foreach ($_G['setting']['filter_field'] as $k => $v) {
                $field[$v]['check'] = 1;
            }
        }
        $info = '';
        if ($_SESSION[update_goods] && $_SESSION[update_goods][page] > 1) {
            $msg = '您上次在 ' . dgmdate($_SESSION[update_goods][start_time], 'dt') . ' 更新到第' . $_SESSION[update_goods][page] . '页,还有' . ($_SESSION[update_goods][page_size] - $_SESSION[update_goods][page]) . '页未完成,点击可继续上次更新?';
            $info = '<a class="red" target="_blank" href="' . $_SESSION[update_goods][url] . '">' . $msg . '</a>';
        }
        unset($_SESSION[update_goods]);
        $this->add(array('field' => $field, 'info' => $info));
        $this->show();
    }
Exemplo n.º 11
0
function get_tomorrow($and, $size)
{
    if (!$size || $size <= 0 || $_GET[price]) {
        return array();
    }
    $h = intval(dgmdate(TIMESTAMP, 'H'));
    if ($h < 10) {
        //未到10点显示今日上架的商品
        $tomorrow = dmktime(dgmdate(TIMESTAMP + 86400, 'd'));
    } elseif ($h >= 16) {
        //上架第二天的商品
        $tomorrow = dmktime(dgmdate(TIMESTAMP + 86400 * 2, 'd'));
    } else {
        return array();
    }
    $and = ' AND  `check` =1  AND start_time>=' . TIMESTAMP . ' AND start_time<' . $tomorrow . $and;
    $yugao = D(array('and' => $and, 'limit' => intval($size), 'all' => true, 'order' => 'start_time ASC'));
    return $yugao;
}
Exemplo n.º 12
0
 public function gift($dp)
 {
     global $_G;
     if (!$dp[content]) {
         $dp['content'] = $dp['title'];
     } else {
         $dp['content'] = trim_html($dp[content], 1);
     }
     $dp['org_dateline'] = $dp['dateline'];
     $dp['dateline'] = dgmdate($dp['dateline'], 'u');
     $dp['duixiang_name'] = $_G[setting][duixiang][$dp[duixiang]]['name'];
     $dp['changhe_name'] = $_G[setting][changhe][$dp[changhe]]['name'];
     $dp['gexing_name'] = $_G[setting][gexing][$dp[gexing]]['name'];
     $dp['leimu_name'] = $_G[setting][leimu][$dp[leimu]]['name'];
     $cate = $dp['cate'];
     if ($_G[gift_cate][$cate]) {
         $dp['cate_name'] = $_G[gift_cate][$cate]['name'];
     } else {
         //最多遍利两级
         foreach ($_G[gift_cate] as $k => $v) {
             if ($v['id'] == $cate) {
                 $dp['cate_name'] = $v['name'];
                 break;
             } else {
                 foreach ($v['sub'] as $k1 => $v1) {
                     if ($v1['id'] == $cate) {
                         $dp['cate_name'] = $v1['name'];
                         break;
                     }
                 }
             }
         }
     }
     $dp['tags'] = make_tags($dp[keywords], '/index.php?m=gift&a=list&tag=');
     $dp[images] = explode(',', $dp[images]);
     $dp[id_url] = $dp[url] = '/index.php?m=gift&id=' . $dp[id];
     $check_text = array('待审核', '已通过', '未通过');
     $dp[check_text] = $check_text[$dp[check]];
     $today = dmktime(dgmdate(TIMESTAMP, 'd'));
     if ($dp[dateline] > $today) {
         $dp['new'] = 1;
     } else {
         $dp['new'] = 0;
     }
     $min = 0;
     if ($dp[goods]) {
         $dp[goods] = stripcslashes($dp[goods]);
         $dp[goods] = unserialize($dp[goods]);
         if (is_array($dp[goods]) && $dp[goods]) {
             foreach ($dp[goods] as $k => $v) {
                 if ($v['num_iid']) {
                     // $url = "http://item.taobao.com/item.htm?id=".$v[num_iid];
                     $url = '/index.php?a=go_pay&num_iid=' . $v[num_iid];
                     $v[url] = $url;
                 }
                 if ($v[content]) {
                     $v[content] = trim_html($v[content], 1);
                 }
                 //if($dp[images] && $v[picurl] && !in_array($v[picurl],$dp[images])) $v[images][] = $v[picurl];
                 //if(!$v['price'])$v['price']=$v['yh_price'];
                 $v['like'] = intval($v['like']);
                 $dp[goods][$k] = $v;
             }
             //最多只能添加10条
             $dp[goods] = array_splice($dp[goods], 0, 10);
         } else {
             $dp[goods] = array();
         }
     } else {
         $dp[goods] = array();
     }
     $dp['price'] = $dp[goods][0]['price'];
     return $dp;
 }
Exemplo n.º 13
0
function get_filed($name, $data = '', $id = '')
{
    global $_G;
    $arr = array();
    if (!$_G[table][$name]) {
        $_G['table'][$name] = table($name);
    }
    $int = array('int', 'tinyint', 'decimal', 'smallint', 'float');
    $float = array('decimal', 'float');
    $times = array('start_time', 'end_time', 'dateline', 'posttime', 'regdate', 'login_time');
    foreach ($_G[table][$name] as $k => $v) {
        //表单中提交的数据,和数据库中的字段名和类型对比
        if ($data && is_array($data)) {
            if ($v['pre']) {
                continue;
            }
            if ($id) {
                //编辑
                if (isset($data[$k])) {
                    if (in_array($k, $times)) {
                        $arr[$k] = $data[$k] ? dmktime($data[$k]) : 0;
                    } elseif (in_array($v[type], $float)) {
                        $arr[$k] = $data[$k] ? floatval($data[$k]) : 0;
                    } elseif (in_array($v[type], $int)) {
                        $arr[$k] = $data[$k] ? intval($data[$k]) : 0;
                    } elseif (is_string($data[$k])) {
                        $arr[$k] = $data[$k] ? trim($data[$k]) : '';
                    } else {
                        $arr[$k] = $arr[$k] ? $data[$k] : '';
                    }
                }
            } else {
                //添加发布
                if (in_array($k, $times)) {
                    $arr[$k] = $data[$k] ? dmktime($data[$k]) : 0;
                } elseif (in_array($v[type], $float)) {
                    $arr[$k] = $data[$k] ? floatval($data[$k]) : 0;
                } elseif (in_array($v[type], $int)) {
                    $arr[$k] = $data[$k] ? intval($data[$k]) : 0;
                } elseif (is_string($data[$k])) {
                    $arr[$k] = $data[$k] ? trim($data[$k]) : '';
                } else {
                    $arr[$k] = $arr[$k] ? $data[$k] : '';
                }
            }
        } else {
            if ($v['pre']) {
                continue;
            }
            if (in_array($k, $times)) {
                $arr[$k] = 0;
            } elseif (in_array($v[type], $float)) {
                $arr[$k] = 0;
            } elseif (in_array($v[type], $int)) {
                $arr[$k] = 0;
            } elseif (is_string($data[$k])) {
                $arr[$k] = '';
            } else {
                $arr[$k] = '';
            }
        }
    }
    unset($arr['dateline'], $arr['posttime']);
    return $arr;
}
Exemplo n.º 14
0
 function post()
 {
     global $_G;
     if (!is_login()) {
         return false;
     }
     if (!$_G[uid]) {
         msg('未登录无法进行操作');
     }
     if ($_G[member][groupid] == 3) {
         msg('抱歉,您当前是禁止用户,无法使用');
     } else {
         if ($_G[member][check] == 0) {
             msg('抱歉,您当前账号未审核无法使用');
         }
     }
     if ($_G[setting][say_status] != 1) {
         msg('系统已关闭评论功能');
     }
     if ($_SESSION['comment'] && $_SESSION['comment']['time'] > 0) {
         $last_comment_time = $_SESSION['comment']['time'] > 0 ? TIMESTAMP - intval($_SESSION['comment']['time']) : 0;
         if ($last_comment_time < 5) {
             msg('发言太快,请休息一下吧');
         }
     }
     $type = trim($_GET[type]);
     $id = intval($_GET[id]);
     if (!$id) {
         msg('抱歉,您要提交的id不能为空');
     }
     if (!$type) {
         msg('抱歉,评论类型不能为空');
     }
     if (!preg_match("/^[a-z_]+\$/", $type)) {
         msg('评论类型格式不正确');
     }
     if (!array_key_exists($type, $_G[setting][comment_types])) {
         msg('当前模块不允许评论或留言');
     }
     $content = trim($_GET[content]);
     if (!$content) {
         msg('您要评论的内容不能为空');
     }
     $content = safe_filter($content);
     $comment_day = $_G[setting][comment_day] > 0 ? $_G[setting][comment_day] : 30;
     //天限制
     $today = dmktime(dgmdate(TIMESTAMP, 'd'));
     $count_day = getcount('comment', " uid=" . $_G[uid] . " AND type = '" . $type . "' AND dateline>" . $today);
     if ($count_day > $comment_day) {
         msg('您今日发布的评论已超过' . $comment_day . '条,待明日再评论吧.');
     }
     $comment_month_mod = $_G[setting][comment_month_mod] > 0 ? $_G[setting][comment_month_mod] : 300;
     //月限制
     $day30 = dmktime(dgmdate(TIMESTAMP - 86400 * 30, 'd'));
     $count = getcount('comment', " uid=" . $_G[uid] . " AND type = '" . $type . "' AND dateline>" . $day30);
     if ($count_day > $comment_month_mod) {
         msg('您本月发布的 ' . $_G[setting][comment_types][$type] . ' 评论已超过' . $comment_month_mod . '条,待下月再来吧.');
     }
     $comment_month_sum = $_G[setting][comment_month_sum] > 0 ? $_G[setting][comment_month_sum] : 1000;
     //不限制分类,月限制
     $day30 = dmktime(dgmdate(TIMESTAMP - 86400 * 30, 'd'));
     $count = getcount('comment', " uid=" . $_G[uid] . " AND dateline>" . $day30);
     if ($count_day > $comment_month_sum) {
         msg('您本月发布的总评论已超过' . $comment_month_sum . '条,待下月再来吧.');
     }
     //检查回复的主题id是否存在
     $idname = $type == 'goods' ? 'aid' : 'id';
     $count_len = getcount($type, $idname . '=' . $id);
     if (!$count_len) {
         msg('回复的主题不存在');
     }
     if ($_G['setting']['comment_filter'] != 1) {
         $content = trim($content);
         //	$html_arr = array('<p><img><a><b><strong><h1><h2><h3><h4><h5><h6><span><em><i><div><table><tr><td><th>');
         //$html_arr = array('<p><img>');
         $content = strip_tags($content);
         $content = str_replace(array('"', "'"), '', $content);
         $content = trim_html($content, 1);
     }
     $content = daddslashes($content);
     if ($_SESSION['comment'] && $_SESSION['comment']['time'] > 0) {
         $last_content = $_SESSION['comment']['content'];
         if ($last_content && $content == $last_content) {
             msg('请勿发布同样的内容');
         }
     }
     $arr = array();
     $arr['uid'] = $_G[uid];
     $arr['username'] = $_G[username];
     $arr['dateline'] = TIMESTAMP;
     $arr['ip'] = $_G[clientip];
     $arr['type_id'] = $id;
     $arr['type'] = $type;
     $arr['content'] = $content;
     if ($_GET['num_iid']) {
         $arr['num_iid'] = trim_html($_GET['num_iid']);
     }
     if ($_GET[is_reply] && $_GET[reply_id] > 0) {
         $arr['is_reply'] = 1;
         $arr['reply_id'] = intval($_GET[reply_id]);
     } else {
         $arr['is_reply'] = 0;
         $arr['reply_id'] = 0;
     }
     $arr['picurl'] = '';
     $arr['check'] = intval($_G[setting][comment_check]);
     $jf = intval($_G[setting][comment_jf]);
     $arr['jf'] = $jf;
     $insert_id = DB::insert('comment', $arr, 1);
     if (!$insert_id) {
         msg('评论失败');
     }
     $msg = '评论成功';
     if ($jf > 0) {
         $msg .= ',恭喜您获得' . $jf . '积分';
         insert_sign(array('desc' => $msg, 'type' => 'comment', 'org_jf' => $_G[member][jf], 'jf' => $jf, 'aid' => $insert_id));
         update_member(array('jf' => $_G[member][jf] + $jf), $_G[uid]);
     }
     $_SESSION['comment']['time'] = TIMESTAMP;
     $_SESSION['comment']['content'] = $arr['content'];
     $fd = table($type);
     if (isset($fd['comment_count'])) {
         $where = '';
         if (isset($fd['id'])) {
             $where = 'id=' . $id;
         } else {
             if (isset($fd['aid'])) {
                 $where = 'aid=' . $id;
             }
         }
         $count = getcount(__CLASS__, " AND type = '{$type}' AND type_id = " . $id . " AND `check` =1 ");
         if ($where) {
             $r = DB::update($type, array('comment_count' => $count), $where);
         }
     }
     /*$data = array('user_pic'=>$_G[member][picurl],'id'=>$insert_id,'username'=>$_G[username],
     		'dateline'=>TIMESTAMP,'content'=>$arr[content]);	*/
     if ($arr[check] == 0) {
         $msg .= ' 需待审核后才能显示';
     }
     if ($_G['inajax'] == 1) {
         json(array('status' => 'success', 'msg' => $msg, 'data' => $data));
     } else {
         msg($msg, 'success');
     }
 }
Exemplo n.º 15
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check() && !$_GET[search]) {
         $page = $_G[page] > 1 ? '&page=' . $_G[page] : '';
         foreach ($_GET[ids] as $k => $v) {
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             $aid = intval($v);
             $arr = array();
             $arr['start_time'] = dmktime($_GET['start_time'][$k]);
             $arr['end_time'] = dmktime($_GET['end_time'][$k]);
             $arr['sort'] = intval($_GET['sort'][$k]);
             if ($_GET['cate'][$k] > 0) {
                 $arr['cate'] = intval($_GET['cate'][$k]);
             }
             $arr['hide'] = intval($_GET['hide'][$k]);
             if ($_GET['cate_in'] != '-1') {
                 $arr['cate'] = intval($_GET['cate_in']);
             }
             if ($_GET['flag_in'] > 0) {
                 $arr['flag'] = intval($_GET['flag_in']);
             }
             if ($_GET['hide_in'] == 1) {
                 $arr['hide'] = 1;
             }
             if ($_GET['check'] == 1) {
                 $arr['check'] = 1;
             }
             if ($_GET['in_fid']) {
                 $arr['fid'] = intval($_GET['in_fid']);
             }
             if ($_GET['start_time_in'] && dmktime($_GET['start_time_in']) > 0) {
                 $arr['start_time'] = dmktime($_GET['start_time_in']);
             }
             if ($_GET['end_time_in'] && dmktime($_GET['end_time_in']) > 0) {
                 $arr['end_time'] = dmktime($_GET['end_time_in']);
             }
             $num_iid = $_GET['num_iid'][$k];
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 api_post(array('a' => 'delete', 'table' => 'goods', 'id' => $num_iid, 'pre_key' => 'num_iid'));
                 DB::delete("goods", "aid=" . intval($aid));
             } else {
                 api_post(array('a' => 'update', 'table' => 'goods', 'data' => $arr, 'pre_key' => 'num_iid', 'id' => $num_iid));
                 DB::update("goods", $arr, "aid=" . $aid);
             }
         }
         $this->add(array('goods' => $goods, 'field' => $field, 'bm_status_text' => $bm_status_text));
         $url = '';
         cpmsg('操作成功', 'success');
         return false;
     }
     $and = ' AND `post` > 0';
     $url = '';
     if (isset($_GET['checks'])) {
         $check = intval($_GET['checks']);
         $and .= " AND `check` =" . $check;
         $url .= "&checks=" . $check;
     }
     $rs = D(array('and' => $and, 'all' => true, 'order' => 'aid ASC'), array('url' => URL . "m=apply&a=main" . $url, 'size' => 40));
     if ($_G[setting][bm_status_text]) {
         if (!is_array($_G[setting][bm_status_text])) {
             $bm_status_text = array();
             $tmp = explode("\r\n", $_G[setting][bm_status_text]);
             foreach ($tmp as $k => $v) {
                 $v = explode("|", $v);
                 $bm_status_text[$v[0]] = array('status' => $v[0], 'name' => $v[1], 'content' => $v[2]);
             }
         } else {
             $bm_status_text = $_G[setting][bm_status_text];
         }
     }
     $rs[bm_status_text] = $bm_status_text;
     $this->add($rs);
     $this->show('apply/main');
 }
Exemplo n.º 16
0
             foreach ($taskvars['setting'] as $taskvar) {
                 if ($taskvar['variable']) {
                     showsetting($taskvar['name'], $taskvar['variable'], $taskvar['value'], $taskvar['type'], '', 0, $taskvar['description']);
                 } else {
                     showsetting($taskvar['name'], $taskvar['variable'], $taskvar['value'], $taskvar['description']);
                 }
             }
         }
     }
     showsubmit('editsubmit', 'submit');
     showtablefooter();
     showformfooter();
 } else {
     $applyperm = $grouplimit == 'special' && is_array($applyperm) ? implode("\t", $applyperm) : $grouplimit;
     $starttime = dmktime($starttime);
     $endtime = dmktime($endtime);
     $prize = ${'prize_' . $reward};
     $bonus = ${'bonus_' . $reward};
     if (!$name || !$description) {
         cpmsg('tasks_basic_invalid', '', 'error');
     } elseif (($starttime != $task['starttime'] || $endtime != $task['endtime']) && ($endtime && $endtime <= $timestamp || $starttime && $endtime && $endtime <= $starttime)) {
         cpmsg('tasks_time_invalid', '', 'error');
     } elseif ($reward && (!$prize || $reward == 'credit' && !$bonus)) {
         cpmsg('tasks_reward_invalid', '', 'error');
     } elseif ($task['newbietask'] == '1') {
         switch (substr($task['scriptname'], 7)) {
             case 'post_reply':
                 $checkid = 'tid';
                 $newbiesettingok = checksettings('tid', $threadid);
                 break;
             case 'post_newthread':
Exemplo n.º 17
0
             $varname = in_array($taskvar['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ? $taskvar['type'] == 'mselect' ? array($taskvar['variable'] . '[]', $taskcvar['value']) : array($taskvar['variable'], $taskcvar['value']) : $taskvar['variable'];
             if (in_array($taskvar['type'], array('mcheckbox', 'mselect'))) {
                 $taskvar['value'] = unserialize($taskvar['value']);
             }
             showsetting($taskvar['name'], $varname, $taskvar['value'], $taskvar['type'], '', 0, $taskvar['description']);
         }
     } else {
         showtablerow('', 'class="td27" colspan="2"', cplang('nolimit'));
     }
     showsubmit('editsubmit', 'submit');
     showtablefooter();
     showformfooter();
 } else {
     $applyperm = $_G['gp_grouplimit'] == 'special' && is_array($_G['gp_applyperm']) ? implode("\t", $_G['gp_applyperm']) : $_G['gp_grouplimit'];
     $_G['gp_starttime'] = dmktime($_G['gp_starttime']);
     $_G['gp_endtime'] = dmktime($_G['gp_endtime']);
     $reward = $_G['gp_reward'];
     $prize = $_G['gp_prize_' . $reward];
     $bonus = $_G['gp_bonus_' . $reward];
     if (!$_G['gp_name'] || !$_G['gp_description']) {
         cpmsg('tasks_basic_invalid', '', 'error');
     } elseif (($_G['gp_starttime'] != $task['starttime'] || $_G['gp_endtime'] != $task['endtime']) && ($_G['gp_endtime'] && $_G['gp_endtime'] <= TIMESTAMP || $_G['gp_starttime'] && $_G['gp_endtime'] && $_G['gp_endtime'] <= $_G['gp_starttime'])) {
         cpmsg('tasks_time_invalid', '', 'error');
     } elseif ($reward && (!$prize || $reward == 'credit' && !$bonus)) {
         cpmsg('tasks_reward_invalid', '', 'error');
     }
     if ($task['available'] == '2' && ($_G['gp_starttime'] > TIMESTAMP || $_G['gp_endtime'] && $_G['gp_endtime'] <= TIMESTAMP)) {
         DB::query("UPDATE " . DB::table('common_task') . " SET available='1' WHERE taskid='{$id}'", 'UNBUFFERED');
     }
     if ($task['available'] == '1' && (!$_G['gp_starttime'] || $_G['gp_starttime'] <= TIMESTAMP) && (!$_G['gp_endtime'] || $_G['gp_endtime'] > TIMESTAMP)) {
         DB::query("UPDATE " . DB::table('common_task') . " SET available='2' WHERE taskid='{$id}'", 'UNBUFFERED');
Exemplo n.º 18
0
 function share_callback()
 {
     global $_G;
     //if($_G['inajax'] !=1) json('Eroor');
     if (!is_login()) {
         return false;
     }
     if ($_G[member][groupid] == 3) {
         msg('抱歉,您当前是禁止用户,无法使用', 'error');
         return false;
     } else {
         if ($_G[member][check] == 0) {
             msg('抱歉,您当前账号未审核无法使用', 'error');
             return false;
         }
     }
     if (!$_GET['type']) {
         msg('分享类型不存在');
         return;
     }
     $type = trim_html($_GET['type'], 1);
     if (!array_key_exists($type, $_G['setting']['share_type_callback'])) {
         msg('未定义的类型,无法分享', 'error');
     }
     $id = intval($_GET[id]);
     if (!$id) {
         msg('抱歉,要分享的id不存在', 'error');
         return false;
     }
     $name = $_G['setting']['share_type_callback'][$type];
     $desc = '分享内容到 ' . $name . ' id=' . $id;
     //$count = getcount('sign'," uid = ".$_G[uid]." AND `desc`='".$desc."' AND type = '".$type."'");
     $count = 0;
     $is_add = false;
     if ($count == 0) {
         $is_add = true;
     } else {
         $today = dmktime(dgmdate(TIMESTAMP, 'd'));
         $count_day = getcount('sign', " uid = " . $_G[uid] . " AND type = '" . $type . "'  AND dateline >=" . $today);
         if ($count_day > $_G[setting][share_goods_num]) {
             $is_add = false;
         }
     }
     if ($is_add) {
         $jf = $_G[setting][share_goods];
         $add_jf = $_G['member']['jf'] + $jf;
         $sid = insert_sign(array('desc' => $desc, 'type' => 'share', 'org_jf' => $add_jf, 'jf' => $jf));
         if ($sid) {
             update_member(array('jf' => $_G[member][jf] + $jf), $_G[uid]);
         }
     }
     json(array('msg' => '分享成功', 'status' => 'success'));
 }
Exemplo n.º 19
0
 function insert($arr, $update = false)
 {
     global $_G;
     if (!$arr || !$arr['num_iid']) {
         return false;
     }
     $num_iid = trim($arr['num_iid']);
     $res = DB::fetch_first("SELECT aid FROM " . DB::table('goods') . " WHERE num_iid='{$num_iid}'");
     if ($res[aid] > 0) {
         if ($update) {
             return $this->update($arr, $res['aid']);
         } else {
             return false;
         }
     }
     if ($arr['images'] && is_array($arr['images'])) {
         $arr['images'] = array_filter($arr['images']);
         $arr['images'] = implode(',', $arr['images']);
     } elseif (!$arr['images']) {
         $arr['images'] = '';
     }
     $arr['sid'] = intval($arr['sid']);
     $arr['fid'] = intval($arr['fid']);
     $arr['flag'] = intval($arr['flag']);
     $arr['sort'] = intval($arr['sort']);
     $arr['num'] = intval($arr['num']);
     $arr['baoyou'] = intval($arr['baoyou']);
     $arr['views'] = intval($arr['views']);
     $arr['hide'] = intval($arr['hide']);
     $arr['post'] = intval($arr['post']);
     $arr['cate'] = intval($arr['cate']);
     $arr['check'] = intval($arr['check']);
     $arr['shop_type'] = intval($arr['shop_type']);
     $arr['sum'] = intval($arr['sum']);
     $arr['bili'] = $arr['bili'] ? $arr['bili'] : '';
     $arr['apply_user'] = $arr['apply_user'] ? trim($arr['apply_user']) : '';
     $arr['apply_phone'] = $arr['apply_phone'] ? trim($arr['apply_phone']) : '';
     $arr['apply_wangwang'] = $arr['apply_wangwang'] ? trim($arr['apply_wangwang']) : '';
     $arr['keywords'] = $arr['keywords'] ? trim($arr['keywords']) : '';
     $arr['description'] = $arr['description'] ? trim($arr['description']) : '';
     $arr['apply_qq'] = $arr['apply_qq'] ? trim($arr['apply_qq']) : '';
     if ($arr['ly']) {
         $arr['ly'] = trim($arr['ly']);
         $arr['ly'] = strip_tags($arr['ly']);
     }
     $arr['return_msg'] = $arr['return_msg'] ? trim($arr['return_msg']) : '';
     $arr['num_iid'] = $arr['num_iid'] ? trim($arr['num_iid']) : '';
     $arr['title'] = $arr['title'] ? trim($arr['title']) : '';
     $arr['nick'] = $arr['nick'] ? trim($arr['nick']) : '';
     $arr['picurl'] = $arr['picurl'] ? trim($arr['picurl']) : $arr['images'][0];
     $arr['url'] = 'http://item.taobao.com/item.htm?id=' . $arr['num_iid'];
     $arr['price'] = $arr['price'] ? sprintf("%.1f", $arr['price']) : 0;
     $arr['city'] = $arr['city'] ? trim($arr['city']) : '';
     $arr['state'] = $arr['state'] ? trim($arr['state']) : '';
     $arr['message'] = $arr['message'] ? trim($arr['message']) : '';
     $arr['username'] = $_G['username'] ? trim($_G['username']) : '外星人';
     $arr['uid'] = $_G['uid'] ? intval($_G['uid']) : 0;
     $arr['yh_price'] = $arr['yh_price'] ? sprintf("%.1f", $arr['yh_price']) : $arr['price'];
     $arr['start_time'] = dmktime($arr['start_time']);
     $arr['end_time'] = dmktime($arr['end_time']);
     $arr['dateline'] = $arr['dateline'] > 0 ? $arr['dateline'] : TIMESTAMP;
     $arr['posttime'] = $arr['posttime'] > 0 ? $arr['posttime'] : TIMESTAMP;
     $arr['like'] = intval($arr[like]);
     $arr['open_iid'] = $arr['open_iid'] ? trim($arr['open_iid']) : '';
     $arr['title'] = trim_html($arr['title'], 1);
     $arr['title'] = cutstr($arr['title'], 250, '');
     $arr['ly'] = cutstr($arr['ly'], 250, '');
     $arr['return_msg'] = cutstr($arr['return_msg'], 250, '');
     unset($arr['zk']);
     if (!$arr['keywords'] && $_G[setting][auto_keywords] == 1) {
         $arr['keywords'] = get_keywords($arr['title']);
     }
     try {
         $id = DB::insert('goods', $arr, 1);
     } catch (PDOException $e) {
         L('商品ID重复', 'error');
         return false;
     }
     if ($id > 0) {
         $arr['aid'] = $id;
         api_post(array('a' => 'insert', 'table' => 'goods', 'data' => $arr));
     }
     return $id;
 }
Exemplo n.º 20
0
 private function check_yaoqing($t, $arr)
 {
     global $_G;
     if ($t > 0 && $_G[setting][yaoqing] > 0) {
         //月限制
         $day30 = TIMESTAMP - 3600 * 24 * 30;
         $count = getcount('member', ' AND t_uid=' . $t . " AND regdate>" . $day30);
         //天限制
         $today = dmktime(dgmdate(TIMESTAMP, 'd'));
         $count_day = getcount('member', ' AND t_uid=' . $t . " AND regdate>" . $today);
         if ($count <= $_G[setting][yaoqing_num] && $count_day <= $_G[setting][yaoqing_day]) {
             $tmp = DB::fetch_first("SELECT * FROM " . DB::table('member') . " WHERE uid ='{$t}' ");
             if ($tmp[uid] > 0 && $tmp[groupid] != 3 && $tmp[check] == 1) {
                 $update_arrr = array();
                 $jf = $_G[setting][yaoqing];
                 $add_jf = $tmp['jf'] + $jf;
                 $sid = insert_sign(array('uid' => $tmp[uid], 'username' => $tmp[username], 'desc' => $tmp[username] . '邀请' . $arr[username] . '注册', 'type' => 'yaoqing', 'org_jf' => $add_jf, 'jf' => $jf));
                 //自动升级到推广组
                 if ($tmp['rank'] == 0 && $_GET['setting']['fanli'] == 1) {
                     $update_arrr['rank'] = 1;
                 }
                 if ($sid) {
                     $update_arrr['jf'] = $tmp[jf] + $jf;
                     dsetcookie("t", '0', -1);
                 }
                 if (count($update_arrr) > 0) {
                     update_member(array('jf' => $tmp[jf] + $jf), $tmp[uid]);
                 }
             }
         }
     }
 }