예제 #1
0
 public function doWebSetting()
 {
     global $_W, $_GPC;
     checklogin();
     load()->func('tpl');
     $item = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid = :weid", array(':weid' => $_W['uniacid']));
     if (!empty($item)) {
         if (!empty($item['share_image'])) {
             $share_image = tomedia($item['share_image']);
         }
     }
     if (checksubmit('submit')) {
         $data = array('weid' => $_W['weid'], 'share_title' => trim($_GPC['share_title']), 'share_desc' => trim($_GPC['share_desc']), 'share_cancel' => trim($_GPC['share_cancel']), 'share_url' => trim($_GPC['share_url']), 'follow_url' => trim($_GPC['follow_url']));
         if (!empty($_GPC['share_image'])) {
             $data['share_image'] = $_GPC['share_image'];
             load()->func('file');
             file_delete($_GPC['share_image-old']);
         }
         if (!empty($item)) {
             pdo_update($this->modulename . '_setting', $data, array('weid' => $_W['uniacid']));
         } else {
             pdo_insert($this->modulename . '_setting', $data);
         }
         message('更新成功!', $this->createWebUrl('setting'), 'success');
     }
     include $this->template('setting');
 }
예제 #2
0
 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     if (checksubmit()) {
         $cfg = array('tablenum' => intval($_GPC['tablenum']), 'start_time' => $_GPC['start_time'], 'end_time' => $_GPC['end_time']);
         $start_time = $cfg['start_time'];
         $start_time = strtotime($start_time);
         $end_time = $cfg['end_time'];
         $end_time = strtotime($end_time);
         if ($start_time >= $end_time) {
             message('开始时间不得晚于结束时间', 'refresh', 'error');
         } elseif ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     if (!isset($settings['tablenum'])) {
         $settings['tablenum'] = '50';
     }
     if (!isset($settings['start_time'])) {
         $settings['start_time'] = '2014-02-14 17:21';
     }
     if (!isset($settings['end_time'])) {
         $settings['end_time'] = '2014-02-15 00:00';
     }
     include $this->template('setting');
 }
예제 #3
0
파일: web.php 프로젝트: noikiy/mygit
 public function index()
 {
     global $_W, $_GPC;
     $set = $this->getSet();
     if (checksubmit('submit')) {
         $set['user'] = is_array($_GPC['user']) ? $_GPC['user'] : array();
         $this->updateSet($set);
         if (!empty($set['user']['upload'])) {
             $ret = $this->check($set['user']);
             if (empty($ret)) {
                 message('配置有误,请仔细检查参数设置!', '', 'error');
             }
         }
         message('设置保存成功!', referer(), 'success');
     }
     if (checksubmit('submit_admin')) {
         $set['admin'] = is_array($_GPC['admin']) ? $_GPC['admin'] : array();
         $this->updateSet($set);
         if (!empty($set['admin']['upload'])) {
             $ret = $this->check($set['admin']);
             if (empty($ret)) {
                 message('配置有误,请仔细检查参数设置!', '', 'error');
             }
         }
         message('设置保存成功!', referer(), 'success');
     }
     include $this->template('set');
 }
