Example #1
0
 public function get_authtoken($node, $openid)
 {
     $data = array('api_id' => $this->module['config']['authid'], 'api_key' => $this->module['config']['authkey'], 'node' => $node, 'openid' => $openid);
     $auth_token = ihttp_post($this->get_auth_token, json_encode($data));
     $auth_token = json_decode($auth_token['content'], true);
     return $auth_token;
 }
Example #2
0
 public function receive()
 {
     global $_W;
     $type = $this->message['type'];
     //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
     if ($type != "text" && $type != "image" && $type != "voice") {
         return;
     }
     $file = IA_ROOT . '/source/modules/mechat/function.php';
     if (!file_exists($file)) {
         return array();
     }
     include_once $file;
     $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
     $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
     if ($row) {
         $pdata = array("ToUserName" => $this->message['tousername'], "FromUserName" => $this->message['fromusername'], "CreateTime" => $this->message['createtime'], "MsgType" => $this->message['msgtype'], "Content" => $this->message['content'], "MsgId" => $this->message['msgid']);
         if ($type == "voice") {
             $pdata["MsgType"] = "text";
             $pdata["Content"] = "系统:微信公众号粉丝发送语音消息,系统暂不能接收请客服处理。";
         }
         $dat = array('unit' => $row["name"], 'msg' => json_encode($pdata));
         $dat2 = iunserializer($row["cdata"]);
         $actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $dat2["access_token"], "appid" => $dat2["appid"], "appsecret" => $dat2["appsecret"]));
         $url = sprintf($this->gateway['mechat_receive'], $actoken);
         $content = ihttp_post($url, $dat);
     }
 }
 private function xiaojo()
 {
     $data = array('chat' => $this->message['content'] . "^" . time(), 'db' => $this->module['config']['xjdb'], 'pw' => $this->module['config']['xjpw'], 'from' => $this->message['from'], 'to' => $this->message['to']);
     $api = "http://www.xiaojo.com/api5.php";
     $data = ihttp_post($api, $data);
     return $data;
 }
Example #4
0
 private function GetRouterInter($jktype, $postarr)
 {
     $arrResult = array('flag' => 0, 'result' => '', 'token' => '', 'debug' => '');
     $url = $this->jk_url[$jktype];
     $jsnpostarr = json_encode($postarr);
     load()->func('communication');
     $rsp = ihttp_post($url, $jsnpostarr);
     $dat = $rsp['content'];
     //获取接口情况
     if (!empty($dat)) {
         $result = json_decode($dat, true);
         if (!is_array($result)) {
             $arrResult['flag'] = 0;
             $arrResult['result'] = '接口返回参数不是JSON格式';
             $arrResult['debug'] = $dat;
         } else {
             if ($result[$this->jk_ret_par[$jktype][0]] == 0) {
                 $arrResult['flag'] = 1;
                 $arrResult['result'] = $result[$this->jk_ret_par[$jktype][1]];
             } elseif ($result[$this->jk_ret_par[$jktype][0]] < 0) {
                 $arrResult['flag'] = -1;
                 $arrResult['result'] = $this->errcodetrans($result[$this->jk_ret_par[$jktype][2]]);
                 $arrResult['debug'] = $jsnpostarr;
             } else {
                 $arrResult['flag'] = 0;
                 $arrResult['result'] = '返回状态异常,请联系路由器接口提供方';
             }
         }
     } else {
         $arrResult['flag'] = 0;
         $arrResult['result'] = '接口无响应';
         $arrResult['debug'] = $url;
     }
     return $arrResult;
 }
Example #5
0
 public function getnode_info($node)
 {
     $node = intval($node);
     $data = array('api_id' => $this->module['config']['nodeid'], 'api_key' => $this->module['config']['nodekey'], 'node' => $node);
     $item = ihttp_post($this->retrieve_node, json_encode($data));
     $item = json_decode($item['content'], true);
     return $item;
 }
 public function menuCreate($menu)
 {
     $dat = json_encode($menu);
     $dat = urldecode($dat);
     $token = $this->fetch_token();
     $url = "https://api.yixin.im/cgi-bin/menu/create?access_token={$token}";
     $content = ihttp_post($url, $dat);
     return $this->menuResponseParse($content);
 }
