private function formText($user, $config)
 {
     if (!$user) {
         return '请先回复绑定并绑定真实信息以使用本功能.';
     }
     if ($user['user_type'] == 1) {
         return '老师是没有考试安排的0.0';
     } else {
         $textArr = array();
         $userSchedules = M('ksap')->where(array('school_id' => $user['school_id'], 'term' => $config['term']))->select();
         if (0 == count($userSchedules)) {
             return "空记录! 还没更新呢!";
         }
         foreach ($userSchedules as $item) {
             $_t = '';
             $_t .= "科目: {$item['course']},\n";
             $_t .= "日期: {$item['date']}, \n";
             $_t .= "时间: {$item['time']},\n";
             $_t .= "教室: {$item['room']}";
             array_push($textArr, $_t);
         }
         $basic = implode("\n\n", $textArr);
         $params['openid'] = get_openid();
         $params['token'] = get_token();
         $more = "\n\n" . "<a href='" . addons_url("Ksap://Ksap/center", $params) . "'>查看完整记录</a>";
         return $basic . $more;
     }
 }
 public function search()
 {
     $openid = get_openid();
     $map['openid'] = $openid;
     $res = $this->where($map)->select();
     return $res;
 }
 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);
     }
 }
 function getid($port, $passwd)
 {
     $param['openid'] = get_openid();
     $param['token'] = get_token();
     $res = $this->where($param)->select();
     return $res['uid'];
 }
 public function indexAction()
 {
     //获取支付编号
     //取付款金额
     $payid = I('get.payid', '');
     if ($payid == '') {
         $this->assign('msg', '支付失败!');
     } else {
         $payM = new OrderRelationModel();
         $res = $payM->getPay($payid);
         $customer = new CustomerModel();
         $key = 'buy_openid';
         $customerInfo = $customer->getCustomerInfo($res[$key]);
         $this->assign('freezen_state', $customerInfo['freezen_state']);
         $pay = $res['payable'];
         $indexUrl = U('Home/Index/index');
         $wxPayUrl = U('WxPay/Pay/payNow');
         $wxPayUrl .= "?payid=" . $payid;
         $introductionM = new IntroductionModel();
         $id = 4;
         $tips = $introductionM->getInfoById($id);
         $this->assign('tips', $tips['content']);
         $openid = get_openid();
         $css = $this->fetch('indexCss');
         $js = $this->fetch('js');
         $this->assign('indexUrl', $indexUrl);
         $this->assign('wxPay', $wxPayUrl);
         $this->assign('pay', $pay);
         $this->assign('css', $css);
         $this->assign('js', $js);
         $this->assign("YZBody", $this->fetch());
         $this->display(YZ_TEMPLATE);
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->token = get_token();
     $this->wecha_id = get_openid();
     // 读取配置
     $pay_config_db = M('payment_set');
     $paymentSet = $pay_config_db->where(array('token' => $this->token))->find();
     if ($paymentSet['wx_cert_pem'] && $paymentSet['wx_key_pem']) {
         $ids[] = $paymentSet['wx_cert_pem'];
         $ids[] = $paymentSet['wx_key_pem'];
         $map['id'] = array('in', $ids);
         $fileData = M('file')->where($map)->select();
         $downloadConfig = C(DOWNLOAD_UPLOAD);
         foreach ($fileData as $f) {
             if ($paymentSet['wx_cert_pem'] == $f['id']) {
                 $certpath = SITE_PATH . str_replace('/', '\\', substr($downloadConfig['rootPath'], 1) . $f['savepath'] . $f['savename']);
             } else {
                 $keypath = SITE_PATH . str_replace('/', '\\', substr($downloadConfig['rootPath'], 1) . $f['savepath'] . $f['savename']);
             }
         }
         $paymentSet['cert_path'] = $certpath;
         $paymentSet['key_path'] = $keypath;
     }
     $this->payConfig = $paymentSet;
     session('paymentinfo', $this->payConfig);
 }
 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;
 }
 public function index()
 {
     // 删除微信传递的token干扰
     unset($_REQUEST['token']);
     $weixin = D('Weixin');
     // 获取数据
     $data = $weixin->getData();
     $this->data = $data;
     if (!empty($data['ToUserName'])) {
         get_token($data['ToUserName']);
     }
     if (!empty($data['FromUserName'])) {
         get_openid($data['FromUserName']);
     }
     $this->token = $data['ToUserName'];
     // 记录日志
     addWeixinLog($data, $GLOBALS['HTTP_RAW_POST_DATA']);
     // 初始化用户
     $data['ToUserName'] == 'gh_3c884a361561' || $this->init_follow($data);
     // 回复数据
     $this->reply($data, $weixin);
     // 客服接口群发消息:未发送成功的消息给用户重新发
     $this->sendOldMessage($data['ToUserName'], $data['FromUserName']);
     // 结束程序。防止oneThink框架的调试信息输出
     exit;
 }