예제 #4
0
 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['weid'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $_W['weid'], 'iurl' => $_GPC['iurl'], 'appid' => $_GPC['appid'], 'appkey' => $_GPC['appkey'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     include $this->template('routeradd');
 }
예제 #5
0
 public function doWebAwardlist()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (checksubmit('delete')) {
         pdo_delete('zzz_user', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     if (!empty($_GPC['wid'])) {
         $wid = intval($_GPC['wid']);
         pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid));
         message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 50;
     $where = '';
     $condition = array('mobile' => " AND `b`.`mobile` LIKE '%" . $_GPC['profilevalue'] . "%'", 'realname' => " AND `b`.`realname` LIKE '%" . $_GPC['profilevalue'] . "%'", 'nickname' => " AND `b`.`nickname` LIKE '%" . $_GPC['profilevalue'] . "%'");
     if (!empty($_GPC['profile'])) {
         $where .= $condition[$_GPC['profile']];
     }
     $sql = 'SELECT `a`.`id`, `a`.`friendcount`, `a`.`points`, `a`.`createtime`, `b`.`realname`, `b`.`nickname`, `b`.`mobile` FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` = `a`.`fanid` LEFT
             JOIN ' . tablename('mc_members') . " AS `b` ON `b`.`uid` = `f`.`uid`  WHERE `a`.`rid` = :rid {$where} ORDER BY `a`.`points`\n                DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize;
     $params = array(':rid' => $id);
     $list = pdo_fetchall($sql, $params);
     if (!empty($list)) {
         $sql = 'SELECT COUNT(*) FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` =
                 `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . ' AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid' . $where;
         $total = pdo_fetchcolumn($sql, $params);
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('awardlist');
 }
예제 #6
0
 public function doWebList()
 {
     global $_GPC, $_W;
     checklogin();
     $weid = $_W['account']['weid'];
     //当前公众号ID
     $id = intval($_GPC['id']);
     $condition = '';
     if (!empty($_GPC['name'])) {
         $condition .= " AND ( grabername LIKE '%{$_GPC['realname']}%' OR fitername LIKE '%{$_GPC['realname']}%' )";
     }
     if (!empty($_GPC['mobile'])) {
         $condition .= " AND ( grabermobile = '{$_GPC['mobile']}' OR fitermobile = '{$_GPC['mobile']}' )";
     }
     if (checksubmit('delete')) {
         pdo_delete('grabseat_record', " id IN ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page'])));
     }
     if (!empty($_GPC['wid'])) {
         $wid = intval($_GPC['wid']);
         pdo_update('grabseat_record', array('status' => intval($_GPC['status'])), array('id' => $wid));
         message('标识领奖成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 25;
     $list = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
     $listtotal = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ");
     $total = count($listtotal);
     $pager = pagination($total, $pindex, $psize);
     include $this->template('list');
 }
예제 #7
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('tpl');
     $config = $this->module['config'];
     if (empty($config['hlogo'])) {
         $config['hlogo'] = MODULE_URL . 'template/style/img/logo.png';
     }
     if (empty($config['flogo'])) {
         $config['flogo'] = MODULE_URL . 'template/style/img/un-logo.png';
     }
     if (empty($config['target'])) {
         $config['target'] = MODULE_URL . 'template/style/img/husky.png';
     }
     if (checksubmit()) {
         $dat = $_GPC['dat'];
         $dat['hlogo'] = $_GPC['hlogo'];
         $dat['flogo'] = $_GPC['flogo'];
         $dat['target'] = $_GPC['target'];
         $this->saveSettings($dat);
         message('设置成功..', referer(), 'success');
     }
     //这里来展示设置项表单
     include $this->template('setting');
 }
예제 #8
0
 public function dolist()
 {
     global $_GPC, $_W;
     checklogin();
     $weid = intval($_W['weid']);
     if (checksubmit('verify') && !empty($_GPC['select'])) {
         pdo_update('message_list', array('isshow' => 1, 'create_time' => TIMESTAMP), " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('审核成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
     }
     if (checksubmit('delete') && !empty($_GPC['select'])) {
         pdo_delete('message_list', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
     }
     $isshow = isset($_GPC['isshow']) ? intval($_GPC['isshow']) : 0;
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $message = pdo_fetch("SELECT id, isshow, weid FROM " . tablename('message_reply') . " WHERE weid = '{$weid}' LIMIT 1");
     $list = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}' ORDER BY create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}");
     if (!empty($list)) {
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}'");
         $pager = pagination($total, $pindex, $psize);
         foreach ($list as &$row) {
             $row['content'] = emotion($row['content']);
             $userids[] = $row['from_user'];
         }
         unset($row);
     }
     include $this->template('list');
 }
예제 #9
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doWebAdd()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->headtable) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,喜帖不存在或是已经删除!', '', 'error');
         }
         $hslists = unserialize($item['hs_pic']);
         if (is_array($hslists)) {
             //兼容0.5数据
             foreach ($hslists as &$h) {
                 if (is_array($h) && isset($h['attachment'])) {
                     $h = $h['attachment'];
                 }
             }
             unset($h);
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入喜帖标题!');
         }
         $data = array('weid' => $_W['uniacid'], 'title' => $_GPC['title'], 'xl_name' => $_GPC['xl_name'], 'xn_name' => $_GPC['xn_name'], 'is_front' => $_GPC['is_front'], 'tel' => $_GPC['tel'], 'hy_time' => $_GPC['hy_time'], 'hy_addr' => $_GPC['hy_addr'], 'jw_addr' => $_GPC['hy_addr'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'video' => $_GPC['video'], 'music' => $_GPC['music'], 'pwd' => $_GPC['pwd'], 'word' => htmlspecialchars_decode($_GPC['word']), 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['dist'], 'createtime' => TIMESTAMP, 'sendtitle' => $_GPC['sendtitle'], 'senddescription' => $_GPC['senddescription'], 'copyright' => htmlspecialchars_decode($_GPC['copyright']));
         load()->func('file');
         //上传图片
         if (!empty($_GPC['art_pic']) && $_GPC['art_pic'] != $_GPC['art_pic_old']) {
             file_delete($_GPC['art_pic_old']);
             $data['art_pic'] = $_GPC['art_pic'];
         }
         if (!empty($_GPC['bg_pic']) && $_GPC['bg_pic'] != $_GPC['bg_pic_old']) {
             file_delete($_GPC['bg_pic_old']);
             $data['bg_pic'] = $_GPC['bg_pic'];
         }
         if (!empty($_GPC['donghua_pic']) && $_GPC['donghua_pic'] != $_GPC['donghua_pic_old']) {
             file_delete($_GPC['donghua_pic_old']);
             $data['donghua_pic'] = $_GPC['donghua_pic'];
         }
         if (!empty($_GPC['suolue_pic']) && $_GPC['suolue_pic'] != $_GPC['suolue_pic_old']) {
             file_delete($_GPC['suolue_pic_old']);
             $data['suolue_pic'] = $_GPC['suolue_pic'];
         }
         if (!empty($_GPC['music']) && $_GPC['music'] != $_GPC['music_old']) {
             file_delete($_GPC['music_old']);
             $data['music'] = $_GPC['music'];
         }
         if (is_array($_GPC['thumbs'])) {
             $data['hs_pic'] = iserializer($_GPC['thumbs']);
         }
         if (empty($id)) {
             pdo_insert($this->headtable, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->headtable, $data, array('id' => $id));
         }
         message('喜帖信息更新成功!', $this->createWebUrl('manager'), 'success');
     }
     include $this->template('add');
 }
예제 #10
0
파일: module.php 프로젝트: aspnmy/weizan
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     if (checksubmit()) {
         $cfg = array('title' => $_GPC['title'], 's_botton' => $_GPC['s_botton'], 'pic' => $_GPC['pic'], 's_url' => $_GPC['s_url'], 'm_url' => $_GPC['m_url'], 'desc' => $_GPC['desc']);
         if ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     if (empty($settings['title'])) {
         $settings['title'] = '你有一通来自亲爱的的未接电话!';
     }
     if (empty($settings['s_url'])) {
         $settings['s_url'] = '';
     }
     if (empty($settings['m_url'])) {
         $settings['m_url'] = $_W['siteroot'] . 'addons/n1ce_love/template/mobile/images/aini.mp3';
     }
     if (empty($settings['s_botton'])) {
         $settings['s_botton'] = '媳妇';
     }
     if (empty($settings['pic'])) {
         $settings['pic'] = $_W['siteroot'] . 'addons/n1ce_love/template/mobile/images/answer.png';
     }
     include $this->template('setting');
 }
예제 #11
0
파일: module.php 프로젝트: noikiy/mygit
 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');
 }
예제 #12
0
파일: module.php 프로젝트: aspnmy/weizan
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     if (checksubmit('submit')) {
         $this->editSetting($_GPC);
         message('配置参数更新成功!', referer(), 'success');
     }
     $member_table = str_replace("`", "", tablename("mc_members"));
     $sql = "SELECT\r\n\t\t\tCOLUMN_NAME,\r\n\t\t\tcolumn_comment\r\n\t\tFROM\r\n\t\t\tINFORMATION_SCHEMA. COLUMNS\r\n\t\tWHERE\r\n\t\t\ttable_name = '{$member_table}'";
     $column = pdo_fetchall($sql);
     $sql = "select * from " . tablename("fl_dkf_column") . " where weid={$_W['weid']}";
     $wcolumn = pdo_fetchall($sql);
     if (!$wcolumn) {
         $sql = "select * from " . tablename("fl_dkf_column") . " where weid=0";
         $wcolumn = pdo_fetchall($sql);
     }
     foreach ($wcolumn as $key => $value) {
         $wcolumn_keys[$value['column_name']] = $value;
     }
     foreach ($column as $key => $value) {
         $column[$key]['column_show_name'] = $wcolumn_keys[$value['COLUMN_NAME']]['column_show_name'];
         $column[$key]['is_show'] = $wcolumn_keys[$value['COLUMN_NAME']]['is_show'];
         $column[$key]['is_edit'] = $wcolumn_keys[$value['COLUMN_NAME']]['is_edit'];
     }
     include $this->template('setting');
 }
예제 #13
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doWebPost()
 {
     //这个操作被定义用来呈现 管理中心导航菜单
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->table_stores) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,位置不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入位置名称!');
         }
         $data = array('uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['reside']['province'], 'city' => $_GPC['reside']['city'], 'dist' => $_GPC['reside']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'icon' => $_GPC['icon'], 'industry1' => $_GPC['industry_1'], 'industry2' => $_GPC['industry_2'], 'createtime' => TIMESTAMP);
         if (empty($id)) {
             pdo_insert($this->table_stores, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->table_stores, $data, array('id' => $id));
         }
         message('位置信息更新成功!', $this->createWebUrl('list'), 'success');
     }
     load()->func('tpl');
     include $this->template('post');
 }
