config('cons.app_id'), 'secret' => config('cons.secret'), 'response_type' => 'array', ]; $app = Factory::officialAccount($config); $acc_token = Redis::get('wx:ac:AccessToken'); if($acc_token) { $app['access_token']->setToken($acc_token); } $wechat_res = $app->template_message->send([ 'touser' => $open_id, 'template_id' => 'hGsUGZlWqWC9TMm4ZGZuz0OwE4gwSmvgbr5ecmTDvq4', 'miniprogram' => [ 'appid' => 'wxd88fffa983758a30', // 零点八零 'pagepath' => 'pages/index/index', // 零点八零 ], 'data' => [ 'thing7' => $record['shop_name'], 'thing14' => $record['activity_detail'], 'time3' => $record['activity_time'], 'thing16' => $record['address'], ], ]); } } // 拉消息 public static function getRedisMessage($uid, $user_type) { $str_uid = Base::getUid($uid, $user_type); $set_str = 'nomsg:message:' . $str_uid; $sent = Redis::get($set_str); $data = []; if($sent) { $sent = json_decode($sent, true); foreach ($sent as $k => $v) { $data[] = json_decode(Redis::get($v), true); Redis::del($v); } Redis::del($set_str); } return $data; } }