AdminbackController.class.php 147 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939
  1. <?php
  2. namespace Admin\Controller;
  3. use Think\Controller;
  4. class AdminbackController extends Controller
  5. {
  6. /**
  7. * 后台收入统计 水友
  8. *
  9. * @param $templateid []
  10. * @return $type 消息类型
  11. */
  12. public function shouye_gailan()
  13. {
  14. ini_set('memory_limit', '556M');
  15. header('Content-Type:text/json;charset=utf-8');
  16. header('Access-Control-Allow-Origin:*');
  17. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  18. header('Access-Control-Allow-Methods:POST');
  19. header('Access-Control-Expose-Headers:*');
  20. $fk_liaotian_biao = M("user_info");
  21. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  22. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  23. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  24. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  25. $san_start_time = strtotime(date("Y-m-d", strtotime("-3 day")) . "00:00:00");
  26. $san_end_time = time();
  27. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  28. $zhou_end_time = time();
  29. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  30. $yue_end_time = time();
  31. $jl_start_time = '0';
  32. $jl_end_time = '9999999999999999999999';
  33. //注册
  34. $zc_jilei = 0;
  35. $zc_jinri = 0;
  36. $zc_zuori = 0;
  37. $zc_sanri = 0;
  38. $zc_yizhou = 0;
  39. $zc_yiyue = 0;
  40. //付费人数
  41. $ffp_jilei = 0;
  42. $ffp_jinri = 0;
  43. $ffp_zuori = 0;
  44. $ffp_sanri = 0;
  45. $ffp_yizhou = 0;
  46. $ffp_yiyue = 0;
  47. //付费金额
  48. $ffm_jilei = 0;
  49. $ffm_jinri = 0;
  50. $ffm_zuori = 0;
  51. $ffm_sanri = 0;
  52. $ffm_yizhou = 0;
  53. $ffm_yiyue = 0;
  54. $zhuce_list = M("user_info")->field("add_time")->select();
  55. foreach ($zhuce_list as $key => $value) {
  56. # code...
  57. $user_zhuce_time = $value['add_time'];
  58. if ($jinri_end_time > $user_zhuce_time and $user_zhuce_time > $jinri_start_time) {
  59. $zc_jilei++;
  60. $zc_jinri++;
  61. $zc_sanri++;
  62. $zc_yizhou++;
  63. $zc_yiyue++;
  64. } elseif ($zuo_end_time > $user_zhuce_time and $user_zhuce_time > $zuo_start_time) {
  65. $zc_jilei++;
  66. $zc_zuori++;
  67. $zc_yiyue++;
  68. } elseif ($san_end_time > $user_zhuce_time and $user_zhuce_time > $san_start_time) {
  69. $zc_jilei++;
  70. $zc_sanri++;
  71. $zc_yiyue++;
  72. } elseif ($zhou_end_time > $user_zhuce_time and $user_zhuce_time > $zhou_start_time) {
  73. $zc_jilei++;
  74. $zc_yizhou++;
  75. $zc_yiyue++;
  76. } elseif ($yue_end_time > $user_zhuce_time and $user_zhuce_time > $yue_start_time) {
  77. $zc_jilei++;
  78. $zc_yiyue++;
  79. } elseif ($user_zhuce_time < $yue_start_time) {
  80. $zc_jilei++;
  81. }
  82. }
  83. //付费人数 和钱数
  84. $user_list = M("pay_test")->field("uid,pay_time,amount")->where("order_type='已支付'")->select();
  85. foreach ($user_list as $key1 => $value1) {
  86. $user_ff_time = $value1['pay_time'];
  87. $fufei_jine = $value1['amount'];
  88. if ($jinri_end_time > $user_ff_time and $user_ff_time > $jinri_start_time) {
  89. $ffm_jilei += $fufei_jine;
  90. $ffm_jinri += $fufei_jine;
  91. $ffm_sanri += $fufei_jine;
  92. $ffm_yizhou += $fufei_jine;
  93. $ffm_yiyue += $fufei_jine;
  94. } elseif ($zuo_end_time > $user_ff_time and $user_ff_time > $zuo_start_time) {
  95. $ffm_yiyue += $fufei_jine;
  96. $ffm_jilei += $fufei_jine;
  97. $ffm_zuori += $fufei_jine;
  98. $ffm_yizhou += $fufei_jine;
  99. } elseif ($san_end_time > $user_ff_time and $user_ff_time > $san_start_time) {
  100. $ffm_yiyue += $fufei_jine;
  101. $ffm_jilei += $fufei_jine;
  102. $ffm_sanri += $fufei_jine;
  103. $ffm_yizhou += $fufei_jine;
  104. } elseif ($zhou_end_time > $user_ff_time and $user_ff_time > $zhou_start_time) {
  105. $ffm_yiyue += $fufei_jine;
  106. $ffm_jilei += $fufei_jine;
  107. $ffm_yizhou += $fufei_jine;
  108. } elseif ($yue_end_time > $user_ff_time and $user_ff_time > $yue_start_time) {
  109. $ffm_jilei += $fufei_jine;
  110. $ffm_yiyue += $fufei_jine;
  111. } else {
  112. //} else ($user_zhuce_time < $yue_start_time) {
  113. $ffm_jilei += $fufei_jine;
  114. }
  115. }
  116. //今日
  117. $todaytime = strtotime(date("Y-m-d", time()) . "00:00:00");
  118. //三日
  119. $threedaytime = strtotime(date("Y-m-d", strtotime("-3 day")) . "00:00:00");
  120. //周
  121. $weekdaytime = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  122. //14日
  123. $fourteendaytime = strtotime(date("Y-m-d", strtotime("-14 day")) . "00:00:00");
  124. $yueday_time = strtotime(date("Y-m-d", strtotime("-30 day")) . "00:00:00");
  125. $renshu_jin = M("pay_test")->where("pay_time>='$todaytime'")->field("uid")->group("uid")->select();
  126. $renshu_zuo = M("pay_test")->where("pay_time>='$zuo_start_time' and pay_time<='$zuo_end_time'")->field("uid")->group("uid")->select();
  127. $renshu_san = M("pay_test")->where("pay_time>='$threedaytime'")->field("uid")->group("uid")->select();;
  128. $renshu_zhou = M("pay_test")->where("pay_time>='$weekdaytime'")->field("uid")->group("uid")->select();
  129. $renshu_yue = M("pay_test")->where("pay_time>='$yueday_time'")->field("uid")->group("uid")->select();
  130. $renshu_jilei = M("pay_test")->field("uid")->group("uid")->select();
  131. $huoyue_jin = M("huoyue_list")->where("time>='$jinri_start_time' and time<='$jinri_end_time'")->field("uid")->group("uid")->select();
  132. $huoyue_zuo = M("huoyue_list")->where("time>='$zuo_start_time' and time<='$zuo_end_time'")->field("uid")->group("uid")->select();
  133. $huoyue_san = M("huoyue_list")->where("time>='$san_start_time' and time<='$san_end_time' ")->field("uid")->group("uid")->select();;
  134. $huoyue_zhou = M("huoyue_list")->where("time>='$zhou_start_time' and time<='$zhou_end_time'")->field("uid")->group("uid")->select();
  135. $huoyue_yue = M("huoyue_list")->where("time>='$yue_start_time' and time<='$yue_end_time'")->field("uid")->group("uid")->select();
  136. $huoyue_jilei = M("huoyue_list")->field("uid")->group("uid")->select();
  137. $yizhoulist['jinri'] = $zc_jinri;
  138. $yizhoulist['zuori'] = $zc_zuori;
  139. $yizhoulist['sanri'] = $zc_sanri;
  140. $yizhoulist['zhou'] = $zc_yizhou;
  141. $yizhoulist['yue'] = $zc_yiyue;
  142. $yizhoulist['jilei'] = $zc_jilei;
  143. $fufei_num['jinri_num'] = count($renshu_jin);
  144. $fufei_num['zuori_num'] = count($renshu_zuo);
  145. $fufei_num['sanri_num'] = count($renshu_san);
  146. $fufei_num['zhou_num'] = count($renshu_zhou);
  147. $fufei_num['yue_num'] = count($renshu_yue);
  148. $fufei_num['jilei_num'] = count($renshu_jilei);
  149. $fufei_number['jinri_people'] = $ffm_jinri;
  150. $fufei_number['zuori_people'] = $ffm_zuori;
  151. $fufei_number['sanri_people'] = $ffm_sanri;
  152. $fufei_number['zhou_people'] = $ffm_yizhou;
  153. $fufei_number['yue_people'] = $ffm_yiyue;
  154. $fufei_number['jilei_people'] = $ffm_jilei;
  155. $huoyue_num['jinriAAA_num'] = count($huoyue_jin);
  156. $huoyue_num['zuoriAAA_num'] = count($huoyue_zuo);
  157. $huoyue_num['sanriAAA_num'] = count($huoyue_san);
  158. $huoyue_num['zhouAAA_num'] = count($huoyue_zhou);
  159. $huoyue_num['yueAAA_num'] = count($huoyue_yue);
  160. $huoyue_num['jileiAAA_num'] = count($huoyue_jilei);
  161. $shuzu_list = array($yizhoulist, $fufei_number, $fufei_num, $huoyue_num);
  162. $data['code'] = '200';
  163. $data['status'] = '1';
  164. $data['message'] = '';
  165. $data['data'] = $shuzu_list;
  166. echo json_encode($data);
  167. }
  168. public function slUserStatistics()
  169. {
  170. // 指定允许其他域名访问
  171. // header('Access-Control-Allow-Origin:*');
  172. // 响应类型
  173. header('Access-Control-Allow-Methods:POST');
  174. // 响应头设置
  175. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  176. if (!empty($_POST)) {
  177. $token = $_POST['token']; //b8e3bb6ef8747d7
  178. if ($token != 'b8e3bb6ef8747d7') {
  179. $data['code'] = '203';
  180. $data['msg'] = 'token错误';
  181. echo json_encode($data);
  182. die;
  183. }
  184. //今日
  185. $todaytime = strtotime(date("Y-m-d", time()) . "00:00:00");
  186. //三日
  187. $threedaytime = strtotime(date("Y-m-d", strtotime("-3 day")) . "00:00:00");
  188. //周
  189. $weekdaytime = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  190. //14日
  191. $fourteendaytime = strtotime(date("Y-m-d", strtotime("-14 day")) . "00:00:00");
  192. /**
  193. * 注册人数统计
  194. */
  195. //累计新增注册
  196. $arr['totaluser'] = M("slgj_user")->count();
  197. //今日新增注册
  198. $arr['todayuser'] = M("slgj_user")->where("registertime>='$todaytime'")->count();
  199. //3日新增注册
  200. $arr['threedayuser'] = M("slgj_user")->where("registertime>='$threedaytime'")->count();
  201. //周新增注册
  202. $arr['weekuser'] = M("slgj_user")->where("registertime>='$weekdaytime'")->count();
  203. //14日新增注册
  204. $arr['fourteenuser'] = M("slgj_user")->where("registertime>='$fourteendaytime'")->count();
  205. /**
  206. * 登录人数统计
  207. */
  208. //今日登录人数
  209. $arr['todayloginuser'] = count(M("slgj_user_sessid")->where("time>='$todaytime' and uid!=0")->group("uid")->getField("uid", true));
  210. //3日登录人数
  211. $arr['threedayloginuser'] = count(M("slgj_user_sessid")->where("time>='$threedaytime' and uid!=0")->group("uid")->getField("uid", true));
  212. //周登录人数
  213. $arr['weekloginuser'] = count(M("slgj_user_sessid")->where("time>='$weekdaytime' and uid!=0")->group("uid")->getField("uid", true));
  214. //14日登录人数
  215. $arr['fourteenloginuser'] = count(M("slgj_user_sessid")->where("time>='$fourteendaytime' and uid!=0")->group("uid")->getField("uid", true));
  216. /**
  217. * 留存人数统计
  218. */
  219. //3日留存
  220. $arr['threedaykeep'] = "0";
  221. //7日留存
  222. $arr['weekdaykeep'] = "0";
  223. //14日留存
  224. $arr['fourteenkeep'] = "0";
  225. $data['code'] = '200';
  226. $data['msg'] = '请求成功';
  227. $data['data'] = $arr;
  228. echo json_encode($data);
  229. } else {
  230. $data['code'] = '202';
  231. $data['msg'] = '参数不正确';
  232. echo json_encode($data);
  233. die;
  234. }
  235. }
  236. //sl后台用户统计
  237. public function slUserInfo()
  238. {
  239. // 指定允许其他域名访问
  240. // header('Access-Control-Allow-Origin:*');
  241. // 响应类型
  242. header('Access-Control-Allow-Methods:POST');
  243. // 响应头设置
  244. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  245. if (!empty($_POST)) {
  246. $token = $_POST['token']; //b8e3bb6ef8747d7
  247. if ($token != 'b8e3bb6ef8747d7') {
  248. $data['code'] = '203';
  249. $data['msg'] = 'token错误';
  250. echo json_encode($data);
  251. die;
  252. }
  253. $page = $_POST['page'];
  254. $size = $_POST['size'];
  255. $arr = M("slgj_user")->field("id,account,registertime,lastlogintime")->page($page, $size)->order("id desc")->select();
  256. if ($arr) {
  257. $total = M("slgj_user")->count();
  258. foreach ($arr as $k => $v) {
  259. $arr[$k]['registertime'] = date("m.d H:i", $v['registertime']);
  260. $lastlogintime = M("slgj_user_sessid")->where(array("uid" => $v['id']))->order("id desc")->find();
  261. if ($lastlogintime) {
  262. $arr[$k]['lastlogintime'] = date("m.d H:i", $lastlogintime['time']);
  263. } else {
  264. $arr[$k]['lastlogintime'] = date("m.d H:i", $v['lastlogintime']);
  265. }
  266. }
  267. $data['code'] = '200';
  268. $data['msg'] = '请求成功';
  269. $data['data'] = $arr;
  270. $data['total'] = $total;
  271. echo json_encode($data);
  272. } else {
  273. $data['code'] = '201';
  274. $data['msg'] = '暂无数据';
  275. $data['data'] = array();
  276. $data['total'] = "0";
  277. echo json_encode($data);
  278. }
  279. } else {
  280. $data['code'] = '202';
  281. $data['msg'] = '参数不正确';
  282. echo json_encode($data);
  283. die;
  284. }
  285. }
  286. //sl后台用户信息
  287. public function slUserFeedback()
  288. {
  289. // 指定允许其他域名访问
  290. // header('Access-Control-Allow-Origin:*');
  291. // 响应类型
  292. header('Access-Control-Allow-Methods:POST');
  293. // 响应头设置
  294. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  295. if (!empty($_POST)) {
  296. $token = $_POST['token']; //b8e3bb6ef8747d7
  297. if ($token != 'b8e3bb6ef8747d7') {
  298. $data['code'] = '203';
  299. $data['msg'] = 'token错误';
  300. echo json_encode($data);
  301. die;
  302. }
  303. $page = $_POST['page'];
  304. $size = $_POST['size'];
  305. $arr = M("slgj_user_feedback")->page($page, $size)->order("id desc")->select();
  306. if ($arr) {
  307. $total = M("slgj_user_feedback")->count();
  308. foreach ($arr as $k => $v) {
  309. $arr[$k]['account'] = M("slgj_user")->where(array("uid" => $v['uid']))->find()['account'];
  310. $arr[$k]['time'] = date("m.d H:i", $v['time']);
  311. if ($v['reply_time'] == "") {
  312. $arr[$k]['is_reply'] = "回复";
  313. } else {
  314. $arr[$k]['is_reply'] = "已回复";
  315. }
  316. }
  317. $data['code'] = '200';
  318. $data['msg'] = '请求成功';
  319. $data['data'] = $arr;
  320. $data['total'] = $total;
  321. echo json_encode($data);
  322. } else {
  323. $data['code'] = '201';
  324. $data['msg'] = '暂无数据';
  325. $data['data'] = array();
  326. $data['total'] = "0";
  327. echo json_encode($data);
  328. }
  329. } else {
  330. $data['code'] = '202';
  331. $data['msg'] = '参数不正确';
  332. echo json_encode($data);
  333. die;
  334. }
  335. }
  336. //sl后台用意见反馈
  337. public function slUserReply()
  338. {
  339. // 指定允许其他域名访问
  340. // header('Access-Control-Allow-Origin:*');
  341. // 响应类型
  342. header('Access-Control-Allow-Methods:POST');
  343. // 响应头设置
  344. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  345. if (!empty($_POST)) {
  346. $token = $_POST['token']; //b8e3bb6ef8747d7
  347. if ($token != 'b8e3bb6ef8747d7') {
  348. $data['code'] = '203';
  349. $data['msg'] = 'token错误';
  350. echo json_encode($data);
  351. die;
  352. }
  353. $id = $_POST['id']; //数据id
  354. $arr['reply_content'] = $_POST['reply_content'];
  355. $arr['reply_time'] = time();
  356. $ret = M("slgj_user_feedback")->where("id='$id'")->save($arr);
  357. if ($ret) {
  358. $data['code'] = '200';
  359. $data['msg'] = '请求成功';
  360. echo json_encode($data);
  361. } else {
  362. $data['code'] = '201';
  363. $data['msg'] = '请求失败';
  364. echo json_encode($data);
  365. }
  366. } else {
  367. $data['code'] = '202';
  368. $data['msg'] = '参数不正确';
  369. echo json_encode($data);
  370. die;
  371. }
  372. }
  373. //sl后台回复
  374. public function advertShowList()
  375. {
  376. // 指定允许其他域名访问
  377. header('Access-Control-Allow-Origin:*');
  378. // 响应类型
  379. header('Access-Control-Allow-Methods:POST');
  380. // 响应头设置
  381. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  382. if (!empty($_POST)) {
  383. $token = $_POST['token']; //b8e3bb6ef8747d7
  384. if ($token != 'b8e3bb6ef8747d7') {
  385. $data['code'] = '203';
  386. $data['msg'] = 'token错误';
  387. echo json_encode($data);
  388. die;
  389. }
  390. $page = $_POST['page'];
  391. $size = $_POST['size'];
  392. $arr = M("slgj_advert_list")->page($page, $size)->where("type='视频列表广告'")->select();
  393. if ($arr) {
  394. $total = M("slgj_advert_list")->where("type='视频列表广告'")->count();
  395. $data['code'] = '200';
  396. $data['msg'] = '请求成功';
  397. $data['data'] = $arr;
  398. $data['total'] = $total;
  399. echo json_encode($data);
  400. } else {
  401. $data['code'] = '201';
  402. $data['msg'] = '暂无数据';
  403. $data['data'] = array();
  404. $data['total'] = "0";
  405. echo json_encode($data);
  406. }
  407. } else {
  408. $data['code'] = '202';
  409. $data['msg'] = '参数不正确';
  410. echo json_encode($data);
  411. die;
  412. }
  413. }
  414. //视频列表和视频详情广告展示
  415. public function advertShowStart()
  416. {
  417. // 指定允许其他域名访问
  418. header('Access-Control-Allow-Origin:*');
  419. // 响应类型
  420. header('Access-Control-Allow-Methods:POST');
  421. // 响应头设置
  422. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  423. if (!empty($_POST)) {
  424. $token = $_POST['token']; //b8e3bb6ef8747d7
  425. if ($token != 'b8e3bb6ef8747d7') {
  426. $data['code'] = '203';
  427. $data['msg'] = 'token错误';
  428. echo json_encode($data);
  429. die;
  430. }
  431. $page = $_POST['page'];
  432. $size = $_POST['size'];
  433. $arr = M("slgj_advert_list")->page($page, $size)->where("type='片头广告'")->select();
  434. if ($arr) {
  435. $total = M("slgj_advert_list")->where("type='片头广告'")->count();
  436. $data['code'] = '200';
  437. $data['msg'] = '请求成功';
  438. $data['data'] = $arr;
  439. $data['total'] = $total;
  440. echo json_encode($data);
  441. } else {
  442. $data['code'] = '201';
  443. $data['msg'] = '暂无数据';
  444. $data['data'] = array();
  445. $data['total'] = "0";
  446. echo json_encode($data);
  447. }
  448. } else {
  449. $data['code'] = '202';
  450. $data['msg'] = '参数不正确';
  451. echo json_encode($data);
  452. die;
  453. }
  454. }
  455. //视频开头广告展示
  456. public function videoAdvertAdd()
  457. {
  458. // 指定允许其他域名访问
  459. // header('Access-Control-Allow-Origin:*');
  460. // 响应类型
  461. header('Access-Control-Allow-Methods:POST');
  462. // 响应头设置
  463. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  464. // echo PHP_EOL.'22';
  465. if (!empty($_POST)) {
  466. $token = $_POST['token']; //b8e3bb6ef8747d7
  467. if ($token != 'b8e3bb6ef8747d7') {
  468. $data['code'] = '203';
  469. $data['msg'] = 'token错误';
  470. echo json_encode($data);
  471. die;
  472. }
  473. $arr['type'] = $type = $_POST['type']; //广告类型 视频列表和视频详情/视频开头
  474. $count = M("slgj_advert_list")->where("type='$type'")->count();
  475. if ($count == "0") {
  476. $arr['number'] = "00" . ($count + 1);
  477. } else {
  478. $numbers = M("slgj_advert_list")->where("type='$type'")->order("number desc")->find()['number'];
  479. $numb = $numbers + 1;
  480. if ($numb > 0 and $numb <= 9) {
  481. $arr['number'] = "00" . $numb;
  482. } elseif ($numb > 9 and $numb <= 99) {
  483. $arr['number'] = "0" . $numb;
  484. } else {
  485. $arr['number'] = $numb;
  486. }
  487. }
  488. $arr['jump_link'] = $_POST['jump_link']; //跳转链接
  489. $arr['content'] = $_POST['content']; //备注
  490. $img = $_FILES['img'];
  491. $upload = new \Think\Upload(); // 实例化上传类
  492. $upload->maxSize = 0; //设置附件上传大小
  493. $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
  494. $upload->rootPath = './Public/'; // 设置附件上传根目录
  495. $upload->savePath = 'backroundiMg/'; // 设置附件上传附目录
  496. $path = "https://www.aa9169.com/Public/";
  497. $info = $upload->uploadOne($img); // 上传单个文件
  498. if (!$info) {
  499. // 上传错误提示错误信息
  500. $this->error($upload->getError());
  501. } else {
  502. $imgs = $path . $info['savepath'] . $info['savename'];
  503. $arr['img'] = $imgs;
  504. }
  505. $ret = M("slgj_advert_list")->add($arr);
  506. if ($ret) {
  507. $data['code'] = '200';
  508. $data['msg'] = '请求成功';
  509. echo json_encode($data);
  510. } else {
  511. $data['code'] = '201';
  512. $data['msg'] = '请求失败';
  513. echo json_encode($data);
  514. }
  515. } else {
  516. $data['code'] = '202';
  517. $data['msg'] = '参数不正确';
  518. echo json_encode($data);
  519. die;
  520. }
  521. }
  522. //广告添加
  523. public function advertShowDetailOne()
  524. {
  525. // 指定允许其他域名访问
  526. header('Access-Control-Allow-Origin:*');
  527. // 响应类型
  528. header('Access-Control-Allow-Methods:POST');
  529. // 响应头设置
  530. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  531. if (!empty($_POST)) {
  532. $token = $_POST['token']; //b8e3bb6ef8747d7
  533. if ($token != 'b8e3bb6ef8747d7') {
  534. $data['code'] = '203';
  535. $data['msg'] = 'token错误';
  536. echo json_encode($data);
  537. die;
  538. }
  539. $id = $_POST['advert_id'];
  540. $arr = M("slgj_advert_list")->where("id='$id'")->find();
  541. if ($arr) {
  542. $data['code'] = '200';
  543. $data['msg'] = '请求成功';
  544. $data['data'] = $arr;
  545. echo json_encode($data);
  546. } else {
  547. $data['code'] = '201';
  548. $data['msg'] = '暂无数据';
  549. $data['data'] = array();
  550. echo json_encode($data);
  551. }
  552. } else {
  553. $data['code'] = '202';
  554. $data['msg'] = '参数不正确';
  555. echo json_encode($data);
  556. die;
  557. }
  558. }
  559. //编辑广告时展示单条数据
  560. //修改广告
  561. public function videoAdvertDetail()
  562. {
  563. // 指定允许其他域名访问
  564. // header('Access-Control-Allow-Origin:*');
  565. // 响应类型
  566. header('Access-Control-Allow-Methods:POST');
  567. // 响应头设置
  568. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  569. if (!empty($_POST)) {
  570. $token = $_POST['token']; //b8e3bb6ef8747d7
  571. if ($token != 'b8e3bb6ef8747d7') {
  572. $data['code'] = '203';
  573. $data['msg'] = 'token错误';
  574. echo json_encode($data);
  575. die;
  576. }
  577. $id = $_POST['advert_id'];
  578. $arr['jump_link'] = $_POST['jump_link']; //跳转链接
  579. $arr['content'] = $_POST['content']; //备注
  580. $oldimg = M("slgj_advert_list")->where("id='$id'")->find()['img'];
  581. $img = $_FILES['img'];
  582. if ($img == '' || $img == "undefined") {
  583. $arr['img'] = $oldimg;
  584. } else {
  585. $upload = new \Think\Upload(); // 实例化上传类
  586. $upload->maxSize = 0; //设置附件上传大小
  587. $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
  588. $upload->rootPath = './Public/'; // 设置附件上传根目录
  589. $upload->savePath = 'backroundiMg/'; // 设置附件上传附目录
  590. $path = "https://www.aa9169.com/Public/";
  591. $info = $upload->uploadOne($img); // 上传单个文件
  592. if (!$info) {
  593. // 上传错误提示错误信息
  594. $this->error($upload->getError());
  595. } else {
  596. $imgs = $path . $info['savepath'] . $info['savename'];
  597. $arr['img'] = $imgs;
  598. }
  599. }
  600. $ret = M("slgj_advert_list")->where("id='$id'")->save($arr);
  601. if ($ret) {
  602. // $this->unlink($oldimg);
  603. $data['code'] = '200';
  604. $data['msg'] = '请求成功';
  605. echo json_encode($data);
  606. } else {
  607. $data['code'] = '201';
  608. $data['msg'] = '请求失败';
  609. echo json_encode($data);
  610. }
  611. } else {
  612. $data['code'] = '202';
  613. $data['msg'] = '参数不正确';
  614. echo json_encode($data);
  615. die;
  616. }
  617. }
  618. //视频广告编辑
  619. public function videoAdvertDelete()
  620. {
  621. // 指定允许其他域名访问
  622. // header('Access-Control-Allow-Origin:*');
  623. // 响应类型
  624. header('Access-Control-Allow-Methods:POST');
  625. // 响应头设置
  626. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  627. if (!empty($_POST)) {
  628. $token = $_POST['token']; //b8e3bb6ef8747d7
  629. if ($token != 'b8e3bb6ef8747d7') {
  630. $data['code'] = '203';
  631. $data['msg'] = 'token错误';
  632. echo json_encode($data);
  633. die;
  634. }
  635. $id = $_POST['advert_id'];
  636. $oldimg = M("slgj_advert_list")->where("id='$id'")->find()['img'];
  637. $ret = M("slgj_advert_list")->where("id='$id'")->delete();
  638. if ($ret) {
  639. $this->unlink($oldimg);
  640. $data['code'] = '200';
  641. $data['msg'] = '请求成功';
  642. echo json_encode($data);
  643. } else {
  644. $data['code'] = '201';
  645. $data['msg'] = '请求失败';
  646. echo json_encode($data);
  647. }
  648. } else {
  649. $data['code'] = '202';
  650. $data['msg'] = '参数不正确';
  651. echo json_encode($data);
  652. die;
  653. }
  654. }
  655. //删除服务器上的图片
  656. public function unlink($img)
  657. {
  658. $str = substr($img, 23);
  659. $filename = "./" . $str;
  660. @unlink($filename);
  661. }
  662. //视频广告删除
  663. public function backSetDetailOne()
  664. {
  665. // 指定允许其他域名访问
  666. // header('Access-Control-Allow-Origin:*');
  667. // 响应类型
  668. header('Access-Control-Allow-Methods:POST');
  669. // 响应头设置
  670. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  671. if (!empty($_POST)) {
  672. $token = $_POST['token']; //b8e3bb6ef8747d7
  673. if ($token != 'b8e3bb6ef8747d7') {
  674. $data['code'] = '203';
  675. $data['msg'] = 'token错误';
  676. echo json_encode($data);
  677. die;
  678. }
  679. $id = $_POST['back_id'];
  680. $arr = M("slgj_backgroud_setting")->where("id='$id'")->find();
  681. if ($arr) {
  682. $data['code'] = '200';
  683. $data['msg'] = '请求成功';
  684. $data['data'] = $arr;
  685. echo json_encode($data);
  686. } else {
  687. $data['code'] = '201';
  688. $data['msg'] = '暂无数据';
  689. $data['data'] = array();
  690. echo json_encode($data);
  691. }
  692. } else {
  693. $data['code'] = '202';
  694. $data['msg'] = '参数不正确';
  695. echo json_encode($data);
  696. die;
  697. }
  698. }
  699. //后台设置展示单条数据
  700. public function backSetShowAll()
  701. {
  702. // 指定允许其他域名访问
  703. // header('Access-Control-Allow-Origin:*');
  704. // 响应类型
  705. header('Access-Control-Allow-Methods:POST');
  706. // 响应头设置
  707. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  708. if (!empty($_POST)) {
  709. $token = $_POST['token']; //b8e3bb6ef8747d7
  710. if ($token != 'b8e3bb6ef8747d7') {
  711. $data['code'] = '203';
  712. $data['msg'] = 'token错误';
  713. echo json_encode($data);
  714. die;
  715. }
  716. $arr = M("slgj_backgroud_setting")->select();
  717. if ($arr) {
  718. $data['code'] = '200';
  719. $data['msg'] = '请求成功';
  720. $data['data'] = $arr;
  721. echo json_encode($data);
  722. } else {
  723. $data['code'] = '201';
  724. $data['msg'] = '暂无数据';
  725. $data['data'] = array();
  726. echo json_encode($data);
  727. }
  728. } else {
  729. $data['code'] = '202';
  730. $data['msg'] = '参数不正确';
  731. echo json_encode($data);
  732. die;
  733. }
  734. }
  735. //后台设置展示所有数据
  736. public function backgroundSettingDetail()
  737. {
  738. // 指定允许其他域名访问
  739. // header('Access-Control-Allow-Origin:*');
  740. // 响应类型
  741. header('Access-Control-Allow-Methods:POST');
  742. // 响应头设置
  743. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  744. if (!empty($_POST)) {
  745. $token = $_POST['token']; //b8e3bb6ef8747d7
  746. if ($token != 'b8e3bb6ef8747d7') {
  747. $data['code'] = '203';
  748. $data['msg'] = 'token错误';
  749. echo json_encode($data);
  750. die;
  751. }
  752. $id = $_POST['back_id'];
  753. $arr['url_type'] = $_POST['url_type']; //网址类型
  754. $arr['jump_link'] = $_POST['jump_link']; //跳转链接
  755. $ret = M("slgj_backgroud_setting")->where("id='$id'")->save($arr);
  756. if ($ret) {
  757. $data['code'] = '200';
  758. $data['msg'] = '请求成功';
  759. echo json_encode($data);
  760. } else {
  761. $data['code'] = '201';
  762. $data['msg'] = '请求失败';
  763. echo json_encode($data);
  764. }
  765. } else {
  766. $data['code'] = '202';
  767. $data['msg'] = '参数不正确';
  768. echo json_encode($data);
  769. die;
  770. }
  771. }
  772. //后台设置编辑
  773. /**
  774. * 测试功能
  775. *
  776. * @param $templateid []
  777. * @return $type 消息类型
  778. */
  779. public function thirdpartylink()
  780. {
  781. // 指定允许其他域名访问
  782. header('Access-Control-Allow-Origin:*');
  783. // 响应类型
  784. header('Access-Control-Allow-Methods:POST');
  785. // 响应头设置
  786. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  787. if (!empty($_POST)) {
  788. $iid = $_POST['id'];
  789. $wula = M("three_url")->where("id=$iid")->field("id", true)->select();
  790. $data['message'] = 'ok';
  791. $data['data'] = $wula;
  792. echo json_encode($data);
  793. } else {
  794. echo $this->returnData();
  795. }
  796. }
  797. protected function returnData()
  798. {
  799. header('Content-Type:text/json;charset=utf-8');
  800. header('Access-Control-Allow-Origin:*');
  801. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  802. header('Access-Control-Allow-Methods:POST');
  803. header('Access-Control-Expose-Headers:*');
  804. $data['status'] = '0';
  805. $data['code'] = '202';//未携带参数,请求失败
  806. $data['message'] = 'errorr';
  807. return $data;
  808. }
  809. /**
  810. * 测试功能
  811. *
  812. * @param $templateid []
  813. * @return $type 消息类型
  814. */
  815. public function niubi_nginx()
  816. {
  817. if (!empty($_POST)) {
  818. $po = $_POST['po'];
  819. if ($po == 'Anzw224484') {
  820. // 定义 Nginx 二进制文件路径
  821. $nginx_bin_path = '/usr/local/nginx/sbin/nginx';
  822. // 向 Nginx 主进程发送重启信号
  823. if (file_exists($nginx_bin_path)) {
  824. shell_exec("$nginx_bin_path -s reload");
  825. echo "Nginx 已重启";
  826. } else {
  827. echo "Nginx 二进制文件不存在";
  828. }
  829. } else {
  830. echo PHP_EOL . 'no';
  831. die();
  832. }
  833. } else {
  834. echo $this->returnData();
  835. }
  836. }
  837. /**
  838. * 代理赚钱统计
  839. * 首先获取代理人总数
  840. *
  841. * @param $templateid []
  842. * @return $type 消息类型
  843. */
  844. public function agent_money_user_statistcs()
  845. {
  846. // 指定允许其他域名访问
  847. header('Access-Control-Allow-Origin:*');
  848. // 响应类型
  849. header('Access-Control-Allow-Methods:POST');
  850. // 响应头设置
  851. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  852. $yue_start_time = strtotime('first day of this month midnight');;
  853. $yue_end_time = strtotime('first day of next month midnight') - 1;
  854. if (!empty($_POST)) {
  855. $page = $_POST['page'];
  856. $page_one = ($page - 1) * 50;
  857. $agent_user_list = M("pop_user")->field("uid,count(uid) as ww")->group("uid")->order(" ww desc")->LIMIT($page_one, 50)->select();
  858. // //add_time BETWEEN $yue_start_time and $yue_end_time and
  859. $agent_user_list_amount = M("pop_user")->field("uid")->group("uid")->select();
  860. //代理人总数
  861. $amount_agent_user = count($agent_user_list_amount);
  862. $agent_list_map = array();
  863. foreach ($agent_user_list as $key => $value) {
  864. # code...
  865. $uid = $value['uid'];
  866. //agent_userinfo_list
  867. $agent_userinfo_list = M("user_info")->where("id=$uid")->field("name,add_time,vip_yn")->select();
  868. $agent_user_name = $agent_userinfo_list[0]["name"];
  869. $agent_user_add_date_time = $agent_userinfo_list[0]["add_time"];
  870. $agent_user_add_date = date("Y-m-d H:i:s", $agent_user_add_date_time);
  871. // $agent_user_add_date = $agent_user_add_date_time;
  872. $agent_user_yn_vip_yn = $agent_userinfo_list[0]["vip_yn"];
  873. if ($agent_user_yn_vip_yn != 0) {
  874. $agent_user_yn_vip = "是";
  875. } else {
  876. $agent_user_yn_vip = "否";
  877. }
  878. //this_month
  879. //agent_money
  880. $agent_money_sum = M("user_info")->where("id=$uid")->getField("agent_money");;
  881. //agent
  882. $agent_people_num = M("pop_user")->where("uid=$uid and add_time BETWEEN $yue_start_time and $yue_end_time")->count();
  883. //会员数量
  884. $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();
  885. //accumulate
  886. //佣金
  887. $agent_money_sum_accumulate = M("agent_money")->where("uid=$uid")->sum('agent_money');
  888. //用户数量
  889. $agent_people_num_accumlate = M("pop_user")->where("uid=$uid")->count();
  890. //会员数量
  891. $agent_people_vip_num_accumulate = M("pop_user")->where("uid=$uid and pay_money>0")->count();
  892. if (empty($commission_payable)) {
  893. $commission_payable = 0;
  894. }
  895. if (empty($commission_payable)) {
  896. $commission_payable = 0;
  897. }
  898. if (empty($agent_people_num)) {
  899. $agent_people_num = 0;
  900. }
  901. if (empty($agent_people_vip_num)) {
  902. $agent_people_vip_num = 0;
  903. }
  904. if (empty($agent_people_num_accumlate)) {
  905. $agent_people_num_accumlate = 0;
  906. }
  907. if (empty($agent_people_vip_num_accumulate)) {
  908. $agent_people_vip_num_accumulate = 0;
  909. }
  910. if (empty($agent_money_sum_accumulate)) {
  911. $agent_money_sum_accumulate = 0;
  912. }
  913. //用户名
  914. $agent_user_detail_list['agent_user_name'] = $agent_user_name;
  915. //注册日期
  916. $agent_user_detail_list['registration_data'] = $agent_user_add_date;
  917. //是否是会员
  918. $agent_user_detail_list['vip_yn'] = $agent_user_yn_vip;
  919. //本月邀请
  920. $agent_user_detail_list['this_month_invite_num'] = $agent_people_num;
  921. //本月会员
  922. $agent_user_detail_list['this_month_vip_num'] = $agent_people_vip_num;
  923. //本月佣金
  924. $agent_user_detail_list['this_month_agent_money'] = $agent_money_sum;
  925. //积累邀请
  926. $agent_user_detail_list['accumulate_invite_num'] = $agent_people_num_accumlate;
  927. //积累会员
  928. $agent_user_detail_list['accumulate_vip_num'] = $agent_people_vip_num_accumulate;
  929. //积累佣金
  930. $agent_user_detail_list['accumulate_agent_money'] = $agent_money_sum_accumulate;
  931. array_push($agent_list_map, $agent_user_detail_list);
  932. }
  933. usort($agent_list_map, function($a, $b) {
  934. return $b['this_month_invite_num'] - $a['this_month_invite_num'];
  935. });
  936. $data['code'] = '200';
  937. $data['status'] = '1';
  938. $data['message'] = 'yes';
  939. $data['data'] = $agent_list_map;
  940. $data['amount'] = $amount_agent_user;
  941. echo json_encode($data);
  942. } else {
  943. echo $this->returnData();
  944. }
  945. }
  946. /**
  947. * agent_list_info_Above
  948. *
  949. * @param $templateid []
  950. * @return $type 消息类型
  951. */
  952. public function agent_list_info_Above()
  953. {
  954. // 指定允许其他域名访问
  955. header('Access-Control-Allow-Origin:*');
  956. // 响应类型
  957. header('Access-Control-Allow-Methods:POST');
  958. // 响应头设置
  959. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  960. $yue_start_time = strtotime('first day of this month midnight');;
  961. $yue_end_time = strtotime('first day of next month midnight') - 1;
  962. //代理人数
  963. $agent_user_list = M("pop_user")->field("uid")->group("uid")->select();
  964. //代理人总数
  965. $amount_agent_user = count($agent_user_list);
  966. //本月邀请
  967. $agent_people_num = M("pop_user")->where("add_time BETWEEN $yue_start_time and $yue_end_time")->count();
  968. //本月会员
  969. $agent_people_vip_num = M("pop_user")->where("agent_money_time BETWEEN $yue_start_time and $yue_end_time and pay_money>0")->count();
  970. //本月佣金
  971. $agent_money_sum = M("user_info")->where("agent_money!=0")->sum('agent_money');
  972. //积累邀请
  973. $agent_people_num_accumlate = M("pop_user")->count();
  974. //积累会员
  975. $agent_people_vip_num_accumulate = M("pop_user")->where("pay_money>0")->count();
  976. //accumulate agent money
  977. $agent_money_sum_accumulate = M("pop_user")->sum('pay_brokerage');
  978. $agent_user_detail_list['agent_people_amount'] = $amount_agent_user;
  979. //本月邀请
  980. $agent_user_detail_list['this_month_invite_num'] = $agent_people_num;
  981. //本月会员
  982. $agent_user_detail_list['this_month_vip_num'] = $agent_people_vip_num;
  983. //本月佣金
  984. $agent_user_detail_list['this_month_agent_money'] = $agent_money_sum;
  985. //积累邀请
  986. $agent_user_detail_list['accumulate_invite_num'] = $agent_people_num_accumlate;
  987. //积累会员
  988. $agent_user_detail_list['accumulate_vip_num'] = $agent_people_vip_num_accumulate;
  989. //积累佣金
  990. $agent_user_detail_list['accumulate_agent_money'] = $agent_money_sum_accumulate;
  991. $data['code'] = '200';
  992. $data['status'] = '1';
  993. $data['data'] = $agent_user_detail_list;
  994. echo json_encode($data);
  995. }
  996. /**
  997. * 待打款
  998. *
  999. * @param $templateid []
  1000. * @return $type 消息类型
  1001. */
  1002. public function commission_payable()
  1003. {
  1004. // 指定允许其他域名访问
  1005. header('Access-Control-Allow-Origin:*');
  1006. // 响应类型
  1007. header('Access-Control-Allow-Methods:POST');
  1008. // 响应头设置
  1009. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1010. $yue_start_time = strtotime('first day of this month midnight');;
  1011. $yue_end_time = strtotime('first day of next month midnight') - 1;
  1012. if (!empty($_POST)) {
  1013. $page = $_POST['page'];
  1014. $page_one = ($page - 1) * 50;
  1015. $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();
  1016. // echo PHP_EOL.M("user_info")->_sql();
  1017. $agent_user_list_amount = M("user_info")->where('last_month_agent_money>=200')->field("id")->select();
  1018. //代理人总数
  1019. $amount_agent_user = count($agent_user_list_amount);
  1020. $agent_list_map = array();
  1021. //先判断剩余佣金是否到达200不足则不显示
  1022. foreach ($agent_user_list as $key => $value) {
  1023. # code...
  1024. $uid = $value['id'];
  1025. //上月佣金-待打款
  1026. //agent_userinfo_list,代理用户基本信息
  1027. $agent_user_name = $agent_user_list[0]["name"];
  1028. $agent_user_name = $agent_user_list[0]["name"];
  1029. $agent_user_add_date = $agent_user_list[0]["add_date"];
  1030. $last_month_commission_payable = $agent_user_list[0]["last_month_agent_money"];
  1031. $button_one = $agent_user_list[0]["payable_one"];
  1032. $button_two = $agent_user_list[0]["payable_two"];
  1033. $beizhu = $agent_user_list[0]["beizhu"];
  1034. //积累佣金) 没问题!!!
  1035. $agent_money_sum_accumulate = M("agent_money")->where("uid=$uid")->sum('agent_money');
  1036. //本月佣金
  1037. $agent_money_sum = M("user_info")->where("id=$uid")->getField('agent_money');
  1038. // //支付宝账号
  1039. // $alipay_account_list = M("alipay_user")->where("uid=$uid")->field("real_name,alipay_user")->select();
  1040. // $alipay_real_name = $alipay_account_list[0]['usdt_string'];
  1041. // $alipay_real_account = $alipay_account_list[0]['alipay_user'];
  1042. //
  1043. $zhifu_type_pay = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");
  1044. switch ($zhifu_type_pay) {
  1045. case 'bank':
  1046. //bank_info
  1047. $bank_info_list = M("agent_bank_card_info")->where("uid=$uid")->field("real_name,bank_card_number,bank_name")->select();
  1048. $bank_real_name = $bank_info_list[0]['real_name'];
  1049. $bank_card_number = $bank_info_list[0]['bank_card_number'];
  1050. $bank_name = $bank_info_list[0]['bank_name'];
  1051. $usdt_string = '';
  1052. break;
  1053. case 'usdt':
  1054. //usdt号码
  1055. $usdt_string = M("agent_usdt_info")->where("uid=$uid")->getField("usdt_string");
  1056. if (empty($usdt_string)) {
  1057. $usdt_string = '';
  1058. }
  1059. $bank_real_name = '';
  1060. $bank_card_number = '';
  1061. $bank_name = '';
  1062. break;
  1063. default:
  1064. echo "type error";
  1065. }
  1066. if (empty($agent_money_sum_accumulate)) {
  1067. $agent_money_sum_accumulate = 0;
  1068. }
  1069. if (empty($agent_money_sum)) {
  1070. $agent_money_sum = 0;
  1071. }
  1072. if (empty($last_month_commission_payable)) {
  1073. $last_month_commission_payable = 0;
  1074. }
  1075. if (empty($agent_money_sum_accumulate)) {
  1076. $agent_money_sum_accumulate = 0;
  1077. }
  1078. if (empty($usdt_string)) {
  1079. $usdt_string = '';
  1080. }
  1081. //用户名
  1082. $agent_user_detail_list['agent_user_name'] = $agent_user_name;
  1083. $agent_user_detail_list['uid'] = $uid;
  1084. //注册日期
  1085. $agent_user_detail_list['registration_data'] = $agent_user_add_date;
  1086. //积累佣金
  1087. $agent_user_detail_list['accumulate_agent_money'] = $agent_money_sum_accumulate;
  1088. //本月佣金
  1089. $agent_user_detail_list['this_month_agent_money'] = $agent_money_sum;
  1090. //上月佣金-待打款
  1091. $agent_user_detail_list['last_month_commission_payable'] = $last_month_commission_payable;
  1092. //支付宝账号
  1093. // $agent_user_detail_list['alipay_real_name'] = $alipay_real_name;
  1094. // $agent_user_detail_list['alipay_account_number'] =$alipay_real_account;
  1095. //
  1096. $agent_user_detail_list['bank_real_name'] = $bank_real_name;
  1097. $agent_user_detail_list['bank_card_number'] = $bank_card_number;
  1098. $agent_user_detail_list['bank_name'] = $bank_name;
  1099. $agent_user_detail_list['payable_button_one'] = $button_one;
  1100. $agent_user_detail_list['payable_button_two'] = $button_two;
  1101. $agent_user_detail_list['beizhu'] = $beizhu;
  1102. $agent_user_detail_list['usdt_string'] = $usdt_string;
  1103. array_push($agent_list_map, $agent_user_detail_list);
  1104. }
  1105. $data['code'] = '200';
  1106. $data['status'] = '1';
  1107. $data['message'] = 'yes';
  1108. $data['data'] = $agent_list_map;
  1109. $data['amount'] = $amount_agent_user;
  1110. echo json_encode($data);
  1111. } else {
  1112. echo $this->returnData();
  1113. }
  1114. }
  1115. /**
  1116. * 待付款佣金 上方列表
  1117. *
  1118. * @param $templateid []
  1119. * @return $type 消息类型
  1120. */
  1121. public function commission_payable_above()
  1122. {
  1123. // 指定允许其他域名访问
  1124. header('Access-Control-Allow-Origin:*');
  1125. // 响应类型
  1126. header('Access-Control-Allow-Methods:POST');
  1127. // 响应头设置
  1128. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1129. //待打款代理 数量
  1130. $agent_payable_amount = M("user_info")->where("last_month_agent_money>=200")->field("id")->select();;
  1131. $diali_num = count($agent_payable_amount);
  1132. //待打款佣金
  1133. $commission_payable = M("user_info")->where("last_month_agent_money>=200")->sum('last_month_agent_money');
  1134. if (empty($diali_num)) {
  1135. $diali_num = 0;
  1136. }
  1137. if (empty($commission_payable)) {
  1138. $commission_payable = 0;
  1139. }
  1140. $arr['agent_payable_amount'] = $diali_num;
  1141. $arr["commission_payable"] = $commission_payable;
  1142. $data['code'] = '200';
  1143. $data['status'] = '1';
  1144. $data['data'] = $arr;
  1145. echo json_encode($data);
  1146. }
  1147. /**
  1148. * 打款按钮
  1149. *
  1150. * @param $templateid []
  1151. * @return $type 消息类型
  1152. */
  1153. public function payable_button()
  1154. {
  1155. // 指定允许其他域名访问
  1156. header('Access-Control-Allow-Origin:*');
  1157. // 响应类型
  1158. header('Access-Control-Allow-Methods:POST');
  1159. // 响应头设置
  1160. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1161. if (!empty($_POST)) {
  1162. $button_type = $_POST['button'];
  1163. $uid = $_POST['uid'];
  1164. $beizhu = $_POST['beizhu'];
  1165. switch ($button_type) {
  1166. case 'one':
  1167. $save_button['payable_one'] = 1;
  1168. break;
  1169. case 'two':
  1170. $save_button['payable_two'] = 1;
  1171. break;
  1172. default:
  1173. echo "type error";
  1174. die();
  1175. }
  1176. M("user_info")->where("id=$uid")->save($save_button);
  1177. //第二部判断 ,如果都是已付款则添加到打款表
  1178. $two_button = M("user_info")->where("id=$uid")->field("payable_two,payable_one,last_month_agent_money")->select();
  1179. $oen_button_type = $two_button[0]['payable_one'];
  1180. $two_button_type = $two_button[0]['payable_two'];
  1181. $last_month_agent_money = $two_button[0]['last_month_agent_money'];
  1182. if ($oen_button_type == 1 and $two_button_type == 1) {
  1183. //操作时间
  1184. $aatime = time();
  1185. $agent_time_date = date("Y-m-d H:i", $aatime);
  1186. //获取操作人员ip
  1187. $userip = $this->get_bb_ip();
  1188. $paid_list['uid'] = $uid;
  1189. $paid_list['payment_amount'] = $last_month_agent_money;
  1190. $paid_list['payment_date'] = $agent_time_date;
  1191. $paid_list['payment_time'] = $aatime;
  1192. $paid_list['beizhu'] = $beizhu;
  1193. $paid_list['pay_type'] = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");;
  1194. $paid_list['ip'] = $userip;
  1195. M("agent_payment_record")->add($paid_list);
  1196. // M("user_info")->where("id=$uid")->setDec('last_month_agent_money',$last_month_agent_money);
  1197. }
  1198. $data['message'] = 'ok';
  1199. echo json_encode($data);
  1200. } else {
  1201. echo $this->returnData();
  1202. }
  1203. }
  1204. /**
  1205. *获取用户IP地址
  1206. *
  1207. * @param int $type
  1208. * @return mixed
  1209. */
  1210. private function get_bb_ip($type = 0)
  1211. {
  1212. $type = $type ? 1 : 0;
  1213. static $ip = NULL;
  1214. if ($ip !== NULL)
  1215. return $ip[$type];
  1216. if ($_SERVER['HTTP_X_REAL_IP']) {//nginx 代理模式下,获取客户端真实IP
  1217. $ip = $_SERVER['HTTP_X_REAL_IP'];
  1218. } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {//客户端的ip
  1219. $ip = $_SERVER['HTTP_CLIENT_IP'];
  1220. } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {//浏览当前页面的用户计算机的网关
  1221. $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
  1222. $pos = array_search('unknown', $arr);
  1223. if (false !== $pos)
  1224. unset($arr[$pos]);
  1225. $ip = trim($arr[0]);
  1226. } elseif (isset($_SERVER['REMOTE_ADDR'])) {
  1227. $ip = $_SERVER['REMOTE_ADDR'];//浏览当前页面的用户计算机的ip地址
  1228. } else {
  1229. $ip = $_SERVER['REMOTE_ADDR'];
  1230. }
  1231. // IP地址合法验证
  1232. $long = sprintf("%u", ip2long($ip));
  1233. $ip = $long ? array($ip, $long) : array('0.0.0.0', 0);
  1234. return $ip[$type];
  1235. }
  1236. /**
  1237. * 已支付佣金记录
  1238. *
  1239. * @param $templateid []
  1240. * @return $type 消息类型
  1241. */
  1242. public function paid_commission_record()
  1243. {
  1244. // 指定允许其他域名访问
  1245. header('Access-Control-Allow-Origin:*');
  1246. // 响应类型
  1247. header('Access-Control-Allow-Methods:POST');
  1248. // 响应头设置
  1249. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1250. if (!empty($_POST)) {
  1251. $page = $_POST['page'];
  1252. $page_one = ($page - 1) * 50;
  1253. $paid_agent_list = M("agent_payment_record")->group('uid')->field("uid")->LIMIT($page_one, 50)->select();
  1254. $amount_agent_user_list = M("agent_payment_record")->group('uid')->field("uid")->select();
  1255. $amount_agent_user = count($amount_agent_user_list);
  1256. $agent_list_map = array();
  1257. foreach ($paid_agent_list as $key => $value) {
  1258. # code...
  1259. $uid = $value['uid'];
  1260. $agent_user_list = M("user_info")->where("id=$uid")->field("add_date,name")->select();
  1261. $agent_user_name = $agent_user_list[0]["name"];
  1262. $agent_user_add_date = $agent_user_list[0]["add_date"];
  1263. //accumulate payment
  1264. $accumulate_payment = M("agent_payment_record")->where("uid=$uid")->sum('payment_amount');
  1265. $agent_info_list = M("agent_payment_record")->where("uid=$uid")->field("payment_date,payment_amount,beizhu")->order("id desc")->LIMIT(1)->select();
  1266. //last_pay_amount
  1267. $last_pay_amount = $agent_info_list[0]['payment_amount'];
  1268. //last_pay_date
  1269. $last_pay_date = $agent_info_list[0]['payment_date'];
  1270. $beizhu= $agent_info_list[0]['beizhu'];
  1271. // //支付宝账号
  1272. // $alipay_account_list = M("alipay_user")->where("uid=$uid")->field("real_name,alipay_user")->select();
  1273. // $alipay_real_name = $alipay_account_list[0]['real_name'];
  1274. // $alipay_real_account = $alipay_account_list[0]['alipay_user'];
  1275. //
  1276. $zhifu_type_pay = M("agent_bank_card_info")->where("uid=$uid")->getField("pay_type");
  1277. switch ($zhifu_type_pay) {
  1278. case 'bank':
  1279. //bank_info
  1280. $bank_info_list = M("agent_bank_card_info")->where("uid=$uid")->field("real_name,bank_card_number,bank_name")->select();
  1281. $bank_real_name = $bank_info_list[0]['real_name'];
  1282. $bank_card_number = $bank_info_list[0]['bank_card_number'];
  1283. $bank_name = $bank_info_list[0]['bank_name'];
  1284. $usdt_string = '';
  1285. break;
  1286. case 'usdt':
  1287. //usdt号码
  1288. $usdt_string = M("agent_usdt_info")->where("uid=$uid")->getField("usdt_string");
  1289. if (empty($usdt_string)) {
  1290. $usdt_string = '未设置';
  1291. }
  1292. $bank_real_name = '';
  1293. $bank_card_number = '';
  1294. $bank_name = '';
  1295. break;
  1296. default:
  1297. echo "type error";
  1298. }
  1299. //用户名
  1300. $agent_user_detail_list['agent_user_name'] = $agent_user_name;
  1301. //注册日期
  1302. $agent_user_detail_list['registration_data'] = $agent_user_add_date;
  1303. //积累打款
  1304. $agent_user_detail_list['accumulate_payment'] = $accumulate_payment;
  1305. //最近打款金额
  1306. $agent_user_detail_list['last_payment_amount'] = $last_pay_amount;
  1307. //最近打款日期
  1308. $agent_user_detail_list['last_payment_date'] = $last_pay_date;
  1309. // //姓名
  1310. // $agent_user_detail_list['alipay_real_name'] = $alipay_real_name;
  1311. // //账号
  1312. // $agent_user_detail_list['alipay_account_number'] =$alipay_real_account;
  1313. $agent_user_detail_list['bank_real_name'] = $bank_real_name;
  1314. $agent_user_detail_list['bank_card_number'] = $bank_card_number;
  1315. $agent_user_detail_list['bank_name'] = $bank_name;
  1316. $agent_user_detail_list['beizhu'] = $beizhu;
  1317. //usdt
  1318. $agent_user_detail_list['usdt_string'] = $usdt_string;
  1319. array_push($agent_list_map, $agent_user_detail_list);
  1320. }
  1321. $data['code'] = '200';
  1322. $data['status'] = '1';
  1323. $data['message'] = 'yes';
  1324. $data['data'] = $agent_list_map;
  1325. $data['amount'] = $amount_agent_user;
  1326. echo json_encode($data);
  1327. } else {
  1328. echo $this->returnData();
  1329. }
  1330. }
  1331. /**
  1332. * 测试功能
  1333. *
  1334. * @param $templateid []
  1335. * @return $type 消息类型
  1336. *
  1337. */
  1338. public function paid_commission_record_above()
  1339. {
  1340. // 指定允许其他域名访问
  1341. header('Access-Control-Allow-Origin:*');
  1342. // 响应类型
  1343. header('Access-Control-Allow-Methods:POST');
  1344. // 响应头设置
  1345. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1346. // 本月开始和结束的时间戳
  1347. $firstDayOfMonth = strtotime('first day of this month midnight');
  1348. $lastDayOfMonth = strtotime('last day of this month 23:59:59');
  1349. // 上个月开始和结束的时间戳
  1350. $firstDayOfLastMonth = strtotime('first day of last month midnight');
  1351. $lastDayOfLastMonth = strtotime('last day of last month 23:59:59');
  1352. //已打款代理
  1353. //累计已打款佣金
  1354. //上月已打款佣金
  1355. //本月已打款佣金
  1356. $amount_agent_user_list = M("agent_payment_record")->group('uid')->field("uid")->select();
  1357. $amount_agent_user = count($amount_agent_user_list);
  1358. $wula['payment_people_num'] = $amount_agent_user;
  1359. $accumulate_payment_amount = M("agent_payment_record")->where("id!=0")->sum('payment_amount');
  1360. $last_month_payment_amount = M("agent_payment_record")->where("id!=0 and payment_time BETWEEN $firstDayOfLastMonth and $lastDayOfLastMonth")->sum('payment_amount');
  1361. $now_month_payment_amount = M("agent_payment_record")->where("id!=0 and payment_time BETWEEN $firstDayOfMonth and $lastDayOfMonth")->sum('payment_amount');
  1362. if (empty($accumulate_payment_amount)) {
  1363. $accumulate_payment_amount = 0;
  1364. }
  1365. if (empty($last_month_payment_amount)) {
  1366. $last_month_payment_amount = 0;
  1367. }
  1368. if (empty($now_month_payment_amount)) {
  1369. $now_month_payment_amount = 0;
  1370. }
  1371. $wula['accumulate_payment_amount'] = $accumulate_payment_amount;
  1372. $wula['last_month_payment_amount'] = $last_month_payment_amount;
  1373. $wula['now_month_payment_amount'] = $now_month_payment_amount;
  1374. $data['code'] = '200';
  1375. $data['status'] = '1';
  1376. $data['data'] = $wula;
  1377. echo json_encode($data);
  1378. }
  1379. /**
  1380. * 测试功能
  1381. *
  1382. * @param $templateid []
  1383. * @return $type 消息类型
  1384. */
  1385. public function time_echo_date()
  1386. {
  1387. // 本月开始和结束的时间戳
  1388. $firstDayOfMonth = strtotime('first day of this month midnight');
  1389. $lastDayOfMonth = strtotime('last day of this month 23:59:59');
  1390. echo "本月开始时间戳:$firstDayOfMonth" . PHP_EOL;
  1391. echo "本月结束时间戳:$lastDayOfMonth" . PHP_EOL;
  1392. // 上个月开始和结束的时间戳
  1393. $firstDayOfLastMonth = strtotime('first day of last month midnight');
  1394. $lastDayOfLastMonth = strtotime('last day of last month 23:59:59');
  1395. echo "上个月开始时间戳:$firstDayOfLastMonth" . PHP_EOL;
  1396. echo "上个月结束时间戳:$lastDayOfLastMonth" . PHP_EOL;
  1397. }
  1398. /**
  1399. * 读通道设置
  1400. *
  1401. * @param $templateid []
  1402. * @return $type 消息类型
  1403. */
  1404. public function select_td_list()
  1405. {
  1406. // 指定允许其他域名访问
  1407. header('Access-Control-Allow-Origin:*');
  1408. // 响应类型
  1409. header('Access-Control-Allow-Methods:POST');
  1410. // 响应头设置
  1411. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1412. $all_td_list = M("td_save")->where("id<4")->select();
  1413. foreach ($all_td_list as $key => $value) {
  1414. $td_id = $value['td_id'];
  1415. switch ($td_id) {
  1416. case '8088':
  1417. $td_number = 1;
  1418. break;
  1419. case '8008':
  1420. $td_number = 2;
  1421. break;
  1422. case '8023':
  1423. $td_number = 3;
  1424. break;
  1425. case '8009':
  1426. $td_number = 4;
  1427. break;
  1428. case '8015':
  1429. $td_number = 5;
  1430. break;
  1431. default:
  1432. echo "type error";
  1433. }
  1434. $td_list[$key]['num'] = $td_number;
  1435. }
  1436. $data['message'] = 'yes';
  1437. $data['data'] = $td_list;
  1438. echo json_encode($data);
  1439. }
  1440. /**
  1441. * 测试功能
  1442. *
  1443. * @param $templateid []
  1444. * @return $type 消息类型
  1445. */
  1446. public function save_td()
  1447. {
  1448. // 指定允许其他域名访问
  1449. header('Access-Control-Allow-Origin:*');
  1450. // 响应类型
  1451. header('Access-Control-Allow-Methods:POST');
  1452. // 响应头设置
  1453. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1454. if (!empty($_POST)) {
  1455. $id = $_POST['id'];
  1456. $td_id = $_POST['td_id'];
  1457. switch ($td_id) {
  1458. case '1':
  1459. $save_list['td_id'] = 8088;
  1460. $save_list['td_str'] = '支付宝倾心';
  1461. break;
  1462. case '2':
  1463. $save_list['td_id'] = 8008;
  1464. $save_list['td_str'] = '支付宝直播';
  1465. break;
  1466. case '3':
  1467. $save_list['td_id'] = 8023;
  1468. $save_list['td_str'] = '支付宝快手';
  1469. break;
  1470. case '4':
  1471. $save_list['td_id'] = 8009;
  1472. $save_list['td_str'] = '支付宝YY';
  1473. break;
  1474. case '5':
  1475. $save_list['td_id'] = 8015;
  1476. $save_list['td_str'] = '微信游戏原生';
  1477. break;
  1478. default:
  1479. echo "type error";
  1480. die();
  1481. }
  1482. $wula_save = M("td_save")->where("id=$id")->save($save_list);
  1483. if ($wula_save) {
  1484. //修改成功
  1485. $data['message'] = 'yes';
  1486. echo json_encode($data);
  1487. } else {
  1488. //无修改
  1489. $data['message'] = 'no';
  1490. echo json_encode($data);
  1491. }
  1492. } else {
  1493. echo $this->returnData();
  1494. }
  1495. }
  1496. /**
  1497. * 反差列表
  1498. *
  1499. * @param $templateid []
  1500. * @return $type 消息类型
  1501. */
  1502. public function facha_list()
  1503. {
  1504. // 指定允许其他域名访问
  1505. header('Access-Control-Allow-Origin:*');
  1506. // 响应类型
  1507. header('Access-Control-Allow-Methods:POST');
  1508. // 响应头设置
  1509. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1510. if (!empty($_POST)) {
  1511. $token = $_POST['token'];
  1512. if ($token != 'b8e3bb6ef8747d7') {
  1513. $data['code'] = '203';
  1514. $data['msg'] = 'token错误';
  1515. echo json_encode($data);
  1516. die;
  1517. }
  1518. $page = $_POST['page'];
  1519. $size = $_POST['size'];
  1520. $facha_list = M("heiliao_haijiao_books")->where("book_type='FC'")->page($page, $size)->order("id desc")->select();
  1521. if ($facha_list) {
  1522. foreach ($facha_list as $key => $value) {
  1523. $img_list = $value['book'];
  1524. // echo PHP_EOL.$img_list;
  1525. $imgarr = explode(',', $img_list);
  1526. $video_list = $value['hj_video_url'];
  1527. // echo PHP_EOL.$img_list;
  1528. if (!$video_list) {
  1529. $videoarr = array();
  1530. }else {
  1531. $videoarr = explode(',', $video_list);
  1532. }
  1533. $facha_list[$key]['book'] = $imgarr;
  1534. $facha_list[$key]['hj_video_url'] = $videoarr;
  1535. }
  1536. $data['code'] = '200';
  1537. $data['status'] = '1';
  1538. $data['message'] = 'ok';
  1539. $data['amount'] = M("heiliao_haijiao_books")->where("book_type='FC'")->count();
  1540. $data['data'] = $facha_list;
  1541. echo json_encode($data);
  1542. } else {
  1543. $data['code'] = '200';
  1544. $data['status'] = '2';
  1545. $data['message'] = 'null';
  1546. $data['data'] = "";
  1547. echo json_encode($data);
  1548. }
  1549. } else {
  1550. echo $this->returnData();
  1551. }
  1552. }
  1553. /**
  1554. * 删除反差
  1555. *
  1556. * @param $templateid []
  1557. * @return $type 消息类型
  1558. */
  1559. public function delete_fancha_list()
  1560. {
  1561. // 指定允许其他域名访问
  1562. header('Access-Control-Allow-Origin:*');
  1563. // 响应类型
  1564. header('Access-Control-Allow-Methods:POST');
  1565. // 响应头设置
  1566. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1567. if (!empty($_POST)) {
  1568. $token = $_POST['token'];
  1569. if ($token != 'b8e3bb6ef8747d7') {
  1570. $data['code'] = '203';
  1571. $data['msg'] = 'token错误';
  1572. echo json_encode($data);
  1573. die;
  1574. }
  1575. $fc_id = $_POST['fc_id'];
  1576. $yn_de_books = M("heiliao_haijiao_books")->where("id=$fc_id")->delete();
  1577. $yn_de_list = M("video_list_test")->where("id=$fc_id")->delete();
  1578. if ($yn_de_books and $yn_de_list) {
  1579. $data['code'] = '200';
  1580. $data['status'] = '1';
  1581. $data['message'] = 'ok';
  1582. $data['data'] = "$fc_id";
  1583. echo json_encode($data);
  1584. } else {
  1585. $data['code'] = '200';
  1586. $data['status'] = '1';
  1587. $data['message'] = 'error';
  1588. $data['data'] = "$fc_id";
  1589. echo json_encode($data);
  1590. }
  1591. } else {
  1592. echo $this->returnData();
  1593. }
  1594. }
  1595. /**
  1596. * 反差详情
  1597. *
  1598. * @param $templateid []
  1599. * @return $type 消息类型
  1600. */
  1601. public function fancha_detail()
  1602. {
  1603. // 指定允许其他域名访问
  1604. header('Access-Control-Allow-Origin:*');
  1605. // 响应类型
  1606. header('Access-Control-Allow-Methods:POST');
  1607. // 响应头设置
  1608. header('Access-Control-Allow-Headers:x-requested-with,content-type');
  1609. if (!empty($_POST)) {
  1610. $fc_id = $_POST['fc_id'];
  1611. $facha_list = M("heiliao_haijiao_books")->where("book_id='$fc_id'")->field("site,book,hj_video_url")->select();
  1612. if ($facha_list) {
  1613. $book_list = $facha_list[0]['book'];
  1614. $book_vieo_list = $facha_list[0]['hj_video_url'];
  1615. $book_site = $facha_list[0]['site'];
  1616. $img_arr = explode(',', $book_list);
  1617. $video_arr = explode(',', $book_vieo_list);
  1618. $facha_list_arr['hj_video_url'] = $video_arr;
  1619. $facha_list_arr['book'] = $img_arr;
  1620. $facha_list_arr['site'] = $book_site;
  1621. $data['code'] = '200';
  1622. $data['status'] = '1';
  1623. $data['message'] = 'ok';
  1624. $data['data'] = $facha_list_arr;
  1625. echo json_encode($data);
  1626. } else {
  1627. $data['code'] = '200';
  1628. $data['status'] = '1';
  1629. $data['message'] = 'error';
  1630. $data['data'] = $facha_list;
  1631. echo json_encode($data);
  1632. }
  1633. } else {
  1634. echo $this->returnData();
  1635. }
  1636. }
  1637. /**
  1638. * 新增反差
  1639. *haohaohao
  1640. * @param $templateid []
  1641. * @return $type 消息类型
  1642. */
  1643. public function add_test_video()
  1644. {
  1645. header('Content-Type:text/json;charset=utf-8');
  1646. header('Access-Control-Allow-Origin:*');
  1647. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  1648. header('Access-Control-Allow-Methods:POST');
  1649. header('Access-Control-Expose-Headers:*');
  1650. if (!empty($_POST)) {
  1651. $img = $_FILES['img'];
  1652. $img = $_FILES['mp4'];
  1653. $token = $_POST['token']; //b8e3bb6ef8747d7
  1654. if ($token != 'b8e3bb6ef8747d7') {
  1655. $data['code'] = '203';
  1656. $data['msg'] = 'token错误';
  1657. echo json_encode($data);
  1658. die;
  1659. }
  1660. $title = $_POST['title'];
  1661. $uploadPath = '/home2/videos/one/FC/img/'; // 头图片和内容图片的上传目录
  1662. $videoPath = '/home2/videos/one/FC/videos/'; // 视频集合的上传目录
  1663. // 判断目标路径是否存在,如果不存在则创建
  1664. if (!file_exists($uploadPath)) {
  1665. mkdir($uploadPath, 0777, true);
  1666. }
  1667. if (!file_exists($videoPath)) {
  1668. mkdir($videoPath, 0777, true);
  1669. }
  1670. $config = array(
  1671. 'maxSize' => 0, // 设置附件上传大小
  1672. 'exts' => array('jpg', 'jpeg', 'png', 'gif'), // 设置图片上传类型
  1673. 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
  1674. );
  1675. $upload = new \Think\Upload($config); // 实例化图片上传类
  1676. // 上传头图片和内容图片
  1677. $infoImages = $upload->upload();
  1678. // 上传视频集合
  1679. $configVideo = array(
  1680. 'maxSize' => 0, // 设置视频上传大小(100MB)
  1681. 'exts' => array('mp4', 'avi', 'mkv', 'mov'), // 设置视频上传类型
  1682. 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
  1683. );
  1684. $uploadVideo = new \Think\Upload($configVideo); // 实例化视频上传类
  1685. // 上传视频集合
  1686. $infoVideo = $uploadVideo->upload();
  1687. // 上传成功,处理上传的文件信息
  1688. $imagePaths = ''; // 存储上传的图片文件路径
  1689. foreach ($infoImages as $key => $value) {
  1690. $savepath = $value['savepath'];
  1691. $savename = $value['savename'];
  1692. if ($key == 0) {
  1693. $fancha_list['head_img'] = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'];
  1694. }else{
  1695. $imgurl_list .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'] . ',';
  1696. $book_str .= "<img src='".'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename']."' alt=''>" ;
  1697. }
  1698. }
  1699. $imgurl_list_new = substr($imgurl_list, 0, -1);
  1700. $videoPaths = ''; // 存储上传的视频文件路径
  1701. foreach ($infoVideo as $file) {
  1702. $videoPaths .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $file['savepath'] . $file['savename'] . ',';
  1703. }
  1704. $videourl_list = substr($videoPaths, 0, -1);
  1705. //video_list_test
  1706. $video_list_detail['title'] = $title;
  1707. $video_list_detail['site'] = 'FC';
  1708. $video_list_detail['uploader'] = '素人反差';
  1709. $video_list_detail['add_time'] = time();
  1710. $video_list_detail['coins'] ="2";
  1711. $video_list_detail['top_img'] = $fancha_list['head_img'];
  1712. $video_list_detail['views'] = $this->randFloat(10.1,99);
  1713. $video_list_detail['thumbs_up'] = $this->randFloat(3.1, 9);
  1714. $ret = M("video_list_test")->add($video_list_detail);
  1715. if ($ret) {
  1716. // 如果主键是自动增长型 成功后返回值就是最新插入的值
  1717. //当前用户id
  1718. $insertId = $ret;
  1719. }
  1720. $fancha_list['book'] = $imgurl_list_new;
  1721. $fancha_list['book_str'] = $book_str;
  1722. $fancha_list['site'] = $title;
  1723. $fancha_list['hj_video_url'] = $videourl_list;
  1724. $fancha_list['id'] = $insertId;
  1725. $fancha_list['book_id'] = $insertId;
  1726. $fancha_list['book_type'] = "FC";
  1727. M("heiliao_haijiao_books")->add($fancha_list);
  1728. // 返回上传成功的文件路径
  1729. $this->ajaxReturn(array(
  1730. 'status' => 1,
  1731. 'message' => '上传成功',
  1732. 'data' => $fancha_list,
  1733. ));
  1734. } else {
  1735. echo $this->returnData();
  1736. }
  1737. }
  1738. function randFloat($min, $max)
  1739. {
  1740. if ($min >= $max) {
  1741. throw new \Exception('最大值必须大于最小值', 501);
  1742. }
  1743. $rand = $min + mt_rand() / mt_getrandmax() * ($max - $min);
  1744. return floatval(sprintf('%.1f', $rand));
  1745. }
  1746. /**
  1747. * 编辑反差
  1748. * @param $templateid []
  1749. * @return $type 消息类型
  1750. */
  1751. public function save_fancha_detail(){
  1752. header('Content-Type:text/json;charset=utf-8');
  1753. header('Access-Control-Allow-Origin:*');
  1754. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  1755. header('Access-Control-Allow-Methods:POST');
  1756. header('Access-Control-Expose-Headers:*');
  1757. if (!empty($_POST)) {
  1758. $token = $_POST['token']; //b8e3bb6ef8747d7
  1759. if ($token != 'b8e3bb6ef8747d7') {
  1760. $data['code'] = '203';
  1761. $data['msg'] = 'token错误';
  1762. echo json_encode($data);
  1763. die;
  1764. }
  1765. $img_list = $_POST['img[]'];
  1766. echo PHP_EOL.$img_list;
  1767. print_r($img_list);
  1768. $fc_id = $_POST['fc_id'];
  1769. $title = $_POST['title'];
  1770. $uploadPath = '/home2/videos/one/FC/img/'; // 头图片和内容图片的上传目录
  1771. $videoPath = '/home2/videos/one/FC/videos/'; // 视频集合的上传目录
  1772. // 判断目标路径是否存在,如果不存在则创建
  1773. if (!file_exists($uploadPath)) {
  1774. mkdir($uploadPath, 0777, true);
  1775. }
  1776. if (!file_exists($videoPath)) {
  1777. mkdir($videoPath, 0777, true);
  1778. }
  1779. $config = array(
  1780. 'maxSize' => 0, // 设置附件上传大小
  1781. 'exts' => array('jpg', 'jpeg', 'png', 'gif'), // 设置图片上传类型
  1782. 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
  1783. );
  1784. $upload = new \Think\Upload($config); // 实例化图片上传类
  1785. // 上传头图片和内容图片
  1786. $infoImages = $upload->upload();
  1787. // 上传视频集合
  1788. $configVideo = array(
  1789. 'maxSize' => 0, // 设置视频上传大小(100MB)
  1790. 'exts' => array('mp4', 'avi', 'mkv', 'mov'), // 设置视频上传类型
  1791. 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
  1792. );
  1793. $uploadVideo = new \Think\Upload($configVideo); // 实例化视频上传类
  1794. // 上传视频集合
  1795. $infoVideo = $uploadVideo->upload();
  1796. echo PHP_EOL.$infoImages;
  1797. echo PHP_EOL.$infoVideo;
  1798. print_r($infoImages);
  1799. print_r($infoVideo);
  1800. if (!$infoImages || !$infoVideo) {
  1801. $this->error($upload->getError());
  1802. $this->error($uploadVideo->getError());
  1803. } else {
  1804. // 上传成功,处理上传的文件信息
  1805. $imagePaths = ''; // 存储上传的图片文件路径
  1806. foreach ($infoImages as $key => $value) {
  1807. $savepath = $value['savepath'];
  1808. $savename = $value['savename'];
  1809. if ($key == 0) {
  1810. $fancha_list['head_img'] = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'];
  1811. }else{
  1812. $imgurl_list .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $value['savepath'] . $value['savename'] . ',';
  1813. }
  1814. }
  1815. $imgurl_list_new = substr($imgurl_list, 0, -1);
  1816. $videoPaths = ''; // 存储上传的视频文件路径
  1817. foreach ($infoVideo as $file) {
  1818. $videoPaths .= 'https://www.5uafocvs4xlibumya2.xyz/videos/one/FC/img/' . $file['savepath'] . $file['savename'] . ',';
  1819. }
  1820. $videourl_list = substr($videoPaths, 0, -1);
  1821. //video_list_test
  1822. $video_list_detail['title'] = $title;
  1823. $video_list_detail['coins'] = "2";
  1824. $video_list_detail['top_img'] = $fancha_list['head_img'];
  1825. $video_list_detail['views'] = $this->randFloat(10.1,99);
  1826. $video_list_detail['thumbs_up'] = $this->randFloat(3.1, 9);
  1827. M("video_list_test")->where("id=$fc_id")->save($video_list_detail);
  1828. $fancha_list['book'] = $imgurl_list_new;
  1829. $fancha_list['site'] = $title;
  1830. $fancha_list['hj_video_url'] = $videourl_list;
  1831. M("heiliao_haijiao_books")->where("id=$fc_id")->save($fancha_list);
  1832. // 返回上传成功的文件路径
  1833. $this->ajaxReturn(array(
  1834. 'status' => 1,
  1835. 'message' => '上传成功',
  1836. 'data' => $fancha_list,
  1837. ));
  1838. }
  1839. } else {
  1840. echo $this->returnData();
  1841. }
  1842. }
  1843. /**
  1844. * 测试功能
  1845. * @param $templateid []
  1846. * @return $type 消息类型
  1847. */
  1848. public function test_img(){
  1849. header('Content-Type:text/json;charset=utf-8');
  1850. header('Access-Control-Allow-Origin:*');
  1851. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  1852. header('Access-Control-Allow-Methods:POST');
  1853. header('Access-Control-Expose-Headers:*');
  1854. $img = $_FILES['images'];
  1855. // 获取请求中的所有`form-data`数据
  1856. $formData = I('post.');
  1857. // 将数据转换为JSON格式
  1858. $jsonData = json_encode($formData);
  1859. // 设置响应头,指定返回的是JSON数据
  1860. header('Content-Type: application/json');
  1861. // 输出JSON数据
  1862. echo $jsonData;
  1863. $config = array(
  1864. 'maxSize' => 0, // 设置附件上传大小
  1865. 'exts' => array('jpg', 'jpeg', 'png', 'gif'), // 设置图片上传类型
  1866. 'rootPath' => '/home2/videos/one/FC/img/', // 设置附件上传根目录
  1867. );
  1868. $upload = new \Think\Upload($config); // 实例化图片上传类
  1869. // 上传头图片和内容图片
  1870. $infoImages = $upload->upload();
  1871. if (!$infoImages) {
  1872. // 上传失败
  1873. $this->ajaxReturn(array('status' => 0, 'message' => '上传失败', 'error' => $upload->getError()));
  1874. } else {
  1875. echo PHP_EOL.'成功';
  1876. }
  1877. }
  1878. /**
  1879. * 版本:
  1880. * 新增/更新:
  1881. * 简述:
  1882. * @param $templateid []
  1883. * @return $type 消息类型
  1884. */
  1885. public function ceshi_shuzu(){
  1886. header('Content-Type:text/json;charset=utf-8');
  1887. header('Access-Control-Allow-Origin:*');
  1888. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  1889. header('Access-Control-Allow-Methods:POST');
  1890. header('Access-Control-Expose-Headers:*');
  1891. if (!empty($_POST)){
  1892. $user_info_list = M('user_info');
  1893. $user_novip = $user_info_list->where("vip_yn=0 ")->field('id')->select();
  1894. var_dump($user_novip);
  1895. }else{
  1896. echo $this->returnData();
  1897. }
  1898. }
  1899. /**
  1900. * 充值数据
  1901. * @param $templateid []
  1902. * @return $type 消息类型
  1903. */
  1904. public function pay_shuju(){
  1905. if (!empty($_POST)){
  1906. header('Content-Type:text/json;charset=utf-8');
  1907. header('Access-Control-Allow-Origin:*');
  1908. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  1909. header('Access-Control-Allow-Methods:POST');
  1910. header('Access-Control-Expose-Headers:*');
  1911. $token = $_POST['token']; //b8e3bb6ef8747d7
  1912. if ($token != 'b8e3bb6ef8747d7') {
  1913. $data['code'] = '203';
  1914. $data['msg'] = 'token错误';
  1915. echo json_encode($data);
  1916. die;
  1917. }
  1918. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  1919. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  1920. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  1921. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  1922. $todayTimestamp = time(); // 获取当前时间戳
  1923. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  1924. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  1925. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  1926. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  1927. $zhou_end_time = time();
  1928. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  1929. $yue_end_time = time();
  1930. $pay_list_table = M('huidiao_test');
  1931. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->count("DISTINCT uid");
  1932. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->count("DISTINCT uid");
  1933. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->count("DISTINCT uid");
  1934. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time ")->count("DISTINCT uid");
  1935. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time ")->count("DISTINCT uid");
  1936. $arr['jilei_pay_num'] = $pay_list_table->where("id>0")->count("DISTINCT uid");
  1937. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time")->sum('amount');
  1938. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->sum('amount');
  1939. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->sum('amount');
  1940. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time")->sum('amount');
  1941. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time")->sum('amount');
  1942. $arrs['jilei_amount'] =$pay_list_table->where("time is not null")->sum('amount');
  1943. $arr_list = array($arr,$arrs);
  1944. $data['code'] = '200';
  1945. $data['status'] = '1';
  1946. $data['data'] =$arr_list;
  1947. echo json_encode($data);
  1948. }else{
  1949. echo $this->returnData();
  1950. }
  1951. }
  1952. /**
  1953. * 会员数据
  1954. * @param $templateid []
  1955. * @return $type 消息类型
  1956. */
  1957. public function huiyuan_shuju(){
  1958. header('Content-Type:text/json;charset=utf-8');
  1959. header('Access-Control-Allow-Origin:*');
  1960. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  1961. header('Access-Control-Allow-Methods:POST');
  1962. header('Access-Control-Expose-Headers:*');
  1963. if (!empty($_POST)){
  1964. $token = $_POST['token']; //b8e3bb6ef8747d7
  1965. if ($token != 'b8e3bb6ef8747d7') {
  1966. $data['code'] = '203';
  1967. $data['msg'] = 'token错误';
  1968. echo json_encode($data);
  1969. die;
  1970. }
  1971. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  1972. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  1973. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  1974. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  1975. $todayTimestamp = time(); // 获取当前时间戳
  1976. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  1977. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  1978. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  1979. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  1980. $zhou_end_time = time();
  1981. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  1982. $yue_end_time = time();
  1983. $pay_list_table = M('vip_add_list');
  1984. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->count("DISTINCT uid");
  1985. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->count("DISTINCT uid");
  1986. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->count("DISTINCT uid");
  1987. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time ")->count("DISTINCT uid");
  1988. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time ")->count("DISTINCT uid");
  1989. $arr['jilei_pay_num'] = $pay_list_table->where("id>0")->count("DISTINCT uid");
  1990. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time")->sum('amount');
  1991. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->sum('amount');
  1992. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->sum('amount');
  1993. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time")->sum('amount');
  1994. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time")->sum('amount');
  1995. $arrs['jilei_amount'] =$pay_list_table->where("time is not null")->sum('amount');
  1996. if (empty($arr['jinri_pay_num'] )) {
  1997. $arrs['jinri_amount'] = "0";
  1998. }
  1999. if (empty($arrs['jinri_amount'] )) {
  2000. $arrs['jinri_amount'] = "0";
  2001. }
  2002. $arr_list = array($arr,$arrs);
  2003. $data['code'] = '200';
  2004. $data['status'] = '1';
  2005. $data['data'] =$arr_list;
  2006. echo json_encode($data);
  2007. }else{
  2008. echo $this->returnData();
  2009. }
  2010. }
  2011. /**
  2012. * 海角数据
  2013. * @param $templateid []
  2014. * @return $type 消息类型
  2015. */
  2016. public function haijiao_shuju(){
  2017. header('Content-Type:text/json;charset=utf-8');
  2018. header('Access-Control-Allow-Origin:*');
  2019. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2020. header('Access-Control-Allow-Methods:POST');
  2021. header('Access-Control-Expose-Headers:*');
  2022. if (!empty($_POST)){
  2023. $token = $_POST['token']; //b8e3bb6ef8747d7
  2024. if ($token != 'b8e3bb6ef8747d7') {
  2025. $data['code'] = '203';
  2026. $data['msg'] = 'token错误';
  2027. echo json_encode($data);
  2028. die;
  2029. }
  2030. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  2031. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  2032. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  2033. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  2034. $todayTimestamp = time(); // 获取当前时间戳
  2035. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  2036. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  2037. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  2038. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  2039. $zhou_end_time = time();
  2040. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  2041. $yue_end_time = time();
  2042. $data['code'] = '200';
  2043. $data['status'] = '1';
  2044. $data['message'] = '';
  2045. echo json_encode($data);
  2046. }else{
  2047. echo $this->returnData();
  2048. }
  2049. }
  2050. /**
  2051. * 反差数据
  2052. * @param $templateid []
  2053. * @return $type 消息类型
  2054. */
  2055. public function fancha_shuju(){
  2056. header('Content-Type:text/json;charset=utf-8');
  2057. header('Access-Control-Allow-Origin:*');
  2058. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2059. header('Access-Control-Allow-Methods:POST');
  2060. header('Access-Control-Expose-Headers:*');
  2061. if (!empty($_POST)){
  2062. $token = $_POST['token']; //b8e3bb6ef8747d7
  2063. if ($token != 'b8e3bb6ef8747d7') {
  2064. $data['code'] = '203';
  2065. $data['msg'] = 'token错误';
  2066. echo json_encode($data);
  2067. die;
  2068. }
  2069. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  2070. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  2071. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  2072. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  2073. $todayTimestamp = time(); // 获取当前时间戳
  2074. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  2075. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  2076. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  2077. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  2078. $zhou_end_time = time();
  2079. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  2080. $yue_end_time = time();
  2081. $pay_list_table = M('hj_fc_buy_record');
  2082. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->count("DISTINCT uid");
  2083. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->count("DISTINCT uid");
  2084. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->count("DISTINCT uid");
  2085. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time ")->count("DISTINCT uid");
  2086. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time ")->count("DISTINCT uid");
  2087. $arr['jilei_pay_num'] = $pay_list_table->where("id>0")->count("DISTINCT uid");
  2088. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time")->sum('coins');
  2089. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time")->sum('coins');
  2090. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time")->sum('coins');
  2091. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time")->sum('coins');
  2092. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time")->sum('coins');
  2093. $arrs['jilei_amount'] =$pay_list_table->where("time is not null")->sum('coins');
  2094. if (empty($arrs['jinri_amount'])) {
  2095. $arrs['jinri_amount'] = "0";
  2096. }
  2097. $arr_list = array($arr,$arrs);
  2098. $data['code'] = '200';
  2099. $data['status'] = '1';
  2100. $data['data'] =$arr_list;
  2101. echo json_encode($data);
  2102. }else{
  2103. echo $this->returnData();
  2104. }
  2105. }
  2106. /**
  2107. * 测试功能
  2108. * @param $templateid []
  2109. * @return $type 消息类型
  2110. */
  2111. public function fankui_list_show(){
  2112. header('Content-Type:text/json;charset=utf-8');
  2113. header('Access-Control-Allow-Origin:*');
  2114. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2115. header('Access-Control-Allow-Methods:POST');
  2116. header('Access-Control-Expose-Headers:*');
  2117. if (!empty($_POST)) {
  2118. $token = $_POST['token']; //b8e3bb6ef8747d7
  2119. if ($token != 'b8e3bb6ef8747d7') {
  2120. $data['code'] = '203';
  2121. $data['msg'] = 'token错误';
  2122. echo json_encode($data);
  2123. die;
  2124. }
  2125. $page = $_POST['page'];
  2126. $size = $_POST['size'];
  2127. $fankui_list = M("user_fankui")->where("id >0")->field("id,user_content,user_date,type")->page($page, $size)->order("id desc")->select();
  2128. $all_fankui_count = M("user_fankui")->where("id >0")->count();
  2129. if ($fankui_list) {
  2130. $data['code'] = '200';
  2131. $data['status'] = '1';
  2132. $data['message'] = 'ok';
  2133. $data['data'] =$fankui_list;
  2134. $data['all_count'] =$all_fankui_count;
  2135. echo json_encode($data);
  2136. }else{
  2137. $data['code'] = '200';
  2138. $data['status'] = '1';
  2139. $data['message'] = 'null';
  2140. $data['data'] =array();
  2141. $data['all_count'] =$all_fankui_count;
  2142. echo json_encode($data);
  2143. }
  2144. }else{
  2145. echo $this->returnData();
  2146. }
  2147. }
  2148. /**
  2149. * 回复
  2150. * @param $templateid []
  2151. * @return $type 消息类型
  2152. */
  2153. public function huifu_user_fankui(){
  2154. header('Content-Type:text/json;charset=utf-8');
  2155. header('Access-Control-Allow-Origin:*');
  2156. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2157. header('Access-Control-Allow-Methods:POST');
  2158. header('Access-Control-Expose-Headers:*');
  2159. if (!empty($_POST)){
  2160. $token = $_POST['token']; //b8e3bb6ef8747d7
  2161. if ($token != 'b8e3bb6ef8747d7') {
  2162. $data['code'] = '203';
  2163. $data['msg'] = 'token错误';
  2164. echo json_encode($data);
  2165. die;
  2166. }
  2167. $id = $_POST['id'];
  2168. $admin_content = $_POST['admin_content'];
  2169. $time_chuo = time();
  2170. $time_data= date("Y-m-d H:i",$time_chuo);
  2171. $fankui_info['admin_content'] = $admin_content;
  2172. $fankui_info['admin_date'] = $time_data;
  2173. $fankui_info['admin_time'] = $time_chuo;
  2174. $fankui_info['type']=2;
  2175. $admin_huifu =M("user_fankui")->where("id=$id")->save($fankui_info);
  2176. if ($admin_huifu) {
  2177. $data['code'] = '200';
  2178. $data['status'] = '1';
  2179. $data['message'] = 'ok';
  2180. echo json_encode($data);
  2181. }else{
  2182. $data['code'] = '200';
  2183. $data['status'] = '2';
  2184. $data['message'] = 'error';
  2185. echo json_encode($data);
  2186. }
  2187. }else{
  2188. echo $this->returnData();
  2189. }
  2190. }
  2191. /**
  2192. * SMshuju
  2193. * @param $templateid []
  2194. * @return $type 消息类型
  2195. */
  2196. public function sm_shuju(){
  2197. header('Content-Type:text/json;charset=utf-8');
  2198. header('Access-Control-Allow-Origin:*');
  2199. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2200. header('Access-Control-Allow-Methods:POST');
  2201. header('Access-Control-Expose-Headers:*');
  2202. if (!empty($_POST)){
  2203. $token = $_POST['token']; //b8e3bb6ef8747d7
  2204. if ($token != 'b8e3bb6ef8747d7') {
  2205. $data['code'] = '203';
  2206. $data['msg'] = 'token错误';
  2207. echo json_encode($data);
  2208. die;
  2209. }
  2210. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  2211. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  2212. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  2213. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  2214. $todayTimestamp = time(); // 获取当前时间戳
  2215. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  2216. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  2217. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  2218. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  2219. $zhou_end_time = time();
  2220. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  2221. $yue_end_time = time();
  2222. $pay_list_table = M('hj_fc_buy_record');
  2223. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='sm'")->count("DISTINCT uid");
  2224. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='sm'")->count("DISTINCT uid");
  2225. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='sm'")->count("DISTINCT uid");
  2226. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='sm'")->count("DISTINCT uid");
  2227. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='sm'")->count("DISTINCT uid");
  2228. $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='sm'")->count("DISTINCT uid");
  2229. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='sm'")->sum('coins');
  2230. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='sm'")->sum('coins');
  2231. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='sm'")->sum('coins');
  2232. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='sm'")->sum('coins');
  2233. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='sm'")->sum('coins');
  2234. $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='sm'")->sum('coins');
  2235. if (empty($arrs['jinri_amount'])) {
  2236. $arrs['jinri_amount'] = "0";
  2237. }
  2238. if (empty($arrs['zuori_amount'])) {
  2239. $arrs['zuori_amount']= "0";
  2240. }
  2241. if (empty( $arrs['sanri_amount'] )) {
  2242. $arrs['sanri_amount'] = "0";
  2243. }
  2244. if (empty($arrs['zhou_amount'])) {
  2245. $arrs['zhou_amount']= "0";
  2246. }
  2247. if (empty($arrs['yue_amount'])) {
  2248. $arrs['yue_amount'] = "0";
  2249. }
  2250. if (empty($arrs['jilei_amount'] )) {
  2251. $arrs['jilei_amount'] = "0";
  2252. }
  2253. $arr_list = array($arr,$arrs);
  2254. $data['code'] = '200';
  2255. $data['status'] = '1';
  2256. $data['data'] =$arr_list;
  2257. echo json_encode($data);
  2258. }else{
  2259. echo $this->returnData();
  2260. }
  2261. }
  2262. /**
  2263. * wanoushuju
  2264. * @param $templateid []
  2265. * @return $type 消息类型
  2266. */
  2267. public function wanou_shuju(){
  2268. header('Content-Type:text/json;charset=utf-8');
  2269. header('Access-Control-Allow-Origin:*');
  2270. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2271. header('Access-Control-Allow-Methods:POST');
  2272. header('Access-Control-Expose-Headers:*');
  2273. if (!empty($_POST)){
  2274. $token = $_POST['token']; //b8e3bb6ef8747d7
  2275. if ($token != 'b8e3bb6ef8747d7') {
  2276. $data['code'] = '203';
  2277. $data['msg'] = 'token错误';
  2278. echo json_encode($data);
  2279. die;
  2280. }
  2281. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  2282. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  2283. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  2284. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  2285. $todayTimestamp = time(); // 获取当前时间戳
  2286. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  2287. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  2288. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  2289. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  2290. $zhou_end_time = time();
  2291. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  2292. $yue_end_time = time();
  2293. $pay_list_table = M('hj_fc_buy_record');
  2294. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='wanou' ")->count("DISTINCT uid");
  2295. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='wanou'")->count("DISTINCT uid");
  2296. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='wanou'")->count("DISTINCT uid");
  2297. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='wanou' ")->count("DISTINCT uid");
  2298. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='wanou'")->count("DISTINCT uid");
  2299. $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='wanou'")->count("DISTINCT uid");
  2300. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='wanou'")->sum('coins');
  2301. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='wanou'")->sum('coins');
  2302. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='wanou'")->sum('coins');
  2303. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='wanou'")->sum('coins');
  2304. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='wanou'")->sum('coins');
  2305. $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='wanou'")->sum('coins');
  2306. if (empty($arrs['jinri_amount'])) {
  2307. $arrs['jinri_amount'] = "0";
  2308. }
  2309. if (empty($arrs['zuori_amount'])) {
  2310. $arrs['zuori_amount']= "0";
  2311. }
  2312. if (empty( $arrs['sanri_amount'] )) {
  2313. $arrs['sanri_amount'] = "0";
  2314. }
  2315. if (empty($arrs['zhou_amount'])) {
  2316. $arrs['zhou_amount']= "0";
  2317. }
  2318. if (empty($arrs['yue_amount'])) {
  2319. $arrs['yue_amount'] = "0";
  2320. }
  2321. if (empty($arrs['jilei_amount'] )) {
  2322. $arrs['jilei_amount'] = "0";
  2323. }
  2324. $arr_list = array($arr,$arrs);
  2325. $data['code'] = '200';
  2326. $data['status'] = '1';
  2327. $data['data'] =$arr_list;
  2328. echo json_encode($data);
  2329. }else{
  2330. echo $this->returnData();
  2331. }
  2332. }
  2333. /**
  2334. * avjieshuoshuju
  2335. * @param $templateid []
  2336. * @return $type 消息类型
  2337. */
  2338. public function avjieshuo_shuju(){
  2339. header('Content-Type:text/json;charset=utf-8');
  2340. header('Access-Control-Allow-Origin:*');
  2341. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2342. header('Access-Control-Allow-Methods:POST');
  2343. header('Access-Control-Expose-Headers:*');
  2344. if (!empty($_POST)){
  2345. $token = $_POST['token']; //b8e3bb6ef8747d7
  2346. if ($token != 'b8e3bb6ef8747d7') {
  2347. $data['code'] = '203';
  2348. $data['msg'] = 'token错误';
  2349. echo json_encode($data);
  2350. die;
  2351. }
  2352. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  2353. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  2354. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  2355. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  2356. $todayTimestamp = time(); // 获取当前时间戳
  2357. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  2358. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  2359. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  2360. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  2361. $zhou_end_time = time();
  2362. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  2363. $yue_end_time = time();
  2364. $pay_list_table = M('hj_fc_buy_record');
  2365. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='av'")->count("DISTINCT uid");
  2366. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='av'")->count("DISTINCT uid");
  2367. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='av'")->count("DISTINCT uid");
  2368. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='av'")->count("DISTINCT uid");
  2369. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='av'")->count("DISTINCT uid");
  2370. $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='av'")->count("DISTINCT uid");
  2371. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='av'")->sum('coins');
  2372. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='av'")->sum('coins');
  2373. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='av'")->sum('coins');
  2374. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='av'")->sum('coins');
  2375. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='av'")->sum('coins');
  2376. $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='av'")->sum('coins');
  2377. if (empty($arrs['jinri_amount'])) {
  2378. $arrs['jinri_amount'] = "0";
  2379. }
  2380. if (empty($arrs['zuori_amount'])) {
  2381. $arrs['zuori_amount']= "0";
  2382. }
  2383. if (empty( $arrs['sanri_amount'] )) {
  2384. $arrs['sanri_amount'] = "0";
  2385. }
  2386. if (empty($arrs['zhou_amount'])) {
  2387. $arrs['zhou_amount']= "0";
  2388. }
  2389. if (empty($arrs['yue_amount'])) {
  2390. $arrs['yue_amount'] = "0";
  2391. }
  2392. if (empty($arrs['jilei_amount'] )) {
  2393. $arrs['jilei_amount'] = "0";
  2394. }
  2395. $arr_list = array($arr,$arrs);
  2396. $data['code'] = '200';
  2397. $data['status'] = '1';
  2398. $data['data'] =$arr_list;
  2399. echo json_encode($data);
  2400. }else{
  2401. echo $this->returnData();
  2402. }
  2403. }
  2404. /**
  2405. * tianmeiluolishuju
  2406. * @param $templateid []
  2407. * @return $type 消息类型
  2408. */
  2409. public function tianmeiluoli_shuju(){
  2410. header('Content-Type:text/json;charset=utf-8');
  2411. header('Access-Control-Allow-Origin:*');
  2412. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2413. header('Access-Control-Allow-Methods:POST');
  2414. header('Access-Control-Expose-Headers:*');
  2415. if (!empty($_POST)){
  2416. $token = $_POST['token']; //b8e3bb6ef8747d7
  2417. if ($token != 'b8e3bb6ef8747d7') {
  2418. $data['code'] = '203';
  2419. $data['msg'] = 'token错误';
  2420. echo json_encode($data);
  2421. die;
  2422. }
  2423. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  2424. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  2425. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  2426. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  2427. $todayTimestamp = time(); // 获取当前时间戳
  2428. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  2429. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  2430. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  2431. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  2432. $zhou_end_time = time();
  2433. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  2434. $yue_end_time = time();
  2435. $pay_list_table = M('hj_fc_buy_record');
  2436. $arr['jinri_pay_num'] = $pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='luoli' ")->count("DISTINCT uid");
  2437. $arr['zuori_pay_num'] = $pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='luoli'")->count("DISTINCT uid");
  2438. $arr['sanri_pay_num'] = $pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='luoli'")->count("DISTINCT uid");
  2439. $arr['zhou_pay_num'] = $pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='luoli'")->count("DISTINCT uid");
  2440. $arr['yue_pay_num'] = $pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='luoli'")->count("DISTINCT uid");
  2441. $arr['jilei_pay_num'] = $pay_list_table->where("id>0 and type='luoli'")->count("DISTINCT uid");
  2442. $arrs['jinri_amount'] =$pay_list_table->where("time BETWEEN $jinri_start_time and $jinri_end_time and type='luoli'")->sum('coins');
  2443. $arrs['zuori_amount'] =$pay_list_table->where("time BETWEEN $zuo_start_time and $zuo_end_time and type='luoli'")->sum('coins');
  2444. $arrs['sanri_amount'] =$pay_list_table->where("time BETWEEN $san_start_time and $san_end_time and type='luoli'")->sum('coins');
  2445. $arrs['zhou_amount'] =$pay_list_table->where("time BETWEEN $zhou_start_time and $zhou_end_time and type='luoli'")->sum('coins');
  2446. $arrs['yue_amount'] =$pay_list_table->where("time BETWEEN $yue_start_time and $yue_end_time and type='luoli'")->sum('coins');
  2447. $arrs['jilei_amount'] =$pay_list_table->where("time is not null and type='luoli'")->sum('coins');
  2448. if (empty($arrs['jinri_amount'])) {
  2449. $arrs['jinri_amount'] = "0";
  2450. }
  2451. if (empty($arrs['zuori_amount'])) {
  2452. $arrs['zuori_amount']= "0";
  2453. }
  2454. if (empty( $arrs['sanri_amount'] )) {
  2455. $arrs['sanri_amount'] = "0";
  2456. }
  2457. if (empty($arrs['zhou_amount'])) {
  2458. $arrs['zhou_amount']= "0";
  2459. }
  2460. if (empty($arrs['yue_amount'])) {
  2461. $arrs['yue_amount'] = "0";
  2462. }
  2463. if (empty($arrs['jilei_amount'] )) {
  2464. $arrs['jilei_amount'] = "0";
  2465. }
  2466. $arr_list = array($arr,$arrs);
  2467. $data['code'] = '200';
  2468. $data['status'] = '1';
  2469. $data['data'] =$arr_list;
  2470. echo json_encode($data);
  2471. }else{
  2472. echo $this->returnData();
  2473. }
  2474. }
  2475. /**
  2476. * 版本:1.7
  2477. * 新增/更新:add
  2478. * 简述:look the name
  2479. * @param $templateid []
  2480. * @return $type 消息类型
  2481. */
  2482. public function show_gonggao_list(){
  2483. header('Content-Type:text/json;charset=utf-8');
  2484. header('Access-Control-Allow-Origin:*');
  2485. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2486. header('Access-Control-Allow-Methods:POST');
  2487. header('Access-Control-Expose-Headers:*');
  2488. if (!empty($_POST)){
  2489. $token = $_POST['token'];
  2490. if ($token != 'b8e3bb6ef8747d7') {
  2491. $data['code'] = '203';
  2492. $data['msg'] = 'token错误';
  2493. echo json_encode($data);
  2494. die;
  2495. }
  2496. $all_gonggao = M("gonggao")->where("id>0")->select();
  2497. if ($all_gonggao){
  2498. $data['code'] = '200';
  2499. $data['status'] = '1';
  2500. $data['message'] = 'ok';
  2501. $data['data'] = $all_gonggao;
  2502. echo json_encode($data);
  2503. }else{
  2504. }
  2505. }else{
  2506. echo $this->returnData();
  2507. }
  2508. }
  2509. /**
  2510. * 版本:1.7
  2511. * 新增/更新:新增
  2512. * 简述:更新公告内容
  2513. * @param $templateid []
  2514. * @return $type 消息类型
  2515. */
  2516. public function save_gonggao_content(){
  2517. header('Content-Type:text/json;charset=utf-8');
  2518. header('Access-Control-Allow-Origin:*');
  2519. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2520. header('Access-Control-Allow-Methods:POST');
  2521. header('Access-Control-Expose-Headers:*');
  2522. if (!empty($_POST)){
  2523. $id = $_POST['id'];
  2524. $content = $_POST['content'];
  2525. $yn_save = M("gonggao")->where("id=$id")->save($_POST);
  2526. if ($yn_save){
  2527. $data['code'] = '200';
  2528. $data['status'] = '1';
  2529. $data['message'] = 'save_ok';
  2530. echo json_encode($data);
  2531. }else{
  2532. $data['code'] = '200';
  2533. $data['status'] = '2';
  2534. $data['message'] = 'no_save';
  2535. echo json_encode($data);
  2536. }
  2537. }else{
  2538. echo $this->returnData();
  2539. }
  2540. }
  2541. /**
  2542. * 版本:1.7
  2543. * 新增/更新:新增
  2544. * 简述:启用公告将其他公告关闭
  2545. * @param $templateid []
  2546. * @return $type 消息类型
  2547. */
  2548. public function open_gonggao(){
  2549. header('Content-Type:text/json;charset=utf-8');
  2550. header('Access-Control-Allow-Origin:*');
  2551. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2552. header('Access-Control-Allow-Methods:POST');
  2553. header('Access-Control-Expose-Headers:*');
  2554. if (!empty($_POST)){
  2555. $id= $_POST['id'];
  2556. $zero['type']= 0;
  2557. $one['type']= 1;
  2558. $one_yn = M("gonggao")->where("id=$id")->save($one);
  2559. $zero_yn =M("gonggao")->where("id!=$id")->save($zero);
  2560. if ($one_yn and $zero_yn){
  2561. $data['code'] = '200';
  2562. $data['status'] = '1';
  2563. $data['message'] = 'save_ok';
  2564. echo json_encode($data);
  2565. }else{
  2566. $data['code'] = '200';
  2567. $data['status'] = '2';
  2568. $data['message'] = 'no_save';
  2569. echo json_encode($data);
  2570. }
  2571. }else{
  2572. echo $this->returnData();
  2573. }
  2574. }
  2575. /**
  2576. * 版本:1.7
  2577. * 新增/更新:新增
  2578. * 简述:add gonggao
  2579. * @param $templateid []
  2580. * @return $type 消息类型
  2581. */
  2582. public function add_gonggao(){
  2583. header('Content-Type:text/json;charset=utf-8');
  2584. header('Access-Control-Allow-Origin:*');
  2585. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2586. header('Access-Control-Allow-Methods:POST');
  2587. header('Access-Control-Expose-Headers:*');
  2588. if (!empty($_POST)){
  2589. $content = $_POST['content'];
  2590. $add_yn = M("gonggao")->add($_POST);
  2591. if ($add_yn){
  2592. $data['code'] = '200';
  2593. $data['status'] = '1';
  2594. $data['message'] = 'ok';
  2595. echo json_encode($data);
  2596. }else{
  2597. $data['code'] = '200';
  2598. $data['status'] = '2';
  2599. $data['message'] = 'error';
  2600. echo json_encode($data);
  2601. }
  2602. }else{
  2603. echo $this->returnData();
  2604. }
  2605. }
  2606. /**
  2607. * 版本:1.7
  2608. * 新增/更新:新增
  2609. * 简述:delete gonggao
  2610. * @param $templateid []
  2611. * @return $type 消息类型
  2612. */
  2613. public function delete_gonggao(){
  2614. header('Content-Type:text/json;charset=utf-8');
  2615. header('Access-Control-Allow-Origin:*');
  2616. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2617. header('Access-Control-Allow-Methods:POST');
  2618. header('Access-Control-Expose-Headers:*');
  2619. if (!empty($_POST)){
  2620. $id = $_POST['id'];
  2621. $yn_de = M("gonggao")->where("id=$id")->delete();
  2622. if ($yn_de){
  2623. $data['code'] = '200';
  2624. $data['status'] = '1';
  2625. $data['message'] = 'ok';
  2626. echo json_encode($data);
  2627. }else{
  2628. $data['code'] = '200';
  2629. $data['status'] = '2';
  2630. $data['message'] = 'error';
  2631. echo json_encode($data);
  2632. }
  2633. }else{
  2634. echo $this->returnData();
  2635. }
  2636. }
  2637. /**
  2638. * 版本:
  2639. * 新增/更新:
  2640. * 简述:
  2641. * @param $templateid []
  2642. * @return $type 消息类型
  2643. */
  2644. public function video_count_tongjiss(){
  2645. header('Content-Type:text/json;charset=utf-8');
  2646. header('Access-Control-Allow-Origin:*');
  2647. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2648. header('Access-Control-Allow-Methods:POST');
  2649. header('Access-Control-Expose-Headers:*');
  2650. if (!empty($_POST)){
  2651. $token = $_POST['token'];
  2652. if ($token != 'b8e3bb6ef8747d7') {
  2653. $data['code'] = '203';
  2654. $data['msg'] = 'token错误';
  2655. echo json_encode($data);
  2656. die;
  2657. }
  2658. $page = $_POST['page'];
  2659. $size = $_POST['size'];
  2660. // $type_list_all =array(
  2661. // array('欧美','亚洲','动漫','素人反差'),
  2662. // array('黑料','网爆门','海角乱伦','麻豆传媒'),
  2663. // array('探花大神','SM调教','AI换脸','另类猎奇'),
  2664. // array('雪白美乳','玩偶姐姐','AV解说','甜美萝莉'),
  2665. // );
  2666. $seven_time_chuo = time() - (7 * 24 * 3600);
  2667. switch ($page) {
  2668. case '1':
  2669. $oumei_count = M("video_list_test")->where("id>0 and site='EUA'")->count();
  2670. $asian_count = M("video_list_test")->where("id>0 and site='Asian'")->count();
  2671. $dongman_count = M("video_list_test")->where("id>0 and site='Anime' or site='动画'")->count();
  2672. $fancha_count = M("video_list_test")->where("id>0 and site='FC'")->count();
  2673. $oumei_count_zhou = M("video_list_test")->where("id>0 and site='EUA' and add_time>'$seven_time_chuo'")->count();
  2674. $asian_countzhou = M("video_list_test")->where("id>0 and site='Asian' and add_time>'$seven_time_chuo'")->count();
  2675. $dongman_countzhou = M("video_list_test")->where("id>0 and site in('Anime','动画') and add_time>'$seven_time_chuo'")->count();
  2676. $fancha_countzhou = M("video_list_test")->where("id>0 and site='FC' and add_time>'$seven_time_chuo'")->count();
  2677. $oumei_list= array('name'=>'欧美','zhou'=>"$oumei_count_zhou",'all'=>"$oumei_count");
  2678. $asian_list= array('name'=>'亚洲','zhou'=>"$asian_countzhou",'all'=>"$asian_count");
  2679. $donman_list= array('name'=>'动漫','zhou'=>"$dongman_countzhou",'all'=>"$dongman_count");
  2680. $fancha_list= array('name'=>'反差','zhou'=>"$fancha_countzhou",'all'=>"$fancha_count");
  2681. $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
  2682. break;
  2683. case '2':
  2684. $heiliao = M("video_list_test")->where("id>0 and site='HL'")->count();
  2685. $wangbao = M("video_list_test")->where("id>0 and site='WB'")->count();
  2686. $haijiaoluanlun = M("video_list_test")->where("id>0 and site='HJ'")->count();
  2687. $madou = M("video_list_test")->where("id>0 and site='麻豆传媒'")->count();
  2688. $heiliaozhou = M("video_list_test")->where("id>0 and site='HL' and add_time>'$seven_time_chuo'")->count();
  2689. $wangbaozhou = M("video_list_test")->where("id>0 and site='WB' and add_time>'$seven_time_chuo'")->count();
  2690. $haijiaoluanlunzhou = M("video_list_test")->where("id>0 and site='HJ' and add_time>'$seven_time_chuo'")->count();
  2691. $madouzhou = M("video_list_test")->where("id>0 and site='麻豆传媒' and add_time>'$seven_time_chuo'")->count();
  2692. $oumei_list= array('name'=>'黑料','zhou'=>"$heiliaozhou",'all'=>"$heiliao");
  2693. $asian_list= array('name'=>'网爆门','zhou'=>"$wangbaozhou",'all'=>"$wangbao");
  2694. $donman_list= array('name'=>'海角乱伦','zhou'=>"$haijiaoluanlunzhou",'all'=>"$haijiaoluanlun");
  2695. $fancha_list= array('name'=>'麻豆传媒','zhou'=>"$madouzhou",'all'=>"$madouzhou");
  2696. $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
  2697. break;
  2698. case '3':
  2699. $tanhua = M("video_list_test")->where("id>0 and site='国产探花'")->count();
  2700. $smtiaojiao = M("video_list_test")->where("id>0 and site='SM调教'")->count();
  2701. $aihuanlian = M("video_list_test")->where("id>0 and site='AI'")->count();
  2702. $linglei = M("video_list_test")->where("id>0 and site='孕妇做爱' or site='性感人妖' or site='人兽动物' or site='超级大胆' or site='另类猎奇' or site='同性做爱'")->count();
  2703. $tanhuazhou = M("video_list_test")->where("id>0 and site='国产探花' and add_time>'$seven_time_chuo'")->count();
  2704. $smtiaojiaozhou = M("video_list_test")->where("id>0 and site='SM调教' and add_time>'$seven_time_chuo'")->count();
  2705. $aihuanlianzhou = M("video_list_test")->where("id>0 and site='AI' and add_time>'$seven_time_chuo'")->count();
  2706. $lingleizhou = M("video_list_test")->where("id>0 and site='孕妇做爱' or site='性感人妖' or site='人兽动物' or site='超级大胆' or site='另类猎奇' or site='同性做爱'")->count();
  2707. $oumei_list= array('name'=>'探花大神','zhou'=>"$tanhuazhou",'all'=>"$tanhua");
  2708. $asian_list= array('name'=>'sm调教','zhou'=>"$smtiaojiaozhou",'all'=>"$smtiaojiao");
  2709. $donman_list= array('name'=>'AI乱伦','zhou'=>"$aihuanlianzhou",'all'=>"$aihuanlian");
  2710. $fancha_list= array('name'=>'另类奇葩','zhou'=>"$lingleizhou",'all'=>"$linglei");
  2711. $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
  2712. break;
  2713. case '4':
  2714. $xuebaimeiru = M("video_list_test")->where("id>0 and site='雪白美乳'")->count();
  2715. $wanou = M("video_list_test")->where("id>0 and site='玩偶姐姐'")->count();
  2716. $avjeishuo = M("video_list_test")->where("id>0 and site='AV解说'")->count();
  2717. $tianmei = M("video_list_test")->where("id>0 and uploader='另类猎奇'")->count();
  2718. $xuebaimeiruzhou = M("video_list_test")->where("id>0 and site='雪白美乳'")->count();
  2719. $wanouzhou = M("video_list_test")->where("id>0 and site='玩偶姐姐'")->count();
  2720. $avjeishuozhou = M("video_list_test")->where("id>0 and site='AV解说'")->count();
  2721. $tianmeizhou = M("video_list_test")->where("id>0 and uploader='粉嫩少女'")->count();
  2722. $oumei_list= array('name'=>'雪白美乳','zhou'=>"$xuebaimeiruzhou",'all'=>"$xuebaimeiru");
  2723. $asian_list= array('name'=>'玩偶姐姐','zhou'=>"$wanouzhou",'all'=>"$wanou");
  2724. $donman_list= array('name'=>'av解说','zhou'=>"$avjeishuozhou",'all'=>"$avjeishuo");
  2725. $fancha_list= array('name'=>'甜美萝莉','zhou'=>"$tianmeizhou",'all'=>"$tianmei");
  2726. $data_list = array($oumei_list,$asian_list,$donman_list,$fancha_list);
  2727. break;
  2728. default:
  2729. echo "type error";
  2730. }
  2731. if ($data_list){
  2732. $data['code'] = '200';
  2733. $data['status'] = '1';
  2734. $data['message'] = 'ok';
  2735. $data['data'] = $data_list;
  2736. echo json_encode($data);
  2737. }else{
  2738. $data['code'] = '200';
  2739. $data['status'] = '2';
  2740. $data['message'] = 'error';
  2741. $data['data'] = "$data_list";
  2742. echo json_encode($data);
  2743. }
  2744. }else{
  2745. echo $this->returnData();
  2746. }
  2747. }
  2748. /**
  2749. * 版本:
  2750. * 新增/更新:
  2751. * 简述:
  2752. * @param $templateid []
  2753. * @return $type 消息类型
  2754. */
  2755. public function show_video_all_count(){
  2756. header('Content-Type:text/json;charset=utf-8');
  2757. header('Access-Control-Allow-Origin:*');
  2758. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2759. header('Access-Control-Allow-Methods:POST');
  2760. header('Access-Control-Expose-Headers:*');
  2761. if (!empty($_POST)){
  2762. $token = $_POST['token'];
  2763. if ($token != 'b8e3bb6ef8747d7') {
  2764. $data['code'] = '203';
  2765. $data['msg'] = 'token错误';
  2766. echo json_encode($data);
  2767. die;
  2768. }
  2769. // $page = $_POST['page'];
  2770. // $size = $_POST['size'];
  2771. // $arr = M("slgj_user_feedback")->page($page, $size)->order("id desc")->select();
  2772. $type_list_all =array(
  2773. array('欧美','亚洲','动漫','素人反差'),
  2774. array('黑料','网爆门','海角乱伦','麻豆传媒'),
  2775. array('探花大神','SM调教','AI换脸','另类猎奇'),
  2776. array('雪白美乳','玩偶姐姐','AV解说','甜美萝莉'),
  2777. );
  2778. $any_site_count = M("video_list_test")->where("id>0")->field("site,count(site) as wuwu")->group('site')->order('wuwu desc')->select();
  2779. $oumei_number = 0;
  2780. $asian_number = 0;
  2781. $anime_number = 0;
  2782. $wb_number = 0;
  2783. $hl_number = 0;
  2784. $fc_number = 0;
  2785. $hj_number = 0;
  2786. $madou_number = 0;
  2787. $tanhua_number=0;
  2788. $ai_number=0;
  2789. $linglei_number=0;
  2790. $meiru_number=0;
  2791. $sm_number=0;
  2792. $wanou_number=0;
  2793. $avjieshuo_number=0;
  2794. $luoli_number=0;
  2795. foreach ($any_site_count as $key => $value) {
  2796. $vtype = $value['site'];
  2797. $vconunt = $value['wuwu'];
  2798. switch ($vtype) {
  2799. case 'Anime':
  2800. $anime_number += $vconunt;
  2801. break;
  2802. case '动画':
  2803. $anime_number += $vconunt;
  2804. break;
  2805. case 'Asian':
  2806. $asian_number += $vconunt;
  2807. break;
  2808. case 'EUA':
  2809. $oumei_number += $vconunt;
  2810. break;
  2811. case 'WB':
  2812. $wb_number += $vconunt;
  2813. break;
  2814. case 'HL':
  2815. $hl_number += $vconunt;
  2816. break;
  2817. case 'FC':
  2818. $fc_number += $vconunt;
  2819. break;
  2820. case 'HJ':
  2821. //海角乱伦
  2822. $hj_number+= $vconunt;
  2823. break;
  2824. case '麻豆传媒':
  2825. //麻豆传媒
  2826. $madou_number+= $vconunt;
  2827. break;
  2828. case '国产探花':
  2829. //探花大神
  2830. $tanhua_number+= $vconunt;
  2831. break;
  2832. case 'AI':
  2833. //明星换脸
  2834. $ai_number+= $vconunt;
  2835. break;
  2836. case '孕妇做爱':
  2837. //另类猎奇 孕妇
  2838. $linglei_number+= $vconunt;
  2839. break;
  2840. case '另类猎奇':
  2841. //另类猎奇 猎奇
  2842. $linglei_number+= $vconunt;
  2843. break;
  2844. case '人兽动物':
  2845. //另类猎奇 人兽
  2846. $linglei_number+= $vconunt;
  2847. break;
  2848. case '性感人妖':
  2849. //另类猎奇 人妖
  2850. $linglei_number+= $vconunt;
  2851. break;
  2852. case '同性做爱':
  2853. //另类猎奇 同性
  2854. $linglei_number+= $vconunt;
  2855. break;
  2856. case '超级大胆':
  2857. //另类猎奇 超级大胆
  2858. $linglei_number+= $vconunt;
  2859. break;
  2860. case '雪白美乳':
  2861. $meiru_number+= $vconunt;
  2862. //雪白美乳
  2863. break;
  2864. case 'SM调教':
  2865. $sm_number+= $vconunt;
  2866. //SM调教
  2867. break;
  2868. case '玩偶姐姐':
  2869. $wanou_number+= $vconunt;
  2870. //玩偶姐姐
  2871. break;
  2872. case 'AV解说':
  2873. $avjieshuo_number+= $vconunt;
  2874. //av解说
  2875. break;
  2876. case '制服学妹':
  2877. $luoli_number+= $vconunt;
  2878. //超级大胆
  2879. break;
  2880. case '马尾学妹':
  2881. $luoli_number+= $vconunt;
  2882. //超级大胆
  2883. break;
  2884. case '后入嫩穴':
  2885. $luoli_number+= $vconunt;
  2886. //超级大胆
  2887. break;
  2888. case '超级巨臀':
  2889. $luoli_number+= $vconunt;
  2890. //超级大胆
  2891. break;
  2892. case '美臀翘臀':
  2893. $luoli_number+= $vconunt;
  2894. //超级大胆
  2895. break;
  2896. default:
  2897. // echo $vtype;
  2898. }
  2899. }
  2900. $all_type_number['oumei_count'] ="$oumei_number";
  2901. $all_type_number['asian_count'] ="$asian_number";
  2902. $all_type_number['anime_count'] ="$anime_number";
  2903. $all_type_number['wb_count'] = "$wb_number";
  2904. $all_type_number['fc_count']= "$fc_number";
  2905. $all_type_number['hl_count']="$hl_number";
  2906. $all_type_number['HJ_number']="$hj_number";
  2907. $all_type_number['madou_number']="$madou_number";
  2908. $all_type_number['tanhua_number']="$tanhua_number";
  2909. $all_type_number['ai_number']="$ai_number";
  2910. $all_type_number['linglei_number']="$linglei_number";
  2911. $all_type_number['meiru_number']="$meiru_number";
  2912. $all_type_number['sm_number']="$sm_number";
  2913. $all_type_number['wanou_number']="$wanou_number";
  2914. $all_type_number['avjieshuo_number']="$avjieshuo_number";
  2915. $all_type_number['luoli_number']="$luoli_number";
  2916. $data['code'] = '200';
  2917. $data['status'] = '1';
  2918. $data['message'] = '';
  2919. $data['data'] = $all_type_number;
  2920. echo json_encode($data);
  2921. }else{
  2922. echo $this->returnData();
  2923. }
  2924. }
  2925. /**
  2926. * 版本:
  2927. * 新增/更新:
  2928. * 简述:add_test_video
  2929. * @param $templateid []
  2930. * @return $type 消息类型
  2931. */
  2932. public function save_beizhu(){
  2933. header('Content-Type:text/json;charset=utf-8');
  2934. header('Access-Control-Allow-Origin:*');
  2935. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2936. header('Access-Control-Allow-Methods:POST');
  2937. header('Access-Control-Expose-Headers:*');
  2938. if (!empty($_POST)){
  2939. $uid = $_POST['uid'];
  2940. $beizhu = $_POST['beizhu'];
  2941. $save_yn = M("user_info")->where("id=$uid")->save($_POST);
  2942. if ($save_yn){
  2943. $data['code'] = '200';
  2944. $data['status'] = '1';
  2945. $data['message'] = 'ok';
  2946. echo json_encode($data);
  2947. }else{
  2948. $data['code'] = '200';
  2949. $data['status'] = '2';
  2950. $data['message'] = 'error';
  2951. echo json_encode($data);
  2952. }
  2953. }else{
  2954. echo $this->returnData();
  2955. }
  2956. }
  2957. /**
  2958. * 版本:1.7
  2959. * 新增/更新:新增
  2960. * 简述:统计
  2961. * @param $templateid []
  2962. * @return $type 消息类型
  2963. */
  2964. public function video_add_tongJi(){
  2965. header('Content-Type:text/json;charset=utf-8');
  2966. header('Access-Control-Allow-Origin:*');
  2967. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  2968. header('Access-Control-Allow-Methods:POST');
  2969. header('Access-Control-Expose-Headers:*');
  2970. if (!empty($_POST)){
  2971. $token = $_POST['token'];
  2972. if ($token != 'b8e3bb6ef8747d7') {
  2973. $data['code'] = '203';
  2974. $data['msg'] = 'token错误';
  2975. echo json_encode($data);
  2976. die;
  2977. }
  2978. $page = $_POST['page'];
  2979. $size = $_POST['size'];
  2980. // $type_list_all =array(
  2981. // array('欧美','亚洲','动漫','素人反差'),
  2982. // array('黑料','网爆门','海角乱伦','麻豆传媒'),
  2983. // array('探花大神','SM调教','AI换脸','另类猎奇'),
  2984. // array('雪白美乳','玩偶姐姐','AV解说','甜美萝莉'),
  2985. // );shoucang_type_list
  2986. $seven_time_chuo = time() - (7 * 24 * 3600);
  2987. $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();
  2988. foreach ($video_seven_add as $key => $value) {
  2989. $video_uplodaer=$value['uploader'];
  2990. # code...
  2991. $video_seven_add[$key]['seven']= M("video_list_test")->where("add_time>'$seven_time_chuo' and uploader='$video_uplodaer'")->count();;
  2992. }
  2993. $data['code'] = '200';
  2994. $data['status'] = '1';
  2995. $data['message'] = 'ok';
  2996. $data['data'] = $video_seven_add;
  2997. echo json_encode($data);
  2998. }else{
  2999. echo $this->returnData();
  3000. }
  3001. }
  3002. /**
  3003. * 新增活跃
  3004. * @param $templateid []
  3005. * @return $type 消息类型
  3006. */
  3007. public function all_huoyue_renshu(){
  3008. header('Content-Type:text/json;charset=utf-8');
  3009. header('Access-Control-Allow-Origin:*');
  3010. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3011. header('Access-Control-Allow-Methods:POST');
  3012. header('Access-Control-Expose-Headers:*');
  3013. if (!empty($_POST)){
  3014. $token = $_POST['token']; //b8e3bb6ef8747d7
  3015. if ($token != 'b8e3bb6ef8747d7') {
  3016. $data['code'] = '203';
  3017. $data['msg'] = 'token错误';
  3018. echo json_encode($data);
  3019. die;
  3020. }
  3021. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  3022. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  3023. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  3024. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  3025. $todayTimestamp = time(); // 获取当前时间戳
  3026. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  3027. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  3028. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  3029. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  3030. $zhou_end_time = time();
  3031. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  3032. $yue_end_time = time();
  3033. $user_info_list = M('user_info');
  3034. $user_novip = $user_info_list->where("vip_yn=0 ")->field('id')->select();
  3035. $arr['jinri_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $jinri_start_time and $jinri_end_time ")->count();
  3036. $arr['zuori_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $zuo_start_time and $zuo_end_time ")->count();
  3037. $arr['sanri_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $san_start_time and $san_end_time")->count();
  3038. // echo PHP_EOL.$user_info_list->_sql();
  3039. $arr['zhou_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $zhou_start_time and $zhou_end_time ")->count();
  3040. $arr['yue_xinzeng_num'] = $user_info_list->where("add_time BETWEEN $yue_start_time and $yue_end_time")->count();
  3041. $arr['jilei_xinzeng_num'] = $user_info_list->where("id>0 ")->count();
  3042. $huoyue = M("huoyue_list");
  3043. $huoyue_jin = M("huoyue_list")->where("time BETWEEN $jinri_start_time and $jinri_end_time ")->field("uid")->group("uid")->select();
  3044. $huoyue_zuo = M("huoyue_list")->where(" time BETWEEN $zuo_start_time and $zuo_end_time ")->field("uid")->group("uid")->select();
  3045. $huoyue_san = M("huoyue_list")->where("time BETWEEN $san_start_time and $san_end_time ")->field("uid")->group("uid")->select();;
  3046. // echo PHP_EOL.M("huoyue_list")->_sql();
  3047. $huoyue_zhou = M("huoyue_list")->where(" time BETWEEN $zhou_start_time and $zhou_end_time ")->field("uid")->group("uid")->select();
  3048. $huoyue_yue = M("huoyue_list")->where(" time BETWEEN $yue_start_time and $yue_end_time")->field("uid")->group("uid")->select();
  3049. $huoyue_jilei = $user_info_list->where("last_login_time is not null ")->field("id")->select();
  3050. $arrs['jinri_huoyue_num'] =count($huoyue_jin);
  3051. $arrs['zuori_huoyue_num'] =count($huoyue_zuo);
  3052. $arrs['sanri_huoyue_num'] = count($huoyue_san);
  3053. $arrs['zhou_huoyue_num'] =count($huoyue_zhou);
  3054. $arrs['yue_huoyue_num'] =count($huoyue_yue);
  3055. $arrs['jilei_huoyue_num'] =count($huoyue_jilei);
  3056. $arr_list = array($arr,$arrs);
  3057. $data['code'] = '200';
  3058. $data['status'] = '1';
  3059. $data['message'] = '';
  3060. $data['data'] =$arr_list;
  3061. echo json_encode($data);
  3062. }else{
  3063. echo $this->returnData();
  3064. }
  3065. }
  3066. /**
  3067. * 版本:
  3068. * 新增/更新:
  3069. * 简述:
  3070. * @param $templateid []
  3071. * @return $type 消息类型
  3072. */
  3073. public function free_huoyue_renshu(){
  3074. header('Content-Type:text/json;charset=utf-8');
  3075. header('Access-Control-Allow-Origin:*');
  3076. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3077. header('Access-Control-Allow-Methods:POST');
  3078. header('Access-Control-Expose-Headers:*');
  3079. if (!empty($_POST)){
  3080. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  3081. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  3082. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  3083. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  3084. $todayTimestamp = time(); // 获取当前时间戳
  3085. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  3086. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  3087. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  3088. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  3089. $zhou_end_time = time();
  3090. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  3091. $yue_end_time = time();
  3092. $vip_user= M("user_info")->where("vip_money is null")->field("id")->select();
  3093. $last_id = array_column($vip_user, 'id');
  3094. $str = json_encode($last_id);
  3095. $str = substr($str, 1, -1);
  3096. $huoyue = M("huoyue_list");
  3097. $huoyue_jin = M("huoyue_list")->where("uid in($str) and time BETWEEN $jinri_start_time and $jinri_end_time ")->field("uid")->group("uid")->select();
  3098. $huoyue_zuo = M("huoyue_list")->where("uid in($str) and time BETWEEN $zuo_start_time and $zuo_end_time ")->field("uid")->group("uid")->select();
  3099. $huoyue_san = M("huoyue_list")->where("uid in($str) and time BETWEEN $san_start_time and $san_end_time ")->field("uid")->group("uid")->select();;
  3100. // echo PHP_EOL.M("huoyue_list")->_sql();
  3101. $huoyue_zhou = M("huoyue_list")->where(" uid in($str) and time BETWEEN $zhou_start_time and $zhou_end_time ")->field("uid")->group("uid")->select();
  3102. $huoyue_yue = M("huoyue_list")->where(" uid in($str) and time BETWEEN $yue_start_time and $yue_end_time")->field("uid")->group("uid")->select();
  3103. $huoyue_jilei = M("user_info")->where("last_login_time is not null and vip_money is null ")->field("id")->select();
  3104. $arrs['jinri_huoyue_num'] =count($huoyue_jin);
  3105. $arrs['zuori_huoyue_num'] =count($huoyue_zuo);
  3106. $arrs['sanri_huoyue_num'] = count($huoyue_san);
  3107. $arrs['zhou_huoyue_num'] =count($huoyue_zhou);
  3108. $arrs['yue_huoyue_num'] =count($huoyue_yue);
  3109. $arrs['jilei_huoyue_num'] =count($huoyue_jilei);
  3110. $data['code'] = '200';
  3111. $data['status'] = '1';
  3112. $data['message'] = '';
  3113. $data['data'] =$arrs;
  3114. echo json_encode($data);
  3115. }else{
  3116. echo $this->returnData();
  3117. }
  3118. }
  3119. /**
  3120. * 版本:
  3121. * 新增/更新:
  3122. * 简述:fu4fei4huo2yue4
  3123. * @param $templateid []
  3124. * @return $type 消息类型
  3125. */
  3126. public function vip_huoyue_renshu(){
  3127. header('Content-Type:text/json;charset=utf-8');
  3128. header('Access-Control-Allow-Origin:*');
  3129. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3130. header('Access-Control-Allow-Methods:POST');
  3131. header('Access-Control-Expose-Headers:*');
  3132. if (!empty($_POST)){
  3133. $jinri_start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  3134. $jinri_end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  3135. $zuo_start_time = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
  3136. $zuo_end_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - 1;
  3137. $todayTimestamp = time(); // 获取当前时间戳
  3138. $threeDaysAgoTimestamp = strtotime('-3 days', $todayTimestamp); // 获取三天前的时间戳
  3139. $san_start_time = strtotime('midnight', strtotime('-3 days', $todayTimestamp)); // 获取三天前的0点时间戳
  3140. $san_end_time = strtotime('23:59:59', strtotime('-1 day', $todayTimestamp)); // 获取前天的23:59:59时间戳
  3141. $zhou_start_time = strtotime(date("Y-m-d", strtotime("-1 week")) . "00:00:00");
  3142. $zhou_end_time = time();
  3143. $yue_start_time = strtotime(date("Y-m-d", strtotime("-1 month")) . "00:00:00");
  3144. $yue_end_time = time();
  3145. $vip_user= M("user_info")->where("vip_money=1")->field("id")->select();
  3146. $last_id = array_column($vip_user, 'id');
  3147. $str = json_encode($last_id);
  3148. $str = substr($str, 1, -1);
  3149. $huoyue = M("huoyue_list");
  3150. $huoyue_jin = M("huoyue_list")->where("uid in($str) and time BETWEEN $jinri_start_time and $jinri_end_time ")->field("uid")->group("uid")->select();
  3151. $huoyue_zuo = M("huoyue_list")->where(" uid in($str) and time BETWEEN $zuo_start_time and $zuo_end_time ")->field("uid")->group("uid")->select();
  3152. $huoyue_san = M("huoyue_list")->where("uid in($str) and time BETWEEN $san_start_time and $san_end_time ")->field("uid")->group("uid")->select();;
  3153. // echo PHP_EOL.M("huoyue_list")->_sql();
  3154. $huoyue_zhou = M("huoyue_list")->where("uid in($str) and time BETWEEN $zhou_start_time and $zhou_end_time ")->field("uid")->group("uid")->select();
  3155. $huoyue_yue = M("huoyue_list")->where(" uid in($str) and time BETWEEN $yue_start_time and $yue_end_time")->field("uid")->group("uid")->select();
  3156. $huoyue_jilei = M("user_info")->where("last_login_time is not null and vip_money=1")->field("id")->select();
  3157. $arrs['jinri_huoyue_num'] =count($huoyue_jin);
  3158. $arrs['zuori_huoyue_num'] =count($huoyue_zuo);
  3159. $arrs['sanri_huoyue_num'] = count($huoyue_san);
  3160. $arrs['zhou_huoyue_num'] =count($huoyue_zhou);
  3161. $arrs['yue_huoyue_num'] =count($huoyue_yue);
  3162. $arrs['jilei_huoyue_num'] =count($huoyue_jilei);
  3163. $data['code'] = '200';
  3164. $data['status'] = '1';
  3165. $data['message'] = '';
  3166. $data['data'] =$arrs;
  3167. echo json_encode($data);
  3168. }else{
  3169. echo $this->returnData();
  3170. }
  3171. }
  3172. /**
  3173. * 版本:
  3174. * 新增/更新:
  3175. * 简述:
  3176. * @param $templateid []
  3177. * @return $type 消息类型
  3178. */
  3179. public function home_url_list(){
  3180. header('Content-Type:text/json;charset=utf-8');
  3181. header('Access-Control-Allow-Origin:*');
  3182. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3183. header('Access-Control-Allow-Methods:POST');
  3184. header('Access-Control-Expose-Headers:*');
  3185. if (!empty($_POST)){
  3186. $token = $_POST['token']; //b8e3bb6ef8747d7
  3187. if ($token != 'b8e3bb6ef8747d7') {
  3188. $data['code'] = '203';
  3189. $data['msg'] = 'token错误';
  3190. echo json_encode($data);
  3191. die;
  3192. }
  3193. $img_list = M("shouye_url")->where("type='yj'")->order('id asc')->select();
  3194. if ($img_list){
  3195. $data['code'] = '200';
  3196. $data['status'] = '1';
  3197. $data['message'] = 'ok';
  3198. $data['data'] =$img_list;
  3199. echo json_encode($data);
  3200. }else{
  3201. $data['code'] = '200';
  3202. $data['status'] = '2';
  3203. $data['message'] = 'null';
  3204. $data['data'] = $img_list;
  3205. echo json_encode($data);
  3206. }
  3207. }else{
  3208. echo $this->returnData();
  3209. }
  3210. }
  3211. /**
  3212. * 版本:1.8
  3213. * 新增/更新:add
  3214. * 简述:上传街拍
  3215. * @param $templateid []
  3216. * @return $type 消息类型
  3217. */
  3218. public function upload_video_new()
  3219. {
  3220. ini_set('upload_max_filesize', '4048M');
  3221. ini_set('post_max_size', '4048M');
  3222. header('Content-Type:text/json;charset=utf-8');
  3223. header('Access-Control-Allow-Origin:*');
  3224. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3225. header('Access-Control-Allow-Methods:POST');
  3226. header('Access-Control-Expose-Headers:*');
  3227. if (!empty($_POST)) {
  3228. $img = $_FILES['mp4'];
  3229. $uploader = $_POST['uploader'];
  3230. $title = $_POST['title'];
  3231. switch ($uploader) {
  3232. case '1':
  3233. $uploader_name = '顶臀街射';
  3234. $videoPath = '/home2/videos/one/DTJS/MP4/'; // 视频集合的上传目录
  3235. $url_path = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/DTJS/MP4/';
  3236. if (!file_exists($videoPath)) {
  3237. mkdir($videoPath, 0777, true);
  3238. }
  3239. break;
  3240. case '2':
  3241. $uploader_name = '抄底偷拍';
  3242. $videoPath = '/home2/videos/one/CDTP/MP4/'; // 视频集合的上传目录
  3243. $url_path = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/CDTP/MP4/';
  3244. if (!file_exists($videoPath)) {
  3245. mkdir($videoPath, 0777, true);
  3246. }
  3247. break;
  3248. case '3':
  3249. $uploader_name = '厕所偷拍';
  3250. $videoPath = '/home2/videos/one/CSTP/MP4/'; // 视频集合的上传目录
  3251. $url_path = 'https://www.5uafocvs4xlibumya2.xyz/videos/one/CSTP/MP4/';
  3252. if (!file_exists($videoPath)) {
  3253. mkdir($videoPath, 0777, true);
  3254. }
  3255. break;
  3256. default:
  3257. echo "type error";
  3258. }
  3259. $token = $_POST['token']; //b8e3bb6ef8747d7
  3260. if ($token != 'b8e3bb6ef8747d7') {
  3261. $data['code'] = '203';
  3262. $data['msg'] = 'token错误';
  3263. echo json_encode($data);
  3264. die;
  3265. }
  3266. // 上传视频集合
  3267. $configVideo = array(
  3268. 'maxSize' => 0, // 设置视频上传大小(100MB)
  3269. 'exts' => array('mp4', 'avi', 'mkv', 'mov','MOV','MP4'), // 设置视频上传类型
  3270. 'rootPath' => "$videoPath", // 设置附件上传根目录
  3271. );
  3272. $uploadVideo = new \Think\Upload($configVideo); // 实例化视频上传类
  3273. // 上传视频集合
  3274. $infoVideo = $uploadVideo->upload();
  3275. $title_list = explode(',',$title);
  3276. $videoPaths = ''; // 存储上传的视频文件路径
  3277. foreach ($infoVideo as $key => $value) {
  3278. $savepath = $value['savepath'];
  3279. $savename = $value['savename'];
  3280. $videoPaths = $videoPath .$savepath . $savename ;
  3281. $url_videoPaths = $url_path .$savepath . $savename ;
  3282. $fancha_list[$key]['uploader'] = $uploader_name;
  3283. $fancha_list[$key]['title'] = $title_list[$key];
  3284. $fancha_list[$key]['mp4_path'] = $videoPaths;
  3285. $fancha_list[$key]['url_path'] = $url_videoPaths;
  3286. $fancha_list[$key]['type'] = '0';
  3287. M("upload_videos_list")->add($fancha_list[$key]);
  3288. }
  3289. // 返回上传成功的文件路径
  3290. $this->ajaxReturn(array(
  3291. 'status' => 1,
  3292. 'message' => '上传成功',
  3293. 'data' => $fancha_list,
  3294. ));
  3295. } else {
  3296. echo $this->returnData();
  3297. }
  3298. }
  3299. //你好111,你好2222,你好333,你好444,你好555
  3300. //413 Request Entity Too Large
  3301. /**
  3302. * 版本:
  3303. * 新增/更新:
  3304. * 简述:
  3305. * @param $templateid []
  3306. * @return $type 消息类型
  3307. */
  3308. public function take_photo_on_street_list(){
  3309. header('Content-Type:text/json;charset=utf-8');
  3310. header('Access-Control-Allow-Origin:*');
  3311. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3312. header('Access-Control-Allow-Methods:POST');
  3313. header('Access-Control-Expose-Headers:*');
  3314. if (!empty($_POST)){
  3315. $page = $_POST['page'];
  3316. $type=$_POST['type'];
  3317. $page_one = ($page - 1) * 50;
  3318. switch ($type) {
  3319. case '1':
  3320. $paid_agent_list = M("upload_videos_list")->where("uploader='顶臀街射' and type!='4'")->order('id desc')->LIMIT($page_one, 50)->select();
  3321. $all_num = M("upload_videos_list")->where("uploader='顶臀街射'")->count();
  3322. break;
  3323. case '2':
  3324. $paid_agent_list = M("upload_videos_list")->where("uploader='抄底偷拍' and type!='4'")->order('id desc')->LIMIT($page_one, 50)->select();
  3325. $all_num =M("upload_videos_list")->where("uploader='抄底偷拍'")->count();
  3326. break;
  3327. case '3':
  3328. $paid_agent_list = M("upload_videos_list")->where("uploader='厕所偷拍' and type!='4'")->order('id desc')->LIMIT($page_one, 50)->select();
  3329. $all_num =M("upload_videos_list")->where("uploader='厕所偷拍'")->count();
  3330. break;
  3331. default:
  3332. echo "type error";
  3333. }
  3334. if ($paid_agent_list){
  3335. $data['code'] = '200';
  3336. $data['status'] = '1';
  3337. $data['message'] = 'ok';
  3338. $data['all_num'] = $all_num;
  3339. $data['data'] = $paid_agent_list;
  3340. echo json_encode($data);
  3341. }else{
  3342. $data['code'] = '200';
  3343. $data['status'] = '2';
  3344. $data['message'] = 'null';
  3345. $data['all_num'] = 0;
  3346. $data['data'] = $paid_agent_list;
  3347. echo json_encode($data);
  3348. }
  3349. }else{
  3350. echo $this->returnData();
  3351. }
  3352. }
  3353. /**
  3354. * 版本:
  3355. * 新增/更新:
  3356. * 简述:
  3357. * @param $templateid []
  3358. * @return $type 消息类型
  3359. */
  3360. public function delete_take_photo(){
  3361. header('Content-Type:text/json;charset=utf-8');
  3362. header('Access-Control-Allow-Origin:*');
  3363. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3364. header('Access-Control-Allow-Methods:POST');
  3365. header('Access-Control-Expose-Headers:*');
  3366. if (!empty($_POST)){
  3367. $id = $_POST['id'];
  3368. $mp4_path = M("upload_videos_list")->where("id=$id")->getField("mp4_path");
  3369. $type_four['type'] = 4;
  3370. $yn_delete = M("upload_videos_list")->where("id=$id")->save($type_four);
  3371. $file = "$mp4_path";
  3372. if (unlink($file) and $yn_delete)
  3373. {
  3374. $data['message'] = 'ok';
  3375. echo json_encode($data);
  3376. }
  3377. else
  3378. {
  3379. $data['message'] = 'error';
  3380. echo json_encode($data);
  3381. }
  3382. }else{
  3383. echo $this->returnData();
  3384. }
  3385. }
  3386. /**
  3387. * 版本:1.75
  3388. * 新增/更新:add
  3389. * 简述:save_home_url
  3390. * @param $templateid []
  3391. * @return $type 消息类型
  3392. */
  3393. public function update_home_url(){
  3394. header('Content-Type:text/json;charset=utf-8');
  3395. header('Access-Control-Allow-Origin:*');
  3396. header("Access-Control-Allow-Headers:token,Origin, X-Requested-With, Content-Type, Accept");
  3397. header('Access-Control-Allow-Methods:POST');
  3398. header('Access-Control-Expose-Headers:*');
  3399. if (!empty($_POST)){
  3400. $usr_c = $_POST['url'];
  3401. $id = $_POST['id'];
  3402. $save = M("shouye_url")->where("id=$id")->save($_POST);
  3403. if($save){
  3404. $data['code'] = '200';
  3405. $data['status'] = '1';
  3406. $data['message'] = 'ok';
  3407. echo json_encode($data);
  3408. }else{
  3409. $data['code'] = '200';
  3410. $data['status'] = '2';
  3411. $data['message'] = 'error';
  3412. echo json_encode($data);
  3413. }
  3414. }else{
  3415. echo $this->returnData();
  3416. }
  3417. }
  3418. }