Example #7
0
 public function doDisplay()
 {
     //这个操作被定义用来呈现主导航栏上扩展菜单,每个模块只能呈现一个扩展菜单,有更多选项,请在页面内使用标签页来表示
     global $_W, $_GPC;
     $mechat = array();
     if (checksubmit('submit')) {
         $file = IA_ROOT . '/source/modules/mechat/function.php';
         if (!file_exists($file)) {
             return array();
         }
         include_once $file;
         $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
         $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
         if ($row) {
             $dat = iunserializer($row["cdata"]);
             $pass = $dat["pass"];
             if ($_GPC['mechat-pass'] != $pass) {
                 $pass = md5($_GPC['mechat-pass']);
             }
             $mechat = array("name" => $_GPC['mechat-user'], "pass" => $pass, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']);
             $access_token = array("token" => $dat["access_token"]["token"], "expire" => $dat["access_token"]["expire"]);
             $update = array("name" => $_GPC['mechat-user'], "cdata" => iserializer($mechat), "access_token" => $access_token);
             pdo_update($this->tablename, $update, array('weid' => $_W['weid']));
         } else {
             $pass = md5($_GPC['mechat-pass']);
             $mechat = array("name" => $_GPC['mechat-user'], "pass" => $pass, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']);
             $access_token = array("token" => "", "expire" => "");
             pdo_insert($this->tablename, array("weid" => $_W['weid'], "name" => $_GPC['mechat-user'], "cdata" => iserializer($mechat), "access_token" => $access_token, "createtime" => TIMESTAMP));
         }
         //exit(json_encode($_W));
         $dat = array("unit" => $_GPC['mechat-user'], "password" => $pass, "wxAppid" => $_W['account']['key'], "wxAppsecret" => $_W['account']['secret']);
         $actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $access_token, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']));
         $url = sprintf("http://open.mobilechat.im/cgi-bin/weixin/bind?access_token=%s", $actoken);
         $content = ihttp_post($url, $dat);
         $dat2 = $content['content'];
         $result = @json_decode($dat2, true);
         if ($result["errcode"] == "0") {
             message('恭喜,微信服务号与美洽企业帐号绑定成功!', create_url('index/module/display', array('name' => 'mechat')), 'success');
         } else {
             message("微信服务号与美洽企业帐号绑定错误. <br />参数: " . json_encode($dat) . "<br />错误代码为: {$result['errcode']} <br />错误信息为: {$result['errmsg']}");
         }
     }
     $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
     $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
     if ($row) {
         $mechat["name"] = $row["name"];
         $dat = iunserializer($row["cdata"]);
         $mechat["pass"] = $dat["pass"];
         $mechat["appid"] = $dat["appid"];
         $mechat["appsecret"] = $dat["appsecret"];
     }
     include $this->template('display');
 }
 private function notify($params)
 {
     $access = $this->fetchAccess();
     $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access;
     $params = json_encode($params);
     $content = ihttp_post($url, $params);
     if (is_error($content)) {
         return $content;
     } else {
         return @json_decode($content['content'], true);
     }
 }
Example #9
0
 public function Seed_tmplmsg($openid, $tmplmsgid, $rid, $params)
 {
     global $_W;
     $reply = pdo_fetch("select title,starttime,endtime FROM " . tablename("stonefish_bigwheel_reply") . " where rid = :rid", array(':rid' => $rid));
     $exchange = pdo_fetch("select awardingstarttime,awardingendtime FROM " . tablename("stonefish_bigwheel_exchange") . " where rid = :rid", array(':rid' => $rid));
     $listtotal = pdo_fetchcolumn("select xuninum+fansnum as total from " . tablename("stonefish_bigwheel_reply") . " where rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     $tmplmsg = pdo_fetch("select * FROM " . tablename("stonefish_bigwheel_tmplmsg") . " where id = :id", array(':id' => $tmplmsgid));
     $fans = pdo_fetch("select * FROM " . tablename("stonefish_bigwheel_fans") . " where rid = :rid and from_user = :from_user", array(':rid' => $rid, ':from_user' => $openid));
     $fans['realname'] = empty($fans['realname']) ? stripcslashes($fans['nickname']) : $fans['realname'];
     if (!empty($tmplmsg)) {
         if ($params['do'] == 'index') {
             $appUrl = $this->createMobileUrl('entry', array('rid' => $rid, 'entrytype' => 'index'), true);
         } else {
             $appUrl = $this->createMobileUrl($params['do'], array('rid' => $rid), true);
         }
         $appUrl = $_W['siteroot'] . 'app/' . substr($appUrl, 2);
         $str = array('#活动名称#' => $reply['title'], '#参与人数#' => $listtotal, '#活动时间#' => date('Y-m-d H:i', $reply['starttime']) . '至' . date('Y-m-d H:i', $reply['endtime']), '#兑奖时间#' => date('Y-m-d H:i', $exchange['awardingstarttime']) . '至' . date('Y-m-d H:i', $exchange['awardingendtime']), '#奖品名称#' => $params['prizerating'] . '-' . $params['prizename'], '#粉丝昵称#' => stripcslashes($fans['nickname']), '#真实姓名#' => $fans['realname'], '#现在时间#' => date('Y-m-d H:i', time()), '#奖品数量#' => $params['prizenum']);
         $datas['first'] = array('value' => strtr($tmplmsg['first'], $str), 'color' => $tmplmsg['firstcolor']);
         for ($i = 1; $i <= 10; $i++) {
             if (!empty($tmplmsg['keyword' . $i]) && !empty($tmplmsg['keyword' . $i . 'code'])) {
                 $datas[$tmplmsg['keyword' . $i . 'code']] = array('value' => strtr($tmplmsg['keyword' . $i], $str), 'color' => $tmplmsg['keyword' . $i . 'color']);
             }
         }
         $datas['remark'] = array('value' => strtr($tmplmsg['remark'], $str), 'color' => $tmplmsg['remarkcolor']);
         $data = json_encode($datas);
         load()->func('communication');
         load()->classs('weixin.account');
         $accObj = WeixinAccount::create($_W['acid']);
         $access_token = $accObj->fetch_token();
         if (empty($access_token)) {
             return;
         }
         $postarr = '{"touser":"******","template_id":"' . $tmplmsg['template_id'] . '","url":"' . $appUrl . '","topcolor":"' . $tmplmsg['topcolor'] . '","data":' . $data . '}';
         $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token, $postarr);
         //添加消息发送记录
         $tmplmsgdata = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'from_user' => $openid, 'tmplmsgid' => $tmplmsgid, 'tmplmsg' => $postarr, 'createtime' => TIMESTAMP);
         pdo_insert('stonefish_bigwheel_fanstmplmsg', $tmplmsgdata);
         //添加消息发送记录
         return true;
     }
     return;
 }
Example #10
0
 public function receive()
 {
     global $_W, $_GPC;
     $type = $this->message['type'];
     //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
     $set = $this->module['config'];
     if (!isset($set['guanzhupp'])) {
         $set['guanzhupp'] = '0';
     }
     if (!isset($set['huoyuepp'])) {
         $set['huoyuepp'] = '0';
     }
     if ($set['guanzhupp'] != '0' || $set['huoyuepp'] != '0') {
         $openid = $this->message['fromusername'];
         $atype = 'weixin';
         $account_token = "account_{$atype}_token";
         $account_code = "account_weixin_code";
         $token = $account_token($_W['account']);
         $url = sprintf("https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s&lang=zh_CN", $token, $openid);
         $content = ihttp_get($url);
         $dat = $content['content'];
         $re = @json_decode($dat, true);
         $dataoi['openid'] = $openid;
         $content3 = ihttp_post(sprintf("https://api.weixin.qq.com/cgi-bin/groups/getid?access_token=%s", $token), json_encode($dataoi));
         $groupid = @json_decode($content3['content'], true);
     }
     //退订
     if ($this->message['event'] == 'unsubscribe') {
         pdo_update('fans', array('follow' => 0, 'createtime' => TIMESTAMP), array('from_user' => $this->message['fromusername'], 'weid' => $GLOBALS['_W']['weid']));
     } elseif ($this->message['event'] == 'subscribe' && $set['guanzhupp'] == '0') {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'createtime' => TIMESTAMP));
     } elseif ($set['huoyuepp'] == '0') {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'createtime' => TIMESTAMP));
     } else {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'nickname' => $re['nickname'], 'gender' => $re['sex'], 'groupid' => $groupid['groupid'], 'residecity' => $re['city'], 'resideprovince' => $re['province'], 'nationality' => $re['country'], 'avatar' => $re['headimgurl'], 'createtime' => TIMESTAMP));
     }
 }