예제 #14
0
파일: site.php 프로젝트: eduNeusoft/weixin
 /**
  * 
  * 系统奖励积分
  */
 public function doWebSystemaward()
 {
     global $_GPC, $_W;
     $uid = $_GPC['uid'];
     $sid = $_GPC['sid'];
     $signUser = CRUD::findById(CRUD::$table_sign_user, $uid);
     $sign = CRUD::findById(CRUD::$table_sign, $sid);
     if (checksubmit()) {
         if (empty($_GPC['credit'])) {
             message("请输入积分");
         }
         $record_data = array('uid' => $uid, 'sid' => $sid, 'sign_type' => self::$TYPE_SYSTEM, 'credit' => $_GPC['credit'], 'createtime' => TIMESTAMP);
         CRUD::create(CRUD::$table_sign_award, $record_data);
         $user_credit = $signUser['credit'];
         $user_data = array('credit' => $user_credit + $_GPC['credit']);
         if ($sign['sync_credit'] == 1) {
             //同步积分
             $this->synFanscredit($signUser['openid'], $_GPC['credit']);
             //同步
         }
         CRUD::updateById(CRUD::$table_sign_user, $user_data, $uid);
         // 更新用户积分
         message('更新用户称成功!', $this->createWebUrl('SignUser', array('sid' => $sid)), 'success');
     }
     include $this->template("system_award");
 }
