Exemplo n.º 1
0
 public function getCommonArticles($extra_int)
 {
     $map['token'] = get_token();
     $extra_int && ($map['id'] = $extra_int);
     $data = M('scratch')->where($map)->order('id desc')->select();
     if (!$data) {
         return true;
     }
     // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统
     //$param ['token'] = get_token ();
     //$param ['openid'] = get_openid ();
     foreach ($data as $key => $vo) {
         $param['id'] = $vo['id'];
         $url = addons_url('Scratch://Scratch/show', $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
     $this->replyNews($articles);
 }
Exemplo n.º 2
0
 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');
 }
Exemplo n.º 3
0
 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);
 }
 public function keyword($params)
 {
     if ($params['mp_id']) {
         $kmap['mp_id'] = $params['mp_id'];
         $kmap['keyword'] = $params['weObj']->getRevContent();
         //TODO:先只支持精确匹配,后续根据keyword_type字段增加模糊匹配
         $Keyword = M('Keyword')->where($kmap)->find();
         if ($Keyword['model'] && $Keyword['aim_id']) {
             //如果有指定模型,就用模型中的aim_id数据组装回复的内容
             $amap['id'] = $Keyword['aim_id'];
             $aimData = M($Keyword['model'])->where($amap)->find();
             $reData[0]['Title'] = $aimData['title'];
             $reData[0]['Description'] = $aimData['intro'];
             $reData[0]['PicUrl'] = get_cover_url($aimData['cover']);
             //'http://images.domain.com/templates/domaincom/logo.png';
             $reData[0]['Url'] = $aimData['url'];
             trace('wechat:keyword' . get_cover_url($aimData['cover']), '微信', 'DEBUG', true);
             $params['weObj']->news($reData);
         } elseif ($Keyword['addon']) {
             //TODO:没有指定模型,就用addon的配置信息组装回复的内容
             $amap['name'] = $Keyword['addon'];
             $aimData = M('Addons')->where($amap)->find();
             //插件信息组装回复,当然插件需要先安装了
             $reData[0]['Title'] = $aimData['title'];
             $reData[0]['Description'] = $aimData['description'];
             $reData[0]['PicUrl'] = get_addoncover_url($Keyword['addon']);
             //插件目录下放个回复封面图片例如jssdk插件中的cover.png
             $param['mp_id'] = $params['mp_id'];
             $reData[0]['Url'] = get_addonreply_url($Keyword['addon'], $param);
             $params['weObj']->news($reData);
         }
     } else {
     }
     // $params['weObj']->text("hello ");
 }
Exemplo n.º 5
0
 function reply($dataArr, $keywordArr = array())
 {
     $map['id'] = $keywordArr['aim_id'];
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     if ($keywordArr['extra_text'] == 'custom_reply_mult') {
         // 多图文回复
         $mult = M('custom_reply_mult')->where($map)->find();
         $map_news['id'] = array('in', $mult['mult_ids']);
         $list = M('custom_reply_news')->where($map_news)->select();
         foreach ($list as $k => $info) {
             if ($k > 8) {
                 continue;
             }
             $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         }
         $res = $this->replyNews($articles);
     } elseif ($keywordArr['extra_text'] == 'custom_reply_news') {
         // 单条图文回复
         $info = M('custom_reply_news')->where($map)->find();
         // 组装微信需要的图文数据,格式是固定的
         $articles[0] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         $res = $this->replyNews($articles);
     } else {
         // 增加积分
         add_credit('custom_reply', 300);
         // 文本回复
         $info = M('custom_reply_text')->where($map)->find();
         $contetn = replace_url(htmlspecialchars_decode($info['content']));
         $this->replyText($contetn);
     }
 }
