Exemplo n.º 1
0
 public function create_qr111($openid = 'oyKgswI_fyh9dM5rdw6SAEy0dEUg', $type = 1)
 {
     //找到此用户的uid
     $uid = M('member')->where(array('OpenID' => $openid))->limit(1)->getField('uid');
     $uid = $type . $uid;
     $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);
     echo 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket'];
     // print_r($rs);
 }
Exemplo n.º 2
0
Arquivo: _back.php Projeto: Jitlee/CKY
    public function SendOrderNotifyToShops()
    {
        $wxm = new WxUserInfo();
        $m = D('M/Orders');
        $obj = $m->orderDetailForNotify(283);
        if (!$obj) {
            return;
        }
        $openid = $obj["wxopenid"];
        //没有设置提醒
        if (empty($openid)) {
            return;
        }
        $ACCESS_TOKEN = $wxm->accessToken();
        $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={$ACCESS_TOKEN}";
        $createTime = $obj["createTime"];
        $totalMoney = $obj["totalMoney"];
        $goods = $obj["goods"];
        $orderType = $obj["orderType"];
        $orderTypeName = "";
        if ($orderType == "1" || $orderType == "2") {
            $orderTypeName = "一元购订单";
        } else {
            if ($orderType == "3") {
                $orderTypeName = "商城订单";
            } else {
                $orderTypeName = "商家订单";
            }
        }
        $username = '******';
        $orderItemData = "订单金额:{$totalMoney}\n商品详情:{$goods}";
        $json = '
{
	"touser":"******",
	"template_id":"JsODEGXf-FzqYgRddUCbgMmTDHG8htzE0uKDFKhC6xA",
	"url":"http://www.cukayun.cn/index.php/M",
	"topcolor":"#FF0000",
	"data":{
		"orderType": {
			"value":"' . $orderTypeName . '",
			"color":"#173177"
		},
		"tradeDateTime":{
			"value":"06月07日 19时24分",
			"color":"#173177"
		},
		"customerInfo":{
			"value":"' . $username . '",
			"color":"#173177"
		},
		"orderItemName":{
			"value":"商品信息",
			"color":"#173177"
		},
		"orderItemData":{
			"value":"' . $orderItemData . '",
			"color":"#173177"
		},
		"remark":{
			"value":"remark",
			"color":"#173177"
		}
	}
}
		';
        $result = $this->postData($url, $json);
        echo $json;
        echo $result;
    }
Exemplo n.º 3
0
 public function create_fqr($type = '')
 {
     //找到此用户的uid
     $uid = '00';
     //				$type='91'
     $dotype = '7777';
     $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);
     header('location:https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket']);
 }