Example #11
0
 private function submitNotify()
 {
     $access = $this->core->fetchAccess();
     $pars = array();
     $pars['order_id'] = $this->message['orderid'];
     $url = "https://api.weixin.qq.com/merchant/order/getbyid?access_token={$access}";
     $content = ihttp_post($url, json_encode($pars));
     if (!is_error($content)) {
         $trade = @json_decode($content['content'], true);
         if (is_array($trade) && $trade['errcode'] == '40001') {
             $access = $this->core->fetchAccess(true);
             $url = "https://api.weixin.qq.com/merchant/order/getbyid?access_token={$access}";
             $content = ihttp_post($url, json_encode($pars));
             if (!is_error($content)) {
                 $trade = @json_decode($content['content'], true);
             }
         }
         if (is_array($trade) && $trade['errcode'] == '0') {
             $trade = $this->convertTrade($trade['order']);
             $ret = $this->core->submitNotify($this->message['from'], $trade);
             print_r($ret);
         }
     }
 }
Example #12
0
 public function sendtempmsg($template_id, $url, $data, $topcolor)
 {
     global $_W, $_GPC;
     //取TOKEN
     $from_user = $this->getFromUser();
     //	$tokens= $this->get_weixin_token();
     $tokens = $this->get_weixin_token();
     if (empty($tokens)) {
         return;
     }
     //
     $postarr = '{"touser":"******","template_id":"' . $template_id . '","url":"' . $url . '","topcolor":"' . $topcolor . '","data":' . $data . '}';
     $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $tokens, $postarr);
     //$res = $res['content'];
     //		$res = $res['content'];
     //		$res = json_decode($res, true);
     return true;
 }