Exemplo n.º 6
0
 function reply($dataArr, $keywordArr = array())
 {
     $map['token'] = get_token();
     $keywordArr['aim_id'] && ($map['id'] = $keywordArr['aim_id']);
     $data = M('sendredpack')->where($map)->order('id desc')->select();
     foreach ($data as $key => $vo) {
         $param['id'] = $vo['id'];
         $url = addons_url('Sendredpack://Sendredpack/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,当前无红包活动!');
     }
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
 function reply($dataArr, $keywordArr = array())
 {
     $map['id'] = $keywordArr['aim_id'];
     $info = M('auto_reply')->where($map)->find();
     if ($info['msg_type'] == 'news') {
         $map_news['group_id'] = $info['group_id'];
         $list = M('material_news')->where($map_news)->select();
         $param['publicid'] = get_token_appinfo('', 'id');
         foreach ($list as $k => $vo) {
             if ($k > 8) {
                 continue;
             }
             $articles[] = array('Title' => $vo['title'], 'Description' => $vo['intro'], 'PicUrl' => get_cover_url($vo['cover_id']), 'Url' => $this->_getNewsUrl($vo, $param));
         }
         $res = $this->replyNews($articles);
     } elseif ($info['msg_type'] == 'image') {
         if ($info['image_id']) {
             // 				$d['image_id']=url_img_html(get_cover_url($d['image_id']));
             $media_id = D('Common/Custom')->get_image_media_id($info['image_id']);
         } else {
             if ($info['image_material']) {
                 $map2['id'] = $info['image_material'];
                 $media_img = M('material_image')->where($map2)->find();
                 $media_id = $media_img['image_id'];
                 if (!$media_id) {
                     $media_id = D('Common/Custom')->get_image_media_id($media_img['cover_id']);
                 }
             }
         }
         $this->replyImage($media_id);
     } else {
         $contetn = replace_url(htmlspecialchars_decode($info['content']));
         $this->replyText($contetn);
     }
 }
 function getList($sportsId, $update = false)
 {
     $key = 'LotteryPrizeList_getList_' . $sportsId;
     $info = S($key);
     if ($info === false || $update) {
         $map['sports_id'] = $sportsId;
         $map['uid'] = session('manager_id');
         if (empty($map['uid'])) {
             $map['uid'] = get_mid();
         }
         $info = (array) $this->where($map)->select();
         $awardDao = D('Addons://Draw/Award');
         if (count($info) != 0) {
             foreach ($info as &$v) {
                 $award = $awardDao->getInfo($v['award_id']);
                 $v['awardarr'] = $award;
                 $v['award_name'] = $award['name'];
                 $v['award_pic'] = get_cover_url($award['img']);
             }
         }
         //             $info['awardarr']=M('Award')->getInfo($info['sports_id']);
         //             $info['sports']=M('Addons://Sports/Sports')->getInfo($info['sports_id']);
         S($key, $info, 86400);
     }
     return $info;
 }
 public function lists()
 {
     D('Addons://Shop/Order')->autoSetFinish();
     $this->assign('add_button', false);
     $this->assign('del_button', false);
     $this->assign('check_all', false);
     $map['token'] = get_token();
     $map['shop_id'] = $this->shop_id;
     $search = $_REQUEST['order_number'];
     if ($search) {
         $this->assign('search', $search);
         $map1['nickname'] = array('like', '%' . htmlspecialchars($search) . '%');
         $nickname_follow_ids = D('Common/User')->where($map1)->getFields('uid');
         $nickname_follow_ids = implode(',', $nickname_follow_ids);
         if (!empty($nickname_follow_ids)) {
             $map['uid'] = array('exp', ' in (' . $nickname_follow_ids . ') ');
         } else {
             $map['order_number'] = array('like', '%' . htmlspecialchars($search) . '%');
         }
         unset($_REQUEST['order_number']);
     }
     session('common_condition', $map);
     $list_data = $this->_get_model_list($this->model);
     // 分类数据
     $map['is_show'] = 1;
     $list = M('weisite_category')->where($map)->field('id,title')->select();
     $cate[0] = '';
     foreach ($list as $vo) {
         $cate[$vo['id']] = $vo['title'];
     }
     $orderDao = D('Addons://Shop/Order');
     // dump($list_data ['list_data']);
     foreach ($list_data['list_data'] as &$vo) {
         $param['id'] = $vo['id'];
         $order = $orderDao->getInfo($vo['id']);
         // dump($order);
         $vo = array_merge($vo, $order);
         $follow = get_followinfo($vo['uid']);
         $param2['uid'] = $follow['uid'];
         $vo['uid'] = '<a target="_blank" href="' . addons_url('UserCenter://UserCenter/detail', $param2) . '">' . $follow['nickname'] . '</a>';
         $vo['cate_id'] = intval($vo['cate_id']);
         $vo['cate_id'] = $cate[$vo['cate_id']];
         $goods = json_decode($order['goods_datas'], true);
         foreach ($goods as $vv) {
             $vo['goods'] .= '<img width="50" style="vertical-align:middle;margin:0 10px 0 0" src="' . get_cover_url($vv['cover']) . '"/>' . $vv['title'] . '<br><br>';
         }
         $vo['goods'] = rtrim($vo['goods'], '<br><br>');
         $vo['order_number'] = '<a href="' . addons_url('Shop://Order/detail', $param) . '">' . $vo['order_number'] . '</a>';
         $vo['action'] = '<a href="' . addons_url('Shop://Order/detail', $param) . '">详情</a>';
         if ($vo['status_code'] == 1) {
             $vo['action'] .= '<br><br><a href="' . addons_url('Shop://Order/set_confirm', $param) . '">商家确认</a>';
         }
     }
     // dump($list_data ['list_data'] );
     $this->assign($list_data);
     // dump ( $list_data );
     $templateFile = $this->model['template_list'] ? $this->model['template_list'] : '';
     $this->display($templateFile);
 }
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 12
0
 function get_list($map)
 {
     $map['token'] = get_token();
     $list = $this->where($map)->order('pid asc, sort asc')->select();
     foreach ($list as &$vo) {
         $vo['icon'] = get_cover_url($vo['icon']);
     }
     return $list;
 }
Exemplo n.º 13
0
 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);
 }