예제 #15
0
 public function settingsDisplay($settings)
 {
     // 声明为全局才可以访问到.
     global $_W, $_GPC;
     if (checksubmit()) {
         // $_GPC 可以用来获取 Cookies,表单中以及地址栏参数
         $data = $_GPC['data'];
         // message() 方法用于提示用户操作提示
         empty($data['name']) && message('请填写便利店名称');
         empty($data['logo']) && message('请填写便利店 LOGO');
         empty($data['linkman']) && message('请填写便利店联系人');
         empty($data['phone']) && message('请填写便利店联系电话');
         empty($data['address']) && message('请填写便利店地址');
         empty($data['description']) && message('请填写便利店介绍');
         //字段验证, 并获得正确的数据$dat
         if (!$this->saveSettings($data)) {
             message('保存信息失败', '', 'error');
         } else {
             message('保存信息成功', '', 'success');
         }
     }
     // 模板中需要用到 "tpl" 表单控件函数的话, 记得一定要调用此方法.
     load()->func('tpl');
     //这里来展示设置项表单
     include $this->template('setting');
 }
예제 #16
0
 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     if (checksubmit()) {
         $cfg = array('times' => intval($_GPC['times']), 'start_time' => $_GPC['start_time'], 'end_time' => $_GPC['end_time'], 'credit' => intval($_GPC['credit']), 'rank' => intval($_GPC['rank']));
         $start_time = $cfg['start_time'];
         $start_time = strtotime($start_time);
         $end_time = $cfg['end_time'];
         $end_time = strtotime($end_time);
         if ($start_time >= $end_time) {
             message('开始时间不得晚于结束时间', 'refresh', 'error');
         } elseif ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     if (!isset($settings['times'])) {
         $settings['times'] = '1';
     }
     if (!isset($settings['start_time'])) {
         $settings['start_time'] = '08:30';
     }
     if (!isset($settings['end_time'])) {
         $settings['end_time'] = '22:00';
     }
     if (!isset($settings['credit'])) {
         $settings['credit'] = '1';
     }
     if (!isset($settings['rank'])) {
         $settings['rank'] = '10';
     }
     include $this->template('setting');
 }
예제 #17
0
파일: site.php 프로젝트: 6662680/qday_wx
 public function doMobilePay()
 {
     global $_W, $_GPC;
     if (empty($_W['member']['uid'])) {
         checkauth();
     }
     $username = $_W['member']['email'] ? $_W['member']['email'] : $_W['member']['mobile'];
     if (empty($username)) {
         message('您的用户信息不完整,请完善用户信息后再充值', '', 'error');
     }
     if (checksubmit('submit', true) || !empty($_GPC['ajax'])) {
         $fee = floatval($_GPC['money']);
         if ($fee <= 0) {
             message('支付错误, 金额小于0');
         }
         $chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND status = '0'", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee));
         if (empty($chargerecord)) {
             $chargerecord = array('uid' => $_W['member']['uid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(10, 1), 'fee' => $fee, 'status' => 0, 'createtime' => TIMESTAMP);
             if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
                 message('创建充值订单失败,请重试!', url('entry', array('m' => 'recharge', 'do' => 'pay')), 'error');
             }
         }
         $params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => '系统充值余额', 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
         $this->pay($params);
     } else {
         include $this->template('recharge');
     }
 }
예제 #18
0
파일: module.php 프로젝트: 6662680/qday_wx
 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     if (checksubmit()) {
         if (empty($_GPC['sendmail']) || empty($_GPC['senduser']) || empty($_GPC['sendpwd'])) {
             message('请完整填写邮件配置信息', 'refresh', 'error');
         }
         if ($_GPC['host'] == 'smtp.qq.com' || $_GPC['host'] == 'smtp.gmail.com') {
             $secure = 'ssl';
             $port = '465';
         } else {
             $secure = 'tls';
             $port = '25';
         }
         $result = $this->sendmail($_GPC['host'], $secure, $port, $_GPC['sendmail'], $_GPC['senduser'], $_GPC['sendpwd'], $_GPC['sendmail']);
         $cfg = array('host' => $_GPC['host'], 'secure' => $secure, 'port' => $port, 'sendmail' => $_GPC['sendmail'], 'senduser' => $_GPC['senduser'], 'sendpwd' => $_GPC['sendpwd'], 'status' => $result);
         if ($result == 1) {
             $this->saveSettings($cfg);
             message('邮箱配置成功', 'refresh');
         } else {
             message('邮箱配置信息有误', 'refresh', 'error');
         }
     }
     include $this->template('setting');
 }
