|
@@ -134,10 +134,7 @@ class CoflController extends Controller
|
|
$user = $this->getUsers($openid);
|
|
$user = $this->getUsers($openid);
|
|
if($user[0]){
|
|
if($user[0]){
|
|
$url_format = '%s://site%s.%s.com%s';
|
|
$url_format = '%s://site%s.%s.com%s';
|
|
- $url = sprintf(
|
|
|
|
- $url_format,
|
|
|
|
- env('PROTOCOL'),
|
|
|
|
- encodeDistributionChannelId($user[1]),
|
|
|
|
|
|
+ $url = sprintf($url_format, env('PROTOCOL'), encodeDistributionChannelId($user[1]),
|
|
env('CUSTOM_HOST'),
|
|
env('CUSTOM_HOST'),
|
|
$activity->activity_page
|
|
$activity->activity_page
|
|
);
|
|
);
|
|
@@ -148,6 +145,46 @@ class CoflController extends Controller
|
|
return redirect()->to($default_ink);
|
|
return redirect()->to($default_ink);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function recent(Request $request){
|
|
|
|
+ $openid = $request->get('openid');
|
|
|
|
+ //授权
|
|
|
|
+ $params = $request->except('_url');
|
|
|
|
+ if(empty($openid)){
|
|
|
|
+ $url = url()->current() . '?' . http_build_query($params);
|
|
|
|
+ $params['redirect_url'] = urlencode($url);
|
|
|
|
+ $app = new Application($this->auth($params));
|
|
|
|
+ return $app->oauth->redirect();
|
|
|
|
+ }
|
|
|
|
+ $user = $this->getUsers($openid);
|
|
|
|
+ if(!$user[0]){
|
|
|
|
+ $distribution_channel_id = 123;
|
|
|
|
+ }else{
|
|
|
|
+ $distribution_channel_id = $user[1];
|
|
|
|
+ }
|
|
|
|
+ $link = $this->getLink($distribution_channel_id).'recent';
|
|
|
|
+ return redirect()->to($link);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function person(Request $request){
|
|
|
|
+ $openid = $request->get('openid');
|
|
|
|
+ //授权
|
|
|
|
+ $params = $request->except('_url');
|
|
|
|
+ if(empty($openid)){
|
|
|
|
+ $url = url()->current() . '?' . http_build_query($params);
|
|
|
|
+ $params['redirect_url'] = urlencode($url);
|
|
|
|
+ $app = new Application($this->auth($params));
|
|
|
|
+ return $app->oauth->redirect();
|
|
|
|
+ }
|
|
|
|
+ $user = $this->getUsers($openid);
|
|
|
|
+ if(!$user[0]){
|
|
|
|
+ $distribution_channel_id = 123;
|
|
|
|
+ }else{
|
|
|
|
+ $distribution_channel_id = $user[1];
|
|
|
|
+ }
|
|
|
|
+ $link = $this->getLink($distribution_channel_id).'person';
|
|
|
|
+ return redirect()->to($link);
|
|
|
|
+ }
|
|
|
|
+
|
|
private function getUsers($openid){
|
|
private function getUsers($openid){
|
|
$users = User::where('openid',$openid)->select('id','distribution_channel_id')->get();
|
|
$users = User::where('openid',$openid)->select('id','distribution_channel_id')->get();
|
|
if($users->isEmpty()) return [0,0];
|
|
if($users->isEmpty()) return [0,0];
|
|
@@ -199,4 +236,5 @@ class CoflController extends Controller
|
|
return $options;
|
|
return $options;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function stats(){}
|
|
}
|
|
}
|