Example #1
0
function cron_check($cronid = 0)
{
    global $_W;
    $cron = pdo_get('core_cron', array('cloudid' => $cronid));
    $_W['uniacid'] = $cron['uniacid'];
    if (empty($cron)) {
        return error(-1000, '任务不存在或已删除');
    }
    if (!$cron['status']) {
        return error(-1001, '任务已关闭');
    }
    if (!$cron['uniacid']) {
        return error(-1002, '任务uniacid错误');
    }
    if (empty($cron['module'])) {
        return error(-1003, '任务所属模块为空');
    } else {
        if ($cron['module'] != 'task') {
            $modules = array_keys(uni_modules());
            if (!in_array($cron['module'], $modules)) {
                return error(-1004, "公众号没有操作模块{$cron['module']}的权限");
            }
        }
    }
    if (empty($cron['filename'])) {
        return error(-1005, '任务脚本名称为空');
    }
    return $cron;
}
Example #2
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC, $frames;
     require_once MB_ROOT . '/source/backlist.class.php';
     $backlist = new backlist();
     $frames = $backlist->getModuleFrames('feng_fightgroups');
     $backlist->_calc_current_frames2($frames);
     load()->func('tpl');
     load()->model('account');
     $modules = uni_modules();
     if (checksubmit()) {
         load()->func('file');
         $r = mkdirs(MB_ROOT . '/cert/' . $_W['uniacid']);
         if (!empty($_GPC['cert'])) {
             $ret = file_put_contents(MB_ROOT . '/cert/' . $_W['uniacid'] . '/apiclient_cert.pem', trim($_GPC['cert']));
             $r = $r && $ret;
         }
         if (!empty($_GPC['key'])) {
             $ret = file_put_contents(MB_ROOT . '/cert/' . $_W['uniacid'] . '/apiclient_key.pem', trim($_GPC['key']));
             $r = $r && $ret;
         }
         if (!$r) {
             message('证书保存失败, 请保证 /addons/feng_fightgroups/cert/ 目录可写');
         }
         $dat = array('userrefund' => $_GPC['userrefund'], 'gettime' => $_GPC['gettime'], 'goodstip' => $_GPC['goodstip'], 'openfirstpay' => $_GPC['openfirstpay'], 'firstpay' => $_GPC['firstpay'], 'refundpercent' => $_GPC['refundpercent'], 'status' => $_GPC['status'], 'sharestatus' => $_GPC['sharestatus'], 'mode' => $_GPC['mode'], 'picmode' => $_GPC['picmode'], 'mchid' => $_GPC['mchid'], 'apikey' => $_GPC['apikey'], 'share_title' => $_GPC['share_title'], 'share_image' => $_GPC['share_image'], 'share_desc' => $_GPC['share_desc'], 'share_imagestatus' => $_GPC['share_imagestatus'], 'pay_suc' => $_GPC['pay_suc'], 'm_pay' => $_GPC['m_pay'], 'm_tuan' => $_GPC['m_tuan'], 'm_cancle' => $_GPC['m_cancle'], 'm_ref' => $_GPC['m_ref'], 'm_send' => $_GPC['m_send'], 'pay_remark' => $_GPC['pay_remark'], 'tuan_remark' => $_GPC['tuan_remark'], 'tuan_suc' => $_GPC['tuan_suc'], 'cancle_remark' => $_GPC['cancle_remark'], 'cancle' => $_GPC['cancle'], 'send_remark' => $_GPC['send_remark'], 'send' => $_GPC['send'], 'ref_remark' => $_GPC['ref_remark'], 'ref' => $_GPC['ref'], 'sname' => $_GPC['sname'], 'slogo' => $_GPC['slogo'], 'marketprice1' => $_GPC['marketprice1'], 'marketprice2' => $_GPC['marketprice2'], 'marketprice3' => $_GPC['marketprice3'], 'marketprice4' => $_GPC['marketprice4'], 'productprice1' => $_GPC['productprice1'], 'productprice2' => $_GPC['productprice2'], 'productprice3' => $_GPC['productprice3'], 'productprice4' => $_GPC['productprice4'], 'copyright' => $_GPC['copyright'], 'content' => htmlspecialchars_decode($_GPC['content']));
         if ($this->saveSettings($dat)) {
             message('保存成功', 'refresh');
         }
     }
     //这里来展示设置项表单
     include $this->template('web/setting');
 }
