|
@@ -55,7 +55,7 @@ class CoflController extends Controller
|
|
|
//$user = $this->getUsers($openid);
|
|
|
$test_param = $request->input('test',0);
|
|
|
//if($test_param ==1 || $test_param =='1' ) {
|
|
|
- $user = $this->getUsersV2($openid,$bid);
|
|
|
+ $user = $this->getUsersV2($openid);
|
|
|
//}
|
|
|
|
|
|
if(!$user[0]){
|
|
@@ -107,7 +107,8 @@ class CoflController extends Controller
|
|
|
$this->stats('reward_200',$crm);
|
|
|
$fee = $this->freeCurrencyFee($token,$rfee);
|
|
|
}
|
|
|
- $user = $this->getUsers($openid);
|
|
|
+ //$user = $this->getUsers($openid);
|
|
|
+ $user = $this->getUsersV2($openid);
|
|
|
if(!$user || !$user[0] || !$user[1]) return redirect()->to($this->getLink().'?'.http_build_query($params));
|
|
|
|
|
|
if($type == 'CRM'){
|
|
@@ -312,8 +313,8 @@ class CoflController extends Controller
|
|
|
* @param $openid
|
|
|
* @return array
|
|
|
*/
|
|
|
- private function getUsersV2($openid,$bid){
|
|
|
- $friend_link_uid_bind = DB::table('friend_link_uid_bind')->where('openid',$openid)->where('bid',$bid)->first();
|
|
|
+ private function getUsersV2($openid){
|
|
|
+ $friend_link_uid_bind = DB::table('friend_link_uid_bind')->where('openid',$openid)->first();
|
|
|
if($friend_link_uid_bind) {
|
|
|
$user = User::where('id',$friend_link_uid_bind->uid)->select('id','distribution_channel_id')->first();
|
|
|
if($user) {
|
|
@@ -344,7 +345,7 @@ class CoflController extends Controller
|
|
|
}
|
|
|
}
|
|
|
if(count($inner_channel_uid_list) == 1) {
|
|
|
- $insert_data = ['uid'=>$inner_channel_uid_list[0]->id,'bid'=>$bid,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
+ $insert_data = ['uid'=>$inner_channel_uid_list[0]->id,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
\Log::info('anchor:count $inner_channel_uid_list =1');
|
|
|
DB::table('friend_link_uid_bind')->insert($insert_data);
|
|
|
return [$inner_channel_uid_list[0]->id,$inner_channel_uid_list[0]->distribution_channel_id];
|
|
@@ -363,7 +364,7 @@ class CoflController extends Controller
|
|
|
foreach ($users as $item) {
|
|
|
if($item->id == $year_order->uid) {
|
|
|
//筛选包年结束时间最后的UID
|
|
|
- $insert_data = ['uid'=>$item->id,'bid'=>$bid,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
+ $insert_data = ['uid'=>$item->id,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
\Log::info('anchor:year_order');
|
|
|
DB::table('friend_link_uid_bind')->insert($insert_data);
|
|
|
return [$item->id,$item->distribution_channel_id];
|
|
@@ -378,10 +379,10 @@ class CoflController extends Controller
|
|
|
->table('chapter_orders'.$table_prefix)
|
|
|
->where('created_at','>=',date('Y-m-d H:i:s',strtotime('-3 day')))
|
|
|
->where('uid',$each->id)
|
|
|
- ->where('bid',$bid)
|
|
|
+ //->where('bid',$bid)
|
|
|
->count('id');
|
|
|
$book_order = BookOrder::where('uid',$each->id)
|
|
|
- ->where('bid',$bid)
|
|
|
+ //->where('bid',$bid)
|
|
|
->where('created_at','>=',date('Y-m-d H:i:s',strtotime('-3 day')))
|
|
|
->first();
|
|
|
if($book_order) {
|
|
@@ -395,7 +396,7 @@ class CoflController extends Controller
|
|
|
}
|
|
|
}
|
|
|
if($users_select['id'] >0) {
|
|
|
- $insert_data = ['uid'=>$users_select['user']->id,'bid'=>$bid,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
+ $insert_data = ['uid'=>$users_select['user']->id,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
\Log::info('anchor:subs_chapter');
|
|
|
DB::table('friend_link_uid_bind')->insert($insert_data);
|
|
|
return [$users_select['user']->id,$users_select['user']->distribution_channel_id];
|
|
@@ -407,11 +408,11 @@ class CoflController extends Controller
|
|
|
$chapter_order = DB::connection('chapter_order_mysql')
|
|
|
->table('chapter_orders'.$table_prefix)
|
|
|
->where('uid',$value->id)
|
|
|
- ->where('bid',$bid)
|
|
|
+ //->where('bid',$bid)
|
|
|
->orderBy('created_at','desc')
|
|
|
->first();
|
|
|
$book_order = BookOrder::where('uid',$value->id)
|
|
|
- ->where('bid',$bid)
|
|
|
+ //->where('bid',$bid)
|
|
|
->first();
|
|
|
if($chapter_order ){
|
|
|
if(strtotime($chapter_order->created_at) > $users_select['create_time']) {
|
|
@@ -430,7 +431,7 @@ class CoflController extends Controller
|
|
|
|
|
|
}
|
|
|
if($users_select['id'] >0) {
|
|
|
- $insert_data = ['uid'=>$users_select['user']->id,'bid'=>$bid,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
+ $insert_data = ['uid'=>$users_select['user']->id,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
\Log::info('anchor:subs_');
|
|
|
DB::table('friend_link_uid_bind')->insert($insert_data);
|
|
|
return [$users_select['user']->id,$users_select['user']->distribution_channel_id];
|
|
@@ -438,7 +439,7 @@ class CoflController extends Controller
|
|
|
|
|
|
if(count($inner_channel_uid_list)>1) {
|
|
|
//有多个网站运营部UID,针对网站运营部UID进入到下一步筛选
|
|
|
- $insert_data = ['uid'=>$inner_channel_uid_list[0]->id,'bid'=>$bid,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
+ $insert_data = ['uid'=>$inner_channel_uid_list[0]->id,'openid'=>$openid ,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
|
|
|
\Log::info('anchor:count $inner_channel_uid_list >1');
|
|
|
DB::table('friend_link_uid_bind')->insert($insert_data);
|
|
|
return [$inner_channel_uid_list[0]['id'],$inner_channel_uid_list[0]['distribution_channel_id']];
|