public
function
actionCustomService()
{
$data
=
file_get_contents
('php:
$data
= json_decode(
$data
,true);
$qrcode_url
= Yii::
$app
->params['gzh_qrcode'];
$openId
=
$data
['FromUserName'];
$access_token
= self::getAccessToken();
$url
= 'https:
$appid
= Yii::
$app
->params['miniAppid'];
$media_id
= self::getRedis(
"wx_material:$appid"
, 'media_id');
if
(!
$media_id
) {
$material
= self::uploadImg(
$qrcode_url
,
$access_token
);
if
(
$material
) {
$redis
= Yii::
$app
->redis;
$redis
->hmset(
"wx_material:$appid"
, 'type',
$material
['type'], 'media_id',
$material
['media_id'], 'created_at',
$material
['created_at']);
$redis
->expire(
"wx_material:$appid"
, 7200);
}
$media_id
=
$material
['media_id'];
}
$data1
= [
'touser' =>
$openId
,
'msgtype' => 'image',
'image' => [
'media_id' =>
$media_id
,
],
];
$data1
= json_encode(
$data1
,JSON_UNESCAPED_UNICODE);
$result
= self::https_request(
$url
,
$data1
);
echo
'success';
}
暂时没有评论,来抢沙发吧~