Exemplo n.º 14
0
 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);
 }
Exemplo n.º 15
0
 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);
 }
Exemplo n.º 16
0
 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);
 }
Exemplo n.º 17
0
 public function lists()
 {
     $map['token'] = get_token();
     session('common_condition', $map);
     $list_data = $this->_get_model_list($this->model);
     foreach ($list_data['list_data'] as &$vo) {
         $vo['img'] = '<img src="' . get_cover_url($vo['img']) . '" width="50px" >';
     }
     $this->assign($list_data);
     //dump ( $list_data );
     $templateFile = $this->model['template_list'] ? $this->model['template_list'] : '';
     $this->display($templateFile);
 }
Exemplo n.º 18
0
 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('亲,老板正在配置酒店,请稍后再来...');
     }
 }
Exemplo n.º 19
0
 function _initialize()
 {
     parent::_initialize();
     $controller = strtolower(_CONTROLLER);
     /*
      * $res ['title'] = '微网设置';
      * $res ['url'] = addons_url ( 'WeiSite://WeiSite/config' );
      * $res ['class'] = $controller == 'weisite' ? 'current' : '';
      * $nav [] = $res;
      *
      * $res ['title'] = '分类管理';
      * $res ['url'] = addons_url ( 'WeiSite://Category/lists' );
      * $res ['class'] = $controller == 'category' ? 'current' : '';
      * $nav [] = $res;
      *
      * $res ['title'] = '首页幻灯片';
      * $res ['url'] = addons_url ( 'WeiSite://Slideshow/lists' );
      * $res ['class'] = $controller == 'slideshow' ? 'current' : '';
      * $nav [] = $res;
      *
      * $res ['title'] = '底部导航';
      * $res ['url'] = addons_url ( 'WeiSite://Footer/lists' );
      * $res ['class'] = $controller == 'footer' ? 'current' : '';
      * $nav [] = $res;
      *
      * $res ['title'] = '文章管理';
      * $res ['url'] = addons_url ( 'WeiSite://Cms/lists' );
      * $res ['class'] = $controller == 'cms' ? 'current' : '';
      * $nav [] = $res;
      *
      * $res ['title'] = '模板管理';
      * $res ['url'] = addons_url ( 'WeiSite://Template/index' );
      * $res ['class'] = $controller == 'template' ? 'current' : '';
      * $nav [] = $res;
      */
     $this->assign('nav', array());
     $config = getAddonConfig('WeiSite');
     $config['cover_url'] = get_cover_url($config['cover']);
     $config['background_id'] = $config['background'];
     $config['background'] = get_cover_url($config['background']);
     $this->config = $config;
     $this->assign('config', $config);
     // dump ( $config );
     // dump(get_token());
     // 定义模板常量
     $act = strtolower(_ACTION);
     $temp = $config['template_' . $act];
     $act = ucfirst($act);
     $this->assign('page_title', $config['title']);
     define('CUSTOM_TEMPLATE_PATH', ONETHINK_ADDON_PATH . 'WeiSite/View/default/Template');
 }
