function _initialize() { parent::_initialize(); $controller = strtolower(_CONTROLLER); $action = strtolower(_ACTION); $res['title'] = '客服管理'; $res['url'] = addons_url('YouaskService://YouaskService/lists'); $res['class'] = ($controller == 'youaskservice' || $controller == 'group') && $action != 'config' ? 'current' : ''; $nav[] = $res; $res['title'] = '关键词指定客服'; $res['url'] = addons_url('YouaskService://KeywordKF/lists'); $res['class'] = $controller == 'keywordkf' ? 'current' : ''; $nav[] = $res; $res['title'] = '微信客服设置'; $res['url'] = addons_url('YouaskService://YouaskService/config'); $res['class'] = $controller == 'youaskservice' && $action == 'config' ? 'current' : ''; $nav[] = $res; $this->assign('nav', $nav); $config = getAddonConfig('YouaskService'); $config['cover_url'] = get_cover_url($config['cover']); $config['background'] = get_cover_url($config['background']); $this->config = $config; $this->assign('config', $config); // 定义模板常量 $act = strtolower(_ACTION); $temp = $config['template_' . $act]; $act = ucfirst($act); }
function _initialize() { parent::_initialize(); $controller = strtolower(_CONTROLLER); $action = strtolower(_ACTION); $res['title'] = '支付配置'; $res['url'] = addons_url('Payment://Payment/lists'); $res['class'] = $action == 'lists' || $action == 'listsv3' || $action == 'zfbpay' || $action == 'cftwappay' || $action == 'ctfpay' || $action == 'quickpay' ? 'current' : ''; $nav[] = $res; $res['title'] = '功能配置'; $res['url'] = addons_url('Payment://Payment/config'); $res['class'] = $action == 'config' ? 'current' : ''; $nav[] = $res; $this->assign('nav', $nav); $config = getAddonConfig('Payment'); $config['cover_url'] = get_cover_url($config['cover']); $config['background'] = get_cover_url($config['background']); $this->config = $config; $this->assign('config', $config); // 定义模板常量 $act = strtolower(_ACTION); $temp = $config['template_' . $act]; $act = ucfirst($act); define('CUSTOM_TEMPLATE_PATH', ONETHINK_ADDON_PATH . 'Payment/View/default/Template'); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Draw'); // 获取后台插件的配置参数 //dump($config); $map['token'] = get_token(); $keywordArr['aim_id'] && ($map['id'] = $keywordArr['aim_id']); $data = M('lottery_games')->where($map)->find(); // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统 $param['token'] = get_token(); $param['openid'] = get_openid(); $param['games_id'] = $data['id']; $url = addons_url('Draw://Wap/index', $param); $articles[0] = array('Title' => $data['title'], 'Url' => $url, 'Description' => $data['intro']); switch ($data['game_type']) { case 1: $articles[0]['PicUrl'] = SITE_URL . '/Addons/Draw/View/default/Public/guaguale_cover.jpg'; break; case 2: $articles[0]['PicUrl'] = SITE_URL . '/Addons/Draw/View/default/Public/dzp_cover.jpg'; break; case 3: $articles[0]['PicUrl'] = SITE_URL . '/Addons/Draw/View/default/Public/zjd_cover.jpg'; break; case 4: $articles[0]['PicUrl'] = SITE_URL . '/Addons/Draw/View/default/Public/nine_cover.jpg'; break; } $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Weather'); // 获取后台插件的配置参数 preg_match('/(.+)天气/i', $dataArr[Content], $matchs); $json_array = file_get_contents('http://api.map.baidu.com/telematics/v3/weather?location=' . $matchs[1] . '&output=json&ak=5slgyqGDENN7Sy7pw29IUvrZ'); $json_array = json_decode($json_array, true); $array = $json_array['results'][0]['weather_data']; print_r($json_array); date_default_timezone_set('Asia/Shanghai'); $h = date('H'); if ($json_array['error'] > -3) { foreach ($array as $key => $val) { date_default_timezone_set(PRC); $h = date('H'); if ($h >= 8 && $h <= 19) { $articles[$key] = array('Title' => $val['date'] . "\n" . $val['weather'] . " " . $val['wind'] . " " . $val['temperature'], 'Description' => '', 'PicUrl' => $val['dayPictureUrl'], 'Url' => ''); } else { $articles[$key] = array('Title' => $val['date'] . "\n" . $val['weather'] . " " . $val['wind'] . " " . $val['temperature'], 'Description' => '', 'PicUrl' => $val['nightPictureUrl'], 'Url' => ''); } } $tarray = array('Title' => $json_array['results'][0]['currentCity'] . "天气预报", 'Description' => '', 'PicUrl' => '', 'Url' => ''); array_unshift($articles, $tarray); $this->replyNews($articles); } else { $this->replyText("没找到耶!...〒_〒"); } }
function reply($dataArr, $keywordArr = array()) { $this->config = getAddonConfig('Chat'); // 获取后台插件的配置参数 $content = $this->_tuling($dataArr['Content']); if ($content) { exit; } // 先尝试小九机器人 目前已不可用 if (empty($content)) { // $content = $this->_xiaojo ( $dataArr ['Content'] ); } // 再尝试小黄鸡 if (empty($content)) { $content = $this->_simsim($dataArr['Content']); } // TODO 此处可继续增加其它API接口 // 最后只能随机回复了 if (empty($content)) { $content = $this->_rand(); } // 增加积分,每隔5分钟才加一次,5分钟内只记一次积分 add_credit('chat', 300); $res = $this->replyText($content); return $res; }
function writeCardInfo() { $map['uid'] = $this->mid; $info = M('card_member')->where($map)->find(); if (IS_POST) { $data['username'] = I('post.username'); $data['phone'] = I('post.phone'); if ($info) { $res = M('card_member')->where($map)->save($data); } else { $config = getAddonConfig('Card'); $data['number'] = M('card_member')->where('number>' . $config['length'] . ' AND token=' . get_token())->getField("max(number) as number"); if (empty($data['number'])) { $data['number'] = $config['length']; } else { $data['number'] += 1; } $data['uid'] = $this->mid; $data['cTime'] = time(); $data['token'] = get_token(); $res = M('card_member')->add($data); } redirect(addons_url('Card://Card/showCard')); } $this->assign('info', $info); $this->display(); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('SceneQrcode'); // 获取后台插件的配置参数 //dump($config); $this->replyText(json_encode($keywordArr) . "adasd"); }
function suggest() { $config = getAddonConfig('Suggestions'); $this->assign($config); // dump ( $config ); $map['id'] = $data['uid'] = $this->mid; $user = get_followinfo($this->mid); $this->assign('user', $user); if (IS_POST) { // 保存用户信息 $nickname = I('nickname'); if ($config['need_nickname'] && !empty($nickname)) { $data['nickname'] = $nickname; } $mobile = I('mobile'); if ($config['need_mobile'] && !empty($mobile)) { $data['mobile'] = $mobile; } // 保存内容 $data['cTime'] = time(); $data['content'] = I('content'); $data['token'] = get_token(); $res = M('suggestions')->add($data); if ($res) { // 增加积分 add_credit('suggestions'); $this->success('增加成功,谢谢您的反馈'); } else { $this->error('增加失败,请稍后再试'); } } else { $this->display(); } }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Dg'); // 获取后台插件的配置参数 // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统 $param['token'] = get_token(); $param['openid'] = get_openid(); $keyword = $keywordArr['keyword']; //设置的关键词 $myword = trim($dataArr['Content']); //用户输入的内容 $myword = str_replace($keyword, '', $myword); //过滤匹配词 if (empty($myword) || empty($keyword)) { $randgqinfoarr = $this->getBaiDurand(); //随机歌曲 $songName = $randgqinfoarr['songName']; $artistName = $randgqinfoarr['artistName']; $songLink = $this->getBaiDugqurl($randgqinfoarr['songLink']); $this->replyMusicnothumb($songName, $artistName, $songLink, $songLink); } elseif ($keyword == '点歌') { $arr = $this->getBaiDugqlist($myword); $mygqinfoarr = $this->getBaiDugqinfo($arr['0']['song_id']); $songName = $mygqinfoarr['songName']; $artistName = $mygqinfoarr['artistName']; $songLink = $this->getBaiDugqurl($mygqinfoarr['songLink']); $this->replyMusicnothumb($songName, $artistName, $songLink, $songLink); $this->replyText($msg); } else { $this->replyText("系统指令出错\n发送【点歌】随机听歌,\n发送【点歌+歌曲名】点歌"); } }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Example'); // 获取后台插件的配置参数 //dump($config); replyText("这是功能演示插件默认文本回复"); }
function _initialize() { parent::_initialize(); $controller = strtolower(_CONTROLLER); $res['title'] = '会员卡制作'; $res['url'] = addons_url('Card://Card/config'); $res['class'] = $controller == 'card' ? 'current' : ''; $nav[] = $res; $res['title'] = '会员管理'; $res['url'] = addons_url('Card://member/lists'); $res['class'] = $controller == 'member' ? 'current' : ''; $nav[] = $res; $res['title'] = '通知管理'; $res['url'] = addons_url('Card://notice/lists'); $res['class'] = $controller == 'notice' ? 'current' : ''; $nav[] = $res; $res['title'] = '优惠券'; $res['url'] = addons_url('Coupon://Coupon/lists'); $res['class'] = $controller == 'coupon' ? 'current' : ''; $nav[] = $res; $this->assign('nav', $nav); $config = getAddonConfig('Card'); $config['background_url'] = $config['background'] == 11 ? $config['background_custom'] : ADDON_PUBLIC_PATH . '/card_bg_' . $config['background'] . '.png'; $this->assign('config', $config); //dump ( $config ); //dump(get_token()); }
function writeCardInfo() { $map['uid'] = $this->mid; $info = M('card_member')->where($map)->find(); if (IS_POST) { $data['username'] = I('post.username'); $data['phone'] = I('post.phone'); if ($info) { $res = M('card_member')->where($map)->save($data); } else { $config = getAddonConfig('Card'); $map_token['token'] = get_token(); $data['number'] = M('card_member')->where($map_token)->getField("max(number) as number"); if (empty($data['number'])) { $data['number'] = $config['length']; } else { $data['number'] += 1; } $data['uid'] = $map2['id'] = $this->mid; $data['cTime'] = time(); $data['token'] = get_token(); $res = M('card_member')->add($data); M('follow')->where($map2)->setField('status', 3); // 增加积分 add_credit('card_bind'); } redirect(addons_url('Card://Card/showCard')); } $this->assign('info', $info); $this->display('write_cardinfo'); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Salon'); // 获取后台插件的配置参数 $param['token'] = get_token(); $param['openid'] = get_openid(); //初始化查找条件,51,52,。。。55分别为E沙龙几个固定的图文项 $map_news['id'] = array('in', array(51, 52, 53, 54, 61, 60)); $list = M('custom_reply_news')->where($map_news)->select(); $contact = array(); foreach ($list as $k => $info) { if ($k > 8) { continue; } if ($info['title'] == "联系我们") { $contact = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => addons_url($info['jump_url'], $param)); continue; } //商家登录 if ($info['id'] == 61) { $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $info['jump_url']); continue; } $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => addons_url($info['jump_url'], $param)); } $articles[] = $contact; $res = $this->replyNews($articles); }
function subscribe($dataArr) { $config = getAddonConfig('Wecome'); // 获取后台插件的配置参数 // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统 $param['token'] = get_token(); $param['openid'] = get_openid(); $sreach = array('[follow]', '[website]'); $replace = array(addons_url('UserCenter://UserCenter/edit', $param), addons_url('WeiSite://WeiSite/index', $param)); $config['description'] = str_replace($sreach, $replace, $config['description']); switch ($config['type']) { case '3': $articles[0] = array('Title' => $config['title'], 'Description' => $config['description'], 'PicUrl' => $config['pic_url'], 'Url' => str_replace($sreach, $replace, $config['url'])); $res = $this->replyNews($articles); break; // case '2' : // $media_id = 1; // $res = $this->replyImage ( $media_id ); // break; // case '2' : // $media_id = 1; // $res = $this->replyImage ( $media_id ); // break; default: $res = $this->replyText($config['description']); } return $res; }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('SendCoupon'); // 获取后台插件的配置参数 //dump($config); $map['token'] = get_token(); $keywordArr['aim_id'] && ($map['id'] = $keywordArr['aim_id']); $data = M('Sendcoupon')->where($map)->order('id desc')->select(); foreach ($data as $key => $vo) { $param['id'] = $vo['id']; $url = addons_url('SendCoupon://SendCoupon/index', $param); $articles[$key] = array('Title' => $vo['title'], 'Url' => $url); $now = time(); if ($vo['end_time'] > $now) { $articles[$key]['Description'] = $vo['intro']; $articles[$key]['PicUrl'] = !empty($vo['cover']) ? get_cover_url($vo['cover']) : SITE_URL . '/Addons/Scratch/View/default/Public/cover_pic.jpg'; } else { $articles[$key]['Description'] = $vo['end_tips']; $articles[$key]['PicUrl'] = !empty($vo['end_cover']) ? get_cover_url($vo['end_cover']) : SITE_URL . '/Addons/Scratch/View/default/Public/cover_pic_over.png'; } } //foreach if ($articles) { $this->replyNews($articles); } else { $this->replyText('Sorry,当前无红包活动!'); } }
function reply($dataArr) { $config = getAddonConfig('Welcome'); // 获取后台插件的配置参数 $PublicFollow = D('Common/PublicFollow'); /**关注**/ $event = $dataArr['Event']; if ($event == 'subscribe') { //记录基本信息 $PublicFollow->subscribe($dataArr['FromUserName'], $dataArr['ToUserName']); //发送关注消息 switch ($config['type']) { case '3': $res = $this->replyMaterialNews($config['appmsg_id']); break; case '2': return false; break; default: $res = $this->replyText($config['description']); } /**扫码用户已关注时的事件推送**/ } elseif ($event == 'scan') { /**取消关注**/ } elseif ($event == 'unsubscribe') { $PublicFollow->unsubscribe($dataArr['FromUserName']); } }
function init_follow($openid, $token = '', $has_subscribe = false) { empty($token) && ($token = get_token()); addWeixinLog($openid . '::_' . $token, 'init_follow_in'); if (empty($openid) || $openid == -1 || empty($token) || $token == -1) { return false; } $data['token'] = $token; $data['openid'] = $openid; $datas = $data; $uid = M('public_follow')->where($data)->getField('uid'); addWeixinLog($uid, 'init_follow_check_uid'); if ($uid) { return $uid; } // 自动注册 $config = getAddonConfig('UserCenter', $token); $user = array('experience' => intval($config['experience']), 'score' => intval($config['score']), 'reg_ip' => get_client_ip(1), 'reg_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1), 'last_login_time' => NOW_TIME, 'status' => 1, 'is_init' => 1, 'is_audit' => 1, 'come_from' => 1); $user2 = getWeixinUserInfo($openid); $user = array_merge($user, $user2); $data['uid'] = $uid = D('Common/User')->add($user); if ($has_subscribe !== false) { $data['has_subscribe'] = $has_subscribe; } M('public_follow')->add($data); return $uid; }
function _initialize() { parent::_initialize(); $config = getAddonConfig('Leaflets'); $config['img'] = is_numeric($config['img']) ? get_cover_url($config['img']) : SITE_URL . '/Addons/Leaflets/View/default/Public/qrcode_default.jpg'; $this->assign('config', $config); // dump($config); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('CustomMenu'); // 获取后台插件的配置参数 // dump($config); if ($data['Content'] == 'view') { redirect($data['EventKey']); } }
public function index() { $word = I('get.keyword'); empty($word) ? $word = '美食' : $word; $ak = getAddonConfig('Nearby'); $this->assign('ak', $ak['ak']); $this->assign('query', $word); $this->display(); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('LostAndFound'); // 获取后台插件的配置参数 $param['token'] = get_token(); $param['openid'] = get_openid(); $url = addons_url("LostAndFound://LostAndFound/index", $param); $articles[0] = array('Title' => $config['title'], 'Description' => $config['desc'], 'PicUrl' => get_cover_url($config['img']), 'Url' => $url); $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('AddressManage'); // 获取后台插件的配置参数 //dump($config); $params['token'] = get_token(); $params['openid'] = get_openid(); $url = addons_url('AddressManage://AddressManage/addList', $params); $this->replyText($url); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Juhe'); // 获取后台插件的配置参数 if ($keywordArr['keyword'] == '股票') { if ($dataArr['Content'] == $keywordArr['keyword']) { set_user_status('Juhe', $keywordArr); $this->replyText('请输入股票编号,上海股市以sh开头,深圳股市以sz开头如:sh601009'); } else { $url = 'http://web.juhe.cn:8080/finance/stock/hs?gid=' . $dataArr['Content'] . '&key=' . $config['stock']; $content = file_get_contents($url); $content = json_decode($content, true); $content = $content['result'][0]['dapandata']; if (empty($content)) { $this->replyText('股票编号不对'); return false; } $str = "名称: " . $content['name'] . "\n当前点数: " . $content['dot'] . "\n当前价格: " . $content['nowPic'] . "\n涨跌率: " . $content['rate'] . "\n成交量: " . $content['traNumber'] . "手\n成交金额: " . $content['traAmount'] . "万元\r\n"; $str .= '如需查询其它股票,请在菜单再次点击"股票查询"重新进入查询'; $this->replyText($str); } } elseif ($keywordArr['keyword'] == '黄金') { if ($dataArr['Content'] == $keywordArr['keyword']) { $url = 'http://web.juhe.cn:8080/finance/gold/shgold?key=' . $config['gold']; $content = file_get_contents($url); addWeixinLog($content, $url); $content = json_decode($content, true); $keywordArr['content'] = $content['result'][0]; $str = "请输入以下列表前的编号查询,如要查询品种为 Ag(T+D)的情况,回复:1\r\n"; $accept['type'] = 'array'; foreach ($keywordArr['content'] as $key => $vo) { $str .= $key . ': ' . $vo['variety'] . "\n"; $accept['data'][] = $key; } $keywordArr['accept'] = $accept; set_user_status('Juhe', $keywordArr); $this->replyText($str); } else { $vo = $keywordArr['content'][$dataArr['Content']]; $str = "品种: " . $vo['variety'] . "\n最新价: " . $vo['latestpri'] . "\n开盘价: " . $vo['openpri'] . "\n最高价: " . $vo['maxpri'] . "\n最低价: " . $vo['minpri'] . "\n涨跌幅: " . $vo['limit'] . "\n昨收价: " . $vo['yespri'] . "\n总成交量: " . $vo['totalvol'] . "\r\n"; $str .= '如需查询其它黄金品种,请在菜单再次点击"黄金数据"重新进入查询'; $this->replyText($str); } } elseif ($keywordArr['keyword'] == '货币汇率') { $url = 'http://web.juhe.cn:8080/finance/exchange/rmbquot?key=' . $config['exchange']; $content = file_get_contents($url); $content = json_decode($content, true); $content = $content['result'][0]; $str = "货币 : 中间价\r\n"; foreach ($content as $vo) { $str .= $vo['name'] . ' :' . $vo['bankConversionPri'] . "\n"; } $this->replyText($str); } }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Cjcx'); // 获取后台插件的配置参数 //dump($config); $map['openid'] = get_openid(); $map['token'] = get_token(); $user = M('swuser')->where($map)->find(); $text = $this->formText($user, $config); $this->replyText($text); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Help'); // 获取后台插件的配置参数 //$this->replyText(json_encode($config)); if (!$config['help']) { return false; } $articles[0] = array('Title' => '诺言@微信客服中心', 'Description' => '客户体验中,那瞬间的美感离不开我们的态度!', 'PicUrl' => SITE_URL . '/Addons/Help/View/default/Public/imgs/cs.png', 'Url' => addons_url('Inn://Book/cs')); $res = $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Donations'); // 获取后台插件的配置参数 //dump($config); $param['token'] = get_token(); $param['openid'] = get_openid(); $picurl = get_cover_url($config['cover']); $url = addons_url('Donations://Donations/index', $param); $articles[0] = array('Title' => $config['title'], 'Description' => $config['desc'], 'PicUrl' => $picurl, 'Url' => $url); $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Jianzhi'); // 获取后台插件的配置参数 //dump($config); $param['token'] = get_token(); $param['openid'] = get_openid(); $url = addons_url('Jianzhi://Jianzhi/index', $param); $picurl = $config['cover'] ? get_cover_url($config['cover']) : 'http://img.wdjimg.com/mms/icon/v1/e/08/0f7cb18996b23754fed4b5fed2ff808e_256_256.png'; $articles[0] = array('Title' => $config['title'], 'Description' => $config['desc'], 'PicUrl' => $picurl, 'Url' => $url); $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('WeiSite'); // 获取后台插件的配置参数 // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统 $param['token'] = get_token(); $param['openid'] = get_openid(); $url = addons_url('WeiSite://WeiSite/index', $param); // 组装微信需要的图文数据,格式是固定的 $articles[0] = array('Title' => $config['title'], 'Description' => $config['info'], 'PicUrl' => get_cover_url($config['cover']), 'Url' => $url); $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Card'); // 获取后台插件的配置参数 // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统 $param['token'] = get_token(); $param['openid'] = get_openid(); $url = addons_url('Card://Card/show', $param); // 组装微信需要的图文数据,格式是固定的 $articles[0] = array('Title' => $config['title'], 'Description' => $config['address'], 'PicUrl' => SITE_URL . '/Addons/Card/View/default/Public/cover.png', 'Url' => $url); $this->replyNews($articles); }
function reply($dataArr, $keywordArr = array()) { $config = getAddonConfig('Hotel'); // 获取后台插件的配置参数 $hotel = M('hotel')->where(array('token' => get_token()))->find(); if ($hotel) { $url = addons_url('Hotel://Web/index', array('token' => get_token(), 'openid' => get_openid())); $articles[0] = array('Title' => $hotel['name'], 'Description' => $hotel['name'] . "\n电话:" . $hotel['tel'] . "\n地址:" . $hotel['address'] . "\n点击进入在线订房。", 'PicUrl' => get_cover_url($hotel['image']), 'Url' => $url); $this->replyNews($articles); } else { $this->replyText('亲,老板正在配置酒店,请稍后再来...'); } }