CoflController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <?php
  2. namespace App\Http\Controllers\Wap\User;
  3. use App\Modules\Activity\Services\ActivityService;
  4. use App\Modules\Book\Services\BookConfigService;
  5. use App\Modules\Channel\Models\Channel;
  6. use App\Modules\Subscribe\Models\BookOrder;
  7. use App\Modules\Subscribe\Models\YearOrder;
  8. use App\Modules\Subscribe\Services\YearOrderService;
  9. use App\Modules\User\Models\User;
  10. use App\Modules\User\Services\ReadRecordService;
  11. use App\Modules\User\Services\UserBindHkWelfareService;
  12. use App\Modules\User\Services\UserService;
  13. use Illuminate\Http\Request;
  14. use App\Http\Controllers\Controller;
  15. use Hashids;
  16. use EasyWeChat\Foundation\Application;
  17. use Log;
  18. use Exception;
  19. use Redis;
  20. use Cookie;
  21. use DB;
  22. /**
  23. * 朋友圈链接
  24. * Class CoflController
  25. * @package App\Http\Controllers\Wap\User
  26. */
  27. class CoflController extends Controller
  28. {
  29. public function index(Request $request){
  30. $bid = $request->get('bid');
  31. if(empty($bid)){
  32. $default_ink = $this->getLink();
  33. return redirect()->to($default_ink);
  34. }
  35. $openid = $request->get('openid');
  36. //授权
  37. $params = $request->except('_url');
  38. if(empty($openid)){
  39. //$url = str_replace('http://', env('PROTOCOL') . '://', url()->current() . '?' . http_build_query($params));
  40. $url = url()->current() . '?' . http_build_query($params);
  41. $params['redirect_url'] = urlencode($url);
  42. $app = new Application($this->auth($params));
  43. return $app->oauth->redirect();
  44. }
  45. try{
  46. $bid = Hashids::decode($bid)[0];
  47. }catch (Exception $e){
  48. return redirect()->to($this->getLink());
  49. }
  50. $crm = $request->get('crm');
  51. //获取用户
  52. $user = $this->getUsers($openid);
  53. $test_param = $request->input('test',0);
  54. if($test_param ==1 || $test_param =='1' ) {
  55. $user = $this->getUsersV2($openid,$bid);
  56. }
  57. if(!$user[0]){
  58. $user[1] = 123;
  59. }
  60. //有阅读纪录的跳转
  61. $read_record = ReadRecordService::getByField($user[0],$bid);
  62. if($read_record){
  63. $cid = explode('_',$read_record)[0];
  64. }else{
  65. //没有阅读记录的跳转
  66. $book_info = BookConfigService::getBookById($bid);
  67. $cid = $book_info->first_cid;
  68. }
  69. $params['cid'] = $cid;
  70. if(isset($params['openid'])) unset($params['openid']);
  71. if(isset($params['unionid'])) unset($params['unionid']);
  72. $url = $this->getLink($user[1]).'reader?'.http_build_query($params);
  73. $this->stats('book',$crm);
  74. $this->statsDetail($user[0],'book',$bid);
  75. return redirect()->to($url);
  76. }
  77. public function freeCurrencyView(Request $request){
  78. $openid = $request->get('openid');
  79. //授权
  80. $params = $request->except('_url');
  81. if(empty($openid)){
  82. //$url = str_replace('http://', env('PROTOCOL') . '://', url()->current() . '?' . http_build_query($params));
  83. $url = url()->current() . '?' . http_build_query($params);
  84. $params['redirect_url'] = urlencode($url);
  85. $app = new Application($this->auth($params));
  86. return $app->oauth->redirect();
  87. }
  88. $uri = $request->path();
  89. $token = $request->get('token');
  90. $rfee = $request->get('amount');
  91. $crm = $request->get('crm','reward');
  92. $source = $request->get('wx','none');
  93. $type = 'CRM';
  94. if($uri == 'freethrhcurrency'){
  95. $fee = 300;
  96. $this->stats('reward_300',$crm);
  97. }elseif($uri == 'wfreecurrency'){
  98. $fee = 200;
  99. $type = 'WCRM';
  100. }
  101. else{
  102. $this->stats('reward_200',$crm);
  103. $fee = $this->freeCurrencyFee($token,$rfee);
  104. }
  105. $user = $this->getUsers($openid);
  106. if(!$user || !$user[0] || !$user[1]) return redirect()->to($this->getLink().'?'.http_build_query($params));
  107. $this->statsDetail($user[0],'reward',0);
  108. $get_free_currency = UserBindHkWelfareService::isHasGet($user[0]);
  109. if($get_free_currency){
  110. //已经领过
  111. if(isset($user[2]) && !empty($user[2]) && isset($user[3]) && !empty($user[3])){
  112. $bid = Hashids::encode($user[2]);
  113. $cid = $user[3];
  114. $params['bid'] = $bid;
  115. $params['cid'] = $cid;
  116. $link = $this->getLink($get_free_currency->distribution_channel_id).'reader?'.http_build_query($params);
  117. }else{
  118. $link = $this->getLink($get_free_currency->distribution_channel_id).'?'.http_build_query($params);
  119. }
  120. return view('jump.bindHkFreeCurrency',['fee'=>$fee,'url'=>$link,'is_get'=>1,'uid'=>$get_free_currency->uid,'source'=>$source]);
  121. }else{
  122. if(isset($user[2]) && !empty($user[2]) && isset($user[3]) && !empty($user[3])){
  123. $bid = Hashids::encode($user[2]);
  124. $cid = $user[3];
  125. $params['bid'] = $bid;
  126. $params['cid'] = $cid;
  127. $link = $this->getLink($user[1]).'reader?'.http_build_query($params);
  128. }else{
  129. $link = $this->getLink($user[1]).'?'.http_build_query($params);
  130. }
  131. $this->getReward($user[0],$fee,$source,$type);
  132. return view('jump.bindHkFreeCurrency',['fee'=>$fee,'url'=>$link,'is_get'=>0,'uid'=>$user[0],'source'=>$source]);
  133. }
  134. }
  135. private function freeCurrencyFee($token,$fee){
  136. if(!$token || !$fee) return 200;
  137. $param['fee'] = $fee;
  138. if( _sign($param,env('SECRET_KEY')) == $token) return $fee;
  139. return 200;
  140. }
  141. public function freeCurrencyPost(Request $request){
  142. $uid = $request->post('uid');
  143. $fee = $request->post('fee',200);
  144. $source = $request->post('source','');
  145. $result = UserBindHkWelfareService::getfreeCurrency($uid,$fee,'CRM',$source);
  146. if($result){
  147. UserService::addBalance($uid,$fee,0,$fee);
  148. }
  149. return response()->success(['uid'=>$uid,'result'=>$result]);
  150. }
  151. private function getReward($uid,$fee,$source,$crm='CRM'){
  152. $result = UserBindHkWelfareService::getfreeCurrency($uid,$fee,$crm,$source);
  153. if($result){
  154. UserService::addBalance($uid,$fee,0,$fee);
  155. }
  156. }
  157. public function activity(Request $request){
  158. $token = $request->get('token');
  159. if(empty($token)){
  160. $default_ink = $this->getLink();
  161. return redirect()->to($default_ink);
  162. }
  163. $openid = $request->get('openid');
  164. //授权
  165. $params = $request->except('_url');
  166. if(empty($openid)){
  167. $url = url()->current() . '?' . http_build_query($params);
  168. $params['redirect_url'] = urlencode($url);
  169. $app = new Application($this->auth($params));
  170. return $app->oauth->redirect();
  171. }
  172. $crm = $request->get('crm');
  173. $this->stats('activity',$crm);
  174. $activity = ActivityService::getByToken($token);
  175. if($activity){
  176. $user = $this->getUsers($openid);
  177. $distribution_channel_id = (isset($user[1]) && !empty($user[1]))?$user[1]:123;
  178. $url_format = '%s://site%s.%s.com%s';
  179. $activity_page = $activity->activity_page ;
  180. if($activity->id == 6000){
  181. $activity_page = '/activity/common?token=LNyAqbFMgvkmvnHP8PXV3DYPIIhQm3oe';
  182. }
  183. $url = sprintf($url_format, env('PROTOCOL'), encodeDistributionChannelId($distribution_channel_id),
  184. env('CUSTOM_HOST'),
  185. $activity_page
  186. );
  187. return redirect()->to($url);
  188. }
  189. $default_ink = $this->getLink();
  190. return redirect()->to($default_ink);
  191. }
  192. public function recent(Request $request){
  193. $openid = $request->get('openid');
  194. //授权
  195. $params = $request->except('_url');
  196. if(empty($openid)){
  197. $url = url()->current() . '?' . http_build_query($params);
  198. $params['redirect_url'] = urlencode($url);
  199. $app = new Application($this->auth($params));
  200. return $app->oauth->redirect();
  201. }
  202. $user = $this->getUsers($openid);
  203. if(!$user[0]){
  204. $distribution_channel_id = 123;
  205. }else{
  206. $distribution_channel_id = $user[1];
  207. }
  208. $crm = $request->get('crm');
  209. $this->stats('recent',$crm);
  210. $this->statsDetail($user[0],'recent',0);
  211. $link = $this->getLink($distribution_channel_id).'recent?'.http_build_query($params);
  212. return redirect()->to($link);
  213. }
  214. public function person(Request $request){
  215. $openid = $request->get('openid');
  216. //授权
  217. $params = $request->except('_url');
  218. if(empty($openid)){
  219. $url = url()->current() . '?' . http_build_query($params);
  220. $params['redirect_url'] = urlencode($url);
  221. $app = new Application($this->auth($params));
  222. return $app->oauth->redirect();
  223. }
  224. $user = $this->getUsers($openid);
  225. if(!$user[0]){
  226. $distribution_channel_id = 123;
  227. }else{
  228. $distribution_channel_id = $user[1];
  229. }
  230. $crm = $request->get('crm');
  231. $this->stats('person',$crm);
  232. $this->statsDetail($user[0],'person',0);
  233. $link = $this->getLink($distribution_channel_id).'person?'.http_build_query($params);
  234. return redirect()->to($link);
  235. }
  236. public function sign(Request $request){
  237. $openid = $request->get('openid');
  238. //授权
  239. $params = $request->except('_url');
  240. if(empty($openid)){
  241. $url = url()->current() . '?' . http_build_query($params);
  242. $params['redirect_url'] = urlencode($url);
  243. $app = new Application($this->auth($params));
  244. return $app->oauth->redirect();
  245. }
  246. $user = $this->getUsers($openid);
  247. if(!$user[0]){
  248. $distribution_channel_id = 123;
  249. }else{
  250. $distribution_channel_id = $user[1];
  251. }
  252. $crm = $request->get('crm');
  253. $this->stats('sign',$crm);
  254. $this->statsDetail($user[0],'sign',0);
  255. $link = $this->getLink($distribution_channel_id).'sign?'.http_build_query($params);
  256. return redirect()->to($link);
  257. }
  258. private function getUsers($openid){
  259. $users = User::where('openid',$openid)->select('id','distribution_channel_id')->get();
  260. if($users->isEmpty()) return [0,0,0,0];
  261. $temp = null;
  262. $distribution_channel_id = 0;
  263. $uid = 0;
  264. $bid = 0;
  265. $cid = 0;
  266. foreach ($users as $user){
  267. $last_read = ReadRecordService::getByField($user->id,'last_read');
  268. if(!$last_read) continue;
  269. if(!$temp ){
  270. $distribution_channel_id = $user->distribution_channel_id;
  271. $uid = $user->id;
  272. $temp = $last_read;
  273. }else{
  274. $temp_last_read_info = explode('_',$temp);
  275. $last_read_info = explode('_',$last_read);
  276. if($last_read_info[2] > $temp_last_read_info[2]){
  277. $uid = $user->id;
  278. $distribution_channel_id = $user->distribution_channel_id;
  279. $temp = $last_read;
  280. $bid = $last_read_info[0];
  281. $cid = $last_read_info[1];
  282. }
  283. }
  284. }
  285. return [$uid,$distribution_channel_id,$bid,$cid];
  286. }
  287. /**
  288. * @param $openid
  289. * @return array
  290. */
  291. private function getUsersV2($openid,$bid){
  292. $friend_link_uid_bind = DB::table('friend_link_uid_bind')->where('openid',$openid)->where('bid',$bid)->first();
  293. if($friend_link_uid_bind) {
  294. $user = User::where('id',$friend_link_uid_bind->uid)->select('id','distribution_channel_id')->get();
  295. if($user) {
  296. return [$user->id,$user->distribution_channel_id];
  297. }
  298. }
  299. $inner_channels = Channel::join('channel_users','channel_users.id','=','distribution_channels.channel_user_id')
  300. ->select('distribution_channels.id')
  301. ->whereIn('channel_users.id',explode(',',redisEnv('PROMOTION_GROUP_CHANNEL_USER_ID')))
  302. ->get()
  303. ->pluck('id')
  304. ->toArray();
  305. \Log::info($inner_channels);
  306. $users = User::where('openid',$openid)->select('id','distribution_channel_id')->get();
  307. if($users->isEmpty()) return [0,0];
  308. $temp = null;
  309. $distribution_channel_id = 0;
  310. $uid = 0;
  311. $inner_channel_uid_list = [];
  312. //先筛网站运营部UID
  313. foreach ($users as $user){
  314. if(in_array($user->distribution_channel_id,$inner_channels)) {
  315. $inner_channel_uid_list[] = $user;
  316. }
  317. }
  318. if(count($inner_channel_uid_list) == 1) {
  319. $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')];
  320. DB::table('friend_link_uid_bind')->insert($insert_data);
  321. return [$inner_channel_uid_list[0]->id,$inner_channel_uid_list[0]->distribution_channel_id];
  322. }
  323. if(count($inner_channel_uid_list)>1) {
  324. //有多个网站运营部UID,针对网站运营部UID进入到下一步筛选
  325. $users = $inner_channel_uid_list;
  326. }
  327. //筛选包年UID
  328. $uid_list = [];
  329. foreach ($users as $item) {
  330. $uid_list[] =$item->id;
  331. }
  332. $year_order = YearOrder::whereIn('uid',$uid_list)->orderBy('end_time','desc')->first();
  333. if($year_order) {
  334. foreach ($users as $item) {
  335. if($item->id == $year_order->uid) {
  336. //筛选包年结束时间最后的UID
  337. $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')];
  338. DB::table('friend_link_uid_bind')->insert($insert_data);
  339. return [$item->id,$item->distribution_channel_id];
  340. }
  341. }
  342. }
  343. //按订阅章节数最多的筛选
  344. $users_select = ['id'=>0,'count'=>0,'user'=>null];
  345. foreach ($users as $each){
  346. $table_prefix = ($each->id)%512;
  347. $chapter_count = DB::connection('chapter_order_mysql')
  348. ->table('chapter_orders'.$table_prefix)
  349. ->where('created_at','>=',date('Y-m-d H:i:s',strtotime('-3 day')))
  350. ->where('uid',$each->id)
  351. ->where('bid',$bid)
  352. ->count('id');
  353. $book_order = BookOrder::where('uid',$each->id)
  354. ->where('bid',$bid)
  355. ->where('created_at','>=',date('Y-m-d H:i:s',strtotime('-3 day')))
  356. ->first();
  357. if($book_order) {
  358. $chapter_count += 30;
  359. }
  360. //$each->chapter_count = $chapter_count;
  361. if($chapter_count>$users_select['count']) {
  362. $users_select['id'] = $each->id;
  363. $users_select['count'] = $chapter_count;
  364. $users_select['user'] = $each;
  365. }
  366. }
  367. if($users_select['id'] >0) {
  368. $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')];
  369. DB::table('friend_link_uid_bind')->insert($insert_data);
  370. return [$users_select['user']->id,$users_select['user']->distribution_channel_id];
  371. }
  372. //有订阅记录的
  373. foreach ($users as $value) {
  374. $table_prefix = ($value->id)%512;
  375. $chapter_order = DB::connection('chapter_order_mysql')
  376. ->table('chapter_orders'.$table_prefix)
  377. ->where('uid',$value->id)
  378. ->where('bid',$bid)
  379. ->orderBy('created_at','desc')
  380. ->first();
  381. $book_order = BookOrder::where('uid',$value->id)
  382. ->where('bid',$bid)
  383. ->first();
  384. if($chapter_order ){
  385. if(strtotime($chapter_order->created_at) > $users_select['create_time']) {
  386. $users_select['id'] = $value->id;
  387. $users_select['create_time'] = strtotime($chapter_order->created_at);
  388. $users_select['user'] = $value;
  389. }
  390. }
  391. if($book_order){
  392. if(strtotime($book_order->created_at) > $users_select['create_time']){
  393. $users_select['id']=$value->id;
  394. $users_select['create_time']= strtotime($book_order->created_at);
  395. $users_select['user']= $value;
  396. }
  397. }
  398. }
  399. if($users_select['id'] >0) {
  400. $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')];
  401. DB::table('friend_link_uid_bind')->insert($insert_data);
  402. return [$users_select['user']->id,$users_select['user']->distribution_channel_id];
  403. }
  404. return [0,0];
  405. }
  406. private function getLink($distribution_channel_id=123){
  407. $url_format = '%s://site%s.%s.com/';
  408. return sprintf(
  409. $url_format,
  410. env('PROTOCOL'),
  411. encodeDistributionChannelId($distribution_channel_id),
  412. env('CUSTOM_HOST')
  413. );
  414. }
  415. private function auth($param){
  416. $param['appid'] = 'wx9d389a73b88bbeae';
  417. $options = [
  418. 'app_id' => 'wx9d389a73b88bbeae',
  419. 'secret' => '2f6594bb595dfa256b5512e43a32a3d3',
  420. 'oauth' => [
  421. 'scopes' => ['snsapi_base'],
  422. 'callback' => env('AUTH_CALLBACK_URL') . '?' . http_build_query($param),
  423. ],
  424. ];
  425. return $options;
  426. }
  427. private function stats($page,$flag){
  428. if(!$page || !$flag) return ;
  429. //pv
  430. $day = date('Y-m-d');
  431. $pv_key = sprintf('crm:pv:%s',$flag);
  432. Redis::hincrby($pv_key, $day, 1);
  433. //Redis::hincrby($pv_key, 'total', 1);
  434. Redis::sadd('crm_'.$day,$flag);
  435. //uv
  436. $cookie_flag = Cookie::get('crm_flag');
  437. if(!$cookie_flag || $cookie_flag != $flag){
  438. $uv_key = sprintf('crm:uv:%s',$flag);
  439. Redis::hincrby($uv_key, $day, 1);
  440. //Redis::hincrby($uv_key, 'total', 1);
  441. }
  442. Cookie::queue('crm_flag', $flag, env('U_COOKIE_EXPIRE'), null, null, false, false);
  443. }
  444. private function statsDetail($uid,$page,$bid=0)
  445. {
  446. try{
  447. DB::table('crm_visit_detail')->insert([
  448. 'uid'=>$uid,'page'=>$page,
  449. 'bid'=>$bid,'day'=>date('Y-m-d'),
  450. 'created_at'=>date('Y-m-d H:i:s'),
  451. 'updated_at'=>date('Y-m-d H:i:s')
  452. ]);
  453. }catch (\Exception $e){}
  454. }
  455. public function longActivity(Request $request)
  456. {
  457. $openid = $request->get('openid');
  458. //授权
  459. $params = $request->except('_url');
  460. if(empty($openid)){
  461. $url = url()->current() . '?' . http_build_query($params);
  462. $params['redirect_url'] = urlencode($url);
  463. $app = new Application($this->auth($params));
  464. return $app->oauth->redirect();
  465. }
  466. $user = $this->getUsers($openid);
  467. if(!$user[0]){
  468. $distribution_channel_id = 123;
  469. }else{
  470. $distribution_channel_id = $user[1];
  471. }
  472. $crm = $request->get('crm');
  473. $this->stats('activity',$crm);
  474. $baselink = $this->getLink($distribution_channel_id).'activity/crm?'.http_build_query($params);
  475. if(isset($params['token']) && !empty($params['token'])){
  476. return redirect()->to($baselink.'activity/crm?'.http_build_query($params));
  477. }
  478. return redirect()->to($baselink);
  479. }
  480. public function guidePersonalAccount(Request $request,$channel_id){
  481. $uid = $request->get('uid',0);
  482. $env_config = redisEnvMulti('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','GUIDE_PERSONAL_ACCOUNT_MAX_USER','GUIDE_PERSONAL_ACCOUNT_ID','GUIDE_PERSONAL_ACCOUNT_ONE_LOOP_MAX_USER');
  483. $img = empty($env_config[0])?'https://cdn-novel.iycdm.com/h5/personal_account/chenchen.jpg':$env_config[0];
  484. $max = empty($env_config[1])?100:$env_config[1];
  485. $one_loop_max = empty($env_config[3])?10:$env_config[3];
  486. $now_id = (int)$env_config[2];
  487. $uv = Redis::scard('guide_personal_uv');
  488. $personal_info = DB::table('personal_account_list')->where('id',$now_id)->select('count')->first();
  489. $total_max = $personal_info->count+$uv;
  490. //Log::info('$total_max is: '.);
  491. if($uv >= $one_loop_max || $total_max>=$max){
  492. if($total_max>=$max){
  493. DB::table('personal_account_list')->where('id',$now_id)->update([
  494. 'status'=>2,
  495. 'count'=>$total_max,
  496. 'updated_at'=>date('Y-m-d H:i:s')
  497. ]);
  498. }else{
  499. DB::table('personal_account_list')->where('id',$now_id)->increment('count',$uv,[
  500. 'updated_at'=>date('Y-m-d H:i:s')
  501. ]);
  502. }
  503. $account = DB::table('personal_account_list')
  504. ->where('is_enable',1)
  505. ->whereIn('status',[1,0])
  506. ->select('id','url')
  507. ->where('count','<',$max)
  508. ->orderBy('count','asc')
  509. ->orderBy('id')
  510. ->first();
  511. Redis::del('guide_personal_uv');
  512. if($account){
  513. DB::table('personal_account_list')->where('id',$account->id)->update([
  514. 'status'=>1,
  515. 'updated_at'=>date('Y-m-d H:i:s')
  516. ]);
  517. $img = $account->url;
  518. $now_id = $account->id;
  519. Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',$account->url,'GUIDE_PERSONAL_ACCOUNT_ID',$account->id);
  520. }else{
  521. Redis::Hmset('env','GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE','','GUIDE_PERSONAL_ACCOUNT_ID','');
  522. return back();
  523. }
  524. }
  525. Redis::sadd('guide_personal_uv',$uid);
  526. if($uid){
  527. DB::table('ad_pdd')->insert([
  528. 'uid'=>$uid,
  529. 'img'=>'GUIDE_PERSONAL_ACCOUNT_'.$now_id,
  530. 'date'=>date('Y-m-d'),
  531. 'created_at'=>date('Y-m-d H:i:s'),
  532. 'updated_at'=>date('Y-m-d H:i:s')
  533. ]);
  534. }
  535. /*if(in_array($channel_id,explode(',',redisEnv('GUIDE_PERSONAL_ACCOUNT_WEID_SITES')))){
  536. $imgs = redisEnv('GUIDE_PERSONAL_ACCOUNT_WEID_QRCODE',[]);
  537. if($imgs) $imgs = json_decode($imgs,1);
  538. $page = 'jump.guidePersonalAccount';
  539. }else{
  540. $imgs = redisEnv('GUIDE_PERSONAL_ACCOUNT_OURS_QRCODE',[]);
  541. if($imgs) $imgs = json_decode($imgs,1);
  542. $page = 'jump.guidePersonalAccountOurs';
  543. }*/
  544. $page = 'jump.guidePersonalAccountOurs';
  545. //$page = 'jump.guidePersonalAccount';
  546. //$img = collect($imgs)->random();
  547. return view($page,['img'=>$img]);
  548. }
  549. }