Exemplo n.º 20
0
 function reply($dataArr, $keywordArr = array())
 {
     $config = getAddonConfig('MoonEating');
     // 获取后台插件的配置参数
     //dump($config);
     //$url = addons_url( 'Dreammore://Dreammore/index', array('openid'=>get_openid(), 'token'=>get_token()) );
     //$this->replyText( $config['title'] );
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     $picurl = get_cover_url($config['cover']);
     $url = addons_url('MoonEating://MoonEating/index', $param);
     $articles[0] = $arrayName = array('Title' => $config['title'], 'Description' => $config['desc'], 'PicUrl' => $picurl, 'Url' => $url);
     $this->replyNews($articles);
 }
Exemplo n.º 21
0
 function image()
 {
     $list_data = $this->_get_data('image');
     unset($list_data['list_grids']['group_id'], $list_data['list_grids']['content']);
     foreach ($list_data['list_data'] as &$d) {
         $map2['id'] = $d['image_id'];
         $url = M('material_image')->where($map2)->getField('cover_url');
         // $d ['image_id'] = url_img_html ( $url );
         $d['image_id'] = url_img_html(get_cover_url($d['image_id']));
     }
     $this->assign($list_data);
     // dump($list_data);
     $this->display('lists');
 }
Exemplo n.º 22
0
 function show()
 {
     $config = getAddonConfig('LostAndFound');
     $config['img'] = get_cover_url($config['img']);
     $this->assign('config', $config);
     $tpl = 'show';
     $map['uid'] = $this->mid;
     $info = M('laf_user')->where($map)->find();
     if ($info) {
         $tpl = 'index';
         $this->assign('info', $info);
     }
     $this->display($tpl);
 }
Exemplo n.º 23
0
 public function lists()
 {
     $map['token'] = get_token();
     session('common_condition', $map);
     $list_data = $this->_get_model_list($this->model);
     foreach ($list_data['list_data'] as &$vo) {
         $src = get_cover_url($vo['icon']);
         $vo['icon'] = empty($src) ? '' : '<img style="background:#ddd" src="' . $src . '" width="50px" >';
     }
     $this->assign($list_data);
     //dump ( $list_data );
     $templateFile = $this->model['template_list'] ? $this->model['template_list'] : '';
     $this->display($templateFile);
 }
Exemplo n.º 24
0
 function get_list($map)
 {
     $map['token'] = get_token();
     $list = $this->where($map)->order('pid asc, sort asc')->select();
     foreach ($list as &$vo) {
         $vo['icon'] = get_cover_url($vo['icon']);
         if ($vo['icon']) {
             $vo['icon'] = '<img src="' . $vo['icon'] . '" >';
         } else {
             $vo['icon'] = '';
         }
     }
     return $list;
 }
