where('group_nick',$group_nick)->first(); return $group_gzh; } static function get_wechat_group_gzh($appid){ // 从redis取 $redis_group_gzh = Redis::get('wechat_group_gzh:appid:'.$appid); $group_gzh = ''; if(!empty($redis_group_gzh)){ $group_gzh = json_decode($redis_group_gzh); }else{ $group_gzh = self::where('appid',$appid)->where('status',1)->first(); v('redis_group_gzh_set:'.$appid); // 重要判断,否则新号有bug if(!empty($group_gzh)){ Redis::set('wechat_group_gzh:appid:'.$appid,json_encode($group_gzh)); } } $group_nick = isset($group_gzh->group_nick)?$group_gzh->group_nick:''; $result = array('group'=>null,'group_api'=>null); if(!empty($group_gzh)){ $group = Redis::get('wechat_group:group_nick:'.$group_nick); if(empty($group)){ $group = WechatGroup::get_group($group_nick); Redis::set('wechat_group:group_nick:'.$group_nick,json_encode($group)); v('redis_group_set:'.json_encode($group)); }else{ $group = objectToArray(json_decode($group)); } $group_api = Redis::get('wechat_group_api:group_nick:'.$group_nick); if(empty($group_api)){ $group_api = WechatGroupApi::get_group_api($group_nick); Redis::set('wechat_group_api:group_nick:'.$group_nick,json_encode($group_api)); v('redis_group_api_set:'.json_encode($group_api)); }else{ $group_api = objectToArray(json_decode($group_api)); } $result['group'] = $group; $result['group_api'] = $group_api; } // $result['group']['domain'] = 'http://api.zsy.com/api/'; // v('$get_wechat_group_gzh');v($result); return $result; } }