Example #3
0
function buildframes($types = array('platform'), $modulename = '')
{
    global $_W;
    $ms = (include IA_ROOT . '/web/common/frames.inc.php');
    $ms = array_elements($types, $ms);
    if (in_array('ext', $types)) {
        load()->model('module');
        $frames = array();
        $modules = uni_modules();
        if (!empty($modules)) {
            foreach ($modules as $m) {
                if (in_array($m['name'], array('basic', 'news', 'music', 'userapi'))) {
                    continue;
                }
                $frames[$m['type']][] = $m;
            }
        }
        $types = module_types();
        if (!empty($frames)) {
            foreach ($frames as $type => $fs) {
                $items = array();
                if (!empty($fs)) {
                    foreach ($fs as $m) {
                        $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
                    }
                }
                $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
            }
        }
    }
    if (in_array('solution', $types)) {
        load()->model('module');
        $module = module_fetch($modulename);
        $entries = module_entries($modulename, array('menu'));
        if ($_W['role'] == 'operator') {
            foreach ($entries as &$entry1) {
                foreach ($entry1 as $index2 => &$entry2) {
                    $url_arr = parse_url($entry2['url']);
                    $url_query = $url_arr['query'];
                    parse_str($url_query, $query_arr);
                    $eid = intval($query_arr['eid']);
                    $data = pdo_fetch('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
                    $ixes = pdo_fetchcolumn('SELECT id FROM ' . tablename('solution_acl') . ' WHERE uid = :uid AND module = :module AND do = :do AND state = :state', array('uid' => $_W['uid'], ':module' => $modulename, ':do' => $data['do'], 'state' => $data['state']));
                    if (empty($ixes)) {
                        unset($entry1[$index2]);
                    }
                }
            }
        }
        if ($entries['menu']) {
            $menus = array('title' => $module['title']);
            foreach ($entries['menu'] as $menu) {
                $menus['items'][] = array('title' => $menu['title'], 'url' => $menu['url']);
            }
            $ms['solution'][] = $menus;
        }
    }
    return $ms;
}
Example #4
0
 public function fieldsFormDisplay($rid = 0)
 {
     global $_W;
     load()->func('tpl');
     $creditnames = array();
     $unisettings = uni_setting($uniacid, array('creditnames'));
     foreach ($unisettings['creditnames'] as $key => $credit) {
         if (!empty($credit['enabled'])) {
             $creditnames[$key] = $credit['title'];
         }
     }
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_redenvelope_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         $share = pdo_fetchall("SELECT * FROM " . tablename('stonefish_redenvelope_share') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         $prize = pdo_fetchall("SELECT * FROM " . tablename('stonefish_redenvelope_prize') . " WHERE rid = :rid ORDER BY `id` asc", array(':rid' => $rid));
         //查询奖品是否可以删除
         foreach ($prize as $mid => $prizes) {
             $prize[$mid]['fans'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('stonefish_redenvelope_award') . " WHERE prizetype = :prizeid", array(':prizeid' => $prizes['id']));
             $prize[$mid]['delete_url'] = $this->createWebUrl('deleteprize', array('rid' => $rid, 'id' => $prizes['id']));
         }
         //查询奖品是否可以删除
     }
     if (!$reply) {
         $now = time();
         $reply = array("title" => "幸运抢红包活动开始了!", "start_picurl" => "../addons/stonefish_redenvelope/template/images/activity-lottery-start.jpg", "description" => "欢迎参加幸运抢红包活动", "repeat_lottery_reply" => "亲,继续努力哦~~", "ticket_information" => "兑奖请联系我们,电话: 13888888888", "starttime" => $now, "endtime" => strtotime(date("Y-m-d H:i", $now + 7 * 24 * 3600)), "end_theme" => "幸运抢红包活动已经结束了", "end_instruction" => "亲,活动已经结束,请继续关注我们的后续活动哦~", "end_picurl" => "../addons/stonefish_redenvelope/template/images/activity-lottery-end.jpg", "cardbg" => "../addons/stonefish_redenvelope/template/images/card_back.png", "homepic" => "../addons/stonefish_redenvelope/template/images/home.jpg", "adpic" => "../addons/stonefish_redenvelope/template/images/banner_bg.png", "award_times" => 1, "credit_times" => 5, "show_num" => 2, "awardnum" => 50, "xuninum" => 500, "xuninumtime" => 86400, "xuninuminitial" => 10, "xuninumending" => 100, "ticketinfo" => "请输入详细资料,兑换奖品", "isrealname" => 1, "ismobile" => 1, "isfans" => 1, "isfansname" => "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位", "homepictime" => 0, "bgcolor" => '#fff9cd', "fontcolor" => '#FFFFFF', "btncolor" => '#ed3c19', "btnfontcolor" => '#FFFFFF', "txcolor" => '#ffe65b', "txfontcolor" => '#73330d', "rulebgcolor" => '#FCF2A8');
     } else {
         $reply['notawardtext'] = implode("\n", (array) iunserializer($reply['notawardtext']));
     }
     //print_r(uni_modules($enabledOnly = true));
     //exit;
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     //查询子公众号信息
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     $ids_num = count($ids);
     //多少个子公众账号
     $one = current($ids);
     //查询子公众号信息
     if (!$share) {
         $share = array();
         foreach ($ids as $acid => $idlists) {
             $share[$acid] = array("acid" => $acid, "share_url" => $acid_arr[$acid]['subscribeurl'], "share_title" => "已有#参与人数#人参与本活动了,你的朋友#参与人# 还中了大奖:#奖品#,请您也来试试吧!", "share_desc" => "亲,欢迎参加抢红包刮奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦", "share_picurl" => "../addons/stonefish_redenvelope/template/images/share.png", "share_pic" => "../addons/stonefish_redenvelope/template/images/img_share.png", "sharenumtype" => 0, "sharenum" => 0, "sharetype" => 1);
         }
     }
     include $this->template('form');
 }
Example #5
0
 public function fieldsFormDisplay($rid = 0)
 {
     global $_W;
     load()->func('tpl');
     $creditnames = array();
     $unisettings = uni_setting($uniacid, array('creditnames'));
     foreach ($unisettings['creditnames'] as $key => $credit) {
         if (!empty($credit['enabled'])) {
             $creditnames[$key] = $credit['title'];
         }
     }
     if (!empty($rid)) {
         $reply = pdo_fetch("select * from " . tablename('stonefish_bigwheel_reply') . " where rid = :rid order by `id` desc", array(':rid' => $rid));
         $share = pdo_fetchall("select * from " . tablename('stonefish_bigwheel_share') . " where rid = :rid order by `id` desc", array(':rid' => $rid));
         $prize = pdo_fetchall("select * from " . tablename('stonefish_bigwheel_prize') . " where rid = :rid order by `id` asc", array(':rid' => $rid));
     }
     if (!$reply) {
         $now = time();
         $reply = array("title" => "幸运大转盘活动开始了!", "start_picurl" => "../addons/stonefish_bigwheel/template/images/activity-lottery-start.jpg", "description" => "欢迎参加幸运大转盘活动", "repeat_lottery_reply" => "亲,继续努力哦~~", "ticket_information" => "兑奖请联系我们,电话: 13888888888", "starttime" => $now, "endtime" => strtotime(date("Y-m-d H:i", $now + 7 * 24 * 3600)), "end_theme" => "幸运大转盘活动已经结束了", "end_instruction" => "亲,活动已经结束,请继续关注我们的后续活动哦~", "end_picurl" => "../addons/stonefish_bigwheel/template/images/activity-lottery-end.jpg", "most_num_times" => 0, "number_times" => 0, "probability" => 0, "turntable" => 1, "turntablenum" => 6, "award_times" => 1, "credit_times" => 5, "credit1" => 0, "credit2" => 0, "sn_code" => 1, "sn_rename" => "SN码", "show_num" => 2, "awardnum" => 50, "xuninum" => 500, "xuninumtime" => 86400, "xuninuminitial" => 10, "xuninumending" => 100, "ticketinfo" => "请输入详细资料,兑换奖品", "isrealname" => 1, "ismobile" => 1, "isfans" => 1, "isfansname" => "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位", "bigwheelpic" => "../addons/stonefish_bigwheel/template/images/activity-lottery-6.png", "bigwheelimg" => "../addons/stonefish_bigwheel/template/images/activity-inner.png", "bigwheelimgan" => "../addons/stonefish_bigwheel/template/images/activity.png", "bigwheelimgbg" => "../addons/stonefish_bigwheel/template/images/activity_bg.png", "prizeDeg" => '1, 60, 120, 180, 240, 300', "lostDeg" => '30, 90, 150, 210, 270, 330', "homepictime" => 0);
     }
     if (!$prize) {
         $prize = array("0" => array("credit_type" => 'physical', "prizetype" => '一等奖'), "1" => array("credit_type" => 'physical', "prizetype" => '二等奖'), "2" => array("credit_type" => 'physical', "prizetype" => '三等奖'), "3" => array("credit_type" => 'physical', "prizetype" => '四等奖'), "4" => array("credit_type" => 'physical', "prizetype" => '五等奖'), "5" => array("credit_type" => 'physical', "prizetype" => '六等奖'), "6" => array("credit_type" => 'physical', "prizetype" => '七等奖'), "7" => array("credit_type" => 'physical', "prizetype" => '八等奖'), "8" => array("credit_type" => 'physical', "prizetype" => '九等奖'), "9" => array("credit_type" => 'physical', "prizetype" => '十等奖'), "10" => array("credit_type" => 'physical', "prizetype" => '参与奖'), "11" => array("credit_type" => 'physical', "prizetype" => '幸运奖'));
     }
     $jiangxiang = array('0' => array("turntablenum" => '3', "prizeDeg" => '1,120,240', "lostDeg" => '60,180,300', "prizeid" => "\$('#prizeid3').hide();\$('#prizeid4').hide();\$('#prizeid5').hide();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '1' => array("turntablenum" => '4', "prizeDeg" => '1,90,180,270', "lostDeg" => '45,135,225,315', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').hide();\$('#prizeid5').hide();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '2' => array("turntablenum" => '5', "prizeDeg" => '1,72,144,216,288', "lostDeg" => '36,108,180,252,324', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').hide();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '3' => array("turntablenum" => '6', "prizeDeg" => '1,60,120,180,240,300', "lostDeg" => '30, 90, 150, 210, 270, 330', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '4' => array("turntablenum" => '8', "prizeDeg" => '1,45,90,135,180,225,270,315', "lostDeg" => '22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').show();\$('#prizeid7').show();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '5' => array("turntablenum" => '10', "prizeDeg" => '1,36,72,108,144,180,216,252,288,324', "lostDeg" => '', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').show();\$('#prizeid7').show();\$('#prizeid8').show();\$('#prizeid9').show();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '6' => array("turntablenum" => '12', "prizeDeg" => '1,30,60,90,120,150,180,210,240,270,300,330', "lostDeg" => '', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').show();\$('#prizeid7').show();\$('#prizeid8').show();\$('#prizeid9').show();\$('#prizeid10').show();\$('#prizeid11').show();"));
     //print_r(uni_modules($enabledOnly = true));
     //exit;
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     //查询子公众号信息
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     $ids_num = count($ids);
     //多少个子公众账号
     $one = current($ids);
     //查询子公众号信息
     if (!$share) {
         $share = array();
         foreach ($ids as $acid => $idlists) {
             $share[$acid] = array("acid" => $acid, "share_url" => $acid_arr[$acid]['subscribeurl'], "share_title" => "已有#参与人数#人参与本活动了,你的朋友#参与人# 还中了大奖:#奖品#,请您也来试试吧!", "share_desc" => "亲,欢迎参加大转盘抽奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦", "share_picurl" => "../addons/stonefish_bigwheel/template/images/share.png", "share_pic" => "../addons/stonefish_bigwheel/template/images/img_share.png", "sharenumtype" => 0, "sharenum" => 0, "sharetype" => 1);
         }
     }
     include $this->template('form');
 }
Example #6
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('tpl');
     load()->model('account');
     $modules = uni_modules();
     if (checksubmit()) {
         $dat = array('share_title' => $_GPC['share_title'], 'share_image' => $_GPC['share_image'], 'share_desc' => $_GPC['share_desc'], 'url' => $_GPC['url'], 'mobile' => $_GPC['mobile'], 'copyright' => $_GPC['copyright']);
         if ($this->saveSettings($dat)) {
             message('保存成功', 'refresh');
         }
     }
     //这里来展示设置项表单
     include $this->template('setting');
 }