Beispiel #10
0
 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发送【点歌+歌曲名】点歌");
     }
 }
 public function consumption()
 {
     $sqm = 'HDLYY-WXKF00001';
     $ywlx = '1';
     $serviceid = 'GetPatItemFee';
     // 构造xml
     $openid = get_openid();
     // get inhospno and name
     $Order = M("Userinfo");
     $where['openid'] = $openid;
     $dataOrder = $Order->where($where)->find();
     $url = U('/addon/Order/Order/binding');
     if (!$dataOrder['name']) {
         // header("Location:$url") ;
     }
     //301
     if (!empty($dataOrder['lyh'])) {
         $inhospno = $dataOrder['lyh'];
         $name = $dataOrder['name'];
     } else {
         // test value 测试数据
     }
     // constitution 构造
     $getxml = $this->buildInstr($inhospno, $name);
     $instr = $getxml;
     $getres = $this->GetHisService($sqm, $ywlx, $serviceid, $instr, $inhospno, $name);
     // format xml to array 转换xml成array$name);
     // format xml to array 转换xml成array
     $resArr = $this->xml_to_array($getres);
     // get reality content 获取主体内容
     $reportArr = $resArr['body']['PatFee']['Record'];
     /* var_dump($getres);exit();  */
     $this->assign('xml', $reportArr);
     $this->display();
 }
 private function formText($user, $config)
 {
     if (!$user) {
         return '请先回复绑定并绑定真实信息以使用本功能.';
     }
     if ($user['user_type'] == 1) {
         return '老师是没有考试成绩的0.0';
     } else {
         $textArr = array();
         $userGrades = M('cjcx')->where(array('school_id' => $user['school_id'], 'term' => $config['term']))->select();
         if (0 == count($userGrades)) {
             return "空记录! 还没有更新呢!";
         }
         foreach ($userGrades as $item) {
             $_t = '';
             $_t .= "课程名称: {$item['course_name']},\n";
             $_t .= "课程属性: {$item['class_type']}, \n";
             $_t .= "学分: {$item['study_score']},\n";
             $_t .= "分数: {$item['stu_grade']}";
             array_push($textArr, $_t);
         }
         $basic = implode("\n\n", $textArr);
         $params['openid'] = get_openid();
         $params['token'] = get_token();
         $more = "\n\n" . "<a href='" . addons_url("Cjcx://Cjcx/center", $params) . "'>查看完整记录</a>";
         return $basic . $more;
     }
 }
 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);
 }
Beispiel #14
0
 function reply($dataArr, $keywordArr = array())
 {
     $param['openid'] = get_openid();
     $param['token'] = get_token();
     $url = addons_url('UserCenter://UserCenter/my', $param);
     $articles[0] = array('Title' => '个人中心', 'Description' => '点此进入', 'PicUrl' => 'http://ipic-ipic.stor.sinaapp.com/original/2ddfdc417b03d7f43bbcb32eba079db0.jpg', 'Url' => $url);
     $this->replyNews($articles);
 }
