1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588 |
- <?php
-
- namespace bibidd\Controller;
- use Think\Controller;
- use Bibidd\Controller\CommonBaseController;
- class MediaonesixController extends CommonBaseController
- {
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function testone()
- {
- $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
- $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
-
- $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
- $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
-
-
- echo PHP_EOL.$jinri_start_time;
- echo PHP_EOL.$jinri_end_time;
- echo PHP_EOL.$zuo_start_time;
- echo PHP_EOL.$zuo_end_time;
- echo PHP_EOL."q---9951";
- // $yn_ip_yiyou = M("ip_jilasdasu")->where("ip='$ip'")->getField("id");
- }
-
-
-
- //封装返回的数据
- /**
- * 视频列表相关 视频列表
-
- *首页视频列表
- * @param type [zuixin 最新,remen 热门,tuijian 推荐,resou 热搜,]
- * @param page [页数]
- * @return $type 消息类型
- */
- public function video_info_list()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Contr-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- if ($uid == '') {
- $uid = 0;
- }
- $type = $_POST['type'];
- $page = $_POST['page'];
- $one_size = 36;
- $page_one = ($page - 1) * $one_size;
- $jiben = $_POST['jiben_type'];
- switch ($jiben) {
- case 'zuixin':
- $jiben_sql = 'id desc';
- break;
- case 'remen':
- $jiben_sql = 'views desc';
- break;
- case 'guankan':
- $jiben_sql = 'views desc';
- break;
- case 'dianzan':
- $jiben_sql = 'thumbs_up desc';
- break;
- case 'shichang':
- $jiben_sql = 'time_chuo desc';
- break;
- default:
- $jiben_sql = '';
- break;
- }
- switch ($type) {
- //最新
- case 'zuixin':
-
- $ip = get_client_ip();
- $user_list['ip'] = $ip;
- $user_list['uid'] = $uid;
- $user_list['time'] = time();
-
- $yn_ip_yiyou = M("ip_jilu")->where("ip='$ip'")->getField("id");
- if ($yn_ip_yiyou) {
- M("ip_jilu")->where("ip='$ip'")->save($user_list);
- } else {
- $user_list['add_time'] = time();
- M("ip_jilu")->add($user_list);
- }
-
- // $data['all_num'] = M("video_list_test")->count();
- if ($page == 1) {
- $video_list = M("tuijian_video")->where("id=1")->getField("str");
- $video_list = json_decode($video_list, $assoc = true);
- foreach ($video_list as $key1 => $value1) {
- $video_id = $value1['id'];
- $video_list[$key1]['views'] = M("video_list_test")->where("id=$video_id")->getField("views");;
- $video_list[$key1]['thumbs_up'] = M("video_list_test")->where("id=$video_id")->getField("thumbs_up");;
- $video_list[$key1]['favorite'] = M("video_list_test")->where("id=$video_id")->getField("favorite");;
- $video_list[$key1]['time_chuo'] = M("video_list_test")->where("id=$video_id")->getField("time_chuo");;
- $video_list[$key1]['top_img'] = 'https://www.bibidd.com/bibidd_testtest/A.jpg';
- $video_list[$key1]['title'] = '102411';
- }
- $data['code'] = '200';
- $data['data'] = $video_list;
- echo json_encode($data);
- die();
- }
- $video_list = M("video_list_test")->order("id desc")->LIMIT($page_one, 60)->select();
- // echo PHP_EOL.M("video_list_test")->_sql();
- $data['code'] = '200';
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
- //热门
- case 'remen':
- //获取该获取那天的数据
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- //获取今日页数
- $video_list_suiji_list = M("video_twelve_suiji")->where("time='$jintian'")->LIMIT($page_one, $one_size)->order('rand()')->Field('v_id')->select();
- $id_list = array_column($video_list_suiji_list, 'v_id');
- $sql_charu = "";
- foreach ($video_list_suiji_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];;
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
-
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->select();
- //牛逼
- foreach ($video_list as $key => $value) {
- $id = $value['id'];
- $suozai_num = array_search("$id", $id_list);
- $id_list[$suozai_num] = $value;
- }
-
- $data['all_num'] = M("video_twelve_suiji")->where("time='$jintian'")->count();
- $data['code'] = '200';
-
-
- //推荐1
- case 'tuijian':
- //获取该获取那天的数据
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- //获取今日页数
- $video_list_suiji_list = M("video_twelve_suiji")->where("type='tuijian' and time='$jintian'")->LIMIT($page_one, $one_size)->Field('v_id')->select();
- $id_list = array_column($video_list_suiji_list, 'v_id');
- $sql_charu = "";
- foreach ($video_list_suiji_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];;
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
-
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->select();
- //牛逼
- foreach ($video_list as $key => $value) {
- $id = $value['id'];
- $suozai_num = array_search("$id", $id_list);
- $id_list[$suozai_num] = $value;
- }
- $data['all_num'] = M("video_twelve_suiji")->where("type='tuijian' and time='$jintian'")->count();
- $data['code'] = '200';
-
- break;
-
- //动漫1列表
- case 'Anime':
- //获取该获取那天的数据
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- //获取今日页数
- $video_list_suiji_list = M("video_twelve_suiji")->where("type='Anime' and time='$jintian'")->LIMIT($page_one, $one_size)->Field('v_id')->select();
- $id_list = array_column($video_list_suiji_list, 'v_id');
- $sql_charu = "";
- foreach ($video_list_suiji_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];;
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
-
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->select();
- //牛逼
- foreach ($video_list as $key => $value) {
- $id = $value['id'];
- $suozai_num = array_search("$id", $id_list);
- $id_list[$suozai_num] = $value;
- }
-
- $data['all_num'] = M("video_twelve_suiji")->where("type='Anime' and time='$jintian'")->count();
- $data['code'] = '200';
-
- break;
- //热搜亚洲1
- case 'Asian':
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- //获取今日页数
- $video_list_suiji_list = M("video_twelve_suiji")->where("type='Asian' and time='$jintian'")->LIMIT($page_one, $one_size)->Field('v_id')->select();
-
- $id_list = array_column($video_list_suiji_list, 'v_id');
- $sql_charu = "";
- foreach ($video_list_suiji_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];;
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
-
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->select();
- //牛逼
- foreach ($video_list as $key => $value) {
- $id = $value['id'];
- $suozai_num = array_search("$id", $id_list);
- $id_list[$suozai_num] = $value;
- }
-
- $data['all_num'] = M("video_twelve_suiji")->where("type='Asian' and time='$jintian'")->count();
- $data['code'] = '200';
- break;
- //黑料
- case 'HL':
- $id_list = M("video_list_test")->where("site='HL'")->order("id desc")->LIMIT($page_one, $one_size)->select();
- $data['all_num'] =M("video_list_test")->where("site='HL'")->order("id desc")->count();
- $data['code'] = '200';
- break;
- //海角
- case 'WB':
- $id_list = M("video_list_test")->where("site='WB'")->order("id desc")->LIMIT($page_one, $one_size)->select();
- $data['all_num'] =M("video_list_test")->where("site='WB'")->order("id desc")->count();
- $data['code'] = '200';
- break;
- //反差
- case 'FC':
- $six = 0;
- $id_list = M("video_list_test")->where("site='FC'")->order("id desc")->LIMIT($page_one, $one_size)->select();
- $goumai_str_list = M("hj_fc_buy_record")->where("uid=$uid")->field("v_id")->select();
- $goumai_str = ',';
- foreach ($goumai_str_list as $key1 => $value1) {
- $vv_id = $value1['v_id'];
- $goumai_str .= "$vv_id".",";
- }
- // echo PHP_EOL.$goumai_str;
- //废弃需求 6个钟有个免费的
- foreach ($id_list as $key => $value) {
- $six++;
- $now_vid = $value['id'];
- $needle = ",$now_vid,";
-
- if (strpos($goumai_str, $needle) !== false){
- $id_list[$key]['coins'] = "-1";
- }
- }
- // else{
- // if ($six % 6 == 0) {
- // $id_list[$key]['coins'] = "0";
- // }
- // }
-
-
- $data['all_num'] = M("video_list_test")->where("site='FC'")->count();
- $data['code'] = '200';
- break;
-
-
-
- default:
- echo "type error";
- }
-
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
-
- $jia_num = 6;
- $qishi_num = 0;
- $data_list_number = count($id_list);
- $quzheng_num = floor($data_list_number / 6);
- foreach ($adv_list as $key => $value) {
- $charu_array = array();
- $charu_array = array($adv_list[$key]);
- array_splice($id_list, $jia_num, 0, $charu_array);
- $jia_num += 7;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
- $data['data'] = $id_list;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 推荐第一页
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tuijian_one_page($uid, $page_one)
- {
- $yn_look_video = M("views_video_type_jilu")->where("uid=$uid")->field("video_type_str")->select();
- if ($yn_look_video) {
- $yan_feng_view_type_str = $yn_look_video[0]['video_type_str'];
- $feng_view_type_str = explode(',', $yan_feng_view_type_str);
- $new_type_num = array_count_values($feng_view_type_str);
- print_r($new_type_num);
- arsort($new_type_num);
- // var_dump($new_type_num);
- $sql_charu = "";
- $new_type_num = array_slice($new_type_num, 0, 5);
- echo PHP_EOL.'----------';
- print_r($new_type_num);
- foreach ($new_type_num as $key => $value) {
- $type_name = $key;
- $xianzhi_one = " or type like '%,$type_name,%' or china_type like '%,$type_name,%' ";
- $sql_charu .= $xianzhi_one;
- }
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->LIMIT($page_one, 60)->order('rand()')->select();
- $data['code'] = '200';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- $jia_num = 5;
- $qishi_num = 0;
- $data_list_number = count($video_list);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
-
- $charu_array = array($adv_list[$key]);
- array_splice($video_list, $jia_num, 0, $charu_array);
- $jia_num += 6;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
- $data['data'] = $video_list;
-
-
- echo json_encode($data);
- } else {
- $video_list = M("video_list_test")->order("thumbs_up desc")->LIMIT($page_one, 60)->select();
- $data['code'] = '200';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- $jia_num = 5;
- $qishi_num = 0;
- $data_list_number = count($video_list);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
-
- $charu_array = array($adv_list[$key]);
- array_splice($video_list, $jia_num, 0, $charu_array);
- $jia_num += 6;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
- $data['data'] = $video_list;
- echo json_encode($data);
- }
- }
-
- protected function returnData()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $data['status'] = '0';
- $data['code'] = '202';//未携带参数,请求失败
- $data['message'] = 'error';
- echo json_encode($data);
- }
-
- /**
- * 视频详情
- * @param video_id [video_id]
- * @return $type 消息类型
- * 1.2更新 进入详情后 将用户观看视频次数加1
- */
- public function video_detail()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $LNG = $_POST['LNG'];
- $uid = $_POST['uid'];
- $video_id = $_POST['video_id'];
- //判断用户是否是异常用户
-
-
- //判读是否登录
- if ($uid == '0' or $uid == '' or $uid=='undefined') {
- $data['message'] = 'error';
- echo json_encode($data);
- die();
- }
-
- $huiyuan_time =M("user_info")->where("id=$uid")->getField("vip_over_time");
- $now_time = time();
- if ($huiyuan_time>$now_time) {
- $video_url = M("video_info_test")->where("video_id=$video_id")->getField("video_url");
- $now_views = M("user_info")->where("id=$uid")->getField("views_num");
- //如果用户当日观看超过1000则关进小黑屋 异常处理
- $yn_black = M("black_box")->where("uid=$uid")->getField("id");
- if ($yn_black) {
- $data['message'] = 'error_403';
- echo json_encode($data);
- die();
- }
- if ($now_views==3000 or $now_views>3000) {
- $data['message'] = 'error_403';
- $userip = $this->get_bb_ip();
- $ttime = time();
- $ddate = date("Y-m-d H:i:s",$ttime);
- $last_login_list['time'] = $ttime;
- $last_login_list['time_date'] = $ddate;
- $last_login_list['uid'] = $uid;
- $last_login_list['ip'] = $userip;
- M("black_box")->add($last_login_list);
- echo json_encode($data);
- die();
- }
- } else {
- $video_url = M("video_info_test")->where("video_id=$video_id")->getField("video_url");
- }
- switch ($LNG) {
- case 'CN':
- $now_zan_num_list = M("video_list_test")->where("id=$video_id")->Field("views,thumbs_up,china_type,title")->select();
- $video_type_list_map = $now_zan_num_list[0]['china_type'];
- break;
- case 'EN':
- $now_zan_num_list = M("video_list_test")->where("id=$video_id")->Field("views,thumbs_up,type,title")->select();
- $video_type_list_map = $now_zan_num_list[0]['type'];
- break;
- default:
- echo "type error";
- }
-
- $dianzan_num =$now_zan_num_list[0]['thumbs_up'];
- $guankan_num = $now_zan_num_list[0]['views'];
- $video_name = $now_zan_num_list[0]['title'];
-
- $vidoe_tpe_list = explode(',', $video_type_list_map);
- $vidoe_tpe_list = array_filter($vidoe_tpe_list);
- $vidoe_tpe_list = array_values($vidoe_tpe_list);
-
-
- //1.2更新处
- //查询当前用户观看次数并加1更新
- $now_views = M("user_info")->where("id=$uid")->getField("views_num");
- $free_list = M("free_video_zb")->where("id=1")->field("free_video,url")->select();
- $free_id = $free_list[0]['free_video'];
- if ($free_id==$video_id) {
- $video_url = M("video_info_test")->where("video_id=$video_id")->getField("video_url");
-
- }else{
- $new_views_num['views_num'] = $now_views + 1;
- }
-
- M("user_info")->where("id=$uid")->save($new_views_num);
- $adv_list = M("slgj_advert_list")->where("type='片头广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(1)->select();
- M('video_list_test')->where("id=$video_id")->setInc('v_really',1);
- if ($video_url==null){
- $heiliao_list = M("heiliao_haijiao_books")->where("id=$video_id")->field("hj_video_url,head_img")->select()[0];
- $video_url = $heiliao_list['hj_video_url'];
-
- }
- $data['adv'] = $adv_list[0];
- $data['data'] = $video_url;
- $data['views'] = $guankan_num;
- $data['thumbs_up'] = $dianzan_num;
- $data['video_name'] = $video_name;
- $data['type_list'] = $vidoe_tpe_list;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 图片列表相关
- * @param $templateid []
- * @return $type 消息类型
- */
- public function imgs_info_list()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $type = $_POST['type'];
- $page = $_POST['page'];
- $page_one = ($page - 1) * 36;
-
- switch ($type) {
- //最新
- case 'zuixin':
-
- $video_list = M("imgs_list")->LIMIT($page_one, 36)->order("id desc")->select();
- $data['all_num'] = M("imgs_list")->count();
- $data['code'] = '200';
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
- //热门
- case 'remen':
- $video_list = M("imgs_list")->LIMIT($page_one, 36)->order("views desc")->select();
- $data['all_num'] = M("imgs_list")->count();
- $data['code'] = '200';
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
- //推荐
- case 'tuijian':
- $video_list = M("imgs_list")->LIMIT($page_one, 36)->order("thumbs_up desc")->select();
- $data['all_num'] = M("imgs_list")->count();
- $data['code'] = '200';
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
-
- //热搜
- case 'resou':
- break;
- default:
- echo "type error";
- }
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 图片详情
- * @param imgs_id [图片id]
- * @return $type 消息类型
- */
- public function img_detail()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $img_id = $_POST['imgs_id'];
- $img_list_str = M("imgs_info")->where("imgs_id=$img_id")->getField("imgs_url");
- $now_zan_num = M("video_list_test")->where("id=$img_id")->getField("views");
- $now_zan_num += 1;
- $new_zan['views'] = $now_zan_num;
- $yn_save = M("imgs_list")->where("id=$img_id")->save($new_zan);
- $img_list = explode(',', $img_list_str);
- $data['data'] = $img_list;
- echo json_encode($data);
-
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 发送评论
- * @param type [需要评论的类型 video or img]
- * @param cid [这个视频或者图片的 id]
- * @param uid [用户id]
- * @param username [用户名称]
- * @param content [评论内容]
- * @return $type 消息类型
- */
- public function add_comments()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $type = $_POST['type'];
- $cid = $_POST['cid'];
- $uid = $_POST['uid'];
- $username = M("user_info")->where("id=$uid")->getField("name");;
- $comment_list['time'] = time();
- $comment_list['content'] = $_POST['content'];
- $comment_list['uid'] = $uid;
- $comment_list['username'] = $username;
-
-
- switch ($type) {
- case 'video':
- $comment_list['video_id'] = $cid;
- $yn_add = M("video_comments")->add($comment_list);
- if ($yn_add) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'error';
- echo json_encode($data);
- }
- break;
- case 'img':
- $comment_list['img_id'] = $cid;
- $yn_add = M("img_comments")->add($comment_list);
- if ($yn_add) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'error';
- echo json_encode($data);
- }
- break;
- default:
- echo "type error";
-
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 评论列表
- * @param type [video or img]
- * @param cid [这个视频或者图片的 id]
- * @return $type 消息类型
- */
- public function comments_list()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $type = $_POST['type'];
- $cid = $_POST['cid'];
- switch ($type) {
- case 'video':
- $yn_se = M("video_comments")->where("video_id=$cid")->field("id,content,time,username,uid,time")->select();
- if ($yn_se) {
- $data['message'] = 'ok';
- $data['data'] = $yn_se;
- echo json_encode($data);
- } else {
- $data['message'] = 'ok';
- $data['data'] = [];
- echo json_encode($data);
- }
- break;
- case 'img':
- $yn_se = M("img_comment")->where("img_id=$cid")->field("id,content,time,username,uid,time")->select();
- if ($yn_se) {
- $data['message'] = 'ok';
- $data['data'] = $yn_se;
- echo json_encode($data);
- } else {
- $data['message'] = 'ok';
- $data['data'] = [];
- echo json_encode($data);
- }
- break;
- default:
- echo "type error";
-
- }
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 点赞视频或图片
- * @param uid [用户id]
- * @param type [img or video]
- * @param cid [这个视频或者图片的 id]
- * @return $type 消息类型
- */
- public function dianzan_img_video()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $type = $_POST['type'];
- $cid = $_POST['cid'];
- switch ($type) {
- case 'video':
- $now_zan_num = M("video_list_test")->where("id=$cid")->getField("thumbs_up");
- $now_zan_num += 1;
- $new_zan['thumbs_up'] = $now_zan_num;
- $yn_save = M("video_list_test")->where("id=$cid")->save($new_zan);
- //添加到点赞表
- $dianzan_list['uid'] = $uid;
- $dianzan_list['v_id'] = $cid;
- if ($uid != 0) {
- M("dianzan_video")->add($dianzan_list);
- }
- if ($yn_save) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'erroe';
- echo json_encode($data);
- }
- break;
- case 'img':
- $now_zan_num = M("imgs_list")->where("id=$cid")->getField("thumbs_up");
- $now_zan_num += 1;
- $new_zan['thumbs_up'] = $now_zan_num;
- $yn_save = M("imgs_list")->where("id=$cid")->save($new_zan);
- if ($yn_save) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'erroe';
- echo json_encode($data);
- }
- break;
- default:
- echo "type error";
- }
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 取消点赞
- * @param uid [用户id]
- * @param v_id [视频id]
- * @return $type 消息类型
- */
- public function close_video_up()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $v_id = $_POST['v_id'];
- $now_zan_num = M("video_list_test")->where("id=$v_id")->getField("thumbs_up");
- $now_zan_num -= 1;
- $new_zan['thumbs_up'] = $now_zan_num;
- $yn_sa = M("video_list_test")->where("id=$v_id")->save($new_zan);
- $yn_de = M("dianzan_video")->where("uid=$uid and v_id=$v_id")->delete();
- if ($yn_sa and $yn_de) {
- $data['message'] = 'close_yes';
- echo json_encode($data);
- } else {
- $data['message'] = 'close_no';
- echo json_encode($data);
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 判断是否点赞过
- * @param uid [用户id]
- * @param v_id [视频id]
- * @return $type 消息类型
- */
- public function yn_me_up()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $v_id = $_POST['v_id'];
- $yn_you = M("dianzan_video")->where("uid=$uid and v_id=$v_id")->getField("id");
- if ($yn_you) {
- $data['message'] = 'yes_like';
- echo json_encode($data);
- } else {
- $data['message'] = 'no_like';
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 更新视频分类数量
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_video_type_num()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $video_type_num = array();
- $video_list = M("video_list_test")->where("id!=''")->field('type')->select();
- foreach ($video_list as $key => $value) {
- $type2 = $value['type'];
- $type2_list = explode(',', $type2);
- $type2_list = array_unique($type2_list);
- foreach ($type2_list as $key1 => $value1) {
- # code...
- array_push($video_type_num, $value1);
- }
- }
- $count = array_count_values($video_type_num);
- // var_dump($count);
- // die();
- foreach ($count as $key11 => $value11) {
- // if ($key11 == '') {
- // echo PHP_EOL . '空?';
- // continue;
- // }
- $domain = strstr($key11, "'");
- if ($domain) {
- continue;
- }
- $yn_type = M("video_type_num")->where("name='$key11'")->getField("name");
- if (!empty($yn_type)) {
- $add_video_type['num'] = $value11;
- echo PHP_EOL . '已有跳过';
- echo PHP_EOL . $key11 . '-' . $value11;
- // continue;
- // print
- M("video_type_num")->where("name='$key11'")->save($add_video_type);
- } else {
- echo PHP_EOL . '没有新增';
- $add_video_type['name'] = $key11;
- $add_video_type['num'] = $value11;
- M("video_type_num")->add($add_video_type);
- }
- }
- }
-
- /**
- * 新同步视频标签数量
- * @param $templateid []
- * @return $type 消息类型
- */
- public function newtongbubiaoqiannum()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- $video_type_num = array();
- $video_list = M("video_list_test")->where("id!=''")->field('type')->select();
- $long_str = '';
- foreach ($video_list as $key => $value) {
- $type2 = $value['type'];
- $long_str .= $type2;
- # code...
- }
- // print_r($long_str);
- $new_long_list = explode(',', $long_str);
-
- $new_type_num = array_count_values($new_long_list);
- print_r($new_type_num);
- echo PHP_EOL . '';
-
- print_r(count($new_type_num));
- // $last = end($new_type_num);
- // $last_key = key($new_type_num);
- //分割数组一次新增3000
- $chunkArr = array_chunk($new_type_num, 2500, true);
- //更改此处!!!!
- foreach ($chunkArr[3] as $key1 => $value1) {
- $add_video_type['num'] = $value1;
- $add_video_type['name'] = $key1;;
- M("video_type_num")->add($add_video_type);
-
- }
- exit();
-
- }
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function shuzu_last_key()
- {
-
- $a = [
- 'one' => 1,
- 'two' => 2,
- 'three' => 3
- ];
-
- // 拆分数组
- $chunkArr = array_chunk($a, 2, true);
-
- // 输出原数组
- // var_dump($a);
- // 输出拆分后的数组
- print_r($chunkArr);
- // var_dump($chunkArr);
- }
-
- /**
- * 更新图片分类数量
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_img_type_num()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $imgs_type_num = array();
- $video_list = M("imgs_list")->field('type')->select();
- foreach ($video_list as $key => $value) {
- $type2 = $value['type'];
- $type2_list = explode(',', $type2);
- $type2_list = array_unique($type2_list);
- foreach ($type2_list as $key1 => $value1) {
- # code...
- array_push($imgs_type_num, $value1);
- }
- }
- $count = array_count_values($imgs_type_num);
- var_dump($count);
- foreach ($count as $key11 => $value11) {
- if ($key11 == '') {
- continue;
- }
- $yn_type = M("imgs_type_num")->where("name='$key11'")->getField("name");
- if ($yn_type) {
-
- // if ($yn_type == $value11) {
- // echo PHP_EOL . '已有不动';
- // var_dump($value11);
- // continue;
- // }
- echo PHP_EOL . '已有更新';
- $add_video_type['num'] = $value11;
- M("imgs_type_num")->where("name='$key11'")->save($add_video_type);
- } else {
- echo PHP_EOL . '没有新增';
- $add_video_type['name'] = $key11;
- $add_video_type['num'] = $value11;
- M("imgs_type_num")->add($add_video_type);
- }
-
- // M("video_type_num")->where("name=''")->getField("");
- }
- }
-
- /**
- * 热搜标签列表,分类列表
- * @param type [img or video or novel]
- * @param page [页数]
- * @return $type 消息类型
- */
- public function shouye_resou_img_video()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $type = $_POST['type'];
- $page = $_POST['page'];
- $LNG = $_POST['LNG'];
- $page_one = ($page - 1) * 30;
- if ($page < 0) {
- $page = 1;
- }
- switch ($type) {
- case 'video':
- switch ($LNG) {
- case 'CN':
- $video_list = M("video_type_num")->LIMIT($page_one, 30)->order("num desc")->Field("id,china_name,num")->select();
- break;
- case 'EN':
- $video_list = M("video_type_num")->LIMIT($page_one, 30)->order("num desc")->Field("id,name,num")->select();
- break;
- default:
- echo "type error";
- }
-
- $data['all_num'] = M("video_type_num")->count();
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
- case 'img':
- $video_list = M("imgs_type_num")->LIMIT($page_one, 30)->order("num desc")->select();
- $data['all_num'] = M("imgs_type_num")->count();
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
- case 'novel':
- $video_list = M("novel_type_num")->LIMIT($page_one, 30)->order("num desc")->select();
- $data['all_num'] = count($video_list);
- $data['data'] = $video_list;
- echo json_encode($data);
- break;
- default:
- echo "type error";
- }
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 标签详情
- * @param type_name [标签名称]
- * @param type [img or video]
- * @param page [页数]
- *
- * @return $type 消息类型
- */
- public function select_type_detail()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $LNG = $_POST['LNG'];
- $type_name = $_POST['type_name'];
- $type = $_POST['type'];
- $page = $_POST['page'];
- $page_one = ($page - 1) * 30;
- $jiben = $_POST['jiben_type'];
- switch ($jiben) {
- case 'zuixin':
- $jiben_sql = 'id desc';
- break;
- case 'remen':
- $jiben_sql = 'views desc';
- break;
- case 'guankan':
- $jiben_sql = 'views desc';
- break;
- case 'dianzan':
- $jiben_sql = 'thumbs_up desc';
- break;
- case 'shichang':
- $jiben_sql = 'time_chuo desc';
- break;
- default:
- $jiben_sql = '';
- break;
- }
- switch ($type) {
- case 'video':
- switch ($LNG) {
- case 'EN':
- if ($jiben_sql=='') {
- $wula = M("video_list_test")->where("type like '%,$type_name,%' and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'")->LIMIT($page_one, 60)->order('rand()')->select();
-
- }else{
- $wula = M("video_list_test")->where("type like '%,$type_name,%' and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'")->LIMIT($page_one, 60)->order("$jiben_sql")->select();
-
- }
- break;
- case 'CN':
- if ($jiben_sql=='') {
- $wula = M("video_list_test")->where("china_type like '%,$type_name,%' and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'")->LIMIT($page_one, 60)->order('rand()')->select();
- }else{
- $wula = M("video_list_test")->where("china_type like '%,$type_name,%' and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'")->LIMIT($page_one, 60)->order("$jiben_sql")->select();
- }
- break;
- default:
- echo "type error";
- }
-
- $data['all_num'] = M("video_list_test")->where("type like '%,$type_name,%' and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'")->count();
- $data['message'] = 'ok';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
-
- $jia_num = 5;
- $qishi_num = 0;
- $data_list_number = count($wula);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
-
- $charu_array = array($adv_list[$key]);
- array_splice($wula, $jia_num, 0, $charu_array);
- $jia_num += 6;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
- $data['data'] = $wula;
- echo json_encode($data);
- break;
- case 'img':
-
- $wula = M("imgs_list")->where("type like '%,$type_name,%'")->LIMIT($page_one, 36)->select();
- $data['all_num'] = M("imgs_list")->where("type like '%,$type_name%,'")->count();
- $data['message'] = 'ok';
- $data['data'] = $wula;
- echo json_encode($data);
- break;
- case 'novel':
- $wula = M("novel_list")->where("type like '%,$type_name,%'")->LIMIT($page_one, 36)->select();
- $data['all_num'] = count($wula);
- $data['message'] = 'ok';
- $data['data'] = $wula;
- echo json_encode($data);
- break;
-
- default:
- echo "type error";
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 推荐视频
- * (2+2+1)
- * @return $type 消息类型
- */
- public function tuijian_shipin()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $oumei_list =M("video_list_test")->where("type not LIKE '%,Asian,%' and type not LIKE '%,Anime,%'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader")->order("rand()")->LIMIT(8)->select();
- $yazhou_list =M("video_list_test")->where("type LIKE '%,Asian,%'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader")->order("rand()")->LIMIT(8)->select();
- $dongman_list = M("video_list_test")->where("type LIKE '%,Anime,%'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader")->order("rand()")->LIMIT(4)->select();
- $tuijian_video_list = array($oumei_list[0], $oumei_list[1], $yazhou_list[0], $yazhou_list[1], $dongman_list[0],
- $oumei_list[2],$oumei_list[3],$yazhou_list[2],$yazhou_list[3],$dongman_list[1],
- $oumei_list[4],$oumei_list[5],$yazhou_list[4],$yazhou_list[5],$dongman_list[2],
- $oumei_list[6],$oumei_list[7],$yazhou_list[6],$yazhou_list[7],$dongman_list[3],);
- if (!empty($tuijian_video_list)) {
- $data['message'] = 'ok';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- $jia_num = 0;
- $qishi_num = 0;
- $data_list_number = count($tuijian_video_list);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
- if ($qishi_num==0) {
- $jia_num += 5;
- $qishi_num += 1;
- }else{
- $jia_num += 6;
- $qishi_num += 1;
- }
-
- $charu_array = array($adv_list[$key]);
- array_splice($tuijian_video_list, $jia_num, 0, $charu_array);
-
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
- $data['data'] = $tuijian_video_list;
- echo json_encode($data);
- } else {
- $data['message'] = 'null';
- $data['data'] = [];
- echo json_encode($data);
-
- }
- }
-
-
- /**
- * 推荐视频
- * (2+2+1)
- * @return $type 消息类型
- */
- public function tuijian_shipin_video_detali()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $oumei_list =M("video_list_test")->where("type not LIKE '%,Asian,%' and type not LIKE '%,Anime,%'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site")->order("rand()")->LIMIT(8)->select();
- $yazhou_list =M("video_list_test")->where("type LIKE '%,Asian,%'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site")->order("rand()")->LIMIT(8)->select();
- $dongman_list = M("video_list_test")->where("type LIKE '%,Anime,%'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site")->order("rand()")->LIMIT(4)->select();
- $tuijian_video_list = array($oumei_list[0], $oumei_list[1], $yazhou_list[0], $yazhou_list[1], $dongman_list[0],
- $oumei_list[2],$oumei_list[3],$yazhou_list[2],$yazhou_list[3],$dongman_list[1],
- $oumei_list[4],$oumei_list[5],$yazhou_list[4],$yazhou_list[5],$dongman_list[2],
- $oumei_list[6],$oumei_list[7],$yazhou_list[6],$yazhou_list[7],$dongman_list[3],);
- if (!empty($tuijian_video_list)) {
- $data['message'] = 'ok';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- $jia_num = 0;
- $qishi_num = 0;
- $data_list_number = count($tuijian_video_list);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
-
-
- $charu_array = array($adv_list[$key]);
- array_splice($tuijian_video_list, $jia_num, 0, $charu_array);
-
- $jia_num += 6;
- $qishi_num += 1;
-
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
- $data['data'] = $tuijian_video_list;
- echo json_encode($data);
- } else {
- $data['message'] = 'null';
- $data['data'] = [];
- echo json_encode($data);
-
- }
- }
-
-
- /**
- * 黑料海角反差视频详情推荐
- * @param $templateid []
- * @return $type 消息类型
- */
- public function new_tuijian_shipin_video_detali(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $video_type = $_POST['type'];
- switch ($video_type) {
- case 'HL':
- $tuijian_video_list = M("video_list_test")->where("site='HL'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site")->order("rand()")->LIMIT(36)->select();
- break;
- case 'WB':
- $tuijian_video_list = M("video_list_test")->where("site='WB'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site")->order("rand()")->LIMIT(36)->select();
- break;
- case 'FC':
- $tuijian_video_list = M("video_list_test")->where("site='FC'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(8)->select();
- break;
- default:
- echo "type error";
- }
-
-
- if (!empty($tuijian_video_list)) {
-
-
- $goumai_str_list = M("hj_fc_buy_record")->where("uid=$uid")->field("v_id")->select();
- $goumai_str = ',';
- foreach ($goumai_str_list as $key1 => $value1) {
- $vv_id = $value1['v_id'];
- $goumai_str .= "$vv_id".",";
- }
- foreach ($tuijian_video_list as $key => $value) {
-
-
- $now_vid = $value['id'];
- $needle = ",$now_vid,";
-
- if (strpos($goumai_str, $needle) !== false){
- $tuijian_video_list[$key]['coins'] = "-1";
- }
-
- }
- $data['message'] = 'ok';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- $jia_num = 0;
- $qishi_num = 0;
- $data_list_number = count($tuijian_video_list);
- $quzheng_num = floor($data_list_number / 6);
- foreach ($adv_list as $key => $value) {
-
-
- $charu_array = array($adv_list[$key]);
- array_splice($tuijian_video_list, $jia_num, 0, $charu_array);
-
- $jia_num += 7;
- $qishi_num += 1;
-
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
-
- $data['data'] = $tuijian_video_list;
- echo json_encode($data);
- } else {
- $data['message'] = 'null';
- $data['data'] = [];
- echo json_encode($data);
-
- }
-
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
- /**
- * 收藏列表
- * @param uid [用户id]
- * @param type [img or video]
- * @return $type 消息类型
- */
- public function shoucang_list()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $page = $_POST['page'];
- $page_one = ($page - 1) * 30;
- $one_size = 30;
- $all_img_video = array();
- $sql_charu = "";
- //视频
- $duifang_id_list_num = M("video_shoucang")->where("uid=$uid")->count();
- //插入sql语句 的限制条件
-
- //视频
- $duifang_id_list = M("video_shoucang")->where("uid=$uid")->Field("vid,time")->order("id desc")->LIMIT($page_one, $one_size)->select();
- //插入sql语句 的限制条件
- foreach ($duifang_id_list as $key => $value) {
- # code...
- $duifang_id = $value['vid'];
- if (!$duifang_id) {
- $duifang_id = 0;
- }
- $xianzhi_one = " or id=$duifang_id";
- $sql_charu .= $xianzhi_one;
- }
- $wula_video = M("video_list_test")->where("id='' $sql_charu")->select();
- foreach ($wula_video as $key1 => $value1) {
- $id = $value1['id'];
-
-
- $suozai_num = array_search($id, $duifang_id_list);
-
- $wula_video[$key1]['time'] = $duifang_id_list[array_search("$id",array_column($duifang_id_list, 'vid'))]['time'];
- }
-
- array_multisort(array_column($wula_video, 'time'), SORT_DESC, $wula_video);
-
-
-
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
- $c = $wula_video;
- $jia_num = 5;
- $qishi_num = 0;
- $data_list_number = count($c);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
- $charu_array = array();
- $charu_array = array($adv_list[$key]);
- array_splice($c, $jia_num, 0, $charu_array);
- $jia_num += 6;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
- $data['message'] = 'ok';
- $data['data'] = $c;
- $data['all_num'] = $duifang_id_list_num;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
- /**
- * 取消收藏
- * @param $templateid []
- * @return $type 消息类型
- */
- public function quxiao_shoucang()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $cid = $_POST['cid'];
- $uid = $_POST['uid'];
- $type = $_POST['type'];
- switch ($type) {
- case 'video':
- $yn_de = M("video_shoucang")->where("uid='$uid' and vid='$cid'")->delete();
- $now_zan_num = M("video_list_test")->where("id=$cid")->getField("favorite");
- $now_zan_num -= 1;
- $new_zan['favorite'] = $now_zan_num;
- $yn_save = M("video_list_test")->where("id=$cid")->save($new_zan);
- break;
- default:
- echo "type error";
- }
- if ($yn_de) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'erroe';
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 同步视频标签
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbu_video_biaoqian()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $video_list = M("video_list_test")->Field("title,type")->select();
- foreach ($video_list as $key => $value) {
- # code...
- $video_type = $value['type'];
- if (!$video_type == '') {
- echo PHP_EOL . '已有';
- continue;
- }
- $name_video = $value['title'];
- $wula = M("slgj_videos")->where("title='$name_video'")->Field("type,type1,type2")->select();
- $type_str = '';
- foreach ($wula as $key => $value) {
- # code...
- $type = $value['type'];
- $type1 = $value['type1'];
- $type2 = $value['type2'];
- $type_str = ",$type,$type1,$type2,";
- $video_listp['type'] = $type_str;
- M("video_list_test")->where("title='$name_video'")->save($video_listp);
- }
- }
- }
-
- /**
- * 同步图片标签
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbu_img_biaoqian()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- $video_list = M("imgs_list")->where("id>16380")->Field("title,type")->select();
- foreach ($video_list as $key => $value) {
- # code...
- $img_type = $value['type'];
- if (!$img_type == '') {
- echo PHP_EOL . '已有';
- continue;
- }
- $name_video = $value['title'];
- $wula = M("slgj_imgs")->where("title='$name_video'")->Field("type,type1,type2")->select();
- $type_str = '';
- foreach ($wula as $key => $value) {
- # code...
- $type = $value['type'];
- $type1 = $value['type1'];
- $type2 = $value['type2'];
- $type_str = ",$type,$type1,$type2,";
- $video_listp['type'] = $type_str;
- M("imgs_list")->where("title='$name_video'")->save($video_listp);
- echo PHP_EOL . M("imgs_list")->_sql();
- }
- }
- }
-
- /**
- * 筛选
- * id desc
- * views desc
- * thumbs_up desc
- * $video_list = M("video_list_test")->order("thumbs_up desc")->LIMIT($page_one, 36)->select();
- * @param page [页数]
- * @param jiben_type [最新zuixin,热门remen,观看次数guankan,点赞数量dianzan,时长shichang]
- * @param time_kaishi [时间筛选开始;例: 0就传0 10就传600 ]
- * @param time_jeishu [时间筛选结束;例: 30就传1800 40+就传99999999 ]
- * @param leixing_shaixuan [类型名称 ]
- * @return $type 消息类型
- */
- public function video_shaixuan()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- if (!empty($_POST)) {
- $LNG = $_POST['LNG'];
- $page = $_POST['page'];
- $page_one = ($page - 1) * 36;
- //基本 最新,热门,观看次数,点赞数量,时长
- $jiben = $_POST['jiben_type'];
- switch ($jiben) {
- case 'zuixin':
- $jiben_sql = 'id desc';
- break;
- case 'remen':
- $jiben_sql = 'views desc';
- break;
- case 'guankan':
- $jiben_sql = 'views desc';
- break;
- case 'dianzan':
- $jiben_sql = 'thumbs_up desc';
- break;
- case 'shichang':
- $jiben_sql = 'time_chuo desc';
- break;
- default:
- $jiben_sql = '';
- break;
- }
- //时长筛选
- $time_kaishi = $_POST['time_kaishi'];
- $time_shaixuan = $_POST['time_jeishu'];
- if ($time_kaishi == '') {
- $time_kaishi = 0;
- $time_shaixuan = 9999999999999;
- }
-
- //包含类型
- $leixing_type = $_POST['leixing_shaixuan'];
-
- if ($leixing_type != '') {
- switch ($LNG) {
- case '':
- $sql_qujian = "(time_chuo between $time_kaishi and $time_shaixuan) and (type like '%,$leixing_type,%') and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'";
- break;
- case '':
- $sql_qujian = "(time_chuo between $time_kaishi and $time_shaixuan) and (china_type like '%,$leixing_type,%') and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'";
- break;
- default:
- echo "type error";
- }
-
- } else {
- // echo PHP_EOL.'kkkk';
- $sql_qujian = "(time_chuo between $time_kaishi and $time_shaixuan) and top_img!='https://www.bibidd.com/bibidd_testtest/A.jpg'";
- }
-
-
- $video_list = M("video_list_test")->where($sql_qujian)->order("$jiben_sql")->LIMIT($page_one, 36)->select();
-
-
- $data['all_num'] = M("video_list_test")->where($sql_qujian)->order("$jiben_sql")->count();
- $data['code'] = '200';
- $data['data'] = $video_list;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
-
- //再次排序
-
- /**
- * 搜索
- * @param $templateid []
- * @return $type 消息类型
- */
- public function sousuo_img_video()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $type_name = $_POST['type_name'];
- $type = $_POST['type'];
- $page = $_POST['page'];
- $uid = $_POST['uid'];
- $page_one = ($page - 1) * 36;
- if (!empty($_POST)) {
-
- switch ($type) {
- case 'video':
- $wula = M("video_list_test")->where("title like '%$type_name%' ")->Field("id,title,top_img,views,thumbs_up,favorite,time_chuo")->LIMIT($page_one, 36)->select();
- $data['all_num'] = M("video_list_test")->where("title like '%$type_name%' ")->count();
- break;
- case 'img':
- $wula = M("imgs_list")->where("title like '%$type_name%' ")->Field("id,title,top_img,views,thumbs_up,favorite,time_chuo")->LIMIT($page_one, 36)->select();
- $data['all_num'] = M("imgs_list")->where("title like '%$type_name%'")->count();
- break;
- default:
- echo "type error";
- }
- // 添加到用户搜索历史表
- // $sousuo_jilu['uid'] =$uid ;
- // $sousuo_jilu['title'] =$type_name ;
- // M("sousuo_jilu")->add($sousuo_jilu);
- if ($wula) {
-
- $data['message'] = 'ok';
- $data['data'] = $wula;
- echo json_encode($data);
- } else {
- $data['message'] = 'null';
- $data['data'] = array();
- echo json_encode($data);
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
- function list_sort_by($list, $field, $sortby = 'desc')
- {
- if (is_array($list)) {
- $refer = $resultSet = array();
- foreach ($list as $i => $data)
- $refer[$i] = &$data[$field];
- switch ($sortby) {
- case 'asc': // 正向排序
- asort($refer);
- break;
- case 'desc':// 逆向排序
- arsort($refer);
- break;
- case 'nat': // 自然排序
- natcasesort($refer);
- break;
- }
- foreach ($refer as $key => $val)
- $resultSet[] = &$list[$key];
- return $resultSet;
- }
- return false;
- }
-
- /**
- * 同步视频
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbu_vidoe()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- // $select_slgj_video = M("slgj_videos")->where(" (site='P站' and m3u8 like '%slgj688.com/%') or (site='黄色仓库' and m3u8!='')")->Field('title,time2,one_img,m3u8')->select();
- // $select_slgj_video = M("slgj_videos")->where("m3u8 like '%.html'")->Field('title,time2,one_img,m3u8')->select();
- // $select_slgj_video = M("slgj_videos")->where("video_watch!='' and m3u8 like '%slgj688.com/%' and one_img like '%750_400%' and is_gengxin=''")->Field('title,time2,one_img,m3u8')->select();
- // $select_slgj_video = M("slgj_videos")->where("video_watch!='' and m3u8 like '%slgj688.com/%' and one_img like '%750_400%' and is_gengxin='' and type like '%Anime%'")->Field('title,time2,one_img,m3u8')->select();
- $select_slgj_video = M("slgj_videos")->where("m3u8 like '%slgj688.com/%' and site!='XVIDEOS'")->Field('title,time2,one_img,m3u8')->select();
- print_r(count($select_slgj_video));
- foreach ($select_slgj_video as $key => $value) {
- //判断 video_list 和 video_info 是否已已有跳过
- //标题
- $sl_title = $value['title'];
- $sl_title = str_replace("'", "", $sl_title);
- //视频时长
- $video_time = $value['time2'];
- $video_time = '00:00';
- if ($video_time == '') {
- continue;
- }
- //头图片
- $top_img = $value['one_img'];
- if ($top_img == '') {
- $top_img = 'https://www.bibidd.com/bibidd_testtest/A.jpg';
- }
- // $top_img = $value['one_img_yun'];
- //m3u8
- $video_m3u8 = $value['m3u8'];
- // $video_m3u8 = $value['video_watch'];
- #bibidd
- $domain = strstr($sl_title, "'");
- if ($domain) {
- echo PHP_EOL . $sl_title;
- continue;
- }
- // $where_id1 = sprintf('title="%d"', $sl_title);
- // try {
- $yn_yiyou = M("video_list_test")->where("title='$sl_title'")->getField("id");
- // } catch (Exception $e) {
- // echo PHP_EOL . $sl_title;
- // continue;
- // }
- if ($yn_yiyou) {
- // echo PHP_EOL . '有了';
- } else {
- echo PHP_EOL . '没有asdasdasdasd';
- //观看点赞(1-999)
-
- $video_list_addp['views'] = rand(200, 9999);
- $video_list_addp['thumbs_up'] = rand(50, 9999);
- $video_list_addp['title'] = $sl_title;
- $video_list_addp['top_img'] = $top_img;
- $video_list_addp['video_time'] = $video_time;
- $add_list = M("video_list_test")->add($video_list_addp);
- $video_info_addp['video_url'] = $video_m3u8;
- $video_info_addp['video_id'] = $add_list;
- $add_info = M("video_info_test")->add($video_info_addp);
-
- }
- }
- }
-
- /**
- * 同步图片
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbu_img()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $select_slgj_video = M("slgj_imgs")->where("title!=''")->Field('title,num,one_img,imgs')->select();
- foreach ($select_slgj_video as $key => $value) {
- //判断 video_list 和 video_info 是否已已有跳过
- //标题
- $sl_title = $value['title'];
- //图片数量
- $img_num = $value['num'];
- //头图片
- $top_img = $value['one_img'];
- //m3u8
- $imgs_imgs = $value['imgs'];
- // $where_id1 = sprintf('title="%d"', $sl_title);
- $domain = strstr($sl_title, "'");
- if ($domain) {
- echo PHP_EOL . $sl_title;
- continue;
- }
- try {
- $yn_yiyou = M("imgs_list")->where("title='$sl_title'")->getField("id");
- } catch (Exception $e) {
- echo PHP_EOL . $sl_title;
- continue;
- }
-
- if ($yn_yiyou) {
- echo PHP_EOL . '有了';
- } else {
- echo PHP_EOL . '没有';
- $video_list_addp['views'] = rand(1, 999);
- $video_list_addp['thumbs_up'] = rand(1, 999);
- $video_list_addp['title'] = $sl_title;
- $video_list_addp['top_img'] = $top_img;
- $video_list_addp['imgs_num'] = $img_num;
- $add_list = M("imgs_list")->add($video_list_addp);
- $video_info_addp['imgs_url'] = $imgs_imgs;
- $video_info_addp['imgs_id'] = $add_list;
- $add_info = M("imgs_info")->add($video_info_addp);
-
- }
- }
- }
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function test_zhongwen()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- $str = "原字符串:";
- $pattern = "/[^\x{4E00}-\x{9FFF}]+/u";
- $newStr = preg_replace($pattern, '', $str);
- if ($newStr === '') {
- echo "字符串中不包含中文<br>";
- } else {
- echo "字符串中包含中文<br>";
- }
-
- }
-
- /**
- * 首页符合要求视频(封面完好 ,时长20+)
- * @param $templateid []
- * @return $type 消息类型
- */
- public function home_video_good()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $video_list = M("video_list_test")->where("time=")->select();
- } else {
- echo $this->returnData();
- }
- }
-
-
- function randFloat($min, $max)
- {
- if ($min >= $max) {
- throw new \Exception('最大值必须大于最小值', 501);
- }
- $rand = $min + mt_rand() / mt_getrandmax() * ($max - $min);
- return floatval(sprintf('%.1f', $rand));
- }
-
- /**
- * 所有视频随机(浏览,点赞1-999)
- * @param $templateid []
- * @return $type 消息类型
- */
- public function rangd_suijione()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $user_list = M("video_list_test")->where("id!='' and views=0 and site='FC'")->Field("id")->select();
- // $user_list = M("novel_list")->where("id!=''")->Field("id")->select();
- // $user_list = M("imgs_list")->where("id!='' and biaoqian_yn=0")->Field("id")->select();
-
-
- foreach ($user_list as $key => $value) {
- echo PHP_EOL . '1';
- $iid = $value['id'];
- echo PHP_EOL . $iid;
- //观看点赞(1-999)
- echo PHP_EOL;
- $video_list_addp['biaoqian_yn'] = 1;
- $video_list_addp['views'] = $this->randFloat(10.1,99);
- $video_list_addp['thumbs_up'] = $this->randFloat(3.1, 9);
- M("video_list_test")->where("id=$iid")->save($video_list_addp);
- // M("novel_list")->where("id=$iid")->save($video_list_addp);
- // M("imgs_list")->where("id=$iid")->save($video_list_addp);
-
- }
-
- }
-
-
- function randFloat11($min = 1, $max = 9) {
- $wula = $this->randFloat(10, 99);
- echo PHP_EOL.$wula;}
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function shijian_zhuanghuan_new()
- {
- print_r('可恶');
- $user_list = M("video_list_test")->where("id!='' and time_chuo=0")->Field("id,video_time")->select();
- print_r(count($user_list));
- // $user_list = M("video_list_test")->where("id='80970'")->Field("id,video_time")->select();
- foreach ($user_list as $key => $value) {
- # code...
-
- $id = $value['id'];
- print_r($id);
- $time = $value['video_time'];
- $is_fuhao = strstr($time, ':');
- if ($is_fuhao) {
- $time_list = explode(':', $time);
- $time_list_count = count($time_list);
- if ($time_list_count == 2) {
- $one = $time_list[0];
- $two = $time_list[1];
- $time_all = ($one * 60) + $two;
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- } elseif ($time_list_count == 3) {
- $one = $time_list[0];
- $two = $time_list[1];
- $three = $time_list[2];
- $time_all = ($one * 3600) + ($two * 60) + $three;
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- }
- } else {
- //带h
- $is_fuhao = strstr($time, 'h');
- if ($is_fuhao) {
- $time_one = substr($time, 0, 1);
- $time_two_mei = substr($time, 4, 9);
- $time_two = str_replace("min", '', $time_two_mei);
- $time_all = ($time_one * 3600) + ($time_two * 60);
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- } else {
- //min的
- $time_one = substr($time, 0, 2);
- $time_all = ($time_one * 60);
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- }
- }
- }
- }
-
- /**
- * 视频转时间
- * @param $templateid []
- * @return $type 消息类型
- */
- public function time_zhuanhuan()
- {
- print_r('可恶');
- $user_list = M("video_list_test")->where("id!='' and time_chuo=0 or time_chuo is null")->Field("id,video_time")->select();
- foreach ($user_list as $key => $value) {
- # code...
-
- $id = $value['id'];
- $time = $value['video_time'];
- $is_fuhao = strstr($time, ':');
- if ($is_fuhao) {
- $time_list = explode(':', $time);
- $time_list_count = count($time_list);
- if ($time_list_count == 2) {
- $one = $time_list[0];
- $two = $time_list[1];
- $time_all = ($one * 60) + $two;
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- } elseif ($time_list_count == 3) {
- $one = $time_list[0];
- $two = $time_list[1];
- $three = $time_list[2];
- $time_all = ($one * 3600) + ($two * 60) + $three;
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- }
- } else {
- //带h
- $is_fuhao = strstr($time, 'h');
- if ($is_fuhao) {
- $time_one = substr($time, 0, 1);
- $time_two_mei = substr($time, 4, 9);
- $time_two = str_replace("min", '', $time_two_mei);
- $time_all = ($time_one * 3600) + ($time_two * 60);
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- } else {
- //min的
- $time_one = substr($time, 0, 2);
- $time_all = ($time_one * 60);
- $time_chuo['time_chuo'] = $time_all;
- M("video_list_test")->where("id=$id")->save($time_chuo);
- }
- }
- }
- }
-
- /**
- * 随机出首页数据 必须 时长20+ 0点更新
- * @param $templateid []
- * @return $type 消息类型
- */
- public function rand_video_tui()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $tuijian = M("video_list_test")->where("time_chuo >1800 or time_chuo >600")->order("rand()")->LIMIT(0, 60)->select();
- $tuijian = M("video_list_test")->order("rand()")->LIMIT(0, 60)->select();
- //推荐视频json
- $wula['str'] = json_encode($tuijian);
- $wula['time'] = date("Y年m月d日 D h时i分s秒 A", time());
- M("tuijian_video")->where("id=1")->save($wula);
- }
-
- /**
- * 取出今天 随机的视频 并记录 ip
- * @param $templateid []
- * @return $type 消息类型
- */
- public function load_videos()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $ip = get_client_ip();
-
- $user_list['time'] = time();
-
- $yn_ip_yiyou = M("ip_jilu")->where("ip='$ip'")->getField("id");
- if ($yn_ip_yiyou) {
- M("ip_jilu")->where("ip='$ip'")->save($user_list);
- } else {
- $user_list['add_time'] = time();
- M("ip_jilu")->add($user_list);
- }
-
- }
-
- /**
- *视频类型中文
- * @param $templateid []
- * @return $type 消息类型
- */
- public function test_chinese()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- $video_list = M("video_type_num")->where("name!=''")->field("name")->select();
- foreach ($video_list as $key => $value) {
- $type_name = $value['name'];
- $pattern = "/[^\x{4E00}-\x{9FFF}]+/u";
- $newStr = preg_replace($pattern, '', $type_name);
- if ($newStr === '') {
- } else {
- echo PHP_EOL . $type_name;
- }
- }
- }
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function all_chinese_type_ec()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- $user_list = M("")->where("")->field("name,num")->select();
- foreach ($user_list as $key => $value) {
- # code...
- $str = $value['name'];
- $pattern = "/[^\x{4E00}-\x{9FFF}]+/u";
- $newStr = preg_replace($pattern, '', $str);
- if ($newStr === '') {
- echo "字符串中不包含中文<br>";
- } else {
- echo "字符串中包含中文<br>";
- }
- $user_list[$key] = $value['id'];
- }
- }
-
- /**
- * 筛选的类型
- * @param $templateid []
- * @return $type 消息类型
- */
- public function shaixuan_type_list()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $LNG = $_POST['LNG'];
- switch ($LNG) {
- case 'EN':
- $type_name_list = M("video_type_num")->where("name!=''")->order("num desc")->Field("name")->LIMIT(0, 100)->select();
- // echo PHP_EOL.count($type_name_list);
- foreach ($type_name_list as $key => $value) {
- # code...
- $type_list[$key]['name'] = $value['name'];
- }
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = $type_list;
- echo json_encode($data);
- break;
- case 'CN':
- $type_name_list = M("video_type_num")->where("name!=''")->order("num desc")->Field("china_name")->LIMIT(0, 100)->select();
- // echo PHP_EOL.count($type_name_list);
- foreach ($type_name_list as $key => $value) {
- # code...
- $type_list[$key]['name'] = $value['china_name'];
- }
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = $type_list;
- echo json_encode($data);
- break;
- default:
- echo "type error";
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 搜索历史
- * @param uid [用户id]
- * @return $type 消息类型
- */
- public function search_history()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $sousuo_lishi_list = M("sousuo_jilu")->where("uid=$uid")->field("title,id")->select();
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $sousuo_lishi_list;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 删除搜索
- * @param $templateid []
- * @return $type 消息类型
- */
- public function delete_search_history()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- if (!empty($_POST)) {
- $sousuo_id = $_POST['id'];
- $yn_shanchu = M("sousuo_jilu")->where("id=$sousuo_id")->delete();
- if ($yn_shanchu) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'no';
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
- /**
- * 同步视频 第二链接
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbu_two_video_url()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- $bbvideo_titi = M("video_list_test")->field("title,id")->select();
- foreach ($bbvideo_titi as $key => $value) {
- # code...
- $vtit = $value['title'];
- $vid = $value['id'];
- $sl_url = M("slgj_videos")->where("title='$vtit'")->getField("video_watch");
- $wula_two['video_url_two'] = $sl_url;
- $yn_sa = M("video_info_test")->where("video_id=$vid")->save($wula_two);
- if ($yn_sa) {
- echo PHP_EOL . '修改成功' . $sl_url;
- } else {
- echo PHP_EOL . '修改失败';
- }
-
- }
- }
-
- /**
- * 将国产内容 同步标签
- * @param $templateid []
- * @return $type 消息类型
- */
- public function update_guochan()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- // SELECT * FROM `bb_slgj_videos` WHERE site='含羞草研究所' and m3u8 like '%slgj688.com/%' and is_gengxin='' and video_watch!=''
- $select_slgj_video = M("slgj_videos")->where("site='含羞草研究所' and m3u8 like '%slgj688.com/%'")->Field('title')->order("id desc")->select();
- print_r(count($select_slgj_video));
- foreach ($select_slgj_video as $key => $value) {
- $sl_tit = $value['title'];
- $sl_tit = str_replace("'", "", $sl_tit);
- $now_type_bb = M("video_list_test")->where("title='$sl_tit' and type not like '%Asian,Chinese%'")->getField("type");
- if ($now_type_bb) {
- print_r($now_type_bb);
- echo PHP_EOL . $now_type_bb;
- $new_type = $now_type_bb . ",Asian,Chinese,";
- $update_type['type'] = $new_type;
- M("video_list_test")->where("title='$sl_tit'")->save($update_type);
- } else {
- print_r('youle');
- }
-
- }
-
-
- }
-
-
-
- /**
- * 亚洲类目下 各个type数量
- * @param $templateid []
- * @return $type 消息类型
- */
- public function yazhou_leimutype()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
- $fenlei_num_all = M("video_type_num")->where("name='Japanese and Korean AV' or name='Mainland' or name='Japan and South Korea' or name='Hong Kong' or name='Taiwan' ")->select();
-
- foreach ($fenlei_num_all as $key => $value) {
- $leixing[$key]['name'] = $value['name'];
- $leixing[$key]['num'] = $value['num'];;
- }
- $data['message'] = 'ok';
- $data['data'] = $leixing;
- echo json_encode($data);
- }
-
- /**
- * 同步动漫时长 在格式化 时间
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbu_anime()
- {
-
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
-
-
- //查询time_chuo空的动漫
- $null_chuo_anime_list = M("video_list_test")->where(" type like '%,Anime,%' and time_chuo =0")->field("title")->select();
- foreach ($null_chuo_anime_list as $key => $value) {
- $anime_title = $value['title'];
- $list_test['video_time'] = M("slgj_videos")->where("title='$anime_title'")->getField("time2");
- print_r($list_test);
- echo PHP_EOL . '';
- M("video_list_test")->where("title='$anime_title'")->save($list_test);
- }
- }
-
-
-
- /**
- * 将当前用户观看的视频类型 记录
- * @param $templateid []
- * @return $type 消息类型
- */
- public function add_user_views()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- if ($uid == 0) {
- exit();
- }
- $video_type = $_POST['video_type'];
- //获取当前用户观看视频类型集合,观看视频数量
- $now_views_jilu_lsit = M("views_video_type_jilu")->where("uid=$uid")->field("views_video_num")->select();
- //已有记录更新 没有新增
-
- if ($now_views_jilu_lsit) {
- // $now_video_type_str = $now_views_jilu_lsit[0]['video_type_str'];
- $now_views_video_num = $now_views_jilu_lsit[0]['views_video_num'];
- //将当前用户观看的视频 类型 更新
- // $new_video_type_str = $now_video_type_str . ',' . $video_type;
- $new_views_video_num = $now_views_video_num + 1;
-
-
- // $update_views_jilu['video_type_str'] = $new_video_type_str;
-
- $update_views_jilu['views_video_num'] = $new_views_video_num;
-
-
- $save_yn = M("views_video_type_jilu")->where("uid=$uid")->save($update_views_jilu);
- if ($save_yn) {
- $data['message'] = 'save_ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'save_no';
- echo json_encode($data);
- }
- } else {
- $update_views_jilu['uid'] = $uid;
- $update_views_jilu['video_type_str'] = "";
- $update_views_jilu['views_video_num'] = 1;
- $add_yn = M("views_video_type_jilu")->add($update_views_jilu);
- if ($add_yn) {
- $data['message'] = 'add_ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'add_no';
- echo json_encode($data);
- }
- }
-
-
- } else {
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
-
- //封装返回的数据
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tuijian_duanhou(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Contr-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $type = $_POST['type'];
- $page = $_POST['page'];
- $page_one = ($page - 1) * 60;
-
- }
-
- /**
- * 同步time2
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tongbushipin_shijian_time()
- {
- $video_list = M("video_list_test")->where("time_chuo=0")->Field("title")->select();
- echo PHP_EOL . M("video_list_test")->_sql();
- foreach ($video_list as $key => $value) {
- # code...
-
- $name_video = $value['title'];
- // $wula = M("slgj_videos")->where("title='$name_video'")->Field("time2")->select();
- $ttime = M("slgj_videos")->where("title='$name_video'")->getField("time2");
- $update_time['video_time'] = $ttime;
-
- M("video_list_test")->where("title='$name_video'")->save($update_time);
- echo PHP_EOL . M("video_list_test")->_sql();
-
- }
-
-
- }
-
-
-
-
-
- /**
- * 同步预热
- * 将预热成功的数据同步到 video_list,video_list_test表中
- * @param $templateid []
- * @return $type 消息类型
- */
- public function yure_tongbu_bibidd()
- {
- //首先获取所有 预热成功的视频的id
- // $yure_yes = M("slgj_videos")->where("yure=1")->field("id")->order("id desc")->select();
- $yure_yes = M("slgj_videos")->where("yure=1")->field("id")->order("id asc")->select();
- //
- foreach ($yure_yes as $key => $value) {
- $id = $value['id'];
- //查询这个id是否已经更新
- $yngengxin_wula = M("video_list_test")->where("sl_id=$id and yure=1")->getField("id");
- if ($yngengxin_wula) {
- echo PHP_EOL.'过了';
- continue;
- } else {
- $yes_yure['yure'] = 1;
- $a = M("video_list_test")->where("sl_id=$id and yure=0")->save($yes_yure);
- echo PHP_EOL.'更新';
- }
- }
-
- }
-
-
-
-
- /**
- * 将没有预热的数据进行处理
- * @param $templateid []
- * @return $type 消息类型
- */
- public function no_yure_chuli(){
-
- $select_no_yure = M("video_list_test")->where("yure=0")->field("title,yure,sl_id")->select();
- foreach ($select_no_yure as $key => $value) {
-
-
- $sl_id = $value['sl_id'];
- $bb_titile = $value['title'];
- $slgj_id_yure = M("slgj_videos")->where("id=$sl_id")->field("title,one_img,yure")->select();
-
- $sl_img = $slgj_id_yure[0]['one_img'];
- $sl_yure = $slgj_id_yure[0]['yure'];
- $sl_title = $slgj_id_yure[0]['title'];
-
- if ($sl_yure == 0) {
- echo PHP_EOL.$sl_yure;
- M("video_list_test")->where("sl_id=$sl_id")->delete();
- }
- }
-
-
- }
-
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function test(){
- $data = $this->returnData();
- if (!empty($_POST)){
-
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 将slgj表id 同步到 video_list 表中
- * @param $templateid []
- * @return $type 消息类型
- */
- public function slgj_tongbu_bibidd_id()
- {
- $video_list_bibidd = M("video_list_test")->where("id!='' and sl_id is null")->field("title")->select();
- foreach ($video_list_bibidd as $key => $value) {
- $bb_title = $value['title'];
- $slgj_id = M("slgj_videos")->where("title='$bb_title'")->getField("id");
- $bb_sl_id_list['sl_id'] = $slgj_id;
- M("video_list_test")->where("title='$bb_title'")->save($bb_sl_id_list);
- }
-
- }
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function test_tuiji_dmemo()
- {
- //获取该获取那天的数据
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- //获取今日页数
- $video_list_suiji_list = M("video_twelve_suiji")->where("type='tuijian' and time='$jintian'")->LIMIT(0, 60)->Field('v_id')->select();
- // print_r($video_list_suiji_list);
- $id_list = array_column($video_list_suiji_list, 'v_id');
- // print_r($id_list);
- $sql_charu = "";
- foreach ($video_list_suiji_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];;
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
-
- // 首先判断用户是否登录 没登录
- $all_suiji_list = array();
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->LIMIT(0, 60)->select();
- // echo PHP_EOL.M("video_list_test")->_sql();
- foreach ($video_list as $key => $value) {
- $id = $value['id'];
- $suozai_num = array_search("$id", $id_list);
- $id_list[$suozai_num] = $value;
- }
- print_r($id_list);
- // 131530
-
- }
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function array_test_demo()
- {
- $key_lsit = array('A', 'B');
-
- $demo = array('A' => array("a" => '11'), 'B' => array("b" => '22'));
- array_search(array("b" => '2'), $demo);
-
- }
-
-
- /**
- * 首页弹窗链接
- * @param $templateid []
- * @return $type 消息类型
- */
- public function shouye_lianjei()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Contr-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $url_list = M("shouye_url")->field("url")->select();
- if ($url_list) {
- $data['message'] = 'ok';
- $data['data'] = $url_list;
- echo json_encode($data);
- } else {
- $data['message'] = 'no';
- $data['data'] = 'no';
- echo json_encode($data);
- }
-
- }
-
-
- /**
- * 返回广告方法
- * @param $templateid []
- * @return $type 消息类型
- */
- public function Return_to_ads()
- {
- if (!empty($_POST)) {
- $avd_type = $_POST['adv_type'];
- switch ($avd_type) {
- case 'list_detail':
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- break;
- case 'video_beg':
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(1)->select();
-
- break;
- default:
- echo "type error";
- }
- if ($adv_list) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] = $adv_list;
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'no';
- $data['data'] = array();
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 将A.jpg 的图片换成处理好的图片
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tihuan_ajpg_()
- {
- //先找出所有A。jpg
- $all_a_jpg = M("video_list_test")->limit(11000, 12000)->field("sl_id,id")->select();
- foreach ($all_a_jpg as $key => $value) {
- $bb_id = $value['id'];
- $sl_id = $value['sl_id'];
-
- $newnew_img = M("slgj_videos")->where("id=$sl_id")->getField("one_img");
-
- if ($newnew_img == null) {
- $newnew_img = 'https://www.bibidd.com/bibidd_testtest/A.jpg';
-
- }
- $now_update_list['top_img'] = $newnew_img;
- $yn_chenggong = M("video_list_test")->where("id=$bb_id")->save($now_update_list);
- echo PHP_EOL . M("video_list_test")->_sql();
- if ($yn_chenggong) {
- echo PHP_EOL . '成功';
- } else {
- echo PHP_EOL . '失败了!!!';
- }
- }
- }
-
-
-
- /**
- * 将a.jpg图片替换
- * @param $templateid []
- * @return $type 消息类型
- */
- public function ajpg_tiuan_yes(){
- $ajpg_list_map = M("video_list_test")->where("top_img='https://www.bibidd.com/bibidd_testtest/A.jpg'")->field("id,sl_id,title")->select();
- foreach ($ajpg_list_map as $key => $value) {
- $bb_id =$value['id'];
- $slgj_id = $value['sl_id'];
- $slgj_title = $value['title'];
- $yn_youshuju = M("slgj_videos")->where("id=$slgj_id")->getField("one_img");
- if ($yn_youshuju) {
- $gegxin_list['top_img'] =$yn_youshuju;
- M("video_list_test")->where("id=$bb_id")->save($gegxin_list);
- echo PHP_EOL.$yn_youshuju;
- echo PHP_EOL.'有数据';
- }else{
- M("video_list_test")->where("id=$bb_id")->delete();
- echo PHP_EOL.$yn_youshuju;
- echo PHP_EOL.'无数据';
- }
- }
- }
-
-
- /**
- * 查询用户是否是会员
- * @param $templateid []
- * @return $type 消息类型
- */
- public function panduan_huiyuan(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Contr-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $huiyuan_time_list =M("user_info")->where("id=$uid")->field("vip_over_time,vip_yn,gold_coins_number")->select();
- $huiyuan_time = $huiyuan_time_list[0]['vip_over_time'];
- $huiyuan_type= $huiyuan_time_list[0]['vip_yn'];
- $user_gold_coins= $huiyuan_time_list[0]['gold_coins_number'];
- $now_time = time();
-
- if ($huiyuan_time>$now_time) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['type'] = $huiyuan_type;
- $data['message'] = 'is_vip';
- echo json_encode($data);
- } else {
- //不是会员判断是否有足够余额来
- if ($user_gold_coins>=48){
- $data['code'] = '200';
- $data['status'] = '2';
- $data['coins'] = 'yes_coins';
- $data['message'] = 'no_vip';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '3';
- $data['coins'] = 'no_coins';
- $data['message'] = 'no_vip';
- echo json_encode($data);
- }
-
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- *获取用户IP地址
- * @param int $type
- * @return mixed
- */
- private function get_bb_ip($type = 0)
- {
- $type = $type ? 1 : 0;
- static $ip = NULL;
- if ($ip !== NULL) return $ip[$type];
- if ($_SERVER['HTTP_X_REAL_IP']) {//nginx 代理模式下,获取客户端真实IP
- $ip = $_SERVER['HTTP_X_REAL_IP'];
- } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {//客户端的ip
- $ip = $_SERVER['HTTP_CLIENT_IP'];
- } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {//浏览当前页面的用户计算机的网关
- $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
- $pos = array_search('unknown', $arr);
- if (false !== $pos) unset($arr[$pos]);
- $ip = trim($arr[0]);
- } elseif (isset($_SERVER['REMOTE_ADDR'])) {
- $ip = $_SERVER['REMOTE_ADDR'];//浏览当前页面的用户计算机的ip地址
- } else {
- $ip = $_SERVER['REMOTE_ADDR'];
- }
- // IP地址合法验证
- $long = sprintf("%u", ip2long($ip));
- $ip = $long ? array($ip, $long) : array('0.0.0.0', 0);
- return $ip[$type];
- }
-
-
- /**
- * 非会员 观看视频
- * @param $templateid []
- * @return $type 消息类型
- */
- public function no_vip_views(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Contr-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $now_views = M("user_info")->where("id=$uid")->getField("views_num");
- if ($now_views==5 or $now_views>5) {
- $data['message'] = 'no';
- echo json_encode($data);
- }else{
- $data['message'] = 'yes';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 添加至收藏
- * @param cid [这个视频或者图片的 id]
- * @param type [video or img]
- * @param uid [用户id]
- * @return $type 消息类型
- */
- public function add_to_shoucang()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $uid = $_POST['uid'];
- $type = $_POST['type'];
- $cid = $_POST['cid'];
- switch ($type) {
- case 'video':
- $video_info_list = M("video_list_test")->where("id=$cid")->field("time_chuo,site,uploader")->select();
- $video_time_chuo = $video_info_list[0]['time_chuo'];
- $video_type= $video_info_list[0]['uploader'];
- $video_list['uid'] = $uid;
- $video_list['vid'] = $cid;
- $video_list['time'] = time();
- $video_list['video_type'] = $video_type;
- $video_list['time_chuo'] = $video_time_chuo;
- $yn_add = M("video_shoucang")->add($video_list);
- break;
- default:
- echo "type error";
- }
- if ($yn_add) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'error';
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 判断是否收藏
- * @param cid [这个视频或者图片的 id]
- * @param type [video or img]
- * @param uid [用户id]
- * @return $type 消息类型
- */
- public function yn_shoucang()
- {
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)) {
- $cid = $_POST['cid'];
- $uid = $_POST['uid'];
- $type = $_POST['type'];
- switch ($type) {
- case 'video':
- $yn_se = M("video_shoucang")->where("uid=$uid and vid=$cid")->getField("id");
- break;
- default:
- echo "type error";
- }
- if ($yn_se) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'no';
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function last_login_jilu(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $ttime = time();
- $ddate = date("Y-m-d H:i:s",$ttime);
- $last_login_list['last_login_time'] = $ttime;
- $last_login_list['last_login_date'] = $ddate;
- $save_yn = M("user_info")->where("id=$uid")->save($last_login_list);
-
- $jintian_riqi = date("Y-m-d");
- //判断今天表中是是否存在
- $yn_yiyou = M("huoyue_list")->where("uid=$uid and today='$jintian_riqi'")->getField("id");
- if ($yn_yiyou) {
-
- }else{
- $add_list['today'] = $jintian_riqi;
- $add_list['time'] = $ttime;
- $add_list['uid'] = $uid;
- M("huoyue_list")->add($add_list);
- }
-
-
- if ($save_yn) {
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- $data['message'] = 'no';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 是否三十天
- * @param $templateid []
- * @return $type 消息类型
- */
- public function threty_dayyn(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $login_time = M("user_info")->where("id=$uid")->getField("add_time");
- $now_time = time();
- $cha_time = 3600 * 24 * 30;
- $jisuan_time = $now_time - $login_time;
- if ($jisuan_time>$cha_time) {
- //chao
- $data['message'] = 'ok';
- echo json_encode($data);
- } else {
- //
- $data['message'] = 'no';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
- /**
- * 智博地址 和 免费视频
- * 1.4修改
- * 免费用户推荐1视频
- * 付费用户推荐3视频
- * @param $templateid []
- * @return $type 消息类型
- */
- public function free_video_adv(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $user_type = $_POST['type'];
- if ($user_type=='0') {
- $free_list = M("free_video_zb")->where("id=1")->field("free_video,url")->select();
- $free_id = $free_list[0]['free_video'];
- $adv_url = $free_list[0]['url'];
- $video_list = M("video_list_test")->where("id=$free_id")->select();
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = array($video_list);
- $data['data']['adv_url'] =$adv_url ;
- echo json_encode($data);
- } else {
- $free_list = M("free_video_zb")->where("id is not null")->field("free_video,url")->select();
- $free_id = $free_list[0]['free_video'];
- $adv_url = $free_list[0]['url'];
- $free_two_id =$free_list[1]['free_video'];
- $free_three_id =$free_list[2]['free_video'];
- $video_list_one = M("video_list_test")->where("id=$free_id")->select();
- $video_list = M("video_list_test")->where("id=$free_two_id or id=$free_three_id")->select();
- $video_list_list = array_merge($video_list_one,$video_list);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = array($video_list_list);
- $data['data']['adv_url'] =$adv_url ;
- echo json_encode($data);
- }
-
-
- }else{
- $free_list = M("free_video_zb")->where("id=1")->field("free_video,url")->select();
- $free_id = $free_list[0]['free_video'];
- $adv_url = $free_list[0]['url'];
- $video_list = M("video_list_test")->where("id=$free_id")->select();
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = $video_list[0];
- $data['data']['adv_url'] =$adv_url ;
- echo json_encode($data);
- }
- }
-
-
-
- /**
- * 代理详情
- * 一页50
- * 本月代理
- * 积累代理
- * @param $templateid []
- * @return $type 消息类型
- */
- public function agentlist(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $yue_start_time = strtotime('first day of this month midnight');;
- $yue_end_time = strtotime('first day of next month midnight') - 1;
- $uid = $_POST['uid'];
- $page = $_POST['page'];
- $page_one = ($page - 1) * 50;
- $data_type = $_POST['data_type'];
- switch ($data_type) {
- case 'month':
- // ->order("id desc")
- $list_agent = M("pop_user")->where("uid=$uid and add_time BETWEEN $yue_start_time and $yue_end_time or uid=$uid and agent_money_time BETWEEN $yue_start_time and $yue_end_time")->order("id desc")->field("get_name,pay_brokerage,pay_money,add_date")->LIMIT($page_one, 50)->select();
- $list_agent_num = M("pop_user")->where("uid=$uid and add_time BETWEEN $yue_start_time and $yue_end_time or uid=$uid and agent_money_time BETWEEN $yue_start_time and $yue_end_time")->count();
- break;
- case 'accumulate':
- // ->order("id desc")
- $list_agent = M("pop_user")->where("uid=$uid")->field("get_name,pay_brokerage,pay_money,add_date")->order("id desc")->LIMIT($page_one, 50)->select();
-
- $list_agent_num = M("pop_user")->where("uid=$uid")->count();
- break;
- default:
- $data['message'] = 'type_error';
- echo json_encode($data);
- die();
- }
-
- if (!empty($list_agent)) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['status'] = 'ok';
- $data['data'] = $list_agent;
- $data['data_num'] = $list_agent_num;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'null';
- $data['data'] = array();
- $data['data_num'] = 0;
- echo json_encode($data);
- }
-
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 积累 or 月 代理数量
- * @param $templateid []
- * @return $type 消息类型
- */
- public function accumulate_month_agent(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $yue_start_time = strtotime('first day of this month midnight');;
- $yue_end_time = strtotime('first day of next month midnight') - 1;
- $uid = $_POST['uid'];
- $data_type = $_POST['data_type'];
- switch ($data_type) {
- case 'month':
- //佣金
- $agent_money_sum = M("user_info")->where("id=$uid")->getField('agent_money');
- //用户数量
- $agent_people_num = M("pop_user")->where("uid=$uid and add_time BETWEEN $yue_start_time and $yue_end_time")->count();
- //会员数量
- $agent_people_vip_num = M("pop_user")->where("uid=$uid and agent_money_time BETWEEN $yue_start_time and $yue_end_time and pay_money>0")->count();
-
- break;
- case 'accumulate':
- //佣金
- $agent_money_sum = M("agent_money")->where("uid=$uid")->sum('agent_money');
- //用户数量
- $agent_people_num = M("pop_user")->where("uid=$uid")->count();
- //会员数量
- $agent_people_vip_num = M("pop_user")->where("uid=$uid and pay_money>0")->count();
-
- break;
- default:
- $data['message'] = 'type_error';
- echo json_encode($data);
- die();
- }
- if (empty($agent_money_sum)) {
- $agent_money_sum=0;
- }
- if (empty($agent_people_num)) {
- $agent_people_num=0;
- }
- if (empty($agent_people_vip_num)) {
- $agent_people_vip_num=0;
- }
-
- $agent_list['agent_money'] =$agent_money_sum ;
- $agent_list['agent_people_num'] = $agent_people_num;
- $agent_list['agent_vip_num'] =$agent_people_vip_num ;
- if (!empty($agent_list)) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['status'] = 'ok';
- $data['data'] = $agent_list;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'null';
- $data['data'] = array();
- echo json_encode($data);
- }
-
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 提现佣金数
- * @param $templateid []
- * @return $type 消息类型
- */
- public function withdrawamount(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
-
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 提现支付宝
- * @param $templateid []
- * @return $type 消息类型
- */
- public function seting_withdrawal_alipay(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $realname = $_POST['realname'];
- $alipayuser = $_POST['alipayuser'];
- $save_time = time();
- //15天后
- $cha_time = 3600 * 24 * 15;
- $save_list['uid'] = $uid;
- $save_list['real_name'] =$realname ;
- $save_list['alipay_user'] =$alipayuser ;
- $save_list['save_time'] = $save_time+$cha_time;
-
- $last_save_time = M("alipay_user")->where("uid=$uid")->getField("save_time");
- if (empty($last_save_time)) {
- //没有数据能添加
- M("alipay_user")->add($save_list);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_yes';
- echo json_encode($data);
- }else{
- $now_time = time();
- if ($now_time>$last_save_time) {
- //chao
- $yn_save = M("alipay_user")->where("uid=$uid")->save($save_list);
- if ($yn_save) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_yes';
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'save_no';
- echo json_encode($data);
- }
- }else{
- $userip = $this->get_bb_ip();
- $ttime = time();
- $ddate = date("Y-m-d H:i:s",$ttime);
- $last_login_list['time'] = $ttime;
- $last_login_list['time_date'] = $ddate;
- $last_login_list['uid'] = $uid;
- $last_login_list['ip'] = $userip;
- M("black_box")->add($last_login_list);
- die();
- }
-
- }
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 判断是否能修改 支付宝账号
- * @param $templateid []
- * @return $type 消息类型
- */
- public function judgmentsavealipay(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $last_save_time_list = M("alipay_user")->where("uid=$uid")->Field('real_name,alipay_user,save_time')->select();
- $last_save_time = $last_save_time_list[0]['save_time'];
- $r_name = $last_save_time_list[0]['save_time'];
- $r_name = $last_save_time_list[0]['save_time'];
- $today = time();
- if (empty($last_save_time_list)) {
- $last_save_time_list[0]['real_name'] ='';
- $last_save_time_list[0]['alipay_user'] ='';
- $last_save_time_list[0]['save_time'] ='0';
- }
- if (empty($last_save_time)) {
- //没有数据能添加
- $data['message'] = 'okay';
- $data['data'] = $last_save_time_list;
- echo json_encode($data);
- }else{
- $now_time = time();
- if ($now_time>$last_save_time) {
- //chao
- $data['message'] = 'okay';
- $data['data'] = $last_save_time_list;
- echo json_encode($data);
- } else {
- // 计算距离指定时间戳的差值(单位:秒)
- $timeDifference = $last_save_time - $today;
-
- // 转换为天数
- $daysRemaining = ceil($timeDifference / (60 * 60 * 24));
-
- $data['message'] = 'no';
- $data['save_day'] = $daysRemaining;
- $data['data'] = $last_save_time_list;
-
- echo json_encode($data);
- }
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
- /**
- * 用户代理佣金数
- * @param $templateid []
- * @return $type 消息类型
- */
- public function show_agent_user_money(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
-
- $uid = $_POST['uid'];
- $user_agent_money_list = M("user_info")->where("id=$uid")->field("last_month_agent_money,payable_one,payable_two")->select();
- $user_agent_money = $user_agent_money_list[0]['last_month_agent_money'];
- $button_one = $user_agent_money_list[0]['payable_one'];
- $button_two = $user_agent_money_list[0]['payable_two'];
-
- // 获取当前月份
- $currentMonth = date('n');
-
- // 获取下个月的月份
- $nextMonth = date('n', strtotime('+1 month'));
- if ($button_one==1 and $button_two==1) {
- $data['code'] = '200';
- $data['status'] = '4';
- $data['message'] = '已打款';
- $data['data'] = array("$nextMonth", "$user_agent_money");
- echo json_encode($data);
- die();
- }
-
- if (!empty($user_agent_money)) {
- if ($user_agent_money>=200) {
- //大于等于200则显示
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'true';
- $data['data'] = array("$nextMonth", "$user_agent_money");
- echo json_encode($data);
-
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'null';
- $data['data'] = $data['data'] = array("$nextMonth", "0");;
- echo json_encode($data);
- }
- } else {
- $data['code'] = '200';
- $data['status'] = '3';
- $data['message'] = 'null';
- $data['data'] = $data['data'] = array("$nextMonth", "0");;
- echo json_encode($data);
- }
-
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function accumulateandmonth(){
- // 获取本月起始时间戳(零点)
- $firstDayOfMonth = strtotime('first day of this month midnight');
-
- // 获取下个月起始时间戳(零点),并减去1秒
- $firstDayOfNextMonth = strtotime('first day of next month midnight') - 1;
-
- // 输出时间戳区间
- echo "本月起始时间戳:" . $firstDayOfMonth . "<br>";
- echo "本月结束时间戳:" . $firstDayOfNextMonth . "<br>";
-
- // 可以将时间戳转换为日期格式进行查看
- echo "本月起始日期:" . date('Y-m-d H:i:s', $firstDayOfMonth) . "<br>";
- echo "本月结束日期:" . date('Y-m-d H:i:s', $firstDayOfNextMonth) . "<br>";
- }
-
-
-
- /**
- *显示支付宝账号
- * @param $templateid []
- * @return $type 消息类型
- */
- public function show_alipay_user(){
- $data = $this->returnData();
- if (!empty($_POST)){
- $uid = $_POST['uid'];
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function favorite_video_list(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- $page = $_POST['page'];
- $page_one = ($page - 1) * 30;
- //所有视频id
- $favorite_video_list = M("shoucang_two_video")->where("time='$jintian'")->field("v_id")->LIMIT($page_one, 30)->select();
- $favorite_video_amount = M("shoucang_two_video")->where("time='$jintian'")->field("v_id")->select();
- $video_list_count = count($favorite_video_amount);
-
- foreach ($favorite_video_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->select();
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
-
-
-
- $jia_num = 5;
- $qishi_num = 0;
- $data_list_number = count($video_list);
- $quzheng_num = floor($data_list_number / 5);
- foreach ($adv_list as $key => $value) {
-
- $charu_array = array($adv_list[$key]);
- array_splice($video_list, $jia_num, 0, $charu_array);
- $jia_num += 6;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
- if (!empty($video_list)) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $video_list;
- $data['count'] = $video_list_count;
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $video_list;
- $data['count'] = 0;
- echo json_encode($data);
- }
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
-
-
-
-
- /**
- *
- * checkbank.php文件
- *
- * User: jackhhy
- * DateTime: 2018/12/1 10:01
- */
- public function bankInfo($card,$bankList)
- {
- header('Content-type:text/html;charset=utf-8');
-
- $card_8 = substr($card, 0, 8);
- if (isset($bankList[$card_8])) {
- // echo $bankList[$card_8];
- return $bankList[$card_8];
- }
- $card_6 = substr($card, 0, 6);
- if (isset($bankList[$card_6])) {
- // echo $bankList[$card_6];
- return $bankList[$card_6];
- }
- $card_5 = substr($card, 0, 5);
- if (isset($bankList[$card_5])) {
- // echo $bankList[$card_5];
- return $bankList[$card_5];
- }
- $card_4 = substr($card, 0, 4);
- if (isset($bankList[$card_4])) {
- // echo $bankList[$card_4];
- return $bankList[$card_4];
- }
- return '该卡号信息暂未录入';
- }
-
-
- /**
- * 判断是否能修改 支付宝账号
- * @param $templateid []
- * @return $type 消息类型
- */
- public function judgmentsave_bank_card(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $last_save_time_list = M("agent_bank_card_info")->where("uid=$uid")->Field('real_name,bank_card_number,bank_name,save_time')->select();
- $last_save_time = $last_save_time_list[0]['save_time'];
- $today = time();
- if (empty($last_save_time_list)) {
- $last_save_time_list[0]['real_name'] ='';
- $last_save_time_list[0]['bank_card_number'] ='';
- $last_save_time_list[0]['bank_name'] ='';
- $last_save_time_list[0]['save_time'] ='0';
- }
- if (empty($last_save_time)) {
- //没有数据能添加
- $data['message'] = 'okay';
- $data['data'] = $last_save_time_list;
- echo json_encode($data);
- }else{
- $now_time = time();
- if ($now_time>$last_save_time) {
- //chao
- $data['message'] = 'okay';
- $data['data'] = $last_save_time_list;
- echo json_encode($data);
- } else {
- // 计算距离指定时间戳的差值(单位:秒)
- $timeDifference = $last_save_time - $today;
-
- // 转换为天数
- $daysRemaining = floor($timeDifference / (60 * 60 * 24));
-
- $data['message'] = 'no';
- $data['save_day'] = $daysRemaining;
- $data['data'] = $last_save_time_list;
-
- echo json_encode($data);
- }
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
- /**
- * 提现银行卡
- * @param $templateid []
- * @return $type 消息类型
- */
- public function seting_bank_card(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $realname = $_POST['realname'];
- $bank_card_number = $_POST['bank_card_number'];
- $bank_name = $_POST['bank_name'];
- $save_time = time();
- //15天后
- $cha_time = 3600 * 24 * 15;
- $save_list['uid'] = $uid;
- $save_list['real_name'] =$realname ;
- $save_list['bank_card_number'] =$bank_card_number ;
- $save_list['bank_name'] =$bank_name ;
- $save_list['save_time'] = $save_time+$cha_time;
- $save_list['pay_type'] = 'bank';
-
- $last_save_time = M("agent_bank_card_info")->where("uid=$uid")->getField("save_time");
- if (empty($last_save_time)) {
- //没有数据能添加
- M("agent_bank_card_info")->add($save_list);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_yes';
- echo json_encode($data);
- }else{
- $now_time = time();
- if ($now_time>$last_save_time) {
- //chao
- $yn_save = M("agent_bank_card_info")->where("uid=$uid")->save($save_list);
- if ($yn_save) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_yes';
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'save_no';
- echo json_encode($data);
- }
- }else{
- $userip = $this->get_bb_ip();
- $ttime = time();
- $ddate = date("Y-m-d H:i:s",$ttime);
- $last_login_list['time'] = $ttime;
- $last_login_list['time_date'] = $ddate;
- $last_login_list['uid'] = $uid;
- $last_login_list['ip'] = $userip;
- M("black_box")->add($last_login_list);
- die();
- }
-
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function get_bank_name(){
- header('Content-type:text/html;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- include 'bankList.php';
- if (!empty($_POST)){
- $bank_card_number = $_POST['bank_card_number'];
-
- /** @noinspection PhpUndefinedVariableInspection */
- $wula = $this->bankInfo("{$bank_card_number}", $bankList);
- if ($wula =='该卡号信息暂未录入') {
- $data['code'] = '200';
- $data['status'] = '2';
- $data['data'] = "该卡号信息暂未录入";
- echo json_encode($data);
- die();
- }
- $bank_name_list = explode('-',$wula);
- $bank_name = $bank_name_list[0];
- $data['code'] = '200';
- $data['status'] = 1;
- $data['data'] = "$bank_name";
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
- /**
- * 海角列表
- * @param $templateid []
- * @return $type 消息类型
- */
- public function haijiao_video_list(){
- header('Content-type:text/html;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
-
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 反差列表
- * @param $templateid []
- * @return $type 消息类型
- */
- public function fancha_video_list(){
- header('Content-type:text/html;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
-
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 首页视频列表112
- * @param $templateid []
- * @return $type 消息类型
- */
- public function twotwoone_list(){
- header('Content-type:text/html;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $page = $_POST['page'];
- $uid = $_POST['uid'];
- $page_one = ($page - 1) * 42;
- //获取该获取那天的数据
- $jintian = M("suiji_num")->where("id=1")->getField("time");
- //获取今日页数
- // $video_list_suiji_list = M("two_two_one_video_test")->where("time='$jintian'")->LIMIT($page_one, 42)->Field('v_id')->select();
- $video_list_suiji_list = M("two_two_one_video")->where("time='$jintian'")->LIMIT($page_one, 42)->Field('v_id')->select();
- // $video_list_suiji_list = M("two_two_one_video_test")->where("id is not null")->LIMIT($page_one, 30)->Field('v_id')->select();
- // echo PHP_EOL.M("two_two_one_video_test")->_sql();
- $id_list = array_column($video_list_suiji_list, 'v_id');
- $sql_charu = "";
- foreach ($video_list_suiji_list as $key1 => $value1) {
- $duifang_id = $value1['v_id'];;
- $xianzhi_one = " or id='$duifang_id'";
- $sql_charu .= $xianzhi_one;
- }
- $video_list = M("video_list_test")->where("id=0 $sql_charu")->select();
- // echo PHP_EOL.M("video_list_test")->_sql();
- //牛逼
- $wula_lsit = array();
- $num_fc = 0;
- $new_twotwo_list = array();
- // print_r($video_list);
- // echo PHP_EOL.'1991';
- foreach ($video_list as $key => $value) {
- $id = $value['id'];
- $video_site = $value['site'];
- if ($id==''){
- $value= M("video_list_test")->where("id=146145")->select();
- }
- $suozai_num = array_search("$id", $id_list);
- $id_list[$suozai_num] = $value;
- }
- // print_r($id_list);
- // die();
- foreach ($id_list as $keyn => $valuen) {
- $video_site_n = $valuen['site'];
- //被删数据替换
- if (is_string($valuen)){
- $valuen = M("video_list_test")->where("site = 'HL'")->order("rand()")->LIMIT(1)->select()[0];
- }
- // echo PHP_EOL.'-----';
- // echo PHP_EOL.$video_site_n;
- // echo PHP_EOL.$value;
- if ($video_site_n =='FC') {
- $goumai_str_list = M("hj_fc_buy_record")->where("uid=$uid")->field("v_id")->select();
- $goumai_str = ',';
- foreach ($goumai_str_list as $key1 => $value1) {
- $vv_id = $value1['v_id'];
- $goumai_str .= "$vv_id".",";
- }
- $now_vid = $valuen['id'];
- $needle = ",$now_vid,";
-
- if (strpos($goumai_str, $needle) !== false){
- $valuen['coins'] = "-1";
- }
- $num_fc++;
- array_push($wula_lsit, $valuen);
- if ($num_fc==2) {
- array_push($new_twotwo_list,$wula_lsit);
- $num_fc = 0;
- $wula_lsit = array();
- }
- }else{
- array_push($new_twotwo_list,$valuen);
- }
- }
- $data['all_num'] = 10624;
- $data['code'] = '200';
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(6)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
- $jia_num = 6;
- $qishi_num = 0;
- $data_list_number = count($id_list);
- $quzheng_num = floor($data_list_number / 7);
- foreach ($adv_list as $key => $value) {
- $charu_array = array();
- $charu_array = array($adv_list[$key]);
- array_splice($new_twotwo_list, $jia_num, 0, $charu_array);
- $jia_num += 7;
- $qishi_num += 1;
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
- $data['data'] = $new_twotwo_list;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 查询判断是否能修改USDT
- * 返回已有
- * @param $templateid []
- * @return $type 消息类型
- */
- public function judgmentsave_usdt(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $last_save_time_list = M("agent_bank_card_info")->where("uid=$uid")->Field('usdt_string,save_time')->select();
- $last_save_time = $last_save_time_list[0]['save_time'];
- $today = time();
- if (empty($last_save_time_list)) {
- $last_save_time_list[0]['usdt_string'] ='';
- $last_save_time_list[0]['save_time'] ='0';
- }
- if (empty($last_save_time)) {
- //没有数据能添加
- $data['message'] = 'okay';
- $data['data'] = $last_save_time_list;
- echo json_encode($data);
- }else{
- $now_time = time();
- if ($now_time>$last_save_time) {
- //chao
- $data['message'] = 'okay';
- $data['data'] = $last_save_time_list;
- echo json_encode($data);
- } else {
- // 计算距离指定时间戳的差值(单位:秒)
- $timeDifference = $last_save_time - $today;
-
- // 转换为天数
- $daysRemaining = floor($timeDifference / (60 * 60 * 24));
-
- $data['message'] = 'no';
- $data['save_day'] = $daysRemaining;
- $data['data'] = $last_save_time_list;
-
- echo json_encode($data);
- }
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
- /**
- * 提现银行卡
- * @param $templateid []
- * @return $type 消息类型
- */
- public function seting_usdt(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $usdt_string = $_POST['usdt_string'];
-
- $save_time = time();
- //15天后
- $cha_time = 3600 * 24 * 15;
- $save_list['uid'] = $uid;
- $save_list['usdt_string'] =$usdt_string ;
- $save_list['save_time'] = $save_time+$cha_time;
- $save_list['pay_type'] = 'usdt';
-
-
- $last_save_time = M("agent_bank_card_info")->where("uid=$uid")->getField("save_time");
- if (empty($last_save_time)) {
- //没有数据能添加
- M("agent_bank_card_info")->add($save_list);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_yes';
- echo json_encode($data);
- }else{
- $now_time = time();
- if ($now_time>$last_save_time) {
- //chao
- $yn_save = M("agent_bank_card_info")->where("uid=$uid")->save($save_list);
- if ($yn_save) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_yes';
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'save_no';
- echo json_encode($data);
- }
- }else{
- $userip = $this->get_bb_ip();
- $ttime = time();
- $ddate = date("Y-m-d H:i:s",$ttime);
- $last_login_list['time'] = $ttime;
- $last_login_list['time_date'] = $ddate;
- $last_login_list['uid'] = $uid;
- $last_login_list['ip'] = $userip;
- M("black_box")->add($last_login_list);
- die();
- }
-
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
- /**
- * c
- * @param $templateid []
- * @return $type 消息类型
- */
- public function get_user_payment(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $bank_info = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");
- if (empty($bank_info)) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'no_set';
- echo json_encode($data);
- } else{
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = $bank_info;
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function get_agent_user(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $agent_user_list = M("agent_money")->where("uid=$uid")->field("get_uid")->order("id asc")->LIMIT(2)->select();
- foreach ($agent_user_list as $key => $value) {
- $get_uid = $value['get_uid'];
- $user_info[$key]['name'] = M("pop_user")->where("get_uid=$get_uid")->getField("get_name");
- }
- if (empty($user_info)) {
- $data['code'] = '200';
- $data['message'] = '0';
- $data['data'] = [];
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['message'] = '1';
- $data['data'] = $user_info;
- echo json_encode($data);
- }
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
- /**
- * 代理 统计固定增加
- * @param $templateid []
- * @return $type 消息类型
- */
- public function get_agent_record(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- $agent_list = M("add_agent_record")->where("id=1")->field('agent_people_number,agent_money_acount')->select();
- $data['code'] = '200';
- $data['message'] = '1';
- $data['data'] = $agent_list;
- echo json_encode($data);
- }
-
-
- /**
- * 是否在新注册两小时内
- * @param $templateid []
- * @return $type 消息类型
- */
- public function newusertwoh(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid =$_POST['uid'];
- //用户注册时间
- $zhuce_time = M("user_info")->where("id=$uid")->getField("add_time");
- //now time
- $now_time = time();
-
- $time_cha = $now_time - $zhuce_time;
- $two_h =7200;
- $time_now_cha = $two_h - $time_cha;
- if ($two_h<$time_cha) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'no';
- $data['data'] = "0";
- echo json_encode($data);
- }else{
- $use_first_pay_type = M("user_first_pay")->where("uid=$uid")->field('thirty,fifty,eighty,one_hundred,two_hundred')->select();
- $wula = array('time'=>$time_now_cha,'pay'=>$use_first_pay_type);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $wula;
-
- echo json_encode($data);
- }
-
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
- /**
- * 黑料详情
- * @param $templateid []
- * @return $type 消息类型
- */
- public function heiliao_detail(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $video_id = $_POST['video_id'];
- $uid = $_POST['uid'];
-
- //判读是否登录
- if ($uid == '0' or $uid == '' or $uid=='undefined') {
- $data['message'] = 'error';
- echo json_encode($data);
- die();
- }
- //内容攒数 观看数
- $now_zan_num_list = M("video_list_test")->where("id=$video_id")->Field("views,thumbs_up,site")->select();
- $video_site = $now_zan_num_list[0]['site'];
- if($video_site =='HL'){
- $heiliao_list = M("heiliao_haijiao_books")->where("id=$video_id")->field("book,site,hj_video_url")->select()[0];
-
-
- $heiliao_list['views'] = $now_zan_num_list[0]['views'];
- $heiliao_list['thumbs_up'] = $now_zan_num_list[0]['thumbs_up'];
- $heiliao_list['hj_video_url'] = explode(",", $heiliao_list['hj_video_url']);
- }elseif ($video_site =='WB'){
- $heiliao_list = M("heiliao_haijiao_books")->where("id=$video_id")->field("book,site,hj_video_url")->select()[0];
- $heiliao_list['views'] = $now_zan_num_list[0]['views'];
- $heiliao_list['thumbs_up'] = $now_zan_num_list[0]['thumbs_up'];
- }else{
- $heiliao_list = M("heiliao_haijiao_books")->where("id=$video_id")->field("book,site")->select()[0];
- $heiliao_list['views'] = $now_zan_num_list[0]['views'];
- $heiliao_list['thumbs_up'] = $now_zan_num_list[0]['thumbs_up'];
- }
-
- if ( $heiliao_list['hj_video_url'][0]=="") {
- $heiliao_list['hj_video_url'] = array();
- }
-
-
-
- if($heiliao_list){
- M('video_list_test')->where("id=$video_id")->setInc('v_really',1);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = $heiliao_list;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] = "";
- echo json_encode($data);
- }
-
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 用户金币数量
- * @param $templateid []
- * @return $type 消息类型
- */
- public function user_gold_coins_amount(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $user_gold_coins_number = M("user_info")->where("id=$uid")->getField("gold_coins_number");
- if ($user_gold_coins_number) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = $user_gold_coins_number;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'ok';
- $data['data'] = 0;
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
- /**
- * 判断海角详情里是否有视频,反差详情
- * @param $templateid []
- * @return $type 消息类型
- */
- public function haijiao_video_yn(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $video_id = $_POST['video_id'];
- $uid = $_POST['uid'];
- $coins_buy =$_POST['coins'];
- $user_gold_coins_number = M("user_info")->where("id=$uid")->getField("gold_coins_number");
- $yn_video_list =M("heiliao_haijiao_books")->where("id=$video_id")->field("hj_video_url,book_type,book,site,book_str")->select()[0];
- $yn_video = $yn_video_list['hj_video_url'];
- $video_site = $yn_video_list['book_type'];
- if ($yn_video or $video_site=='FC') {
- $now_zan_num_list = M("video_list_test")->where("id=$video_id")->Field("views,thumbs_up,site,coins")->select();
-
- if ($video_site=='FC') {
- $video_list['book'] =$yn_video_list['book_str'] ;
- $video_list['hj_video_url'] = array();
- $video_list['title'] = $yn_video_list['site'] ;
- $video_list['coins'] = $now_zan_num_list[0]['coins'] ;
- $video_list['views'] = $now_zan_num_list[0]['views'] ;
- $video_list['thumbs_up'] = $now_zan_num_list[0]['thumbs_up'] ;
- }else{
- $video_list['hj_video_url'] =array();
- }
-
- //查询是否购买
- $yn_buy_hj = M("hj_fc_buy_record")->where("uid=$uid and v_id=$video_id")->getField("id");
- if ($yn_buy_hj or $coins_buy=='0') {
- M('video_list_test')->where("id=$video_id")->setInc('v_really',1);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['buy'] = '1';
- $data['user_coins'] = $user_gold_coins_number;
- $data['data'] = $video_list;
- echo json_encode($data);
- }else{
- $data['title'] = $yn_video_list['site'] ;
- $data['code'] = '200';
- $data['status'] = '3';
- $data['message'] = 'yes';
- $data['buy'] = '0';
- $data['user_coins'] = $user_gold_coins_number;
- $data['data'] = array();
- echo json_encode($data);
- }
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'no';
- $data['buy'] = '0';
- $data['user_coins'] = $user_gold_coins_number;
- $data['data'] = 'yes';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 购买海角视频
- * @param $templateid []
- * @return $type 消息类型
- */
- public function haijiao_video_detail_buy(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- $video_id = $_POST['video_id'];
- $user_gold_coins = M("user_info")->where("id=$uid")->getField("gold_coins_number");
- $video_coins = M("video_list_test")->where("id=$video_id")->getField("coins");
- if ($user_gold_coins>=$video_coins){
- //给用户扣费
- $koufei_hj = M("user_info")->where("id=$uid")->setDec('gold_coins_number',$video_coins); // 用户的积分减5
- if ($koufei_hj) {
- $buy_hj_record['uid'] = $uid;
- $buy_hj_record['v_id'] = $video_id;
- $buy_hj_record['time'] = time();
- $buy_hj_record['date'] = date("Y-m-d H:i:s",$buy_hj_record['time']);;
- $buy_hj_record['coins'] =$video_coins;
- $buy_hj_record['type'] ="FC";
- M("hj_fc_buy_record")->add($buy_hj_record);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'success';
- echo json_encode($data);
- }else{
- //没有足够金币
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- echo json_encode($data);
- }
-
- }else{
- //没有足够金币
- $data['code'] = '200';
- $data['status'] = '3';
- $data['message'] = 'no_coins';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
-
- /**
- * 临时
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_fancha_str(){
- if (!empty($_POST)){
- $fancha_list = M("heiliao_haijiao_books")->where("book_type='FC'")->field("id,book,book_str")->select();
- echo PHP_EOL.M("heiliao_haijiao_books")->_sql();
- foreach ($fancha_list as $key => $value) {
- $img_str = $value['book'];
- $img_id = $value['id'];
-
- $topimg_list = explode(',', $img_str);
- echo PHP_EOL.$img_id;
- $book_str = '';
- foreach ($topimg_list as $key1 => $value1) {
- echo PHP_EOL.$value1.'*';
- $book_str .= "<img src='".$value1."' alt=''>" ;
-
- }
- $fancha_list['book_str'] = $book_str;
- M("heiliao_haijiao_books")->where("id=$img_id")->save($fancha_list);
-
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
-
- /**
- * 三大类推荐
- * 1个欧美+1个日韩+1个动画+1个黑料专区+1个海角社区+2个反差福利+1个信息流广告——如此循环5次结束
- * @param $templateid []
- * @return $type 消息类型
- */
- public function three_type_tuijian(){
- header('Content-Type:text/json;charset=utf-8');
- header('Access-Control-Allow-Origin:*');
- header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
- header('Access-Control-Allow-Methods:POST');
- header('Access-Control-Expose-Headers:*');
- if (!empty($_POST)){
- $uid = $_POST['uid'];
- // EUA
- // Asian
- // Anime
- // HL
- // WB
- // FC
- $oumei_list =M("video_list_test")->where("site = 'EUA'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(5)->select();
- $yazhou_list =M("video_list_test")->where("site = 'Asian'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(5)->select();
- $dongman_list = M("video_list_test")->where("site = 'Anime'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(5)->select();
- $heiliao_list = M("video_list_test")->where("site = 'HL'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(5)->select();
- $wangbao_list = M("video_list_test")->where("site = 'WB'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(5)->select();
- // $fancha_list = M("video_list_test")->where("site = 'FC'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("id asc")->LIMIT(10)->select();
- $fancha_list = M("video_list_test")->where("site = 'FC'")->field("id,title,top_img,views,thumbs_up,favorite,time_chuo,uploader,site,coins")->order("rand()")->LIMIT(10)->select();
-
- $goumai_str_list = M("hj_fc_buy_record")->where("uid=$uid")->field("v_id")->select();
- $goumai_str = ',';
- foreach ($goumai_str_list as $key1 => $value1) {
- $vv_id = $value1['v_id'];
- $goumai_str .= "$vv_id".",";
- }
- foreach ($fancha_list as $key => $value) {
-
-
- $now_vid = $value['id'];
- $needle = ",$now_vid,";
-
- if (strpos($goumai_str, $needle) !== false){
- $fancha_list[$key]['coins'] = "-1";
- }
-
- }
- $tuijian_video_list = array($oumei_list[0], $yazhou_list[0], $dongman_list[0], $heiliao_list[0], $wangbao_list[0], array($fancha_list[0],$fancha_list[1]),
- $oumei_list[1], $yazhou_list[1], $dongman_list[1], $heiliao_list[1], $wangbao_list[1], array($fancha_list[2],$fancha_list[3]),
- $oumei_list[2], $yazhou_list[2], $dongman_list[2], $heiliao_list[2], $wangbao_list[2], array($fancha_list[4],$fancha_list[5]),
- $oumei_list[3], $yazhou_list[3], $dongman_list[3], $heiliao_list[3], $wangbao_list[3], array($fancha_list[6],$fancha_list[7]),
- $oumei_list[4], $yazhou_list[4], $dongman_list[4], $heiliao_list[4], $wangbao_list[4], array($fancha_list[8],$fancha_list[9]),);
- if (!empty($tuijian_video_list)) {
-
-
-
-
- $data['message'] = 'ok';
-
- //获取广告列表
- $adv_list = M("slgj_advert_list")->where("type='视频列表广告'")->Field("img,jump_link,number")->order("rand()")->LIMIT(12)->select();
- $adv_list = array($adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3],$adv_list[0],$adv_list[1],$adv_list[2],$adv_list[3]);
-
- $jia_num = 0;
- $qishi_num = 0;
- $data_list_number = count($tuijian_video_list);
- $quzheng_num = floor($data_list_number / 6);
- foreach ($adv_list as $key => $value) {
-
-
- $charu_array = array($adv_list[$key]);
- array_splice($tuijian_video_list, $jia_num, 0, $charu_array);
-
- $jia_num += 7;
- $qishi_num += 1;
-
- if ($qishi_num >= $quzheng_num) {
- break;
- }
- }
-
-
- $data['data'] = $tuijian_video_list;
- echo json_encode($data);
- } else {
- $data['message'] = 'null';
- $data['data'] = [];
- echo json_encode($data);
-
- }
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_idheiliao(){
- $user_list =M("video_list_test")->where("site='WB'")->field("id,title")->select();
- foreach ($user_list as $key => $value) {
- $vid = $value['id'];
- $title = $value['title'];
- echo PHP_EOL.$vid;
- echo PHP_EOL.$title;
- $heiliao_list['id'] =$vid;
- M("heiliao_haijiao_books")->where("site='$title'")->save($heiliao_list);
-
- }
- }
-
-
-
- }
-
- ?>
|