コード例 #1
0
ファイル: index.php プロジェクト: alexa0503/nivea_2015love
 public function shareInfo()
 {
     if (isset($_GET['url'])) {
         $url = urldecode($_GET['url']);
         $jssdk = new Jssdk(self::WECHAT_APPID, self::WECHAT_SECRET);
         $signPackage = $jssdk->GetSignPackage();
         $data = $signPackage;
         $this->output->set_content_type('application/json')->set_output(json_encode($data));
     }
 }
コード例 #2
0
 public function job_detail()
 {
     import("Org.ThinkSDK.sdk.Jssdk");
     $appid = "wx5aee7c9e7c2eb969";
     $secretkey = "44062163dcb3b4627a53bf0ac164c87d";
     $jssdk = new \Jssdk($appid, $secretkey);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("appId", $signPackage['appId']);
     $this->assign("timestamp", $signPackage['timestamp']);
     $this->assign("nonceStr", $signPackage['nonceStr']);
     $this->assign("signature", $signPackage['signature']);
     $id = $_GET['id'];
     if (empty($id)) {
         header("location:/Home/Webchat/new_job");
         exit;
     }
     $WebChatModel = D('job');
     $result = $WebChatModel->get_detail($id);
     //echo "<pre>";print_r($result);echo "</pre>";
     $tag = 0;
     //默认是未收藏状态
     //判断当前用户是否登陆,如果登陆判断当前页面当前用户是否已藏
     $userinfo = $_COOKIE['userinfo'];
     if (!empty($userinfo)) {
         $userinfoArr = unserialize($userinfo);
         $username = $userinfoArr['username'];
         //判断当前页面当前用户是否已藏
         $jcOb = M("job_collection");
         $jcArr = $jcOb->where("username='******' and status=1 and j_id=" . $id)->find();
         //echo $jcOb ->getLastSql();
         //var_dump($jcArr);
         if (!empty($jcArr)) {
             $tag = 1;
             //收藏表里有相关数据,改为已收藏状态
         }
     }
     $this->assign("tag", $tag);
     $this->assign("result", $result);
     $this->display("./Webchat/job_detail");
 }
コード例 #3
0
 /**
  * 私人定制页面  
  * 
  * @access public 
  * @since 1.0 
  */
 function index()
 {
     import("Org.ThinkSDK.sdk.Jssdk");
     $appid = C("APPID");
     $secretkey = C("SECRETKEY");
     $jssdk = new \Jssdk($appid, $secretkey);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("appId", $signPackage['appId']);
     $this->assign("timestamp", $signPackage['timestamp']);
     $this->assign("nonceStr", $signPackage['nonceStr']);
     $this->assign("signature", $signPackage['signature']);
     //查看分享信息
     $arShare = D("ShareInfo")->get_info("share1");
     if (empty($arShare)) {
         $arShare['wxurl'] = "http://www.renrenlie.com/Home/Webchatcustomized/index.html";
         $arShare['title'] = "人人猎-高薪工作机会的“私人订制”";
         $arShare['desc'] = "人人猎--您最可靠的私人求职顾问";
         $arShare['img'] = "http://www.renrenlie.com/Public/img/web_custom.png";
     }
     $this->assign("share", $arShare);
     $this->assign("domain", "http://www.renrenlie.com");
     $this->display("Webchatnew/custom");
 }
コード例 #4
0
 function upresume_info()
 {
     import("Org.ThinkSDK.sdk.Jssdk");
     $appid = C("APPID");
     $secretkey = C("SECRETKEY");
     $jssdk = new \Jssdk($appid, $secretkey);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("appId", $signPackage['appId']);
     $this->assign("timestamp", $signPackage['timestamp']);
     $this->assign("nonceStr", $signPackage['nonceStr']);
     $this->assign("signature", $signPackage['signature']);
     //查看分享信息
     $arShare = D("ShareInfo")->get_info("share3");
     if (empty($arShare)) {
         $arShare['wxurl'] = "http://www.renrenlie.com/Home/Webchatnew/upresume_info.html";
         $arShare['title'] = "人人猎-上传简历坐等收钱";
         $arShare['desc'] = "HR和猎头的赚钱神器";
         $arShare['img'] = "http://www.renrenlie.com/Public/img/web_logo.png";
     }
     $this->assign("domain", "http://www.renrenlie.com");
     $this->assign("share", $arShare);
     $this->display();
 }
コード例 #5
0
ファイル: index.php プロジェクト: alexa0503/ferrero_sep
<?php