Example #13
0
            $id = pdo_insertid();
        } else {
            pdo_update("xcommunity_announcement", $data, array('id' => $id, 'weid' => $_W['weid']));
        }
        //是否启用模板消息
        if ($_GPC['status'] == 2) {
            load()->classs('weixin.account');
            load()->func('communication');
            $obj = new WeiXinAccount();
            $access_token = $obj->fetch_available_token();
            $templates = pdo_fetch("SELECT * FROM" . tablename('xcommunity_notice_setting') . "WHERE uniacid='{$_W['uniacid']}'");
            $key = 'template_id_' . $_GPC['enable'];
            $template_id = $templates[$key];
            $openids = pdo_fetchall("SELECT openid FROM" . tablename('xcommunity_member') . "WHERE weid='{$_W['uniacid']}' AND regionid='{$member['regionid']}'");
            $url = $_W['siteroot'] . "app/index.php?i={$_W['uniacid']}&c=entry&id={$id}&op=detail&do=announcement&m=xfeng_community";
            foreach ($openids as $key => $value) {
                $data = array('touser' => $value['openid'], 'template_id' => $template_id, 'url' => $url, 'topcolor' => "#FF0000", 'data' => array('first' => array('value' => $_GPC['title']), 'time' => array('value' => $_GPC['datetime']), 'location' => array('value' => $_GPC['location']), 'reason' => array('value' => $_GPC['reason']), 'remark' => array('value' => $_GPC['remark'])));
                $json = json_encode($data);
                $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token;
                $ret = ihttp_post($url, $json);
            }
        }
        message('提交成功', $this->createMobileUrl('announcement', array('op' => 'display')), 'success');
    }
} elseif ($op == 'verify') {
    //公告状态
    $status = $_GPC['status'];
    pdo_query("update" . tablename("xcommunity_announcement") . " set status='{$status}' where id =:id and weid=:weid", array(':id' => $id, ':weid' => $_W['weid']));
    message('操作成功', referer(), 'success');
}
include $this->template('announcement');
Example #14
0
 } else {
     if ($op == 'download') {
         $tmpdir = IA_ROOT . '/addons/ewei_shop/' . date('ymd');
         $f = file_get_contents($tmpdir . '/file.txt');
         $upgrade = json_decode($f, true);
         $files = $upgrade['files'];
         $auth = $this->getAuthSet();
         $path = "";
         foreach ($files as $f) {
             if (empty($f['download'])) {
                 $path = $f['path'];
                 break;
             }
         }
         if (!empty($path)) {
             $resp = ihttp_post(EWEI_SHOP_AUTH_URL, array('type' => 'download', 'ip' => $auth['ip'], 'id' => $auth['id'], 'code' => $auth['code'], 'domain' => $auth['domain'], 'path' => $path));
             $ret = @json_decode($resp['content'], true);
             if (is_array($ret)) {
                 $path = $ret['path'];
                 $dirpath = dirname($path);
                 if (!is_dir(IA_ROOT . '/addons/ewei_shop/' . $dirpath)) {
                     mkdirs(IA_ROOT . '/addons/ewei_shop/' . $dirpath, '0777');
                 }
                 $content = base64_decode($ret['content']);
                 file_put_contents(IA_ROOT . '/addons/ewei_shop/' . $path, $content);
                 $success = 0;
                 foreach ($files as &$f) {
                     if ($f['path'] == $path) {
                         $f['download'] = 1;
                         break;
                     }
Example #15
0
 private function destroy_card($content)
 {
     // 获取公众号的 access_token
     load()->classs('weixin.account');
     $access_token = WeiXinAccount::fetch_available_token();
     // 生成post请求的url地址
     $url = 'https://api.weixin.qq.com/card/code/consume?access_token=' . $access_token;
     // post请求的内容
     $posts = '{"code":' . $content . '}';
     // 加载文件: load()→func('communication')
     load()->func('communication');
     // 向处理卡券的模块提交post请求,并返回数据,可以尝试对结果打印
     $result = ihttp_post($url, $posts);
     // print_r($result);
     // 对返回的数据中的['content']进行json_decode处理
     $res = json_decode($result['content'], true);
     // 获取返回的错误码
     $errcode = $res["errcode"];
     // 获取返回的card_id
     $card_id = $res["card_id"];
     // 根据返回的错误码进行相应的处理
     switch ($errcode) {
         case '0':
             $message = '消费成功!卡券信息为:' . $this->reply_kaquanDetail($card_id);
             break;
         case '40099':
             $message = '该卡券已经被销毁!请重新输入' . $str . '进行销卡';
             break;
         case '40078':
             $message = '不合法的卡券状态!请重新输入“销卡”进行销卡';
             break;
         default:
             $message = '出现错误,无法销毁!请重新输入“销卡”进行销卡';
             break;
     }
     $this->endContext();
     // 返回消息内容
     return $this->respText($message);
 }
Example #16
0
     $url = "https://api.weixin.qq.com/shakearound/page/delete?access_token={$token}";
     $pars = array();
     $pars['page_ids'][0] = intval($id);
     $resp = ihttp_post($url, json_encode($pars));
     if (is_error($resp)) {
         return $resp;
     }
     $ret = @json_decode($resp['content'], true);
     if (is_array($ret) && $ret['errcode'] == '0') {
         return true;
     }
     return error(-1, $resp['content']);
 }
 /**
  * 上传图片素材
  * @param $file string 要上传的文件
  * @return string
  */
 public function mediaUpload($file)
 {
     $file = IA_ROOT . '/attachment/' . $file;
     $token = $this->getAccessToken();
     $url = "https://api.weixin.qq.com/shakearound/material/add?access_token={$token}";
     $body = array();
     if (function_exists('curl_file_create')) {
         $body['media'] = curl_file_create($file);
     } else {
         $body['media'] = '@' . $file;
     }
     $resp = @ihttp_request($url, $body);
     if (is_error($resp)) {
         return $resp;
Example #17
0
    public function sendmessage($content, $openid)
    {
        global $_W, $_GPC;
        $weid = $_W['weid'];
        $cfg = $this->module['config'];
        $appid = $cfg['appid'];
        $secret = $cfg['secret'];
        $img = $_W['attachurl'] . $cfg['kefuimg'];
        $id = $_W['openid'];
        //当前粉丝$openid为发送者
        $res = $this->getusers($weid, $id);
        load()->classs('weixin.account');
        $accObj = WeixinAccount::create($_W['account']['acid']);
        $access_token = $accObj->fetch_token();
        $token2 = $access_token;
        $title = $res['nickname'] . '给你发来新消息了!';
        $fans = pdo_fetch('SELECT salt,acid,openid FROM ' . tablename('mc_mapping_fans') . ' WHERE uniacid = :uniacid AND openid = :openid', array(':uniacid' => $weid, ':openid' => $openid));
        $pass['time'] = TIMESTAMP;
        $pass['acid'] = $fans['acid'];
        $pass['openid'] = $fans['openid'];
        $pass['hash'] = md5("{$fans['openid']}{$pass['time']}{$fans['salt']}{$_W['config']['setting']['authkey']}");
        $auth = base64_encode(json_encode($pass));
        $vars = array();
        $vars['__auth'] = $auth;
        $vars['forward'] = base64_encode($this->createMobileUrl('hitmail', array('toname' => $res['nickname'], 'toopenid' => $id)));
        $url2 = $_W['siteroot'] . 'app/' . murl('auth/forward', $vars);
        $data = '{
										"touser":"******",
										"msgtype":"news",
										"news":{
											"articles": [
											 {
												 "title":"' . $title . '",
												 "description":"' . $title . '",
												 "url":"' . $url2 . '",
												 "picurl":"' . $img . '",
											 }
											 ]
										}
									}';
        $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $token2;
        load()->func('communication');
        $it = ihttp_post($url, $data);
    }
Example #18
0
 public function sendMessage($data, $notice = false)
 {
     global $_W;
     $reply = pdo_fetch('select * from ' . tablename('xwz_queue_reply') . ' where uniacid=:uniacid and rid=:rid limit 1', array(':uniacid' => $_W['uniacid'], ':rid' => $data['rid']));
     $type = pdo_fetch('select * from ' . tablename('xwz_queue_type') . ' where uniacid=:uniacid and  rid=:rid and id=:id limit 1', array(':uniacid' => $_W['uniacid'], ':rid' => $data['rid'], ':id' => $data['typeid']));
     $number = pdo_fetchcolumn('select count(*) from ' . tablename('xwz_queue_data') . ' where uniacid=:uniacid and  rid=:rid and typeid=:typeid and openid<>:openid  and status=0 and id<:id  ', array(':uniacid' => $_W['uniacid'], ':rid' => $reply['rid'], ':typeid' => $data['typeid'], ':openid' => $data['openid'], ':id' => $data['id']));
     //发送通知
     $sendtype = 0;
     // 0不发送 1 模板消息 2 客服消息
     //如果是认证服务号模板消息,如果认证号订阅号,客服消息
     load()->model('account');
     $account = account_fetch($_W['uniacid']);
     if ($account['level'] == 4) {
         //认证服务号
         $template_id = $reply['templateid'];
         if (!empty($template_id)) {
             $sendtype = 1;
         } else {
             $sendtype = 2;
         }
     } else {
         if ($account['level'] == 3) {
             //认证订阅号
             $sendtype = 2;
         }
     }
     $url = $_W['siteroot'] . 'app/index.php?i=' . $_W['uniacid'] . '&c=entry&m=xwz_queue&do=index&rid=' . $data['rid'];
     if ($sendtype == 1) {
         $data = json_encode(array('keyword1' => array('value' => $type['tag'] . $data['number']), 'keyword2' => array('value' => $type['title']), 'keyword3' => array('value' => $number . '位'), 'keyword4' => array('value' => $reply['heading']), 'keyword5' => array('value' => date('Y-m-d H:i', $data['createtime']))));
         load()->classs('weixin.account');
         $accObj = WeixinAccount::create($_W['uniacid']);
         $access_token = $accObj->fetch_token();
         if (!empty($access_token)) {
             load()->func('communication');
             $postarr = '{"touser":"******","template_id":"' . $template_id . '","url":"' . $url . '","data":' . $data . '}';
             $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token, $postarr);
         }
     } else {
         if ($sendtype == 2) {
             $content = $notice ? "排号进度通知" : "取号成功通知\n\n";
             $content .= "号码:" . $type['tag'] . $data['number'] . "\n";
             $content .= "类型:" . $type['title'] . "\n";
             $content .= "前面还有:" . $number . "位\n";
             $content .= "商家:" . $reply['heading'] . "\n";
             $content .= "取号时间:" . date('Y-m-d H:i', $data['createtime']) . "\n\n";
             $content .= "<a href='{$url}'>点击查看详情</a>";
             $data = array("touser" => $data['openid'], "msgtype" => "text", "text" => array('content' => urlencode($content)));
             load()->classs('weixin.account');
             $accObj = WeixinAccount::create($_W['uniacid']);
             $access_token = $accObj->fetch_token();
             if (!empty($access_token)) {
                 $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$access_token}";
                 load()->func('communication');
                 $res = ihttp_request($url, urldecode(json_encode($data)));
             }
         }
     }
 }
Example #19
0
 public function doWebUnauth_user()
 {
     global $_W, $_GPC;
     $id = intval($_GPC['id']);
     $node = intval($_GPC['node']);
     $openid = $_GPC['openid'];
     $data = array('api_id' => $this->module['config']['authid'], 'api_key' => $this->module['config']['authkey'], 'node' => $node, 'openid' => $openid);
     load()->func('communication');
     $result = ihttp_post($this->unauth_user, json_encode($data));
     $result = json_encode($result['content'], true);
     //print_r($result);
     if ($result['status'] == 0) {
         pdo_update('wdl_wifi_authentication', array('result' => '0'), array('id' => $id));
         message('强制下线成功', referer(), 'success');
     } else {
         message('强制下线失败,错误详情为' . $result['err_msg']);
     }
 }
Example #20
0
global $_GPC, $_W;
WeSession::start($_W['uniacid'], $_W['fans']['from_user'], 60);
$mobile = $_GPC['mobile'];
if ($_GPC['type'] == 'verify') {
    $member = pdo_fetch("select * from" . tablename("xcommunity_member") . "where weid='{$_W['uniacid']}' and mobile=:mobile", array(':mobile' => $mobile));
} else {
    $member = pdo_fetch("select * from" . tablename("xcommunity_business") . "where weid='{$_W['uniacid']}' and mobile=:mobile", array(':mobile' => $mobile));
}
if (!empty($member)) {
    message('该号码已经注册,请更换号码,重新注册', referer(), 'success');
    exit;
}
if ($mobile == $_SESSION['mobile']) {
    $code = $_SESSION['code'];
} else {
    $code = random(6, 1);
    $_SESSION['mobile'] = $mobile;
    $_SESSION['code'] = $code;
}
//验证是否开启
if ($this->module['config']['verifycode'] || $this->module['config']['businesscode']) {
    $mobile = $_SESSION['mobile'];
    $tpl_id = $this->module['config']['resgisterid'];
    $tpl_value = urlencode("#code#={$code}");
    $appkey = $this->module['config']['sms_account'];
    $params = "mobile=" . $mobile . "&tpl_id=" . $tpl_id . "&tpl_value=" . $tpl_value . "&key=" . $appkey;
    $url = 'http://v.juhe.cn/sms/send';
    load()->func('communication');
    $content = ihttp_post($url, $params);
    return $content;
}
Example #21
0
function sms_send($mobile = '', $content = '', $signature = '', $check = true)
{
    global $_W;
    $setting = setting_load('sms');
    load()->func('communication');
    if (empty($setting['sms'])) {
        return error(1, "未设置短信接口,无法发送短信!");
    }
    if (!empty($setting['sms']) && $setting['sms']['type'] == 'yimei') {
        if (empty($setting['sms']['url']) || empty($setting['sms']['password']) || empty($setting['sms']['serialNumber']) || empty($setting['sms']['sessionKey'])) {
            return error(1, "亿美短信接口配置不完整,无法发送短信!");
        }
    }
    if (!empty($setting['sms']) && $setting['sms']['type'] == 'dxton') {
        if (empty($setting['sms']['dxton_username']) || empty($setting['sms']['dxton_pwd'])) {
            return error(1, "短信通接口配置不完整,无法发送短信!");
        }
    }
    if (!empty($setting['sms']) && $setting['sms']['type'] == 'smscn') {
        if (empty($setting['sms']['smscn_uid']) || empty($setting['sms']['smscn_pwd'])) {
            return error(1, "云信接口配置不完整,无法发送短信!");
        }
    }
    $config = $setting['sms'];
    $smsconfig = array("balance" => 0, "signature" => $_W['setting']['sitename']);
    $row = pdo_fetch("SELECT `notify` FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
    $row['notify'] = @iunserializer($row['notify']);
    if (!empty($row['notify']) && !empty($row['notify']['sms'])) {
        $smsconfig = $row['notify']['sms'];
    }
    if ($check) {
        if (intval($smsconfig['balance']) <= 0) {
            return error(1, "短信条数不足,请联系客服人员");
        }
    }
    if (empty($signature)) {
        $signature = "";
    }
    if ($config['type'] == 'yimei') {
        $content = "【" . $signature . "】" . $content;
        $sms = new SMSUtil($config['url'], $config['serialNumber'], $config['password'], $config['sessionKey'], array("proxyhost" => $config['proxyhost'], "proxyport" => $config['proxyport'], "proxyusername" => $config['proxyusername'], "proxypassword" => $config['proxypassword']), $config['timeout'], $config['response_timeout']);
        $err = $sms->send($mobile, $content);
        if (empty($err)) {
            $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1;
            pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
            return true;
        }
        return error(1, $err);
    } else {
        if ($config['type'] == 'dxton') {
            $username = $config['dxton_username'];
            $pwd = $config['dxton_pwd'];
            $target = "http://www.dxton.com/webservice/sms.asmx/Submit";
            $post_data = "account=" . $username . "&password="******"&mobile=" . $mobile . "&content=" . rawurlencode($content);
            $result = ihttp_request($target, $post_data);
            $xml = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA);
            $result = (string) $xml->result;
            $message = (string) $xml->message;
            if ($result == '100') {
                $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1;
                pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
                return true;
            }
            return error(1, $message);
        } else {
            if ($config['type'] == 'smscn') {
                $uid = $config['smscn_uid'];
                $pwd = md5($config['smscn_pwd'] . $uid);
                $target = 'http://api.sms.cn/mtutf8/';
                $content = "【" . $signature . "】" . $content;
                $post_data = "uid=" . $uid . "&pwd=" . $pwd . "&mobile=" . $mobile . "&content=" . urlencode($content);
                $result = ihttp_post($target, $post_data);
                if (is_array($result)) {
                    $contents = explode("&", $result['content']);
                    $codes = isset($contents[1]) ? explode("=", $contents[1]) : '';
                    $messsages = isset($contents[2]) ? explode("=", $contents[2]) : '';
                    if (is_array($codes)) {
                        $code = $codes[1];
                        $message = $messsages[1];
                        if ($code == '100') {
                            $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1;
                            pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
                            return true;
                        }
                        return error(1, $message);
                    }
                }
                return error(1, "发送短信失败!");
            }
        }
    }
}
Example #22
0
 public function jkvisit($type, $data)
 {
     $url = $this->jk_array[$type];
     if (empty($url)) {
         message($type . '接口地址未设置');
     }
     if (empty($data)) {
         message($type . '接口参数未设置,请到设置菜单设置!');
     }
     load()->func('communication');
     $jsondata = json_encode($data);
     $rsp = ihttp_post($url, $jsondata);
     $dat = $rsp['content'];
     $arrdat = json_decode($dat, true);
     $status = $arrdat['status'];
     if ($status <= -1 && $status >= -7) {
         message('错误代码[' . $status . '];错误信息' . $arrdat['err_msg'] . $this->errorinfo[$status]['des']);
     }
     return $arrdat;
 }
Example #23
0
 public function push_draw($touser, $content)
 {
     global $_W, $_GPC;
     load()->func('communication');
     //获取平台信息
     $wechat = pdo_fetch("SELECT * FROM " . tablename('account_wechats') . " WHERE uniacid=" . $_W['uniacid']);
     $token = unserialize($wechat['access_token']);
     $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $token['token'];
     $data = array();
     $data['touser'] = $touser;
     $data['msgtype'] = 'text';
     $data['text']['content'] = urlencode($content);
     $dat = json_encode($data);
     $dat = urldecode($dat);
     $result = ihttp_post($url, $dat);
     $final = json_decode($result);
     return $final;
 }
Example #24
0
function cloud_schema()
{
    $pars = _cloud_build_params();
    $pars['method'] = 'application.schema';
    $dat = ihttp_post('http://v2.addons.we7.cc/gateway.php', $pars);
    $file = IA_ROOT . '/data/application.schema';
    $ret = _cloud_shipping_parse($dat, $file);
    if (!is_error($ret)) {
        $schemas = array();
        if (!empty($ret['schemas'])) {
            load()->func('db');
            foreach ($ret['schemas'] as $remote) {
                $name = substr($remote['tablename'], 4);
                $local = db_table_schema(pdo(), $name);
                unset($remote['increment']);
                unset($local['increment']);
                if (empty($local)) {
                    $schemas[] = $remote;
                } else {
                    $diffs = db_schema_compare($local, $remote);
                    if (!empty($diffs)) {
                        $schemas[] = $remote;
                    }
                }
            }
        }
        $ret['schemas'] = $schemas;
    }
    return $ret;
}
Example #25
0
 public function sendtpl($openid, $url, $template_id, $content)
 {
     global $_GPC, $_W;
     load()->classs('weixin.account');
     load()->func('communication');
     $obj = new WeiXinAccount();
     $access_token = $obj->fetch_available_token();
     $data = array('touser' => $openid, 'template_id' => $template_id, 'url' => $url, 'topcolor' => "#FF0000", 'data' => $content);
     $json = json_encode($data);
     $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token;
     $ret = ihttp_post($url, $json);
 }
Example #26
0
 public function fansBatchQueryInfo($data)
 {
     if (empty($data)) {
         return error(-1, '粉丝openid错误');
     }
     foreach ($data as $da) {
         $post[] = array('openid' => trim($da), 'lang' => 'zh-CN');
     }
     $data = array();
     $data['user_list'] = $post;
     $token = $this->getAccessToken();
     if (is_error($token)) {
         return $token;
     }
     $url = "https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token={$token}";
     $response = ihttp_post($url, json_encode($data));
     if (is_error($response)) {
         return error(-1, "访问公众平台接口失败, 错误: {$response['message']}");
     }
     $result = @json_decode($response['content'], true);
     if (empty($result)) {
         return error(-1, "接口调用失败, 元数据: {$response['meta']}");
     } elseif (!empty($result['errcode'])) {
         return error(-1, "访问微信接口错误, 错误代码: {$result['errcode']}, 错误信息: {$result['errmsg']},错误详情:{$this->error_code($result['errcode'])}");
     }
     return $result['user_info_list'];
 }
Example #27
0
 public function settingsDisplay($settings)
 {
     global $_W, $_GPC, $codeca, $ckey, $settings;
     load()->func('tpl');
     load()->func('communication');
     $settings = $this->module['config'];
     $a = array();
     $is_set = '13000000000000000000000000000000000000000000000000000000000000000000';
     $a = ihttp_get($codeca . '&ac=0');
     if (strlen($a['content']) > 5) {
         $a = @json_decode($a['content'], true);
     }
     if (strlen($a['set']) > 5) {
         $is_set = $a['set'];
     }
     if (empty($a) || $a['content'] != '3') {
         if (checksubmit() || $a['content'] == '0') {
             $akey = pdo_fetch("SELECT * FROM " . tablename('core_settings') . " WHERE `key` = 'copyright'");
             $akey = iunserializer($akey['value']);
             $postarr = array('key' => $ckey['key'], 'ip' => $ckey['sip'], 'web' => $_SERVER['HTTP_HOST'], 'webname' => $akey['sitename']);
             $a = ihttp_post($codeca . '&ac=1', $postarr);
             if (strlen($a['content']) > 5) {
                 $a = @json_decode($a['content'], true);
             }
             if ($a['content'] != '0' && !empty($a['t'])) {
                 $postarr = array('codenane' => '微防伪授权码', 'code' => $a['t']);
                 if ($ckey['code'] == 'abcd') {
                     $postarr = array('key' => 'zm_fwfree', 'value' => iserializer($postarr));
                     pdo_insert('core_settings', $postarr);
                 } else {
                     pdo_update('core_settings', array('value' => iserializer($postarr)), array('key' => 'zm_fwfree'));
                 }
                 $ckey['code'] = $a['t'] . '';
             }
         }
         if ($a['content'] != '3') {
             include $this->template('setting1');
             exit;
         }
     }
     $settings['iscodeset'] = empty($settings['iscodeset']) ? "0" : $settings['iscodeset'];
     $settings['luck'] = empty($settings['luck']) ? "0" : $settings['luck'];
     $codeset = array();
     $mk = array();
     $mm = array();
     $codeo = array();
     if ($settings['iscodeset'] != 1) {
         $codeset = pdo_fetch("SELECT * FROM " . tablename('zmcn_fw_codeset') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
         $codeset['id'] = empty($codeset['id']) ? "0" : $codeset['id'];
         if (empty($codeset['k'])) {
             $codeset['k'] = 'a:3:{s:1:"k";a:5:{i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";i:5;s:0:"";}s:1:"m";a:5:{i:1;s:2:"FW";i:2;s:1:"7";i:3;s:1:"6";i:4;s:1:"5";i:5;s:2:"20";}s:1:"s";i:0;}';
             $codeo = iunserializer($codeset['k']);
         } else {
             $codeo = iunserializer($codeset['k']);
         }
     }
     $set = pdo_fetch("SELECT * FROM " . tablename('zmcn_fw_set') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
     $luck = iunserializer($set['luck']);
     $settings = iunserializer($set['settings']);
     $set['id'] = empty($set['id']) ? "0" : $set['id'];
     if (checksubmit()) {
         if ($settings['iscodeset'] != 1) {
             if (strlen($_GPC['k1']) == 10 && strlen($_GPC['k2']) == 10 && strlen($_GPC['k3']) == 10 && strlen($_GPC['k4']) == 10 && strlen($_GPC['k5']) == 10) {
                 $mmm1 = "FW";
                 $mm = array('1' => $mmm1, '2' => (int) $codeo['m']['2'], '3' => (int) $codeo['m']['3'], '4' => (int) $codeo['m']['4'], '5' => (int) $codeo['m']['5']);
                 $mk = array('1' => (int) $_GPC['k1'], '2' => (int) $_GPC['k2'], '3' => (int) $_GPC['k3'], '4' => (int) $_GPC['k4'], '5' => (int) $_GPC['k5']);
                 $coden = array('k' => $mk, 'm' => $mm, 's' => 0, 'key' => $ckey['key'], 'cid' => $_W['uniacid']);
                 $insert = array('cid' => $_W['uniacid'], 'codeset' => iserializer($coden));
                 $a = ihttp_post($codeca . '&ac=2', $insert);
                 if (strlen($a['content']) > 5) {
                     $a = @json_decode($a['content'], true);
                 }
                 if ($a['content'] == '3' && ($a['codeset'] = '666')) {
                     if ($_GPC['codesetid'] == 0) {
                         $insert = array('uniacid' => $_W['uniacid'], 'm1' => $mmm1, 'k' => iserializer($coden), 'act' => 0, 'rid' => 0);
                         pdo_insert('zmcn_fw_codeset', $insert);
                     } else {
                         $insert = array('m1' => $mmm1, 'k' => iserializer($coden), 'rid' => 0);
                         pdo_update('zmcn_fw_codeset', $insert, array('id' => (int) $_GPC['codesetid']));
                     }
                     $pp = pdo_fetch("SELECT COUNT(*) FROM " . tablename('zmcn_fw_batch') . " WHERE uniacid = :uniacid  AND m1 = :m1 AND batch = :batch", array(':uniacid' => $_W['uniacid'], ':m1' => $mmm1, ':batch' => '8888888'));
                     if (empty($pp)) {
                         $insert = array('uniacid' => $_W['uniacid'], 'm1' => $mmm1, 'batch' => '8888888', 'product' => '微防伪演示商品', 'addtime' => TIMESTAMP, 'lasttime' => TIMESTAMP, 'factory' => $_W['account']['name'], 'remark' => '系统保留演示专用');
                         pdo_insert('zmcn_fw_batch', $insert);
                     }
                 }
             }
         }
         if ($_GPC['isluck'] == 1) {
             $lucks = array();
             for ($i = 0; $i < 6; ++$i) {
                 $lucks[$i] = array('n' => $_GPC['luck' . $i . 'n'], 'm' => (int) $_GPC['luck' . $i . 'm'], 'i' => (int) $_GPC['luck' . $i . 'i'], 't' => $_GPC['luck' . $i . 't']);
             }
             $insert = array('luck' => iserializer($lucks));
             pdo_update('zmcn_fw_set', $insert, array('uniacid' => $_W['uniacid']));
         }
         if ($_GPC['iscodeset'] == 0) {
             $iscodeset = 0;
         } else {
             $iscodeset = 1;
         }
         if ('1' == $is_set[3]) {
             $wapcss = $_GPC['wapcss'];
         } else {
             $wapcss = 'default';
         }
         $insert = array('upperlimit' => empty($_GPC['upperlimit']) ? "0" : $_GPC['upperlimit'], 'ishistory' => empty($_GPC['ishistory']) ? "0" : $_GPC['ishistory'], 'isint' => empty($_GPC['isint']) ? "0" : $_GPC['isint'], 'isluck' => empty($_GPC['isluck']) ? "0" : $_GPC['isluck'], 'isapi' => empty($_GPC['isapi']) ? "0" : $_GPC['isapi'], 'islink' => empty($_GPC['islink']) ? "0" : $_GPC['islink'], 'ischuanhuo' => empty($_GPC['ischuanhuo']) ? "0" : $_GPC['ischuanhuo'], 'iscodeset' => $iscodeset, 'tongzi' => $_GPC['tongzi'], 'apikey' => $_GPC['apikey'], 'inttype' => $_GPC['inttype'], 'wapcss' => $wapcss, 'istixe' => $_GPC['istixe'], 'wxmobid' => $_GPC['wxmobid'], 'luckname' => $_GPC['luckname'], 'link' => $_GPC['link'], 'welcometxt' => $_GPC['welcometxt'], 'factory' => $_GPC['factory'], 'ftel' => $_GPC['ftel'], 'dtel' => $_GPC['dtel'], 'link' => $_GPC['link'], 'logo' => $_GPC['logo'], 'banner' => $_GPC['banner'], 'suc_one' => $_GPC['suc_one'], 'suc_two' => $_GPC['suc_two'], 'suc_three' => $_GPC['suc_three'], 'con_msg' => $_GPC['con_msg'], 'welcome' => $_GPC['welcome'], 'script' => $_GPC['script'], 'template_id' => $_GPC['template_id'], 'profile' => $_GPC['profile']);
         $this->saveSettings($insert);
         $insert = array('settings' => iserializer($insert));
         pdo_update('zmcn_fw_set', $insert, array('uniacid' => $_W['uniacid']));
         $data1 = array('uniacid' => $_W['uniacid'], 'type' => 1, 'summary' => 'setting', 'uid' => $_W['uid'], 'addtime' => TIMESTAMP, 'ip' => $_W['clientip'], 'remark' => '更新系统设置');
         pdo_insert('zmcn_fw_history', $data1);
         message('保存成功', '?c=' . $_GPC['c'] . '&a=' . $_GPC['a'] . '&do=' . $_GPC['do'] . '&m=' . $_GPC['m'] . '&tab=' . $_GPC['tab'], 'success');
     }
     $dirs = getSubDirs(MODULE_ROOT . '/template/mobile/');
     include $this->template('setting');
 }
Example #28
0
 public function sendtempmsg($template_id, $url, $data, $topcolor, $tousers = '')
 {
     load()->func('communication');
     load()->classs('weixin.account');
     $access_token = WeAccount::token();
     if (empty($access_token)) {
         return;
     }
     $postarr = '{"touser":"******","template_id":"' . $template_id . '","url":"' . $url . '","topcolor":"' . $topcolor . '","data":' . $data . '}';
     $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token, $postarr);
     return true;
 }
Example #29
0
 public function menuCreate($menu)
 {
     $dat = $this->menuBuildMenuSet($menu);
     $token = $this->fetch_token();
     if (is_error($token)) {
         return $token;
     }
     $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$token}";
     $content = ihttp_post($url, $dat);
     return $this->menuResponseParse($content);
 }
Example #30
0
 /**
  * 模板消息 
  * 接口已开放   
  * 
  */
 private function SendTpl($openid, $info, $type, $res)
 {
     load()->func('communication');
     require_once 'template_conf_ap.php';
     require_once 'template_conf_auth.php';
     require_once 'template_conf_re.php';
     require_once 'template_conf_cd.php';
     require_once 'template_conf_fl.php';
     global $_W;
     $access_token = WeAccount::token();
     $apply = json_decode($apply, true);
     //		$this->saveSettings($apply);
     $auth = json_decode($auth, true);
     //		$this->saveSettings(auth);
     $refu = json_decode($refu, true);
     //		$this->saveSettings($refu);
     $credit = json_decode($credit, true);
     //		$this->saveSettings($credit);
     $full = json_decode($full, true);
     //		$this->saveSettings($full);
     //post URL
     $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token;
     //POST data
     if ($type == 'apply') {
         $data = array('touser' => $openid, 'template_id' => $apply['apply_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $apply['apply_first'], 'color' => $apply['apply_fcolor']), 'keynote1' => array('value' => $apply['apply_keynote1'], 'color' => $apply['apply_kfcolor']), 'keynote2' => array('value' => '请联系雇主确认....', 'color' => '#000'), 'remark' => array('value' => $apply['apply_remark'], 'color' => $apply['apply_mkcolor'])));
     } else {
         if ($type == 'auth') {
             $date = date('Y-m-d H:i');
             $data = array('touser' => $openid, 'template_id' => $auth['auth_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $auth['auth_first'], 'color' => $apply['auth_first']), 'keyword1' => array('value' => $info['name'], 'color' => '#000'), 'keyword2' => array('value' => $info['phone'], 'color' => '#000'), 'keyword3' => array('value' => $date, 'color' => '#000'), 'remark' => array('value' => $auth['auth_remark'], 'color' => $auth['auth_mkcolor'])));
         } else {
             if ($type == 'refuse') {
                 $date = date('Y-m-d H:i');
                 $data = array('touser' => $openid, 'template_id' => $refu['refu_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $refu['refu_first'], 'color' => $refu['refu_fcolor']), 'keyword1' => array('value' => $info['name'], 'color' => '#000'), 'keyword2' => array('value' => $info['phone'], 'color' => '#000'), 'keyword3' => array('value' => $date, 'color' => '#000'), 'remark' => array('value' => $refu['refu_remark'], 'color' => $refu['refu_mkcolor'])));
             } else {
                 if ($type == 'credit1') {
                     $date = date('Y-m-d H:i:s');
                     $data = array('touser' => $openid, 'template_id' => $credit['credit_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $credit['credit_first'], 'color' => $credit['credit_fcolor']), 'account' => array('value' => $info['name'], 'color' => '#000'), 'time' => array('value' => $date, 'color' => '#000'), 'type' => array('value' => $credit['credit_type'], 'color' => $credit['credit_tpcolor']), 'creditChange' => array('value' => '支出', 'color' => '#000'), 'number' => array('value' => '100', 'color' => '#000'), 'creditName' => array('value' => '账户积分', 'color' => '#000'), 'amount' => array('value' => $res, 'color' => '#000'), 'remark' => array('value' => $credit['credit_remark'], 'color' => $credit['crefit_mkcolor'])));
                 } else {
                     if ($type == 'full') {
                         $data = array('touser' => $openid, 'template_id' => $full['full_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjmyinfo&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $full['full_first'], 'color' => $full['full_fcolor']), 'keyword1' => array('value' => $info['title'], 'color' => '#000'), 'keyword2' => array('value' => "待办", 'color' => 'red'), 'remark' => array('value' => $full['full_remark'], 'color' => $full['full_mkcolor'])));
                     } else {
                         if ($type == 'first_third') {
                             $data = array('touser' => $openid, 'template_id' => $full['full_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjmyinfo&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => '请尽快去录取应答者,完成本次招募。', 'color' => '#000'), 'keyword1' => array('value' => $info['title'], 'color' => '#000'), 'keyword2' => array('value' => '待办', 'color' => 'red'), 'remark' => array('value' => '帖子有人认领啦,快去看看.', 'color' => '#0542FA')));
                         } else {
                             if ($type == 'second_third') {
                                 $data = array('touser' => $openid, 'template_id' => $full['full_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjmyinfo&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => '请尽快去录取应聘者,完成本次招聘。', 'color' => '#000'), 'keyword1' => array('value' => $info['title'], 'color' => '#000'), 'keyword2' => array('value' => '待办', 'color' => 'red'), 'remark' => array('value' => '招聘帖子人数快满了,请速去验收.', 'color' => '#0542FA')));
                             } else {
                                 if ($type == 'admit') {
                                     $data = array('touser' => $openid, 'template_id' => $apply['apply_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => 'congrats!你已被' . $info['name'] . '招募', 'color' => '#FF0000'), 'keynote1' => array('value' => $info['name'] . '欢迎你的加入~', 'color' => '#000'), 'keynote2' => array('value' => '请联系雇主确认....', 'color' => '#000'), 'remark' => array('value' => '要愉快地玩耍哦~~~~', 'color' => '#000')));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return ihttp_post($url, json_encode($data));
 }