Exemple #1
0
 public function doWebCommission()
 {
     global $_W, $_GPC;
     load()->func('tpl');
     checklogin();
     $uniacid = $_W['uniacid'];
     $op = $operation = $_GPC['op'] ? $_GPC['op'] : 'display';
     $members = pdo_fetchall("select id, realname, mobile from " . tablename('eso_sale_member') . " where uniacid = " . $_W['uniacid'] . " and status = 1");
     $member = array();
     foreach ($members as $m) {
         $member['realname'][$m['id']] = $m['realname'];
         $member['mobile'][$m['id']] = $m['mobile'];
     }
     // 正在申请
     if ($op == 'display') {
         if ($_GPC['opp'] == 'check') {
             $shareid = $_GPC['shareid'];
             // 申请人的信息
             $user = pdo_fetch("select realname, mobile from " . tablename('eso_sale_member') . " where id = " . $_GPC['shareid']);
             // 申请订单信息
             $info = pdo_fetch("select og.id, og.total, og.price, og.status, og.commission, og.commission2,og.commission3, og.applytime, og.content, g.title from " . tablename('eso_sale_order_goods') . " as og left join " . tablename('eso_sale_goods') . " as g on og.goodsid = g.id and og.uniacid = g.uniacid where og.id = " . $_GPC['id']);
             include $this->template('applying_detail');
             exit;
         }
         if ($_GPC['opp'] == 'checked') {
             $checked = array('status' => $_GPC['status'], 'checktime' => time(), 'content' => trim($_GPC['content']));
             $temp = pdo_update('eso_sale_order_goods', $checked, array('id' => $_GPC['id']));
             if (empty($temp)) {
                 message('审核失败,请重新审核!', $this->createWebUrl('commission', array('opp' => 'check', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'error');
             } else {
                 message('审核成功!', $this->createWebUrl('commission'), 'success');
             }
         }
         if ($_GPC['opp'] == 'sort') {
             $sort = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile']);
             //$shareid = pdo_fetchall("select id from ".tablename('eso_sale_member')." where uniacid = ".$_W['uniacid']." and realname like '%".$sort['realname']."%' and mobile like '%".$sort['mobile']."%'");
             $shareid = "select id from " . tablename('eso_sale_member') . " where uniacid = " . $_W['uniacid'] . " and realname like '%" . $sort['realname'] . "%' and mobile like '%" . $sort['mobile'] . "%'";
             $list = pdo_fetchall("select o.shareid, o.status, g.id, g.applytime from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = 1 and o.shareid in (" . $shareid . ") ORDER BY o.id desc");
             $total = sizeof($list);
         } else {
             $pindex = max(1, intval($_GPC['page']));
             $psize = 20;
             $list = pdo_fetchall("select o.shareid, o.status, g.id, g.applytime from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = 1 ORDER BY o.id DESC limit " . ($pindex - 1) * $psize . ',' . $psize);
             $total = pdo_fetchcolumn("select count(o.id) from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = 1");
             $pager = pagination1($total, $pindex, $psize);
         }
         include $this->template('applying');
         exit;
     }
     // 审核通过
     if ($op == 'applyed') {
         if ($_GPC['opp'] == 'jieyong') {
             $shareid = $_GPC['shareid'];
             // 申请人的信息
             $user = pdo_fetch("select id, realname, mobile,shareid from " . tablename('eso_sale_member') . " where id = " . $_GPC['shareid']);
             // 申请订单信息
             $info = pdo_fetch("select og.id, og.total, og.price, og.status, og.commission, og.commission2,og.commission3, og.applytime, og.content, g.title from " . tablename('eso_sale_order_goods') . " as og left join " . tablename('eso_sale_goods') . " as g on og.goodsid = g.id and og.uniacid = g.uniacid where og.id = " . $_GPC['id']);
             // 佣金记录
             $commissions = pdo_fetchall("select * from " . tablename('eso_sale_commission') . " where ogid = " . $_GPC['id'] . ' and mid=' . $_GPC['shareid']);
             $commission = pdo_fetchcolumn("select sum(commission) from " . tablename('eso_sale_commission') . " where isshare!=1 and ogid = " . $_GPC['id'] . ' and mid=' . $_GPC['shareid']);
             $commission = empty($commission) ? 0 : $commission;
             if (!empty($user['shareid'])) {
                 $commission2 = pdo_fetchcolumn("select sum(commission) from " . tablename('eso_sale_commission') . " where isshare=1 and ogid = " . $_GPC['id'] . ' and mid=' . $user['shareid']);
                 $commission2 = empty($commission2) ? 0 : $commission2;
                 $user2 = pdo_fetch("select id, realname, mobile,shareid from " . tablename('eso_sale_member') . " where id = " . $user['shareid']);
                 if (!empty($user2['shareid'])) {
                     $commission3 = pdo_fetchcolumn("select sum(commission) from " . tablename('eso_sale_commission') . " where isshare=1 and ogid = " . $_GPC['id'] . ' and mid=' . $user2['shareid']);
                     $commission3 = empty($commission3) ? 0 : $commission3;
                     $user3 = pdo_fetch("select id, realname, mobile,shareid from " . tablename('eso_sale_member') . " where id = " . $user2['shareid']);
                 } else {
                     $commission3 = 0;
                 }
             } else {
                 $commission2 = 0;
             }
             include $this->template('applyed_detail');
             exit;
         }
         if ($_GPC['opp'] == 'jieyonged') {
             if ($_GPC['status'] == 2) {
                 if (!is_numeric($_GPC['commission']) || !is_numeric($_GPC['commission2']) || !is_numeric($_GPC['commission3'])) {
                     message('佣金请输入合法数字!', '', 'error');
                 }
                 $shareid = $_GPC['shareid'];
                 $ogid = $_GPC['id'];
                 $commission = array('uniacid' => $_W['uniacid'], 'mid' => $shareid, 'ogid' => $ogid, 'commission' => $_GPC['commission'], 'content' => trim($_GPC['content']), 'isshare' => 0, 'createtime' => time());
                 if ($_GPC['commission'] > 0) {
                     $temp = pdo_insert('eso_sale_commission', $commission);
                 }
                 $user = pdo_fetch("select id,shareid from " . tablename('eso_sale_member') . " where id = " . $_GPC['shareid']);
                 if (!empty($user['shareid'])) {
                     $user2 = pdo_fetch("select id from " . tablename('eso_sale_member') . " where flag=1 and id = " . $user['shareid']);
                     if (!empty($user2)) {
                         if (!empty($_GPC['commission2'])) {
                             $commission2 = array('uniacid' => $_W['uniacid'], 'mid' => $user['shareid'], 'ogid' => $ogid, 'commission' => $_GPC['commission2'], 'content' => trim($_GPC['content']), 'isshare' => 1, 'createtime' => time());
                             if ($_GPC['commission2'] > 0) {
                                 pdo_insert('eso_sale_commission', $commission2);
                             }
                         }
                     }
                 }
                 if (!empty($user2['id'])) {
                     $nuser2 = pdo_fetch("select shareid from " . tablename('eso_sale_member') . " where id = " . $user2['id']);
                 }
                 if (!empty($nuser2['shareid'])) {
                     $nuser3 = pdo_fetch("select id from " . tablename('eso_sale_member') . " where flag=1 and id = " . $nuser2['shareid']);
                     if (!empty($nuser3)) {
                         if (!empty($_GPC['commission3'])) {
                             $commission3 = array('uniacid' => $_W['uniacid'], 'mid' => $nuser2['shareid'], 'ogid' => $ogid, 'commission' => $_GPC['commission3'], 'content' => trim($_GPC['content']), 'isshare' => 1, 'createtime' => time());
                             if ($_GPC['commission3'] > 0) {
                                 pdo_insert('eso_sale_commission', $commission3);
                             }
                         }
                     }
                 }
                 if ($_GPC['commission'] > 0 && !empty($shareid)) {
                     $recharged = array('uniacid' => $_W['uniacid'], 'mid' => $shareid, 'flag' => 1, 'content' => trim($_GPC['content']), 'commission' => $_GPC['commission'], 'createtime' => time());
                     $temp = pdo_insert('eso_sale_commission', $recharged);
                     if (empty($temp)) {
                         message('充值失败,请重新充值!', $this->createWebUrl('commission', array('op' => 'applyed', 'opp' => 'jieyong', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'error');
                     } else {
                         $commission = pdo_fetchcolumn("select commission from " . tablename('eso_sale_member') . " where id = " . $shareid);
                         pdo_update('eso_sale_member', array('commission' => $commission + $_GPC['commission']), array('id' => $shareid));
                     }
                 }
                 if ($_GPC['commission2'] > 0 && !empty($user['shareid'])) {
                     $recharged = array('uniacid' => $_W['uniacid'], 'mid' => $user['shareid'], 'flag' => 1, 'content' => trim($_GPC['content']), 'commission' => $_GPC['commission2'], 'createtime' => time());
                     $temp = pdo_insert('eso_sale_commission', $recharged);
                     if (empty($temp)) {
                         message('充值失败,请重新充值!', $this->createWebUrl('commission', array('op' => 'applyed', 'opp' => 'jieyong', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'error');
                     } else {
                         $commission = pdo_fetchcolumn("select commission from " . tablename('eso_sale_member') . " where id = " . $user['shareid']);
                         pdo_update('eso_sale_member', array('commission' => $commission + $_GPC['commission2']), array('id' => $user['shareid']));
                     }
                 }
                 if ($_GPC['commission3'] > 0 && !empty($nuser2['shareid'])) {
                     $recharged = array('uniacid' => $_W['uniacid'], 'mid' => $nuser2['shareid'], 'flag' => 1, 'content' => trim($_GPC['content']), 'commission' => $_GPC['commission3'], 'createtime' => time());
                     $temp = pdo_insert('eso_sale_commission', $recharged);
                     if (empty($temp)) {
                         message('充值失败,请重新充值!', $this->createWebUrl('commission', array('op' => 'applyed', 'opp' => 'jieyong', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'error');
                     } else {
                         $commission = pdo_fetchcolumn("select commission from " . tablename('eso_sale_member') . " where id = " . $nuser2['shareid']);
                         pdo_update('eso_sale_member', array('commission' => $commission + $_GPC['commission3']), array('id' => $nuser2['shareid']));
                     }
                 }
                 message('充值成功!', $this->createWebUrl('commission', array('op' => 'applyed', 'opp' => 'jieyong', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'success');
                 //if(empty($temp)){
                 //		message('充值失败,请重新充值!', $this->createWebUrl('commission', array('op'=>'applyed', 'opp'=>'jieyong', 'shareid'=>$_GPC['shareid'], 'id'=>$_GPC['id'])), 'error');
                 //	}else{
                 //		message('审核成功!', $this->createWebUrl('commission', array('op'=>'applyed', 'opp'=>'jieyong', 'shareid'=>$_GPC['shareid'], 'id'=>$_GPC['id'])), 'success');
                 //	}
             } else {
                 $checked = array('status' => $_GPC['status'], 'content' => trim($_GPC['content']));
                 $temp = pdo_update('eso_sale_order_goods', $checked, array('id' => $_GPC['id']));
                 if (empty($temp)) {
                     message('提交失败,请重新提交!', $this->createWebUrl('commission', array('op' => 'applyed', 'opp' => 'jieyong', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'error');
                 } else {
                     message('提交成功!', $this->createWebUrl('commission', array('op' => 'applyed')), 'success');
                 }
             }
         }
         if ($_GPC['opp'] == 'sort') {
             $sort = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile']);
             //$shareid = pdo_fetchall("select id from ".tablename('eso_sale_member')." where uniacid = ".$_W['uniacid']." and realname like '%".$sort['realname']."%' and mobile like '%".$sort['mobile']."%'");
             $shareid = "select id from " . tablename('eso_sale_member') . " where uniacid = " . $_W['uniacid'] . " and realname like '%" . $sort['realname'] . "%' and mobile like '%" . $sort['mobile'] . "%'";
             $list = pdo_fetchall("select o.shareid, o.status, g.id, g.checktime from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = 2 and o.shareid in (" . $shareid . ") ORDER BY o.id desc");
             $total = sizeof($list);
         } else {
             $pindex = max(1, intval($_GPC['page']));
             $psize = 20;
             $list = pdo_fetchall("select o.shareid, o.status, g.id, g.checktime from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = 2 ORDER BY g.checktime DESC limit " . ($pindex - 1) * $psize . ',' . $psize);
             $total = pdo_fetchcolumn("select count(o.id) from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = 2");
             $pager = pagination1($total, $pindex, $psize);
         }
         include $this->template('applyed');
         exit;
     }
     // 审核无效
     if ($op == 'invalid') {
         if ($_GPC['opp'] == 'delete') {
             $delete = array('status' => -2);
             $temp = pdo_update('eso_sale_order_goods', $delete, array('id' => $_GPC['id']));
             if (empty($temp)) {
                 message('删除失败,请重新删除!', $this->createWebUrl('commission', array('op' => 'invalid')), 'error');
             } else {
                 message('删除成功!', $this->createWebUrl('commission', array('op' => 'invalid')), 'success');
             }
         }
         if ($_GPC['opp'] == 'detail') {
             $shareid = $_GPC['shareid'];
             // 申请人的信息
             $user = pdo_fetch("select realname, mobile from " . tablename('eso_sale_member') . " where id = " . $_GPC['shareid']);
             // 申请订单信息
             $info = pdo_fetch("select og.id, og.total, og.price, og.status, og.checktime, og.content, g.title from " . tablename('eso_sale_order_goods') . " as og left join " . tablename('eso_sale_goods') . " as g on og.goodsid = g.id and og.uniacid = g.uniacid where og.id = " . $_GPC['id']);
             include $this->template('invalid_detail');
             exit;
         }
         if ($_GPC['opp'] == 'invalided') {
             $invalided = array('status' => $_GPC['status'], 'content' => trim($_GPC['content']));
             $temp = pdo_update('eso_sale_order_goods', $invalided, array('id' => $_GPC['id']));
             if (empty($temp)) {
                 message('提交失败,请重新提交!', $this->createWebUrl('commission', array('op' => 'invalid', 'opp' => 'detail', 'shareid' => $_GPC['shareid'], 'id' => $_GPC['id'])), 'error');
             } else {
                 message('提交成功!', $this->createWebUrl('commission', array('op' => 'invalid')), 'success');
             }
         }
         if ($_GPC['opp'] == 'sort') {
             $sort = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile']);
             //$shareid = pdo_fetchall("select id from ".tablename('eso_sale_member')." where uniacid = ".$_W['uniacid']." and realname like '%".$sort['realname']."%' and mobile like '%".$sort['mobile']."%'");
             $shareid = "select id from " . tablename('eso_sale_member') . " where uniacid = " . $_W['uniacid'] . " and realname like '%" . $sort['realname'] . "%' and mobile like '%" . $sort['mobile'] . "%'";
             $list = pdo_fetchall("select o.shareid, o.status, g.id, g.checktime from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = -1 and o.shareid in (" . $shareid . ") ORDER BY o.id desc");
             $total = sizeof($list);
         } else {
             $pindex = max(1, intval($_GPC['page']));
             $psize = 20;
             $list = pdo_fetchall("select o.shareid, o.status, g.id, g.checktime from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = -1 ORDER BY o.id DESC limit " . ($pindex - 1) * $psize . ',' . $psize);
             $pager = pagination1($total, $pindex, $psize);
             $total = pdo_fetchcolumn("select count(o.id) from " . tablename('eso_sale_order') . " as o left join " . tablename('eso_sale_order_goods') . " as g on o.id = g.orderid and o.uniacid = g.uniacid where o.uniacid = " . $_W['uniacid'] . " and g.status = -1");
         }
         include $this->template('invalid');
         exit;
     }
 }
Exemple #2
0
    }
    $storeid = array();
    foreach ($stores as $key => $s) {
        $storeid[$key] = $s['id'];
    }
    $sid = implode(",", $storeid);
    if (empty($stores)) {
        $sid = 0;
    }
    if ($op == 'hot') {
        $style = 2;
        $activities = pdo_fetchall("select * from " . tablename('weilive_activity') . " where storeid in (" . $sid . ") and start_time < " . time() . " and end_time > " . time() . " and flag = 0 and isopen = 1 and ischeck = 1 and weid = " . $weid . " order by catch desc, used desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
        $total = pdo_fetchcolumn("select count(id) from " . tablename('weilive_activity') . " where storeid in (" . $sid . ") and start_time < " . time() . " and end_time > " . time() . " and flag = 0 and isopen = 1 and ischeck = 1 and weid = " . $weid);
    }
    if ($op == 'new') {
        $style = 3;
        $activities = pdo_fetchall("select * from " . tablename('weilive_activity') . " where storeid in (" . $sid . ") and start_time < " . time() . " and end_time > " . time() . " and flag = 0 and isopen = 1 and ischeck = 1 and weid = " . $weid . " order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
        $total = pdo_fetchcolumn("select count(id) from " . tablename('weilive_activity') . " where storeid in (" . $sid . ") and start_time < " . time() . " and end_time > " . time() . " and flag = 0 and isopen = 1 and ischeck = 1 and weid = " . $weid);
    }
}
$location_c = '中国';
$pager = pagination1($total, $pindex, $psize);
// $ip = getip();
// $ip = "115.239.210.27";
// $res = ihttp_get("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=".$ip);
// $res = $res['content'];
// $res = str_replace("var remote_ip_info = ", "", $res);
// $res = str_replace(";", "", $res);
// $res = json_decode($res);
// $city = $res->city;
include $this->template('index');
Exemple #3
0
 public function doMobileCommission()
 {
     global $_W, $_GPC;
     $weid = $_W['weid'];
     $op = $_GPC['op'] ? $_GPC['op'] : 'display';
     $this->CheckCookie();
     $from_user = $_W['fans']['from_user'];
     $rule = pdo_fetch('SELECT * FROM ' . tablename('broke_rule') . " WHERE `weid` = :weid ", array(':weid' => $_W['weid']));
     if (empty($from_user)) {
         message('你想知道怎么加入么?', $rule['gzurl'], 'sucessr');
         exit;
     }
     $shareid = 'broke_shareid' . $_W['weid'];
     if (empty($_COOKIE[$shareid])) {
     } else {
         $profile = pdo_fetchcolumn('SELECT id FROM ' . tablename('broke_member') . " WHERE  weid = :weid  AND from_user = :from_user", array(':weid' => $_W['weid'], ':from_user' => $from_user));
         if (!empty($profile)) {
         } else {
             echo "<script>\n\t\t\t\t\t\tif(confirm('您是否要注册?')){\n\t\t\t\t\t\t\twindow.location.href = '" . $this->createMobileUrl('register', array('op' => 'display')) . "';\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\twindow.location.href = '" . $this->createMobileUrl('yuyue') . "';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t</script>";
         }
     }
     $profile = pdo_fetch('SELECT * FROM ' . tablename('broke_member') . " WHERE  weid = :weid  AND from_user = :from_user", array(':weid' => $_W['weid'], ':from_user' => $from_user));
     if (empty($profile)) {
         message('请先注册', $this->createMobileUrl('register'), 'error');
         exit;
     }
     $mycommission = pdo_fetchcolumn("select commission from" . tablename('broke_member') . " where id =" . $profile['id']);
     $commission = pdo_fetchcolumn("select sum(commission) from" . tablename('broke_commission') . " where flag != 2 and mid =" . $profile['id'] . " and weid =" . $_W['weid']);
     $comm = $commission - $profile['commission'];
     if ($op == 'more') {
         $op = 'more';
         $pindex = max(1, intval($_GPC['page']));
         $psize = 10;
         $list = pdo_fetchall("select co.*, cu.realname from " . tablename('broke_commission') . " as co left join " . tablename('broke_customer') . " as cu on co.cid = cu.id and co.weid = cu.weid where co.mid =" . $profile['id'] . " and co.flag != 2 ORDER BY co.createtime DESC limit " . ($pindex - 1) * $psize . ',' . $psize);
         $total = pdo_fetchcolumn("select count(id) from " . tablename('broke_commission') . " where mid =" . $profile['id'] . " and flag != 2");
         $pager = pagination1($total, $pindex, $psize);
     } else {
         $list = pdo_fetchall("select co.*, cu.realname from " . tablename('broke_commission') . " as co left join " . tablename('broke_customer') . " as cu on co.cid = cu.id and co.weid = cu.weid where co.mid =" . $profile['id'] . " and co.flag != 2 ORDER BY co.createtime DESC limit 10");
         $total = pdo_fetchcolumn("select count(id) from " . tablename('broke_commission') . " where mid =" . $profile['id'] . " and flag != 2");
     }
     include $this->template('hlcommission');
 }