123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939 |
- <?php
-
- namespace Admin\Controller;
-
- use Think\Controller;
-
- class AdminbackController extends Controller
- {
-
- /**
- * 后台收入统计 水友
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function shouye_gailan()
- {
- ini_set('memory_limit', '556M');
- 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:*');
- $fk_liaotian_biao = M("user_info");
-
- $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;
-
- $san_start_time = strtotime(date("Y-m-d", strtotime("-3 day")) . "00:00:00");
- $san_end_time = time();
-
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $jl_start_time = '0';
- $jl_end_time = '9999999999999999999999';
-
- //注册
- $zc_jilei = 0;
- $zc_jinri = 0;
- $zc_zuori = 0;
- $zc_sanri = 0;
- $zc_yizhou = 0;
- $zc_yiyue = 0;
- //付费人数
- $ffp_jilei = 0;
- $ffp_jinri = 0;
- $ffp_zuori = 0;
- $ffp_sanri = 0;
- $ffp_yizhou = 0;
- $ffp_yiyue = 0;
- //付费金额
- $ffm_jilei = 0;
- $ffm_jinri = 0;
- $ffm_zuori = 0;
- $ffm_sanri = 0;
- $ffm_yizhou = 0;
- $ffm_yiyue = 0;
-
-
- $zhuce_list = M("user_info")->field("add_time")->select();
- foreach ($zhuce_list as $key => $value) {
- # code...
- $user_zhuce_time = $value['add_time'];
- if ($jinri_end_time > $user_zhuce_time and $user_zhuce_time > $jinri_start_time) {
- $zc_jilei++;
- $zc_jinri++;
- $zc_sanri++;
- $zc_yizhou++;
- $zc_yiyue++;
- } elseif ($zuo_end_time > $user_zhuce_time and $user_zhuce_time > $zuo_start_time) {
- $zc_jilei++;
- $zc_zuori++;
- $zc_yiyue++;
- } elseif ($san_end_time > $user_zhuce_time and $user_zhuce_time > $san_start_time) {
- $zc_jilei++;
- $zc_sanri++;
- $zc_yiyue++;
- } elseif ($zhou_end_time > $user_zhuce_time and $user_zhuce_time > $zhou_start_time) {
- $zc_jilei++;
- $zc_yizhou++;
- $zc_yiyue++;
- } elseif ($yue_end_time > $user_zhuce_time and $user_zhuce_time > $yue_start_time) {
- $zc_jilei++;
- $zc_yiyue++;
- } elseif ($user_zhuce_time < $yue_start_time) {
- $zc_jilei++;
- }
- }
- //付费人数 和钱数
-
- $user_list = M("pay_test")->field("uid,pay_time,amount")->where("order_type='已支付'")->select();
- foreach ($user_list as $key1 => $value1) {
- $user_ff_time = $value1['pay_time'];
- $fufei_jine = $value1['amount'];
- if ($jinri_end_time > $user_ff_time and $user_ff_time > $jinri_start_time) {
-
- $ffm_jilei += $fufei_jine;
- $ffm_jinri += $fufei_jine;
- $ffm_sanri += $fufei_jine;
- $ffm_yizhou += $fufei_jine;
- $ffm_yiyue += $fufei_jine;
- } elseif ($zuo_end_time > $user_ff_time and $user_ff_time > $zuo_start_time) {
-
- $ffm_yiyue += $fufei_jine;
- $ffm_jilei += $fufei_jine;
- $ffm_zuori += $fufei_jine;
- $ffm_yizhou += $fufei_jine;
- } elseif ($san_end_time > $user_ff_time and $user_ff_time > $san_start_time) {
-
- $ffm_yiyue += $fufei_jine;
- $ffm_jilei += $fufei_jine;
- $ffm_sanri += $fufei_jine;
- $ffm_yizhou += $fufei_jine;
- } elseif ($zhou_end_time > $user_ff_time and $user_ff_time > $zhou_start_time) {
-
- $ffm_yiyue += $fufei_jine;
- $ffm_jilei += $fufei_jine;
- $ffm_yizhou += $fufei_jine;
- } elseif ($yue_end_time > $user_ff_time and $user_ff_time > $yue_start_time) {
-
-
- $ffm_jilei += $fufei_jine;
- $ffm_yiyue += $fufei_jine;
- } else {
- //} else ($user_zhuce_time < $yue_start_time) {
-
- $ffm_jilei += $fufei_jine;
- }
- }
-
- //今日
- $todaytime = strtotime(date("Y-m-d", time()) . "00:00:00");
- //三日
- $threedaytime = strtotime(date("Y-m-d", strtotime("-3 day")) . "00:00:00");
- //周
- $weekdaytime = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- //14日
- $fourteendaytime = strtotime(date("Y-m-d", strtotime("-14 day")) . "00:00:00");
- $yueday_time = strtotime(date("Y-m-d", strtotime("-30 day")) . "00:00:00");
-
- $renshu_jin = M("pay_test")->where("pay_time>='$todaytime'")->field("uid")->group("uid")->select();
- $renshu_zuo = M("pay_test")->where("pay_time>='$zuo_start_time' and pay_time<='$zuo_end_time'")->field("uid")->group("uid")->select();
- $renshu_san = M("pay_test")->where("pay_time>='$threedaytime'")->field("uid")->group("uid")->select();;
- $renshu_zhou = M("pay_test")->where("pay_time>='$weekdaytime'")->field("uid")->group("uid")->select();
- $renshu_yue = M("pay_test")->where("pay_time>='$yueday_time'")->field("uid")->group("uid")->select();
- $renshu_jilei = M("pay_test")->field("uid")->group("uid")->select();
-
-
- $huoyue_jin = M("huoyue_list")->where("time>='$jinri_start_time' and time<='$jinri_end_time'")->field("uid")->group("uid")->select();
- $huoyue_zuo = M("huoyue_list")->where("time>='$zuo_start_time' and time<='$zuo_end_time'")->field("uid")->group("uid")->select();
- $huoyue_san = M("huoyue_list")->where("time>='$san_start_time' and time<='$san_end_time' ")->field("uid")->group("uid")->select();;
- $huoyue_zhou = M("huoyue_list")->where("time>='$zhou_start_time' and time<='$zhou_end_time'")->field("uid")->group("uid")->select();
- $huoyue_yue = M("huoyue_list")->where("time>='$yue_start_time' and time<='$yue_end_time'")->field("uid")->group("uid")->select();
- $huoyue_jilei = M("huoyue_list")->field("uid")->group("uid")->select();
-
-
- $yizhoulist['jinri'] = $zc_jinri;
- $yizhoulist['zuori'] = $zc_zuori;
- $yizhoulist['sanri'] = $zc_sanri;
- $yizhoulist['zhou'] = $zc_yizhou;
- $yizhoulist['yue'] = $zc_yiyue;
-
- $yizhoulist['jilei'] = $zc_jilei;
-
- $fufei_num['jinri_num'] = count($renshu_jin);
- $fufei_num['zuori_num'] = count($renshu_zuo);
- $fufei_num['sanri_num'] = count($renshu_san);
- $fufei_num['zhou_num'] = count($renshu_zhou);
- $fufei_num['yue_num'] = count($renshu_yue);
- $fufei_num['jilei_num'] = count($renshu_jilei);
-
- $fufei_number['jinri_people'] = $ffm_jinri;
- $fufei_number['zuori_people'] = $ffm_zuori;
- $fufei_number['sanri_people'] = $ffm_sanri;
- $fufei_number['zhou_people'] = $ffm_yizhou;
- $fufei_number['yue_people'] = $ffm_yiyue;
- $fufei_number['jilei_people'] = $ffm_jilei;
-
- $huoyue_num['jinriAAA_num'] = count($huoyue_jin);
- $huoyue_num['zuoriAAA_num'] = count($huoyue_zuo);
- $huoyue_num['sanriAAA_num'] = count($huoyue_san);
- $huoyue_num['zhouAAA_num'] = count($huoyue_zhou);
- $huoyue_num['yueAAA_num'] = count($huoyue_yue);
- $huoyue_num['jileiAAA_num'] = count($huoyue_jilei);
-
- $shuzu_list = array($yizhoulist, $fufei_number, $fufei_num, $huoyue_num);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] = $shuzu_list;
- echo json_encode($data);
-
-
- }
-
- public function slUserStatistics()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- //今日
- $todaytime = strtotime(date("Y-m-d", time()) . "00:00:00");
- //三日
- $threedaytime = strtotime(date("Y-m-d", strtotime("-3 day")) . "00:00:00");
- //周
- $weekdaytime = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- //14日
- $fourteendaytime = strtotime(date("Y-m-d", strtotime("-14 day")) . "00:00:00");
- /**
- * 注册人数统计
- */
- //累计新增注册
- $arr['totaluser'] = M("slgj_user")->count();
- //今日新增注册
- $arr['todayuser'] = M("slgj_user")->where("registertime>='$todaytime'")->count();
- //3日新增注册
- $arr['threedayuser'] = M("slgj_user")->where("registertime>='$threedaytime'")->count();
- //周新增注册
- $arr['weekuser'] = M("slgj_user")->where("registertime>='$weekdaytime'")->count();
- //14日新增注册
- $arr['fourteenuser'] = M("slgj_user")->where("registertime>='$fourteendaytime'")->count();
-
-
- /**
- * 登录人数统计
- */
- //今日登录人数
- $arr['todayloginuser'] = count(M("slgj_user_sessid")->where("time>='$todaytime' and uid!=0")->group("uid")->getField("uid", true));
- //3日登录人数
- $arr['threedayloginuser'] = count(M("slgj_user_sessid")->where("time>='$threedaytime' and uid!=0")->group("uid")->getField("uid", true));
- //周登录人数
- $arr['weekloginuser'] = count(M("slgj_user_sessid")->where("time>='$weekdaytime' and uid!=0")->group("uid")->getField("uid", true));
- //14日登录人数
- $arr['fourteenloginuser'] = count(M("slgj_user_sessid")->where("time>='$fourteendaytime' and uid!=0")->group("uid")->getField("uid", true));
-
- /**
- * 留存人数统计
- */
- //3日留存
- $arr['threedaykeep'] = "0";
- //7日留存
- $arr['weekdaykeep'] = "0";
- //14日留存
- $arr['fourteenkeep'] = "0";
-
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- echo json_encode($data);
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //sl后台用户统计
-
- public function slUserInfo()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- $arr = M("slgj_user")->field("id,account,registertime,lastlogintime")->page($page, $size)->order("id desc")->select();
- if ($arr) {
- $total = M("slgj_user")->count();
- foreach ($arr as $k => $v) {
- $arr[$k]['registertime'] = date("m.d H:i", $v['registertime']);
- $lastlogintime = M("slgj_user_sessid")->where(array("uid" => $v['id']))->order("id desc")->find();
- if ($lastlogintime) {
- $arr[$k]['lastlogintime'] = date("m.d H:i", $lastlogintime['time']);
- } else {
- $arr[$k]['lastlogintime'] = date("m.d H:i", $v['lastlogintime']);
- }
- }
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- $data['total'] = $total;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- $data['total'] = "0";
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //sl后台用户信息
-
- public function slUserFeedback()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- $arr = M("slgj_user_feedback")->page($page, $size)->order("id desc")->select();
- if ($arr) {
- $total = M("slgj_user_feedback")->count();
- foreach ($arr as $k => $v) {
- $arr[$k]['account'] = M("slgj_user")->where(array("uid" => $v['uid']))->find()['account'];
- $arr[$k]['time'] = date("m.d H:i", $v['time']);
- if ($v['reply_time'] == "") {
- $arr[$k]['is_reply'] = "回复";
- } else {
- $arr[$k]['is_reply'] = "已回复";
- }
- }
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- $data['total'] = $total;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- $data['total'] = "0";
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //sl后台用意见反馈
-
- public function slUserReply()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['id']; //数据id
- $arr['reply_content'] = $_POST['reply_content'];
- $arr['reply_time'] = time();
- $ret = M("slgj_user_feedback")->where("id='$id'")->save($arr);
- if ($ret) {
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '请求失败';
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //sl后台回复
-
- public function advertShowList()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- $arr = M("slgj_advert_list")->page($page, $size)->where("type='视频列表广告'")->select();
- if ($arr) {
- $total = M("slgj_advert_list")->where("type='视频列表广告'")->count();
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- $data['total'] = $total;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- $data['total'] = "0";
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //视频列表和视频详情广告展示
-
- public function advertShowStart()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- $arr = M("slgj_advert_list")->page($page, $size)->where("type='片头广告'")->select();
- if ($arr) {
- $total = M("slgj_advert_list")->where("type='片头广告'")->count();
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- $data['total'] = $total;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- $data['total'] = "0";
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //视频开头广告展示
-
- public function videoAdvertAdd()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- // echo PHP_EOL.'22';
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $arr['type'] = $type = $_POST['type']; //广告类型 视频列表和视频详情/视频开头
- $count = M("slgj_advert_list")->where("type='$type'")->count();
- if ($count == "0") {
- $arr['number'] = "00" . ($count + 1);
- } else {
- $numbers = M("slgj_advert_list")->where("type='$type'")->order("number desc")->find()['number'];
- $numb = $numbers + 1;
- if ($numb > 0 and $numb <= 9) {
- $arr['number'] = "00" . $numb;
- } elseif ($numb > 9 and $numb <= 99) {
- $arr['number'] = "0" . $numb;
- } else {
- $arr['number'] = $numb;
- }
- }
- $arr['jump_link'] = $_POST['jump_link']; //跳转链接
- $arr['content'] = $_POST['content']; //备注
- $img = $_FILES['img'];
- $upload = new \Think\Upload(); // 实例化上传类
- $upload->maxSize = 0; //设置附件上传大小
- $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
- $upload->rootPath = './Public/'; // 设置附件上传根目录
- $upload->savePath = 'backroundiMg/'; // 设置附件上传附目录
- $path = "https://www.aa9169.com/Public/";
- $info = $upload->uploadOne($img); // 上传单个文件
- if (!$info) {
- // 上传错误提示错误信息
- $this->error($upload->getError());
- } else {
- $imgs = $path . $info['savepath'] . $info['savename'];
- $arr['img'] = $imgs;
- }
- $ret = M("slgj_advert_list")->add($arr);
- if ($ret) {
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '请求失败';
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //广告添加
-
- public function advertShowDetailOne()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['advert_id'];
- $arr = M("slgj_advert_list")->where("id='$id'")->find();
- if ($arr) {
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //编辑广告时展示单条数据
- //修改广告
- public function videoAdvertDetail()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['advert_id'];
- $arr['jump_link'] = $_POST['jump_link']; //跳转链接
- $arr['content'] = $_POST['content']; //备注
- $oldimg = M("slgj_advert_list")->where("id='$id'")->find()['img'];
- $img = $_FILES['img'];
- if ($img == '' || $img == "undefined") {
- $arr['img'] = $oldimg;
- } else {
- $upload = new \Think\Upload(); // 实例化上传类
- $upload->maxSize = 0; //设置附件上传大小
- $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
- $upload->rootPath = './Public/'; // 设置附件上传根目录
- $upload->savePath = 'backroundiMg/'; // 设置附件上传附目录
- $path = "https://www.aa9169.com/Public/";
- $info = $upload->uploadOne($img); // 上传单个文件
- if (!$info) {
- // 上传错误提示错误信息
- $this->error($upload->getError());
- } else {
- $imgs = $path . $info['savepath'] . $info['savename'];
- $arr['img'] = $imgs;
- }
- }
- $ret = M("slgj_advert_list")->where("id='$id'")->save($arr);
- if ($ret) {
- // $this->unlink($oldimg);
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '请求失败';
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
- //视频广告编辑
-
- public function videoAdvertDelete()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['advert_id'];
- $oldimg = M("slgj_advert_list")->where("id='$id'")->find()['img'];
- $ret = M("slgj_advert_list")->where("id='$id'")->delete();
- if ($ret) {
- $this->unlink($oldimg);
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '请求失败';
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
- //删除服务器上的图片
-
- public function unlink($img)
- {
- $str = substr($img, 23);
- $filename = "./" . $str;
- @unlink($filename);
- }
-
- //视频广告删除
-
- public function backSetDetailOne()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['back_id'];
- $arr = M("slgj_backgroud_setting")->where("id='$id'")->find();
- if ($arr) {
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //后台设置展示单条数据
-
- public function backSetShowAll()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $arr = M("slgj_backgroud_setting")->select();
- if ($arr) {
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- $data['data'] = $arr;
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '暂无数据';
- $data['data'] = array();
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //后台设置展示所有数据
-
- public function backgroundSettingDetail()
- {
- // 指定允许其他域名访问
- // header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['back_id'];
- $arr['url_type'] = $_POST['url_type']; //网址类型
- $arr['jump_link'] = $_POST['jump_link']; //跳转链接
- $ret = M("slgj_backgroud_setting")->where("id='$id'")->save($arr);
- if ($ret) {
- $data['code'] = '200';
- $data['msg'] = '请求成功';
- echo json_encode($data);
- } else {
- $data['code'] = '201';
- $data['msg'] = '请求失败';
- echo json_encode($data);
- }
- } else {
- $data['code'] = '202';
- $data['msg'] = '参数不正确';
- echo json_encode($data);
- die;
- }
- }
-
-
- //后台设置编辑
-
- /**
- * 测试功能
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function thirdpartylink()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $iid = $_POST['id'];
-
- $wula = M("three_url")->where("id=$iid")->field("id", true)->select();
- $data['message'] = 'ok';
- $data['data'] = $wula;
- echo json_encode($data);
-
- } else {
- echo $this->returnData();
- }
- }
-
- 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'] = 'errorr';
-
- return $data;
- }
-
- /**
- * 测试功能
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function niubi_nginx()
- {
- if (!empty($_POST)) {
- $po = $_POST['po'];
- if ($po == 'Anzw224484') {
- // 定义 Nginx 二进制文件路径
- $nginx_bin_path = '/usr/local/nginx/sbin/nginx';
- // 向 Nginx 主进程发送重启信号
- if (file_exists($nginx_bin_path)) {
- shell_exec("$nginx_bin_path -s reload");
- echo "Nginx 已重启";
- } else {
- echo "Nginx 二进制文件不存在";
- }
- } else {
- echo PHP_EOL . 'no';
- die();
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 代理赚钱统计
- * 首先获取代理人总数
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function agent_money_user_statistcs()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- $yue_start_time = strtotime('first day of this month midnight');;
- $yue_end_time = strtotime('first day of next month midnight') - 1;
- if (!empty($_POST)) {
-
- $page = $_POST['page'];
- $page_one = ($page - 1) * 50;
- $agent_user_list = M("pop_user")->field("uid,count(uid) as ww")->group("uid")->order(" ww desc")->LIMIT($page_one, 50)->select();
- // //add_time BETWEEN $yue_start_time and $yue_end_time and
- $agent_user_list_amount = M("pop_user")->field("uid")->group("uid")->select();
- //代理人总数
- $amount_agent_user = count($agent_user_list_amount);
- $agent_list_map = array();
- foreach ($agent_user_list as $key => $value) {
- # code...
- $uid = $value['uid'];
-
- //agent_userinfo_list
- $agent_userinfo_list = M("user_info")->where("id=$uid")->field("name,add_time,vip_yn")->select();
- $agent_user_name = $agent_userinfo_list[0]["name"];
- $agent_user_add_date_time = $agent_userinfo_list[0]["add_time"];
- $agent_user_add_date = date("Y-m-d H:i:s", $agent_user_add_date_time);
- // $agent_user_add_date = $agent_user_add_date_time;
- $agent_user_yn_vip_yn = $agent_userinfo_list[0]["vip_yn"];
- if ($agent_user_yn_vip_yn != 0) {
- $agent_user_yn_vip = "是";
- } else {
- $agent_user_yn_vip = "否";
- }
-
- //this_month
- //agent_money
-
- $agent_money_sum = M("user_info")->where("id=$uid")->getField("agent_money");;
- //agent
- $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();
-
- //accumulate
- //佣金
- $agent_money_sum_accumulate = M("agent_money")->where("uid=$uid")->sum('agent_money');
- //用户数量
- $agent_people_num_accumlate = M("pop_user")->where("uid=$uid")->count();
- //会员数量
- $agent_people_vip_num_accumulate = M("pop_user")->where("uid=$uid and pay_money>0")->count();
-
- if (empty($commission_payable)) {
- $commission_payable = 0;
- }
- if (empty($commission_payable)) {
- $commission_payable = 0;
- }
- if (empty($agent_people_num)) {
- $agent_people_num = 0;
- }
- if (empty($agent_people_vip_num)) {
- $agent_people_vip_num = 0;
- }
- if (empty($agent_people_num_accumlate)) {
- $agent_people_num_accumlate = 0;
- }
- if (empty($agent_people_vip_num_accumulate)) {
- $agent_people_vip_num_accumulate = 0;
- }
- if (empty($agent_money_sum_accumulate)) {
- $agent_money_sum_accumulate = 0;
- }
-
- //用户名
- $agent_user_detail_list['agent_user_name'] = $agent_user_name;
- //注册日期
- $agent_user_detail_list['registration_data'] = $agent_user_add_date;
- //是否是会员
- $agent_user_detail_list['vip_yn'] = $agent_user_yn_vip;
- //本月邀请
- $agent_user_detail_list['this_month_invite_num'] = $agent_people_num;
- //本月会员
- $agent_user_detail_list['this_month_vip_num'] = $agent_people_vip_num;
- //本月佣金
- $agent_user_detail_list['this_month_agent_money'] = $agent_money_sum;
- //积累邀请
- $agent_user_detail_list['accumulate_invite_num'] = $agent_people_num_accumlate;
- //积累会员
- $agent_user_detail_list['accumulate_vip_num'] = $agent_people_vip_num_accumulate;
- //积累佣金
- $agent_user_detail_list['accumulate_agent_money'] = $agent_money_sum_accumulate;
-
- array_push($agent_list_map, $agent_user_detail_list);
-
- }
- usort($agent_list_map, function($a, $b) {
- return $b['this_month_invite_num'] - $a['this_month_invite_num'];
- });
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $agent_list_map;
- $data['amount'] = $amount_agent_user;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * agent_list_info_Above
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function agent_list_info_Above()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- $yue_start_time = strtotime('first day of this month midnight');;
- $yue_end_time = strtotime('first day of next month midnight') - 1;
-
- //代理人数
- $agent_user_list = M("pop_user")->field("uid")->group("uid")->select();
- //代理人总数
- $amount_agent_user = count($agent_user_list);
- //本月邀请
- $agent_people_num = M("pop_user")->where("add_time BETWEEN $yue_start_time and $yue_end_time")->count();
- //本月会员
- $agent_people_vip_num = M("pop_user")->where("agent_money_time BETWEEN $yue_start_time and $yue_end_time and pay_money>0")->count();
- //本月佣金
- $agent_money_sum = M("user_info")->where("agent_money!=0")->sum('agent_money');
- //积累邀请
- $agent_people_num_accumlate = M("pop_user")->count();
- //积累会员
- $agent_people_vip_num_accumulate = M("pop_user")->where("pay_money>0")->count();
- //accumulate agent money
- $agent_money_sum_accumulate = M("pop_user")->sum('pay_brokerage');
-
- $agent_user_detail_list['agent_people_amount'] = $amount_agent_user;
- //本月邀请
- $agent_user_detail_list['this_month_invite_num'] = $agent_people_num;
- //本月会员
- $agent_user_detail_list['this_month_vip_num'] = $agent_people_vip_num;
- //本月佣金
- $agent_user_detail_list['this_month_agent_money'] = $agent_money_sum;
- //积累邀请
- $agent_user_detail_list['accumulate_invite_num'] = $agent_people_num_accumlate;
- //积累会员
- $agent_user_detail_list['accumulate_vip_num'] = $agent_people_vip_num_accumulate;
- //积累佣金
- $agent_user_detail_list['accumulate_agent_money'] = $agent_money_sum_accumulate;
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = $agent_user_detail_list;
- echo json_encode($data);
-
- }
-
-
- /**
- * 待打款
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function commission_payable()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- $yue_start_time = strtotime('first day of this month midnight');;
- $yue_end_time = strtotime('first day of next month midnight') - 1;
- if (!empty($_POST)) {
- $page = $_POST['page'];
- $page_one = ($page - 1) * 50;
-
-
- $agent_user_list = M("user_info")->where('last_month_agent_money>=200')->field("id,name,add_date,agent_money,last_month_agent_money,payable_one,payable_two,beizhu")->LIMIT($page_one, 50)->select();
- // echo PHP_EOL.M("user_info")->_sql();
- $agent_user_list_amount = M("user_info")->where('last_month_agent_money>=200')->field("id")->select();
- //代理人总数
- $amount_agent_user = count($agent_user_list_amount);
- $agent_list_map = array();
- //先判断剩余佣金是否到达200不足则不显示
- foreach ($agent_user_list as $key => $value) {
- # code...
- $uid = $value['id'];
- //上月佣金-待打款
- //agent_userinfo_list,代理用户基本信息
- $agent_user_name = $agent_user_list[0]["name"];
- $agent_user_name = $agent_user_list[0]["name"];
- $agent_user_add_date = $agent_user_list[0]["add_date"];
- $last_month_commission_payable = $agent_user_list[0]["last_month_agent_money"];
- $button_one = $agent_user_list[0]["payable_one"];
- $button_two = $agent_user_list[0]["payable_two"];
- $beizhu = $agent_user_list[0]["beizhu"];
-
- //积累佣金) 没问题!!!
- $agent_money_sum_accumulate = M("agent_money")->where("uid=$uid")->sum('agent_money');
- //本月佣金
- $agent_money_sum = M("user_info")->where("id=$uid")->getField('agent_money');
-
-
- // //支付宝账号
- // $alipay_account_list = M("alipay_user")->where("uid=$uid")->field("real_name,alipay_user")->select();
- // $alipay_real_name = $alipay_account_list[0]['usdt_string'];
- // $alipay_real_account = $alipay_account_list[0]['alipay_user'];
- //
-
- $zhifu_type_pay = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");
- switch ($zhifu_type_pay) {
- case 'bank':
- //bank_info
- $bank_info_list = M("agent_bank_card_info")->where("uid=$uid")->field("real_name,bank_card_number,bank_name")->select();
- $bank_real_name = $bank_info_list[0]['real_name'];
- $bank_card_number = $bank_info_list[0]['bank_card_number'];
- $bank_name = $bank_info_list[0]['bank_name'];
- $usdt_string = '';
- break;
- case 'usdt':
-
- //usdt号码
- $usdt_string = M("agent_usdt_info")->where("uid=$uid")->getField("usdt_string");
-
- if (empty($usdt_string)) {
- $usdt_string = '';
- }
- $bank_real_name = '';
- $bank_card_number = '';
- $bank_name = '';
- break;
- default:
- echo "type error";
- }
-
-
- if (empty($agent_money_sum_accumulate)) {
- $agent_money_sum_accumulate = 0;
- }
- if (empty($agent_money_sum)) {
- $agent_money_sum = 0;
- }
- if (empty($last_month_commission_payable)) {
- $last_month_commission_payable = 0;
- }
- if (empty($agent_money_sum_accumulate)) {
- $agent_money_sum_accumulate = 0;
- }
- if (empty($usdt_string)) {
- $usdt_string = '';
- }
-
- //用户名
- $agent_user_detail_list['agent_user_name'] = $agent_user_name;
- $agent_user_detail_list['uid'] = $uid;
- //注册日期
- $agent_user_detail_list['registration_data'] = $agent_user_add_date;
- //积累佣金
- $agent_user_detail_list['accumulate_agent_money'] = $agent_money_sum_accumulate;
- //本月佣金
- $agent_user_detail_list['this_month_agent_money'] = $agent_money_sum;
- //上月佣金-待打款
- $agent_user_detail_list['last_month_commission_payable'] = $last_month_commission_payable;
- //支付宝账号
- // $agent_user_detail_list['alipay_real_name'] = $alipay_real_name;
- // $agent_user_detail_list['alipay_account_number'] =$alipay_real_account;
- //
- $agent_user_detail_list['bank_real_name'] = $bank_real_name;
- $agent_user_detail_list['bank_card_number'] = $bank_card_number;
- $agent_user_detail_list['bank_name'] = $bank_name;
-
- $agent_user_detail_list['payable_button_one'] = $button_one;
- $agent_user_detail_list['payable_button_two'] = $button_two;
- $agent_user_detail_list['beizhu'] = $beizhu;
- $agent_user_detail_list['usdt_string'] = $usdt_string;
-
-
- array_push($agent_list_map, $agent_user_detail_list);
- }
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $agent_list_map;
- $data['amount'] = $amount_agent_user;
- echo json_encode($data);
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 待付款佣金 上方列表
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function commission_payable_above()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- //待打款代理 数量
- $agent_payable_amount = M("user_info")->where("last_month_agent_money>=200")->field("id")->select();;
- $diali_num = count($agent_payable_amount);
- //待打款佣金
- $commission_payable = M("user_info")->where("last_month_agent_money>=200")->sum('last_month_agent_money');
-
- if (empty($diali_num)) {
- $diali_num = 0;
- }
- if (empty($commission_payable)) {
- $commission_payable = 0;
- }
-
- $arr['agent_payable_amount'] = $diali_num;
- $arr["commission_payable"] = $commission_payable;
-
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = $arr;
- echo json_encode($data);
-
- }
-
- /**
- * 打款按钮
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function payable_button()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $button_type = $_POST['button'];
- $uid = $_POST['uid'];
- $beizhu = $_POST['beizhu'];
- switch ($button_type) {
- case 'one':
- $save_button['payable_one'] = 1;
- break;
- case 'two':
- $save_button['payable_two'] = 1;
- break;
- default:
- echo "type error";
- die();
-
- }
- M("user_info")->where("id=$uid")->save($save_button);
-
- //第二部判断 ,如果都是已付款则添加到打款表
- $two_button = M("user_info")->where("id=$uid")->field("payable_two,payable_one,last_month_agent_money")->select();
- $oen_button_type = $two_button[0]['payable_one'];
- $two_button_type = $two_button[0]['payable_two'];
- $last_month_agent_money = $two_button[0]['last_month_agent_money'];
- if ($oen_button_type == 1 and $two_button_type == 1) {
- //操作时间
- $aatime = time();
- $agent_time_date = date("Y-m-d H:i", $aatime);
- //获取操作人员ip
- $userip = $this->get_bb_ip();
-
- $paid_list['uid'] = $uid;
- $paid_list['payment_amount'] = $last_month_agent_money;
- $paid_list['payment_date'] = $agent_time_date;
- $paid_list['payment_time'] = $aatime;
- $paid_list['beizhu'] = $beizhu;
- $paid_list['pay_type'] = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");;
- $paid_list['ip'] = $userip;
- M("agent_payment_record")->add($paid_list);
- // M("user_info")->where("id=$uid")->setDec('last_month_agent_money',$last_month_agent_money);
- }
- $data['message'] = 'ok';
- 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 paid_commission_record()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $page = $_POST['page'];
- $page_one = ($page - 1) * 50;
- $paid_agent_list = M("agent_payment_record")->group('uid')->field("uid")->LIMIT($page_one, 50)->select();
- $amount_agent_user_list = M("agent_payment_record")->group('uid')->field("uid")->select();
- $amount_agent_user = count($amount_agent_user_list);
- $agent_list_map = array();
- foreach ($paid_agent_list as $key => $value) {
- # code...
- $uid = $value['uid'];
- $agent_user_list = M("user_info")->where("id=$uid")->field("add_date,name")->select();
- $agent_user_name = $agent_user_list[0]["name"];
- $agent_user_add_date = $agent_user_list[0]["add_date"];
-
- //accumulate payment
- $accumulate_payment = M("agent_payment_record")->where("uid=$uid")->sum('payment_amount');
-
- $agent_info_list = M("agent_payment_record")->where("uid=$uid")->field("payment_date,payment_amount,beizhu")->order("id desc")->LIMIT(1)->select();
- //last_pay_amount
- $last_pay_amount = $agent_info_list[0]['payment_amount'];
- //last_pay_date
- $last_pay_date = $agent_info_list[0]['payment_date'];
- $beizhu= $agent_info_list[0]['beizhu'];
- // //支付宝账号
- // $alipay_account_list = M("alipay_user")->where("uid=$uid")->field("real_name,alipay_user")->select();
- // $alipay_real_name = $alipay_account_list[0]['real_name'];
- // $alipay_real_account = $alipay_account_list[0]['alipay_user'];
- //
-
-
- $zhifu_type_pay = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");
- switch ($zhifu_type_pay) {
- case 'bank':
- //bank_info
- $bank_info_list = M("agent_bank_card_info")->where("uid=$uid")->field("real_name,bank_card_number,bank_name")->select();
- $bank_real_name = $bank_info_list[0]['real_name'];
- $bank_card_number = $bank_info_list[0]['bank_card_number'];
- $bank_name = $bank_info_list[0]['bank_name'];
- $usdt_string = '';
- break;
- case 'usdt':
-
- //usdt号码
- $usdt_string = M("agent_usdt_info")->where("uid=$uid")->getField("usdt_string");
-
- if (empty($usdt_string)) {
- $usdt_string = '未设置';
- }
- $bank_real_name = '';
- $bank_card_number = '';
- $bank_name = '';
- break;
- default:
- echo "type error";
- }
-
-
- //用户名
- $agent_user_detail_list['agent_user_name'] = $agent_user_name;
- //注册日期
- $agent_user_detail_list['registration_data'] = $agent_user_add_date;
- //积累打款
- $agent_user_detail_list['accumulate_payment'] = $accumulate_payment;
- //最近打款金额
- $agent_user_detail_list['last_payment_amount'] = $last_pay_amount;
- //最近打款日期
- $agent_user_detail_list['last_payment_date'] = $last_pay_date;
- // //姓名
- // $agent_user_detail_list['alipay_real_name'] = $alipay_real_name;
- // //账号
- // $agent_user_detail_list['alipay_account_number'] =$alipay_real_account;
-
- $agent_user_detail_list['bank_real_name'] = $bank_real_name;
- $agent_user_detail_list['bank_card_number'] = $bank_card_number;
- $agent_user_detail_list['bank_name'] = $bank_name;
- $agent_user_detail_list['beizhu'] = $beizhu;
-
- //usdt
- $agent_user_detail_list['usdt_string'] = $usdt_string;
-
-
- array_push($agent_list_map, $agent_user_detail_list);
- }
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'yes';
- $data['data'] = $agent_list_map;
- $data['amount'] = $amount_agent_user;
- echo json_encode($data);
-
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 测试功能
- *
- * @param $templateid []
- * @return $type 消息类型
- *
- */
- public function paid_commission_record_above()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
-
-
- // 本月开始和结束的时间戳
- $firstDayOfMonth = strtotime('first day of this month midnight');
- $lastDayOfMonth = strtotime('last day of this month 23:59:59');
-
-
- // 上个月开始和结束的时间戳
- $firstDayOfLastMonth = strtotime('first day of last month midnight');
- $lastDayOfLastMonth = strtotime('last day of last month 23:59:59');
-
-
- //已打款代理
- //累计已打款佣金
- //上月已打款佣金
- //本月已打款佣金
- $amount_agent_user_list = M("agent_payment_record")->group('uid')->field("uid")->select();
- $amount_agent_user = count($amount_agent_user_list);
-
- $wula['payment_people_num'] = $amount_agent_user;
-
- $accumulate_payment_amount = M("agent_payment_record")->where("id!=0")->sum('payment_amount');
- $last_month_payment_amount = M("agent_payment_record")->where("id!=0 and payment_time BETWEEN $firstDayOfLastMonth and $lastDayOfLastMonth")->sum('payment_amount');
- $now_month_payment_amount = M("agent_payment_record")->where("id!=0 and payment_time BETWEEN $firstDayOfMonth and $lastDayOfMonth")->sum('payment_amount');
- if (empty($accumulate_payment_amount)) {
- $accumulate_payment_amount = 0;
- }
- if (empty($last_month_payment_amount)) {
- $last_month_payment_amount = 0;
- }
- if (empty($now_month_payment_amount)) {
- $now_month_payment_amount = 0;
- }
-
- $wula['accumulate_payment_amount'] = $accumulate_payment_amount;
- $wula['last_month_payment_amount'] = $last_month_payment_amount;
- $wula['now_month_payment_amount'] = $now_month_payment_amount;
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] = $wula;
- echo json_encode($data);
-
- }
-
-
- /**
- * 测试功能
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function time_echo_date()
- {
- // 本月开始和结束的时间戳
- $firstDayOfMonth = strtotime('first day of this month midnight');
- $lastDayOfMonth = strtotime('last day of this month 23:59:59');
-
- echo "本月开始时间戳:$firstDayOfMonth" . PHP_EOL;
- echo "本月结束时间戳:$lastDayOfMonth" . PHP_EOL;
-
- // 上个月开始和结束的时间戳
- $firstDayOfLastMonth = strtotime('first day of last month midnight');
- $lastDayOfLastMonth = strtotime('last day of last month 23:59:59');
-
- echo "上个月开始时间戳:$firstDayOfLastMonth" . PHP_EOL;
- echo "上个月结束时间戳:$lastDayOfLastMonth" . PHP_EOL;
- }
-
-
- /**
- * 读通道设置
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function select_td_list()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
-
- $all_td_list = M("td_save")->where("id<4")->select();
- foreach ($all_td_list as $key => $value) {
- $td_id = $value['td_id'];
- switch ($td_id) {
- case '8088':
- $td_number = 1;
- break;
- case '8008':
- $td_number = 2;
- break;
- case '8023':
- $td_number = 3;
- break;
- case '8009':
- $td_number = 4;
- break;
- case '8015':
- $td_number = 5;
- break;
- default:
- echo "type error";
- }
- $td_list[$key]['num'] = $td_number;
- }
- $data['message'] = 'yes';
- $data['data'] = $td_list;
- echo json_encode($data);
-
- }
-
- /**
- * 测试功能
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_td()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
- if (!empty($_POST)) {
- $id = $_POST['id'];
- $td_id = $_POST['td_id'];
- switch ($td_id) {
- case '1':
- $save_list['td_id'] = 8088;
- $save_list['td_str'] = '支付宝倾心';
- break;
- case '2':
- $save_list['td_id'] = 8008;
- $save_list['td_str'] = '支付宝直播';
- break;
- case '3':
- $save_list['td_id'] = 8023;
- $save_list['td_str'] = '支付宝快手';
- break;
- case '4':
- $save_list['td_id'] = 8009;
- $save_list['td_str'] = '支付宝YY';
- break;
- case '5':
- $save_list['td_id'] = 8015;
- $save_list['td_str'] = '微信游戏原生';
- break;
- default:
- echo "type error";
- die();
- }
-
- $wula_save = M("td_save")->where("id=$id")->save($save_list);
- if ($wula_save) {
- //修改成功
- $data['message'] = 'yes';
- echo json_encode($data);
- } else {
- //无修改
- $data['message'] = 'no';
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 反差列表
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function facha_list()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
-
- if (!empty($_POST)) {
- $token = $_POST['token'];
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
-
- $page = $_POST['page'];
- $size = $_POST['size'];
- $facha_list = M("heiliao_haijiao_books")->where("book_type='FC'")->page($page, $size)->order("id desc")->select();
- if ($facha_list) {
- foreach ($facha_list as $key => $value) {
- $img_list = $value['book'];
- // echo PHP_EOL.$img_list;
- $imgarr = explode(',', $img_list);
- $video_list = $value['hj_video_url'];
- // echo PHP_EOL.$img_list;
- if (!$video_list) {
- $videoarr = array();
- }else {
- $videoarr = explode(',', $video_list);
- }
- $facha_list[$key]['book'] = $imgarr;
- $facha_list[$key]['hj_video_url'] = $videoarr;
- }
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['amount'] = M("heiliao_haijiao_books")->where("book_type='FC'")->count();
- $data['data'] = $facha_list;
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'null';
- $data['data'] = "";
- echo json_encode($data);
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 删除反差
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function delete_fancha_list()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
-
- if (!empty($_POST)) {
- $token = $_POST['token'];
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $fc_id = $_POST['fc_id'];
- $yn_de_books = M("heiliao_haijiao_books")->where("id=$fc_id")->delete();
- $yn_de_list = M("video_list_test")->where("id=$fc_id")->delete();
- if ($yn_de_books and $yn_de_list) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = "$fc_id";
- echo json_encode($data);
- } else {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'error';
- $data['data'] = "$fc_id";
- echo json_encode($data);
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
- /**
- * 反差详情
- *
- * @param $templateid []
- * @return $type 消息类型
- */
- public function fancha_detail()
- {
- // 指定允许其他域名访问
- header('Access-Control-Allow-Origin:*');
- // 响应类型
- header('Access-Control-Allow-Methods:POST');
- // 响应头设置
- header('Access-Control-Allow-Headers:x-requested-with,content-type');
-
- if (!empty($_POST)) {
- $fc_id = $_POST['fc_id'];
- $facha_list = M("heiliao_haijiao_books")->where("book_id='$fc_id'")->field("site,book,hj_video_url")->select();
- if ($facha_list) {
- $book_list = $facha_list[0]['book'];
- $book_vieo_list = $facha_list[0]['hj_video_url'];
- $book_site = $facha_list[0]['site'];
- $img_arr = explode(',', $book_list);
- $video_arr = explode(',', $book_vieo_list);
- $facha_list_arr['hj_video_url'] = $video_arr;
- $facha_list_arr['book'] = $img_arr;
- $facha_list_arr['site'] = $book_site;
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = $facha_list_arr;
- echo json_encode($data);
-
- } else {
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'error';
- $data['data'] = $facha_list;
- echo json_encode($data);
-
- }
-
- } else {
- echo $this->returnData();
- }
- }
-
-
-
- /**
- * 新增反差
- *haohaohao
- * @param $templateid []
- * @return $type 消息类型
- */
- public function add_test_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)) {
- $img = $_FILES['img'];
- $img = $_FILES['mp4'];
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $title = $_POST['title'];
- $uploadPath = '/home2/videos/one/FC/img/'; // 头图片和内容图片的上传目录
- $videoPath = '/home2/videos/one/FC/videos/'; // 视频集合的上传目录
-
-
- // 判断目标路径是否存在,如果不存在则创建
- if (!file_exists($uploadPath)) {
- mkdir($uploadPath, 0777, true);
- }
-
- if (!file_exists($videoPath)) {
- mkdir($videoPath, 0777, true);
- }
-
- $config = array(
- 'maxSize' => 0, // 设置附件上传大小
- 'exts' => array('jpg', 'jpeg', 'png', 'gif'), // 设置图片上传类型
- 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
- );
-
- $upload = new \Think\Upload($config); // 实例化图片上传类
-
- // 上传头图片和内容图片
- $infoImages = $upload->upload();
-
- // 上传视频集合
- $configVideo = array(
- 'maxSize' => 0, // 设置视频上传大小(100MB)
- 'exts' => array('mp4', 'avi', 'mkv', 'mov'), // 设置视频上传类型
- 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
- );
-
- $uploadVideo = new \Think\Upload($configVideo); // 实例化视频上传类
-
- // 上传视频集合
- $infoVideo = $uploadVideo->upload();
-
-
- // 上传成功,处理上传的文件信息
- $imagePaths = ''; // 存储上传的图片文件路径
- foreach ($infoImages as $key => $value) {
- $savepath = $value['savepath'];
- $savename = $value['savename'];
- if ($key == 0) {
- $fancha_list['head_img'] = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'];
- }else{
- $imgurl_list .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'] . ',';
- $book_str .= "<img src='".'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename']."' alt=''>" ;
- }
-
-
- }
- $imgurl_list_new = substr($imgurl_list, 0, -1);
-
-
- $videoPaths = ''; // 存储上传的视频文件路径
- foreach ($infoVideo as $file) {
- $videoPaths .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $file['savepath'] . $file['savename'] . ',';
- }
- $videourl_list = substr($videoPaths, 0, -1);
-
- //video_list_test
- $video_list_detail['title'] = $title;
- $video_list_detail['site'] = 'FC';
- $video_list_detail['uploader'] = '素人反差';
- $video_list_detail['add_time'] = time();
- $video_list_detail['coins'] ="2";
- $video_list_detail['top_img'] = $fancha_list['head_img'];
- $video_list_detail['views'] = $this->randFloat(10.1,99);
- $video_list_detail['thumbs_up'] = $this->randFloat(3.1, 9);
- $ret = M("video_list_test")->add($video_list_detail);
-
-
- if ($ret) {
- // 如果主键是自动增长型 成功后返回值就是最新插入的值
- //当前用户id
- $insertId = $ret;
- }
-
-
- $fancha_list['book'] = $imgurl_list_new;
- $fancha_list['book_str'] = $book_str;
- $fancha_list['site'] = $title;
- $fancha_list['hj_video_url'] = $videourl_list;
- $fancha_list['id'] = $insertId;
- $fancha_list['book_id'] = $insertId;
- $fancha_list['book_type'] = "FC";
- M("heiliao_haijiao_books")->add($fancha_list);
-
- // 返回上传成功的文件路径
- $this->ajaxReturn(array(
- 'status' => 1,
- 'message' => '上传成功',
- 'data' => $fancha_list,
- ));
-
- } 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));
- }
-
-
- /**
- * 编辑反差
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_fancha_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)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $img_list = $_POST['img[]'];
- echo PHP_EOL.$img_list;
- print_r($img_list);
-
- $fc_id = $_POST['fc_id'];
- $title = $_POST['title'];
- $uploadPath = '/home2/videos/one/FC/img/'; // 头图片和内容图片的上传目录
- $videoPath = '/home2/videos/one/FC/videos/'; // 视频集合的上传目录
-
-
- // 判断目标路径是否存在,如果不存在则创建
- if (!file_exists($uploadPath)) {
- mkdir($uploadPath, 0777, true);
- }
-
- if (!file_exists($videoPath)) {
- mkdir($videoPath, 0777, true);
- }
-
- $config = array(
- 'maxSize' => 0, // 设置附件上传大小
- 'exts' => array('jpg', 'jpeg', 'png', 'gif'), // 设置图片上传类型
- 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
- );
-
- $upload = new \Think\Upload($config); // 实例化图片上传类
-
- // 上传头图片和内容图片
- $infoImages = $upload->upload();
-
- // 上传视频集合
- $configVideo = array(
- 'maxSize' => 0, // 设置视频上传大小(100MB)
- 'exts' => array('mp4', 'avi', 'mkv', 'mov'), // 设置视频上传类型
- 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
- );
-
- $uploadVideo = new \Think\Upload($configVideo); // 实例化视频上传类
-
- // 上传视频集合
- $infoVideo = $uploadVideo->upload();
-
-
- echo PHP_EOL.$infoImages;
- echo PHP_EOL.$infoVideo;
- print_r($infoImages);
- print_r($infoVideo);
- if (!$infoImages || !$infoVideo) {
- $this->error($upload->getError());
- $this->error($uploadVideo->getError());
- } else {
- // 上传成功,处理上传的文件信息
- $imagePaths = ''; // 存储上传的图片文件路径
- foreach ($infoImages as $key => $value) {
- $savepath = $value['savepath'];
- $savename = $value['savename'];
- if ($key == 0) {
- $fancha_list['head_img'] = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'];
- }else{
- $imgurl_list .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'] . ',';
- }
-
-
- }
- $imgurl_list_new = substr($imgurl_list, 0, -1);
-
-
- $videoPaths = ''; // 存储上传的视频文件路径
- foreach ($infoVideo as $file) {
- $videoPaths .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $file['savepath'] . $file['savename'] . ',';
- }
- $videourl_list = substr($videoPaths, 0, -1);
-
- //video_list_test
- $video_list_detail['title'] = $title;
- $video_list_detail['coins'] = "2";
- $video_list_detail['top_img'] = $fancha_list['head_img'];
- $video_list_detail['views'] = $this->randFloat(10.1,99);
- $video_list_detail['thumbs_up'] = $this->randFloat(3.1, 9);
- M("video_list_test")->where("id=$fc_id")->save($video_list_detail);
-
-
- $fancha_list['book'] = $imgurl_list_new;
- $fancha_list['site'] = $title;
- $fancha_list['hj_video_url'] = $videourl_list;
- M("heiliao_haijiao_books")->where("id=$fc_id")->save($fancha_list);
-
- // 返回上传成功的文件路径
- $this->ajaxReturn(array(
- 'status' => 1,
- 'message' => '上传成功',
- 'data' => $fancha_list,
- ));
- }
- } else {
- echo $this->returnData();
- }
- }
-
-
-
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function test_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:*');
- $img = $_FILES['images'];
- // 获取请求中的所有`form-data`数据
- $formData = I('post.');
-
- // 将数据转换为JSON格式
- $jsonData = json_encode($formData);
-
- // 设置响应头,指定返回的是JSON数据
- header('Content-Type: application/json');
-
- // 输出JSON数据
- echo $jsonData;
- $config = array(
- 'maxSize' => 0, // 设置附件上传大小
- 'exts' => array('jpg', 'jpeg', 'png', 'gif'), // 设置图片上传类型
- 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
- );
-
- $upload = new \Think\Upload($config); // 实例化图片上传类
-
- // 上传头图片和内容图片
- $infoImages = $upload->upload();
- if (!$infoImages) {
- // 上传失败
- $this->ajaxReturn(array('status' => 0, 'message' => '上传失败', 'error' => $upload->getError()));
- } else {
- echo PHP_EOL.'成功';
- }
- }
-
-
-
-
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function ceshi_shuzu(){
- 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_info_list = M('user_info');
- $user_novip = $user_info_list->where("vip_yn=0 ")->field('id')->select();
- var_dump($user_novip);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 充值数据
- * @param $templateid []
- * @return $type 消息类型
- */
- public function pay_shuju(){
-
- if (!empty($_POST)){
- 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:*');
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
-
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
-
-
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
-
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
-
- $pay_list_table = M('huidiao_test');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->count("DISTINCT uid");
-
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time ")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time ")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0")->count("DISTINCT uid");
-
-
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time")->sum('amount');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->sum('amount');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->sum('amount');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time")->sum('amount');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time")->sum('amount');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null")->sum('amount');
-
-
- $arr_list = array($arr,$arrs);
-
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
- echo json_encode($data);
-
-
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 会员数据
- * @param $templateid []
- * @return $type 消息类型
- */
- public function huiyuan_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
-
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
-
-
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
-
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
-
- $pay_list_table = M('vip_add_list');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->count("DISTINCT uid");
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time ")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time ")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0")->count("DISTINCT uid");
-
-
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time")->sum('amount');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->sum('amount');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->sum('amount');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time")->sum('amount');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time")->sum('amount');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null")->sum('amount');
-
- if (empty($arr['jinri_pay_num'] )) {
- $arrs['jinri_amount'] = "0";
- }
- if (empty($arrs['jinri_amount'] )) {
- $arrs['jinri_amount'] = "0";
- }
- $arr_list = array($arr,$arrs);
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
- echo json_encode($data);
-
-
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 海角数据
- * @param $templateid []
- * @return $type 消息类型
- */
- public function haijiao_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
-
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
-
-
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
-
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- echo json_encode($data);
-
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
- /**
- * 反差数据
- * @param $templateid []
- * @return $type 消息类型
- */
- public function fancha_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
-
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
-
-
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
-
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
-
- $pay_list_table = M('hj_fc_buy_record');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->count("DISTINCT uid");
-
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time ")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time ")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0")->count("DISTINCT uid");
-
-
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time")->sum('coins');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->sum('coins');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->sum('coins');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time")->sum('coins');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time")->sum('coins');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null")->sum('coins');
-
- if (empty($arrs['jinri_amount'])) {
- $arrs['jinri_amount'] = "0";
- }
- $arr_list = array($arr,$arrs);
-
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
-
- echo json_encode($data);
-
- }else{
- echo $this->returnData();
- }
- }
-
-
-
-
-
- /**
- * 测试功能
- * @param $templateid []
- * @return $type 消息类型
- */
- public function fankui_list_show(){
- 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)) {
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- $fankui_list = M("user_fankui")->where("id >0")->field("id,user_content,user_date,type")->page($page, $size)->order("id desc")->select();
- $all_fankui_count = M("user_fankui")->where("id >0")->count();
- if ($fankui_list) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] =$fankui_list;
- $data['all_count'] =$all_fankui_count;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'null';
- $data['data'] =array();
- $data['all_count'] =$all_fankui_count;
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
-
- /**
- * 回复
- * @param $templateid []
- * @return $type 消息类型
- */
- public function huifu_user_fankui(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $id = $_POST['id'];
- $admin_content = $_POST['admin_content'];
- $time_chuo = time();
- $time_data= date("Y-m-d H:i",$time_chuo);
- $fankui_info['admin_content'] = $admin_content;
- $fankui_info['admin_date'] = $time_data;
- $fankui_info['admin_time'] = $time_chuo;
- $fankui_info['type']=2;
- $admin_huifu =M("user_fankui")->where("id=$id")->save($fankui_info);
- if ($admin_huifu) {
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * SMshuju
- * @param $templateid []
- * @return $type 消息类型
- */
- public function sm_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $pay_list_table = M('hj_fc_buy_record');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='sm'")->count("DISTINCT uid");
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='sm'")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='sm'")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='sm'")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='sm'")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='sm'")->count("DISTINCT uid");
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='sm'")->sum('coins');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='sm'")->sum('coins');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='sm'")->sum('coins');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='sm'")->sum('coins');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='sm'")->sum('coins');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='sm'")->sum('coins');
- if (empty($arrs['jinri_amount'])) {
- $arrs['jinri_amount'] = "0";
- }
- if (empty($arrs['zuori_amount'])) {
- $arrs['zuori_amount']= "0";
- }
- if (empty( $arrs['sanri_amount'] )) {
- $arrs['sanri_amount'] = "0";
- }
- if (empty($arrs['zhou_amount'])) {
- $arrs['zhou_amount']= "0";
- }
- if (empty($arrs['yue_amount'])) {
- $arrs['yue_amount'] = "0";
- }
- if (empty($arrs['jilei_amount'] )) {
- $arrs['jilei_amount'] = "0";
- }
- $arr_list = array($arr,$arrs);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * wanoushuju
- * @param $templateid []
- * @return $type 消息类型
- */
- public function wanou_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $pay_list_table = M('hj_fc_buy_record');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='wanou' ")->count("DISTINCT uid");
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='wanou'")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='wanou'")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='wanou' ")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='wanou'")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='wanou'")->count("DISTINCT uid");
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='wanou'")->sum('coins');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='wanou'")->sum('coins');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='wanou'")->sum('coins');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='wanou'")->sum('coins');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='wanou'")->sum('coins');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='wanou'")->sum('coins');
- if (empty($arrs['jinri_amount'])) {
- $arrs['jinri_amount'] = "0";
- }
- if (empty($arrs['zuori_amount'])) {
- $arrs['zuori_amount']= "0";
- }
- if (empty( $arrs['sanri_amount'] )) {
- $arrs['sanri_amount'] = "0";
- }
- if (empty($arrs['zhou_amount'])) {
- $arrs['zhou_amount']= "0";
- }
- if (empty($arrs['yue_amount'])) {
- $arrs['yue_amount'] = "0";
- }
- if (empty($arrs['jilei_amount'] )) {
- $arrs['jilei_amount'] = "0";
- }
- $arr_list = array($arr,$arrs);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * avjieshuoshuju
- * @param $templateid []
- * @return $type 消息类型
- */
- public function avjieshuo_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $pay_list_table = M('hj_fc_buy_record');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='av'")->count("DISTINCT uid");
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='av'")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='av'")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='av'")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='av'")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='av'")->count("DISTINCT uid");
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='av'")->sum('coins');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='av'")->sum('coins');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='av'")->sum('coins');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='av'")->sum('coins');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='av'")->sum('coins');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='av'")->sum('coins');
- if (empty($arrs['jinri_amount'])) {
- $arrs['jinri_amount'] = "0";
- }
- if (empty($arrs['zuori_amount'])) {
- $arrs['zuori_amount']= "0";
- }
- if (empty( $arrs['sanri_amount'] )) {
- $arrs['sanri_amount'] = "0";
- }
- if (empty($arrs['zhou_amount'])) {
- $arrs['zhou_amount']= "0";
- }
- if (empty($arrs['yue_amount'])) {
- $arrs['yue_amount'] = "0";
- }
- if (empty($arrs['jilei_amount'] )) {
- $arrs['jilei_amount'] = "0";
- }
- $arr_list = array($arr,$arrs);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * tianmeiluolishuju
- * @param $templateid []
- * @return $type 消息类型
- */
- public function tianmeiluoli_shuju(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $pay_list_table = M('hj_fc_buy_record');
- $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='luoli' ")->count("DISTINCT uid");
- $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='luoli'")->count("DISTINCT uid");
- $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='luoli'")->count("DISTINCT uid");
- $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='luoli'")->count("DISTINCT uid");
- $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='luoli'")->count("DISTINCT uid");
- $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='luoli'")->count("DISTINCT uid");
- $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='luoli'")->sum('coins');
- $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='luoli'")->sum('coins');
- $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='luoli'")->sum('coins');
- $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='luoli'")->sum('coins');
- $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='luoli'")->sum('coins');
- $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='luoli'")->sum('coins');
- if (empty($arrs['jinri_amount'])) {
- $arrs['jinri_amount'] = "0";
- }
- if (empty($arrs['zuori_amount'])) {
- $arrs['zuori_amount']= "0";
- }
- if (empty( $arrs['sanri_amount'] )) {
- $arrs['sanri_amount'] = "0";
- }
- if (empty($arrs['zhou_amount'])) {
- $arrs['zhou_amount']= "0";
- }
- if (empty($arrs['yue_amount'])) {
- $arrs['yue_amount'] = "0";
- }
- if (empty($arrs['jilei_amount'] )) {
- $arrs['jilei_amount'] = "0";
- }
- $arr_list = array($arr,$arrs);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['data'] =$arr_list;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 版本:1.7
- * 新增/更新:add
- * 简述:look the name
- * @param $templateid []
- * @return $type 消息类型
- */
- public function show_gonggao_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)){
- $token = $_POST['token'];
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $all_gonggao = M("gonggao")->where("id>0")->select();
- if ($all_gonggao){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = $all_gonggao;
- echo json_encode($data);
- }else{
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.7
- * 新增/更新:新增
- * 简述:更新公告内容
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_gonggao_content(){
- 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)){
- $id = $_POST['id'];
- $content = $_POST['content'];
- $yn_save = M("gonggao")->where("id=$id")->save($_POST);
- if ($yn_save){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'no_save';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.7
- * 新增/更新:新增
- * 简述:启用公告将其他公告关闭
- * @param $templateid []
- * @return $type 消息类型
- */
- public function open_gonggao(){
- 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)){
- $id= $_POST['id'];
- $zero['type']= 0;
- $one['type']= 1;
- $one_yn = M("gonggao")->where("id=$id")->save($one);
- $zero_yn =M("gonggao")->where("id!=$id")->save($zero);
- if ($one_yn and $zero_yn){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'save_ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'no_save';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.7
- * 新增/更新:新增
- * 简述:add gonggao
- * @param $templateid []
- * @return $type 消息类型
- */
- public function add_gonggao(){
- 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)){
- $content = $_POST['content'];
- $add_yn = M("gonggao")->add($_POST);
- if ($add_yn){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.7
- * 新增/更新:新增
- * 简述:delete gonggao
- * @param $templateid []
- * @return $type 消息类型
- */
- public function delete_gonggao(){
- 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)){
- $id = $_POST['id'];
- $yn_de = M("gonggao")->where("id=$id")->delete();
- if ($yn_de){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function video_count_tongjiss(){
- 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)){
- $token = $_POST['token'];
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- // $type_list_all =array(
- // array('欧美','亚洲','动漫','素人反差'),
- // array('黑料','网爆门','海角乱伦','麻豆传媒'),
- // array('探花大神','SM调教','AI换脸','另类猎奇'),
- // array('雪白美乳','玩偶姐姐','AV解说','甜美萝莉'),
- // );
- $seven_time_chuo = time() - (7 * 24 * 3600);
- switch ($page) {
- case '1':
- $oumei_count = M("video_list_test")->where("id>0 and site='EUA'")->count();
- $asian_count = M("video_list_test")->where("id>0 and site='Asian'")->count();
- $dongman_count = M("video_list_test")->where("id>0 and site='Anime' or site='动画'")->count();
- $fancha_count = M("video_list_test")->where("id>0 and site='FC'")->count();
- $oumei_count_zhou = M("video_list_test")->where("id>0 and site='EUA' and add_time>'$seven_time_chuo'")->count();
- $asian_countzhou = M("video_list_test")->where("id>0 and site='Asian' and add_time>'$seven_time_chuo'")->count();
- $dongman_countzhou = M("video_list_test")->where("id>0 and site in('Anime','动画') and add_time>'$seven_time_chuo'")->count();
- $fancha_countzhou = M("video_list_test")->where("id>0 and site='FC' and add_time>'$seven_time_chuo'")->count();
- $oumei_list= array('name'=>'欧美','zhou'=>"$oumei_count_zhou",'all'=>"$oumei_count");
- $asian_list= array('name'=>'亚洲','zhou'=>"$asian_countzhou",'all'=>"$asian_count");
- $donman_list= array('name'=>'动漫','zhou'=>"$dongman_countzhou",'all'=>"$dongman_count");
- $fancha_list= array('name'=>'反差','zhou'=>"$fancha_countzhou",'all'=>"$fancha_count");
- $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
- break;
- case '2':
- $heiliao = M("video_list_test")->where("id>0 and site='HL'")->count();
- $wangbao = M("video_list_test")->where("id>0 and site='WB'")->count();
- $haijiaoluanlun = M("video_list_test")->where("id>0 and site='HJ'")->count();
- $madou = M("video_list_test")->where("id>0 and site='麻豆传媒'")->count();
- $heiliaozhou = M("video_list_test")->where("id>0 and site='HL' and add_time>'$seven_time_chuo'")->count();
- $wangbaozhou = M("video_list_test")->where("id>0 and site='WB' and add_time>'$seven_time_chuo'")->count();
- $haijiaoluanlunzhou = M("video_list_test")->where("id>0 and site='HJ' and add_time>'$seven_time_chuo'")->count();
- $madouzhou = M("video_list_test")->where("id>0 and site='麻豆传媒' and add_time>'$seven_time_chuo'")->count();
- $oumei_list= array('name'=>'黑料','zhou'=>"$heiliaozhou",'all'=>"$heiliao");
- $asian_list= array('name'=>'网爆门','zhou'=>"$wangbaozhou",'all'=>"$wangbao");
- $donman_list= array('name'=>'海角乱伦','zhou'=>"$haijiaoluanlunzhou",'all'=>"$haijiaoluanlun");
- $fancha_list= array('name'=>'麻豆传媒','zhou'=>"$madouzhou",'all'=>"$madouzhou");
- $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
- break;
- case '3':
- $tanhua = M("video_list_test")->where("id>0 and site='国产探花'")->count();
- $smtiaojiao = M("video_list_test")->where("id>0 and site='SM调教'")->count();
- $aihuanlian = M("video_list_test")->where("id>0 and site='AI'")->count();
- $linglei = M("video_list_test")->where("id>0 and site='孕妇做爱' or site='性感人妖' or site='人兽动物' or site='超级大胆' or site='另类猎奇' or site='同性做爱'")->count();
- $tanhuazhou = M("video_list_test")->where("id>0 and site='国产探花' and add_time>'$seven_time_chuo'")->count();
- $smtiaojiaozhou = M("video_list_test")->where("id>0 and site='SM调教' and add_time>'$seven_time_chuo'")->count();
- $aihuanlianzhou = M("video_list_test")->where("id>0 and site='AI' and add_time>'$seven_time_chuo'")->count();
- $lingleizhou = M("video_list_test")->where("id>0 and site='孕妇做爱' or site='性感人妖' or site='人兽动物' or site='超级大胆' or site='另类猎奇' or site='同性做爱'")->count();
- $oumei_list= array('name'=>'探花大神','zhou'=>"$tanhuazhou",'all'=>"$tanhua");
- $asian_list= array('name'=>'sm调教','zhou'=>"$smtiaojiaozhou",'all'=>"$smtiaojiao");
- $donman_list= array('name'=>'AI乱伦','zhou'=>"$aihuanlianzhou",'all'=>"$aihuanlian");
- $fancha_list= array('name'=>'另类奇葩','zhou'=>"$lingleizhou",'all'=>"$linglei");
- $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
- break;
- case '4':
- $xuebaimeiru = M("video_list_test")->where("id>0 and site='雪白美乳'")->count();
- $wanou = M("video_list_test")->where("id>0 and site='玩偶姐姐'")->count();
- $avjeishuo = M("video_list_test")->where("id>0 and site='AV解说'")->count();
- $tianmei = M("video_list_test")->where("id>0 and uploader='另类猎奇'")->count();
- $xuebaimeiruzhou = M("video_list_test")->where("id>0 and site='雪白美乳'")->count();
- $wanouzhou = M("video_list_test")->where("id>0 and site='玩偶姐姐'")->count();
- $avjeishuozhou = M("video_list_test")->where("id>0 and site='AV解说'")->count();
- $tianmeizhou = M("video_list_test")->where("id>0 and uploader='粉嫩少女'")->count();
- $oumei_list= array('name'=>'雪白美乳','zhou'=>"$xuebaimeiruzhou",'all'=>"$xuebaimeiru");
- $asian_list= array('name'=>'玩偶姐姐','zhou'=>"$wanouzhou",'all'=>"$wanou");
- $donman_list= array('name'=>'av解说','zhou'=>"$avjeishuozhou",'all'=>"$avjeishuo");
- $fancha_list= array('name'=>'甜美萝莉','zhou'=>"$tianmeizhou",'all'=>"$tianmei");
- $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
- break;
- default:
- echo "type error";
- }
- if ($data_list){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = $data_list;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- $data['data'] = "$data_list";
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function show_video_all_count(){
- 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)){
- $token = $_POST['token'];
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- // $page = $_POST['page'];
- // $size = $_POST['size'];
- // $arr = M("slgj_user_feedback")->page($page, $size)->order("id desc")->select();
- $type_list_all =array(
- array('欧美','亚洲','动漫','素人反差'),
- array('黑料','网爆门','海角乱伦','麻豆传媒'),
- array('探花大神','SM调教','AI换脸','另类猎奇'),
- array('雪白美乳','玩偶姐姐','AV解说','甜美萝莉'),
- );
- $any_site_count = M("video_list_test")->where("id>0")->field("site,count(site) as wuwu")->group('site')->order('wuwu desc')->select();
- $oumei_number = 0;
- $asian_number = 0;
- $anime_number = 0;
- $wb_number = 0;
- $hl_number = 0;
- $fc_number = 0;
- $hj_number = 0;
- $madou_number = 0;
- $tanhua_number=0;
- $ai_number=0;
- $linglei_number=0;
- $meiru_number=0;
- $sm_number=0;
- $wanou_number=0;
- $avjieshuo_number=0;
- $luoli_number=0;
- foreach ($any_site_count as $key => $value) {
- $vtype = $value['site'];
- $vconunt = $value['wuwu'];
- switch ($vtype) {
- case 'Anime':
- $anime_number += $vconunt;
- break;
- case '动画':
- $anime_number += $vconunt;
- break;
- case 'Asian':
- $asian_number += $vconunt;
- break;
- case 'EUA':
- $oumei_number += $vconunt;
- break;
- case 'WB':
- $wb_number += $vconunt;
- break;
- case 'HL':
- $hl_number += $vconunt;
- break;
- case 'FC':
- $fc_number += $vconunt;
- break;
- case 'HJ':
- //海角乱伦
- $hj_number+= $vconunt;
- break;
- case '麻豆传媒':
- //麻豆传媒
- $madou_number+= $vconunt;
- break;
- case '国产探花':
- //探花大神
- $tanhua_number+= $vconunt;
- break;
- case 'AI':
- //明星换脸
- $ai_number+= $vconunt;
- break;
- case '孕妇做爱':
- //另类猎奇 孕妇
- $linglei_number+= $vconunt;
- break;
- case '另类猎奇':
- //另类猎奇 猎奇
- $linglei_number+= $vconunt;
- break;
- case '人兽动物':
- //另类猎奇 人兽
- $linglei_number+= $vconunt;
- break;
- case '性感人妖':
- //另类猎奇 人妖
- $linglei_number+= $vconunt;
- break;
- case '同性做爱':
- //另类猎奇 同性
- $linglei_number+= $vconunt;
- break;
- case '超级大胆':
- //另类猎奇 超级大胆
- $linglei_number+= $vconunt;
- break;
- case '雪白美乳':
- $meiru_number+= $vconunt;
- //雪白美乳
- break;
- case 'SM调教':
- $sm_number+= $vconunt;
- //SM调教
- break;
- case '玩偶姐姐':
- $wanou_number+= $vconunt;
- //玩偶姐姐
- break;
- case 'AV解说':
- $avjieshuo_number+= $vconunt;
- //av解说
- break;
- case '制服学妹':
- $luoli_number+= $vconunt;
- //超级大胆
- break;
- case '马尾学妹':
- $luoli_number+= $vconunt;
- //超级大胆
- break;
- case '后入嫩穴':
- $luoli_number+= $vconunt;
- //超级大胆
- break;
- case '超级巨臀':
- $luoli_number+= $vconunt;
- //超级大胆
- break;
- case '美臀翘臀':
- $luoli_number+= $vconunt;
- //超级大胆
- break;
- default:
- // echo $vtype;
- }
- }
- $all_type_number['oumei_count'] ="$oumei_number";
- $all_type_number['asian_count'] ="$asian_number";
- $all_type_number['anime_count'] ="$anime_number";
- $all_type_number['wb_count'] = "$wb_number";
- $all_type_number['fc_count']= "$fc_number";
- $all_type_number['hl_count']="$hl_number";
- $all_type_number['HJ_number']="$hj_number";
- $all_type_number['madou_number']="$madou_number";
- $all_type_number['tanhua_number']="$tanhua_number";
- $all_type_number['ai_number']="$ai_number";
- $all_type_number['linglei_number']="$linglei_number";
- $all_type_number['meiru_number']="$meiru_number";
- $all_type_number['sm_number']="$sm_number";
- $all_type_number['wanou_number']="$wanou_number";
- $all_type_number['avjieshuo_number']="$avjieshuo_number";
- $all_type_number['luoli_number']="$luoli_number";
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] = $all_type_number;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:
- * 新增/更新:
- * 简述:add_test_video
- * @param $templateid []
- * @return $type 消息类型
- */
- public function save_beizhu(){
- 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'];
- $beizhu = $_POST['beizhu'];
- $save_yn = M("user_info")->where("id=$uid")->save($_POST);
- if ($save_yn){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.7
- * 新增/更新:新增
- * 简述:统计
- * @param $templateid []
- * @return $type 消息类型
- */
- public function video_add_tongJi(){
- 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)){
- $token = $_POST['token'];
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $page = $_POST['page'];
- $size = $_POST['size'];
- // $type_list_all =array(
- // array('欧美','亚洲','动漫','素人反差'),
- // array('黑料','网爆门','海角乱伦','麻豆传媒'),
- // array('探花大神','SM调教','AI换脸','另类猎奇'),
- // array('雪白美乳','玩偶姐姐','AV解说','甜美萝莉'),
- // );shoucang_type_list
- $seven_time_chuo = time() - (7 * 24 * 3600);
- $video_seven_add = M("video_list_test")->where("id>0 and uploader in ('黑料吃瓜','海角乱伦','网曝门','明星换脸','麻豆传媒','探花大神','AV解说','玩偶姐姐','SM调教','亚洲','欧美','动漫','甜美萝莉','另类猎奇','雪白美乳','素人反差')")->field("uploader,count('uploader') as count_video")->group('uploader')->order('count_video DESC')->select();
- foreach ($video_seven_add as $key => $value) {
- $video_uplodaer=$value['uploader'];
- # code...
- $video_seven_add[$key]['seven']= M("video_list_test")->where("add_time>'$seven_time_chuo' and uploader='$video_uplodaer'")->count();;
- }
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] = $video_seven_add;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 新增活跃
- * @param $templateid []
- * @return $type 消息类型
- */
- public function all_huoyue_renshu(){
- 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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $user_info_list = M('user_info');
- $user_novip = $user_info_list->where("vip_yn=0 ")->field('id')->select();
- $arr['jinri_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $jinri_start_time and $jinri_end_time ")->count();
- $arr['zuori_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $zuo_start_time and $zuo_end_time ")->count();
- $arr['sanri_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $san_start_time and $san_end_time")->count();
- // echo PHP_EOL.$user_info_list->_sql();
- $arr['zhou_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $zhou_start_time and $zhou_end_time ")->count();
- $arr['yue_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $yue_start_time and $yue_end_time")->count();
- $arr['jilei_xinzeng_num'] = $user_info_list->where("id>0 ")->count();
- $huoyue = M("huoyue_list");
- $huoyue_jin = M("huoyue_list")->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->field("uid")->group("uid")->select();
- $huoyue_zuo = M("huoyue_list")->where(" time BETWEEN $zuo_start_time and $zuo_end_time ")->field("uid")->group("uid")->select();
- $huoyue_san = M("huoyue_list")->where("time BETWEEN $san_start_time and $san_end_time ")->field("uid")->group("uid")->select();;
- // echo PHP_EOL.M("huoyue_list")->_sql();
- $huoyue_zhou = M("huoyue_list")->where(" time BETWEEN $zhou_start_time and $zhou_end_time ")->field("uid")->group("uid")->select();
- $huoyue_yue = M("huoyue_list")->where(" time BETWEEN $yue_start_time and $yue_end_time")->field("uid")->group("uid")->select();
- $huoyue_jilei = $user_info_list->where("last_login_time is not null ")->field("id")->select();
- $arrs['jinri_huoyue_num'] =count($huoyue_jin);
- $arrs['zuori_huoyue_num'] =count($huoyue_zuo);
- $arrs['sanri_huoyue_num'] = count($huoyue_san);
- $arrs['zhou_huoyue_num'] =count($huoyue_zhou);
- $arrs['yue_huoyue_num'] =count($huoyue_yue);
- $arrs['jilei_huoyue_num'] =count($huoyue_jilei);
- $arr_list = array($arr,$arrs);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] =$arr_list;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function free_huoyue_renshu(){
- 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)){
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $vip_user= M("user_info")->where("vip_money is null")->field("id")->select();
- $last_id = array_column($vip_user, 'id');
- $str = json_encode($last_id);
- $str = substr($str, 1, -1);
- $huoyue = M("huoyue_list");
- $huoyue_jin = M("huoyue_list")->where("uid in($str) and time BETWEEN $jinri_start_time and $jinri_end_time ")->field("uid")->group("uid")->select();
- $huoyue_zuo = M("huoyue_list")->where("uid in($str) and time BETWEEN $zuo_start_time and $zuo_end_time ")->field("uid")->group("uid")->select();
- $huoyue_san = M("huoyue_list")->where("uid in($str) and time BETWEEN $san_start_time and $san_end_time ")->field("uid")->group("uid")->select();;
- // echo PHP_EOL.M("huoyue_list")->_sql();
- $huoyue_zhou = M("huoyue_list")->where(" uid in($str) and time BETWEEN $zhou_start_time and $zhou_end_time ")->field("uid")->group("uid")->select();
- $huoyue_yue = M("huoyue_list")->where(" uid in($str) and time BETWEEN $yue_start_time and $yue_end_time")->field("uid")->group("uid")->select();
- $huoyue_jilei = M("user_info")->where("last_login_time is not null and vip_money is null ")->field("id")->select();
- $arrs['jinri_huoyue_num'] =count($huoyue_jin);
- $arrs['zuori_huoyue_num'] =count($huoyue_zuo);
- $arrs['sanri_huoyue_num'] = count($huoyue_san);
- $arrs['zhou_huoyue_num'] =count($huoyue_zhou);
- $arrs['yue_huoyue_num'] =count($huoyue_yue);
- $arrs['jilei_huoyue_num'] =count($huoyue_jilei);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] =$arrs;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:
- * 新增/更新:
- * 简述:fu4fei4huo2yue4
- * @param $templateid []
- * @return $type 消息类型
- */
- public function vip_huoyue_renshu(){
- 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)){
- $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;
- $todayTimestamp = time(); // 获取当前时间戳
- $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
- $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
- $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
- $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
- $zhou_end_time = time();
- $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
- $yue_end_time = time();
- $vip_user= M("user_info")->where("vip_money=1")->field("id")->select();
- $last_id = array_column($vip_user, 'id');
- $str = json_encode($last_id);
- $str = substr($str, 1, -1);
- $huoyue = M("huoyue_list");
- $huoyue_jin = M("huoyue_list")->where("uid in($str) and time BETWEEN $jinri_start_time and $jinri_end_time ")->field("uid")->group("uid")->select();
- $huoyue_zuo = M("huoyue_list")->where(" uid in($str) and time BETWEEN $zuo_start_time and $zuo_end_time ")->field("uid")->group("uid")->select();
- $huoyue_san = M("huoyue_list")->where("uid in($str) and time BETWEEN $san_start_time and $san_end_time ")->field("uid")->group("uid")->select();;
- // echo PHP_EOL.M("huoyue_list")->_sql();
- $huoyue_zhou = M("huoyue_list")->where("uid in($str) and time BETWEEN $zhou_start_time and $zhou_end_time ")->field("uid")->group("uid")->select();
- $huoyue_yue = M("huoyue_list")->where(" uid in($str) and time BETWEEN $yue_start_time and $yue_end_time")->field("uid")->group("uid")->select();
- $huoyue_jilei = M("user_info")->where("last_login_time is not null and vip_money=1")->field("id")->select();
- $arrs['jinri_huoyue_num'] =count($huoyue_jin);
- $arrs['zuori_huoyue_num'] =count($huoyue_zuo);
- $arrs['sanri_huoyue_num'] = count($huoyue_san);
- $arrs['zhou_huoyue_num'] =count($huoyue_zhou);
- $arrs['yue_huoyue_num'] =count($huoyue_yue);
- $arrs['jilei_huoyue_num'] =count($huoyue_jilei);
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = '';
- $data['data'] =$arrs;
- echo json_encode($data);
- }else{
- echo $this->returnData();
- }
- }
-
-
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function home_url_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)){
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- $img_list = M("shouye_url")->where("type='yj'")->order('id asc')->select();
- if ($img_list){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['data'] =$img_list;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'null';
- $data['data'] = $img_list;
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.8
- * 新增/更新:add
- * 简述:上传街拍
- * @param $templateid []
- * @return $type 消息类型
- */
- public function upload_video_new()
- {
- ini_set('upload_max_filesize', '4048M');
- ini_set('post_max_size', '4048M');
- 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 = $_FILES['mp4'];
- $uploader = $_POST['uploader'];
- $title = $_POST['title'];
- switch ($uploader) {
- case '1':
- $uploader_name = '顶臀街射';
- $videoPath = '/home2/videos/one/DTJS/MP4/'; // 视频集合的上传目录
- $url_path = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/DTJS/MP4/';
- if (!file_exists($videoPath)) {
- mkdir($videoPath, 0777, true);
- }
- break;
- case '2':
- $uploader_name = '抄底偷拍';
- $videoPath = '/home2/videos/one/CDTP/MP4/'; // 视频集合的上传目录
- $url_path = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/CDTP/MP4/';
- if (!file_exists($videoPath)) {
- mkdir($videoPath, 0777, true);
- }
- break;
- case '3':
- $uploader_name = '厕所偷拍';
- $videoPath = '/home2/videos/one/CSTP/MP4/'; // 视频集合的上传目录
- $url_path = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/CSTP/MP4/';
- if (!file_exists($videoPath)) {
- mkdir($videoPath, 0777, true);
- }
- break;
- default:
- echo "type error";
- }
- $token = $_POST['token']; //b8e3bb6ef8747d7
- if ($token != 'b8e3bb6ef8747d7') {
- $data['code'] = '203';
- $data['msg'] = 'token错误';
- echo json_encode($data);
- die;
- }
- // 上传视频集合
- $configVideo = array(
- 'maxSize' => 0, // 设置视频上传大小(100MB)
- 'exts' => array('mp4', 'avi', 'mkv', 'mov','MOV','MP4'), // 设置视频上传类型
- 'rootPath' => "$videoPath", // 设置附件上传根目录
- );
- $uploadVideo = new \Think\Upload($configVideo); // 实例化视频上传类
- // 上传视频集合
- $infoVideo = $uploadVideo->upload();
- $title_list = explode(',',$title);
- $videoPaths = ''; // 存储上传的视频文件路径
- foreach ($infoVideo as $key => $value) {
- $savepath = $value['savepath'];
- $savename = $value['savename'];
- $videoPaths = $videoPath .$savepath . $savename ;
- $url_videoPaths = $url_path .$savepath . $savename ;
- $fancha_list[$key]['uploader'] = $uploader_name;
- $fancha_list[$key]['title'] = $title_list[$key];
- $fancha_list[$key]['mp4_path'] = $videoPaths;
- $fancha_list[$key]['url_path'] = $url_videoPaths;
- $fancha_list[$key]['type'] = '0';
- M("upload_videos_list")->add($fancha_list[$key]);
- }
- // 返回上传成功的文件路径
- $this->ajaxReturn(array(
- 'status' => 1,
- 'message' => '上传成功',
- 'data' => $fancha_list,
- ));
- } else {
- echo $this->returnData();
- }
- }
- //你好111,你好2222,你好333,你好444,你好555
- //413 Request Entity Too Large
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function take_photo_on_street_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)){
- $page = $_POST['page'];
- $type=$_POST['type'];
- $page_one = ($page - 1) * 50;
- switch ($type) {
- case '1':
- $paid_agent_list = M("upload_videos_list")->where("uploader='顶臀街射' and type!='4'")->order('id desc')->LIMIT($page_one, 50)->select();
- $all_num = M("upload_videos_list")->where("uploader='顶臀街射'")->count();
- break;
- case '2':
- $paid_agent_list = M("upload_videos_list")->where("uploader='抄底偷拍' and type!='4'")->order('id desc')->LIMIT($page_one, 50)->select();
- $all_num =M("upload_videos_list")->where("uploader='抄底偷拍'")->count();
- break;
- case '3':
- $paid_agent_list = M("upload_videos_list")->where("uploader='厕所偷拍' and type!='4'")->order('id desc')->LIMIT($page_one, 50)->select();
- $all_num =M("upload_videos_list")->where("uploader='厕所偷拍'")->count();
- break;
- default:
- echo "type error";
- }
- if ($paid_agent_list){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- $data['all_num'] = $all_num;
- $data['data'] = $paid_agent_list;
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'null';
- $data['all_num'] = 0;
- $data['data'] = $paid_agent_list;
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:
- * 新增/更新:
- * 简述:
- * @param $templateid []
- * @return $type 消息类型
- */
- public function delete_take_photo(){
- 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)){
- $id = $_POST['id'];
- $mp4_path = M("upload_videos_list")->where("id=$id")->getField("mp4_path");
- $type_four['type'] = 4;
- $yn_delete = M("upload_videos_list")->where("id=$id")->save($type_four);
- $file = "$mp4_path";
- if (unlink($file) and $yn_delete)
- {
- $data['message'] = 'ok';
- echo json_encode($data);
- }
- else
- {
- $data['message'] = 'error';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- /**
- * 版本:1.75
- * 新增/更新:add
- * 简述:save_home_url
- * @param $templateid []
- * @return $type 消息类型
- */
- public function update_home_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:*');
- if (!empty($_POST)){
- $usr_c = $_POST['url'];
- $id = $_POST['id'];
- $save = M("shouye_url")->where("id=$id")->save($_POST);
- if($save){
- $data['code'] = '200';
- $data['status'] = '1';
- $data['message'] = 'ok';
- echo json_encode($data);
- }else{
- $data['code'] = '200';
- $data['status'] = '2';
- $data['message'] = 'error';
- echo json_encode($data);
- }
- }else{
- echo $this->returnData();
- }
- }
- }
|