Beispiel #15
0
 function reply($dataArr, $keywordArr = array())
 {
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     $url = addons_url('Love://Love/show', $param);
     $articles[0] = array('Title' => '微信表白墙', 'Description' => '请勇敢说出你的爱', 'PicUrl' => 'http://pic21.nipic.com/20120519/6589089_105229006397_2.jpg', 'Url' => $url);
     $res = $this->replyNews($articles);
 }
 public function __construct()
 {
     $this->orderRelation = new OrderRelationModel();
     parent::__construct();
     $this->openId = get_openid();
     $custmoer = get_customer_info($this->openId);
     $this->id = $custmoer['id'];
 }
 function _initialize()
 {
     parent::_initialize();
     $openid = get_openid();
     $this->user = getWeixinUserInfo($openid);
     $this->user['uid'] = get_mid();
     $this->assign('user', $this->user);
 }
 public function __construct()
 {
     parent::__construct();
     $openId = get_openid();
     //获取openid
     $customerInfo = get_customer_info($openId);
     $this->customerId = $customerInfo['id'];
 }
 public function __construct()
 {
     $this->token = get_token();
     $this->wecha_id = get_openid();
     // 读取支付配置
     $alipay_config_db = M('payment_set');
     $this->alipayConfig = $alipay_config_db->where(array('token' => $this->token))->find();
 }
 function reply($dataArr, $keywordArr = array())
 {
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     $url = addons_url('Suggestions://Suggestions/suggest', $param);
     $articles[0] = array('Title' => '建议意见', 'Description' => '请点击进入填写反馈内容', 'PicUrl' => 'http://weiphp.cn/Public/Home/images/about/logo.jpg', 'Url' => $url);
     $res = $this->replyNews($articles);
 }
