Beispiel #1
0
 public function sendText($weid, $openid, $msg)
 {
     yload()->classs('quick_center', 'wechatapi');
     $_wechatapi = new WechatAPI();
     $ret = $_wechatapi->sendText($openid, $msg);
     $this->addCustomMsg($weid, $openid, $msg);
     return $ret;
 }
Beispiel #2
0
 public function settingsDisplay($settings)
 {
     global $_GPC, $_W;
     yload()->classs('quick_center', 'kvparser');
     if (checksubmit()) {
         $vip_arr = KVParser::decode($_GPC['vip']);
         if ($vip_arr === NULL) {
             message('VIP名称自定义格式错误,请参考输入框下方的例子');
         }
         $cfg = array('template' => trim($_GPC['template']), 'title' => trim($_GPC['title']), 'uplevelname' => trim($_GPC['uplevelname']), 'vip' => serialize($vip_arr));
         if ($this->saveSettings($cfg)) {
             message('保存成功', 'refresh');
         }
     }
     if (empty($settings['uplevelname'])) {
         $settings['uplevelname'] = '上线';
     }
     if (empty($settings['template'])) {
         $settings['template'] = 'pink';
     }
     if (empty($settings['title'])) {
         $settings['title'] = '记账本';
     }
     if (!empty($settings['vip'])) {
         $settings['vip'] = KVParser::encode(unserialize($settings['vip']));
     }
     yload()->classs('quick_center', 'FormTpl');
     yload()->classs('quick_center', 'dirscanner');
     $_scanner = new DirScanner();
     $dirs = $_scanner->scan('quicktemplate/quick_center');
     $template_items = array();
     foreach ($dirs as $dir) {
         $template_items[$dir] = $dir;
     }
     include $this->template('setting');
 }
Beispiel #3
0
 public function addCredit($weid, $from_user, $credit, $credittype = 1, $tag = '')
 {
     yload()->classs('quick_center', 'creditlog');
     $_creditlog = new CreditLog();
     $_creditlog->logCredit($this, $weid, $from_user, $credittype, $credit, $tag . '前');
     $ret = $this->sysAddCredit($from_user, floatval($credit), $credittype, $tag);
     $_creditlog->logCredit($this, $weid, $from_user, $credittype, $credit, $tag . '后');
     return $ret;
 }
Beispiel #4
0
 public function doWebCenter()
 {
     global $_W, $_GPC;
     $operation = empty($_GPC['op']) ? 'display' : $_GPC['op'];
     if ($operation == 'display') {
         $level = empty($_GPC['level']) ? 1 : intval($_GPC['level']);
         $groupid = empty($_GPC['groupid']) ? 1 : intval($_GPC['groupid']);
         $list = pdo_fetchall("SELECT * FROM " . tablename(self::$t_bind) . " WHERE weid=:weid ORDER BY enable DESC, groupid, displayorder", array(':weid' => $_W['weid']));
     } else {
         if ($operation == 'post') {
             load()->func('tpl');
             yload()->classs('quick_center', 'FormTpl');
             $id = intval($_GPC['id']);
             if (checksubmit('submit')) {
                 if (empty($id)) {
                     $this->center->AddItem($_GPC);
                     message('新增菜单项成功', $this->createWebUrl('Center'), 'success');
                 } else {
                     $this->center->UpdateItem($id, $_GPC);
                     message('更新成功', $this->createWebUrl('Center', array('op' => 'display')), 'success');
                 }
             }
             $item = $this->center->GetItem($id);
         } else {
             if ($operation == 'delete') {
                 $id = intval($_GPC['id']);
                 $this->center->DeleteItem($id);
                 message('删除成功', referer(), 'success');
             }
         }
     }
     $data_config = $this->user_config;
     include $this->template('center');
 }
Beispiel #5
0
 private function getQRTicket($token, $data)
 {
     $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={$token}";
     WeUtility::logging('QR data', json_encode($data));
     yload()->classs('quick_center', 'wechatutil');
     $ret = WechatUtil::http_request($url, json_encode($data));
     $content = @json_decode($ret['content'], true);
     WeUtility::logging('QR content', $content);
     return $content;
 }
Beispiel #6
0
 private function tryLink()
 {
     global $_GPC, $_W;
     if ($this->module['config']['enable_link'] == 1) {
         yload()->classs('quicklink', 'translink');
         $_link = new TransLink();
         if ($_GPC['shareby'] != $_W['fans']['from_user']) {
             $_link->instantLink($_W['weid'], $_W['fans'], $_GPC['shareby']);
         }
     }
 }