예제 #19
0
파일: module.php 프로젝트: ChainBoy/wxfx
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('tpl');
     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('status' => $_GPC['status'], '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'], 'url' => $_GPC['url'], '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'], 'copyright' => $_GPC['copyright'], 'content' => htmlspecialchars_decode($_GPC['content']));
         if ($this->saveSettings($dat)) {
             message('保存成功', 'refresh');
         }
     }
     //这里来展示设置项表单
     include $this->template('setting');
 }
예제 #20
0
파일: site.php 프로젝트: 6662680/qday_wx
 public function doWebPost()
 {
     global $_GPC, $_W;
     if (empty($_GPC['do'])) {
         $_GPC['do'] = 'post';
     }
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename('business') . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,商户不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入商户名称!');
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'industry1' => $_GPC['industry']['parent'], 'industry2' => $_GPC['industry']['child'], 'createtime' => TIMESTAMP);
         if (!empty($_GPC['thumb'])) {
             $data['thumb'] = $_GPC['thumb'];
             load()->func('file');
             file_delete($_GPC['thumb-old']);
         }
         if (empty($id)) {
             pdo_insert('business', $data);
         } else {
             unset($data['createtime']);
             pdo_update('business', $data, array('id' => $id));
         }
         message('商户信息更新成功!', $this->createWebUrl('display'), 'success');
     }
     include $this->template('post');
 }
예제 #21
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doWebsetting()
 {
     global $_W, $_GPC;
     $weid = $_W['uniacid'];
     load()->func('tpl');
     $subject = pdo_fetch("SELECT * FROM " . tablename(hc_ybdzs_setting) . " WHERE weid = '{$weid}' ORDER BY id DESC LIMIT 1");
     $item['hc_ybdzs_title'] = empty($item['hc_ybdzs_title']) ? '月饼大战' : $item['hc_ybdzs_title'];
     $item['share_desc'] = empty($item['share_desc']) ? '我只用了一层功力,已经无人可及了!' : $item['share_desc'];
     $item['wechat'] = empty($item['wechat']) ? '导流标题' : $item['wechat'];
     $item['hc_ybdzs_url'] = empty($item['hc_ybdzs_url']) ? 'http://52jscn.com' : $item['hc_ybdzs_url'];
     if (checksubmit()) {
         $data = array('hc_ybdzs_title' => $_GPC['hc_ybdzs_title'], 'hc_ybdzs_url' => $_GPC['hc_ybdzs_url'], 'share_desc' => $_GPC['share_desc'], 'wechat' => $_GPC['wechat'], 'counts' => $_GPC['counts'], 'photo' => $_GPC['photo']);
         if (empty($subject)) {
             $data['weid'] = $weid;
             pdo_insert(hc_ybdzs_setting, $data);
         } else {
             pdo_update(hc_ybdzs_setting, $data, array('weid' => $weid));
         }
         message('欧了!欧了!更新完毕!', referer(), 'success');
     }
     if (!$subject['photo']) {
         $subject = array("photo" => "../addons/hc_ybdzs/template/mobile/b.gif");
     }
     include $this->template('setting');
 }