Beispiel #21
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);
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->openid = get_openid();
     if ($this->openid == false) {
         $this->error('非法操作');
     }
     $this->token = get_token();
     $this->data = D('youaskservice_logs');
 }
 function reply($dataArr, $keywordArr = array())
 {
     //$config = getAddonConfig ( 'WeVote' ); // 获取后台插件的配置参数
     //dump($config);
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     $url = addons_url('WeVote://Home/WeVote', $param);
     $articles[0] = array('Title' => '投票', 'Description' => '第一武道会正式开始', 'PicUrl' => ADDON_PUBLIC_PATH . '/images/a.jpg', 'Url' => $url);
     $res = $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);
 }
 public function indexAction()
 {
     $queryAdd = I('get.condition');
     $data = array();
     if (is_numeric($queryAdd)) {
         $openId = get_openid();
         $orderFormModel = new OrderFormModel();
         $orderFormModel->setQueryAdd($queryAdd);
         $orderFormModel->setOpenId($openId);
         $orderForm = $orderFormModel->getOrderFormInfo();
         $num = count($orderForm);
         if ($num < 1) {
             $data['content'] = $this->fetch('noForm');
         } else {
             $orderGoods = new OrderGoodsModel();
             $orderGoods->setOrderForm($orderForm);
             $res = $orderGoods->getOrderGoods();
             $this->assign('res', $res);
             $data['content'] = $this->fetch('list');
         }
         $data['state'] = 0;
         //表示返回的订单信息
     } else {
         $goodsDetailUrl = U('Goods/GoodsDetail/index');
         $this->assign('goodsDetailUrl', $goodsDetailUrl);
         $goodsModel = new GoodsModel();
         $goodsModel->setPageSize($this->pageSize);
         $goodsModel->setName($queryAdd);
         $num = $goodsModel->likeNameCount();
         if ($num == 0) {
             $data['content'] = 'soory';
         } else {
             if ($num > $this->pageSize) {
                 $this->assign('nextPageNum', 2);
                 $data['page'] = $this->fetch('page');
             }
             $res = $goodsModel->goodsList();
             //添加物流方式
             $logistic = new LogisticsModel();
             $key = 'logistics_mode';
             $res = $logistic->getLogisticInfo($res, $key);
             //添加来源
             $source = new SourceModel();
             $key = 'source';
             $keyRes = 'source';
             $res = $source->getInfoById($res, $key, $keyRes);
             $this->assign('list', $res);
             $data['content'] = $this->fetch($this->goodsList);
         }
         $data['state'] = 1;
         //表示返回的商品信息
     }
     $jsonData = json_encode($data);
     echo $jsonData;
 }
 public function indexAction()
 {
     $openid = get_openid();
     $coupon = new CouponModel();
     $unUsedCoupons = $coupon->getUnusedCouponsByOpenid($openid);
     $usedInCoupons = $coupon->getUsedCouponsByOpenid($openid);
     $this->assign('unUsedCoupons', $unUsedCoupons);
     $this->assign('usedInCoupons', $usedInCoupons);
     $this->assign("YZBody", $this->fetch('index'));
     $this->display(YZ_TEMPLATE);
 }
 function getPackageData($id)
 {
     $token = get_token();
     $return['publicInfo'] = $info = $publicInfo = get_token_appinfo($token);
     //$uid = session ( 'mid' );
     $param['publicid'] = $info['id'];
     $param['id'] = $id = I('id');
     $openid = get_openid();
     // $return ['canJoin'] = ! empty ( $openid ) && ! empty ( $token ) && ! ($this->_is_overtime ( $id )) && ! ($this->_is_join ( $id, $uid, $token ));
     return $return;
 }
 public function subscribe($data)
 {
     $scene_qrcode = M('scene_qrcode')->where(array('token' => get_token(), 'ticket' => getRevTicket()))->find();
     $data['token'] = get_token();
     $data['openid'] = get_openid();
     $data['qrcode_id'] = $scene_qrcode['id'];
     $data['scene_name'] = $scene_qrcode['scene_name'];
     $data['keyword'] = $scene_qrcode['keyword'];
     $data['scene_id'] = getRevSceneId();
     $data['scan_type'] = 'subscribe';
     $data['ctime'] = $data['CreateTime'];
     $res = M('scene_qrcode_statistics')->add($data);
     if ($res) {
         $map['title'] = $scene_qrcode['keyword'];
         $map['name'] = $scene_qrcode['scene_str'];
         $map['_logic'] = 'or';
         $where['_complex'] = $map;
         $where['status'] = 1;
         $addonInfo = M('addons')->where($map)->find();
         // 调用插件的关键词回复
         if ($addonInfo) {
             require_once ONETHINK_ADDON_PATH . $addonInfo['name'] . '/Model/WeixinAddonModel.class.php';
             $model = D('Addons://' . $addonInfo['name'] . '/WeixinAddon');
             !method_exists($model, 'reply') || $model->reply($data, $keywordArr);
         }
         // 调用自定义回复插件的回复规则
         $map_r['keyword'] = $scene_qrcode['keyword'];
         $map_r['token'] = get_token();
         $info = M('auto_reply')->where($map_r)->find();
         // replyText(json_encode($info));
         if (!$info) {
             //$this->replyText("根据你发送的语音识别到的关键词是:".$keyword.",系统没有匹配到对应的回复内容,请重新发送");
         } else {
             if ($info['msg_type'] == 'news') {
                 // replyText(json_encode($info));
                 $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') {
                 $this->replyText('image');
             } else {
                 $contetn = replace_url(htmlspecialchars_decode($info['content']));
                 $this->replyText($contetn);
             }
         }
     }
 }
 private function getScore()
 {
     $score = 0;
     $map['openid'] = get_openid();
     $map['token'] = get_token();
     $follow = M('follow')->where($map)->select();
     if ($follow) {
         $score = $follow[0]['score'];
     }
     return $score;
 }
Beispiel #30
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);
 }