public function byfilter($openId) { \Home\Common\Common::setrep(); $accessToken = $_SESSION["tokens"]; //获取access_token $xjson = ' { } '; $PostUrl = "https://api.weixin.qq.com/merchant/order/getbyfilter?access_token=" . $accessToken; //POST的url $value = \Home\Common\Common::PData($PostUrl, $xjson); $datas = json_decode($value, ture); $isnull = true; // $openId = "ou9X8tl0p-rfJcmRriSrj2QP144s"; // $openId = "ou9X8tmgcfDo8PRv_kOQlaXsTE1U"; // $openId = "ou9X8tsAIKJfcy86ynM9tXUKorbg"; $arr = array(); foreach ($datas['order_list'] as $tableName => $table) { if ($table['buyer_openid'] == $openId) { $arr[] = $table; } } $result = json_encode($arr); return $result; }
public function checkGZ($openid) { \Home\Common\Common::setrep(); $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $_SESSION['tokens'] . "&openid=" . $openid . "&lang=zh_CN"; $value = \Home\Common\Common::PData($url); return $value; }
/** * send message to openid * @param type $openid openid * @param type $content content * @return type */ function sendMessage($openid, $content) { \Home\Common\Common::setrep(); $accessToken = $_SESSION["tokens"]; //获取access_token $xjson = ' { "touser":"******", "msgtype":"text", "text": { "content":"' . $content . '" } } '; $PostUrl = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $accessToken; //POST的url $value = \Home\Common\Common::PData($PostUrl, $xjson); $datas = json_decode($value, ture); return $value; }