Ejemplo n.º 1
0
 public function lifeDetail()
 {
     $m = D('M/Malllife');
     $data = $m->get();
     $goods = $m->getgoods();
     $wxm = new WxUserInfo();
     $signPackage = $wxm->getSignPackage();
     $this->assign('signPackage', $signPackage);
     $this->assign('data', $data);
     $this->assign('childitems', $goods);
     //echo dump($goods);
     $this->assign('title', '商城-惠生活');
     $this->display("/Mall/lifedetail");
 }
Ejemplo n.º 2
0
 public function create_qr($openid = '', $type, $dotype = '1001')
 {
     //找到此用户的uid
     $uid = M('member')->where(array('OpenID' => $openid))->limit(1)->getField('uid');
     $uid = $dotype . $type . $uid;
     //https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
     //{"expire_seconds": 604800, "action_name": "QR_SCENE", "action_info": {"scene": {"scene_id": 123}}}
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_SCENE', 'action_info' => array('scene' => array('scene_id' => $uid)));
     $param = json_encode($param);
     $wxmsg = new WxUserInfo();
     $access_token = $wxmsg->accessToken();
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     return 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket'];
 }
Ejemplo n.º 3
0
    public function KJNotify($username, $openid, $mobile, $goodsname)
    {
        $wxm = new WxUserInfo();
        $ACCESS_TOKEN = $wxm->accessToken();
        $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={$ACCESS_TOKEN}";
        $json = '
{
	"touser":"******",
	"template_id":"wBRE4_Vm2TwYua7XRS8zrNqT8uy7RVmhBSuuE5ih3-c",	
	"topcolor":"#FF0000",
	"data":{
		"first": {
			"value":"恭喜你参与活动砍价成功!",
			"color":"#173177"
		},
		"keyword1":{
			"value":"' . $username . '",
			"color":"#173177"
		},
		"keyword2":{
			"value":"' . $mobile . '",
			"color":"#173177"
		},
		"keyword3":{
			"value":"",
			"color":"#173177"
		},
		"keyword4":{
			"value":"",
			"color":"#173177"
		},
		"keyword5":{
			"value":"' . $goodsname . '",
			"color":"#173177"
		},		
		"remark":{
			"value":"恭喜您获得:' . $goodsname . ',系统将于72小时内自动发放奖品。",
			"color":"#173177"
		}
	}
}
		';
        $result = $this->postData($url, $json);
        logger("/**************通知结果:{$result}******************/");
        return $result;
    }