Exemplo n.º 25
0
 public function downMedia()
 {
     $media_id = I('media_id');
     $cover_id = down_media($media_id);
     if ($cover_id) {
         $res['errcode'] = 40001;
         $res['errmsg'] = 'download picture success';
         $res['cover_id'] = $cover_id;
         $res['media_id'] = $media_id;
         $res['picture_url'] = get_cover_url($cover_id);
     } else {
         $res['errcode'] = 40002;
         $res['errmsg'] = 'download picture fail';
     }
     echo json_encode($res);
 }
 function reply($dataArr, $keywordArr = array())
 {
     if (!empty($keywordArr['aim_id'])) {
         $map['id'] = $keywordArr['aim_id'];
         $info = M('invite')->where($map)->find();
     } else {
         $info = M('invite')->order('id desc')->find();
     }
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     $param['id'] = $info['id'];
     $url = addons_url('Invite://Wap/receive', $param);
     // 组装微信需要的图文数据,格式是固定的
     $articles[0] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $url);
     $res = $this->replyNews($articles);
 }
Exemplo n.º 27
0
 public function scan()
 {
     $config = getAddonConfig('Liuyanban');
     // 获取后台插件的配置参数
     $param['token'] = get_token();
     //获取当前公众号的token
     $param['openid'] = get_openid();
     //获取当前用户的openid
     $url = addons_url('Liuyanban://Liuyanban/index', $param);
     //生成微信回复图文消息跳转链接
     $picurl = $config['cover'] ? get_cover_url($config['cover']) : $config['cover_url'];
     //生成微信回复图文消息封面图片地址
     $articles[0] = array('Title' => $config['title'], 'Description' => $config['desc'], 'PicUrl' => $picurl, 'Url' => $url);
     $this->replyNews($articles);
     return true;
 }
Exemplo n.º 28
0
 function subscribe($dataArr)
 {
     //-------------
     unset($map);
     unset($data);
     $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']);
     //$this->replyText(json_encode($config));
     switch ($config['type']) {
         case '4':
             //多图文回复
             $map['id'] = $config['mult_id'];
             $mult = M('custom_reply_mult')->where($map)->find();
             $map_news['id'] = array('in', $mult['mult_ids']);
             $list = M('custom_reply_news')->where($map_news)->order('sort asc')->select();
             foreach ($list as $k => $info) {
                 if ($k > 8) {
                     continue;
                 }
                 $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
             }
             $res = $this->replyNews($articles);
             break;
         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;
 }
Exemplo n.º 29
0
 function reply($dataArr, $keywordArr = array())
 {
     $config = getAddonConfig('Academic');
     // 获取后台插件的配置参数
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     //初始化查找条件,56,57,。。。60分别为E学术几个固定的图文项
     $map_news['id'] = array('in', array(56, 57, 58, 59, 60));
     $list = M('custom_reply_news')->where($map_news)->select();
     foreach ($list as $k => $info) {
         if ($k > 8) {
             continue;
         }
         $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => addons_url($info['jump_url'], $param));
     }
     $res = $this->replyNews($articles);
 }
Exemplo n.º 30
0
 function getInfo($id, $update = false, $data = array())
 {
     $key = 'Goods_getInfo_' . $id;
     $info = S($key);
     if ($info === false || $update) {
         $info = (array) (empty($data) ? $this->find($id) : $data);
         if (!isset($info['imgs_url']) && !empty($info['imgs'])) {
             $imgs = array_filter(explode(',', $info['imgs']));
             foreach ($imgs as $img) {
                 $imgs_url[] = get_cover_url($img);
             }
             $info['imgs_url'] = array_filter($imgs_url);
         }
         S($key, $info);
     }
     return $info;
 }