Example #7
0
 public function doWebEventlist()
 {
     global $_GPC, $_W;
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     $weid = $_W['uniacid'];
     //当前公众号ID
     $pindex = max(1, intval($_GPC['page']));
     $psize = 15;
     $params = array();
     $params[':weid'] = $weid;
     if (!empty($_GPC['keyword'])) {
         $sql .= ' and `title` LIKE :keyword';
         $params[':keyword'] = "%{$_GPC['keyword']}%";
     }
     $list_praise = pdo_fetchall('SELECT * FROM ' . tablename($this->table_reply) . ' WHERE weid= :weid ' . $sql . ' order by `id` desc LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, $params);
     $pager = pagination($total, $pindex, $psize);
     if (!empty($list_praise)) {
         foreach ($list_praise as $mid => $list) {
             $count = pdo_fetch("SELECT count(id) as dd FROM " . tablename($this->table_list) . " WHERE rid= " . $list['rid'] . "");
             $list_praise[$mid]['user_znum'] = $count['dd'];
             //参与人数
             $count = pdo_fetch("SELECT count(id) as dd FROM " . tablename($this->table_data) . " WHERE rid= " . $list['rid'] . "");
             $list_praise[$mid]['share_znum'] = $count['dd'];
             //分享人数
             $listpraise = pdo_fetchall('SELECT * FROM ' . tablename($this->table_gift) . ' WHERE rid=:rid  order by `id`', array(':rid' => $list['rid']));
             if (!empty($listpraise)) {
                 $praiseinfo = '';
                 foreach ($listpraise as $row) {
                     $count = pdo_fetch("SELECT count(id) as dd FROM " . tablename($this->table_list) . " WHERE zhongjiang>=1 and liheid=" . $row['id'] . " and rid= " . $row['rid'] . "");
                     $praiseinfo = $praiseinfo . '奖品:' . $row['title'] . ';总数为:' . $row['total'] . ';中奖率:' . $row['probalilty'] . '%;中奖数为:' . $count['dd'] . ';还剩:<b>' . ($row['total'] - $count['dd']) . '</b>个奖品<br/>';
                 }
             }
             $praiseinfo = substr($praiseinfo, 0, strlen($praiseinfo) - 5);
             $list_praise[$mid]['praiseinfo'] = $praiseinfo;
             //奖品情况
             $nowtime = time();
             if ($list['start_time'] > $nowtime) {
                 $list_praise[$mid]['isshow'] = '<span class="label label-warning">未开始</span>';
             } elseif ($list['end_time'] < $nowtime) {
                 $list_praise[$mid]['isshow'] = '<span class="label label-default ">已结束</span>';
             } else {
                 if ($list['status'] == 1) {
                     $list_praise[$mid]['isshow'] = '<span class="label label-success">已开始</span>';
                 } else {
                     $list_praise[$mid]['isshow'] = '<span class="label label-default ">已暂停</span>';
                 }
             }
         }
     }
     include $this->template('event');
 }
Example #8
0
/**
 * [Weizan System] Copyright (c) 2014 wdlcms.com
 * Weizan is NOT a free software, it under the license terms, visited http://www.wdlcms.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'post', 'del', 'default', 'copy', 'quickmenu');
$do = in_array($do, $dos) ? $do : 'display';
$setting = uni_setting($_W['uniacid'], 'default_site');
$default_site = intval($setting['default_site']);
if ($do == 'quickmenu') {
    $id = intval($_GPC['mtid']);
    $multi = pdo_fetch('SELECT id,quickmenu FROM ' . tablename('site_multi') . ' WHERE uniacid = :uniacid AND id = :id', array(':uniacid' => $_W['uniacid'], ':id' => $id));
    if (empty($multi)) {
        message('微站不存在或已删除', referer(), 'error');
    }
    $modules = uni_modules();
    $quickmenu = iunserializer($multi['quickmenu']);
    if (!is_array($quickmenu)) {
        $quickmenu = array();
    }
    if (checksubmit('submit')) {
        $module = array();
        if (!empty($_GPC['module'])) {
            foreach ($_GPC['module'] as $row) {
                if (isset($modules[$row])) {
                    $module[] = $row;
                }
            }
        }
        $params = $insert = array(':position' => '3');
        $sql = 'DELETE FROM ' . tablename('site_nav') . " WHERE `multiid` = :multiid AND `position` = :position AND `module` <> :module";
Example #9
0
function buildframes($frame = array('platform'))
{
    global $_W, $_GPC;
    if ($_W['role'] == 'clerk') {
        return false;
    }
    $GLOBALS['top_nav'] = pdo_fetchall('SELECT name, title, append_title FROM ' . tablename('core_menu') . ' WHERE pid = 0 AND is_display = 1 ORDER BY displayorder DESC');
    $ms = cache_load('system_frame');
    if (empty($ms)) {
        cache_build_frame_menu();
        $ms = cache_load('system_frame');
    }
    load()->model('module');
    $frames = array();
    $modules = uni_modules(false);
    $modules_temp = array_keys($modules);
    $status = uni_user_permission_exist();
    if (is_error($status)) {
        $modules_temp = pdo_fetchall('SELECT type FROM ' . tablename('users_permission') . ' WHERE uniacid = :uniacid AND uid = :uid AND type != :type', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['uid'], ':type' => 'system'), 'type');
        if (!empty($modules_temp)) {
            $modules_temp = array_keys($modules_temp);
        } else {
            $modules = array();
        }
    }
    if (!empty($modules)) {
        $sysmods = system_modules();
        foreach ($modules as $m) {
            if (in_array($m['name'], $sysmods)) {
                $_W['setting']['permurls']['modules'][] = $m['name'];
                continue;
            }
            if (in_array($m['name'], $modules_temp)) {
                if ($m['enabled']) {
                    $frames[$m['type']][] = $m;
                }
                $_W['setting']['permurls']['modules'][] = $m['name'];
            }
        }
    }
    if (is_error($status)) {
        $system = array();
        $system = uni_user_permission('system');
        if (!empty($system) || !empty($modules_temp)) {
            foreach ($ms as $name => $section) {
                $hassection = false;
                foreach ($section as $i => $menus) {
                    $hasitems = false;
                    if (empty($menus['items'])) {
                        continue;
                    }
                    foreach ($menus['items'] as $j => $menu) {
                        if (!in_array($menu['permission_name'], $system)) {
                            unset($ms[$name][$i]['items'][$j]);
                        } else {
                            $hasitems = true;
                            $hassection = true;
                        }
                    }
                    if (!$hasitems) {
                        unset($ms[$name][$i]);
                    }
                }
                if (!$hassection) {
                    unset($ms[$name]);
                } else {
                    $_W['setting']['permurls']['sections'][] = $name;
                }
            }
        }
    }
    $types = module_types();
    if (!empty($frames)) {
        foreach ($frames as $type => $fs) {
            $items = array();
            if (!empty($fs)) {
                foreach ($fs as $m) {
                    $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
                }
            }
            $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
        }
        if (is_error($status)) {
            $_W['setting']['permurls']['sections'][] = 'ext';
        }
    }
    $GLOBALS['ext_type'] = 0;
    $m = trim($_GPC['m']);
    $eid = intval($_GPC['eid']);
    if (FRAME == 'ext' && (!empty($m) || !empty($eid)) && $GLOBALS['ext_type'] != 2) {
        if (empty($_COOKIE['ext_type'])) {
            setcookie('ext_type', 1, TIMESTAMP + 8640000, "/");
            $_COOKIE['ext_type'] = 1;
        }
        $GLOBALS['ext_type'] = $_COOKIE['ext_type'];
        if (empty($m)) {
            $m = pdo_fetchcolumn('SELECT module FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
        }
        $module = module_fetch($m);
        $entries = module_entries($m);
        if (is_error($status)) {
            $permission = uni_user_permission($m);
            if ($permission[0] != 'all') {
                if (!in_array($m . '_rule', $permission)) {
                    unset($module['isrulefields']);
                }
                if (!in_array($m . '_settings', $permission)) {
                    unset($module['settings']);
                }
                if (!in_array($m . '_home', $permission)) {
                    unset($entries['home']);
                }
                if (!in_array($m . '_profile', $permission)) {
                    unset($entries['profile']);
                }
                if (!in_array($m . '_shortcut', $permission)) {
                    unset($entries['shortcut']);
                }
                if (!empty($entries['cover'])) {
                    foreach ($entries['cover'] as $k => $row) {
                        if (!in_array($m . '_cover_' . $row['do'], $permission)) {
                            unset($entries['cover'][$k]);
                        }
                    }
                }
                if (!empty($entries['menu'])) {
                    foreach ($entries['menu'] as $k => $row) {
                        if (!in_array($m . '_menu_' . $row['do'], $permission)) {
                            unset($entries['menu'][$k]);
                        }
                    }
                }
            }
        }
        $entries_filter = array_elements(array('cover', 'menu', 'mine'), $entries);
        $navs = array(array('title' => "模块列表", 'items' => array(array('title' => "<i class='fa fa-reply-all'></i> &nbsp;&nbsp;返回模块列表", 'url' => url('home/welcome/ext', array('a' => 0))), array('title' => "<i class='fa fa-reply-all'></i> &nbsp;&nbsp;返回{$module['title']}", 'url' => url('home/welcome/ext', array('m' => $m, 't' => 1))))));
        if ($module['isrulefields'] || $module['settings']) {
            $navs['rule'] = array('title' => "回复规则");
            if ($module['isrulefields']) {
                $navs['rule']['items'][] = array('title' => "<i class='fa fa-comments'></i> &nbsp;&nbsp;回复规则列表", 'url' => url('platform/reply', array('m' => $m)));
            }
            if ($module['settings']) {
                $navs['rule']['items'][] = array('title' => "<i class='fa fa-cog'></i> &nbsp;&nbsp;参数设置", 'url' => url('profile/module/setting', array('m' => $m)));
            }
        }
        if ($entries['home'] || $entries['profile'] || $entries['shortcut']) {
            $navs['nav'] = array('title' => "导航菜单");
            if ($entries['home']) {
                $navs['nav']['items'][] = array('title' => "<i class='fa fa-home'></i> &nbsp;&nbsp;微站首页导航", 'url' => url('site/nav/home', array('m' => $m)));
            }
            if ($entries['profile']) {
                $navs['nav']['items'][] = array('title' => "<i class='fa fa-user'></i> &nbsp;&nbsp;个人中心导航", 'url' => url('site/nav/profile', array('m' => $m)));
            }
            if ($entries['shortcut']) {
                $navs['nav']['items'][] = array('title' => "<i class='fa fa-plane'></i> &nbsp;&nbsp;快捷菜单", 'url' => url('site/nav/shortcut', array('m' => $m)));
            }
        }
        $menus = array('menu' => "业务菜单", 'cover' => "封面入口", 'mine' => "自定义菜单");
        foreach ($entries_filter as $key => $row) {
            if (empty($row)) {
                continue;
            }
            if (!isset($navs[$key])) {
                $navs[$key] = array('title' => $menus[$key]);
            }
            foreach ($row as $li) {
                $navs[$key]['items'][] = array('title' => "<i class='{$li["icon"]}'></i> &nbsp;&nbsp;{$li['title']}", 'url' => $li['url']);
            }
        }
    }
    if ($GLOBALS['ext_type'] == 1) {
        $ms['ext'] = $navs;
    } elseif ($GLOBALS['ext_type'] == 3) {
        $ms['ext'] = array_merge($navs, $ms['ext']);
    }
    return $ms;
}
Example #10
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$moduels = uni_modules();
$params = @json_decode(base64_decode($_GPC['params']), true);
if (empty($params) || !array_key_exists($params['module'], $moduels)) {
    message('访问错误.');
}
$setting = uni_setting($_W['uniacid'], 'payment');
$dos = array();
if (!empty($setting['payment']['credit']['switch'])) {
    $dos[] = 'credit';
}
if (!empty($setting['payment']['alipay']['switch'])) {
    $dos[] = 'alipay';
}
if (!empty($setting['payment']['wechat']['switch'])) {
    $dos[] = 'wechat';
}
if (!empty($setting['payment']['delivery']['switch'])) {
    $dos[] = 'delivery';
}
if (!empty($setting['payment']['unionpay']['switch'])) {
    $dos[] = 'unionpay';
}
if (!empty($setting['payment']['baifubao']['switch'])) {
    $dos[] = 'baifubao';
Example #11
0
/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.qdaygroup.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'post', 'del');
$do = in_array($do, $dos) ? $do : 'display';
$creditnames = array();
$unisettings = uni_setting($uniacid, array('creditnames'));
foreach ($unisettings['creditnames'] as $key => $credit) {
    if (!empty($credit['enabled'])) {
        $creditnames[$key] = $credit['title'];
    }
}
$activities = array();
$_W['modules'] = uni_modules();
foreach ($_W['modules'] as $key => $value) {
    if ($value['type'] == 'activity') {
        $activities[$key] = $value;
    }
}
if ($do == 'post') {
    load()->func('tpl');
    $id = intval($_GPC['id']);
    if (!empty($id)) {
        $item = pdo_fetch('SELECT * FROM ' . tablename('activity_exchange') . ' WHERE id=:id AND uniacid=:uniacid', array(':id' => $id, ':uniacid' => $_W['uniacid']));
        if (empty($item)) {
            message('未找到指定兑换礼品或已删除.', url('activity/partimes'), 'error');
        } else {
            $item['extra'] = iunserializer($item['extra']);
        }
Example #12
0
 private function receive($par, $keyword, $response)
 {
     global $_W;
     $subscribe = cache_load('module_receive_enable');
     $modules = uni_modules();
     $obj = WeUtility::createModuleReceiver('core');
     $obj->message = $this->message;
     $obj->params = $par;
     $obj->response = $response;
     $obj->keyword = $keyword;
     $obj->module = 'core';
     $obj->uniacid = $_W['uniacid'];
     $obj->acid = $_W['acid'];
     if (method_exists($obj, 'receive')) {
         @$obj->receive();
     }
     if (!empty($subscribe['subscribe']) && ($this->message['event'] == 'subscribe' || $this->message['type'] == 'subscribe')) {
         foreach ($subscribe['subscribe'] as $modulename) {
             $obj = WeUtility::createModuleReceiver($modulename);
             $obj->message = $this->message;
             $obj->params = $par;
             $obj->response = $response;
             $obj->keyword = $keyword;
             $obj->module = $modules[$modulename];
             $obj->uniacid = $_W['uniacid'];
             $obj->acid = $_W['acid'];
             if (method_exists($obj, 'receive')) {
                 @$obj->receive();
             }
         }
     } elseif (!empty($subscribe['unsubscribe']) && ($this->message['event'] == 'unsubscribe' || $this->message['type'] == 'unsubscribe')) {
         foreach ($subscribe['unsubscribe'] as $modulename) {
             $obj = WeUtility::createModuleReceiver($modulename);
             $obj->message = $this->message;
             $obj->params = $par;
             $obj->response = $response;
             $obj->keyword = $keyword;
             $obj->module = $modules[$modulename];
             $obj->uniacid = $_W['uniacid'];
             $obj->acid = $_W['acid'];
             if (method_exists($obj, 'receive')) {
                 @$obj->receive();
             }
         }
     } else {
         $modules = $subscribe[$this->message['type']];
         if (!empty($modules)) {
             foreach ($modules as $modulename) {
                 $row = array();
                 $row['uniacid'] = $_W['uniacid'];
                 $row['acid'] = $_W['acid'];
                 $row['dateline'] = $_W['timestamp'];
                 $row['message'] = iserializer($this->message);
                 $row['keyword'] = iserializer($keyword);
                 $row['params'] = iserializer($par);
                 $row['response'] = iserializer($response);
                 $row['module'] = $modulename;
                 $row['type'] = 1;
                 pdo_insert('core_queue', $row);
             }
         }
         if (date('N') == '1') {
             pdo_query("DELETE FROM " . tablename('core_queue') . " WHERE dateline < '" . ($_W['timestamp'] - 2592000) . "'");
         }
     }
 }
Example #13
0
            }
            $data['id'] = $id;
            unset($data['cloudid']);
            pdo_update('core_cron', $data, array('id' => $id, 'uniacid' => $_W['uniacid']));
            message('编辑计划任务成功', url('cron/display/list'), 'success');
        } else {
            $status = cloud_cron_create($data);
            if (is_error($status)) {
                message($status['message'], '', 'error');
            }
            $data['cloudid'] = $status['cron_id'];
            pdo_insert('core_cron', $data);
            message('添加计划任务成功', url('cron/display/list'), 'success');
        }
    }
    $modules_temp = uni_modules();
    $modules['task'] = array('name' => 'task', 'title' => '系统任务');
    foreach ($modules_temp as $module) {
        if (!$module['issystem']) {
            $modules[$module['name']] = array('name' => $module['name'], 'title' => $module['title']);
        }
    }
}
if ($do == 'list') {
    $pindex = max(1, intval($_GPC['page']));
    $psize = 15;
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('core_cron') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid']));
    $crons = pdo_fetchall('SELECT * FROM ' . tablename('core_cron') . ' WHERE uniacid = :uniacid ORDER BY id DESC LIMIT ' . ($pindex - 1) * $psize . ", {$psize}", array(':uniacid' => $_W['uniacid']));
    $pager = pagination($total, $pindex, $psize);
    if (!empty($crons)) {
        foreach ($crons as &$cron) {
Example #14
0
						<li class="divider"></li>
						<?php 
}
?>
						<li><a href="<?php 
echo url('user/logout');
?>
"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
					</ul>
				</li>
			</ul>
      <div class="msgbox"></div>
  </header>

<?php 
$modules_shcuts = uni_modules();
$settings_shortcuts = uni_setting($_W['uniacid'], array('shortcuts'));
$shorts_shcuts = $settings_shortcuts['shortcuts'];
if (!is_array($shorts_shcuts)) {
    $shorts_shcuts = array();
}
$shortcut_scs_shcuts = array();
foreach ($shorts_shcuts as $shortcut_sc) {
    $module_sc = $modules_shcuts[$shortcut_sc['name']];
    if (!empty($module_sc)) {
        $shortcut_sc['title'] = $module_sc['title'];
        if (file_exists('../addons/' . $module_sc['name'] . '/icon.jpg')) {
            $shortcut_sc['image'] = '../addons/' . $module_sc['name'] . '/icon.jpg';
        } else {
            $shortcut_sc['image'] = '../web/resource/images/nopic-small.jpg';
        }
Example #15
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     //点击模块设置时将调用此方法呈现模块设置页面,$settings 为模块设置参数, 结构为数组。这个参数系统针对不同公众账号独立保存。
     //在此呈现页面中自行处理post请求并保存设置参数(通过使用$this->saveSettings()来实现)
     load()->func('communication');
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     $settings['weixinvisit'] = !isset($settings['weixinvisit']) ? "1" : $settings['weixinvisit'];
     $settings['stonefish_chailihe_num'] = !isset($settings['stonefish_chailihe_num']) ? "1" : $settings['stonefish_chailihe_num'];
     if (checksubmit()) {
         //字段验证, 并获得正确的数据$dat
         if ($_GPC['stonefish_chailihe_oauth'] == 2) {
             if (empty($_GPC['appid']) || empty($_GPC['secret'])) {
                 message('请填写借用AppId或借用AppSecret', referer(), 'error');
             }
         }
         if ($_GPC['stonefish_chailihe_jssdk'] == 2) {
             if (empty($_GPC['jssdk_appid']) || empty($_GPC['jssdk_secret'])) {
                 message('请填写借用JS分享AppId或借用JS分享AppSecret', referer(), 'error');
             }
         }
         $dat = array('appid' => $_GPC['appid'], 'secret' => $_GPC['secret'], 'jssdk_appid' => $_GPC['jssdk_appid'], 'jssdk_secret' => $_GPC['jssdk_secret'], 'weixinvisit' => $_GPC['weixinvisit'], 'stonefish_chailihe_num' => $_GPC['stonefish_chailihe_num'], 'stonefish_chailihe_oauth' => $_GPC['stonefish_chailihe_oauth'], 'stonefish_chailihe_jssdk' => $_GPC['stonefish_chailihe_jssdk']);
         $this->saveSettings($dat);
         message('配置参数更新成功!', referer(), 'success');
     }
     //这里来展示设置项表单
     include $this->template('settings');
 }
Example #16
0
 public function doWebAwarddui()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['rid']);
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     $reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_planting_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     //所有奖品类别
     $award = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_prize') . " WHERE rid = :rid and uniacid=:uniacid ORDER BY `id` asc", array(':rid' => $rid, ':uniacid' => $_W['uniacid']));
     foreach ($award as $k => $awards) {
         $award[$k]['num'] = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_planting_award') . " WHERE rid = :rid and uniacid=:uniacid and prizeid='" . $awards['id'] . "'", array(':rid' => $rid, ':uniacid' => $_W['uniacid']));
     }
     //所有奖品类别
     //导出标题
     if ($_GPC['tickettype'] == 1) {
         $statustitle = '后台兑奖' . $_GPC['award'] . '统计';
     }
     if ($_GPC['tickettype'] == 2) {
         $statustitle = '店员兑奖' . $_GPC['award'] . '统计';
     }
     if ($_GPC['tickettype'] == 3) {
         $statustitle = '商家网点兑奖' . $_GPC['award'] . '统计';
     }
     if ($_GPC['tickettype'] <= 0) {
         $statustitle = '全部' . $_GPC['award'] . '统计';
     }
     //导出标题
     if (empty($rid)) {
         message('抱歉,传递的参数错误!', '', 'error');
     }
     $where = '';
     $params = array(':rid' => $rid, ':uniacid' => $_W['uniacid']);
     if (isset($_GPC['tickettype'])) {
         $where .= ' and tickettype=:tickettype';
         $params[':tickettype'] = $_GPC['tickettype'];
     } else {
         $where .= ' and tickettype>=1';
     }
     if (!empty($_GPC['award'])) {
         $where .= ' and prizetype=:name';
         $params[':name'] = $_GPC['award'];
     }
     if (!empty($_GPC['ticketname'])) {
         $where .= ' and ticketname=:ticketname';
         $params[':ticketname'] = $_GPC['ticketname'];
     }
     if (!empty($_GPC['keywords'])) {
         if (strlen($_GPC['keywords']) == 11 && is_numeric($_GPC['keywords'])) {
             $members = pdo_fetch("SELECT from_user FROM " . tablename('stonefish_planting_fans') . " WHERE mobile = :mobile and rid = :rid", array(':mobile' => $_GPC['keywords'], ':rid' => $rid));
             if (!empty($members)) {
                 $where .= " AND from_user=:from_user";
                 $params[':from_user'] = $members['from_user'];
             } else {
                 $where .= " AND from_user=''";
             }
         }
     }
     $total = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_planting_award') . "  WHERE rid = :rid and uniacid=:uniacid" . $where . "", $params);
     $pindex = max(1, intval($_GPC['page']));
     $psize = 12;
     $pager = pagination($total, $pindex, $psize);
     $start = ($pindex - 1) * $psize;
     $limit .= " LIMIT {$start},{$psize}";
     $list = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_award') . "  WHERE rid = :rid and uniacid=:uniacid  " . $where . " ORDER BY ticketid DESC " . $limit, $params);
     //中奖资料
     foreach ($list as &$lists) {
         $lists['realname'] = pdo_fetchcolumn("SELECT realname FROM " . tablename('stonefish_planting_fans') . " WHERE rid = :rid and uniacid=:uniacid and from_user = :from_user", array(':rid' => $rid, ':uniacid' => $_W['uniacid'], ':from_user' => $lists['from_user']));
         $lists['mobile'] = pdo_fetchcolumn("SELECT mobile FROM " . tablename('stonefish_planting_fans') . " WHERE rid = :rid and uniacid=:uniacid and from_user = :from_user", array(':rid' => $rid, ':uniacid' => $_W['uniacid'], ':from_user' => $lists['from_user']));
         $lists['fid'] = pdo_fetchcolumn("SELECT id FROM " . tablename('stonefish_planting_fans') . " WHERE rid = :rid and uniacid=:uniacid and from_user = :from_user", array(':rid' => $rid, ':uniacid' => $_W['uniacid'], ':from_user' => $lists['from_user']));
     }
     //中奖资料
     //一些参数的显示
     $num1 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_planting_award') . " WHERE rid = :rid and tickettype>=1", array(':rid' => $rid));
     $num2 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_planting_award') . " WHERE rid = :rid and tickettype=1", array(':rid' => $rid));
     $num3 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_planting_award') . " WHERE rid = :rid and tickettype=2", array(':rid' => $rid));
     $num4 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_planting_award') . " WHERE rid = :rid and tickettype=3", array(':rid' => $rid));
     //一些参数的显示
     include $this->template('awarddui');
 }
Example #17
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('communication');
     $config = "已授权";
     $lianxi = 'QQ800083075';
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     $settings['weixinvisit'] = !isset($settings['weixinvisit']) ? "1" : $settings['weixinvisit'];
     $settings['stonefish_bigwheel_num'] = !isset($settings['stonefish_bigwheel_num']) ? "1" : $settings['stonefish_bigwheel_num'];
     $settings['stonefish_oauth_time'] = !isset($settings['stonefish_oauth_time']) ? "7" : $settings['stonefish_oauth_time'];
     if (checksubmit()) {
         if ($_GPC['stonefish_bigwheel_oauth'] == 2) {
             if (empty($_GPC['appid']) || empty($_GPC['secret'])) {
                 message('请填写借用AppId或借用AppSecret', referer(), 'error');
             }
         }
         if ($_GPC['stonefish_bigwheel_jssdk'] == 2) {
             if (empty($_GPC['jssdk_appid']) || empty($_GPC['jssdk_secret'])) {
                 message('请填写借用JS分享AppId或借用JS分享AppSecret', referer(), 'error');
             }
         }
         $dat = array('appid' => $_GPC['appid'], 'secret' => $_GPC['secret'], 'jssdk_appid' => $_GPC['jssdk_appid'], 'jssdk_secret' => $_GPC['jssdk_secret'], 'weixinvisit' => $_GPC['weixinvisit'], 'stonefish_oauth_time' => $_GPC['stonefish_oauth_time'], 'stonefish_bigwheel_num' => $_GPC['stonefish_bigwheel_num'], 'stonefish_bigwheel_oauth' => $_GPC['stonefish_bigwheel_oauth'], 'stonefish_bigwheel_jssdk' => $_GPC['stonefish_bigwheel_jssdk']);
         $this->saveSettings($dat);
         message('配置参数更新成功!', referer(), 'success');
     }
     include $this->template('settings');
 }
Example #18
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     //点击模块设置时将调用此方法呈现模块设置页面,$settings 为模块设置参数, 结构为数组。这个参数系统针对不同公众账号独立保存。
     //在此呈现页面中自行处理post请求并保存设置参数(通过使用$this->saveSettings()来实现)
     load()->func('communication');
     $oauth2_code = base64_decode('aHR0cDovL3dlNy53d3c5LnRvbmdkYW5ldC5jb20vYXBwL2luZGV4LnBocD9pPTImaj03JmM9ZW50cnkmZG89YXV0aG9yaXplY2hlY2smbT1zdG9uZWZpc2hfYXV0aG9yaXplJm1vZHVsZXM9c3RvbmVmaXNoX3NjcmF0Y2gmd2VidXJsPQ==') . $_SERVER['HTTP_HOST'] . "&visitorsip=" . $_W['clientip'];
     $content = ihttp_get($oauth2_code);
     $token = @json_decode($content['content'], true);
     $config = $token['config'];
     $lianxi = $token['lianxi'];
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     if (checksubmit()) {
         //字段验证, 并获得正确的数据$dat
         $dat = array('stonefish_scratch_num' => $_GPC['stonefish_scratch_num']);
         $this->saveSettings($dat);
         message('配置参数更新成功!', referer(), 'success');
     }
     //这里来展示设置项表单
     include $this->template('settings');
 }
Example #19
0
 public function fieldsFormDisplay($rid = 0)
 {
     //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
     global $_W;
     load()->func('tpl');
     $weid = $_W['uniacid'];
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
         $awarding = pdo_fetchall("SELECT * FROM " . tablename('stonefish_branch_business') . " WHERE uniacid = :weid ORDER BY `id` DESC", array(':weid' => $weid));
     }
     //查询是否有商户网点权限
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         $award = pdo_fetchall("SELECT * FROM " . tablename($this->table_gift) . " WHERE rid = :rid ORDER BY `id` ASC", array(':rid' => $rid));
         if (!empty($award)) {
             foreach ($award as &$pointer) {
                 $pointer['activation_code_num'] = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename($this->table_giftmika) . '  WHERE rid=' . $rid . ' AND giftid = ' . $pointer['id'] . '');
             }
         }
     } else {
         $reply = array('periodlottery' => 1, 'maxlottery' => 1);
     }
     $reply['start_time'] = empty($reply['start_time']) ? strtotime(date('Y-m-d H:i')) : $reply['start_time'];
     $reply['end_time'] = empty($reply['end_time']) ? strtotime("+1 week") : $reply['end_time'];
     $reply['status'] = !isset($reply['status']) ? "1" : $reply['status'];
     $reply['miao'] = !isset($reply['miao']) ? "5" : $reply['miao'];
     $reply['randlihe'] = !isset($reply['randlihe']) ? "0" : $reply['randlihe'];
     $reply['xuninum'] = !isset($reply['xuninum']) ? "500" : $reply['xuninum'];
     $reply['xuninumtime'] = !isset($reply['xuninumtime']) ? "86400" : $reply['xuninumtime'];
     $reply['xuninuminitial'] = !isset($reply['xuninuminitial']) ? "10" : $reply['xuninuminitial'];
     $reply['xuninumending'] = !isset($reply['xuninumending']) ? "50" : $reply['xuninumending'];
     $reply['music'] = !isset($reply['music']) ? "1" : $reply['music'];
     $reply['musicbg'] = empty($reply['musicbg']) ? "../addons/stonefish_chailihe/template/images/bg.mp3" : $reply['musicbg'];
     $reply['subscribe'] = !isset($reply['subscribe']) ? "0" : $reply['subscribe'];
     $reply['opensubscribe'] = !isset($reply['opensubscribe']) ? "0" : $reply['opensubscribe'];
     $reply['opentype'] = !isset($reply['opentype']) ? "0" : $reply['opentype'];
     $reply['showlihe'] = !isset($reply['showlihe']) ? "0" : $reply['showlihe'];
     $reply['showline'] = !isset($reply['showline']) ? "1" : $reply['showline'];
     $reply['repeatzj'] = !isset($reply['repeatzj']) ? "1" : $reply['repeatzj'];
     $reply['helpchai'] = !isset($reply['helpchai']) ? "0" : $reply['helpchai'];
     $reply['chainum'] = !isset($reply['chainum']) ? "0" : $reply['chainum'];
     $reply['helpren'] = !isset($reply['helpren']) ? "0" : $reply['helpren'];
     $reply['awarding'] = !isset($reply['awarding']) ? "0" : $reply['awarding'];
     $reply['number_num'] = !isset($reply['number_num']) ? "1" : $reply['number_num'];
     $reply['number_num_day'] = !isset($reply['number_num_day']) ? "1" : $reply['number_num_day'];
     $reply['share_shownum'] = !isset($reply['share_shownum']) ? "50" : $reply['share_shownum'];
     $reply['helpnum'] = !isset($reply['helpnum']) ? "50" : $reply['helpnum'];
     $reply['picture'] = empty($reply['picture']) ? "../addons/stonefish_chailihe/template/images/big_ads.jpg" : $reply['picture'];
     $reply['bgcolor'] = empty($reply['bgcolor']) ? "#26216F" : $reply['bgcolor'];
     $reply['text01color'] = empty($reply['text01color']) ? "#FFFFFF" : $reply['text01color'];
     $reply['text02color'] = empty($reply['text02color']) ? "#5E43B6" : $reply['text02color'];
     $reply['text03color'] = empty($reply['text03color']) ? "#523d3d" : $reply['text03color'];
     $reply['text04color'] = empty($reply['text04color']) ? "#322C8E" : $reply['text04color'];
     $reply['text05color'] = empty($reply['text05color']) ? "#c1c1c1" : $reply['text05color'];
     $reply['picnojiang'] = empty($reply['picnojiang']) ? "../addons/stonefish_chailihe/template/images/nojiang.png" : $reply['picnojiang'];
     $reply['picbg01'] = empty($reply['picbg01']) ? "../addons/stonefish_chailihe/template/images/bg.jpg" : $reply['picbg01'];
     $reply['picbg02'] = empty($reply['picbg02']) ? "../addons/stonefish_chailihe/template/images/bg_common.jpg" : $reply['picbg02'];
     $reply['picbg03'] = empty($reply['picbg03']) ? "../addons/stonefish_chailihe/template/images/bg_myprize.jpg" : $reply['picbg03'];
     $reply['userinfo'] = empty($reply['userinfo']) ? "为了将幸运礼盒更快、更准确的送达您手中,请留下您的个人信息,谢谢!" : $reply['userinfo'];
     $reply['shangjialogo'] = empty($reply['shangjialogo']) ? "../addons/stonefish_chailihe/template/images/smalllogo.png" : $reply['shangjialogo'];
     $reply['isrealname'] = !isset($reply['isrealname']) ? "1" : $reply['isrealname'];
     $reply['isinfo'] = !isset($reply['isinfo']) ? "0" : $reply['isinfo'];
     $reply['ismobile'] = !isset($reply['ismobile']) ? "1" : $reply['ismobile'];
     $reply['isfans'] = !isset($reply['isfans']) ? "1" : $reply['isfans'];
     $reply['copyrighturl'] = empty($reply['copyrighturl']) ? "http://" . $_SERVER['HTTP_HOST'] : $reply['copyrighturl'];
     $reply['iscopyright'] = !isset($reply['iscopyright']) ? "0" : $reply['iscopyright'];
     $reply['copyright'] = empty($reply['copyright']) ? $_W['account']['name'] : $reply['copyright'];
     $reply['isfansname'] = empty($reply['isfansname']) ? "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位" : $reply['isfansname'];
     include $this->template('form');
 }
Example #20
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     //点击模块设置时将调用此方法呈现模块设置页面,$settings 为模块设置参数, 结构为数组。这个参数系统针对不同公众账号独立保存。
     //在此呈现页面中自行处理post请求并保存设置参数(通过使用$this->saveSettings()来实现)
     load()->func('communication');
     //$config = $token['config'];
     $lianxi = $token['lianxi'];
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     if (checksubmit()) {
         //字段验证, 并获得正确的数据$dat
         $dat = array('stonefish_scratch_num' => $_GPC['stonefish_scratch_num']);
         $this->saveSettings($dat);
         message('配置参数更新成功!', referer(), 'success');
     }
     //这里来展示设置项表单
     include $this->template('settings');
 }
Example #21
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'setting', 'shortcut', 'enable', 'form');
$do = !empty($_GPC['do']) ? $_GPC['do'] : 'display';
if ($do != 'setting') {
    uni_user_permission_check('profile_module');
}
$modulelist = uni_modules(false);
if (empty($modulelist)) {
    message('没有可用功能.');
}
if ($do == 'display') {
    $_W['page']['title'] = '模块列表 - 公众号选项';
    $setting = uni_setting($_W['uniacid'], array('shortcuts'));
    $shortcuts = $setting['shortcuts'];
    if (!empty($modulelist)) {
        foreach ($modulelist as $i => &$module) {
            if (!empty($_W['setting']['permurls']['modules']) && !in_array($module['name'], $_W['setting']['permurls']['modules'])) {
                unset($modulelist[$i]);
                continue;
            }
            $module['shortcut'] = !empty($shortcuts[$module['name']]);
            $module['official'] = empty($module['issystem']) && (strexists($module['author'], 'WeEngine Team') || strexists($module['author'], '微擎团队'));
            if ($module['issystem']) {
                $path = '../framework/builtin/' . $module['name'];
            } else {
Example #22
0
 public function doWebAwardlist()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['rid']);
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     $reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_redenvelope_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     //所有奖品类别
     $award = pdo_fetchall("SELECT * FROM " . tablename('stonefish_redenvelope_prize') . " WHERE rid = :rid and uniacid=:uniacid ORDER BY `id` asc", array(':rid' => $rid, ':uniacid' => $_W['uniacid']));
     foreach ($award as $k => $awards) {
         $award[$k]['num'] = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_redenvelope_award') . " WHERE rid = :rid and uniacid=:uniacid and prizetype='" . $awards['id'] . "'", array(':rid' => $rid, ':uniacid' => $_W['uniacid']));
     }
     //所有奖品类别
     //导出标题
     if ($_GPC['status'] == 0) {
         $statustitle = '被取消' . $_GPC['award'];
     }
     if ($_GPC['status'] == 1) {
         $statustitle = '未兑换' . $_GPC['award'];
     }
     if ($_GPC['status'] == 2) {
         $statustitle = '已兑换' . $_GPC['award'];
     }
     if ($_GPC['status'] == '') {
         $statustitle = '全部' . $_GPC['award'];
     }
     //导出标题
     if (empty($rid)) {
         message('抱歉,传递的参数错误!', '', 'error');
     }
     $where = '';
     $params = array(':rid' => $rid, ':uniacid' => $_W['uniacid']);
     if (isset($_GPC['status'])) {
         $where .= ' and a.status=:status';
         $params[':status'] = $_GPC['status'];
     }
     if (!empty($_GPC['award'])) {
         $where .= ' and a.name=:name';
         $params[':name'] = $_GPC['award'];
     }
     if (!empty($_GPC['keywords'])) {
         if (strlen($_GPC['keywords']) == 11 && is_numeric($_GPC['keywords'])) {
             $members = pdo_fetchall("SELECT uid FROM " . tablename('mc_members') . " WHERE mobile = :mobile", array(':mobile' => $_GPC['keywords']), 'uid');
             if (!empty($members)) {
                 $fans = pdo_fetchall("SELECT openid FROM " . tablename('mc_mapping_fans') . " WHERE uid in ('" . implode("','", array_keys($members)) . "')", array(), 'openid');
                 if (!empty($fans)) {
                     $where .= " AND a.from_user IN ('" . implode("','", array_keys($fans)) . "')";
                 }
             }
         } else {
             $where .= ' and (a.award_sn like :keywords)';
             $params[':keywords'] = "%{$_GPC['keywords']}%";
         }
     }
     $total = pdo_fetchcolumn("SELECT count(a.id) FROM " . tablename('stonefish_redenvelope_award') . " a WHERE a.rid = :rid and a.uniacid=:uniacid " . $where . "", $params);
     $pindex = max(1, intval($_GPC['page']));
     $psize = 12;
     $pager = pagination($total, $pindex, $psize);
     $start = ($pindex - 1) * $psize;
     $limit .= " LIMIT {$start},{$psize}";
     $list = pdo_fetchall("SELECT a.* FROM " . tablename('stonefish_redenvelope_award') . " a WHERE a.rid = :rid and a.uniacid=:uniacid  " . $where . " ORDER BY a.id DESC " . $limit, $params);
     //中奖资料
     foreach ($list as &$lists) {
         $lists['realname'] = pdo_fetchcolumn("SELECT realname FROM " . tablename('stonefish_redenvelope_fans') . " WHERE rid = :rid and uniacid=:uniacid and from_user = :from_user", array(':rid' => $rid, ':uniacid' => $_W['uniacid'], ':from_user' => $lists['from_user']));
         $lists['mobile'] = pdo_fetchcolumn("SELECT mobile FROM " . tablename('stonefish_redenvelope_fans') . " WHERE rid = :rid and uniacid=:uniacid and from_user = :from_user", array(':rid' => $rid, ':uniacid' => $_W['uniacid'], ':from_user' => $lists['from_user']));
         $lists['fid'] = pdo_fetchcolumn("SELECT id FROM " . tablename('stonefish_redenvelope_fans') . " WHERE rid = :rid and uniacid=:uniacid and from_user = :from_user", array(':rid' => $rid, ':uniacid' => $_W['uniacid'], ':from_user' => $lists['from_user']));
     }
     //中奖资料
     //一些参数的显示
     $num1 = pdo_fetchcolumn("SELECT total_num FROM " . tablename('stonefish_redenvelope_reply') . " WHERE rid = :rid", array(':rid' => $rid));
     $num2 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_redenvelope_award') . " WHERE rid = :rid and status=1", array(':rid' => $rid));
     $num3 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_redenvelope_award') . " WHERE rid = :rid and status=2", array(':rid' => $rid));
     $num4 = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('stonefish_redenvelope_award') . " WHERE rid = :rid and status=0", array(':rid' => $rid));
     //一些参数的显示
     include $this->template('awardlist');
 }
Example #23
0
 private function receive($par, $keyword, $response)
 {
     global $_W;
     if (in_array($this->message['event'], array('subscribe', 'unsubscribe')) || in_array($this->message['type'], array('subscribe', 'unsubscribe'))) {
         $modules = uni_modules();
         $core = array();
         $core['name'] = 'core';
         $core['subscribes'] = array('core');
         array_unshift($modules, $core);
         foreach ($modules as $m) {
             if (!empty($m['subscribes'])) {
                 if ($m['name'] == 'core' || in_array($this->message['type'], $m['subscribes']) || in_array($this->message['event'], $m['subscribes'])) {
                     $obj = WeUtility::createModuleReceiver($m['name']);
                     $obj->message = $this->message;
                     $obj->params = $par;
                     $obj->response = $response;
                     $obj->keyword = $keyword;
                     $obj->module = $m;
                     $obj->uniacid = $_W['uniacid'];
                     $obj->acid = $_W['acid'];
                     if (method_exists($obj, 'receive')) {
                         @$obj->receive();
                     }
                 }
             }
         }
     } else {
         $row = array();
         $row['uniacid'] = $_W['uniacid'];
         $row['acid'] = $_W['acid'];
         $row['dateline'] = $par['message']['time'];
         $row['message'] = iserializer($par['message']);
         $row['keyword'] = iserializer($keyword);
         unset($par['message']);
         unset($par['keyword']);
         $row['params'] = iserializer($par);
         $row['response'] = iserializer($response);
         $row['module'] = $par['module'];
         $row['type'] = 1;
         pdo_insert('core_queue', $row);
     }
 }
Example #24
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.qdaygroup.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'set', 'cancel', 'message', 'search_key');
$do = !empty($_GPC['do']) && in_array($do, $dos) ? $do : 'display';
load()->model('reply');
load()->model('account');
$_W['account']['modules'] = uni_modules();
if ($_W['isajax']) {
    if ($do == 'search_key') {
        $condition = '';
        $key_word = trim($_GPC['key_word']);
        if (!empty($key_word)) {
            $condition = " AND content LIKE '%{$key_word}%' ";
        }
        $data = pdo_fetchall('SELECT content FROM ' . tablename('rule_keyword') . " WHERE (uniacid = 0 OR uniacid = :uniacid) AND status != 0 " . $condition . ' ORDER BY uniacid DESC,displayorder DESC LIMIT 100', array(':uniacid' => $_W['uniacid']));
        $exit_da = array();
        if (!empty($data)) {
            foreach ($data as $da) {
                $exit_da[] = $da['content'];
            }
        }
        exit(json_encode($exit_da));
    }
    exit('error');
}
if ($do == 'display') {
Example #25
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('module');
$do = in_array($do, $dos) ? $do : 'module';
if ($do == 'module') {
    $module = uni_modules();
    $new = array();
    if (!empty($module)) {
        $filter = array('services', 'customer', 'activity');
        foreach ($module as $mou) {
            if (!in_array($mou['type'], $filter) && !$mou['issystem']) {
                $new[] = $mou;
            }
        }
    }
    unset($module);
    template('activity/module_model');
    die;
}
Example #26
0
 public function doMobileDetail()
 {
     global $_W, $_GPC;
     $modules = uni_modules();
     $info = pdo_fetch("SELECT l.title as goods_title,l.info,l.price,l.thumb,d.*,r.title as rule_title,r.rule FROM " . tablename('zerobuy_detail') . " d left join " . tablename('zerobuy_list') . " l on d.lid=l.id left join " . tablename('zerobuy_rule') . " r on d.rid=r.id WHERE d.id=" . $_GPC['id']);
     if ($info['status'] == 4) {
         $btn_info = '已开奖';
     } elseif ($info['status'] == 1) {
         $btn_info = '即将开始';
     } elseif ($info['status'] == 2) {
         $btn_info = '立即参与';
         //免费参加次数是否已经使用
         if ($modules['qmteam_zerobuy']['config']['dayjoin'] == 1) {
             $where = " WHERE uid='" . $_W['member']['uid'] . "' AND did=" . $info['id'] . " AND jointime>" . strtotime(date('Y-m-d'));
         } else {
             $where = " WHERE uid='" . $_W['member']['uid'] . "' AND did=" . $info['id'];
         }
         $free = pdo_fetch("SELECT * FROM " . tablename('zerobuy_code') . $where);
         if (!empty($free)) {
             $btn_info = '已参与';
         }
     } else {
         $btn_info = '等待开奖';
     }
     if ($info['status'] == 4) {
         $member_info = pdo_fetch("SELECT * FROM " . tablename('mc_members') . " WHERE uid=" . $info['winner_uid']);
     }
     include $this->template('detail');
 }
Example #27
0
function module_fetch($name)
{
    $modules = uni_modules();
    return $modules[$name];
}
Example #28
0
function uni_modules_app_binding()
{
    global $_W;
    $cachekey = "unimodulesappbinding:{$_W['uniacid']}";
    $cache = cache_load($cachekey);
    if (!empty($cache)) {
        return $cache;
    }
    load()->model('module');
    $result = array();
    $modules = uni_modules();
    if (!empty($modules)) {
        foreach ($modules as $module) {
            if ($module['type'] == 'system') {
                continue;
            }
            $entries = module_app_entries($module['name'], array('home', 'profile', 'shortcut', 'function', 'cover'));
            if (empty($entries)) {
                continue;
            }
            if ($module['type'] == '') {
                $module['type'] = 'other';
            }
            $result[$module['name']] = array('name' => $module['name'], 'type' => $module['type'], 'title' => $module['title'], 'entries' => array('cover' => $entries['cover'], 'home' => $entries['home'], 'profile' => $entries['profile'], 'shortcut' => $entries['shortcut'], 'function' => $entries['function']));
            unset($module);
        }
    }
    cache_write($cachekey, $result);
    return $result;
}
Example #29
0
function buildframes($types = array('platform'), $modulename = '')
{
    global $_W;
    $ms = (include IA_ROOT . '/web/common/frames.inc.php');
    load()->model('module');
    $frames = array();
    $modules = uni_modules();
    //print_r($module);die();
    if (!empty($modules)) {
        $sysmods = system_modules();
        foreach ($modules as $m) {
            if (in_array($m['name'], $sysmods)) {
                continue;
            }
            $frames[$m['type']][] = $m;
        }
    }
    $types = module_types();
    if (!empty($frames)) {
        foreach ($frames as $type => $fs) {
            $items = array();
            if (!empty($fs)) {
                foreach ($fs as $m) {
                    $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
                }
            }
            $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
        }
    }
    if (in_array('solution', $types)) {
        load()->model('module');
        $error = module_solution_check($modulename);
        if (is_error($error)) {
        } else {
            $module = module_fetch($modulename);
            $entries = module_entries($modulename, array('menu'));
            if ($_W['role'] == 'operator') {
                foreach ($entries as &$entry1) {
                    foreach ($entry1 as $index2 => &$entry2) {
                        $url_arr = parse_url($entry2['url']);
                        $url_query = $url_arr['query'];
                        parse_str($url_query, $query_arr);
                        $eid = intval($query_arr['eid']);
                        $data = pdo_fetch('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
                        $ixes = pdo_fetchcolumn('SELECT id FROM ' . tablename('solution_acl') . ' WHERE uid = :uid AND module = :module AND do = :do AND state = :state', array('uid' => $_W['uid'], ':module' => $modulename, ':do' => $data['do'], 'state' => $data['state']));
                        if (empty($ixes)) {
                            unset($entry1[$index2]);
                        }
                    }
                }
            }
            if ($entries['menu']) {
                $menus = array('title' => '业务功能菜单');
                foreach ($entries['menu'] as $menu) {
                    $menus['items'][] = array('title' => $menu['title'], 'url' => $menu['url']);
                }
                $ms['solution'][] = $menus;
            }
        }
    }
    if (empty($_W['isfounder'])) {
        $urls = array();
        $permurls = pdo_fetchall("SELECT url FROM " . tablename('users_permission') . " WHERE uid = :uid AND uniacid = :uniacid", array(':uid' => $_W['uid'], ':uniacid' => $_W['uniacid']));
        if (!empty($permurls)) {
            foreach ($permurls as $row) {
                $urls[] = $row['url'];
            }
        }
        if (!empty($urls)) {
            foreach ($ms as $name => $section) {
                $hassection = false;
                foreach ($section as $i => $menus) {
                    $hasitems = false;
                    foreach ($menus['items'] as $j => $menu) {
                        $_W['setting']['permurls']['menus'][] = ltrim($menu['url'], './index.php?');
                        if (!in_array(rtrim(ltrim($menu['url'], './index.php?'), '&'), $urls)) {
                            unset($ms[$name][$i]['items'][$j]);
                        } else {
                            $hasitems = true;
                            $hassection = true;
                        }
                    }
                    if (!$hasitems) {
                        unset($ms[$name][$i]);
                    }
                }
                if (!$hassection) {
                    unset($ms[$name]);
                } else {
                    $_W['setting']['permurls']['sections'][] = $name;
                }
            }
        }
    }
    $_W['setting']['permurls']['urls'] = $urls;
    return $ms;
}
Example #30
0
 public function doWebBranch()
 {
     global $_GPC, $_W;
     //查询是否有商户网点权限
     $modules = uni_modules($enabledOnly = true);
     $modules_arr = array();
     $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;'));
     if (in_array('stonefish_branch', $modules_arr)) {
         $stonefish_branch = true;
     }
     //查询是否有商户网点权限
     $rid = $_GPC['rid'];
     //选择商家
     $district = pdo_fetchall("select * FROM " . tablename('stonefish_branch_district') . " where uniacid = '{$_W['uniacid']}' ORDER BY orderid desc, id DESC", array(), 'id');
     $items = pdo_fetchall("select id,title,districtid FROM " . tablename('stonefish_branch_business') . " where uniacid = '{$_W['uniacid']}' ORDER BY id DESC", array(), 'id');
     if (!empty($items)) {
         $business = '';
         foreach ($items as $cid => $cate) {
             $business[$cate['districtid']][$cate['id']] = array($cate['id'], $cate['title']);
         }
     }
     //选择商家
     $params = array(':module' => 'stonefish_bigwheel', ':rid' => $rid, ':uniacid' => $_W['uniacid']);
     if (!empty($_GPC['mobile'])) {
         $where .= ' and mobile=:mobile';
         $params[':mobile'] = $_GPC['mobile'];
     }
     if (!empty($_GPC['districtid'])) {
         $where .= ' and districtid=:districtid';
         $params[':districtid'] = $_GPC['districtid'];
     } elseif (!empty($_GPC['pcate'])) {
         $districts = pdo_fetchall("select id FROM " . tablename('stonefish_branch_business') . "  where districtid=:districtid and  uniacid=:uniacid ORDER BY id DESC", array('districtid' => $_GPC['pcate'], 'uniacid' => $_W['uniacid']), 'districtid');
         $districtid = '';
         foreach ($districts as $districtss) {
             $districtid .= $districtss['id'] . ',';
         }
         $districtid = substr($districtid, 0, strlen($districtid) - 1);
         $where .= ' and districtid in(:districtid)';
         $params[':districtid'] = $districtid;
     }
     $total = pdo_fetchcolumn("select count(id) FROM " . tablename('stonefish_branch_doings') . "  where module=:module and rid = :rid and uniacid=:uniacid " . $where . "", $params);
     $pindex = max(1, intval($_GPC['page']));
     $psize = 12;
     $pager = pagination($total, $pindex, $psize);
     $start = ($pindex - 1) * $psize;
     $limit .= " LIMIT {$start},{$psize}";
     $list = pdo_fetchall("select * FROM " . tablename('stonefish_branch_doings') . " where module=:module and rid = :rid and uniacid=:uniacid " . $where . " ORDER BY id DESC " . $limit, $params);
     //查询商家
     foreach ($list as &$lists) {
         $lists['shangjia'] = pdo_fetchcolumn("select title FROM " . tablename('stonefish_branch_business') . "  where id = :id", array(':id' => $lists['districtid']));
     }
     //查询商家
     include $this->template('branch');
 }