|
@@ -12,6 +12,7 @@ use App\Modules\User\Services\ForceGuidePersonAccountService;
|
|
|
use App\Modules\User\Services\ReadRecordService;
|
|
|
use App\Modules\User\Services\UserBindHkWelfareService;
|
|
|
use App\Modules\User\Services\UserBindPhoneService;
|
|
|
+use App\Modules\User\Services\UserDivisionCpcPropertyService;
|
|
|
use App\Modules\User\Services\UserWealthyOperateRecordService;
|
|
|
use App\Modules\User\Services\WapReaderPageFissionService;
|
|
|
use Illuminate\Http\Request;
|
|
@@ -73,8 +74,9 @@ class UserController extends BaseController
|
|
|
* }
|
|
|
* }
|
|
|
*/
|
|
|
- public function index(){
|
|
|
- if(!$this->checkUid()){
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ if (!$this->checkUid()) {
|
|
|
return response()->error('NOT_LOGIN');
|
|
|
}
|
|
|
|
|
@@ -82,9 +84,9 @@ class UserController extends BaseController
|
|
|
$data['bind'] = 0;
|
|
|
$data['bind_phone'] = '';
|
|
|
$data['is_paid'] = $this->is_paid;
|
|
|
- if($this->is_paid){
|
|
|
+ if ($this->is_paid) {
|
|
|
$bind_info = UserBindPhoneService::bindInfo($this->uid);
|
|
|
- if($bind_info){
|
|
|
+ if ($bind_info) {
|
|
|
$data['bind'] = 1;
|
|
|
$data['bind_phone'] = $bind_info->phone;
|
|
|
}
|
|
@@ -93,25 +95,25 @@ class UserController extends BaseController
|
|
|
$data['is_vip'] = 0;
|
|
|
$data['vip_days'] = 0;
|
|
|
$year_record = YearOrderService::getRecord($this->uid);
|
|
|
- if($year_record){
|
|
|
+ if ($year_record) {
|
|
|
$data['is_vip'] = 1;
|
|
|
|
|
|
- $time = strtotime($year_record['end_time'])-time();
|
|
|
- if($time>=86400){
|
|
|
- $data['vip_days'] = floor($time/86400).'天';
|
|
|
- }elseif ($time>3600) {
|
|
|
- $data['vip_days'] = floor($time/3600).'小时';
|
|
|
- }elseif ($time>60) {
|
|
|
- $data['vip_days'] = floor($time/60).'分钟';
|
|
|
- }else{
|
|
|
- $data['vip_days'] = $time.'秒';
|
|
|
+ $time = strtotime($year_record['end_time']) - time();
|
|
|
+ if ($time >= 86400) {
|
|
|
+ $data['vip_days'] = floor($time / 86400) . '天';
|
|
|
+ } elseif ($time > 3600) {
|
|
|
+ $data['vip_days'] = floor($time / 3600) . '小时';
|
|
|
+ } elseif ($time > 60) {
|
|
|
+ $data['vip_days'] = floor($time / 60) . '分钟';
|
|
|
+ } else {
|
|
|
+ $data['vip_days'] = $time . '秒';
|
|
|
}
|
|
|
}
|
|
|
$data['is_all_life'] = 0;
|
|
|
$activity_id = env('FOREVER_ACTIVITY_ID');
|
|
|
- if($activity_id){
|
|
|
- if(OrderService::userIsParticipateActivity($this->uid,$activity_id)){
|
|
|
- $data['is_vip'] = 0 ;
|
|
|
+ if ($activity_id) {
|
|
|
+ if (OrderService::userIsParticipateActivity($this->uid, $activity_id)) {
|
|
|
+ $data['is_vip'] = 0;
|
|
|
$data['vip_days'] = '99年';
|
|
|
$data['is_all_life'] = 1;
|
|
|
}
|
|
@@ -159,63 +161,66 @@ class UserController extends BaseController
|
|
|
* }
|
|
|
* }
|
|
|
*/
|
|
|
- public function signRecord(Request $request){
|
|
|
- $sign_result = paginationTransform(new SignRecordTransformer(),UserSignService::getUserSignRecord($this->uid));
|
|
|
+ public function signRecord(Request $request)
|
|
|
+ {
|
|
|
+ $sign_result = paginationTransform(new SignRecordTransformer(), UserSignService::getUserSignRecord($this->uid));
|
|
|
$sign_status = UserSignService::isSign($this->uid);
|
|
|
$sign_today = [];
|
|
|
- if($sign_status){
|
|
|
- $sign_today = ReadRecordService::getByField($this->uid,'sign_info');
|
|
|
- if($sign_today) $sign_today = json_decode($sign_today,1);
|
|
|
- isset($sign_today['sign_time']) && $sign_today['sign_time'] = date('Y-m-d H:i:s',$sign_today['sign_time']);
|
|
|
+ if ($sign_status) {
|
|
|
+ $sign_today = ReadRecordService::getByField($this->uid, 'sign_info');
|
|
|
+ if ($sign_today) $sign_today = json_decode($sign_today, 1);
|
|
|
+ isset($sign_today['sign_time']) && $sign_today['sign_time'] = date('Y-m-d H:i:s', $sign_today['sign_time']);
|
|
|
isset($sign_today['sign_at']) && $sign_today['sign_time'] = $sign_today['sign_at'];
|
|
|
isset($sign_today['price']) && $sign_today['reward'] = $sign_today['price'];
|
|
|
}
|
|
|
$result = [
|
|
|
- 'sign_status'=>$sign_status,
|
|
|
- 'sign_result'=>$sign_result,
|
|
|
- 'sign_today'=>$sign_today
|
|
|
+ 'sign_status' => $sign_status,
|
|
|
+ 'sign_result' => $sign_result,
|
|
|
+ 'sign_today' => $sign_today
|
|
|
];
|
|
|
return response()->success($result);
|
|
|
}
|
|
|
|
|
|
- public function getCoupons(Request $request){
|
|
|
+ public function getCoupons(Request $request)
|
|
|
+ {
|
|
|
$activity_id = $request->input('activity_id');
|
|
|
- if(!DB::table('discount_coupons')->where('uid',$this->uid)->where('activity_id',$activity_id)->count()){
|
|
|
+ if (!DB::table('discount_coupons')->where('uid', $this->uid)->where('activity_id', $activity_id)->count()) {
|
|
|
DB::table('discount_coupons')->insert([
|
|
|
- 'uid'=>$this->uid,
|
|
|
- 'activity_id'=>$activity_id,
|
|
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
- 'updated_at'=>date('Y-m-d H:i:s')
|
|
|
+ 'uid' => $this->uid,
|
|
|
+ 'activity_id' => $activity_id,
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
return response()->success();
|
|
|
}
|
|
|
|
|
|
- public function sign(Request $request){
|
|
|
+ public function sign(Request $request)
|
|
|
+ {
|
|
|
//sign_days
|
|
|
//$day = date('Y-m-d');
|
|
|
$sign = UserSignService::isSign($this->uid);
|
|
|
$sign_count = ReadRecordService::getSignCount($this->uid);
|
|
|
- if($sign){
|
|
|
+ if ($sign) {
|
|
|
//如果已经签过到
|
|
|
- if(!$sign_count){
|
|
|
- ReadRecordService::setSignCount($this->uid,1);
|
|
|
+ if (!$sign_count) {
|
|
|
+ ReadRecordService::setSignCount($this->uid, 1);
|
|
|
ReadRecordService::setSignDay($this->uid);
|
|
|
$sign_count = 1;
|
|
|
}
|
|
|
$fee = 30;
|
|
|
- if($sign_count>=3){
|
|
|
+ if ($sign_count >= 3) {
|
|
|
$fee = 50;
|
|
|
}
|
|
|
- $data = ['sign_days'=>$sign_count,'sign_reard'=>$fee,'status'=>1];
|
|
|
+ $data = ['sign_days' => $sign_count, 'sign_reard' => $fee, 'status' => 1];
|
|
|
return response()->success($data);
|
|
|
}
|
|
|
|
|
|
//还没有签到
|
|
|
$status = UserSignService::signToday($this->uid);
|
|
|
$sign_count = ReadRecordService::getSignCount($this->uid);
|
|
|
- $data = ['sign_days'=>$sign_count,'sign_reard'=>$status,'status'=>0];
|
|
|
+ $data = ['sign_days' => $sign_count, 'sign_reard' => $status, 'status' => 0];
|
|
|
return response()->success($data);
|
|
|
}
|
|
|
|
|
@@ -231,32 +236,32 @@ class UserController extends BaseController
|
|
|
}*/
|
|
|
$version = UserSignService::getUserSignVersion($this->uid);
|
|
|
|
|
|
- if($version == 'v1'){
|
|
|
+ if ($version == 'v1') {
|
|
|
$page = 'wap.sign';
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$page = 'wap.signv2';
|
|
|
}
|
|
|
- $book1= $book2 = null;
|
|
|
- if($version == 'v2' ){
|
|
|
+ $book1 = $book2 = null;
|
|
|
+ if ($version == 'v2') {
|
|
|
$sex = $this->_user_info->sex;
|
|
|
- $sex = $sex?$sex:2;
|
|
|
+ $sex = $sex ? $sex : 2;
|
|
|
$book1 = BookConfigService::getRandomOneHighQualityBook($sex);
|
|
|
- $book1->url = sprintf('/reader?bid=%s&cid=%s&source=wechatmsg&fromtype=sign_recommend',Hashids::encode($book1->bid),$book1->first_cid);
|
|
|
+ $book1->url = sprintf('/reader?bid=%s&cid=%s&source=wechatmsg&fromtype=sign_recommend', Hashids::encode($book1->bid), $book1->first_cid);
|
|
|
$book2 = SignBookService::getRandomBook($sex);
|
|
|
\Log::info($book2);
|
|
|
- foreach ($book2 as $item){
|
|
|
- $item->url = sprintf('/reader?bid=%s&cid=%s&source=wechatmsg&fromtype=sign_recommend',Hashids::encode($item->bid),$item->first_cid);
|
|
|
+ foreach ($book2 as $item) {
|
|
|
+ $item->url = sprintf('/reader?bid=%s&cid=%s&source=wechatmsg&fromtype=sign_recommend', Hashids::encode($item->bid), $item->first_cid);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- $tomorrow_pool = $fee_pool = [0,30,50,120,50,50,50,150];
|
|
|
- $day = [0,'一','二','三','四','五','六','七'];
|
|
|
- list($sign,$sign_count) = ReadRecordService::getByMultiField($this->uid,'sign_day','sign_counts');
|
|
|
+ $tomorrow_pool = $fee_pool = [0, 30, 50, 120, 50, 50, 50, 150];
|
|
|
+ $day = [0, '一', '二', '三', '四', '五', '六', '七'];
|
|
|
+ list($sign, $sign_count) = ReadRecordService::getByMultiField($this->uid, 'sign_day', 'sign_counts');
|
|
|
if ($sign && $sign == date('Y-m-d')) {
|
|
|
- if($version == 'v1'){
|
|
|
- $fee = $sign_count>=3 ? 50:30;
|
|
|
- }else{
|
|
|
- if ($sign_count % 7 == 1 && $sign_count<=7) {
|
|
|
+ if ($version == 'v1') {
|
|
|
+ $fee = $sign_count >= 3 ? 50 : 30;
|
|
|
+ } else {
|
|
|
+ if ($sign_count % 7 == 1 && $sign_count <= 7) {
|
|
|
$fee = 30;
|
|
|
} elseif ($sign_count % 7 == 3) {
|
|
|
$fee = 120;
|
|
@@ -266,43 +271,45 @@ class UserController extends BaseController
|
|
|
$fee = 50;
|
|
|
}
|
|
|
}
|
|
|
- if($sign_count >=8){
|
|
|
+ if ($sign_count >= 8) {
|
|
|
$fee_pool[1] = 50;
|
|
|
}
|
|
|
|
|
|
- $tomorrow = (($sign_count+1) % 7 == 0? 7:($sign_count+1) % 7);
|
|
|
- if($sign_count+1 >=8){
|
|
|
+ $tomorrow = (($sign_count + 1) % 7 == 0 ? 7 : ($sign_count + 1) % 7);
|
|
|
+ if ($sign_count + 1 >= 8) {
|
|
|
$tomorrow_pool[1] = 50;
|
|
|
}
|
|
|
//签过到了
|
|
|
- $data = ['sign_count'=>$sign_count,'fee'=>$fee,'fee_pool'=>$fee_pool,'day'=>$day,'book1'=>$book1,'book2'=>$book2,'tomorrow_fee'=>$tomorrow_pool[$tomorrow]];
|
|
|
- return view($page,$data);
|
|
|
+ $data = ['sign_count' => $sign_count, 'fee' => $fee, 'fee_pool' => $fee_pool, 'day' => $day, 'book1' => $book1, 'book2' => $book2, 'tomorrow_fee' => $tomorrow_pool[$tomorrow]];
|
|
|
+ return view($page, $data);
|
|
|
}
|
|
|
- $fee = UserSignService::signToday($this->uid,$version);
|
|
|
- if(!$fee){
|
|
|
+ $fee = UserSignService::signToday($this->uid, $version);
|
|
|
+ if (!$fee) {
|
|
|
return response()->error('WAP_SYS_ERROR');
|
|
|
}
|
|
|
$sign_count = ReadRecordService::getSignCount($this->uid);
|
|
|
- if($sign_count >=8){
|
|
|
+ if ($sign_count >= 8) {
|
|
|
$fee_pool[1] = 50;
|
|
|
}
|
|
|
- if($sign_count+1 >=8){
|
|
|
+ if ($sign_count + 1 >= 8) {
|
|
|
$tomorrow_pool[1] = 50;
|
|
|
}
|
|
|
- $tomorrow = (($sign_count+1) % 7 == 0? 7:($sign_count+1) % 7);
|
|
|
- $data = ['sign_count'=>$sign_count,'fee'=>$fee,'fee_pool'=>$fee_pool,'day'=>$day,'book1'=>$book1,'book2'=>$book2,'tomorrow_fee'=>$tomorrow_pool[$tomorrow]];
|
|
|
- return view($page,$data);
|
|
|
+ $tomorrow = (($sign_count + 1) % 7 == 0 ? 7 : ($sign_count + 1) % 7);
|
|
|
+ $data = ['sign_count' => $sign_count, 'fee' => $fee, 'fee_pool' => $fee_pool, 'day' => $day, 'book1' => $book1, 'book2' => $book2, 'tomorrow_fee' => $tomorrow_pool[$tomorrow]];
|
|
|
+ return view($page, $data);
|
|
|
}
|
|
|
- public function signV3(){
|
|
|
+
|
|
|
+ public function signV3()
|
|
|
+ {
|
|
|
//修改签到页面,version=v2
|
|
|
- $fee_pool = [0,30,50,120,50,50,50,150];
|
|
|
- list($sign,$sign_count) = ReadRecordService::getByMultiField($this->uid,'sign_day','sign_counts');
|
|
|
+ $fee_pool = [0, 30, 50, 120, 50, 50, 50, 150];
|
|
|
+ list($sign, $sign_count) = ReadRecordService::getByMultiField($this->uid, 'sign_day', 'sign_counts');
|
|
|
$read_record = $this->getSignPageReadRecord($all_bid);
|
|
|
- if(!$all_bid)$all_bid = [];
|
|
|
+ if (!$all_bid) $all_bid = [];
|
|
|
$user = $this->_user_info;
|
|
|
- $recommend_book = $this->getSignRecomandBook($user->sex,$all_bid);
|
|
|
+ $recommend_book = $this->getSignRecomandBook($user->sex, $all_bid);
|
|
|
if ($sign && $sign == date('Y-m-d')) {
|
|
|
- if ($sign_count % 7 == 1 && $sign_count<=7) {
|
|
|
+ if ($sign_count % 7 == 1 && $sign_count <= 7) {
|
|
|
$fee = 30;
|
|
|
} elseif ($sign_count % 7 == 3) {
|
|
|
$fee = 120;
|
|
@@ -311,11 +318,11 @@ class UserController extends BaseController
|
|
|
} else {
|
|
|
$fee = 50;
|
|
|
}
|
|
|
- if($sign_count >=8){
|
|
|
+ if ($sign_count >= 8) {
|
|
|
$fee_pool[1] = 50;
|
|
|
}
|
|
|
- $day = $sign_count%7;
|
|
|
- if($day == 0){
|
|
|
+ $day = $sign_count % 7;
|
|
|
+ if ($day == 0) {
|
|
|
$day = 7;
|
|
|
}
|
|
|
|
|
@@ -323,47 +330,48 @@ class UserController extends BaseController
|
|
|
$name = $user->nickname;
|
|
|
$head_img = $user->head_img;
|
|
|
$balance = $user->balance;
|
|
|
- $data = ['sign_count'=>$sign_count,'fee'=>$fee,'fee_pool'=>$fee_pool,
|
|
|
- 'day'=>$day,'is_alert'=>0,'read_record'=>$read_record,'name'=>$name,
|
|
|
- 'head_img'=>$head_img,
|
|
|
- 'balance'=>$balance,
|
|
|
- 'recommend_book'=>$recommend_book
|
|
|
+ $data = ['sign_count' => $sign_count, 'fee' => $fee, 'fee_pool' => $fee_pool,
|
|
|
+ 'day' => $day, 'is_alert' => 0, 'read_record' => $read_record, 'name' => $name,
|
|
|
+ 'head_img' => $head_img,
|
|
|
+ 'balance' => $balance,
|
|
|
+ 'recommend_book' => $recommend_book
|
|
|
];
|
|
|
- return view('wap.signV3',$data);
|
|
|
+ return view('wap.signV3', $data);
|
|
|
}
|
|
|
- $fee = UserSignService::signToday($this->uid,'v2');
|
|
|
- if(!$fee){
|
|
|
+ $fee = UserSignService::signToday($this->uid, 'v2');
|
|
|
+ if (!$fee) {
|
|
|
return response()->error('WAP_SYS_ERROR');
|
|
|
}
|
|
|
$sign_count = ReadRecordService::getSignCount($this->uid);
|
|
|
//$sign_count++;
|
|
|
- if($sign_count >=8){
|
|
|
+ if ($sign_count >= 8) {
|
|
|
$fee_pool[1] = 50;
|
|
|
}
|
|
|
- $day = $sign_count%7;
|
|
|
- if($day == 0){
|
|
|
+ $day = $sign_count % 7;
|
|
|
+ if ($day == 0) {
|
|
|
$day = 7;
|
|
|
}
|
|
|
//签过到了
|
|
|
$name = $user->nickname;
|
|
|
$head_img = $user->head_img;
|
|
|
$balance = $user->balance;
|
|
|
- $data = ['sign_count'=>$sign_count,'fee'=>$fee,'fee_pool'=>$fee_pool,
|
|
|
- 'day'=>$day,'is_alert'=>1,'read_record'=>$read_record,
|
|
|
- 'name'=>$name,
|
|
|
- 'head_img'=>$head_img,
|
|
|
- 'balance'=>$balance,
|
|
|
- 'recommend_book'=>$recommend_book
|
|
|
+ $data = ['sign_count' => $sign_count, 'fee' => $fee, 'fee_pool' => $fee_pool,
|
|
|
+ 'day' => $day, 'is_alert' => 1, 'read_record' => $read_record,
|
|
|
+ 'name' => $name,
|
|
|
+ 'head_img' => $head_img,
|
|
|
+ 'balance' => $balance,
|
|
|
+ 'recommend_book' => $recommend_book
|
|
|
];
|
|
|
- return view('wap.signV3',$data);
|
|
|
+ return view('wap.signV3', $data);
|
|
|
}
|
|
|
|
|
|
- private function getSignPageReadRecord(&$all_id){
|
|
|
+ private function getSignPageReadRecord(&$all_id)
|
|
|
+ {
|
|
|
$res = ReadRecordService::getReadRecord($this->uid);
|
|
|
- if($res){
|
|
|
+ if ($res) {
|
|
|
$id_arr = [];
|
|
|
foreach ($res as $key => $value) {
|
|
|
- if($key < 2){
|
|
|
+ if ($key < 2) {
|
|
|
$id_arr[] = $value['bid'];
|
|
|
}
|
|
|
$all_id[] = $value['bid'];
|
|
@@ -372,17 +380,17 @@ class UserController extends BaseController
|
|
|
$book = BookConfigService::getBooksByIds($id_arr);
|
|
|
foreach ($res as $key => &$value) {
|
|
|
$value['cover'] = '';
|
|
|
- $value['url'] = sprintf('/reader?bid=%s&cid=%s',Hashids::encode($value['bid']),$value['cid']);
|
|
|
+ $value['url'] = sprintf('/reader?bid=%s&cid=%s', Hashids::encode($value['bid']), $value['cid']);
|
|
|
$value['last_chapter'] = 0;
|
|
|
$value['update_count'] = 0;
|
|
|
- foreach ($book as $val) {
|
|
|
- if($value['bid'] == $val->bid){
|
|
|
+ foreach ($book as $val) {
|
|
|
+ if ($value['bid'] == $val->bid) {
|
|
|
$value['cover'] = $val->cover;
|
|
|
$value['last_chapter'] = $val->last_chapter;
|
|
|
- if($val->status == 0){
|
|
|
+ if ($val->status == 0) {
|
|
|
$value['update_count'] = DB::table('book_updates')
|
|
|
- ->where('bid',$val->bid)->where('update_type','add_chapter')
|
|
|
- ->where('created_at','>=',date('Y-m-d H:i:s',$value['time']))
|
|
|
+ ->where('bid', $val->bid)->where('update_type', 'add_chapter')
|
|
|
+ ->where('created_at', '>=', date('Y-m-d H:i:s', $value['time']))
|
|
|
->sum('update_chapter_count');
|
|
|
}
|
|
|
break;
|
|
@@ -394,75 +402,77 @@ class UserController extends BaseController
|
|
|
}
|
|
|
return $res;
|
|
|
}
|
|
|
- private function getSignRecomandBook(int $sex,array $all_bid):array
|
|
|
+
|
|
|
+ private function getSignRecomandBook(int $sex, array $all_bid):array
|
|
|
{
|
|
|
- if($sex == 1){
|
|
|
+ if ($sex == 1) {
|
|
|
$set_key = 'male_high_reco_bids';
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$set_key = 'female_high_reco_bids';
|
|
|
}
|
|
|
$bids = Cookie::get('sign_recomand_bids');
|
|
|
- if(!$bids){
|
|
|
- $bid_array = Redis::Srandmember($set_key,16);
|
|
|
+ if (!$bids) {
|
|
|
+ $bid_array = Redis::Srandmember($set_key, 16);
|
|
|
//Log::info($bid_array);
|
|
|
- $time = strtotime(date('Y-m-d',time()+86400))-time();
|
|
|
+ $time = strtotime(date('Y-m-d', time() + 86400)) - time();
|
|
|
$new_bid_array = [];
|
|
|
- foreach ($bid_array as $item){
|
|
|
- if(in_array($item,$all_bid)){
|
|
|
- array_unshift($new_bid_array,$item);
|
|
|
- }else{
|
|
|
- array_push($new_bid_array,$item);
|
|
|
+ foreach ($bid_array as $item) {
|
|
|
+ if (in_array($item, $all_bid)) {
|
|
|
+ array_unshift($new_bid_array, $item);
|
|
|
+ } else {
|
|
|
+ array_push($new_bid_array, $item);
|
|
|
}
|
|
|
}
|
|
|
- $bids = implode(',',$new_bid_array);
|
|
|
- Cookie::queue('sign_recomand_bids',$bids,$time);
|
|
|
+ $bids = implode(',', $new_bid_array);
|
|
|
+ Cookie::queue('sign_recomand_bids', $bids, $time);
|
|
|
}
|
|
|
//Log::info($bids);
|
|
|
- $result = DB::select(sprintf('select book_configs.book_name,intro,bid,books.category_name,book_configs.cover,first_cid,
|
|
|
+ $result = DB::select(sprintf('select book_configs.book_name,intro,bid,books.category_name,book_configs.cover,first_cid,
|
|
|
(select GROUP_CONCAT(tags) from book_tags where bid = book_configs.bid and `status` = 1) as tag from book_configs
|
|
|
left join books on books.id = book_configs.bid left join book_categories on book_categories.id = books.category_id
|
|
|
-where bid in (%s) and is_on_shelf =2 ORDER by field(book_configs.bid,%s)',$bids,$bids));
|
|
|
+where bid in (%s) and is_on_shelf =2 ORDER by field(book_configs.bid,%s)', $bids, $bids));
|
|
|
$data = [];
|
|
|
- foreach ($result as $item){
|
|
|
+ foreach ($result as $item) {
|
|
|
$tag_list = [];
|
|
|
- if($item->tag){
|
|
|
- $tag_list = explode(',',$item->tag);
|
|
|
+ if ($item->tag) {
|
|
|
+ $tag_list = explode(',', $item->tag);
|
|
|
}
|
|
|
$data[] = [
|
|
|
- 'book_name'=>$item->book_name,
|
|
|
- 'intro'=>$item->intro,
|
|
|
- 'bid'=>$item->bid,
|
|
|
- 'category_name'=>$item->category_name,
|
|
|
- 'cover'=>$item->cover,
|
|
|
- 'tag'=>$item->tag,
|
|
|
- 'tag_list'=>$tag_list,
|
|
|
- 'url'=>sprintf('/reader?bid=%s&cid=%s&source=wechatmsg&fromtype=sign_recommend',Hashids::encode($item->bid),$item->first_cid),
|
|
|
+ 'book_name' => $item->book_name,
|
|
|
+ 'intro' => $item->intro,
|
|
|
+ 'bid' => $item->bid,
|
|
|
+ 'category_name' => $item->category_name,
|
|
|
+ 'cover' => $item->cover,
|
|
|
+ 'tag' => $item->tag,
|
|
|
+ 'tag_list' => $tag_list,
|
|
|
+ 'url' => sprintf('/reader?bid=%s&cid=%s&source=wechatmsg&fromtype=sign_recommend', Hashids::encode($item->bid), $item->first_cid),
|
|
|
];
|
|
|
}
|
|
|
return $data;
|
|
|
|
|
|
}
|
|
|
|
|
|
- public function recordShare(Request $request){
|
|
|
- if(!$this->checkUid()){
|
|
|
+ public function recordShare(Request $request)
|
|
|
+ {
|
|
|
+ if (!$this->checkUid()) {
|
|
|
return response()->error('NOT_LOGIN');
|
|
|
}
|
|
|
$uid = $this->uid;
|
|
|
$distribution_channel_id = $this->distribution_channel_id;
|
|
|
$type = 'click';
|
|
|
$bid = $request->get('bid');
|
|
|
- $cid = $request->get('cid',0);
|
|
|
- if(!$bid){
|
|
|
+ $cid = $request->get('cid', 0);
|
|
|
+ if (!$bid) {
|
|
|
return response()->error('PARAM_ERROR');
|
|
|
}
|
|
|
!is_numeric($bid) && $bid = Hashids::decode($bid)[0];
|
|
|
- WapReaderPageFissionService::createV2($uid,$bid,$distribution_channel_id,$type,0,$cid);
|
|
|
+ WapReaderPageFissionService::createV2($uid, $bid, $distribution_channel_id, $type, 0, $cid);
|
|
|
$user = $this->_user_info;
|
|
|
$data = [];
|
|
|
- if(in_array($distribution_channel_id,[2,14,211]) && $user){
|
|
|
+ if (in_array($distribution_channel_id, [2, 14, 211]) && $user) {
|
|
|
$data['username'] = $user->nickname;
|
|
|
$data['head_img'] = $user->head_img;
|
|
|
- $url = 'https://'._domain().'/detail?fromtype=readershare&id='.Hashids::encode($bid).'&fromflag='.$uid;
|
|
|
+ $url = 'https://' . _domain() . '/detail?fromtype=readershare&id=' . Hashids::encode($bid) . '&fromflag=' . $uid;
|
|
|
//$url = str_replace('http://', $h5_scheme . '://', url()->current() . '?' . http_build_query($params));
|
|
|
$data['share_url'] = $url;
|
|
|
}
|
|
@@ -499,37 +509,39 @@ where bid in (%s) and is_on_shelf =2 ORDER by field(book_configs.bid,%s)',$bids
|
|
|
* }
|
|
|
* }
|
|
|
*/
|
|
|
- public function adVisitStat(Request $request){
|
|
|
+ public function adVisitStat(Request $request)
|
|
|
+ {
|
|
|
$bid = $request->get('bid');
|
|
|
- $cid = $request->get('cid',0);
|
|
|
+ $cid = $request->get('cid', 0);
|
|
|
$type = $request->get('type');
|
|
|
- if(!$bid || !$type){
|
|
|
+ if (!$bid || !$type) {
|
|
|
return response()->error('PARAM_ERROR');
|
|
|
}
|
|
|
!is_numeric($bid) && $bid = Hashids::decode($bid)[0];
|
|
|
- AdVisitStatService::create($this->uid,$bid,$cid,$type);
|
|
|
+ AdVisitStatService::create($this->uid, $bid, $cid, $type);
|
|
|
return response()->success();
|
|
|
}
|
|
|
|
|
|
- public function urgeUpdate(Request $request){
|
|
|
+ public function urgeUpdate(Request $request)
|
|
|
+ {
|
|
|
$bid = $request->get('bid');
|
|
|
- if(!$bid){
|
|
|
+ if (!$bid) {
|
|
|
return response()->error('PARAM_ERROR');
|
|
|
}
|
|
|
$bid = Hashids::decode($bid)[0];
|
|
|
|
|
|
- $result = BookUrgeUpdateService::UrgeRecord($this->uid,$bid);
|
|
|
- if($result && !$result->id){
|
|
|
- BookUrgeUpdateService::UrgeUpdate($this->uid,$bid,$result->updated_at);
|
|
|
+ $result = BookUrgeUpdateService::UrgeRecord($this->uid, $bid);
|
|
|
+ if ($result && !$result->id) {
|
|
|
+ BookUrgeUpdateService::UrgeUpdate($this->uid, $bid, $result->updated_at);
|
|
|
}
|
|
|
return response()->success();
|
|
|
}
|
|
|
|
|
|
- function logout(Request $request,$channel_id,$domain)
|
|
|
+ function logout(Request $request, $channel_id, $domain)
|
|
|
{
|
|
|
//echo $channel_id.'----';
|
|
|
//echo $domain;
|
|
|
- $domains = ['zhuishuyun','66kshu','iycdm','leyuee'];
|
|
|
+ $domains = ['zhuishuyun', '66kshu', 'iycdm', 'leyuee'];
|
|
|
|
|
|
setcookie(env('COOKIE_AUTH_WEB_WECHAT'), '', -1);
|
|
|
setcookie('u', '', -1);
|
|
@@ -539,42 +551,43 @@ where bid in (%s) and is_on_shelf =2 ORDER by field(book_configs.bid,%s)',$bids
|
|
|
//return response('logout');
|
|
|
$param = $request->except('_url');
|
|
|
$url_format = '%s://site%s.%s.com/logout?%s';
|
|
|
- if(in_array($domain,$domains)){
|
|
|
+ if (in_array($domain, $domains)) {
|
|
|
$i = 0;
|
|
|
- foreach ($domains as $k=>$v){
|
|
|
- if($v == $domain){
|
|
|
- $i = $k;
|
|
|
- }
|
|
|
- }
|
|
|
- if(isset($domains[$i+1])){
|
|
|
- $link = sprintf($url_format,env('PROTOCOL'),$channel_id,$domains[$i+1],http_build_query($param)) ;
|
|
|
- return redirect()->to($link);
|
|
|
- }
|
|
|
- }
|
|
|
- return view('help.logout');
|
|
|
+ foreach ($domains as $k => $v) {
|
|
|
+ if ($v == $domain) {
|
|
|
+ $i = $k;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isset($domains[$i + 1])) {
|
|
|
+ $link = sprintf($url_format, env('PROTOCOL'), $channel_id, $domains[$i + 1], http_build_query($param));
|
|
|
+ return redirect()->to($link);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return view('help.logout');
|
|
|
}
|
|
|
|
|
|
- function setOrderDelCookie(Request $request){
|
|
|
+ function setOrderDelCookie(Request $request)
|
|
|
+ {
|
|
|
$param = $request->except('_url');
|
|
|
- $type = isset($param['type']) ?$param['type']:'set';
|
|
|
+ $type = isset($param['type']) ? $param['type'] : 'set';
|
|
|
|
|
|
- foreach ($param as $k=>$v){
|
|
|
- if($k == 'type') continue;
|
|
|
- if($type == 'set'){
|
|
|
+ foreach ($param as $k => $v) {
|
|
|
+ if ($k == 'type') continue;
|
|
|
+ if ($type == 'set') {
|
|
|
Cookie::queue($k, $v, 1000, null, null, false, false);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
setcookie($k, '', -1);
|
|
|
}
|
|
|
}
|
|
|
return response('ok');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function test_add_user_login_cookie(Request $request)
|
|
|
{
|
|
|
- $uid = $request->get('uid');
|
|
|
- \Log::info('test_add_user_login_cookie:'.$uid);
|
|
|
- Cookie::queue(env('COOKIE_AUTH_WEB_WECHAT'), $uid, env('U_COOKIE_EXPIRE'), null, null, false, false);
|
|
|
- return response('add_cookie:'.$uid);
|
|
|
+ $uid = $request->get('uid');
|
|
|
+ \Log::info('test_add_user_login_cookie:' . $uid);
|
|
|
+ Cookie::queue(env('COOKIE_AUTH_WEB_WECHAT'), $uid, env('U_COOKIE_EXPIRE'), null, null, false, false);
|
|
|
+ return response('add_cookie:' . $uid);
|
|
|
}
|
|
|
|
|
|
//日常随机签到
|
|
@@ -582,185 +595,258 @@ where bid in (%s) and is_on_shelf =2 ORDER by field(book_configs.bid,%s)',$bids
|
|
|
{
|
|
|
$uid = $this->uid;
|
|
|
$day = date('Y-m-d');
|
|
|
- $hasSigned = UserRandSignService::hasSigned(compact('uid','day'));
|
|
|
+ $hasSigned = UserRandSignService::hasSigned(compact('uid', 'day'));
|
|
|
$fee = 0;
|
|
|
- if(!$hasSigned)
|
|
|
- {
|
|
|
- $fee = mt_rand(5,15);
|
|
|
- UserRandSignService::sign(compact('uid','day','fee'));
|
|
|
+ if (!$hasSigned) {
|
|
|
+ $fee = mt_rand(5, 15);
|
|
|
+ UserRandSignService::sign(compact('uid', 'day', 'fee'));
|
|
|
}
|
|
|
- return view('wap.rand_sign',compact('hasSigned','fee'));
|
|
|
+ return view('wap.rand_sign', compact('hasSigned', 'fee'));
|
|
|
}
|
|
|
|
|
|
- public function sendCode(Request $request){
|
|
|
+ public function sendCode(Request $request)
|
|
|
+ {
|
|
|
$phone = $request->post('phone');
|
|
|
- $code = random_int(1000,9999);
|
|
|
- Redis::setex('code:'.$phone,120,$code);
|
|
|
- AliSMS::send($phone, 'paid_user_bind_phone', ['code'=>$code]);
|
|
|
+ $code = random_int(1000, 9999);
|
|
|
+ Redis::setex('code:' . $phone, 120, $code);
|
|
|
+ AliSMS::send($phone, 'paid_user_bind_phone', ['code' => $code]);
|
|
|
return response()->success();
|
|
|
}
|
|
|
|
|
|
- public function bindPhone(Request $request){
|
|
|
+ public function bindPhone(Request $request)
|
|
|
+ {
|
|
|
$code = $request->post('code');
|
|
|
$phone = $request->post('phone');
|
|
|
$from = $request->post('from');
|
|
|
- $old = Redis::get('code:'.$phone);
|
|
|
- if($old && $old == $code){
|
|
|
- Redis::del('code:'.$phone);
|
|
|
- $user_info = UserService::getById($this->uid);
|
|
|
- if(!$user_info){
|
|
|
+ $old = Redis::get('code:' . $phone);
|
|
|
+ if ($old && $old == $code) {
|
|
|
+ Redis::del('code:' . $phone);
|
|
|
+ $user_info = UserService::getById($this->uid);
|
|
|
+ if (!$user_info) {
|
|
|
return response()->error();
|
|
|
}
|
|
|
- try{
|
|
|
- $result = UserBindPhoneService::bind($this->uid,$user_info->openid,$phone,$from);
|
|
|
- if($result == 0){
|
|
|
- UserService::addBalance($this->uid,100,0,100);
|
|
|
- UserWealthyOperateRecordService::create($this->uid,100,$this->distribution_channel_id,'bind_phone');
|
|
|
+ try {
|
|
|
+ $result = UserBindPhoneService::bind($this->uid, $user_info->openid, $phone, $from);
|
|
|
+ if ($result == 0) {
|
|
|
+ UserService::addBalance($this->uid, 100, 0, 100);
|
|
|
+ UserWealthyOperateRecordService::create($this->uid, 100, $this->distribution_channel_id, 'bind_phone');
|
|
|
return response()->success();
|
|
|
}
|
|
|
- if($result == -1){
|
|
|
+ if ($result == -1) {
|
|
|
return response()->error('WAP_BIND_PHONE_EXIST');
|
|
|
}
|
|
|
- if($result == -2){
|
|
|
+ if ($result == -2) {
|
|
|
return response()->error('WAP_SEND_OPENID_EXIST');
|
|
|
}
|
|
|
- }catch (\Exception $e){}
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ }
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return response()->error('WAP_SEND_CODE_ERROR');
|
|
|
}
|
|
|
return response()->error();
|
|
|
}
|
|
|
|
|
|
- public function bindPhoneView(Request $request){
|
|
|
+ public function bindPhoneView(Request $request)
|
|
|
+ {
|
|
|
$from = 'personal';
|
|
|
$order = '';
|
|
|
$url = '/personal';
|
|
|
- return view('pay.order.bindPhone', compact('order', 'url','from'));
|
|
|
+ return view('pay.order.bindPhone', compact('order', 'url', 'from'));
|
|
|
}
|
|
|
|
|
|
- public function guidePersonalAccount(Request $request){
|
|
|
+ public function guidePersonalAccount(Request $request)
|
|
|
+ {
|
|
|
$bid = $request->get('bid');
|
|
|
$cid = $request->get('cid');
|
|
|
$prev_cid = $request->get('prev_cid');
|
|
|
$book_name = $request->get('book_name');
|
|
|
$bid_no = Hashids::decode($bid)[0];
|
|
|
- if(Redis::SISMEMBER('crm:out_channel_sites',$this->distribution_channel_id)){
|
|
|
+ if (Redis::SISMEMBER('crm:out_channel_sites', $this->distribution_channel_id)) {
|
|
|
$group = 'OUT_FORCE';
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$group = 'FORCE';
|
|
|
}
|
|
|
- $env_config = redisEnvMulti($group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$group.'_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
|
|
|
- $group.'_GUIDE_PERSONAL_ACCOUNT_ID',$group.'_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
|
|
|
- if(empty($env_config[0])) return back();
|
|
|
+ $env_config = redisEnvMulti($group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
|
|
|
+ $group . '_GUIDE_PERSONAL_ACCOUNT_ID', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
|
|
|
+ if (empty($env_config[0])) return back();
|
|
|
$img = $env_config[0];
|
|
|
- $max = empty($env_config[1])?100:$env_config[1];
|
|
|
- $one_loop_max = empty($env_config[3])?10:$env_config[3];
|
|
|
+ $max = empty($env_config[1]) ? 100 : $env_config[1];
|
|
|
+ $one_loop_max = empty($env_config[3]) ? 10 : $env_config[3];
|
|
|
$now_id = (int)$env_config[2];
|
|
|
- $uv = Redis::scard(strtolower($group).'_guide_personal_uv');
|
|
|
- $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('count')->first();
|
|
|
- $total_max = $personal_info->count+$uv;
|
|
|
+ $uv = Redis::scard(strtolower($group) . '_guide_personal_uv');
|
|
|
+ $personal_info = DB::table('personal_account_list')->where('id', $now_id)->select('count')->first();
|
|
|
+ $total_max = $personal_info->count + $uv;
|
|
|
//Log::info('$total_max is: '.);
|
|
|
- if($uv >= $one_loop_max || $total_max>=$max){
|
|
|
- if($total_max>=$max){
|
|
|
- DB::table('personal_account_list')->where('id',$now_id)->update([
|
|
|
- 'status'=>2,
|
|
|
- 'count'=>$total_max,
|
|
|
- 'updated_at'=>date('Y-m-d H:i:s')
|
|
|
+ if ($uv >= $one_loop_max || $total_max >= $max) {
|
|
|
+ if ($total_max >= $max) {
|
|
|
+ DB::table('personal_account_list')->where('id', $now_id)->update([
|
|
|
+ 'status' => 2,
|
|
|
+ 'count' => $total_max,
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
]);
|
|
|
- }else{
|
|
|
- DB::table('personal_account_list')->where('id',$now_id)->increment('count',$uv,[
|
|
|
- 'updated_at'=>date('Y-m-d H:i:s')
|
|
|
+ } else {
|
|
|
+ DB::table('personal_account_list')->where('id', $now_id)->increment('count', $uv, [
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
$account = DB::table('personal_account_list')
|
|
|
- ->where('is_enable',1)
|
|
|
- ->whereIn('status',[1,0])
|
|
|
- ->select('id','url')
|
|
|
- ->where('count','<',$max)
|
|
|
- ->where('group',$group)
|
|
|
- ->orderBy('count','asc')
|
|
|
+ ->where('is_enable', 1)
|
|
|
+ ->whereIn('status', [1, 0])
|
|
|
+ ->select('id', 'url')
|
|
|
+ ->where('count', '<', $max)
|
|
|
+ ->where('group', $group)
|
|
|
+ ->orderBy('count', 'asc')
|
|
|
->orderBy('id')
|
|
|
->first();
|
|
|
- Redis::del(strtolower($group).'_guide_personal_uv');
|
|
|
- if($account){
|
|
|
- DB::table('personal_account_list')->where('id',$account->id)->update([
|
|
|
- 'status'=>1,
|
|
|
- 'updated_at'=>date('Y-m-d H:i:s')
|
|
|
+ Redis::del(strtolower($group) . '_guide_personal_uv');
|
|
|
+ if ($account) {
|
|
|
+ DB::table('personal_account_list')->where('id', $account->id)->update([
|
|
|
+ 'status' => 1,
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
]);
|
|
|
$img = $account->url;
|
|
|
$now_id = $account->id;
|
|
|
- Redis::Hmset('env',$group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,$group.'_GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
|
|
|
- }else{
|
|
|
- Redis::Hmset('env',$group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','',$group.'_GUIDE_PERSONAL_ACCOUNT_ID','');
|
|
|
+ Redis::Hmset('env', $group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', $account->url, $group . '_GUIDE_PERSONAL_ACCOUNT_ID', $account->id);
|
|
|
+ } else {
|
|
|
+ Redis::Hmset('env', $group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', '', $group . '_GUIDE_PERSONAL_ACCOUNT_ID', '');
|
|
|
}
|
|
|
}
|
|
|
- Redis::sadd(strtolower($group).'_guide_personal_uv',$this->uid);
|
|
|
+ Redis::sadd(strtolower($group) . '_guide_personal_uv', $this->uid);
|
|
|
if ($group == 'OUT_FORCE') {
|
|
|
$data = UserService::getById($this->uid);
|
|
|
- Redis::hset('crm:out_guide_exposure_user',$data->openid,$this->uid);
|
|
|
+ Redis::hset('crm:out_guide_exposure_user', $data->openid, $this->uid);
|
|
|
}
|
|
|
- $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('name')->first();
|
|
|
+ $personal_info = DB::table('personal_account_list')->where('id', $now_id)->select('name')->first();
|
|
|
DB::table('ad_pdd')->insert([
|
|
|
- 'uid'=>$this->uid,
|
|
|
- 'img'=>$group.'_GUIDE_PERSONAL_ACCOUNT_'.$now_id,
|
|
|
- 'date'=>date('Y-m-d'),
|
|
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
- 'updated_at'=>date('Y-m-d H:i:s')
|
|
|
+ 'uid' => $this->uid,
|
|
|
+ 'img' => $group . '_GUIDE_PERSONAL_ACCOUNT_' . $now_id,
|
|
|
+ 'date' => date('Y-m-d'),
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
]);
|
|
|
|
|
|
- ForceGuidePersonAccountService::create($this->uid,$bid_no,$cid);
|
|
|
+ ForceGuidePersonAccountService::create($this->uid, $bid_no, $cid);
|
|
|
|
|
|
- $link['next'] = sprintf('/reader?bid=%s&cid=%s',$bid,$cid);
|
|
|
- $link['prev'] = sprintf('/reader?bid=%s&cid=%s',$bid,$prev_cid);
|
|
|
- $link['catalog'] = sprintf('/catalog?id=%s',$bid);
|
|
|
+ $link['next'] = sprintf('/reader?bid=%s&cid=%s', $bid, $cid);
|
|
|
+ $link['prev'] = sprintf('/reader?bid=%s&cid=%s', $bid, $prev_cid);
|
|
|
+ $link['catalog'] = sprintf('/catalog?id=%s', $bid);
|
|
|
|
|
|
- return view('jump.forceGuidePersonalAccountV2',['img'=>$img,'link'=>$link,'title'=>$book_name,'name'=>$personal_info->name]);
|
|
|
+ return view('jump.forceGuidePersonalAccountV2', ['img' => $img, 'link' => $link, 'title' => $book_name, 'name' => $personal_info->name]);
|
|
|
}
|
|
|
|
|
|
- public function crmPushView(Request $request){
|
|
|
- $out_status = Redis::SISMEMBER('crm:out_channel_sites',$this->distribution_channel_id);
|
|
|
- if($out_status){
|
|
|
+ /*public function crmPushView(Request $request)
|
|
|
+ {
|
|
|
+ $out_status = Redis::SISMEMBER('crm:out_channel_sites', $this->distribution_channel_id);
|
|
|
+ if ($out_status) {
|
|
|
$group = 'OUT_ACTIVE';
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$group = 'ACTIVE';
|
|
|
}
|
|
|
- list($qrcode,$max_uv,$account_id,$one_uv) = redisEnvMulti($group.'_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$group.'_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
|
|
|
- $group.'_GUIDE_PERSONAL_ACCOUNT_ID',$group.'_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
|
|
|
- $uv = Redis::scard(strtolower($group).'_guide_personal_uv');
|
|
|
- if(!$max_uv) $max_uv = 100;
|
|
|
- if($uv >= $max_uv) {
|
|
|
+ list($qrcode, $max_uv, $account_id, $one_uv) = redisEnvMulti($group . '_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_UV',
|
|
|
+ $group . '_GUIDE_PERSONAL_ACCOUNT_ID', $group . '_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
|
|
|
+ $uv = Redis::scard(strtolower($group) . '_guide_personal_uv');
|
|
|
+ if (!$max_uv) $max_uv = 100;
|
|
|
+ if ($uv >= $max_uv) {
|
|
|
//名额不足
|
|
|
- $data = ['code'=>-1,'read_url'=>'/continue'];
|
|
|
- return view('crm.crmPush',$data);
|
|
|
+ $data = ['code' => -1, 'read_url' => '/continue'];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
}
|
|
|
$sql = 'SELECT friend_link_uid_bind.uid FROM friend_link_uid_bind where openid = (SELECT openid FROM users WHERE id = %s) ORDER by id desc limit 1';
|
|
|
- $friend_link_uid_bind = DB::select(sprintf($sql,$this->uid));
|
|
|
+ $friend_link_uid_bind = DB::select(sprintf($sql, $this->uid));
|
|
|
//$get_info = UserBindHkWelfareService::isHasGet($this->uid);
|
|
|
- if($friend_link_uid_bind) {
|
|
|
- $info = DB::table('ad_pdd')->where('uid',$friend_link_uid_bind[0]->uid)->orderBy('id','desc')->first();
|
|
|
- if($info){
|
|
|
- $personal_account_id = preg_replace('/\D+/','',$info->img);
|
|
|
- if($info){
|
|
|
+ if ($friend_link_uid_bind) {
|
|
|
+ $info = DB::table('ad_pdd')->where('uid', $friend_link_uid_bind[0]->uid)->orderBy('id', 'desc')->first();
|
|
|
+ if ($info) {
|
|
|
+ $personal_account_id = preg_replace('/\D+/', '', $info->img);
|
|
|
+ if ($info) {
|
|
|
$personal_info = DB::table('personal_account_list')
|
|
|
- ->where('id',$personal_account_id)
|
|
|
- ->where('is_enable',1)
|
|
|
- ->select('name','url','status','is_enable')->first();
|
|
|
+ ->where('id', $personal_account_id)
|
|
|
+ ->where('is_enable', 1)
|
|
|
+ ->select('name', 'url', 'status', 'is_enable')->first();
|
|
|
//$user_info = UserService::getById($friend_link_uid_bind[0]->uid);
|
|
|
//$link = sprintf('https://site%s.leyuee.com',encodeDistributionChannelId($user_info->distribution_channel_id));
|
|
|
- if($personal_info){
|
|
|
- $data = ['code'=>-2,'name'=>$personal_info->name,'read_url'=>'/guidestrem?uid='.$this->uid.'&name='.$personal_info->name.'&img='.urlencode($personal_info->url)];
|
|
|
- return view('crm.crmPush',$data);
|
|
|
+ if ($personal_info) {
|
|
|
+ $data = ['code' => -2, 'name' => $personal_info->name, 'read_url' => '/guidestrem?uid=' . $this->uid . '&name=' . $personal_info->name . '&img=' . urlencode($personal_info->url)];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $data = ['code'=>-3,'read_url'=>'/guidestrem?uid='.$this->uid.'&fee=500','name'=>''];
|
|
|
- return view('crm.crmPush',$data);
|
|
|
- }else{
|
|
|
- $data = ['code'=>0,'read_url'=>'/guidestrem?uid='.$this->uid.'&fee=500','name'=>''];
|
|
|
- return view('crm.crmPush',$data);
|
|
|
+ $data = ['code' => -3, 'read_url' => '/guidestrem?uid=' . $this->uid . '&fee=500', 'name' => ''];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
+ } else {
|
|
|
+ $data = ['code' => 0, 'read_url' => '/guidestrem?uid=' . $this->uid . '&fee=500', 'name' => ''];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ public function crmPushView(Request $request)
|
|
|
+ {
|
|
|
+ $crm_config = redisEnvMulti('ACTIVE_GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',
|
|
|
+ 'ACTIVE_GUIDE_PERSONAL_ACCOUNT_MAX_UV', 'ACTIVE_GUIDE_PERSONAL_ACCOUNT_ID',
|
|
|
+ 'ACTIVE_GUIDE_PERSONAL_ACCOUNT_MAX_EVERY_UV');
|
|
|
+ $img = $crm_config[0];
|
|
|
+ $max = empty($crm_config[1]) ? 100 : $crm_config[1];
|
|
|
+ $max = (int)$max;
|
|
|
+ $one_loop_max = empty($crm_config[3]) ? 10 : $crm_config[3];
|
|
|
+ $now_id = (int)$crm_config[2];
|
|
|
+ $uv_key = 'active_guide_personal_uv';
|
|
|
+ $uv = Redis::scard($uv_key);
|
|
|
+ $personal_info = DB::table('personal_account_list')->where('id', $now_id)->select('count')->first();
|
|
|
+ $total_max = (int)($personal_info->count + $uv);
|
|
|
+ if (empty($img) || empty($now_id) || $total_max >= $max) {
|
|
|
+ //没有名额
|
|
|
+ $data = ['code' => -1, 'read_url' => '/sign'];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
+ }
|
|
|
+ $sql = 'SELECT friend_link_uid_bind.uid FROM friend_link_uid_bind where openid = (SELECT openid FROM users WHERE id = %s) ORDER by id desc limit 1';
|
|
|
+ $friend_link_uid_bind = DB::select(sprintf($sql, $this->uid));
|
|
|
+ //$get_info = UserBindHkWelfareService::isHasGet($this->uid);
|
|
|
+ if ($friend_link_uid_bind) {
|
|
|
+ $info = DB::table('ad_pdd')->where('uid', $friend_link_uid_bind[0]->uid)->orderBy('id', 'desc')->first();
|
|
|
+ if ($info) {
|
|
|
+ $personal_account_id = preg_replace('/\D+/', '', $info->img);
|
|
|
+ if ($info) {
|
|
|
+ $personal_info = DB::table('personal_account_list')
|
|
|
+ ->where('id', $personal_account_id)
|
|
|
+ ->where('is_enable', 1)
|
|
|
+ ->select('name', 'url', 'status', 'is_enable')->first();
|
|
|
+ if ($personal_info) {
|
|
|
+ $data = ['code' => -2, 'name' => $personal_info->name];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data = ['code' => -3, 'read_url' => '/sign'];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
+ }
|
|
|
+ $property = UserDivisionCpcPropertyService::getUserPropertyV2($this->uid);
|
|
|
+ $charge = false;
|
|
|
+ if (in_array($property, ['medium', 'high'])) {
|
|
|
+ $charge = true;
|
|
|
+ } else {
|
|
|
+ if ($this->property == 'undefined' && OrderService::getChargeNum($this->uid) >= 10) {
|
|
|
+ $charge = true;
|
|
|
+ }
|
|
|
}
|
|
|
+ if (!$charge) {
|
|
|
+ //不符合条件
|
|
|
+ $data = ['code' => -1, 'read_url' => '/sign'];
|
|
|
+ return view('crm.crmPush', $data);
|
|
|
+ }
|
|
|
+
|
|
|
+ Redis::sadd($uv_key, $this->uid);
|
|
|
+
|
|
|
+ DB::table('ad_pdd')->insert([
|
|
|
+ 'uid' => $this->uid,
|
|
|
+ 'img' => 'GUIDE_PERSONAL_ACCOUNT_' . $now_id,
|
|
|
+ 'date' => date('Y-m-d'),
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
+ ]);
|
|
|
+ return view('crm.crmPush2', ['name' => $personal_info->name, 'img' => $img]);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|