예제 #22
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doWebAwardlist()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (checksubmit('delete')) {
         pdo_delete('zzz_user', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     if (!empty($_GPC['wid'])) {
         $wid = intval($_GPC['wid']);
         pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid));
         message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 15;
     $where = '';
     $condition = array('mobile' => " AND `b`.`mobile` LIKE '%" . $_GPC['profilevalue'] . "%'", 'realname' => " AND `b`.`realname` LIKE '%" . $_GPC['profilevalue'] . "%'", 'nickname' => " AND `b`.`nickname` LIKE '%" . $_GPC['profilevalue'] . "%'");
     if (!empty($_GPC['profile'])) {
         $where .= $condition[$_GPC['profile']];
     }
     $sql = 'SELECT `a`.`id`, `a`.`friendcount`, `a`.`points`, `a`.`createtime`, `a`.`sharevalue`, `b`.`realname`, `b`.`nickname`,
             `b`.`mobile` FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON
             `f`.`fanid` = `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . " AS `b` ON `b`.`uid` = `f`.`uid`  WHERE `a`.`rid` = :rid\n                {$where} ORDER BY `a`.`points` DESC ";
     $params = array(':rid' => $id);
     if (empty($_GPC['export'])) {
         $sql .= ' LIMIT ' . ($pindex - 1) * $psize . ',' . $psize;
     } else {
         $list = pdo_fetchall($sql, $params);
         $tableHeader = array('realname' => '姓名', 'nickname' => '昵称', 'mobile' => '手机', 'points' => '分数');
         $tableLength = count($tableHeader) + 1;
         /* 输入到CSV文件 */
         $html = "";
         /* 输出表头 */
         foreach ($tableHeader as $header) {
             $html .= $header . "\t ,";
         }
         $html .= "创建时间\t, \n";
         /* 输出内容 */
         foreach ($list as $value) {
             foreach ($tableHeader as $key => $header) {
                 $html .= $value[$key] . "\t ,";
             }
             $html .= date('Y-m-d H:i:s', $value['createtime']) . "\t ,";
             $html .= "\n";
         }
         /* 输出CSV文件 */
         header("Content-type:text/csv");
         header("Content-Disposition:attachment; filename=全部数据.csv");
         echo $html;
         exit;
     }
     $list = pdo_fetchall($sql, $params);
     if (!empty($list)) {
         $sql = 'SELECT COUNT(*) FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` =
                 `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . ' AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid' . $where;
         $total = pdo_fetchcolumn($sql, $params);
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('awardlist');
 }
예제 #23
0
파일: module.php 프로젝트: aspnmy/weizan
 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     if (checksubmit()) {
         load()->func('file');
         mkdirs(ZC_ROOT . '/cert');
         $r = true;
         $pemname = isset($pemname) ? $pemname : time();
         if (!empty($_GPC['cert'])) {
             $ret = file_put_contents(ZC_ROOT . '/cert/apiclient_cert.pem.' . $pemname, trim($_GPC['cert']));
             $r = $r && $ret;
         }
         if (!empty($_GPC['key'])) {
             $ret = file_put_contents(ZC_ROOT . '/cert/apiclient_key.pem.' . $pemname, trim($_GPC['key']));
             $r = $r && $ret;
         }
         if (!empty($_GPC['ca'])) {
             $ret = file_put_contents(ZC_ROOT . '/cert/rootca.pem.' . $pemname, trim($_GPC['ca']));
             $r = $r && $ret;
         }
         if (!$r) {
             message('证书保存失败, 请保证 /addons/hx_zhongchou/cert/ 目录可写');
         }
         $cfg = array('noticeemail' => $_GPC['noticeemail'], 'kfid' => $_GPC['kfid'], 'k_templateid' => $_GPC['k_templateid'], 'kfirst' => $_GPC['kfirst'], 'kfoot' => $_GPC['kfoot'], 'm_templateid' => $_GPC['m_templateid'], 'mfirst' => $_GPC['mfirst'], 'mfoot' => $_GPC['mfoot'], 'ispublish' => intval($_GPC['ispublish']), 'shopname' => $_GPC['shopname'], 'address' => $_GPC['address'], 'phone' => $_GPC['phone'], 'email' => $_GPC['email'], 'officialweb' => $_GPC['officialweb'], 'description' => htmlspecialchars_decode($_GPC['description']), 'appid' => trim($_GPC['appid']), 'secret' => trim($_GPC['secret']), 'mchid' => trim($_GPC['mchid']), 'password' => trim($_GPC['password']), 'ip' => trim($_GPC['ip']), 'pemname' => $pemname);
         if (!empty($_GPC['logo'])) {
             $cfg['logo'] = $_GPC['logo'];
         }
         if ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     load()->func('tpl');
     include $this->template('setting');
 }
예제 #24
0
파일: module.php 프로젝트: aspnmy/weizan
 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     load()->func('tpl');
     if (empty($settings['weisrc_pano'])) {
         $settings['weisrc_pano']['title'] = "360全景展示";
         $settings['weisrc_pano']['bg'] = "../addons/weisrc_pano/template/images/bg.jpg";
         $settings['weisrc_pano']['share_title'] = "360全景展示";
         $settings['weisrc_pano']['share_image'] = "../addons/weisrc_pano/icon.jpg";
         $settings['weisrc_pano']['share_desc'] = "360全景展示";
     }
     if (checksubmit()) {
         $cfg = $settings;
         $cfg['weisrc_pano']['title'] = trim($_GPC['title']);
         $cfg['weisrc_pano']['bg'] = trim($_GPC['bg']);
         $cfg['weisrc_pano']['share_title'] = trim($_GPC['share_title']);
         $cfg['weisrc_pano']['share_image'] = trim($_GPC['share_image']);
         $cfg['weisrc_pano']['share_cancel'] = trim($_GPC['share_cancel']);
         $cfg['weisrc_pano']['share_desc'] = trim($_GPC['share_desc']);
         $cfg['weisrc_pano']['share_url'] = trim($_GPC['share_url']);
         if ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     include $this->template('setting');
 }
예제 #25
0
 public function doWebAwardlist()
 {
     global $_GPC, $_W;
     checklogin();
     //$from_user = $_W['fans']['from_user'];
     $id = $_GPC['id'];
     if (checksubmit('delete')) {
         pdo_delete('mgamblemoon_user', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     if (!empty($_GPC['wid'])) {
         $wid = intval($_GPC['wid']);
         pdo_update('mgamblemoon_user', array('status' => intval($_GPC['status'])), array('id' => $wid));
         message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 50;
     $where = '';
     $condition = array('mobile' => " AND b.mobile ='{$_GPC['profilevalue']}'", 'realname' => " AND b.realname ='{$_GPC['profilevalue']}'");
     if (!empty($_GPC['profile'])) {
         $where .= $condition[$_GPC['profile']];
     }
     $sql = "SELECT a.id,  a.award,a.createtime,a.num,a.status, b.nickname, b.mobile FROM " . tablename('mgamblemoon_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = {$id}  {$where} ORDER BY a.huodeid ASC LIMIT " . ($pindex - 1) * $psize . ",{$psize}";
     $list = pdo_fetchall($sql);
     if (!empty($list)) {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('mgamblemoon_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = '{$id}' {$where}");
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('awardlist');
 }
예제 #26
0
파일: module.php 프로젝트: aspnmy/weizan
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('tpl');
     if (checksubmit()) {
         $cfg = array();
         $cfg['type'] = $_GPC['type'];
         $cfg['size'] = intval($_GPC['size']);
         $cfg['mailadd'] = $_GPC['mailadd'];
         $cfg['password'] = $_GPC['password'];
         $cfg['smtp'] = $_GPC['smtp'];
         $cfg['headtitle'] = $_GPC['headtitle'];
         $cfg['logo'] = $_GPC['logo'];
         if ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     if (!isset($settings['size'])) {
         $settings['size'] = 10;
     }
     if (!isset($settings['type'])) {
         $settings['type'] = 'xml,jpg,jpeg,css';
     }
     if (!isset($settings['mailadd'])) {
         $settings['mailadd'] = '龙哥专用邮箱284099857@qq.com';
     }
     if (!isset($settings['smtp'])) {
         $settings['smtp'] = 'smtp.qq.com';
     }
     if (!isset($settings['headtitle'])) {
         $settings['headtitle'] = 'MEEPO大学生联盟致力于打造最强校园联盟!';
     }
     include $this->template('setting');
 }
예제 #27
0
 public function doWebShare()
 {
     global $_W, $_GPC;
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display-log';
     if ($operation == 'post') {
         $goodsid = $_GPC['goodsid'];
         $item = pdo_fetch("SELECT * FROM " . tablename($this->table_event) . " WHERE goodsid=:goodsid", array(":goodsid" => $goodsid));
         $goods = pdo_fetch("SELECT * FROM " . tablename($this->table_goods) . " WHERE id=:goodsid", array(":goodsid" => $goodsid));
         if (checksubmit()) {
             $share_title = $_GPC['share_title'];
             $share_content = $_GPC['share_content'];
             $discount = $_GPC['discount'];
             $discount_limit = $_GPC['discount_limit'];
             if (false == $item) {
                 pdo_insert($this->table_event, array('weid' => $_W['weid'], 'share_title' => $share_title, 'share_content' => $share_content, 'goodsid' => $goodsid, 'discount' => $discount, 'discount_limit' => $discount_limit));
             } else {
                 pdo_update($this->table_event, array('weid' => $_W['weid'], 'share_title' => $share_title, 'share_content' => $share_content, 'discount' => $discount, 'discount_limit' => $discount_limit), array('goodsid' => $goodsid));
             }
             message("更新成功", $this->createWebUrl("Share", array("op" => "display-event")), "success");
         }
     }
     if ($operation == 'display-event') {
         $list = pdo_fetchall("SELECT * FROM " . tablename($this->table_goods) . " WHERE weid=:weid AND istime=1", array(":weid" => $_W['weid']));
     }
     if ($operation == 'display-log') {
         $list = pdo_fetchall("SELECT COUNT(goodsid) as click, goodsid, orderid, title  FROM " . tablename($this->table_iptable) . " WHERE weid=:weid GROUP BY orderid", array(":weid" => $_W['weid']));
     }
     include $this->template('share');
 }
예제 #28
0
파일: site.php 프로젝트: aspnmy/weizan
 public function doWebAddInfo()
 {
     global $_W, $_GPC;
     load()->func('tpl');
     $infoid = intval($_GPC['infoid']);
     if ($infoid) {
         $info = pdo_fetch("SELECT * FROM " . tablename('water_query_info') . " WHERE id= " . $infoid);
     }
     if ($_GPC['op'] == 'delete') {
         $infoid = intval($_GPC['infoid']);
         $info = pdo_fetch("SELECT id FROM " . tablename('water_query_info') . " WHERE id = " . $infoid);
         if (empty($info)) {
             message('抱歉,信息不存在或是已经被删除!');
         }
         pdo_delete('water_query_info', array('id' => $infoid));
         message('删除成功!', referer(), 'success');
     }
     if (checksubmit()) {
         $data = array('keyword' => $_GPC['keyword'], 'info' => htmlspecialchars_decode($_GPC['info']), 'infophoto' => $_GPC['infophoto']);
         if (!empty($infoid)) {
             pdo_update('water_query_info', $data, array('id' => $infoid));
         } else {
             $data['uniacid'] = $_W['uniacid'];
             pdo_insert('water_query_info', $data);
             $infoid = pdo_insertid();
         }
         message('更新成功!', referer(), 'success');
     }
     include $this->template('addinfo');
 }
예제 #29
0
파일: module.php 프로젝트: aspnmy/weizan
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC;
     load()->func('file');
     $_W['page']['title'] = '签文参数设置';
     if ($_W['isajax'] && $_GPC['op'] == 'delete' && $_GPC['filename']) {
         file_delete($_GPC['filename']);
         exit('ok');
     }
     if (checksubmit()) {
         // 配置
         $dat = $_GPC['add'];
         $dat['imgUrl'] = $_GPC['imgUrl'];
         $this->saveSettings($dat);
         // 签文
         $qian = $_GPC['qian'];
         $f_exp = "::::::";
         $r_exp = PHP_EOL;
         $morepic = "";
         for ($i = 0; $i < count($qian['filename']); $i++) {
             //替换非法字符
             $name = str_replace($f_exp, "", $qian['title'][$i]);
             $name = str_replace($r_exp, "", $name);
             $pic = str_replace($f_exp, "", $qian['filename'][$i]);
             $pic = str_replace($r_exp, "", $pic);
             if ($pic) {
                 $morepic .= $pic . $f_exp . $name . $r_exp;
             }
         }
         // 去掉最后的字符
         // $morepic = substr($morepic,0,strlen($morepic)-2);
         $morepic = trim($morepic);
         $check = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
         if ($check) {
             pdo_update('qiyue_qiuqian', array('morepic' => $morepic), array('uniacid' => $_W['uniacid']));
         } else {
             $add['uniacid'] = $_W['uniacid'];
             $add['morepic'] = $morepic;
             pdo_insert('qiyue_qiuqian', $add);
         }
         message('设置成功', 'referer', 'success');
     }
     if (empty($settings)) {
         $settings = array('title' => '新年祈福签', 'desc' => '我在' . $_W['account']['name'] . '求了一支新年签,你也来吧!', 'imgUrl' => tomedia('./addons/qiuqian/icon.jpg'));
     }
     $qian_r = pdo_fetch("SELECT * FROM " . tablename('qiyue_qiuqian') . " WHERE uniacid=:uniacid", array(':uniacid' => $_W['uniacid']));
     $morepic = array();
     if ($qian_r['morepic']) {
         $f_exp = "::::::";
         $r_exp = PHP_EOL;
         $rr = explode($r_exp, $qian_r['morepic']);
         for ($i = 0; $i < count($rr); $i++) {
             $fr = explode($f_exp, $rr[$i]);
             $morepic[] = array('title' => $fr['1'], 'filename' => $fr['0']);
         }
         unset($qian_r['morepic']);
     }
     include $this->template('setting');
 }
예제 #30
0
 public function doWebAward()
 {
     // 1. display credit
     // 2. add credit
     // 3. delete credit
     // 4. update credit
     global $_W;
     global $_GPC;
     // 获取query string中的参数
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     if ($operation == 'post') {
         // 增加或者更新兑换商品
         $award_id = intval($_GPC['award_id']);
         if (!empty($award_id)) {
             $item = pdo_fetch("SELECT * FROM " . tablename('award_list') . " WHERE award_id = :award_id", array(':award_id' => $award_id));
             if (empty($item)) {
                 message('抱歉,兑换商品不存在或是已经删除!', '', 'error');
             }
         }
         if (checksubmit('submit')) {
             if (empty($_GPC['title'])) {
                 message('请输入兑换商品名称!');
             }
             if (empty($_GPC['credit_cost'])) {
                 message('请输入兑换商品需要消耗的积分数量!');
             }
             if (empty($_GPC['price'])) {
                 message('请输入商品实际价值!');
             }
             $credit_cost = intval($_GPC['credit_cost']);
             $price = intval($_GPC['price']);
             $amount = intval($_GPC['amount']);
             $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'logo' => $_GPC['logo'], 'deadline' => $_GPC['deadline'], 'amount' => $amount, 'credit_cost' => $credit_cost, 'price' => $price, 'content' => $_GPC['content'], 'createtime' => TIMESTAMP);
             if (!empty($award_id)) {
                 pdo_update('award_list', $data, array('award_id' => $award_id));
             } else {
                 pdo_insert('award_list', $data);
             }
             message('商品更新成功!', create_url('site/module/award', array('name' => 'credit', 'op' => 'display')), 'success');
         }
     } else {
         if ($operation == 'delete') {
             //删除商品
             $award_id = intval($_GPC['award_id']);
             $row = pdo_fetch("SELECT award_id FROM " . tablename('award_list') . " WHERE award_id = :award_id", array(':award_id' => $award_id));
             if (empty($row)) {
                 message('抱歉,商品' . $award_id . '不存在或是已经被删除!');
             }
             pdo_delete('award_list', array('award_id' => $award_id));
             message('删除成功!', referer(), 'success');
         } else {
             if ($operation == 'display') {
                 $condition = '';
                 $list = pdo_fetchall("SELECT * FROM " . tablename('award_list') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY createtime DESC");
             }
         }
     }
     include $this->template('award');
 }