include_once '../includes/jssdk.php';
//include_once('../includes/curl.php');
$domain = 'http://' . $_SERVER[HTTP_HOST];
define('WECHAT_APPID', 'wx3978e56538c6ef7f');
define('WECHAT_SECRET', '83bc38882177448990ea14101ca7b78a');
$wechat_share = array('title' => '臻心意 致师恩', 'desc' => '您的学生送来一份甜蜜的祝福', 'link' => $domain . '/fll2/index.php?n=' . $_GET['n'], 'imgUrl' => $domain . '/fll1/images/share.jpg');
$jssdk = new Jssdk(WECHAT_APPID, WECHAT_SECRET);
$sign_package = $jssdk->getSignPackage();
if (isset($_GET['n'])) {
    $data = json_decode(file_get_contents('../text/' . $_GET['n'] . '.txt'), true);
}
if (!empty($data['fromName'])) {
    $wechat_share['desc'] = '您的学生' . $data['fromName'] . '送来一份甜蜜的祝福';
}
if (empty($data['fromName'])) {
    $data['fromName'] = '您的学生';
}
if (empty($data['toName'])) {
    $data['toName'] = '老师';
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="format-detection" content="telephone=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<title>臻心意 报师恩</title>
	<link rel="stylesheet" href="css/common.css">
コード例 #6
0
 /**
  * 通过网页授权根据code获取用户openid,并发放红包
  */
 public function get_openid()
 {
     $userinfo = $_COOKIE['userinfo'];
     $userArr = unserialize($userinfo);
     $uid = $userArr['userid'];
     $username = $userArr['username'];
     if (!$uid) {
         header("location:/index.php");
         die;
     }
     if ($_SESSION['rrl' . $username]) {
         $openid = $_SESSION['rrl' . $username];
     } else {
         if (empty($_GET['state']) || empty($_GET['code'])) {
             header("location:/index.php");
         }
         $openidurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $this->wxappid . "&secret=" . $this->appsecret . "&code=" . $_GET['code'] . "&grant_type=authorization_code";
         $content = file_get_contents($openidurl, true);
         $openidArr = $this->std_class_object_to_array(json_decode($content));
         $openid = $openidArr['openid'];
         $_SESSION['rrl' . $username] = $openid;
         //var_dump($openid);
     }
     //判断该用户是否已经获取过分享链接
     $shareOb = M("share");
     $isExit = $shareOb->where("activeid=" . C('WX_REDPACKAGE_ID') . " and username='******' and status=1")->find();
     if (!$isExit) {
         /*                         * **********************************拼凑分享链接获取邀请码*************************************** */
         $shareUrlBase = "http://www.renrenlie.com/Home/Webchatactive/wxredpackage";
         $shareUrlTmp = "wxredtag/WxRedpackage/wxredchannel/WxShare&wxredaid/" . C('WX_REDPACKAGE_ID') . "/wxreduname/" . $openid;
         $shareUrl = $shareUrlBase . "/wxredshare/" . md5($shareUrlTmp);
         $sharecode = $this->get_sharecode();
         //不加密的分享链接地址
         $shareUrl2 = $shareUrlBase . "/" . $shareUrlTmp;
         $userinfoArr = M("userinfo")->where("username='******'")->find();
         $userid = $userinfoArr['userid'];
         //插入一条分享信息
         $activeInfo = M("active")->where("id='" . C('WX_REDPACKAGE_ID') . "'")->find();
         $data['url'] = $shareUrl2;
         $data['decrypturl'] = $shareUrl;
         $data['uid'] = $userid;
         $data['username'] = $username;
         $data['tag'] = "WxRedpackage";
         $data['channel'] = "WxShare";
         $data['activeid'] = C('WX_REDPACKAGE_ID');
         $data['activename'] = $activeInfo['activename'];
         $data['click'] = 0;
         $data['num'] = 0;
         $data['comment'] = $sharecode;
         $data['created_at'] = $data['updated_at'] = time();
         M("share")->add($data);
     } else {
         $shareUrl = $isExit['decrypturl'];
         $sharecode = $isExit['comment'];
     }
     //微信分享相关
     import("Org.ThinkSDK.sdk.Jssdk");
     $appid = C("APPID");
     $secretkey = C("SECRETKEY");
     $jssdk = new \Jssdk($appid, $secretkey);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("appId", $signPackage['appId']);
     $this->assign("timestamp", $signPackage['timestamp']);
     $this->assign("nonceStr", $signPackage['nonceStr']);
     $this->assign("signature", $signPackage['signature']);
     $this->assign("shareurl", $shareUrl);
     $this->assign("sharecode", strtoupper($sharecode));
     $this->display("./Webchat/shareinfo");
 }