Fullorder.php 233 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Fullorder extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_fullorder','fullorder');
  7. $this->load->_model('Model_fullordertt','fullordertt');
  8. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  9. $this->load->_model('Model_shop','shop');
  10. $this->load->_model('Model_typeclass','typeclass');
  11. $this->load->_model('Model_express','express');
  12. $this->load->_model('Model_country','country');
  13. $this->load->_model('Model_productdescribe','productdescribe');
  14. $this->load->_model('Model_customs','customs');
  15. $this->load->_model('Model_detailed','detailed');
  16. $this->load->_model('Model_productdescription','productdescription');
  17. $this->load->_model('Model_logistics','logistics');
  18. $this->load->_model('Model_hl','hl');
  19. $this->load->_model('Model_excel','excel');
  20. $this->load->_model('Model_warehouse','warehouse');
  21. $this->load->_model('Model_customer','customer');
  22. $this->load->_model('Model_user','user');
  23. $this->load->_model('Model_dhl','dhl');
  24. $this->load->_model('Model_ali','ali');
  25. $this->load->_model('Model_notice','notice');
  26. $this->load->_model('Model_api','api');
  27. $this->load->_model('Model_usps','usps');
  28. $this->load->_model('Model_fullorder_smt','fullorder_smt');
  29. $this->load->_model('Model_whlabel','whlabel');
  30. $this->load->_model('Model_reset','fullreset');
  31. $this->load->_model('Model_specialstock','specialstock');
  32. $this->load->_model('Model_systemwigsout','systemwigsout');
  33. $this->load->_model('Model_colourorderts','colourorderts');
  34. $this->load->_model('Model_paypal','paypal');
  35. $this->load->_model('Model_ck','ck');
  36. $this->load->_model('Model_weight','weight');
  37. $this->load->_model('Model_pay','pay');
  38. $this->load->_model('Model_setting','setting');
  39. $this->load->_model('Model_whlabel_fc','whlabel_fc');
  40. $this->load->_model('Model_transfer','transfer');
  41. $this->load->_model('Model_systemtransfer','systemtransfer');
  42. $this->load->_model('Model_power','power');
  43. $this->load->_model('Model_awlgx','awlgx');
  44. $this->load->_model('Model_fullorderhb','fullorderhb');
  45. $this->load->_model('Model_notice','notice');
  46. $this->load->_model('Model_producttitle','producttitle');
  47. $this->load->_model('Model_emaildata','emaildata');
  48. $this->load->_model('Model_afspaypal','afspaypal');
  49. $this->load->_model('Model_returngoods','returngoods');
  50. $this->load->_model('Model_message','message');
  51. $this->load->_model("Model_logic_order","logic_order");
  52. $this->load->_model("Model_logic_ding","logic_ding");
  53. $this->load->_model("Model_fullordererrors","fullordererrors");
  54. }
  55. //定义方法的调用规则 获取URI第二段值
  56. public function _remap($arg,$arg_array)
  57. {
  58. if($arg == 'add')//添加
  59. {
  60. $this->_add();
  61. }
  62. else if($arg == 'edit')//修改
  63. {
  64. $this->_edit($arg_array);
  65. }
  66. else if($arg == 'readonly')//修改
  67. {
  68. $this->_readonly($arg_array);
  69. }
  70. else if($arg == 'readlist')
  71. {
  72. $this->_readlist();
  73. }
  74. else if($arg == 'readlistdown')
  75. {
  76. $this->_readlistdown();
  77. }
  78. else if($arg == 'del')//修改
  79. {
  80. $this->_del();
  81. }
  82. else if($arg == 'price')//价格明细
  83. {
  84. $this->_price();
  85. }
  86. else if($arg == 'customs')
  87. {
  88. $this->_customs();
  89. }
  90. else if($arg == 'express')
  91. {
  92. $this->_express();
  93. }
  94. else if($arg == 'hl')
  95. {
  96. $this->_hl();
  97. }
  98. else if($arg == 'repeat')
  99. {
  100. $this->_repeat();
  101. }
  102. else if($arg == 'operation')
  103. {
  104. $this->_operation();
  105. }
  106. else if($arg == 'merge')
  107. {
  108. $this->_merge();
  109. }
  110. else if($arg == 'fmexcel')
  111. {
  112. $this->_fmexcel();
  113. }
  114. else if($arg == 'fdexcel')
  115. {
  116. $this->_fdexcel();
  117. }
  118. else if($arg == 'fdfexcel')
  119. {
  120. $this->_fdfexcel();
  121. }
  122. else if($arg == 'evaluate')
  123. {
  124. $this->_evaluate();
  125. }
  126. else if($arg == 'state')
  127. {
  128. $this->_state();
  129. }
  130. else if($arg == 'wl')
  131. {
  132. $this->_wl();
  133. }
  134. else if($arg == 'wlbz')
  135. {
  136. $this->_wlbz($arg_array);
  137. }
  138. else if($arg == 'review')
  139. {
  140. $this->_review();
  141. }
  142. else if($arg == 'black')
  143. {
  144. $this->_black();
  145. }
  146. else if($arg == 'ryf')
  147. {
  148. $this->_ryf();
  149. }
  150. else if($arg == 'expresstype')
  151. {
  152. $this->_expresstype();
  153. }
  154. else if($arg == 'fsstate')
  155. {
  156. $this->_fsstate();
  157. }
  158. else if($arg == 'power')
  159. {
  160. $this->_power();
  161. }
  162. else if($arg == 'error')
  163. {
  164. $this->_error();
  165. }
  166. else if($arg == 'yzaddress')
  167. {
  168. $this->_yzaddress();
  169. }
  170. else if($arg == 'return')
  171. {
  172. $this->_return();
  173. }
  174. else if($arg == 'clearreturn')
  175. {
  176. $this->_clearreturn();
  177. }
  178. else if($arg == 'ali')
  179. {
  180. $this->_ali();
  181. }
  182. else if($arg == 'dqpm')
  183. {
  184. $this->_dqpm();
  185. }
  186. else if($arg == 'ddpmdata')
  187. {
  188. $this->_ddpmdata($arg_array);
  189. }
  190. else if($arg == 'dqpmprovince')
  191. {
  192. $this->_dqpmprovince($arg_array);
  193. }
  194. else if($arg == 'ddpmexcel')
  195. {
  196. $this->_ddpmexcel($arg_array);
  197. }
  198. else if($arg == 'statedc')
  199. {
  200. $this->_statedc();
  201. }
  202. else if($arg == 'statedcwl')
  203. {
  204. $this->_statedcwl();
  205. }
  206. else if($arg == 'waybillemail')
  207. {
  208. $this->_waybillemail();
  209. }
  210. else if($arg == 'khdd')
  211. {
  212. $this->_khdd();
  213. }
  214. else if($arg == 'klarnadata')
  215. {
  216. $this->_klarnadata();
  217. }
  218. else if($arg == 'epod')
  219. {
  220. $this->_epod();
  221. }
  222. else if($arg == 'zw')
  223. {
  224. $this->_zw($arg_array);
  225. }
  226. else if($arg == 'thxz')
  227. {
  228. $this->_thxz($arg_array);
  229. }
  230. else if($arg == 'dcdxyz')
  231. {
  232. $this->_dcdxyz();
  233. }
  234. else if($arg == 'ddcf')
  235. {
  236. $this->_ddcf();
  237. }
  238. else if($arg == 'cf')
  239. {
  240. $this->_cf();
  241. }
  242. else
  243. {
  244. $this->_index();
  245. }
  246. }
  247. //管理
  248. public function _index()
  249. {
  250. $dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';
  251. if(isset($_SESSION['api']))
  252. {
  253. $user = $this->user->get_api($_SESSION['api']);
  254. $usp = $user;
  255. $fgshop = "";$sid = "";
  256. $usersp = explode('|',trim($user['shop'],'|'));
  257. foreach ($usersp as $value)
  258. {
  259. $fgshop .= " shop = ".$value." or";
  260. $sid .= " id = ".$value." or";
  261. }
  262. if($user['vip'] == 1)
  263. {
  264. $vip = 1;
  265. }
  266. else
  267. {
  268. $vip = 0;
  269. }
  270. }
  271. else
  272. {
  273. $vip = 0;
  274. header('Location: /');exit;
  275. }
  276. $post = $this->input->post(NULL, TRUE);
  277. if(isset($post['page']))
  278. {
  279. $page = $this->input->post('page',true);
  280. $perpage = $this->input->post('perpage',true);
  281. $warehouse = $this->input->post('warehouse',true);
  282. $timetk = $this->input->post('timetk',true);
  283. $timetj = $this->input->post('timetj',true);
  284. $shop = $this->input->post('shop',true);
  285. $source = $this->input->post('source',true);
  286. $state = $this->input->post('state',true);
  287. $review = $this->input->post('review',true);
  288. $type = $this->input->post('type',true);
  289. $express = $this->input->post('express',true);
  290. $orderinfo = $this->input->post('orderinfo',true);
  291. $user = $this->input->post('user',true);
  292. $client = $this->input->post('name',true);
  293. $waybill = $this->input->post('waybill',true);
  294. $number = $this->input->post('number',true);
  295. $email = $this->input->post('email',true);
  296. $phone = $this->input->post('phone',true);
  297. $dlz = $this->input->post('dlz',true);
  298. $print = $this->input->post('print',true);
  299. $library = $this->input->post('library',true);
  300. $js = $this->input->post('js',true);
  301. $exstate = $this->input->post('exstate',true);
  302. $xztime = $this->input->post('xztime',true);
  303. $libraryconfirm = $this->input->post('libraryconfirm',true);
  304. $timetk = strtotime($timetk);
  305. $timetj = strtotime($timetj);
  306. $plorder = $this->input->post('pl',true);
  307. $paypal = $this->input->post('paypal',true);
  308. $pay = $this->input->post('pay',true);
  309. $klarna = $this->input->post('klarna',true);
  310. $zf = $this->input->post('zf',true);
  311. $where = "1=1 and (".rtrim($fgshop,'or').")";
  312. if($warehouse)
  313. {
  314. $where .= " and type = '$warehouse'";
  315. }
  316. if($timetk && $timetj)
  317. {
  318. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  319. }
  320. if($shop)
  321. {
  322. $where .= " and shop = '$shop'";
  323. }
  324. if($source)
  325. {
  326. if($source == '2d')
  327. {
  328. $where .= " and source >= '2'";
  329. }
  330. else
  331. {
  332. $where .= " and source = '$source'";
  333. }
  334. }
  335. if($state)
  336. {
  337. $where .= " and state = '$state'";
  338. }
  339. if($review)
  340. {
  341. $where .= " and review = '$review'";
  342. }
  343. if($type)
  344. {
  345. $where .= " and type = '$type'";
  346. }
  347. if($express)
  348. {
  349. $where .= " and express = '$express'";
  350. }
  351. if($orderinfo)
  352. {
  353. $where .= " and orderinfo = '$orderinfo' and orderinfo != '0'";
  354. }
  355. if($user)
  356. {
  357. $where .= " and user = '$user'";
  358. }
  359. if($client)
  360. {
  361. $where .= " and client like '%$client%'";
  362. }
  363. if($waybill)
  364. {
  365. $where .= " and waybill like '%$waybill%'";
  366. }
  367. if($number)
  368. {
  369. $where .= " and number like '$number%'";
  370. }
  371. if($email)
  372. {
  373. $where .= " and email = '$email'";
  374. }
  375. if($phone)
  376. {
  377. $where .= " and phone like '%$phone%'";
  378. }
  379. if($library)
  380. {
  381. $where .= " and library = '$library'";
  382. }
  383. if($print)
  384. {
  385. $where .= " and print = '$print'";
  386. }
  387. if($dlz != '')
  388. {
  389. $where .= " and dlz = '$dlz'";
  390. }
  391. if($js)
  392. {
  393. $where .= " and js = '$js'";
  394. }
  395. if($exstate)
  396. {
  397. $where .= " and exstate = '$exstate'";
  398. }
  399. if($libraryconfirm)
  400. {
  401. $where .= " and libraryconfirm = '$libraryconfirm'";
  402. }
  403. if($klarna != '')
  404. {
  405. if($klarna == 2)
  406. {
  407. $where .= " and klarna >= '$klarna'";
  408. }
  409. else
  410. {
  411. $where .= " and klarna = '$klarna'";
  412. }
  413. }
  414. if($paypal)
  415. {
  416. $where .= " and paypal = '$paypal'";
  417. }
  418. if($pay)
  419. {
  420. $where .= " and pay = '$pay'";
  421. }
  422. if($zf)
  423. {
  424. if($zf == 1)
  425. {
  426. $where .= " and paypal not like '%-%-%-%'";
  427. }
  428. else
  429. {
  430. $where .= " and paypal like '%-%-%-%'";
  431. }
  432. }
  433. if($plorder)
  434. {
  435. $plorderinfo = '';$plnumber = '';$pln = 0;
  436. $plorder = explode(',',trim($plorder,','));
  437. foreach ($plorder as $value)
  438. {
  439. if(is_numeric($value))
  440. {
  441. $plorderinfo .= " orderinfo = ".$value." or";
  442. }
  443. else if($value != '')
  444. {
  445. $plorderinfo .= " number = '".$value."' or";
  446. }
  447. }
  448. if($pln > 0)
  449. {
  450. $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")";
  451. }
  452. else
  453. {
  454. $where .= " and (".rtrim($plorderinfo,'or').")";
  455. }
  456. }
  457. //数据排序
  458. $order_str = "dtime desc";
  459. if(empty($page))
  460. {
  461. $start = 0;
  462. $perpage = 1;
  463. }
  464. else
  465. {
  466. $start = ($page - 1)*$perpage;
  467. }
  468. //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black
  469. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,sname,email,state,buytime,review,libraryconfirm,express,waybill,orderremarks,library,black,clientremarks,waybillid',$order_str,$start,$perpage);
  470. //格式化数据
  471. foreach ($info_list as $key=>$value)
  472. {
  473. $rginfo = $this->returngoods->get_orderinfo($value['orderinfo']);
  474. if(!empty($rginfo)){
  475. $info_list[$key]['number'] = $value['number']."<br/>".'<p style="color:blue"><i class="method fa fa-exclamation-circle" data-t="'.$rginfo['remark'].'"></i><p>';
  476. }
  477. $ud = $this->fullorder->read($value['id']);
  478. $ud['address'] = str_replace("'","’",$ud['address']);
  479. $ud['name'] = str_replace("'","’",$ud['name']);
  480. $customer = $this->customer->get_email($ud['email'],$value['shop']);
  481. $customernum = $this->fullorder->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."' and extra_status = 0");
  482. preg_match_all('/[0-9]/u',$ud['phone'],$result);
  483. $numphone = join('',$result[0]);
  484. $hmdaddress1 = str_replace(array(' parkway',' drive',' street',' road',' avenue',' boulevard',' alley',' court',' place',' lane',' manor',' terrace',' trail',' view',' cove'),array(' pkwy',' dr',' st',' rd',' av',' blvd',' aly',' ct',' pl',' ln',' mnr',' ter',' trl',' vw',' cv'),strtolower($ud['address']));
  485. $hmdaddress2 = str_replace(array(' pkwy',' dr',' st',' rd',' av',' blvd',' aly',' ct',' pl',' ln',' mnr',' ter',' trl',' vw',' cv'),array(' parkway',' drive',' street',' road',' avenue',' boulevard',' alley',' court',' place',' lane',' manor',' terrace',' trail',' view',' cove'),strtolower($ud['address']));
  486. $hmdaddress3 = str_replace(array(' avenue',' ave',' av'),array(' ave',' avenue',' ave'),strtolower($ud['address']));
  487. if($numphone == '0')
  488. {
  489. $customerb = $this->customer->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or address = '".$hmdaddress1."' or address = '".$hmdaddress2."' or address = '".$hmdaddress3."' or phone = '".$numphone."')",'*','id desc');
  490. }
  491. else
  492. {
  493. $customerb = $this->customer->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or address = '".$hmdaddress1."' or address = '".$hmdaddress2."' or address = '".$hmdaddress3."' or numphone = '".$numphone."')",'*','id desc');
  494. }
  495. $customerc = $this->customer->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');
  496. $customerd = $this->customer->find_all("type = 2 and shop = '".$ud['shop']."' and email = '".$ud['email']."'",'*','id desc');
  497. //$a = array_column($customer, 'email'); //三维找其中健的数组
  498. //$a = array_flip($a); //键和值调换
  499. $djcount = '';
  500. $lkh = $value['sname'];
  501. $djlkh = 0;$djhmd = 0;
  502. if($customer)
  503. {
  504. if($customer['count'] != '' && $customernum < 2)
  505. {
  506. $count = '<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>';
  507. $djcount = $count;
  508. }
  509. if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1
  510. {
  511. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  512. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";
  513. $djlkh = 1;
  514. $djcount = $count;
  515. }
  516. else if(isset($customerc[0]['num']))
  517. {
  518. if($customerc[0]['num'] > 1)
  519. {
  520. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  521. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";
  522. $djlkh = 1;
  523. $djcount = $count;
  524. }
  525. }
  526. }
  527. if($customerb)
  528. {
  529. $hmsp = $this->shop->read($customerb[0]['shop']);
  530. $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';
  531. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  532. $djhmd = 1;
  533. if($customerd)
  534. {
  535. if($customerd[0]['num'] > 1)
  536. {
  537. $count = $customerd[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerd[0]['count'].'"></i>':'';
  538. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
  539. $djlkh = 1;
  540. $djcount = $count;
  541. $djlkh = 1;
  542. }
  543. }
  544. }
  545. if($djlkh == '1' && $djhmd == '1')
  546. {
  547. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  548. }
  549. if($djlkh != '1' && $djhmd != '1' && $djcount)
  550. {
  551. $info_list[$key]['sname'] = $lkh."<p style='color:#FF3333'>".$djcount."</p>";
  552. }
  553. else
  554. {
  555. $info_list[$key]['sname'] = $lkh;
  556. }
  557. $shop = $this->shop->read($value['shop']);
  558. $info_list[$key]['shop'] = $shop['shopname'];
  559. //$info_list[$key]['user'] = $shop['shopuser'];
  560. $warehouse = $this->warehouse->read($value['type']);
  561. $warehousetitle = $warehouse['title'];
  562. if($value['type'] != 13){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  563. $info_list[$key]['type'] = $warehousetitle;
  564. if(empty($ud['send_email'])){
  565. $info_list[$key]['email'] = '<em style="font-size: 13px;">'.$value['email'].'</em><br />'.$ud['phone'];
  566. }else{
  567. $info_list[$key]['email'] = '<em style="font-size: 13px;">'.$value['email'].'</em><br />'.'<em style="font-size: 13px;">'.$ud['send_email'].'</em><br />'.$ud['phone'];
  568. }
  569. $typeclass = $this->typeclass->read($value['state']);
  570. $info_list[$key]['state'] = "<font style='font-size: 13px;'>".$typeclass['spare']."</font>";
  571. /**
  572. $wl = '';
  573. if($value['exstate'] == '99')
  574. {
  575. $wl = '<font style="color:#ccc">未获取到物流信息</font>';
  576. }
  577. else if($value['exstate'] == '1')
  578. {
  579. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';
  580. }
  581. else if($value['exstate'] == '2')
  582. {
  583. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';
  584. }
  585. else if($value['exstate'] == '3')
  586. {
  587. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';
  588. }
  589. else if($value['exstate'] == '4')
  590. {
  591. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';
  592. }
  593. else if($value['exstate'] == '5')
  594. {
  595. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';
  596. }
  597. $info_list[$key]['exstate'] = $wl.'<br />';
  598. **/
  599. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  600. {
  601. $info_list[$key]['buytime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$ud['dtime']).'</p><p style="font-size: 13px;">'.date('H:i:s',$ud['dtime']).'</p>';
  602. }
  603. else
  604. {
  605. $info_list[$key]['buytime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$value['buytime']+$dt).'</p><p style="font-size: 13px;">'.date('H:i:s',$value['buytime']+$dt).'</p>';
  606. }
  607. if($value['review'] == 1)
  608. {
  609. $info_list[$key]['review'] = "<font style='font-size: 13px;'>未送审</font>";
  610. }
  611. else if($value['review'] == 2)
  612. {
  613. $info_list[$key]['review'] = "<font style='color:#555;font-size: 13px;'>待审核</font>";
  614. }
  615. else if($value['review'] == 3)
  616. {
  617. $info_list[$key]['review'] = "<font style='color:#f90f4b;font-size: 13px;'>不通过</font>";
  618. }
  619. else if($value['review'] == 4)
  620. {
  621. $info_list[$key]['review'] = "<font style='font-size: 13px;'>取消重审</font>";
  622. }
  623. else if($value['review'] == 5)
  624. {
  625. $info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>审核通过</font>";
  626. }
  627. else if($value['review'] == 6)
  628. {
  629. $info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>自动通过</font>";
  630. }
  631. if($ud['dlz'] == 1)
  632. {
  633. $dlz = "<p>独立站已更新</p>";
  634. }
  635. else if($ud['dlz'] == 3)
  636. {
  637. $dlz = "<p>不需要更新</p>";
  638. }
  639. else if($ud['dlz'] == 2)
  640. {
  641. $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
  642. }
  643. else
  644. {
  645. $dlz = "";
  646. }
  647. if($value['waybill'] != "")
  648. {
  649. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
  650. //如果是云尚快线那么需要展示一个可以查全程的运单号
  651. if( !empty($value['waybillid'])){
  652. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz."<p>".$value['waybillid']."</p>";
  653. }
  654. }
  655. if($value['express'] != 0)
  656. {
  657. $express = $this->express->read($value['express']);
  658. $expressservicename = $express['servicename'];
  659. if($value['express'] != 1 && $value['express'] != 63)
  660. {
  661. $expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";
  662. }
  663. else if($value['express'] == 63)
  664. {
  665. $expressservicename = "<font style='color:#a910f8'>".$express['servicename']."</font>";
  666. }
  667. $info_list[$key]['express'] = $expressservicename;
  668. }
  669. else
  670. {
  671. $info_list[$key]['express'] = "无";
  672. }
  673. $x = "";
  674. if($value['libraryconfirm'] == 2 && $value['review'] > 4 && $ud['library'] == 1)
  675. {
  676. $x = "<p class='ckn'><b class='fojz' data-type='1'>禁止发货</b></p>";
  677. }
  678. else if(($value['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1)
  679. {
  680. $x = "<p class='ckn'><b class='fojzof' data-type='6' data-id='".$value['id']."'>允许发货</b></p>";
  681. }
  682. if(($value['review'] > 4) && $ud['print'] == 2)
  683. {
  684. $x = "<p class='ckn'><b class='fojzof' data-type='7' data-id='".$value['id']."'>禁止打印</b></p>";
  685. }
  686. else if($value['review'] >4 && $ud['print'] == 1)
  687. {
  688. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  689. }
  690. if($value['waybill'] == "" && $value['review'] > 4)
  691. {
  692. $x .= "<p><b class='kn' data-type='2'>填写运单号</b></p>";
  693. }
  694. else if($value['waybill'] != "" && $value['review'] > 4)
  695. {
  696. $x .= "<p><b class='kn' data-type='2'>修改运单号</b></p>";
  697. }
  698. if(($value['review'] == 1 || $value['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0 && ($ud['merge'] == 0 || $ud['merge'] != 0 && $ud['merge'] == $ud['id']))
  699. {
  700. $x .= "<p><b class='focz' data-type='2' data-id='".$value['id']."'>提交审核</b></p>";
  701. }
  702. $x .= "<p><b class='window' data-h='/customer/edit/".$customer['id']."' data-t='客户信息 - 修改'>客户信息</b></p>";
  703. $info_list[$key]['black'] = $x;
  704. $tly = "";
  705. if($value['clientremarks'] != "")
  706. {
  707. $tly = "<p style='color:#FF3333'>有客户留言</p>";
  708. }
  709. if($value['review'] > 4 && $usp['vip'] != 1 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id']))
  710. {
  711. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/readonly/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  712. }
  713. else if($ud['merge'] == 0 || $ud['merge'] == $ud['id'])
  714. {
  715. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  716. }
  717. else if($ud['merge'] != 0 && $ud['merge'] != $ud['id'])
  718. {
  719. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."' style='color:#000'><p>".$value['orderinfo']."</p>".$tly."</h9>"."<p>合并订单</p>";
  720. }
  721. //else
  722. //{
  723. // $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";
  724. //}
  725. if($value['library'] == 1 && $ud['printtype'] == 3)
  726. {
  727. $info_list[$key]['library'] = "不需要";
  728. }
  729. else if($value['library'] == 1 && $ud['printtype'] != 3)
  730. {
  731. $info_list[$key]['library'] = "未出库";
  732. }
  733. else if($value['library'] == 2)
  734. {
  735. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
  736. }
  737. else if($value['library'] == 3)
  738. {
  739. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
  740. }
  741. unset($info_list[$key]['waybillid']);
  742. }
  743. $total = $this->fullorder->find_count($where);
  744. $pagenum = ceil($total/$perpage);
  745. $over = $total-($start+$perpage);
  746. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  747. echo json_encode($rows);exit;
  748. }
  749. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  750. $this->data['wlshop'] = $wlshop;
  751. $this->data['express'] = $this->express->find_all();
  752. $user = $this->user->get_api($_SESSION['api']);
  753. $powerid = $this->power->read($user['power']);
  754. $powertext = explode('|',trim($powerid['excelid'],'|'));
  755. $pid = '';
  756. foreach ($powertext as $v)
  757. {
  758. $pid .= " id = ".$v." or";
  759. }
  760. $fullorderexcel = $this->fullorderexcel->find_all("type = '100001' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
  761. $this->data['fullorderexcel'] = $fullorderexcel;
  762. $error = $this->fullorder->find_count("failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').") and dtime > '".(time()-90*24*3600)."'");
  763. $this->data['error'] = $error;
  764. $cs_num = $this->fullordererrors->find_count( " plat = 'fullorder' and error_type = 1 and (".rtrim($fgshop,'or'). " ) and error_time > '".(time()-90*24*3600)."'");
  765. $this->data['cs_num'] = $cs_num;
  766. $this->data['power'] = $vip;
  767. $this->_Template('fullorder',$this->data);
  768. }
  769. //筛选重复订单
  770. public function _repeat()
  771. {
  772. $user = $this->user->get_api($_SESSION['api']);
  773. if($user)
  774. {
  775. $fgshop = "";$sid = "";
  776. $user = explode('|',trim($user['shop'],'|'));
  777. foreach ($user as $value)
  778. {
  779. $fgshop .= " shop = ".$value." or";
  780. $sid .= " id = ".$value." or";
  781. }
  782. }
  783. $post = $this->input->post(NULL, TRUE);
  784. if(isset($post['page']))
  785. {
  786. $page = $this->input->post('page',true);
  787. $perpage = $this->input->post('perpage',true);
  788. $shop = $this->input->post('shop',true);
  789. $email = $this->input->post('email',true);
  790. $timetk = $this->input->post('timetk',true);
  791. $timetj = $this->input->post('timetj',true);
  792. $timetk = strtotime($timetk);
  793. $timetj = strtotime($timetj);
  794. $where = "print != 999 and state = 207 and review = 1 and number NOT like '%-%-%-%' and (".rtrim($fgshop,'or').")";
  795. if($shop)
  796. {
  797. $where .= " and shop = '$shop'";
  798. }
  799. if($email)
  800. {
  801. $where .= " and email = '$email'";
  802. }
  803. if($timetk && $timetj)
  804. {
  805. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  806. }
  807. //数据排序
  808. $order_str = "id desc";
  809. if(empty($page))
  810. {
  811. $start = 0;
  812. $perpage = 1;
  813. }
  814. else
  815. {
  816. $start = ($page - 1)*$perpage;
  817. }
  818. //取得信息列表
  819. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,name,email,address,state,dtime,shipremarks,type,merge');
  820. $info = array();
  821. $len = count($info_list);
  822. //格式化数据
  823. foreach ($info_list as $key=>$value)
  824. {
  825. $ud = $this->fullorder->read($value['id']);
  826. $shop = $this->shop->read($value['shop']);
  827. $warehouse = $this->warehouse->read($value['type']);
  828. $info_list[$key]['shop'] = '<p>'.$shop['shopname'].'</p>'.'<p>'.$warehouse['title'].'</p>';
  829. $info_list[$key]['email'] = '<p>'.$value['email'].'</p>'.'<p>'.$ud['phone'].'</p>';
  830. $typeclass = $this->typeclass->read($value['state']);
  831. $info_list[$key]['state'] = $typeclass['spare'];
  832. $info_list[$key]['type'] = $ud['orderremarks'];
  833. $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']).'</p><p>'.date('H:i:s',$value['dtime']).'</p>';
  834. if($value['merge'] == 0)
  835. {
  836. $info_list[$key]['merge'] = "<p>可合并</p>";
  837. }
  838. else
  839. {
  840. if($value['merge'] == $value['id'])
  841. {
  842. if($ud['print'] < '3' && $ud['library'] == '1')
  843. {
  844. $info_list[$key]['merge'] = "<p><b class='cforder' data-id='".$value['id']."'>拆分订单</b></p>";
  845. }
  846. else
  847. {
  848. $info_list[$key]['merge'] = "已合并";
  849. }
  850. }
  851. else
  852. {
  853. $info_list[$key]['merge'] = "被合并";
  854. }
  855. }
  856. }
  857. /** 操作合并
  858. if($value['merge'] == 0)
  859. {
  860. $info_list[$key]['merge'] = "<p><b class='jd' data-type='5'>合并订单</b></p>";
  861. }
  862. else
  863. {
  864. if($value['merge'] == $value['id'])
  865. {
  866. $info_list[$key]['merge'] = "已合并";
  867. }
  868. else
  869. {
  870. $info_list[$key]['merge'] = "被合并";
  871. }
  872. }
  873. **/
  874. $asd = array();
  875. for($i=0;$i<$len;$i++)
  876. {
  877. for($j=$i+1;$j<$len;$j++)
  878. {
  879. if (strtolower($info_list[$i]['address']) == strtolower($info_list[$j]['address']) && stripos($info_list[$i]['number'],$info_list[$j]['number']) === false && stripos($info_list[$j]['number'],$info_list[$i]['number']) === false) //$info_list[$i]['email'] == $info_list[$j]['email']
  880. {
  881. if(!array_key_exists($j,$info))
  882. {
  883. $info[$j] = $info_list[$j];
  884. }
  885. if(!array_key_exists($i,$info))
  886. {
  887. $info[$i] = $info_list[$i];
  888. }
  889. }
  890. }
  891. }
  892. rsort($info);
  893. $total = count($info);
  894. $pagenum = ceil($total/$perpage);
  895. $over = $total-($start+$perpage);
  896. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage)));
  897. echo json_encode($rows);exit;
  898. }
  899. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  900. $this->data['wlshop'] = $wlshop;
  901. $this->_Template('fullorder_repeat',$this->data);
  902. }
  903. //修改
  904. public function _edit($arg_array)
  905. {
  906. if(isset($_SESSION['api']))
  907. {
  908. $user = $this->user->get_api($_SESSION['api']);
  909. if($user['vip'] == 1)
  910. {
  911. $vip = 1;
  912. }
  913. else
  914. {
  915. $vip = 0;
  916. }
  917. $this->data['userid'] = $user['id'];
  918. }
  919. else
  920. {
  921. $this->data['userid'] = 0;
  922. $vip = 0;
  923. }
  924. $post = $this->input->post(NULL, TRUE);
  925. if(isset($post['id']))
  926. {
  927. // $dtsbjz = $this->input->post('dtsbjz',true);
  928. // $ts = $this->input->post('ts',true);
  929. // $dtsbjz = sprintf("%.2f",$dtsbjz);
  930. // $total_sbjz = $dtsbjz*$ts;
  931. // $tmp_zsbjz = $this->input->post('zsbjz',true);
  932. // $tmp_zsbjz = sprintf("%.2f",$tmp_zsbjz);
  933. // if($tmp_zsbjz*1 != $total_sbjz){
  934. // echo json_encode(array('msg'=>'单条申报价为2为小数!','success'=>false));exit;
  935. // }
  936. $id = $this->input->post('id',true);
  937. $data = $this->fullorder->read($id);
  938. $post['type'] = $this->input->post('warehouse',true);
  939. $post['country'] = $this->input->post('country',true);
  940. $currency = $this->country->read($post['country']);
  941. $post['al'] = $currency['lb'];
  942. $post['freight'] = $this->input->post('freight',true);
  943. $post['expressmoney'] = $this->input->post('expressmoney',true);
  944. $post['shouldmoney'] = $this->input->post('shouldmoney',true);
  945. $orderremarks = $this->input->post('orderremarks');
  946. $orderremarks = str_replace(array('%26','%2B'),array('&','+'),$orderremarks);
  947. $post['orderremarks'] = $orderremarks;
  948. $shipremarks = $this->input->post('shipremarks');
  949. $shipremarks = str_replace(array('%26','%2B'),array('&','+'),$shipremarks);
  950. $post['shipremarks'] = preg_replace('/( | | |\s)/',' ',$shipremarks);
  951. $email = $this->input->post('email',true);
  952. $post['email'] = preg_replace('/( | | |\s)/','',$email);
  953. //$post['paypal'] = $this->input->post('paypal',true);
  954. $name = $this->input->post('name',true);
  955. $post['name'] = str_replace("'","’",$name);
  956. $post['phone'] = $this->input->post('phone',true);
  957. $post['phone'] = preg_replace('/\D/s','',$post['phone']);
  958. $post['phone'] = preg_replace('/( | | |\s)/','',$post['phone']);
  959. $post['country'] = $this->input->post('country',true);
  960. $post['province'] = $this->input->post('province',true);//省、州
  961. $post['province'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['province']); //替换开头空字符
  962. $post['province'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['province']); //替换结尾空字符
  963. $post['city'] = $this->input->post('city',true);//城市
  964. $post['city'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['city']); //替换开头空字符
  965. $post['city'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['city']); //替换结尾空字符
  966. $post['zipcode'] = $this->input->post('zipcode',true);//邮编
  967. $post['zipcode'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['zipcode']); //替换开头空字符
  968. $post['zipcode'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['zipcode']); //替换结尾空字符
  969. $post['street'] = $this->input->post('street',true);
  970. $address = $this->input->post('address',true);
  971. $address = preg_replace('/( | | |\s)/',' ',$address);
  972. $post['address'] = str_replace("'","’",$address);
  973. $address2 = $this->input->post('address2',true);
  974. $address2 = preg_replace('/( | | |\s)/',' ',$address2);
  975. if($address2 == ' ')
  976. {
  977. $address2 = '';
  978. }
  979. $post['address2'] = str_replace("'","’",$address2);
  980. $post['express'] = $this->input->post('express',true);
  981. $post['printtype'] = $this->input->post('printtype',true);
  982. $fpdata = $this->input->post('fpdata');
  983. $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);
  984. $post['fpdata'] = $fpdata;
  985. $post['waybill'] = $this->input->post('waybill',true);
  986. $post['msg'] = $this->input->post('msg',true);
  987. $post['zsbjz'] = $this->input->post('zsbjz',true);
  988. $post['refundy'] = $this->input->post('refundy',true);
  989. $post['refundj'] = $this->input->post('refundj',true);
  990. $rtime = $this->input->post('rtime',true);
  991. $post['rtime'] = strtotime($rtime);
  992. $post['rpaypal'] = $this->input->post('rpaypal',true);
  993. $post['rtext'] = $this->input->post('rtext',true);
  994. $post['sbpm'] = $this->input->post('sbpm',true);
  995. $post['edittime'] = time();
  996. $editstate = $this->input->post('state',true);
  997. if(!$editstate)
  998. {
  999. $editstate = $data['state'];
  1000. }
  1001. $whlabel = $this->input->post('whlabel',true);
  1002. $fpcount = $this->input->post('fpcount',true);
  1003. $post['ioss'] = $this->input->post('ioss',true);
  1004. $post['waybill'] = preg_replace('/( | | | |\s)/','',$post['waybill']);
  1005. $pay = $this->pay->get_typeclass($data['pay']);
  1006. $yga = $post['shouldmoney'];
  1007. $ygc = $data['estimaterate'];
  1008. $post['budget'] = 0;
  1009. if($post['email'] == $post['send_email']){
  1010. $post['send_email'] = '';
  1011. }
  1012. $ifbudget = eval("return $yga*1.$ygc;");
  1013. if($ifbudget > 0)
  1014. {
  1015. $post['budget'] = eval("return $yga*1.$ygc;");
  1016. }
  1017. $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;
  1018. foreach ($whlabeldata as $va)
  1019. {
  1020. if(stripos($va,'z') !== false)
  1021. {
  1022. $way += 1;
  1023. }
  1024. }
  1025. //如果备注中出现网红的两个字 ,那么在fpdata种的品名中必须有 WH这两个字 且美仓不用
  1026. if($post['type'] !=5 ){
  1027. if(stripos($post['shipremarks'],'网红') !== false){
  1028. if(stripos($post['fpdata'],'-2090-') === false){
  1029. echo json_encode(array('msg'=>'网红单请在商品名称中勾选WH!','success'=>false));exit;
  1030. }
  1031. }
  1032. }
  1033. if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64) && $post['type'] != 5) )
  1034. {
  1035. echo json_encode(array('msg'=>'此快递方式必须从美仓发货!','success'=>false));exit;
  1036. }
  1037. if( ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['type'] == 5)){
  1038. echo json_encode(array('msg'=>'此快递方式不能美仓发货!','success'=>false));exit;
  1039. }
  1040. //仅独立站 地址美国对电话 10或者11位进行判断
  1041. if($post['country'] == 192){
  1042. if((strlen($post['phone'])!= 10) && (strlen($post['phone'])!= 11)){
  1043. echo json_encode(array('msg'=>'美国电话号码应为10/11位!','success'=>false));exit;
  1044. }
  1045. }
  1046. //减少代码复用吧
  1047. $lo_ret = $this->logic_order->checkEditExpress($post);
  1048. if($lo_ret['code'] != 1){
  1049. echo json_encode(array('msg'=>$lo_ret['msg'],'success'=>false));exit;
  1050. }
  1051. //检测PayPal有但是为空的情况
  1052. if(isset($post['paypal'])){
  1053. if(empty($post['paypal'])){
  1054. echo json_encode(array('msg'=>'交易号不可为空!','success'=>false));exit;
  1055. }
  1056. }else{
  1057. $tmp_info = $this->fullorder->read($post['id']);
  1058. if(empty($tmp_info)){
  1059. echo json_encode(array('msg'=>'订单信息异常','success'=>false));exit;
  1060. }
  1061. if(empty($tmp_info['paypal'])){
  1062. echo json_encode(array('msg'=>'交易号不可为空!','success'=>false));exit;
  1063. }
  1064. }
  1065. // if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 ||
  1066. // {
  1067. // echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
  1068. // }
  1069. if($post['express'] == 24 && $post['sbpm'] != 'Hair Sample' && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 ||
  1070. {
  1071. echo json_encode(array('msg'=>'此快递方式必须选择Hair Sample/Human Hair Wigs/Human Hair Goods!','success'=>false));exit;
  1072. }
  1073. if($post['country'] != 192 && $post['express'] == 1 && $post['sbpm'] != 'Synthetic Hair Wigs' && $post['sbpm'] != 'Synthetic Hair Goods')//$post['express'] == 3 ||
  1074. {
  1075. echo json_encode(array('msg'=>'非美国选择官方DHL必须选择Synthetic Hair Wigs/Synthetic Hair Goods','success'=>false));exit;
  1076. }
  1077. if($way == count($whlabeldata) && $post['type'] != 12)
  1078. {
  1079. echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;
  1080. }
  1081. if($way == '0' && $post['type'] == 12)
  1082. {
  1083. echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;
  1084. }
  1085. $post['review'] = 1;
  1086. if($post['zsbjz'] < '0.01')
  1087. {
  1088. echo json_encode(array('msg'=>'总申报价错误!','success'=>false));exit;
  1089. }
  1090. if($data['library'] == 1)
  1091. {
  1092. if($data['print'] != 3)
  1093. {
  1094. $post['print'] = 1;
  1095. $post['libraryconfirm'] = 1;
  1096. $post['librarynot'] = "订单未打印,未审核或未通过";
  1097. }
  1098. else
  1099. {
  1100. $post['libraryconfirm'] = 1;
  1101. $post['librarynot'] = "订单被修改或重新提交";
  1102. }
  1103. }
  1104. if($data['yhs'] == 1)
  1105. {
  1106. echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;
  1107. }
  1108. if($post['express'] == 2 && (stripos($post['name'],'&') !== false || stripos($post['name'],"'") !== false))
  1109. {
  1110. echo json_encode(array('msg'=>'USPS收件人或公司名不可用特殊符号!','success'=>false));exit;
  1111. }
  1112. if(strlen($post['client']) > 34 || strlen($post['name']) > 34)//收件人姓名或公司名不允许超过35位
  1113. {
  1114. echo json_encode(array('msg'=>'收件人姓名或公司名不可超过34个字符!','success'=>false));exit;
  1115. }
  1116. if($post['express'] == '3' && $post['address2'] != '')//UPS不允许提交地址2
  1117. {
  1118. echo json_encode(array('msg'=>'UPS不允许提交地址2','success'=>false));exit;
  1119. }
  1120. if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $post['country'] != 192)
  1121. {
  1122. echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;
  1123. }
  1124. if($post['express'] == '3' && $post['country'] != 192 && $post['country'] != 35)
  1125. {
  1126. echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;
  1127. }
  1128. if($post['country'] == 35 && $post['zsbjz'] > 20)
  1129. {
  1130. echo json_encode(array('msg'=>'加拿大最高申报不可超过20','success'=>false));exit;
  1131. }
  1132. if(($post['express'] == '28' || $post['express'] == '7') && $post['country'] != 191)
  1133. {
  1134. echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;
  1135. }
  1136. $express = $this->express->read($post['express']);
  1137. if($express['ioss'] == 1 && $post['ioss'] == '')
  1138. {
  1139. echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;
  1140. }
  1141. if(strlen($post['address']) > $express['addresssize'] || strlen($post['address2']) > $express['addresssize'])
  1142. {
  1143. echo json_encode(array('msg'=>'此快递地址不可超出'.$express['addresssize'].'个字符','success'=>false));exit;
  1144. }
  1145. if(strlen($post['address']) < 5)
  1146. {
  1147. echo json_encode(array('msg'=>'地址不可留空!','success'=>false));exit;
  1148. }
  1149. if(($express['sbjz'] > 0) && ($post['zsbjz'] > $express['sbjz']))
  1150. {
  1151. echo json_encode(array('msg'=>'总申报价值不可超出'.$express['sbjz'],'success'=>false));exit;
  1152. }
  1153. if($post['shouldmoney'] > $express['shouldmoney'] && $express['shouldmoney'] != 0)
  1154. {
  1155. echo json_encode(array('msg'=>'订单金额不可超出'.$express['shouldmoney'],'success'=>false));exit;
  1156. }
  1157. if($post['express'] == '2' && $post['zzl'] > '16' && isset($post['js']) && $post['js'] == '0')
  1158. {
  1159. echo json_encode(array('msg'=>'重量大于16不可按Ground Advantage提交!','success'=>false));exit;
  1160. }
  1161. // if($post['express'] == '2' && isset($post['js']) && $post['js'] == '0'&& $post['qm'] == '1')
  1162. // {
  1163. // echo json_encode(array('msg'=>'Ground Advantage不可使用签名服务!','success'=>false));exit;
  1164. // }
  1165. if(isset($post['bx']))
  1166. {
  1167. if($post['express'] == '99' && $post['bx'] > 0)
  1168. {
  1169. echo json_encode(array('msg'=>'此物流不允许购买保险','success'=>false));exit;
  1170. }
  1171. }
  1172. if(($post['express'] == '3' || $post['express'] == '42' || $post['express'] == '24') && $post['shouldmoney'] < 1)
  1173. {
  1174. //echo json_encode(array('msg'=>'零金额订单不可发 UPS/DHL官方-美国/Fedex(杭州)','success'=>false));exit;
  1175. }
  1176. if($post['express'] == '42' && $post['zsbjz'] < 1)
  1177. {
  1178. echo json_encode(array('msg'=>'零申报金额不可发 DHL官方-美国','success'=>false));exit;
  1179. }
  1180. if($post['express'] == '6' && $post['province'] == '')
  1181. {
  1182. echo json_encode(array('msg'=>'选择DPEX必须填写州信息','success'=>false));exit;
  1183. }
  1184. if(($post['express'] == '24' || $post['express'] == '3') && $post['shouldmoney'] == 0)
  1185. {
  1186. echo json_encode(array('msg'=>'0金额订单不可发UPS/Fedex(杭州)!!!','success'=>false));exit;
  1187. }
  1188. if($post['country'] == '35' && $post['zsbjz'] > 20)
  1189. {
  1190. echo json_encode(array('msg'=>'加拿大不可申报超过20美金!!!','success'=>false));exit;
  1191. }
  1192. if($post['printtype'] == 1)//如果是运单
  1193. {
  1194. $post['productdescription'] = $this->input->post('productdescription',true);
  1195. $post['customs'] = $this->input->post('customs',true);
  1196. }
  1197. if($post['express'] == 2 && strlen($post['zipcode']) != 5)//如果usps 邮编不是5位
  1198. {
  1199. echo json_encode(array('msg'=>'USPS-USA的邮编需按5位数格式提交!','success'=>false));exit;
  1200. }
  1201. if(strlen($post['phone']) > 11 && $post['express'] == 63)
  1202. {
  1203. echo json_encode(array('msg'=>'美国联邦,电话号码不允许超过11位!','success'=>false));exit;
  1204. }
  1205. /**
  1206. if($post['paypal'] != '')
  1207. {
  1208. $pp = $this->fullorder->get_paypal($post['paypal']);
  1209. if(isset($pp['number']) && $pp['number'] != $data['number'])
  1210. {
  1211. echo json_encode(array('msg'=>'此交易号的订单已存在!-'.$pp['number'],'success'=>false));exit;
  1212. }
  1213. }
  1214. **/
  1215. /**
  1216. if($editstate == 216 && $data['state'] != 216)
  1217. {
  1218. echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
  1219. }
  1220. **/
  1221. $post['review'] = $data['review'];
  1222. $post['state'] = $editstate;
  1223. if($editstate == 216)
  1224. {
  1225. foreach ($post as $k=>$v)
  1226. {
  1227. if($k == 'shipremarks' || $k == 'whlabel' || $k == 'fpdata' || $k == 'fpcount' || $k == 'refundy' || $k == 'refundj' || $k == 'rtime' || $k == 'rpaypal' || $k == 'rtext' || $k == 'freight' || $k == 'expressmoney' || $k == 'edittime' || $k == 'librarynot' || $k == 'state' || $k == 'jweight' || $k == 'productdescription')
  1228. {
  1229. continue;
  1230. }
  1231. else
  1232. {
  1233. //当时不知道为会把 当前不可修改订单信息 给注释掉 但是 如果注释掉 这个判断就没意义了 还引起了报错 我这里就注释掉了
  1234. // if($v != $data[$k])
  1235. // {
  1236. // //echo json_encode(array('msg'=>'当前不可修改订单信息','cs'=>$k,'success'=>false));exit;
  1237. // }
  1238. }
  1239. }
  1240. }
  1241. /**
  1242. if($editstate == 216 && $post['waybill'] != '' && $data['waybill'] != '')//if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true)
  1243. {
  1244. echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit;
  1245. }
  1246. else
  1247. {
  1248. $post['review'] = $data['review'];
  1249. $post['state'] = $editstate;
  1250. }
  1251. **/
  1252. $thisdata = $this->fullorder->read($id);
  1253. $warehouse = $this->warehouse->read($thisdata['type']);
  1254. $warehousenew = $this->warehouse->read($post['type']);
  1255. if($warehousenew['bdcountry'] != 0 && $post['country'] != $warehousenew['bdcountry'])
  1256. {
  1257. echo json_encode(array('msg'=>'当前国家无法选择'.$warehousenew['title'].'!','success'=>false));exit;
  1258. }
  1259. if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
  1260. {
  1261. echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;
  1262. }
  1263. $expt = $this->express->read($post['express']);
  1264. if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false)
  1265. {
  1266. echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;
  1267. }
  1268. if($expt['province'] != '' && stripos($expt['province'],$post['province'].'、') !== false)
  1269. {
  1270. echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;
  1271. }
  1272. /**
  1273. if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])
  1274. {
  1275. echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;
  1276. }
  1277. **/
  1278. //开始注释 xyxg
  1279. /**
  1280. $ft = array();
  1281. $ftdata = explode('|',rtrim($fpcount,'|'));
  1282. foreach ($ftdata as $va)
  1283. {
  1284. $ftitle = '';
  1285. $va = explode('-',trim($va,'-'));
  1286. foreach ($va as $v)
  1287. {
  1288. $v = $this->typeclass->read($v);
  1289. $ftitle .= $v['title'].' ';
  1290. }
  1291. $ft[] = rtrim($ftitle,' ');
  1292. }
  1293. if($data['library'] == 1)
  1294. {
  1295. $tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$data['shop'],$data['number']);
  1296. if(isset($tqkcyz[0]))
  1297. {
  1298. echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;
  1299. }
  1300. if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)
  1301. {
  1302. $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);
  1303. if($tskcyz['t'] > '0')
  1304. {
  1305. echo $tskcyz['m'];exit;
  1306. }
  1307. }
  1308. $kcyz = $this->whlabel->get_kc($thisdata['state'],$post['state'],$warehousenew['zd'],$warehousenew['ys'],$post['type'],$whlabel,$fpcount,$ft,$thisdata['number'],$thisdata['shop'],$thisdata['type'],$thisdata['whlabel']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字
  1309. if($kcyz['t'] > '0')
  1310. {
  1311. echo $kcyz['m'];exit;
  1312. }
  1313. }
  1314. //结束注释
  1315. **/
  1316. /** 重新写产品名称
  1317. $dtctitle = array();
  1318. $dictionaries = $this->typeclass->find_all();
  1319. foreach ($dictionaries as $v)
  1320. {
  1321. $dtctitle[$v['id']] = array($v['title'],$v['bqsku']);
  1322. }
  1323. if(stripos($fpdata,'-128-') !== false || stripos($fpdata,'-127-') !== false)
  1324. {
  1325. $dfp = explode(';',trim($fpdata,';'));
  1326. $fdata = '';
  1327. foreach ($dfp as $k=>$v)
  1328. {
  1329. $ptitleb = '';
  1330. $fp = explode('|',trim($v,'|'));
  1331. $fp0 = explode(',',$fp[0]);
  1332. $fp1 = explode('-',trim($fp0[1],'-'));
  1333. foreach ($fp1 as $vv)
  1334. {
  1335. $ptitleb .= isset($dtctitle[$vv])?$dtctitle[$vv][0].' ':'';
  1336. }
  1337. $ptitleb .= $dtctitle[$fp0[0]][1].'inch ';
  1338. $fp[1] = $ptitleb;
  1339. $fdata .= implode("|",$fp).";";
  1340. }
  1341. $fpdata = $fdata;
  1342. }
  1343. **/
  1344. $warehouse = $this->warehouse->read($post['type']);
  1345. //未出库或者(已退库并且订单的状态不是等待买家收货和代发货状态)
  1346. if($data['library'] == 1 || ($data['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))
  1347. {
  1348. // echo "<pre>";
  1349. // var_dump($post['state']);
  1350. // var_dump($warehouse);
  1351. // var_dump($thisdata['shop']);
  1352. // var_dump($thisdata['number']);
  1353. // var_dump($whlabel);
  1354. // var_dump($fpdata);
  1355. // die;
  1356. $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);
  1357. if($kcyz['t'] > '0')
  1358. {
  1359. echo $kcyz['m'];exit;
  1360. }
  1361. else if($kcyz['fpdata'] != '')
  1362. {
  1363. $post['whlabel'] = $kcyz['whlabel'];
  1364. $post['fpdata'] = $kcyz['fpdata'];
  1365. }
  1366. }
  1367. //$fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);
  1368. //$post['sfxh'] = $fl['sfxh'];
  1369. //$post['ckfl'] = $fl['ckfl'];
  1370. //查询净重开始
  1371. $post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
  1372. unset($post[0]);
  1373. //查询净重结束
  1374. if($this->fullorder->save($post,$id))
  1375. {
  1376. if($data['printtime'] == '0')
  1377. {
  1378. $xghz = ',将自动禁止打印';
  1379. }
  1380. else if($data['printtime'] > '0' && $data['librarytime'] == '0')
  1381. {
  1382. $q = '';
  1383. if($data['libraryconfirm'] == 1)
  1384. {
  1385. $q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';
  1386. }
  1387. $xghz = ',将自动禁止发货'.$q;
  1388. }
  1389. else
  1390. {
  1391. $xghz = '';
  1392. }
  1393. echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit;
  1394. }
  1395. else
  1396. {
  1397. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  1398. }
  1399. }
  1400. $this->data['vip'] = $vip;
  1401. $arg_array = $arg_array[0];$fpdata = array();
  1402. $fullorder = $this->fullorder->read($arg_array);
  1403. $returngoods = $this->returngoods->get_orderinfo($fullorder['orderinfo']);
  1404. $this->data['returngoods'] = 0;
  1405. if(!empty($returngoods)){
  1406. if($returngoods['status'] != 120){
  1407. $this->data['returngoods'] = 1;
  1408. }
  1409. }
  1410. $fullorder['parameter'] = str_replace(",","---",$fullorder['parameter']);
  1411. $country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息
  1412. $express = $this->express->find_all('1=1');//所有快递配置信息
  1413. $this->data['fullorder'] = $fullorder;
  1414. if($fullorder['express'] == 2)
  1415. {
  1416. $zzhl = 'oz';
  1417. }
  1418. else
  1419. {
  1420. $zzhl = 'kg';
  1421. }
  1422. $this->data['zzhl'] = $zzhl;
  1423. $this->data['country'] = $country;
  1424. $this->data['express'] = $express;
  1425. $this->data['dtime'] = date('Y-m-d H:i:s',$fullorder['dtime']);
  1426. $warehouse = $this->warehouse->read($fullorder['type']);
  1427. if(stripos($fullorder['fpdata'],';') !== false)
  1428. {
  1429. $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
  1430. foreach ($fpdata as $k=>$v)
  1431. {
  1432. $xxv = explode('|',$v);
  1433. if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
  1434. {
  1435. $xxv['zd'] = "<p>已占单</p>";
  1436. $bdck = $warehouse['bdck'];
  1437. if(stripos($xxv[9],'~') !== false)
  1438. {
  1439. $dxxv = explode('~',trim($xxv[9],'~'));
  1440. foreach ($dxxv as $val)
  1441. {
  1442. $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
  1443. if($wzid['details'] != '')
  1444. {
  1445. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1446. }
  1447. }
  1448. }
  1449. else
  1450. {
  1451. $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
  1452. if($wzid['details'] != '')
  1453. {
  1454. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1455. }
  1456. }
  1457. }
  1458. $fpdata[$k] = $xxv;
  1459. }
  1460. }
  1461. $this->data['fpdata'] = $fpdata;
  1462. $thfpdataxs = array();
  1463. if($fullorder['thfpdata'] != '')
  1464. {
  1465. $thfpdata = explode(';',trim($fullorder['thfpdata'],';'));
  1466. foreach ($thfpdata as $k=>$v)
  1467. {
  1468. $thxs = explode('~',trim($v,'~'));
  1469. $thxs[0] = explode('|',trim($thxs[0],'|'));
  1470. $thxs[1] = explode('|',trim($thxs[1],'|'));
  1471. $thfpdataxs[] = array("<p>".$thxs[0][1]."<i class='fa fa-level-down'></i></p><p>".$thxs[1][1]."</p>","<p>".$thxs[0][2]."</p><p>".$thxs[1][2]."</p>","<p>旧</p><p>新</p>",$thxs[1][0]);
  1472. }
  1473. }
  1474. $this->data['thfpdata'] = $thfpdataxs;
  1475. $shop = $this->shop->read($fullorder['shop']);
  1476. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  1477. $is = 0;
  1478. if($shop['type'] == 269 || $shop['type'] == 2768)//判断是否独立站,269是独立站
  1479. {
  1480. $is = 1;
  1481. }
  1482. $this->data['is'] = $is;
  1483. if(isset($_SESSION['api']))
  1484. {
  1485. $user = $this->user->get_api($_SESSION['api']);
  1486. if($user['vip'] == 1)
  1487. {
  1488. $vip = 1;
  1489. }
  1490. else
  1491. {
  1492. $vip = 0;
  1493. }
  1494. }
  1495. else
  1496. {
  1497. $vip = 0;
  1498. }
  1499. $this->data['power'] = $vip;
  1500. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  1501. $downwaybill = '';$dwls = array();
  1502. $oldwaybill = explode('-',ltrim($fullorder['oldwaybill'],'-'));
  1503. if(isset($oldwaybill[0][1]))
  1504. {
  1505. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  1506. foreach ($oldwaybill as $v)
  1507. {
  1508. $dw = explode('/',$v);
  1509. if(isset($dw[1]))
  1510. {
  1511. if(stripos($downwaybill,$dw[1]) === false)
  1512. {
  1513. $dwls[$dw[1]] = 1;
  1514. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  1515. }
  1516. }
  1517. }
  1518. }
  1519. if($fullorder['printtype'] == 1)
  1520. {
  1521. if($fullorder['waybill'] != '' && !isset($dwls[$fullorder['waybill']]))
  1522. {
  1523. $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorder['printtime']).'/y-'.$fullorder['waybill'].'.pdf" target="_blank">'.$fullorder['waybill'].'</a>、'.$downwaybill;
  1524. }
  1525. }
  1526. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  1527. /** 历史打印时间 **/
  1528. $printtime = '';
  1529. if($fullorder['oldprinttime'])
  1530. {
  1531. $pte = explode('-',rtrim($fullorder['oldprinttime'],'-'));
  1532. foreach ($pte as $v)
  1533. {
  1534. if(!empty($v)){
  1535. $printtime .= date('Y-m-d H:i:s',$v).'、';
  1536. }
  1537. }
  1538. }
  1539. $this->data['printtime'] = rtrim($printtime,'、');
  1540. $product = '';
  1541. $fullorder['product'] = str_replace("'","",$fullorder['product']);
  1542. if($fullorder['link'] != '' && $fullorder['source'] != '1')
  1543. {
  1544. $pt = explode(',',$fullorder['product']);
  1545. $lk = explode(',',$fullorder['link']);
  1546. for($i=0;$i<count($pt);$i++)
  1547. {
  1548. if(isset($lk[$i]))
  1549. {
  1550. $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
  1551. }
  1552. else
  1553. {
  1554. $octs = '';
  1555. }
  1556. $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
  1557. //$a = (stripos($pt[$i],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($pt[$i],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($pt[$i],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($pt[$i],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($pt[$i],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($pt[$i],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($pt[$i],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($pt[$i],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($pt[$i],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$pt[$i].'</font>':$pt[$i];
  1558. if(isset($lk[$i]))
  1559. {
  1560. $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
  1561. }
  1562. else
  1563. {
  1564. $product .= ($product != '')?' , '.$a:$a;
  1565. }
  1566. }
  1567. }
  1568. else
  1569. {
  1570. $octs = $this->colourorderts->get_text($fullorder['product']);
  1571. $a = $octs?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
  1572. //$a = (stripos($fullorder['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorder['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorder['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorder['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorder['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorder['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorder['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorder['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorder['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
  1573. $product = $a;
  1574. }
  1575. $this->data['product'] = $product;
  1576. $out = $this->systemtransfer->find_all("number = '".$fullorder['number']."'");
  1577. $outread = '';
  1578. if($out)
  1579. {
  1580. foreach ($out as $val)
  1581. {
  1582. $list = '';
  1583. $rk = explode('|',trim($val['rk'],'|'));
  1584. $rktime = explode('|',trim($val['rktime'],'|'));
  1585. $zw = array();
  1586. $t = $this->transfer->find_all("1=1");
  1587. foreach ($t as $v)
  1588. {
  1589. $zw[$v['id']] = $v['title'];
  1590. }
  1591. if($val['rk'] != '' && count($rk) > 0)
  1592. {
  1593. for($i=0;$i<count($rk);$i++)
  1594. {
  1595. if(!isset($rktime[$i]))
  1596. {
  1597. if(isset($cz[$i]))
  1598. {
  1599. $list .= $zw[$cz[$i]];
  1600. }
  1601. }
  1602. else
  1603. {
  1604. $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
  1605. }
  1606. }
  1607. }
  1608. $outread .= '<span style="color:#f00">'.$val['shipremarks'].'</span>:'.$list.'<br>';
  1609. //$outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
  1610. }
  1611. }
  1612. else
  1613. {
  1614. $systemwigsout = $this->systemwigsout->find_all("number = '".$fullorder['number']."'");
  1615. $outread = array();
  1616. if($systemwigsout)
  1617. {
  1618. foreach ($systemwigsout as $v)
  1619. {
  1620. if($v['czwarehouse'] == 37)
  1621. {
  1622. $outread[] = '华荣厂';
  1623. }
  1624. else if($v['czwarehouse'] == 0)
  1625. {
  1626. $outread[] = '龙盈厂';
  1627. }
  1628. $cz = explode('|',trim($v['cz'],'|'));
  1629. $cztime = explode('|',trim($v['cztime'],'|'));
  1630. $zw = $this->transfer->get_list();
  1631. if($v['cz'] != '' && count($cz) > 0)
  1632. {
  1633. for($i=0;$i<count($cz);$i++)
  1634. {
  1635. if(!isset($cztime[$i]))
  1636. {
  1637. $outread[] = $zw[$cz[$i]].' -&gt; ';
  1638. }
  1639. else
  1640. {
  1641. $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -&gt; ';
  1642. }
  1643. }
  1644. $outread[] = '<br>';
  1645. }
  1646. }
  1647. }
  1648. }
  1649. $klarnacolor = '';
  1650. if($fullorder['klarnadata'] !='')
  1651. {
  1652. $klarnadata = explode('|',$fullorder['klarnadata']);
  1653. if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
  1654. {
  1655. $klarnadata[1] = json_decode($klarnadata[1],true);
  1656. if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorder['shouldmoney'] && $fullorder['pay'] == 1211)
  1657. {
  1658. $klarnacolor = 'style="color:#F00"';
  1659. }
  1660. }
  1661. else if($klarnadata[0]!=1 && $fullorder['pay']!=26 && $fullorder['pay']!=27 && $fullorder['pay']!=1211)
  1662. {
  1663. $klarnacolor = 'style="color:#F00"';
  1664. }
  1665. if($fullorder['pay'] == 23)//klarna
  1666. {
  1667. $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
  1668. $ToState = array_flip($ToState);
  1669. $klarnadata3 = str_replace(' ','',$klarnadata[3]);
  1670. $city = str_replace(' ','',$fullorder['city']);
  1671. $klarnadataaddress = explode($city,$klarnadata3);
  1672. if(isset($klarnadataaddress[1]))
  1673. {
  1674. $klarnadata3 = $city.$klarnadataaddress[1];
  1675. $klarnadatacolor = explode(',',$klarnadata3);
  1676. unset($klarnadatacolor[4]);
  1677. unset($klarnadatacolor[6]);
  1678. if(isset($ToState[$klarnadatacolor[1]]))
  1679. {
  1680. $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
  1681. }
  1682. $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
  1683. }
  1684. else
  1685. {
  1686. $klarnadata['color'] = $klarnadata3;
  1687. }
  1688. }
  1689. }
  1690. else
  1691. {
  1692. $klarnadata = '';
  1693. }
  1694. $p = explode('-',$fullorder['paypal']);
  1695. $this->data['klarnacolor'] = $klarnacolor;
  1696. $this->data['klarnadata'] = $klarnadata;
  1697. $this->data['systemwigsout'] = $outread;
  1698. $quantity = explode(';',trim($fullorder['quantity'],';'));
  1699. $qc = 0;
  1700. foreach ($quantity as $v)
  1701. {
  1702. if($v > 1)
  1703. {
  1704. $qc += 1;
  1705. }
  1706. }
  1707. $this->data['qc'] = $qc;
  1708. //新增row_total和sub_total
  1709. $product_ids = $row_total = $sub_total = "";
  1710. if(!empty($fullorder['extra_price'])){
  1711. $extra_price = json_decode($fullorder['extra_price'],true);
  1712. foreach($extra_price as $k=>$v){
  1713. $row_total .= sprintf("%.2f",($v['qty']* $v['price'])).";";
  1714. $sub_total .= sprintf("%.2f",$v['sub_total']).";";
  1715. if(!empty($v['product_id'])){
  1716. $product_ids .= $v['product_id'].";";
  1717. }
  1718. }
  1719. }
  1720. $this->data['row_total'] = trim($row_total,";");
  1721. $this->data['sub_total'] = trim($sub_total,";");
  1722. $this->data['product_ids'] = trim($product_ids,";");
  1723. $this->_Template('fullorder_edit',$this->data);
  1724. }
  1725. //不可修改
  1726. public function _readonly($arg_array)
  1727. {
  1728. $post = $this->input->post(NULL, TRUE);
  1729. if(isset($post['id']))
  1730. {
  1731. $id = $this->input->post('id',true);
  1732. $ud = $this->fullorder->read($id);
  1733. $post['type'] = $this->input->post('warehouse',true);
  1734. $post['orderremarks'] = $this->input->post('orderremarks',true);
  1735. $post['state'] = $this->input->post('state',true);
  1736. $post['msg'] = $this->input->post('msg',true);
  1737. $post['refundy'] = $this->input->post('refundy',true);
  1738. $post['refundj'] = $this->input->post('refundj',true);
  1739. $fpdata = $this->input->post('fpdata');
  1740. $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);
  1741. $post['fpdata'] = $fpdata;
  1742. $rtime = $this->input->post('rtime',true);
  1743. $post['rtime'] = strtotime($rtime);
  1744. $post['rpaypal'] = $this->input->post('rpaypal',true);
  1745. $post['rtext'] = $this->input->post('rtext',true);
  1746. $post['express'] = $this->input->post('express',true);
  1747. $whlabel = $this->input->post('whlabel',true);
  1748. //$post['ioss'] = $this->input->post('ioss',true);
  1749. $post['edittime'] = time();
  1750. $editstate = $post['state'];
  1751. if(!$editstate)
  1752. {
  1753. $editstate = $ud['state'];
  1754. $post['state'] = $editstate;
  1755. }
  1756. /**
  1757. if($post['state'] == 216 && $ud['state'] != 216)
  1758. {
  1759. echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;
  1760. }
  1761. **/
  1762. $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;
  1763. foreach ($whlabeldata as $va)
  1764. {
  1765. if(stripos($va,'z') !== false)
  1766. {
  1767. $way += 1;
  1768. }
  1769. }
  1770. if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64) && $post['type'] != 5) || ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['type'] == 5))
  1771. {
  1772. echo json_encode(array('msg'=>'此快递方式必须选择美仓!','success'=>false));exit;
  1773. }
  1774. if($way == count($whlabeldata) && $post['type'] != 12)
  1775. {
  1776. echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;
  1777. }
  1778. if($way == '0' && $post['type'] == 12)
  1779. {
  1780. echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;
  1781. }
  1782. $fpcount = $this->input->post('fpcount',true);
  1783. if(!$fpcount)
  1784. {
  1785. echo json_encode(array('msg'=>'需要先清理浏览器缓存,刷新当前页面后再试!','success'=>false));exit;
  1786. }
  1787. if($ud['library'] == 1)
  1788. {
  1789. if($ud['print'] != 3)
  1790. {
  1791. $post['print'] = 1;
  1792. $post['libraryconfirm'] = 1;
  1793. $post['librarynot'] = "订单未打印,未审核或未通过";
  1794. }
  1795. else
  1796. {
  1797. $post['libraryconfirm'] = 1;
  1798. $post['librarynot'] = "订单被重新提交";
  1799. }
  1800. }
  1801. if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $ud['country'] != 192)
  1802. {
  1803. echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;
  1804. }
  1805. if($post['express'] == '3' && $ud['country'] != 192 && $ud['country'] != 35)
  1806. {
  1807. echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;
  1808. }
  1809. if(($post['express'] == '28' || $post['express'] == '7') && $ud['country'] != 191)
  1810. {
  1811. echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;
  1812. }
  1813. $express = $this->express->read($post['express']);
  1814. /**
  1815. if($express['ioss'] == 1 && $post['ioss'] == '')
  1816. {
  1817. echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;
  1818. }
  1819. **/
  1820. $thisdata = $this->fullorder->read($id);
  1821. $warehouse = $this->warehouse->read($thisdata['type']);
  1822. $warehousenew = $this->warehouse->read($post['type']);
  1823. if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库
  1824. {
  1825. echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;
  1826. }
  1827. if($ud['yhs'] == 1)
  1828. {
  1829. echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;
  1830. }
  1831. $expt = $this->express->read($post['express']);
  1832. if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false)
  1833. {
  1834. echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;
  1835. }
  1836. if($expt['province'] != '' && stripos($expt['province'],$ud['province'].'、') !== false)
  1837. {
  1838. echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;
  1839. }
  1840. if($post['type'] != 5 && in_array($post['express'],[2,63,64]))
  1841. {
  1842. echo json_encode(array('msg'=>"此快递方式必须从美仓发货!",'success'=>false));exit;
  1843. }
  1844. if($post['type'] == 5 && !in_array($post['express'],[2,63,64]))
  1845. {
  1846. echo json_encode(array('msg'=>"此快递方式不能美仓发货!",'success'=>false));exit;
  1847. }
  1848. /**
  1849. if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])
  1850. {
  1851. echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;
  1852. }
  1853. **/
  1854. /**
  1855. if($warehousenew['zd'] == '1' && $editstate != $thisdata['state'] && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝
  1856. {
  1857. echo json_encode(array('msg'=>'如需更改订单状态,请先把仓库选择为非开启库存模式仓库或等待订单出库!','success'=>false));exit;
  1858. }
  1859. if($warehousenew['zd'] == '1' && $editstate != '207' && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝
  1860. {
  1861. echo json_encode(array('msg'=>'非待发货状态,不允许修改为开启库存模式仓库','success'=>false));exit;
  1862. }
  1863. **/
  1864. //开始注释 xyxg
  1865. /**
  1866. $ft = array();
  1867. $ftdata = explode('|',rtrim($fpcount,'|'));
  1868. foreach ($ftdata as $va)
  1869. {
  1870. $ftitle = '';
  1871. $va = explode('-',trim($va,'-'));
  1872. foreach ($va as $v)
  1873. {
  1874. $v = $this->typeclass->read($v);
  1875. $ftitle .= $v['title'].' ';
  1876. }
  1877. $ft[] = rtrim($ftitle,' ');
  1878. }
  1879. $user = $this->user->get_api($_SESSION['api']);
  1880. if($ud['library'] == 1)
  1881. {
  1882. $tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$ud['shop'],$ud['number']);
  1883. if(isset($tqkcyz[0]))
  1884. {
  1885. echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;
  1886. }
  1887. if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)
  1888. {
  1889. $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);
  1890. if($tskcyz['t'] > '0')
  1891. {
  1892. echo $tskcyz['m'];exit;
  1893. }
  1894. }
  1895. $kcyz = $this->whlabel->get_kc($thisdata['state'],$post['state'],$warehousenew['zd'],$warehousenew['ys'],$post['type'],$whlabel,$fpcount,$ft,$thisdata['number'],$thisdata['shop'],$thisdata['type'],$thisdata['whlabel']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字
  1896. if($kcyz['t'] > '0')
  1897. {
  1898. echo $kcyz['m'];exit;
  1899. }
  1900. }
  1901. //结束注释
  1902. **/
  1903. if($ud['state'] == 216 && $post['fpdata'] != $ud['fpdata'])
  1904. {
  1905. echo json_encode(array('msg'=>'商品信息需要找梦体修改','success'=>false));exit;
  1906. }
  1907. $warehouse = $this->warehouse->read($post['type']);
  1908. if($ud['library'] == 1 || ($ud['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))
  1909. {
  1910. $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);
  1911. if($kcyz['t'] > '0')
  1912. {
  1913. echo $kcyz['m'];exit;
  1914. }
  1915. else if($kcyz['fpdata'] != '')
  1916. {
  1917. $post['whlabel'] = $kcyz['whlabel'];
  1918. $post['fpdata'] = $kcyz['fpdata'];
  1919. }
  1920. }
  1921. $fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);
  1922. $post['sfxh'] = $fl['sfxh'];
  1923. $post['ckfl'] = $fl['ckfl'];
  1924. //查询净重开始
  1925. $post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
  1926. //查询净重结束
  1927. if($this->fullorder->save($post,$id))
  1928. {
  1929. if($ud['printtime'] == '0')
  1930. {
  1931. $xghz = ',将自动禁止打印';
  1932. }
  1933. else if($ud['printtime'] > '0' && $ud['librarytime'] == '0')
  1934. {
  1935. $q = '';
  1936. if($ud['libraryconfirm'] == 1)
  1937. {
  1938. $q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';
  1939. }
  1940. $xghz = ',将自动禁止发货'.$q;
  1941. }
  1942. else
  1943. {
  1944. $xghz = '';
  1945. }
  1946. echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'cs'=>$ud['state'].' - '.$post['fpdata'].' - '.$ud['fpdata'],'success'=>true));exit;
  1947. }
  1948. else
  1949. {
  1950. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  1951. }
  1952. }
  1953. $arg_array = $arg_array[0];$fpdata = array();
  1954. $fullorder = $this->fullorder->read($arg_array);
  1955. $returngoods = $this->returngoods->get_orderinfo($fullorder['orderinfo']);
  1956. $this->data['returngoods'] = $returngoods?1:0;
  1957. $fullorder['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$fullorder['shipremarks']);
  1958. $fullorder['parameter'] = str_replace(",","---",$fullorder['parameter']);
  1959. $this->data['fullorder'] = $fullorder;
  1960. if($fullorder['express'] == 2)
  1961. {
  1962. $zzhl = 'oz';
  1963. }
  1964. else
  1965. {
  1966. $zzhl = 'kg';
  1967. }
  1968. $this->data['zzhl'] = $zzhl;
  1969. $this->data['countrys'] = $this->country->find_all();
  1970. $this->data['express'] = $this->express->find_all();
  1971. $warehouse = $this->warehouse->read($fullorder['type']);
  1972. if(stripos($fullorder['fpdata'],';') !== false)
  1973. {
  1974. $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
  1975. foreach ($fpdata as $k=>$v)
  1976. {
  1977. $xxv = explode('|',$v);
  1978. if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
  1979. {
  1980. $xxv['zd'] = "<p>已占单</p>";
  1981. $bdck = $warehouse['bdck'];
  1982. if(stripos($xxv[9],'~') !== false)
  1983. {
  1984. $dxxv = explode('~',trim($xxv[9],'~'));
  1985. foreach ($dxxv as $val)
  1986. {
  1987. $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
  1988. if($wzid['details'] != '')
  1989. {
  1990. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  1991. }
  1992. }
  1993. }
  1994. else
  1995. {
  1996. $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
  1997. if($wzid['details'] != '')
  1998. {
  1999. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  2000. }
  2001. }
  2002. }
  2003. $fpdata[$k] = $xxv;
  2004. }
  2005. }
  2006. $this->data['fpdata'] = $fpdata;
  2007. $this->data['fpdata'] = $fpdata;
  2008. $thfpdataxs = array();
  2009. if($fullorder['thfpdata'] != '')
  2010. {
  2011. $thfpdata = explode(';',trim($fullorder['thfpdata'],';'));
  2012. foreach ($thfpdata as $k=>$v)
  2013. {
  2014. $thxs = explode('~',trim($v,'~'));
  2015. $thxs[0] = explode('|',trim($thxs[0],'|'));
  2016. $thxs[1] = explode('|',trim($thxs[1],'|'));
  2017. $thfpdataxs[] = array("<p>".$thxs[0][1]."<i class='fa fa-level-down'></i></p><p>".$thxs[1][1]."</p>","<p>".$thxs[0][2]."</p><p>".$thxs[1][2]."</p>","<p>旧</p><p>新</p>",$thxs[1][0]);
  2018. }
  2019. }
  2020. $this->data['thfpdata'] = $thfpdataxs;
  2021. $shop = $this->shop->read($fullorder['shop']);
  2022. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  2023. $is = 0;
  2024. if($shop['type'] == 269 || $shop['type']==2768 )//判断是否独立站,269是独立站
  2025. {
  2026. $is = 1;
  2027. }
  2028. $this->data['is'] = $is;
  2029. //单项开始
  2030. $warehouse = $this->warehouse->read($fullorder['warehouse']);//发货仓库
  2031. $state = $this->typeclass->read($fullorder['state']);//订单状态
  2032. $country = $this->country->read($fullorder['country']);//国家
  2033. if($fullorder['capital'] == 1)
  2034. {
  2035. $capital = '暂未支付';
  2036. }
  2037. else if($fullorder['capital'] == 2)
  2038. {
  2039. $capital = '部分支付';
  2040. }
  2041. else if($fullorder['capital'] == 3)
  2042. {
  2043. $capital = '全部支付';
  2044. }
  2045. if($fullorder['printtype'] == 1)
  2046. {
  2047. $printtype = '运单';
  2048. }
  2049. else if($fullorder['printtype'] == 2)
  2050. {
  2051. $printtype = '发货单';
  2052. }
  2053. else if($fullorder['printtype'] == 3)
  2054. {
  2055. $printtype = '不打印单据';
  2056. }
  2057. else
  2058. {
  2059. $printtype = '未选择';
  2060. }
  2061. $this->data['warehouse'] = $warehouse['title'];
  2062. $this->data['state'] = $state['title'];
  2063. $this->data['capital'] = $capital;
  2064. $this->data['country'] = $country['name'];
  2065. $this->data['printtype'] = $printtype;
  2066. //单项结束
  2067. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  2068. $downwaybill = '';$dwls = array();
  2069. $oldwaybill = explode('-',ltrim($fullorder['oldwaybill'],'-'));
  2070. if(isset($oldwaybill[0][1]))
  2071. {
  2072. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  2073. foreach ($oldwaybill as $v)
  2074. {
  2075. $dw = explode('/',$v);
  2076. if(isset($dw[1]))
  2077. {
  2078. if(stripos($downwaybill,$dw[1]) === false)
  2079. {
  2080. $dwls[$dw[1]] = 1;
  2081. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  2082. }
  2083. }
  2084. }
  2085. }
  2086. if($fullorder['printtype'] == 1)
  2087. {
  2088. if($fullorder['waybill'] != '' && !isset($dwls[$fullorder['waybill']]))
  2089. {
  2090. $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorder['printtime']).'/y-'.$fullorder['waybill'].'.pdf" target="_blank">'.$fullorder['waybill'].'</a>、'.$downwaybill;
  2091. }
  2092. }
  2093. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  2094. /** 历史打印时间 **/
  2095. $printtime = '';
  2096. if($fullorder['oldprinttime'])
  2097. {
  2098. $pte = explode('-',rtrim($fullorder['oldprinttime'],'-'));
  2099. foreach ($pte as $v)
  2100. {
  2101. $printtime .= date('Y-m-d H:i:s',$v).'、';
  2102. }
  2103. }
  2104. $this->data['printtime'] = rtrim($printtime,'、');
  2105. $product = '';
  2106. $fullorder['product'] = str_replace("'","",$fullorder['product']);
  2107. if($fullorder['link'] != '' && $fullorder['source'] != '1')
  2108. {
  2109. $pt = explode(',',$fullorder['product']);
  2110. $lk = explode(',',$fullorder['link']);
  2111. for($i=0;$i<count($pt);$i++)
  2112. {
  2113. if(isset($lk[$i]))
  2114. {
  2115. $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
  2116. }
  2117. else
  2118. {
  2119. $octs = '';
  2120. }
  2121. $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
  2122. //$a = (stripos($pt[$i],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($pt[$i],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($pt[$i],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($pt[$i],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($pt[$i],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($pt[$i],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($pt[$i],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($pt[$i],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($pt[$i],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$pt[$i].'</font>':$pt[$i];
  2123. if(isset($lk[$i]))
  2124. {
  2125. $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
  2126. }
  2127. else
  2128. {
  2129. $product .= ($product != '')?' , '.$a:$a;
  2130. }
  2131. }
  2132. }
  2133. else
  2134. {
  2135. $octs = $this->colourorderts->get_text($fullorder['product']);
  2136. $a = $octs?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
  2137. //$a = (stripos($fullorder['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorder['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorder['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorder['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorder['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorder['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorder['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorder['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorder['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
  2138. $product = $a;
  2139. }
  2140. $this->data['product'] = $product;
  2141. $out = $this->systemtransfer->find_all("number = '".$fullorder['number']."'");
  2142. $outread = '';
  2143. if($out)
  2144. {
  2145. foreach ($out as $val)
  2146. {
  2147. $list = '';
  2148. $rk = explode('|',trim($val['rk'],'|'));
  2149. $rktime = explode('|',trim($val['rktime'],'|'));
  2150. $zw = array();
  2151. $t = $this->transfer->find_all("1=1");
  2152. foreach ($t as $v)
  2153. {
  2154. $zw[$v['id']] = $v['title'];
  2155. }
  2156. if($val['rk'] != '' && count($rk) > 0)
  2157. {
  2158. for($i=0;$i<count($rk);$i++)
  2159. {
  2160. if(!isset($rktime[$i]))
  2161. {
  2162. $list .= $zw[$cz[$i]];
  2163. }
  2164. else
  2165. {
  2166. $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
  2167. }
  2168. }
  2169. }
  2170. $outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
  2171. }
  2172. }
  2173. else
  2174. {
  2175. $systemwigsout = $this->systemwigsout->find_all("number = '".$fullorder['number']."'");
  2176. $outread = array();
  2177. if($systemwigsout)
  2178. {
  2179. foreach ($systemwigsout as $v)
  2180. {
  2181. if($v['czwarehouse'] == 37)
  2182. {
  2183. $outread[] = '华荣厂';
  2184. }
  2185. else if($v['czwarehouse'] == 0)
  2186. {
  2187. $outread[] = '龙盈厂';
  2188. }
  2189. $cz = explode('|',trim($v['cz'],'|'));
  2190. $cztime = explode('|',trim($v['cztime'],'|'));
  2191. $zw = $this->transfer->get_list();
  2192. if($v['cz'] != '' && count($cz) > 0)
  2193. {
  2194. for($i=0;$i<count($cz);$i++)
  2195. {
  2196. if(!isset($cztime[$i]))
  2197. {
  2198. $outread[] = $zw[$cz[$i]].' -&gt; ';
  2199. }
  2200. else
  2201. {
  2202. $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -&gt; ';
  2203. }
  2204. }
  2205. $outread[] = '<br>';
  2206. }
  2207. }
  2208. }
  2209. }
  2210. $klarnacolor = '';
  2211. if($fullorder['klarnadata'] !='')
  2212. {
  2213. $klarnadata = explode('|',$fullorder['klarnadata']);
  2214. if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
  2215. {
  2216. $klarnadata[1] = json_decode($klarnadata[1],true);
  2217. if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorder['shouldmoney'] && $fullorder['pay'] == 1211)
  2218. {
  2219. $klarnacolor = 'style="color:#F00"';
  2220. }
  2221. }
  2222. else if($klarnadata[0]!=1 && $fullorder['pay']!=26 && $fullorder['pay']!=27 && $fullorder['pay']!=1211)
  2223. {
  2224. $klarnacolor = 'style="color:#F00"';
  2225. }
  2226. if($fullorder['pay'] == 23)//klarna
  2227. {
  2228. $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
  2229. $ToState = array_flip($ToState);
  2230. $klarnadata3 = str_replace(' ','',$klarnadata[3]);
  2231. $city = str_replace(' ','',$fullorder['city']);
  2232. $klarnadataaddress = explode($city,$klarnadata3);
  2233. if(isset($klarnadataaddress[1]))
  2234. {
  2235. $klarnadata3 = $city.$klarnadataaddress[1];
  2236. $klarnadatacolor = explode(',',$klarnadata3);
  2237. unset($klarnadatacolor[4]);
  2238. unset($klarnadatacolor[6]);
  2239. if(isset($ToState[$klarnadatacolor[1]]))
  2240. {
  2241. $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
  2242. }
  2243. $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
  2244. }
  2245. else
  2246. {
  2247. $klarnadata['color'] = $klarnadata3;
  2248. }
  2249. }
  2250. }
  2251. else
  2252. {
  2253. $klarnadata = '';
  2254. }
  2255. $p = explode('-',$fullorder['paypal']);
  2256. $this->data['klarnacolor'] = $klarnacolor;
  2257. $this->data['klarnadata'] = $klarnadata;
  2258. $this->data['systemwigsout'] = $outread;
  2259. $quantity = explode(';',trim($fullorder['quantity'],';'));
  2260. $qc = 0;
  2261. foreach ($quantity as $v)
  2262. {
  2263. if($v > 1)
  2264. {
  2265. $qc += 1;
  2266. }
  2267. }
  2268. $this->data['qc'] = $qc;
  2269. $this->_Template('fullorder_readonly',$this->data);
  2270. }
  2271. //浏览列表
  2272. public function _readlist()
  2273. {
  2274. if(isset($_SESSION['api']))
  2275. {
  2276. $user = $this->user->get_api($_SESSION['api']);
  2277. $usp = $user;
  2278. $fgshop = "";$sid = "";
  2279. $usersp = explode('|',trim($user['shop'],'|'));
  2280. foreach ($usersp as $value)
  2281. {
  2282. $fgshop .= " shop = ".$value." or";
  2283. $sid .= " id = ".$value." or";
  2284. }
  2285. }
  2286. $post = $this->input->post(NULL, TRUE);
  2287. if(isset($post['page']))
  2288. {
  2289. $page = $this->input->post('page',true);
  2290. $perpage = $this->input->post('perpage',true);
  2291. $shop = $this->input->post('shop',true);
  2292. $warehouse = $this->input->post('warehouse',true);
  2293. $express = $this->input->post('express',true);
  2294. $state = $this->input->post('state',true);
  2295. $print = $this->input->post('print',true);
  2296. $libraryconfirm = $this->input->post('libraryconfirm',true);
  2297. $orderinfo = $this->input->post('orderinfo',true);
  2298. $client = $this->input->post('name',true);
  2299. $email = $this->input->post('email',true);
  2300. $number = $this->input->post('number',true);
  2301. $waybill = $this->input->post('waybill',true);
  2302. $authorid = $this->input->post('authorid',true);
  2303. $sourcecontentid = $this->input->post('sourcecontentid',true);
  2304. $timetk = $this->input->post('timetk',true);
  2305. $timetj = $this->input->post('timetj',true);
  2306. $timetk = strtotime($timetk);
  2307. $timetj = strtotime($timetj);
  2308. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  2309. if($shop)
  2310. {
  2311. $where .= " and shop = '$shop'";
  2312. }
  2313. if($warehouse)
  2314. {
  2315. $where .= " and type = '$warehouse'";
  2316. }
  2317. if($express)
  2318. {
  2319. $where .= " and express = '$express'";
  2320. }
  2321. if($state)
  2322. {
  2323. $where .= " and state = '$state'";
  2324. }
  2325. if($print)
  2326. {
  2327. $where .= " and print = '$print'";
  2328. }
  2329. if($libraryconfirm)
  2330. {
  2331. $where .= " and libraryconfirm = '$libraryconfirm'";
  2332. }
  2333. if($orderinfo)
  2334. {
  2335. $where .= " and orderinfo = '$orderinfo'";
  2336. }
  2337. if($client)
  2338. {
  2339. $where .= " and client like '%$client%'";
  2340. }
  2341. if($email)
  2342. {
  2343. $where .= " and email = '$email'";
  2344. }
  2345. if($number)
  2346. {
  2347. $where .= " and number = '$number'";
  2348. }
  2349. if($waybill)
  2350. {
  2351. $where .= " and waybill = '$waybill'";
  2352. }
  2353. if($authorid)
  2354. {
  2355. $where .= " and authorid = '$authorid'";
  2356. }
  2357. if($sourcecontentid)
  2358. {
  2359. $where .= " and sourcecontentid = '$sourcecontentid'";
  2360. }
  2361. if($timetk && $timetj)
  2362. {
  2363. $timetj = $timetj+24*3600;
  2364. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  2365. }
  2366. //数据排序
  2367. $order_str = "dtime desc";
  2368. if(empty($page))
  2369. {
  2370. $start = 0;
  2371. $perpage = 1;
  2372. }
  2373. else
  2374. {
  2375. $start = ($page - 1)*$perpage;
  2376. }
  2377. //取得信息列表
  2378. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,sname,state,buytime,review,libraryconfirm,express,waybill,exstate,orderremarks,library,clientremarks,waybillid',$order_str,$start,$perpage);
  2379. //格式化数据
  2380. $dt = 0;
  2381. foreach ($info_list as $key=>$value)
  2382. {
  2383. $ud = $this->fullorder->read($value['id']);
  2384. $ud['address'] = str_replace("'","’",$ud['address']);
  2385. $ud['name'] = str_replace("'","’",$ud['name']);
  2386. $customer = $this->customer->get_email($ud['email'],$value['shop']);
  2387. $customernum = $this->fullorder->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."'");
  2388. preg_match_all('/[0-9]/u',$ud['phone'],$result);
  2389. $numphone = join('',$result[0]);
  2390. $customerb = $this->customer->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or numphone = '".$numphone."')",'*','id desc');
  2391. $customerc = $this->customer->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');
  2392. //$a = array_column($customer, 'email'); //三维找其中健的数组
  2393. //$a = array_flip($a); //键和值调换
  2394. $lkh = $value['sname'];
  2395. $djlkh = 0;$djhmd = 0;
  2396. if($customer)
  2397. {
  2398. if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1
  2399. {
  2400. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  2401. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
  2402. $djlkh = 1;
  2403. $djcount = $count;
  2404. }
  2405. else if(isset($customerc[0]['num']))
  2406. {
  2407. if($customerc[0]['num'] > 1)
  2408. {
  2409. $count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';
  2410. $lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";
  2411. $djlkh = 1;
  2412. $djcount = $count;
  2413. }
  2414. }
  2415. }
  2416. if($customerb)
  2417. {
  2418. $hmsp = $this->shop->read($customerb[0]['shop']);
  2419. $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';
  2420. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  2421. $djhmd = 1;
  2422. }
  2423. if($djlkh == '1' && $djhmd == '1')
  2424. {
  2425. $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";
  2426. }
  2427. $info_list[$key]['sname'] = $lkh;
  2428. $shop = $this->shop->read($value['shop']);
  2429. $info_list[$key]['shop'] = $shop['shopname'];
  2430. //$info_list[$key]['user'] = $shop['shopuser'];
  2431. $warehouse = $this->warehouse->read($value['type']);
  2432. $warehousetitle = $warehouse['title'];
  2433. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  2434. $info_list[$key]['type'] = $warehousetitle;
  2435. $typeclass = $this->typeclass->read($value['state']);
  2436. $info_list[$key]['state'] = $typeclass['spare'];
  2437. $wl = '';
  2438. if($value['exstate'] == '99')
  2439. {
  2440. $wl = '<font style="color:#ccc">未获取到物流信息</font>';
  2441. }
  2442. else if($value['exstate'] == '1')
  2443. {
  2444. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';
  2445. }
  2446. else if($value['exstate'] == '2')
  2447. {
  2448. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';
  2449. }
  2450. else if($value['exstate'] == '3')
  2451. {
  2452. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';
  2453. }
  2454. else if($value['exstate'] == '4')
  2455. {
  2456. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';
  2457. }
  2458. else if($value['exstate'] == '5')
  2459. {
  2460. $wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';
  2461. }
  2462. $info_list[$key]['exstate'] = $wl.'<br />';
  2463. if($ud['source'] == 1) //线下单用订单时间,其他用付款时间
  2464. {
  2465. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';
  2466. }
  2467. else
  2468. {
  2469. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']+$dt).'</p><p>'.date('H:i:s',$value['buytime']+$dt).'</p>';
  2470. }
  2471. if($value['review'] == 1)
  2472. {
  2473. $info_list[$key]['review'] = "未送审";
  2474. }
  2475. else if($value['review'] == 2)
  2476. {
  2477. $info_list[$key]['review'] = "<font style='color:#555'>待审核</font>";
  2478. }
  2479. else if($value['review'] == 3)
  2480. {
  2481. $info_list[$key]['review'] = "<font style='color:#f90f4b'>不通过</font>";
  2482. }
  2483. else if($value['review'] == 4)
  2484. {
  2485. $info_list[$key]['review'] = "取消重审";
  2486. }
  2487. else if($value['review'] == 5)
  2488. {
  2489. $info_list[$key]['review'] = "<font style='color:#2f80f9'>审核通过</font>";
  2490. }
  2491. else if($value['review'] == 6)
  2492. {
  2493. $info_list[$key]['review'] = "<font style='color:#2f80f9'>自动通过</font>";
  2494. }
  2495. if($ud['dlz'] == 1)
  2496. {
  2497. $dlz = "<p>独立站已更新</p>";
  2498. }
  2499. else if($ud['dlz'] == 3)
  2500. {
  2501. $dlz = "<p>不需要更新</p>";
  2502. }
  2503. else if($ud['dlz'] == 2)
  2504. {
  2505. $dlz = "<p style='color:#C3C'>独立站更新失败</p>";
  2506. }
  2507. else
  2508. {
  2509. $dlz = "";
  2510. }
  2511. if($value['waybill'] != "")
  2512. {
  2513. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;
  2514. if( !empty($value['waybillid'])){
  2515. $info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz."<p>".$value['waybillid']."</p>";
  2516. }
  2517. }
  2518. if($value['express'] != 0)
  2519. {
  2520. $express = $this->express->read($value['express']);
  2521. $expressservicename = $express['servicename'];
  2522. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  2523. $info_list[$key]['express'] = $expressservicename;
  2524. }
  2525. else
  2526. {
  2527. $info_list[$key]['express'] = "无";
  2528. }
  2529. $tly = "";
  2530. if($value['clientremarks'] != "")
  2531. {
  2532. $tly = "<p style='color:#FF3333'>有客户留言</p>";
  2533. }
  2534. if($value['library'] == 1 && $ud['printtype'] == 3)
  2535. {
  2536. $info_list[$key]['library'] = "不需要";
  2537. }
  2538. else if($value['library'] == 1 && $ud['printtype'] != 3)
  2539. {
  2540. $info_list[$key]['library'] = "未出库";
  2541. }
  2542. else if($value['library'] == 2)
  2543. {
  2544. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';
  2545. }
  2546. else if($value['library'] == 3)
  2547. {
  2548. $info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';
  2549. }
  2550. if($ud['authorid'] != '' && $ud['authorid'] != 0)
  2551. {
  2552. $info_list[$key]['orderremarks'] = '<p>'.$value['orderremarks'].'</p><p style="border-top: 1px dashed #C2C2C2;">author_id:</p><p>'.$ud['authorid'].'</p><p>source_content_id:</p><p>'.$ud['sourcecontentid'].'</p>';
  2553. }
  2554. unset($info_list[$key]['waybillid']);
  2555. }
  2556. $total = $this->fullorder->find_count($where);
  2557. $pagenum = ceil($total/$perpage);
  2558. $over = $total-($start+$perpage);
  2559. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  2560. echo json_encode($rows);exit;
  2561. }
  2562. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  2563. $this->data['wlshop'] = $wlshop;
  2564. $this->_Template('fullorder_readlist',$this->data);
  2565. }
  2566. public function _readlistdown()
  2567. {
  2568. if(isset($_SESSION['api']))
  2569. {
  2570. $user = $this->user->get_api($_SESSION['api']);
  2571. $usp = $user;
  2572. $fgshop = "";$sid = "";
  2573. $usersp = explode('|',trim($user['shop'],'|'));
  2574. foreach ($usersp as $value)
  2575. {
  2576. $fgshop .= " shop = ".$value." or";
  2577. $sid .= " id = ".$value." or";
  2578. }
  2579. }
  2580. $post = $this->input->get(NULL, TRUE);
  2581. if(isset($post['excel']))
  2582. {
  2583. $shop = $this->input->get('shop',true);
  2584. $warehouse = $this->input->get('warehouse',true);
  2585. $express = $this->input->get('express',true);
  2586. $state = $this->input->get('state',true);
  2587. $print = $this->input->get('print',true);
  2588. $libraryconfirm = $this->input->get('libraryconfirm',true);
  2589. $orderinfo = $this->input->get('orderinfo',true);
  2590. $client = $this->input->get('name',true);
  2591. $email = $this->input->get('email',true);
  2592. $number = $this->input->get('number',true);
  2593. $waybill = $this->input->get('waybill',true);
  2594. $authorid = $this->input->get('authorid',true);
  2595. $sourcecontentid = $this->input->get('sourcecontentid',true);
  2596. $timetk = $this->input->get('timetk',true);
  2597. $timetj = $this->input->get('timetj',true);
  2598. $timetk = strtotime($timetk);
  2599. $timetj = strtotime($timetj);
  2600. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  2601. if($shop)
  2602. {
  2603. $where .= " and shop = '$shop'";
  2604. }
  2605. if($warehouse)
  2606. {
  2607. $where .= " and type = '$warehouse'";
  2608. }
  2609. if($express)
  2610. {
  2611. $where .= " and express = '$express'";
  2612. }
  2613. if($state)
  2614. {
  2615. $where .= " and state = '$state'";
  2616. }
  2617. if($print)
  2618. {
  2619. $where .= " and print = '$print'";
  2620. }
  2621. if($libraryconfirm)
  2622. {
  2623. $where .= " and libraryconfirm = '$libraryconfirm'";
  2624. }
  2625. if($orderinfo)
  2626. {
  2627. $where .= " and orderinfo = '$orderinfo'";
  2628. }
  2629. if($client)
  2630. {
  2631. $where .= " and client like '%$client%'";
  2632. }
  2633. if($email)
  2634. {
  2635. $where .= " and email = '$email'";
  2636. }
  2637. if($number)
  2638. {
  2639. $where .= " and number = '$number'";
  2640. }
  2641. if($waybill)
  2642. {
  2643. $where .= " and waybill = '$waybill'";
  2644. }
  2645. if($authorid)
  2646. {
  2647. $where .= " and authorid = '$authorid'";
  2648. }
  2649. if($sourcecontentid)
  2650. {
  2651. $where .= " and sourcecontentid = '$sourcecontentid'";
  2652. }
  2653. if($timetk && $timetj)
  2654. {
  2655. $timetj = $timetj+24*3600;
  2656. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  2657. }
  2658. //数据排序
  2659. $order_str = "dtime desc";
  2660. //取得信息列表
  2661. $info_list = $this->fullorder->find_all($where,'shop,number,orderinfo,buytime,name,express,waybill,email,shipremarks,shouldmoney,orderremarks,librarytime,authorid,sourcecontentid',$order_str);
  2662. //格式化数据
  2663. $dt = 0;
  2664. foreach ($info_list as $key=>$value)
  2665. {
  2666. $shop = $this->shop->read($value['shop']);
  2667. $info_list[$key]['shop'] = $shop['shopname'];
  2668. $info_list[$key]['buytime'] = date('Y-m-d H:i:s',$value['buytime']);
  2669. if($value['librarytime'] > 0)
  2670. {
  2671. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  2672. }
  2673. if($value['express'] != 0)
  2674. {
  2675. $express = $this->express->read($value['express']);
  2676. $info_list[$key]['express'] = $express['servicename'];
  2677. }
  2678. else
  2679. {
  2680. $info_list[$key]['express'] = "无";
  2681. }
  2682. }
  2683. $title = "订单列表 ".date("Y-m-d");
  2684. $titlename = "<table border=1>
  2685. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  2686. <tr>
  2687. <td>店铺</td>
  2688. <td>编号</td>
  2689. <td>订单号</td>
  2690. <td>订单日期</td>
  2691. <td>客户姓名</td>
  2692. <td>快递方式</td>
  2693. <td>运单号</td>
  2694. <td>邮箱</td>
  2695. <td>仓库品名</td>
  2696. <td>订单金额</td>
  2697. <td>订单备注</td>
  2698. <td>出库时间</td>
  2699. <td>author_id</td>
  2700. <td>source_content_id</td>
  2701. </tr>
  2702. </table>";
  2703. $filename = $title.".xls";
  2704. $tail = "\n";
  2705. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  2706. }
  2707. }
  2708. //删除
  2709. public function _del()
  2710. {
  2711. $post = $this->input->post(NULL, TRUE);
  2712. if(isset($post['s']))
  2713. {
  2714. $id_arr = $this->input->post('s');
  2715. $id_arr = explode(',',$id_arr);
  2716. if(!$id_arr)
  2717. {
  2718. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  2719. }
  2720. //循环删除记录
  2721. foreach ($id_arr as $v)
  2722. {
  2723. $this->fullorder->remove($v);
  2724. }
  2725. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  2726. }
  2727. }
  2728. //查找商品价格
  2729. public function _price()
  2730. {
  2731. $post = $this->input->post(NULL, TRUE);
  2732. if(isset($post['data']))
  2733. {
  2734. $data = $this->input->post('data');
  2735. $data = explode('-',$data);
  2736. $number = '';$num = count($data);
  2737. //循环删除记录
  2738. for($i=0;$i<$num-1;$i++)
  2739. {
  2740. if($data[$i] != 0)
  2741. {
  2742. $number=$number.$data[$i];
  2743. if($i == 2)
  2744. {
  2745. $number=$number.$data[$num-1];
  2746. }
  2747. }
  2748. }
  2749. $list = $this->productdescribe->get_number($number);
  2750. if($list)
  2751. {
  2752. echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));
  2753. }
  2754. else
  2755. {
  2756. $list = array('purchase'=>0,'cost'=>0,'salesprice'=>0);
  2757. //echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit;
  2758. echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit;
  2759. }
  2760. }
  2761. }
  2762. public function _customs()
  2763. {
  2764. $post = $this->input->post(NULL, TRUE);
  2765. if(isset($post['e']))
  2766. {
  2767. $e = $this->input->post('e');//快递信息
  2768. $c = $this->input->post('c');//国家信息
  2769. $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"');
  2770. $list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"');
  2771. $rows = array();
  2772. foreach ($data as $key=>$value)
  2773. {
  2774. $detailed = explode('|',trim($value['detailed'],'|'));
  2775. //此处未对比重量选择价值,暂直接选择第一条海关价值
  2776. $detailed = $this->detailed->read($detailed[0]);
  2777. $money = $detailed['customsval'];//找到海关价值
  2778. }
  2779. foreach ($list as $key=>$value)
  2780. {
  2781. $description = $this->typeclass->read($value['description']);
  2782. $list[$key]['title'] = $description['title'];//产品描述名称
  2783. }
  2784. if(!$data && !$list)
  2785. {
  2786. echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit;
  2787. }
  2788. else
  2789. {
  2790. //$list-title -description 取值
  2791. echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true));
  2792. }
  2793. }
  2794. }
  2795. public function _express()
  2796. {
  2797. $post = $this->input->post(NULL, TRUE);
  2798. if(isset($post['e']))
  2799. {
  2800. $e = $this->input->post('e');//快递信息
  2801. $c = $this->input->post('c');//国家信息
  2802. $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"');
  2803. if(!$data)
  2804. {
  2805. echo json_encode(array('success'=>false));exit;
  2806. }
  2807. else
  2808. {
  2809. echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true));
  2810. }
  2811. }
  2812. }
  2813. public function _hl()
  2814. {
  2815. $post = $this->input->post(NULL, TRUE);
  2816. if(isset($post['cy']))
  2817. {
  2818. $hl = 0;
  2819. $cy = $this->input->post('cy');//币种ID
  2820. $cy = $this->typeclass->read($cy);
  2821. $gethl = $this->hl->get_hl();
  2822. foreach ($gethl as $v)
  2823. {
  2824. $code = str_replace(" ","",$v['code']);
  2825. if($code == $cy['title'])
  2826. {
  2827. $hl = $v['refePrice']/100;
  2828. }
  2829. }
  2830. echo json_encode(array('msg'=>$hl,'success'=>true));
  2831. }
  2832. }
  2833. public function _operation()
  2834. {
  2835. $post = $this->input->post(NULL, TRUE);
  2836. if(isset($post['type']))
  2837. {
  2838. $type = $this->input->post('type');
  2839. $id = $this->input->post('id');
  2840. $msg = $this->input->post('msg');
  2841. $d = $this->fullorder->read($id);
  2842. $time = time();
  2843. if($type == 1)//禁止发货
  2844. {
  2845. if($d['library'] != 1)
  2846. {
  2847. echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit;
  2848. }
  2849. if($msg == "")
  2850. {
  2851. echo json_encode(array('msg'=>'必须填写禁止原因!','success'=>false));exit;
  2852. }
  2853. if($d['print'] < 3)
  2854. {
  2855. $a = "订单未打印,";
  2856. }
  2857. else
  2858. {
  2859. $a = "";
  2860. }
  2861. if($this->fullorder->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id))
  2862. {
  2863. echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
  2864. }
  2865. else
  2866. {
  2867. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2868. }
  2869. }
  2870. if($type == 6)//允许发货
  2871. {
  2872. if($d['library'] > 1)
  2873. {
  2874. echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
  2875. }
  2876. if($d['print'] < 3)
  2877. {
  2878. $a = "订单未打印,";
  2879. }
  2880. else
  2881. {
  2882. $a = "";
  2883. }
  2884. if($this->fullorder->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id))
  2885. {
  2886. echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;
  2887. }
  2888. else
  2889. {
  2890. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2891. }
  2892. }
  2893. if($type == 7)//禁止打印
  2894. {
  2895. if($d['printtime'] != 0)
  2896. {
  2897. echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;
  2898. }
  2899. if($d['library'] > 1)
  2900. {
  2901. echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
  2902. }
  2903. if($d['print'] < 3)
  2904. {
  2905. $a = "订单未打印,";
  2906. }
  2907. else
  2908. {
  2909. $a = "";
  2910. }
  2911. if($this->fullorder->save(array('print'=>1),$id))
  2912. {
  2913. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  2914. }
  2915. else
  2916. {
  2917. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2918. }
  2919. }
  2920. if($type == 8)//允许打印
  2921. {
  2922. /**
  2923. if($d['printtime'] != 0)
  2924. {
  2925. echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;
  2926. }
  2927. **/
  2928. if($d['library'] > 1)
  2929. {
  2930. echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;
  2931. }
  2932. if($d['print'] < 3)
  2933. {
  2934. $a = "订单未打印,";
  2935. }
  2936. else
  2937. {
  2938. $a = "";
  2939. }
  2940. if($d['printtime'] == '0')
  2941. {
  2942. $bcprint = 2;
  2943. }
  2944. else
  2945. {
  2946. $bcprint = 3;
  2947. }
  2948. if($this->fullorder->save(array('print'=>$bcprint,'failed'=>''),$id))
  2949. {
  2950. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  2951. }
  2952. else
  2953. {
  2954. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2955. }
  2956. }
  2957. if($type == 9)//关闭
  2958. {
  2959. if($this->fullorder->save(array('failed'=>''),$id))
  2960. {
  2961. echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;
  2962. }
  2963. else
  2964. {
  2965. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  2966. }
  2967. }
  2968. if($type == 2)//填写运单、修改运单
  2969. {
  2970. if($d['express'] == 0)
  2971. {
  2972. echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit;
  2973. }
  2974. if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1))
  2975. {
  2976. echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit;
  2977. }
  2978. if($msg == '')
  2979. {
  2980. echo json_encode(array('msg'=>'运单号不能为空!','success'=>false));exit;
  2981. }
  2982. $ckemail = '';
  2983. $d['waybill'] = $msg;
  2984. $xg = $this->fullorder->read($id);
  2985. $shop = $this->shop->read($xg['shop']);
  2986. $ex = $this->express->read($xg['express']);
  2987. $fs = $this->notice->find_all("shop = '".$d['shop']."' and message = '1' and state = '1' and type = '4' and ktime < '$time' and jtime > '$time'");
  2988. if(isset($fs[0]))
  2989. {
  2990. $fs = $fs[0];
  2991. $fs['email'] = $this->emaildata->read($fs['email']);
  2992. if(($xg['dlzemail'] == 1 && $msg != $xg['waybill']) || $xg['dlzemail'] == 0)
  2993. {
  2994. $warehouse = $this->warehouse->read($xg['type']);
  2995. $ck = $this->notice->get_god($d,$shop,$ex,$fs);
  2996. if($ck == 1)
  2997. {
  2998. $ckemail = '邮件发送成功,';
  2999. $this->fullorder->save(array('dlzemail'=>1,'dlzemailtime'=>time()),$id);
  3000. }
  3001. }
  3002. }
  3003. if( $msg )
  3004. {
  3005. if($xg['source'] != 1)
  3006. {
  3007. $ms = $this->message->find_all("express like '%,".$xg['express'].",%'");
  3008. if(!isset($ms[0]))
  3009. {
  3010. $ms = $this->message->read(2);
  3011. }
  3012. else
  3013. {
  3014. $ms = $ms[0];
  3015. }
  3016. if($xg['shop'] == 5){
  3017. $ddh = $xg['orderinfo'];
  3018. }else{
  3019. $ddh = substr($xg['orderinfo'],1);
  3020. }
  3021. $shopifyid = $xg['shopify'];
  3022. //独立站地址更新订单状态、物流信息
  3023. $shopname = $shop['brandname']; //店铺名
  3024. $buyername = $xg['bname']; //Bill Name
  3025. $email_call = $shop['shopid']; //发货人邮箱;
  3026. $phone = $shop['shopphone']; //发货人电话
  3027. $track_type = $ex['title']; //快递名称
  3028. $service = $ex['title']; //快递追踪名称
  3029. $track_link = $ex['url']; //快递查询网址
  3030. $logistics_number = $msg; //运单号
  3031. $t= array('%buyername%','%email_call%','%track_type%','%service%','%track_link%','%logistics_number%','%shop%','%phone%','%jtime%');
  3032. $h= array($buyername,$email_call,$track_type,$service,$track_link,$logistics_number,$shopname,$phone,$ex['yjtime']);
  3033. $remark = str_replace($t,$h,$ms['content']);
  3034. $gx = $this->api->get_gx($ddh,$msg,$xg,$shop,$ex,$remark,$shopifyid);
  3035. }
  3036. else if($xg['source'] == 1)
  3037. {
  3038. $gx['res'] = 3;
  3039. $gx['state'] = 216;
  3040. $gx['cw'] = 'a';
  3041. }
  3042. }
  3043. else
  3044. {
  3045. $gx['res'] = $xg['dlz'];
  3046. $gx['state'] = $xg['state'];
  3047. $gx['cw'] = 'b';
  3048. }
  3049. $xg['iscode'] = $ex['title'];
  3050. $xg['url'] = $shop['shopname'];
  3051. $xg['waybill'] = $msg;
  3052. @$chuanshu = $this->api->get_paypal($xg);
  3053. $this->afspaypal->insert(array('number'=>$xg['number'],'cs'=>$chuanshu));
  3054. $msg = preg_replace('/( | | | |\s)/','',$msg);
  3055. if($this->fullorder->save(array('waybill'=>$msg,'state'=>$gx['state'],'dlz'=>$gx['res']),$id))
  3056. {
  3057. if($gx['res'] == 2)
  3058. {
  3059. echo json_encode(array('msg'=>$ckemail.'传输独立站失败!','cs'=>$gx['state'].' - '.$gx['res'].' - '.$gx['cw'],'success'=>false));exit;
  3060. }
  3061. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  3062. }
  3063. else
  3064. {
  3065. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  3066. }
  3067. }
  3068. }
  3069. }
  3070. public function _merge()
  3071. {
  3072. $post = $this->input->post(NULL, TRUE);
  3073. if(isset($post['s']))
  3074. {
  3075. $id_arr = $this->input->post('s');
  3076. $id_arr = explode(',',trim( $id_arr,','));
  3077. $id_arr = array_reverse($id_arr);
  3078. if(!$id_arr)
  3079. {
  3080. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  3081. }
  3082. if(count($id_arr) < 2)
  3083. {
  3084. echo json_encode(array('msg'=>'缺少可合并单!','success'=>false));exit;
  3085. }
  3086. $post = array();
  3087. $u = $this->fullorder->read($id_arr[0]);
  3088. unset($id_arr[0]);
  3089. $this->db->trans_begin();
  3090. $hd = $this->fullorderhb->get_orderinfo($u['orderinfo']);
  3091. if(!$hd)
  3092. {
  3093. $this->fullorderhb->insert($u);
  3094. }
  3095. //相加
  3096. $post['shouldmoney'] = $u['shouldmoney'];//购买应收金额
  3097. $post['budget'] = $u['budget'];//预估到帐金额
  3098. $post['expressmoney']= $u['expressmoney'];//物流金额
  3099. //$post['refundy'] = $u['refundy'];//补/退原额
  3100. //$post['refundj'] = $u['refundj'];//补/退净额
  3101. $post['cost'] = $u['cost'];//成本金额
  3102. //$post['zzl'] = $u['zzl'];//总重量
  3103. //$post['zsbjz'] = $u['zsbjz'];//总申报价值
  3104. $post['ts'] = $u['ts'];//条数
  3105. $post['cost'] = $u['cost'];//成本金额
  3106. //追加
  3107. $post['rpaypal'] = $u['rpaypal'];//补/退交易号
  3108. $post['rtext'] = $u['rtext'];//补/退原因
  3109. $post['pay'] = $u['pay'];//付款方式
  3110. $post['paypal'] = $u['paypal'];//交易号
  3111. $post['clientremarks'] = $u['clientremarks'];//客户留言
  3112. $post['product'] = $u['product'];//商品名称
  3113. //$post['issku'] = $u['issku'];//sku
  3114. //$post['orderremarks'] = $u['orderremarks'];//订单备注
  3115. $post['shipremarks'] = $u['shipremarks'];//仓库品名
  3116. //产品追加
  3117. $post['fpdata'] = $u['fpdata'];//产品内容
  3118. $post['whlabel'] = $u['whlabel'];//产品对应库存码
  3119. $merge = $u['id'];
  3120. $d = array($u['id']);$order = '';
  3121. $zsl = 0;$zccsl = 0;
  3122. foreach ($id_arr as $v)
  3123. {
  3124. $v = $this->fullorder->read($v);
  3125. if($u['type'] != $v['type'])
  3126. {
  3127. echo json_encode(array('msg'=>'仓库不一致,无法合并!','success'=>false));exit;
  3128. }
  3129. if($v['shop'] = $u['shop'])
  3130. {
  3131. $hd = $this->fullorderhb->get_orderinfo($v['orderinfo']);
  3132. if(!$hd)
  3133. {
  3134. $this->fullorderhb->insert($v);
  3135. }
  3136. $post['shouldmoney'] += $v['shouldmoney'];//购买应收金额
  3137. $post['budget'] += $v['budget'];//预估到帐金额
  3138. $post['expressmoney'] += $v['expressmoney'];//物流金额
  3139. //$post['refundy'] += $v['refundy'];//补/退原额
  3140. //$post['refundj'] += $v['refundj'];//补/退净额
  3141. $post['cost'] += $v['cost'];//成本金额
  3142. //$post['zzl'] += $v['zzl'];//总重量
  3143. //$post['zsbjz'] += $v['zsbjz'];//总申报价值
  3144. $post['ts'] += $v['ts'];//条数
  3145. //$post['rpaypal'] .= $v['rpaypal'];//补/退交易号
  3146. //$post['rtext'] .= $v['rtext'];//补/退原因
  3147. //$post['pay'] .= (stripos($post['pay'],$v['pay']) !== false)?'':';'.$v['pay'];//付款方式
  3148. //$post['paypal'] .= $v['paypal'];//交易号
  3149. $post['clientremarks'] .= $v['clientremarks'];//客户留言
  3150. $post['product'] .= $v['product'];//商品名称
  3151. //$post['issku'] .= $v['issku'];//sku
  3152. //$post['orderremarks'] .= $v['orderremarks'];//订单备注
  3153. $post['shipremarks'] .= $v['shipremarks'];//仓库品名
  3154. $post['fpdata'] .= $v['fpdata'];//产品内容
  3155. $post['whlabel'] .= ltrim($v['whlabel'],'|');//产品对应库存码
  3156. $d[] = $v['id'];
  3157. $order .= $v['orderinfo'].'('.$v['number'].')、';
  3158. $wl = $this->whlabel->find_all("zd = '".$v['number']."'");//查找是否有占用库存情况
  3159. $i = 0;
  3160. if($wl)//如果有那么清除所有占用
  3161. {
  3162. foreach ($wl as $val)
  3163. {
  3164. if($val['sku'] == 'Preset' && $val['state'] == '9')
  3165. {
  3166. $this->whlabel->remove($val['id']);//删除预设
  3167. $i++;
  3168. }
  3169. else
  3170. {
  3171. $this->whlabel->save(array('zd'=>''),$val['id']);//专属
  3172. $i++;
  3173. }
  3174. }
  3175. }
  3176. $zsl += count($wl);
  3177. $zccsl += $i;
  3178. $this->fullorder->save(array('merge'=>$u['id'],'mergeid'=>1,'orderremarks'=>' 《合并信息》:'.'已合并到'.$u['orderinfo'].'('.$u['number'].')中; '.$v['orderremarks'],'shouldmoney'=>0,'print'=>1,'libraryconfirm'=>1,'shouldmoney'=>0,'budget'=>0,'whlabel'=>'','fpdata'=>'','shipremarks'=>''),$v['id']);
  3179. }
  3180. }
  3181. //计算出单条价值
  3182. /**
  3183. if($post['zsbjz'] < 1 || $post['ts'] < 1)
  3184. {
  3185. //$post['dtsbjz'] = 0;
  3186. }
  3187. else
  3188. {
  3189. //$post['dtsbjz'] = $post['zsbjz']/$post['ts'];//单条申报价
  3190. }
  3191. **/
  3192. $post['orderremarks'] = ' 《合并信息》:由'.rtrim($order,'、').'合并而来; '.$u['orderremarks'];;
  3193. $post['merge'] = $u['id'];
  3194. //$post['mergeid'] = 1;
  3195. //合并重复项
  3196. $hbcfw = explode('|',trim($post['whlabel'],'|'));
  3197. $hbcff = explode(';',trim($post['fpdata'],';'));
  3198. $c = 0;
  3199. $hbw = array();
  3200. $hbf = array();
  3201. for($i=0;$i<count($hbcfw);$i++)
  3202. {
  3203. $w = explode('-',$hbcfw[$i]);
  3204. $f = explode('|',$hbcff[$i]);
  3205. if(isset($w[2]))
  3206. {
  3207. $w2 = ($w[2]==0)?0:'';
  3208. }
  3209. else
  3210. {
  3211. $w2 = '';
  3212. }
  3213. if(!isset($hbw[$w[0].$w2]))
  3214. {
  3215. $hbw[$w[0].$w2] = $hbcfw[$i];
  3216. $hbf[$w[0].$w2] = $hbcff[$i];
  3217. }
  3218. else
  3219. {
  3220. $c++;
  3221. $cw = explode('-',$hbw[$w[0].$w2]);
  3222. $cf = explode('|',$hbf[$w[0].$w2]);
  3223. if($cw[2] != 0 && $w[2] != 0)
  3224. {
  3225. $cf[2] += $f[2];
  3226. $cf[9] .= '~'.$f[9];
  3227. $hbf[$w[0].$w2] = implode("|",$cf);
  3228. $cw[1] += $f[2];
  3229. $cw[2] .= '~'.$f[9];
  3230. $hbw[$w[0].$w2] = implode("-",$cw);
  3231. }
  3232. else if($cw[2] == 0 && $w[2] == 0)
  3233. {
  3234. $cf[2] += $f[2];
  3235. $hbf[$w[0].$w2] = implode("|",$cf);
  3236. $cw[1] += $f[2];
  3237. $hbw[$w[0].$w2] = implode("-",$cw);
  3238. }
  3239. else
  3240. {
  3241. $hbw[] = $hbcfw[$i];
  3242. $hbf[] = $hbcff[$i];
  3243. }
  3244. }
  3245. }
  3246. if($c > 0)
  3247. {
  3248. $post['fpdata'] = implode(";",$hbf).';';
  3249. $post['whlabel'] = '|'.implode("|",$hbw).'|';
  3250. }
  3251. //合并重复项结束
  3252. $this->fullorder->save($post,$u['id']);
  3253. if ($this->db->trans_status() === FALSE)
  3254. {
  3255. $this->db->trans_commit();
  3256. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  3257. }
  3258. else
  3259. {
  3260. $this->db->trans_commit();
  3261. echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$u['id'],'success'=>true));
  3262. }
  3263. }
  3264. /**
  3265. $post = $this->input->post(NULL, TRUE);
  3266. if(isset($post['type']))
  3267. {
  3268. $type = $this->input->post('type');
  3269. $id = $this->input->post('id');
  3270. $u = $this->fullorder->read($id);
  3271. $rows = $this->fullorder->find_all('name = "'.$u['name'].'" or email = "'.$u['email'].'" or address = "'.$u['address'].'"','*','id desc');
  3272. if(count($rows)>1)
  3273. {
  3274. $this->db->trans_begin();
  3275. $fpdata=$rows[0]['fpdata'];//购买产品
  3276. $shouldmoney=$rows[0]['shouldmoney'];//购买应收金额
  3277. $budget=$rows[0]['budget'];//预估到帐金额
  3278. $cost=$rows[0]['cost'];//成本金额
  3279. $merge=$rows[0]['id'];
  3280. $d = array($rows[0]['id']);
  3281. for($i=1;$i<count($rows);$i++)
  3282. {
  3283. $fpdata=$fpdata.$rows[$i]['fpdata'];
  3284. $shouldmoney=$shouldmoney+$rows[$i]['shouldmoney'];
  3285. $budget=$budget+$rows[$i]['budget'];
  3286. $cost=$cost+$rows[$i]['cost'];
  3287. $d[] = $rows[$i]['id'];
  3288. $this->fullorder->save(array('merge'=>$rows[0]['id'],'mergeid'=>1),$rows[$i]['id']);
  3289. }
  3290. $this->fullorder->save(array('fpdata'=>$fpdata,'shouldmoney'=>$shouldmoney,'budget'=>$budget,'cost'=>$cost,'merge'=>$merge),$rows[0]['id']);
  3291. if ($this->db->trans_status() === FALSE)
  3292. {
  3293. $this->db->trans_commit();
  3294. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  3295. }
  3296. else
  3297. {
  3298. $this->db->trans_commit();
  3299. echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$rows[0]['id'],'success'=>true));
  3300. }
  3301. }
  3302. }
  3303. **/
  3304. }
  3305. //评价管理
  3306. public function _evaluate()
  3307. {
  3308. $user = $this->user->get_api($_SESSION['api']);
  3309. if($user)
  3310. {
  3311. $fgshop = "";$sid = "";
  3312. $user = explode('|',trim($user['shop'],'|'));
  3313. foreach ($user as $value)
  3314. {
  3315. $fgshop .= " shop = ".$value." or";
  3316. $sid .= " id = ".$value." or";
  3317. }
  3318. }
  3319. $post = $this->input->post(NULL, TRUE);
  3320. if(isset($post['page']))
  3321. {
  3322. $page = $this->input->post('page',true);
  3323. $perpage = $this->input->post('perpage',true);
  3324. $shop = $this->input->post('shop',true);
  3325. $where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")";
  3326. if($shop)
  3327. {
  3328. $where .= " and shop = '$shop'";
  3329. }
  3330. //数据排序
  3331. $order_str = "id desc";
  3332. if(empty($page))
  3333. {
  3334. $start = 0;
  3335. $perpage = 1;
  3336. }
  3337. else
  3338. {
  3339. $start = ($page - 1)*$perpage;
  3340. }
  3341. //取得信息列表
  3342. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage);
  3343. //格式化数据
  3344. foreach ($info_list as $key=>$value)
  3345. {
  3346. $shop = $this->shop->read($value['shop']);
  3347. $info_list[$key]['shop'] = $shop['shopname'];
  3348. $info_list[$key]['operation'] = "评价";
  3349. }
  3350. $total = $this->fullorder->find_count($where);
  3351. $pagenum = ceil($total/$perpage);
  3352. $over = $total-($start+$perpage);
  3353. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3354. echo json_encode($rows);exit;
  3355. }
  3356. $this->_Template('fullorder_evaluate',$this->data);
  3357. }
  3358. //订单消息
  3359. public function _state()
  3360. {
  3361. $user = $this->user->get_api($_SESSION['api']);
  3362. if($user)
  3363. {
  3364. $fgshop = "";$sid = "";
  3365. $user = explode('|',trim($user['shop'],'|'));
  3366. foreach ($user as $value)
  3367. {
  3368. $fgshop .= " shop = ".$value." or";
  3369. $sid .= " id = ".$value." or";
  3370. }
  3371. }
  3372. $post = $this->input->post(NULL, TRUE);
  3373. if(isset($post['page']))
  3374. {
  3375. $page = $this->input->post('page',true);
  3376. $perpage = $this->input->post('perpage',true);
  3377. $timetk = $this->input->post('timetk',true);
  3378. $timetj = $this->input->post('timetj',true);
  3379. $shop = $this->input->post('shop',true);
  3380. $expressstate = $this->input->post('expressstate',true);
  3381. $fs = $this->input->post('fs',true);
  3382. $state = $this->input->post('state',true);
  3383. $express = $this->input->post('express',true);
  3384. $review = $this->input->post('review',true);
  3385. $orderinfo = $this->input->post('orderinfo',true);
  3386. $number = $this->input->post('number',true);
  3387. $waybill = $this->input->post('waybill',true);
  3388. $xztime = $this->input->post('xztime',true);
  3389. $timetk = strtotime($timetk);
  3390. $timetj = strtotime($timetj);
  3391. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  3392. if($timetk && $timetj)
  3393. {
  3394. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  3395. }
  3396. if($xztime == 'librarytime')
  3397. {
  3398. $order_str = "librarytime desc";
  3399. }
  3400. else if($xztime == 'dtime')
  3401. {
  3402. $order_str = "dtime desc";
  3403. }
  3404. if($shop)
  3405. {
  3406. $where .= " and shop = '$shop'";
  3407. }
  3408. if($expressstate)
  3409. {
  3410. $where .= " and expressstate = '$expressstate'";
  3411. }
  3412. if($review)
  3413. {
  3414. $where .= " and review = '$review'";
  3415. }
  3416. if($fs)
  3417. {
  3418. if($fs == '2')
  3419. {
  3420. $where .= " and exstateerror != ''";
  3421. }
  3422. else
  3423. {
  3424. $where .= " and exstateerror = ''";
  3425. }
  3426. }
  3427. if($state)
  3428. {
  3429. $where .= " and state = '$state'";
  3430. }
  3431. if($express)
  3432. {
  3433. $where .= " and express = '$express'";
  3434. }
  3435. if($orderinfo)
  3436. {
  3437. $where .= " and orderinfo = '$orderinfo'";
  3438. }
  3439. if($number)
  3440. {
  3441. $where .= " and number = '$number'";
  3442. }
  3443. if($waybill)
  3444. {
  3445. $where .= " and waybill = '$waybill'";
  3446. }
  3447. if(empty($page))
  3448. {
  3449. $start = 0;
  3450. $perpage = 1;
  3451. }
  3452. else
  3453. {
  3454. $start = ($page - 1)*$perpage;
  3455. }
  3456. //取得信息列表
  3457. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,content,orderremarks,exstateerror',$order_str,$start,$perpage);
  3458. //格式化数据
  3459. foreach ($info_list as $key=>$value)
  3460. {
  3461. $shop = $this->shop->read($value['shop']);
  3462. $info_list[$key]['shop'] = $shop['shopname'];
  3463. $country = $this->country->read($value['country']);
  3464. $info_list[$key]['country'] = $country['name'];
  3465. //$state = $this->typeclass->read($value['state']);
  3466. //$info_list[$key]['state'] = $state['title'];
  3467. if($value['library'] == 1)
  3468. {
  3469. $info_list[$key]['library'] = "未出库";
  3470. }
  3471. else if($value['library'] == 2)
  3472. {
  3473. $info_list[$key]['library'] = "已出库";
  3474. }
  3475. else if($value['library'] == 3)
  3476. {
  3477. $info_list[$key]['library'] = "已退库";
  3478. }
  3479. if($value['librarytime'] == '0')
  3480. {
  3481. $info_list[$key]['librarytime'] = '无';
  3482. }
  3483. else
  3484. {
  3485. $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);
  3486. }
  3487. $express = $this->express->read($value['express']);
  3488. $info_list[$key]['express'] = $express['servicename'];
  3489. }
  3490. $total = $this->fullorder->find_count($where);
  3491. $pagenum = ceil($total/$perpage);
  3492. $over = $total-($start+$perpage);
  3493. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3494. echo json_encode($rows);exit;
  3495. }
  3496. $notice = $this->notice->find_all("type = '1' and (".rtrim($fgshop,'or').")");
  3497. $this->data['notice'] = $notice;
  3498. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3499. $this->data['wlshop'] = $wlshop;
  3500. $this->data['express'] = $this->express->find_all();
  3501. $this->_Template('fullorder_state',$this->data);
  3502. }
  3503. //物流信息
  3504. public function _wl()
  3505. {
  3506. $user = $this->user->get_api($_SESSION['api']);
  3507. if($user)
  3508. {
  3509. $fgshop = "";$sid = "";
  3510. $user = explode('|',trim($user['shop'],'|'));
  3511. foreach ($user as $value)
  3512. {
  3513. $fgshop .= " shop = ".$value." or";
  3514. $sid .= " id = ".$value." or";
  3515. }
  3516. }
  3517. $post = $this->input->post(NULL, TRUE);
  3518. if(isset($post['page']))
  3519. {
  3520. $page = $this->input->post('page',true);
  3521. $perpage = $this->input->post('perpage',true);
  3522. $timetk = $this->input->post('timetk',true);
  3523. $timetj = $this->input->post('timetj',true);
  3524. $shop = $this->input->post('shop',true);
  3525. $expressstate = $this->input->post('expressstate',true);
  3526. $fs = $this->input->post('fs',true);
  3527. $state = $this->input->post('state',true);
  3528. $express = $this->input->post('express',true);
  3529. $orderinfo = $this->input->post('orderinfo',true);
  3530. $number = $this->input->post('number',true);
  3531. $waybill = $this->input->post('waybill',true);
  3532. $wlyc = $this->input->post('wlyc',true);
  3533. $wltype = $this->input->post('wltype',true);
  3534. $source = $this->input->post('source',true);
  3535. $xztime = $this->input->post('xztime',true);
  3536. $wlbz = $this->input->post('wlbz',true);
  3537. $timetk = strtotime($timetk);
  3538. $timetj = strtotime($timetj);
  3539. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  3540. if($timetk && $timetj)
  3541. {
  3542. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  3543. }
  3544. if($xztime == 'librarytime')
  3545. {
  3546. $order_str = "librarytime desc";
  3547. }
  3548. else if($xztime == 'dtime')
  3549. {
  3550. $order_str = "dtime desc";
  3551. }
  3552. else if ($xztime == 'wlfstime')
  3553. {
  3554. $order_str = "wlfstime desc";
  3555. }
  3556. if($shop)
  3557. {
  3558. $where .= " and shop = '$shop'";
  3559. }
  3560. if($fs)
  3561. {
  3562. if($fs == '1')
  3563. {
  3564. $where .= " and wlcontent != ''";
  3565. }
  3566. if($fs == '2')
  3567. {
  3568. $where .= " and wlerror != ''";
  3569. }
  3570. if($fs == '3')
  3571. {
  3572. $where .= " and wlcontent = '' and shouldmoney > 100";
  3573. }
  3574. else if($fs == '4')
  3575. {
  3576. $where .= " and wltype = '1'";
  3577. }
  3578. }
  3579. if($state)
  3580. {
  3581. $where .= " and state = '$state'";
  3582. }
  3583. if($express)
  3584. {
  3585. $where .= " and express = '$express'";
  3586. }
  3587. if($orderinfo)
  3588. {
  3589. $where .= " and orderinfo = '$orderinfo'";
  3590. }
  3591. if($number)
  3592. {
  3593. $where .= " and number = '$number'";
  3594. }
  3595. if($waybill)
  3596. {
  3597. $where .= " and waybill = '$waybill'";
  3598. }
  3599. if($wlbz)
  3600. {
  3601. $where .= " and wlbz like '%$wlbz%'";
  3602. }
  3603. if($wlyc!='')
  3604. {
  3605. $where .= " and wlyc = '$wlyc'";
  3606. }
  3607. if($wltype!='')
  3608. {
  3609. $where .= " and wltype = '$wltype'";
  3610. }
  3611. if($source)
  3612. {
  3613. if($source == 1)
  3614. {
  3615. $where .= " and source = '$source'";
  3616. }
  3617. else
  3618. {
  3619. $where .= " and source != '1'";
  3620. }
  3621. }
  3622. if($expressstate != '')
  3623. {
  3624. if($expressstate == 99)
  3625. {
  3626. $cxid = '';
  3627. $sjcc = $this->awlgx->find_all("time < '".(time()-3*24*3600)."' and exstate != 6",'number');
  3628. foreach ($sjcc as $v)
  3629. {
  3630. $cxid .= "number = '".$v['number']."' or ";
  3631. }
  3632. $where .= ' and ('.rtrim($cxid,'or ').')';
  3633. }
  3634. else
  3635. {
  3636. $where .= " and expressstate = '$expressstate'";
  3637. }
  3638. }
  3639. if(empty($page))
  3640. {
  3641. $start = 0;
  3642. $perpage = 1;
  3643. }
  3644. else
  3645. {
  3646. $start = ($page - 1)*$perpage;
  3647. }
  3648. //取得信息列表
  3649. $info_list = $this->fullorder->find_all($where,'id,orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,wlcontent,wlerror,excontent,wltype',$order_str,$start,$perpage);
  3650. //格式化数据
  3651. foreach ($info_list as $key=>$value)
  3652. {
  3653. $f = $this->fullorder->read($value['id']);
  3654. $info_list[$key]['number'] = "<p>".$value['number']."</p>"."<p>".$f['email']."</p>";
  3655. $country = $this->country->read($value['country']);
  3656. $info_list[$key]['country'] = "<p>".$country['name']."</p><p>".$f['phone']."</p>";
  3657. //$state = $this->typeclass->read($value['state']);
  3658. //$info_list[$key]['state'] = $state['title'];
  3659. if($value['library'] == 1)
  3660. {
  3661. $info_list[$key]['library'] = "未出库";
  3662. }
  3663. else if($value['library'] == 2)
  3664. {
  3665. $info_list[$key]['library'] = "已出库";
  3666. }
  3667. else if($value['library'] == 3)
  3668. {
  3669. $info_list[$key]['library'] = "已退库";
  3670. }
  3671. if($value['librarytime'] == '0')
  3672. {
  3673. $info_list[$key]['librarytime'] = '无';
  3674. }
  3675. else
  3676. {
  3677. $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']).'<br>'.$f['shouldmoney'];
  3678. }
  3679. if($value['expressstate'] == 0)
  3680. {
  3681. $info_list[$key]['expressstate'] = "无信息";
  3682. }
  3683. else if($value['expressstate'] == 2)
  3684. {
  3685. $info_list[$key]['expressstate'] = "已取件";
  3686. }
  3687. else if($value['expressstate'] == 3)
  3688. {
  3689. $info_list[$key]['expressstate'] = "在途中";
  3690. }
  3691. /**
  3692. else if($value['expressstate'] == 4)
  3693. {
  3694. $info_list[$key]['expressstate'] = "到达目的地国".$value['expressstate'];
  3695. }
  3696. **/
  3697. else if($value['expressstate'] == 4 || $value['expressstate'] == 5)
  3698. {
  3699. $info_list[$key]['expressstate'] = "即将派送";
  3700. }
  3701. else if($value['expressstate'] == 6)
  3702. {
  3703. $info_list[$key]['expressstate'] = "已签收";
  3704. }
  3705. else if($value['expressstate'] == 1)
  3706. {
  3707. $info_list[$key]['expressstate'] = "派送异常";
  3708. }
  3709. $express = $this->express->read($value['express']);
  3710. $info_list[$key]['express'] = $express['servicename'];
  3711. if($value['wltype'] == '0')
  3712. {
  3713. $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>禁止发送</b></p>";
  3714. }
  3715. else
  3716. {
  3717. $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>允许发送</b></p>";
  3718. }
  3719. if($f['wlyc'] == '0')
  3720. {
  3721. $info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='1'>加入异常处理中</b></p>";
  3722. }
  3723. else if($f['wlyc'] == '1')
  3724. {
  3725. $info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='2'>移入异常已处理</b></p>";
  3726. $info_list[$key]['wltype'] .= "<p class='yc'><b class='ycyc' data-id='".$value['id']."' data-c='2'>移出异常处理中</b></p>";
  3727. }
  3728. else if($f['wlyc'] == '2')
  3729. {
  3730. $info_list[$key]['wltype'] .= "<p><b>异常已处理</b></p>";
  3731. }
  3732. if(stripos($value['excontent'],'<br />') !== false)
  3733. {
  3734. $excontent = explode('<br />',$value['excontent']);
  3735. $info_list[$key]['excontent'] = '<i class="method fa fa-list-ul" data-t="'.$value['excontent'].'"></i> '.$excontent[0];
  3736. }
  3737. }
  3738. $total = $this->fullorder->find_count($where);
  3739. $pagenum = ceil($total/$perpage);
  3740. $over = $total-($start+$perpage);
  3741. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'cs'=>$where);
  3742. echo json_encode($rows);exit;
  3743. }
  3744. if(isset($post['q']))
  3745. {
  3746. $id = $this->input->post('id',true);
  3747. $f = $this->fullorder->read($id);
  3748. $wl = ($f['wltype']=='0')?1:0;
  3749. $wltitle = ($f['wltype']=='0')?'已禁发送':'已允发送';
  3750. if($this->fullorder->save(array('wltype'=>$wl),$id))
  3751. {
  3752. echo json_encode(array('msg'=>'ckn','id'=>$id,'wltitle'=>$wltitle,'success'=>true));exit;
  3753. }
  3754. else
  3755. {
  3756. echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$wltitle,'success'=>false));exit;
  3757. }
  3758. }
  3759. if(isset($post['t']))
  3760. {
  3761. $id = $this->input->post('id',true);
  3762. $f = $this->fullorder->read($id);
  3763. $t = $this->input->post('t',true);
  3764. $yc = ($f['wlyc']=='0')?1:2;
  3765. $yctitle = ($f['wlyc']=='0')?'移入成功':'异常已处理';
  3766. if($this->fullorder->save(array('wlyc'=>$yc),$id))
  3767. {
  3768. echo json_encode(array('msg'=>'yc','id'=>$id,'wltitle'=>$yctitle,'success'=>true));exit;
  3769. }
  3770. else
  3771. {
  3772. echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$yctitle,'success'=>false));exit;
  3773. }
  3774. }
  3775. if(isset($post['c']))
  3776. {
  3777. $id = $this->input->post('id',true);
  3778. $f = $this->fullorder->read($id);
  3779. $t = $this->input->post('t',true);
  3780. $yc = 0;
  3781. $yctitle = '移出成功';
  3782. if($this->fullorder->save(array('wlyc'=>$yc),$id))
  3783. {
  3784. echo json_encode(array('msg'=>'yc','id'=>$id,'wltitle'=>$yctitle,'success'=>true));exit;
  3785. }
  3786. else
  3787. {
  3788. echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$yctitle,'success'=>false));exit;
  3789. }
  3790. }
  3791. $notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");
  3792. $this->data['notice'] = $notice;
  3793. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3794. $this->data['wlshop'] = $wlshop;
  3795. $this->data['express'] = $this->express->find_all();
  3796. $this->_Template('fullorder_wl',$this->data);
  3797. }
  3798. //审核订单
  3799. public function _review()
  3800. {
  3801. $user = $this->user->get_api($_SESSION['api']);
  3802. if($user)
  3803. {
  3804. $fgshop = "";$sid = "";
  3805. $user = explode('|',trim($user['shop'],'|'));
  3806. foreach ($user as $value)
  3807. {
  3808. $sid .= " id = ".$value." or";
  3809. $fgshop .= " shop = ".$value." or";
  3810. }
  3811. $fgshop = " and (".rtrim($fgshop,'or').")";
  3812. }
  3813. $post = $this->input->post(NULL, TRUE);
  3814. if(isset($post['page']))
  3815. {
  3816. $page = $this->input->post('page',true);
  3817. $perpage = $this->input->post('perpage',true);
  3818. $source = $this->input->post('source',true);
  3819. $warehouse = $this->input->post('warehouse',true);
  3820. $express = $this->input->post('express',true);
  3821. $orderremarks = $this->input->post('orderremarks',true);
  3822. $shop = $this->input->post('shop',true);
  3823. $review = $this->input->post('review',true);
  3824. $orderinfo = $this->input->post('orderinfo',true);
  3825. $shipremarks = $this->input->post('shipremarks',true);
  3826. $number = $this->input->post('number',true);
  3827. $timetk = $this->input->post('timetk',true);
  3828. $timetj = $this->input->post('timetj',true);
  3829. $timetk = strtotime($timetk);
  3830. $timetj = strtotime($timetj);
  3831. $where = "mergeid = 0 and state = '207'".$fgshop;
  3832. if($timetk && $timetj)
  3833. {
  3834. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  3835. }
  3836. if($source)
  3837. {
  3838. if($source == '2d')
  3839. {
  3840. $where .= " and source >= '2'";
  3841. }
  3842. else
  3843. {
  3844. $where .= " and source = '$source'";
  3845. }
  3846. }
  3847. if($review)
  3848. {
  3849. $where .= " and review = '$review'";
  3850. }
  3851. else
  3852. {
  3853. $where .= " and ((review = '2' and source = '1') or (review = '1' and source >= '2'))";
  3854. }
  3855. if($shop)
  3856. {
  3857. $where .= " and shop = '$shop'";
  3858. }
  3859. if($warehouse)
  3860. {
  3861. $where .= " and type = '$warehouse'";
  3862. }
  3863. if($express)
  3864. {
  3865. $where .= " and express = '$express'";
  3866. }
  3867. if($orderremarks)
  3868. {
  3869. $where .= " and orderremarks like '%$orderremarks%'";
  3870. }
  3871. if($orderinfo)
  3872. {
  3873. $where .= " and orderinfo = '$orderinfo'";
  3874. }
  3875. if($number)
  3876. {
  3877. $where .= " and number = '$number'";
  3878. }
  3879. if($shipremarks)
  3880. {
  3881. $where .= " and shipremarks like '%$shipremarks%'";
  3882. }
  3883. //数据排序
  3884. $order_str = "id desc";
  3885. if(empty($page))
  3886. {
  3887. $start = 0;
  3888. $perpage = 1;
  3889. }
  3890. else
  3891. {
  3892. $start = ($page - 1)*$perpage;
  3893. }
  3894. //取得信息列表
  3895. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,client,express,buytime,shouldmoney,review,orderremarks');
  3896. //格式化数据
  3897. foreach ($info_list as $key=>$value)
  3898. {
  3899. $lr = $this->fullorder->read($value['id']);
  3900. $shop = $this->shop->read($value['shop']);
  3901. $info_list[$key]['shop'] = $shop['shopname'];
  3902. $warehouse = $this->warehouse->read($value['type']);
  3903. $info_list[$key]['type'] = $warehouse['title'];
  3904. $express = $this->express->read($value['express']);
  3905. $info_list[$key]['express'] = $express['servicename'];
  3906. $info_list[$key]['buytime'] = '<p>'.date('Y-m-d',$value['buytime']).'</p><p>'.date('H:i:s',$value['buytime']).'</p>';
  3907. if($value['review'] == 1)
  3908. {
  3909. $info_list[$key]['review'] = "未送审";
  3910. }
  3911. else if($value['review'] == 2)
  3912. {
  3913. $info_list[$key]['review'] = "待审核";
  3914. }
  3915. else if($value['review'] == 3)
  3916. {
  3917. $info_list[$key]['review'] = "不通过";
  3918. }
  3919. else if($value['review'] == 4)
  3920. {
  3921. $info_list[$key]['review'] = "取消重审";
  3922. }
  3923. else if($value['review'] == 5)
  3924. {
  3925. $info_list[$key]['review'] = "审核通过";
  3926. }
  3927. else if($value['review'] == 6)
  3928. {
  3929. $info_list[$key]['review'] = "自动通过";
  3930. }
  3931. /**
  3932. $info_list[$key]['library'] = "";
  3933. if($value['review'] == 1)
  3934. {
  3935. $info_list[$key]['library'] = "<p><b class='focz' data-type='6' data-id='".$value['id']."'>审核通过</b></p>";
  3936. }
  3937. if($value['review'] == 2)
  3938. {
  3939. $info_list[$key]['library'] = "<p><b class='focz' data-type='5' data-id='".$value['id']."'>审核通过</b></p><p><b class='focz' data-type='3' data-id='".$value['id']."'>不通过</b></p>";
  3940. }
  3941. else if($value['review'] == 3)
  3942. {
  3943. $info_list[$key]['library'] = "<p><b class='fullorderreview' data-type='5' data-id='".$value['id']."'>审核通过</b></p>";
  3944. }
  3945. else if($value['review'] == 5)
  3946. {
  3947. $info_list[$key]['library'] = "<p><b class='fullorderreview' data-type='3' data-id='".$value['id']."'>不通过</b></p>";
  3948. }
  3949. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle'];
  3950. $lr['hl'] = $lr['hl']==0?6.71:$lr['hl'];
  3951. $cost = $lr['cost']/$lr['hl'];
  3952. $currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney'];
  3953. $info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle'];
  3954. **/
  3955. }
  3956. $total = $this->fullorder->find_count($where);
  3957. $pagenum = ceil($total/$perpage);
  3958. $over = $total-($start+$perpage);
  3959. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  3960. echo json_encode($rows);exit;
  3961. }
  3962. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3963. $this->data['shop'] = $wlshop;
  3964. $this->_Template('fullorder_review',$this->data);
  3965. }
  3966. public function _wlbz($arg_array)
  3967. {
  3968. $post = $this->input->post(NULL, TRUE);
  3969. if(isset($post['id']))
  3970. {
  3971. $id = $this->input->post('id',true);
  3972. $post['wlbz'] = $this->input->post('wlbz',true);
  3973. if($post['wlbz'] == '')
  3974. {
  3975. echo json_encode(array('msg'=>'备注不能为空','success'=>false));exit;
  3976. }
  3977. if($this->fullorder->save($post,$id))
  3978. {
  3979. echo json_encode(array('msg'=>'修改成功','id'=>$id,'success'=>true));exit;
  3980. }
  3981. else
  3982. {
  3983. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  3984. }
  3985. }
  3986. $arg_array = $arg_array[0];
  3987. $fullorder = $this->fullorder->read($arg_array);
  3988. $this->data['fullorder'] = $fullorder;
  3989. $this->_Template('fullorder_wlbz',$this->data);
  3990. }
  3991. //导出资金统计excel
  3992. public function _fmexcel()
  3993. {
  3994. $user = $this->user->get_api($_SESSION['api']);
  3995. if($user)
  3996. {
  3997. $fgshop = "";$sid = "";
  3998. $user = explode('|',trim($user['shop'],'|'));
  3999. foreach ($user as $value)
  4000. {
  4001. $fgshop .= " shop = ".$value." or";
  4002. $sid .= " id = ".$value." or";
  4003. }
  4004. }
  4005. if(isset($_GET['excel']))
  4006. {
  4007. $timetk = $this->input->get('timetk',true);
  4008. $timetj = $this->input->get('timetj',true);
  4009. $shop = $this->input->get('shop',true);
  4010. $source = $this->input->get('source',true);
  4011. $state = $this->input->get('state',true);
  4012. $type = $this->input->get('type',true);
  4013. $orderinfo = $this->input->get('orderinfo',true);
  4014. $user = $this->input->get('user',true);
  4015. $name = $this->input->get('name',true);
  4016. $timetk = strtotime($timetk);
  4017. $timetj = strtotime($timetj);
  4018. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  4019. if($timetk && $timetj)
  4020. {
  4021. $where .= " and buytime > '$timetk' and buytime < '$timetj'";
  4022. }
  4023. if($shop)
  4024. {
  4025. $where .= " and shop = '$shop'";
  4026. }
  4027. if($source)
  4028. {
  4029. $where .= " and source = '$source'";
  4030. }
  4031. if($state)
  4032. {
  4033. if($state == 1)
  4034. {
  4035. $where .= " and state = '$state'";
  4036. }
  4037. }
  4038. if($type)
  4039. {
  4040. $where .= " and type = '$type'";
  4041. }
  4042. if($orderinfo)
  4043. {
  4044. $where .= " and orderinfo = '$orderinfo'";
  4045. }
  4046. if($user)
  4047. {
  4048. $where .= " and user = '$user'";
  4049. }
  4050. if($name)
  4051. {
  4052. $where .= " and name = '$name'";
  4053. }
  4054. //取得信息列表
  4055. $info_list = $this->fullorder->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle');
  4056. //格式化数据
  4057. $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1;
  4058. foreach ($info_list as $key=>$value)
  4059. {
  4060. $info_list[$key]['id'] = $i;
  4061. if($value['currencytitle'] != "CNY")
  4062. {
  4063. $hl=$value['hl'];
  4064. }
  4065. $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
  4066. $budget=$budget+($value['budget']*$hl);
  4067. $currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl);
  4068. $refund=$refund+($value['refund']*$hl);
  4069. $shop = $this->shop->read($value['shop']);
  4070. $info_list[$key]['shop'] = $shop['shopname'];
  4071. $info_list[$key]['user'] = $shop['shopuser'];
  4072. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  4073. $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
  4074. $country = $this->country->read($value['country']);
  4075. $info_list[$key]['country'] = $country['name'];
  4076. $express = $this->express->read($value['express']);
  4077. $info_list[$key]['express'] = $express['servicename'];
  4078. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
  4079. $info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle'];
  4080. $info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle'];
  4081. $info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle'];
  4082. $fpdata = array();
  4083. if(stripos($value['fpdata'],';') !== false)
  4084. {
  4085. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  4086. foreach ($fpdata as $ke=>$va)
  4087. {
  4088. $v = explode('|',rtrim($va,'|'));
  4089. $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
  4090. }
  4091. }
  4092. $info_list[$key]['fpdata'] = $fpdata;
  4093. $i++;
  4094. }
  4095. $data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY');
  4096. $title = "订单资金信息";
  4097. $titlename = "<table border=1>
  4098. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  4099. <tr>
  4100. <td>NO.</td>
  4101. <td>店铺</td>
  4102. <td>负责人</td>
  4103. <td>编号</td>
  4104. <td>订单号</td>
  4105. <td>客户姓名</td>
  4106. <td>国家</td>
  4107. <td>订单日期</td>
  4108. <td>发货日期</td>
  4109. <td>快递公司</td>
  4110. <td>运单号</td>
  4111. <td>订单金额</td>
  4112. <td>退款金额</td>
  4113. <td>手续费</td>
  4114. <td>预估金额</td>
  4115. <td>
  4116. <table border=1>
  4117. <tr><td colspan='3' align='center'>订单产品信息</td></tr>
  4118. <tr>
  4119. <td>产品</td>
  4120. <td>条数</td>
  4121. <td>数量</td>
  4122. </tr>
  4123. </table>
  4124. </td>
  4125. <td>总条数</td>
  4126. </tr>
  4127. </table>";
  4128. $filename = $title.".xls";
  4129. $tail = "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>合计:</td><td>".$data[0]."</td><td>".$data[1]."</td><td>".$data[2]."</td><td>".$data[3]."</td></tr>\n";
  4130. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  4131. }
  4132. }
  4133. //导出订单excel
  4134. public function _fdexcel()
  4135. {
  4136. if(isset($_GET['excel']))
  4137. {
  4138. $page = $this->input->post('page',true);
  4139. $perpage = $this->input->post('perpage',true);
  4140. $timetk = $this->input->post('timetk',true);
  4141. $timetj = $this->input->post('timetj',true);
  4142. $shop = $this->input->post('shop',true);
  4143. $source = $this->input->post('source',true);
  4144. $state = $this->input->post('state',true);
  4145. $review = $this->input->post('review',true);
  4146. $express = $this->input->post('express',true);
  4147. $orderinfo = $this->input->post('orderinfo',true);
  4148. $user = $this->input->post('user',true);
  4149. $name = $this->input->post('name',true);
  4150. $waybill = $this->input->post('waybill',true);
  4151. $timetk = strtotime($timetk);
  4152. $timetj = strtotime($timetj);
  4153. $where = "1=1 and mergeid = 0";
  4154. if($timetk && $timetj)
  4155. {
  4156. $where .= " and buytime > '$timetk' and buytime < '$timetj'";
  4157. }
  4158. if($shop)
  4159. {
  4160. $where .= " and shop = '$shop'";
  4161. }
  4162. if($source)
  4163. {
  4164. $where .= " and source = '$source'";
  4165. }
  4166. if($state)
  4167. {
  4168. $where .= " and state = '$state'";
  4169. }
  4170. if($review)
  4171. {
  4172. $where .= " and review = '$review'";
  4173. }
  4174. if($express)
  4175. {
  4176. $where .= " and express = '$express'";
  4177. }
  4178. if($orderinfo)
  4179. {
  4180. $where .= " and orderinfo = '$orderinfo'";
  4181. }
  4182. if($user)
  4183. {
  4184. $where .= " and user = '$user'";
  4185. }
  4186. if($name)
  4187. {
  4188. $where .= " and name = '$name'";
  4189. }
  4190. if($waybill)
  4191. {
  4192. $where .= " and waybill = '$waybill'";
  4193. }
  4194. //取得信息列表
  4195. $info_list = $this->fullorder->find_all($where,'id,shop,number,orderinfo,source,client,name,address,city,zipcode,province,country,phone,dtime,ftime,state,shouldmoney,express,waybill,orderremarks,clientremarks,fpdata,hl,currencytitle');
  4196. //格式化数据
  4197. $i = 1;$shouldmoney = 0;$hl=1;
  4198. foreach ($info_list as $key=>$value)
  4199. {
  4200. $info_list[$key]['id'] = $i;
  4201. if($value['source'] == 1)
  4202. {
  4203. $info_list[$key]['source'] = "线下订单";
  4204. }
  4205. else if($value['source'] == 2)
  4206. {
  4207. $info_list[$key]['source'] = "PC订单";
  4208. }
  4209. else if($value['source'] == 3)
  4210. {
  4211. $info_list[$key]['source'] = "手机订单";
  4212. }
  4213. if($value['currencytitle'] != "CNY")
  4214. {
  4215. $hl=$value['hl'];
  4216. }
  4217. $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);
  4218. $shop = $this->shop->read($value['shop']);
  4219. $info_list[$key]['shop'] = $shop['shopname'];
  4220. $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);
  4221. $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);
  4222. $state = $this->typeclass->read($value['state']);
  4223. $info_list[$key]['state'] = $state['title'];
  4224. $country = $this->country->read($value['country']);
  4225. $info_list[$key]['country'] = $country['name'];
  4226. $express = $this->express->read($value['express']);
  4227. $info_list[$key]['express'] = $express['servicename'];
  4228. $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];
  4229. $fpdata = array();
  4230. if(stripos($value['fpdata'],';') !== false)
  4231. {
  4232. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  4233. foreach ($fpdata as $ke=>$va)
  4234. {
  4235. $v = explode('|',rtrim($va,'|'));
  4236. $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数
  4237. }
  4238. }
  4239. $info_list[$key]['fpdata'] = $fpdata;
  4240. $i++;
  4241. }
  4242. $data = array($shouldmoney.' CNY');
  4243. $title = "订单信息表";
  4244. $titlename = "<table border=1>
  4245. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  4246. <tr>
  4247. <td>NO.</td>
  4248. <td>店铺</td>
  4249. <td>编号</td>
  4250. <td>订单号</td>
  4251. <td>订单类型</td>
  4252. <td>客户姓名</td>
  4253. <td>收件人名称</td>
  4254. <td>收货人地址</td>
  4255. <td>城市</td>
  4256. <td>邮编</td>
  4257. <td>州</td>
  4258. <td>国家</td>
  4259. <td>收件电话</td>
  4260. <td>订单日期</td>
  4261. <td>发货日期</td>
  4262. <td>订单状态</td>
  4263. <td>订单金额</td>
  4264. <td>快递公司</td>
  4265. <td>运单号</td>
  4266. <td>订单备注</td>
  4267. <td>客户备注</td>
  4268. <td>
  4269. <table border=1>
  4270. <tr><td colspan='3' align='center'>订单产品信息</td></tr>
  4271. <tr>
  4272. <td>产品</td>
  4273. <td>条数</td>
  4274. <td>数量</td>
  4275. </tr>
  4276. </table>
  4277. </td>
  4278. <td>总条数</td>
  4279. </tr>
  4280. </table>";
  4281. $filename = $title.".xls";
  4282. $tail = "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>合计:</td><td>".$data[0]."</td></tr>\n";
  4283. $this->excel->get_fz($info_list,$titlename,$filename,$tail);
  4284. }
  4285. }
  4286. public function _black()
  4287. {
  4288. $post = $this->input->post(NULL, TRUE);
  4289. if(isset($post['bd']))
  4290. {
  4291. $bd = $this->input->post('bd',true);
  4292. $rows = $this->fullorder->read($bd);
  4293. $post['shop'] = $rows['shop'];
  4294. $post['source'] = 1;
  4295. $post['name'] = $rows['client'];
  4296. $post['email'] = $rows['email'];
  4297. $post['phone'] = $rows['phone'];
  4298. $post['country'] = $rows['country'];
  4299. $post['money'] = $rows['shouldmoney'];
  4300. $post['num'] = 1;
  4301. $post['time'] = $rows['dtime'];
  4302. $post['province'] = $rows['province'];
  4303. $post['city'] = $rows['city'];
  4304. $post['street'] = $rows['street'];
  4305. $post['address'] = $rows['address'];
  4306. $post['address2'] = $rows['address2'];
  4307. $post['zipcode'] = $rows['zipcode'];
  4308. $post['type'] = 2;
  4309. if($this->customer->insert($post))
  4310. {
  4311. $this->fullorder->save(array('black'=>1),$bd);
  4312. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  4313. }
  4314. else
  4315. {
  4316. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  4317. }
  4318. }
  4319. }
  4320. public function _ryf()
  4321. {
  4322. $post = $this->input->post(NULL, TRUE);
  4323. if(isset($post['bd']))
  4324. {
  4325. $bd = $this->input->post('bd',true);
  4326. $d = $this->fullorder->read($bd);
  4327. if($d['state'] == 207 || $d['state'] == 207)//订单状态为等待发货或等待部分发货才可更改为允许发货
  4328. {
  4329. if($d['print'] < 3)//打印状态为未打印
  4330. {
  4331. $print = 1;//未打印
  4332. $libraryconfirm = 1;//不允许出库
  4333. $a = "订单未打印,";
  4334. }
  4335. else//已打印订单
  4336. {
  4337. $libraryconfirm = 2;//允许出库
  4338. $a = "";
  4339. }
  4340. if($this->fullorder->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
  4341. {
  4342. echo json_encode(array('msg'=>'操作成功','success'=>true));exit;
  4343. }
  4344. else
  4345. {
  4346. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  4347. }
  4348. }
  4349. if($this->fullorder->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))
  4350. {
  4351. echo json_encode(array('msg'=>'操作失败!订单未非发货状态','success'=>false));exit;
  4352. }
  4353. else
  4354. {
  4355. echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;
  4356. }
  4357. }
  4358. }
  4359. public function _fsstate()
  4360. {
  4361. $post = $this->input->post(NULL, TRUE);
  4362. if(isset($post['s']))
  4363. {
  4364. $id_arr = $this->input->post('s');
  4365. $id_arr = explode(',',$id_arr);
  4366. if(!$id_arr)
  4367. {
  4368. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  4369. }
  4370. foreach ($id_arr as $v)
  4371. {
  4372. $data = $this->fullorder->read($v);
  4373. $warehouse = $this->warehouse->read($data['type']);
  4374. $fs = $this->notice->get_ordertatus($data['state']);
  4375. if($fs)
  4376. {
  4377. $ck = $this->_email($fs['content'],$data,$warehouse['company']);
  4378. if($ck == 1)
  4379. {
  4380. $this->fullorder->save(array('fscontent'=>date('Y-m-d H:i:s',time()).'已发送:'.$fs['title'].' - '),$v);
  4381. }
  4382. }
  4383. }
  4384. echo json_encode(array('msg'=>'发送完成!','success'=>true));exit;
  4385. }
  4386. }
  4387. public function _power()
  4388. {
  4389. $user = $this->user->get_api($_SESSION['api']);
  4390. $post = $this->input->post(NULL, TRUE);
  4391. if(isset($post['id']))
  4392. {
  4393. $id = $this->input->post('id',true);
  4394. $fullorder = $this->fullorder->read($id);
  4395. $express = $this->express->read($fullorder['express']);
  4396. $warehouse = $this->warehouse->read($fullorder['type']);
  4397. if(($warehouse['zd'] == '1' || stripos($fullorder['whlabel'],'z|') !== false) && $fullorder['library'] == '2')
  4398. {
  4399. echo json_encode(array('msg'=>'需要先退库释放库存后才可重置!','success'=>false));exit;
  4400. }
  4401. /**
  4402. if($fullorder['print'] == '3' && isset($express['iscode']) && ($express['iscode'] == 'ARAMEX' || $express['iscode'] == 'TOLL' || $express['iscode'] == 'FEDEX'))
  4403. {
  4404. $lj = $this->ali->get_lj($fullorder['number'],2,'订单修改');
  4405. if($lj != '1' && $lj != '订单不存在')
  4406. {
  4407. echo json_encode(array('msg'=>$lj,'success'=>false));exit;
  4408. }
  4409. }
  4410. **/
  4411. $warehouse = $this->warehouse->read($fullorder['warehouse']);
  4412. $typeclass = $this->typeclass->read($fullorder['state']);
  4413. $express = $this->express->read($fullorder['express']);
  4414. $printtype = array(1=>'运单',2=>'发货单',3=>'不打印单据');
  4415. $teset['number']=$fullorder['number'];
  4416. $teset['orderinfo']=$fullorder['orderinfo'];
  4417. $teset['shop']=$fullorder['shop'];
  4418. $teset['user']=$user['userid'];
  4419. $teset['ip']=$this->input->ip_address();
  4420. $teset['time']=time();
  4421. $teset['warehouse']=(isset($warehouse['title']))?$warehouse['title']:'未选择';
  4422. $teset['state']=(isset($typeclass['title']))?$typeclass['spare']:'未选择';
  4423. $teset['express']=(isset($express['title']))?$express['servicename']:'未选择';
  4424. $teset['printtype']=(isset($printtype[$fullorder['printtype']]))?$printtype[$fullorder['printtype']]:'未选择';
  4425. $teset['reviewtime']=($fullorder['reviewtime'] > '0')?date('Y-m-d H:i:s',$fullorder['reviewtime']):'无';
  4426. $teset['printtime']=($fullorder['printtime'] > '0')?date('Y-m-d H:i:s',$fullorder['printtime']):'无';
  4427. $teset['librarytime']=($fullorder['librarytime'] > '0')?date('Y-m-d H:i:s',$fullorder['librarytime']):'无';
  4428. $teset['shipremarks']=$fullorder['shipremarks'];
  4429. $teset['fpdata']=$fullorder['fpdata'];
  4430. $teset['oldwaybill']=$fullorder['oldwaybill'];
  4431. $teset['oldprinttime']=$fullorder['oldprinttime'];
  4432. if($fullorder['printtype'] == 1)
  4433. {
  4434. if($fullorder['waybill'] != '' && stripos($fullorder['oldwaybill'],$fullorder['waybill']) === false)
  4435. {
  4436. $teset['oldwaybill'] .= '-'.date('Ymd',$fullorder['printtime']).'/'.$fullorder['waybill'];
  4437. $teset['oldprinttime'] .= '-'.$fullorder['printtime'];
  4438. }
  4439. }
  4440. $review = ($fullorder['source']==1)?2:1;//线下单审核状态直接为待审核
  4441. if(!$this->fullreset->insert($teset))
  4442. {
  4443. echo json_encode(array('msg'=>'重置失败,请重试','success'=>true));exit;
  4444. }
  4445. if($this->fullorder->save(array('library'=>1,'librarytime'=>0,'libraryconfirm'=>2,'print'=>1,'printtime'=>0,'printnumber'=>0,'retreattime'=>0,'librarynot'=>'订单未打印,未审核或未通过','review'=>$review,'reviewtime'=>0,'state'=>207,'waybill'=>'','waybill2'=>'','waybillid'=>'','oldwaybill'=>$teset['oldwaybill'],'oldprinttime'=>$teset['oldprinttime'],'dlzemail'=>0,'yhs'=>0,'failed'=>''),$id))
  4446. {
  4447. echo json_encode(array('msg'=>'重置成功!如需再次提交,请先保存、再提交','success'=>true));exit;
  4448. }
  4449. else
  4450. {
  4451. echo json_encode(array('msg'=>'重置失败,请重试','success'=>false));exit;
  4452. }
  4453. }
  4454. }
  4455. public function _expresstype()
  4456. {
  4457. $post = $this->input->post(NULL, TRUE);
  4458. if(isset($post['id']))
  4459. {
  4460. $id = $this->input->post('id',true);
  4461. $data = $this->express->read($id);
  4462. echo json_encode(array('msg'=>$data['type'],'success'=>true));exit;
  4463. }
  4464. }
  4465. public function _email($content,$data,$shopname)
  4466. {
  4467. $express = $this->express->read($data['express']);
  4468. $t= array('$userName','$orderid','$trackingNumber','$expressCompany','$contactPerson','$mobileNo','$zip','$recipientAddress');//需要被替换的内容
  4469. $h= array($data['client'],$data['orderinfo'],$data['waybill'],$express['servicename'],$data['name'],$data['phone'],$data['zipcode'],$data['address']);//替换的内容
  4470. $content = str_replace($t,$h,$content);
  4471. $this->load->library('email');
  4472. $config['protocol'] = 'smtp';
  4473. $config['smtp_host'] = 'smtpdm-ap-southeast-1.aliyun.com';
  4474. $config['smtp_port'] = 465;
  4475. $config['smtp_user'] = 'service@email.supernovahair.com';
  4476. $config['smtp_pass'] = 'LONGyihair374';
  4477. $config['smtp_crypto'] = 'ssl';
  4478. $config['crlf'] = "\r\n";
  4479. $config['newline'] = "\r\n";
  4480. $this->email->initialize($config);
  4481. $this->email->from('service@email.supernovahair.com',$shopname);
  4482. $this->email->to($data['email']);//收件
  4483. $this->email->subject('The product you purchased has a new progress');//标题
  4484. $this->email->message($content);//内容
  4485. if ( ! $this->email->send())
  4486. {
  4487. return 2;
  4488. }
  4489. else
  4490. {
  4491. return 1;
  4492. }
  4493. }
  4494. public function _error()
  4495. {
  4496. if(isset($_SESSION['api']))
  4497. {
  4498. $user = $this->user->get_api($_SESSION['api']);
  4499. $usp = $user;
  4500. $fgshop = "";$sid = "";
  4501. $user = explode('|',trim($user['shop'],'|'));
  4502. foreach ($user as $value)
  4503. {
  4504. $fgshop .= " shop = ".$value." or";
  4505. $sid .= " id = ".$value." or";
  4506. }
  4507. }
  4508. $post = $this->input->post(NULL, TRUE);
  4509. if(isset($post['page']))
  4510. {
  4511. $page = $this->input->post('page',true);
  4512. $perpage = $this->input->post('perpage',true);
  4513. $orderinfo = $this->input->post('orderinfo',true);
  4514. $waybill = $this->input->post('waybill',true);
  4515. $number = $this->input->post('number',true);
  4516. $timetk = $this->input->post('timetk',true);
  4517. $timetj = $this->input->post('timetj',true);
  4518. $timetk = strtotime($timetk);
  4519. $timetj = strtotime($timetj);
  4520. $where = "failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').")";
  4521. if($orderinfo)
  4522. {
  4523. $where .= " and orderinfo = '$orderinfo'";
  4524. }
  4525. if($waybill)
  4526. {
  4527. $where .= " and waybill = '$waybill'";
  4528. }
  4529. if($number)
  4530. {
  4531. $where .= " and number = '$number'";
  4532. }
  4533. if($timetk && $timetj)
  4534. {
  4535. $timetj = $timetj+24*3600;
  4536. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  4537. }
  4538. //数据排序
  4539. $order_str = "dtime desc";
  4540. if(empty($page))
  4541. {
  4542. $start = 0;
  4543. $perpage = 1;
  4544. }
  4545. else
  4546. {
  4547. $start = ($page - 1)*$perpage;
  4548. }
  4549. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage);
  4550. //格式化数据
  4551. foreach ($info_list as $key=>$value)
  4552. {
  4553. $ud = $this->fullorder->read($value['id']);
  4554. $shop = $this->shop->read($value['shop']);
  4555. $info_list[$key]['shop'] = $shop['shopname'];
  4556. $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
  4557. $warehouse = $this->warehouse->read($value['type']);
  4558. $warehousetitle = $warehouse['title'];
  4559. if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
  4560. $info_list[$key]['type'] = $warehousetitle;
  4561. if($value['express'] != 0)
  4562. {
  4563. $express = $this->express->read($value['express']);
  4564. $expressservicename = $express['servicename'];
  4565. if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
  4566. $info_list[$key]['express'] = $expressservicename;
  4567. }
  4568. else
  4569. {
  4570. $info_list[$key]['express'] = "无";
  4571. }
  4572. $x = "";
  4573. if($ud['review'] >4 && $ud['print'] == 1)
  4574. {
  4575. $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
  4576. }
  4577. else
  4578. {
  4579. $x = "<p class='ckn'><b class='fojzof' data-type='9' data-id='".$value['id']."'>关闭</b></p>";
  4580. }
  4581. $info_list[$key]['operation'] = $x;
  4582. }
  4583. $total = $this->fullorder->find_count($where);
  4584. $pagenum = ceil($total/$perpage);
  4585. $over = $total-($start+$perpage);
  4586. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  4587. echo json_encode($rows);exit;
  4588. }
  4589. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  4590. $this->data['wlshop'] = $wlshop;
  4591. $this->data['express'] = $this->express->find_all();
  4592. $user = $this->user->get_api($_SESSION['api']);
  4593. $powerid = $this->power->read($user['power']);
  4594. $powertext = explode('|',trim($powerid['excelid'],'|'));
  4595. $pid = '';
  4596. foreach ($powertext as $v)
  4597. {
  4598. $pid .= " id = ".$v." or";
  4599. }
  4600. $fullorderexcel = $this->fullorderexcel->find_all("type = '100001' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板
  4601. $this->data['fullorderexcel'] = $fullorderexcel;
  4602. $this->_Template('fullorder_error',$this->data);
  4603. }
  4604. //验证地址
  4605. public function _yzaddress()
  4606. {
  4607. $post = $this->input->post(NULL, TRUE);
  4608. if(isset($post['address']))
  4609. {
  4610. $address = $this->input->post('address',true);
  4611. $address2 = $this->input->post('address2',true);
  4612. $city = $this->input->post('city',true);
  4613. $province = $this->input->post('province',true);
  4614. $zipcode = $this->input->post('zipcode',true);
  4615. $barcode = $this->usps->get_address(array('address'=>$address,'address2'=>$address2,'city'=>$city,'province'=>$province,'zipcode'=>$zipcode));
  4616. $this->logic_ding->sendToDing("usps地址验证返回数据".$barcode);
  4617. echo $barcode;
  4618. }
  4619. }
  4620. //清除退货信息
  4621. public function _clearreturn()
  4622. {
  4623. $post = $this->input->post(NULL, TRUE);
  4624. if(isset($post['orderinfo']))
  4625. {
  4626. $orderinfo = $this->input->post('orderinfo',true);
  4627. $data = $this->fullorder->get_orderinfo($orderinfo);
  4628. $fu = 'fullorder';
  4629. if(!$data)
  4630. {
  4631. $data = $this->fullorder_smt->get_orderinfo($orderinfo);
  4632. $fu = 'fullorder_smt';
  4633. }
  4634. $this->$fu->save(array('library'=>'2','retreattime'=>'0','returndata'=>''),$data['id']);
  4635. echo json_encode(array('msg'=>'清除成功!','success'=>true));exit;
  4636. }
  4637. }
  4638. //订单退货
  4639. public function _return()
  4640. {
  4641. $post = $this->input->post(NULL, TRUE);
  4642. if(isset($post['orderinfo']))
  4643. {
  4644. $orderinfo = $this->input->post('orderinfo',true);
  4645. $data = $this->fullorder->get_orderinfo($orderinfo);
  4646. $fu = 'fullorder';
  4647. if(!$data)
  4648. {
  4649. $data = $this->fullorder_smt->get_orderinfo($orderinfo);
  4650. $fu = 'fullorder_smt';
  4651. }
  4652. $bctime = date('Ymd',time());
  4653. if($data['library'] != 2){
  4654. echo json_encode(array('msg'=>'此单不是出库状态,不允许退货','success'=>false));exit;
  4655. }
  4656. if($data['returndata'] != "")
  4657. {
  4658. echo json_encode(array('msg'=>'请求失败,已有Return Label信息!','success'=>false));exit;
  4659. }
  4660. $barcode = $this->usps->get_return($data);
  4661. // if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))
  4662. // {
  4663. // echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;
  4664. // }
  4665. // else if(isset($barcode['TrackingNumber']))
  4666. // {
  4667. // $pdf = $this->_pdf($barcode['ReturnLabel'],'t-'.$barcode['TrackingNumber'],$bctime);
  4668. // $read = 'PostalRouting:'.$barcode['PostalRouting'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['TrackingNumber'].'.pdf" target="_blank">'.$barcode['TrackingNumber'].'</a>';
  4669. // $this->$fu->save(array('returndata'=>$read),$data['id']);
  4670. // echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
  4671. // }
  4672. // else
  4673. // {
  4674. // echo json_encode(array('msg'=>'请求失败,请稍后重试!','cs'=>$barcode,'success'=>false));exit;
  4675. // }
  4676. if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))
  4677. {
  4678. echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;
  4679. }
  4680. else if(isset($barcode['trackingNumber']))
  4681. {
  4682. $pdf = $this->_pdf($barcode['returnLabelImage'],'t-'.$barcode['trackingNumber'],$bctime);
  4683. $read = 'PostalRouting:'.$barcode['routingInformation'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['trackingNumber'].'.pdf" target="_blank">'.$barcode['trackingNumber'].'</a>';
  4684. $this->$fu->save(array('returndata'=>$read),$data['id']);
  4685. echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
  4686. }
  4687. else
  4688. {
  4689. echo json_encode(array('msg'=>'请求失败,请稍后重试!'.json_encode($barcode),'cs'=>$barcode,'success'=>false));exit;
  4690. }
  4691. }
  4692. /**
  4693. $post = $this->input->post(NULL, TRUE);
  4694. if(isset($post['orderinfo']))
  4695. {
  4696. $orderinfo = $this->input->post('orderinfo',true);
  4697. $data = $this->fullorder->get_orderinfo($orderinfo);
  4698. $fu = 'fullorder';
  4699. if(!$data)
  4700. {
  4701. $data = $this->fullorder_smt->get_orderinfo($orderinfo);
  4702. $fu = 'fullorder_smt';
  4703. }
  4704. $bctime = date('Ymd',time());
  4705. if($data['returndata'] != "")
  4706. {
  4707. echo json_encode(array('msg'=>'请求失败,已有Return Label信息!','success'=>false));exit;
  4708. }
  4709. $barcode = $this->usps->get_return($data);
  4710. if(isset($barcode['error']['message']))
  4711. {
  4712. echo json_encode(array('msg'=>$barcode['error']['message'],'success'=>false));exit;
  4713. }
  4714. else if(isset($barcode['trackingNumber']))
  4715. {
  4716. $pdf = $this->_pdf($barcode['returnLabelImage'],'t-'.$barcode['trackingNumber'],$bctime);
  4717. $read = 'trackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['trackingNumber'].'.pdf" target="_blank">'.$barcode['trackingNumber'].'</a>';
  4718. $this->$fu->save(array('returndata'=>$read),$data['id']);
  4719. echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;
  4720. }
  4721. else
  4722. {
  4723. echo json_encode(array('msg'=>'请求失败,请稍后重试!','cs'=>$barcode,'success'=>false));exit;
  4724. }
  4725. }**/
  4726. }
  4727. public function _pdf($pdf,$title,$bctime)
  4728. {
  4729. $pdf_path = './data/pdf/'.$bctime.'/';
  4730. $file_base64 = $pdf;
  4731. $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);
  4732. $file_base64 = base64_decode($file_base64);
  4733. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  4734. file_put_contents($pdf_path.$title.'.pdf',$file_base64);
  4735. return $bctime;
  4736. }
  4737. public function _find($find)
  4738. {
  4739. preg_match_all('/\d+/',$find,$n);
  4740. $a = '';
  4741. foreach($n[0] as $v)
  4742. {
  4743. $a .= $v;
  4744. }
  4745. return $a;
  4746. }
  4747. public function _dqpm()
  4748. {
  4749. if(isset($_SESSION['api']))
  4750. {
  4751. $user = $this->user->get_api($_SESSION['api']);
  4752. $usp = $user;
  4753. $fgshop = "";$sid = "";
  4754. $usersp = explode('|',trim($user['shop'],'|'));
  4755. foreach ($usersp as $value)
  4756. {
  4757. $fgshop .= " shop = ".$value." or";
  4758. $sid .= " id = ".$value." or";
  4759. }
  4760. }
  4761. $post = $this->input->post(NULL, TRUE);
  4762. if(isset($post['page']))
  4763. {
  4764. $timetk = $this->input->post('timetk',true);
  4765. $timetj = $this->input->post('timetj',true);
  4766. $timetk = strtotime($timetk);
  4767. $timetj = strtotime($timetj);
  4768. $where = "mergeid = 0 and (".rtrim($fgshop,'or').")";
  4769. if($timetk && $timetj)
  4770. {
  4771. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  4772. }
  4773. //数据排序
  4774. $order_str = "dtime desc";
  4775. if(empty($page))
  4776. {
  4777. $start = 0;
  4778. $perpage = 1;
  4779. }
  4780. else
  4781. {
  4782. $start = ($page - 1)*$perpage;
  4783. }
  4784. $continentdata = '';
  4785. $continent = array();//陆地板块
  4786. $num = $this->fullorder->find_count($where);//订单总数量
  4787. $country = $this->country->find_all('1=1','id,continent,ename,zname');
  4788. foreach ($country as $k=>$v)
  4789. {
  4790. $tc = $this->typeclass->read($v['continent']);
  4791. $continent[$v['continent']] = array(0=>$tc['title'],1=>0,2=>'');
  4792. }
  4793. foreach ($country as $k=>$v)
  4794. {
  4795. $n = $this->fullorder->find_count($where.' and country = "'.$v['id'].'"');
  4796. $country[$k]['continent'] = $continent[$v['continent']][0];//此国家数量
  4797. $country[$k]['zname'] = '<a href="/fullorder/dqpmprovince/'.$v['id'].'/'.$timetk.'/'.$timetj.'">'.$v['zname'].'</a>';//此国家数量
  4798. $country[$k]['num'] = $n;//此国家数量
  4799. $country[$k]['zb'] = (sprintf("%.4f",$n/$num)*100).'%';//此国家占比
  4800. $continent[$v['continent']]['1'] += $n;//此洲数量增加;
  4801. }
  4802. array_multisort(array_column($continent, '1'), SORT_DESC, $continent);
  4803. array_multisort(array_column($country, 'num'), SORT_DESC, $country);
  4804. foreach ($continent as $k=>$v)
  4805. {
  4806. $continentdata .= $v['0'].' 总量:'.$v['1'].' 占比:'.(sprintf("%.4f",$v['1']/$num)*100).'%&nbsp;&nbsp; - &nbsp;&nbsp;';
  4807. }
  4808. echo json_encode(array('ewnr'=>$continentdata,'rows'=>$country,'total'=>count($country),'over'=>0,'pagenum'=>1,'success'=>true));exit;
  4809. }
  4810. $this->_Template('fullorder_dqpm',$this->data);
  4811. }
  4812. public function _dqpmprovince($arg_array)
  4813. {
  4814. if(isset($_SESSION['api']))
  4815. {
  4816. $user = $this->user->get_api($_SESSION['api']);
  4817. $usp = $user;
  4818. $fgshop = "";$sid = "";
  4819. $usersp = explode('|',trim($user['shop'],'|'));
  4820. foreach ($usersp as $value)
  4821. {
  4822. $fgshop .= " shop = ".$value." or";
  4823. $sid .= " id = ".$value." or";
  4824. }
  4825. }
  4826. $post = $this->input->post(NULL, TRUE);
  4827. if(isset($post['page']))
  4828. {
  4829. $country = $this->input->post('country',true);
  4830. $timetk = $this->input->post('timetk',true);
  4831. $timetj = $this->input->post('timetj',true);
  4832. $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
  4833. $province = array();
  4834. $city_list = $this->fullorder->find_all($where,'id,province');
  4835. $ToState = array('AL'=>'alabama','AK'=>'alaska','AZ'=>'arizona','AR'=>'arkansas','CA'=>'california','CO'=>'colorado','CT'=>'connecticut','DE'=>'delaware','FL'=>'florida','GA'=>'georgia','HI'=>'hawaii','ID'=>'idaho','IL'=>'illinois','IN'=>'indiana','IA'=>'iowa','KS'=>'kansas','KY'=>'kentucky','LA'=>'louisiana','ME'=>'maine','MD'=>'maryland','MA'=>'massachusetts','MI'=>'michigan','MN'=>'minnesota','MS'=>'mississippi','MO'=>'missouri','MT'=>'montana','NE'=>'nebraska','NV'=>'nevada','NH'=>'new hampshire','NJ'=>'new jersey','NM'=>'new mexico','NY'=>'new york','NC'=>'north carolina','ND'=>'north dakota','OH'=>'ohio','OK'=>'oklahoma','OR'=>'oregon','PA'=>'pennsylvania','RI'=>'rhode island','SC'=>'south carolina','SD'=>'south dakota','TN'=>'tennessee','TX'=>'texas','UT'=>'utah','VT'=>'vermont','VA'=>'virginia','WA'=>'washington','WV'=>'west virginia','WI'=>'wisconsin','WY'=>'wyoming','DC'=>'district of columbia','VI'=>'virgin islands');
  4836. foreach ($city_list as $k=>$v)
  4837. {
  4838. $v['province'] = strtoupper(trim($v['province'],' '));
  4839. if(isset($ToState[$v['province']]))
  4840. {
  4841. $v['province'] = $ToState[$v['province']];
  4842. }
  4843. if(!isset($province[$v['province']]))
  4844. {
  4845. $province[$v['province']] = array('id'=>$v['id'],'province'=>'<a href="/fullorder/ddpmdata/'.$country.'/'.$timetk.'/'.$timetj.'/'.strtoupper($v['province']).'">'.$v['province'].'</a>','num'=>0,'zb'=>'');
  4846. }
  4847. $province[$v['province']]['num'] += 1;
  4848. }
  4849. array_multisort(array_column($province, 'num'), SORT_DESC, $province);
  4850. $province = array_values($province);
  4851. foreach ($province as $k=>$v)
  4852. {
  4853. $province[$k]['zb'] = (sprintf("%.4f",$v['num']/count($city_list))*100).'%';
  4854. }
  4855. echo json_encode(array('rows'=>($province),'total'=>count($province),'over'=>0,'pagenum'=>1,'success'=>true));exit;
  4856. }
  4857. $this->data['arg_array'] = $arg_array;
  4858. $this->_Template('fullorder_dqpmprovince',$this->data);
  4859. }
  4860. public function _ddpmdata($arg_array)
  4861. {
  4862. $arg_array[3] = str_replace('%20',' ',$arg_array[3]);
  4863. if(isset($_SESSION['api']))
  4864. {
  4865. $user = $this->user->get_api($_SESSION['api']);
  4866. $usp = $user;
  4867. $fgshop = "";$sid = "";
  4868. $usersp = explode('|',trim($user['shop'],'|'));
  4869. foreach ($usersp as $value)
  4870. {
  4871. $fgshop .= " shop = ".$value." or";
  4872. $sid .= " id = ".$value." or";
  4873. }
  4874. }
  4875. $post = $this->input->post(NULL, TRUE);
  4876. if(isset($post['page']))
  4877. {
  4878. $page = $this->input->post('page',true);
  4879. $perpage = $this->input->post('perpage',true);
  4880. $province = $this->input->post('province',true);
  4881. $timetk = $this->input->post('timetk',true);;
  4882. $timetj = $this->input->post('timetj',true);;
  4883. $country = $this->input->post('country',true);;
  4884. $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
  4885. if($province)
  4886. {
  4887. $where .= " and province = '$province'";
  4888. }
  4889. $order_str = "dtime desc";
  4890. if(empty($page))
  4891. {
  4892. $start = 0;
  4893. $perpage = 1;
  4894. }
  4895. else
  4896. {
  4897. $start = ($page - 1)*$perpage;
  4898. }
  4899. $info_list = $this->fullorder->find_all($where,'id,orderinfo,number,shipremarks,shouldmoney',$order_str,$start,$perpage);
  4900. $total = $this->fullorder->find_count($where);
  4901. $pagenum = ceil($total/$perpage);
  4902. $over = $total-($start+$perpage);
  4903. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  4904. echo json_encode($rows);exit;
  4905. }
  4906. $province = array();
  4907. $city_list = $this->fullorder->find_all("mergeid = 0 and dtime > '$arg_array[1]' and dtime < '$arg_array[2]' and country = '$arg_array[0]' and (".rtrim($fgshop,'or').")",'province');
  4908. $ToState = array('AL'=>'alabama','AK'=>'alaska','AZ'=>'arizona','AR'=>'arkansas','CA'=>'california','CO'=>'colorado','CT'=>'connecticut','DE'=>'delaware','FL'=>'florida','GA'=>'georgia','HI'=>'hawaii','ID'=>'idaho','IL'=>'illinois','IN'=>'indiana','IA'=>'iowa','KS'=>'kansas','KY'=>'kentucky','LA'=>'louisiana','ME'=>'maine','MD'=>'maryland','MA'=>'massachusetts','MI'=>'michigan','MN'=>'minnesota','MS'=>'mississippi','MO'=>'missouri','MT'=>'montana','NE'=>'nebraska','NV'=>'nevada','NH'=>'new hampshire','NJ'=>'new jersey','NM'=>'new mexico','NY'=>'new york','NC'=>'north carolina','ND'=>'north dakota','OH'=>'ohio','OK'=>'oklahoma','OR'=>'oregon','PA'=>'pennsylvania','RI'=>'rhode island','SC'=>'south carolina','SD'=>'south dakota','TN'=>'tennessee','TX'=>'texas','UT'=>'utah','VT'=>'vermont','VA'=>'virginia','WA'=>'washington','WV'=>'west virginia','WI'=>'wisconsin','WY'=>'wyoming','DC'=>'district of columbia','VI'=>'virgin islands');
  4909. foreach ($city_list as $k=>$v)
  4910. {
  4911. $v['province'] = strtoupper(trim($v['province'],' '));
  4912. if(isset($ToState[$v['province']]))
  4913. {
  4914. $v['province'] = $ToState[$v['province']];
  4915. }
  4916. $province[$v['province']] = array('province'=>$v['province']);
  4917. }
  4918. $this->data['province'] = $province;
  4919. $this->data['arg_array'] = $arg_array;
  4920. $this->_Template('fullorder_ddpmdata',$this->data);
  4921. }
  4922. public function _ddpmexcel($arg_array)
  4923. {
  4924. if(isset($_SESSION['api']))
  4925. {
  4926. $user = $this->user->get_api($_SESSION['api']);
  4927. $usp = $user;
  4928. $fgshop = "";$sid = "";
  4929. $usersp = explode('|',trim($user['shop'],'|'));
  4930. foreach ($usersp as $value)
  4931. {
  4932. $fgshop .= " shop = ".$value." or";
  4933. $sid .= " id = ".$value." or";
  4934. }
  4935. }
  4936. $province = $this->input->get('province',true);
  4937. $timetk = $arg_array[1];
  4938. $timetj = $arg_array[2];
  4939. $country = $arg_array[0];
  4940. $where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";
  4941. if($province)
  4942. {
  4943. $where .= " and province = '$province'";
  4944. }
  4945. $order_str = "dtime desc";
  4946. $info_list = $this->fullorder->find_all($where,'orderinfo,number,shipremarks,shouldmoney',$order_str);
  4947. $country = $this->country->read($arg_array[0]);
  4948. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  4949. $titlename = "<table border=1>
  4950. <tr><th colspan='4' align='left'><h3>".$title."<h3></th></tr>
  4951. <tr>
  4952. <td>订单号</td>
  4953. <td>订单编号</td>
  4954. <td>仓库品名</td>
  4955. <td>订单金额</td>
  4956. </tr>
  4957. </table>";
  4958. $filename = $title.".xls";
  4959. $tail = "\n";
  4960. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  4961. }
  4962. public function _statedc()
  4963. {
  4964. $user = $this->user->get_api($_SESSION['api']);
  4965. if($user)
  4966. {
  4967. $fgshop = "";$sid = "";
  4968. $user = explode('|',trim($user['shop'],'|'));
  4969. foreach ($user as $value)
  4970. {
  4971. $fgshop .= " shop = ".$value." or";
  4972. $sid .= " id = ".$value." or";
  4973. }
  4974. }
  4975. $post = $this->input->get(NULL, TRUE);
  4976. if(isset($post['timetk']))
  4977. {
  4978. $page = $this->input->get('page',true);
  4979. $perpage = $this->input->get('perpage',true);
  4980. $timetk = $this->input->get('timetk',true);
  4981. $timetj = $this->input->get('timetj',true);
  4982. $shop = $this->input->get('shop',true);
  4983. $source = $this->input->get('source',true);
  4984. $state = $this->input->get('state',true);
  4985. $review = $this->input->get('review',true);
  4986. $express = $this->input->get('express',true);
  4987. $fs = $this->input->get('fs',true);
  4988. $orderinfo = $this->input->get('orderinfo',true);
  4989. $number = $this->input->get('number',true);
  4990. $user = $this->input->get('user',true);
  4991. $name = $this->input->get('name',true);
  4992. $waybill = $this->input->get('waybill',true);
  4993. $expressstate = $this->input->get('expressstate',true);
  4994. $wltype = $this->input->get('wltype',true);
  4995. $wlyc = $this->input->get('wlyc',true);
  4996. $xztime = $this->input->get('xztime',true);
  4997. $timetk = strtotime($timetk);
  4998. $timetj = strtotime($timetj);
  4999. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5000. if($timetk && $timetj)
  5001. {
  5002. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5003. }
  5004. if($xztime == 'librarytime')
  5005. {
  5006. $order_str = "librarytime desc";
  5007. }
  5008. else if($xztime == 'dtime')
  5009. {
  5010. $order_str = "dtime desc";
  5011. }
  5012. if($shop)
  5013. {
  5014. $where .= " and shop = '$shop'";
  5015. }
  5016. if($source)
  5017. {
  5018. if($source == 11)
  5019. {
  5020. $where .= " and source != '1'";
  5021. }
  5022. else
  5023. {
  5024. $where .= " and source = '$source'";
  5025. }
  5026. }
  5027. if($fs)
  5028. {
  5029. if($fs == '2')
  5030. {
  5031. $where .= " and exstateerror != ''";
  5032. }
  5033. else
  5034. {
  5035. $where .= " and exstateerror = ''";
  5036. }
  5037. }
  5038. if($state)
  5039. {
  5040. $where .= " and state = '$state'";
  5041. }
  5042. if($review)
  5043. {
  5044. $where .= " and review = '$review'";
  5045. }
  5046. if($expressstate != "")
  5047. {
  5048. $where .= " and expressstate = '$expressstate'";
  5049. }
  5050. if($wltype != "")
  5051. {
  5052. $where .= " and wltype = '$wltype'";
  5053. }
  5054. if($wlyc != "")
  5055. {
  5056. $where .= " and wlyc = '$wlyc'";
  5057. }
  5058. if($express)
  5059. {
  5060. $where .= " and express = '$express'";
  5061. }
  5062. if($orderinfo)
  5063. {
  5064. $where .= " and orderinfo = '$orderinfo'";
  5065. }
  5066. if($number)
  5067. {
  5068. $where .= " and number = '$number'";
  5069. }
  5070. if($user)
  5071. {
  5072. $where .= " and user = '$user'";
  5073. }
  5074. if($name)
  5075. {
  5076. $where .= " and name = '$name'";
  5077. }
  5078. if($waybill)
  5079. {
  5080. $where .= " and waybill = '$waybill'";
  5081. }
  5082. if(empty($page))
  5083. {
  5084. $start = 0;
  5085. $perpage = 1;
  5086. }
  5087. else
  5088. {
  5089. $start = ($page - 1)*$perpage;
  5090. }
  5091. //取得信息列表
  5092. $info_list = $this->fullorder->find_all($where,'shop,number,country,library,librarytime,expressstate,express,waybill,content,exstateerror,excontent',$order_str);
  5093. //格式化数据
  5094. foreach ($info_list as $key=>$value)
  5095. {
  5096. $shop = $this->shop->read($value['shop']);
  5097. $info_list[$key]['shop'] = $shop['shopname'];
  5098. $country = $this->country->read($value['country']);
  5099. $info_list[$key]['country'] = $country['name'];
  5100. //$state = $this->typeclass->read($value['state']);
  5101. //$info_list[$key]['state'] = $state['title'];
  5102. if($value['library'] == 1)
  5103. {
  5104. $info_list[$key]['library'] = "未出库";
  5105. }
  5106. else if($value['library'] == 2)
  5107. {
  5108. $info_list[$key]['library'] = "已出库";
  5109. }
  5110. else if($value['library'] == 3)
  5111. {
  5112. $info_list[$key]['library'] = "已退库";
  5113. }
  5114. if($value['librarytime'] == '0')
  5115. {
  5116. $info_list[$key]['librarytime'] = '无';
  5117. }
  5118. else
  5119. {
  5120. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  5121. }
  5122. if($value['expressstate'] == 0)
  5123. {
  5124. $info_list[$key]['expressstate'] = "无信息";
  5125. }
  5126. else if($value['expressstate'] == 2)
  5127. {
  5128. $info_list[$key]['expressstate'] = "已取件";
  5129. }
  5130. else if($value['expressstate'] == 3)
  5131. {
  5132. $info_list[$key]['expressstate'] = "在途中";
  5133. }
  5134. /**
  5135. else if($value['expressstate'] == 4)
  5136. {
  5137. $info_list[$key]['expressstate'] = "到达目的地国";
  5138. }
  5139. **/
  5140. else if($value['expressstate'] == 4 || $value['expressstate'] == 5)
  5141. {
  5142. $info_list[$key]['expressstate'] = "即将派送";
  5143. }
  5144. else if($value['expressstate'] == 6)
  5145. {
  5146. $info_list[$key]['expressstate'] = "已签收";
  5147. }
  5148. else if($value['expressstate'] == 1)
  5149. {
  5150. $info_list[$key]['expressstate'] = "派送异常";
  5151. }
  5152. $express = $this->express->read($value['express']);
  5153. $info_list[$key]['express'] = $express['servicename'];
  5154. }
  5155. }
  5156. $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5157. $titlename = "<table border=1>
  5158. <tr>
  5159. <td>店铺名称</td>
  5160. <td>编号</td>
  5161. <td>收件人国家</td>
  5162. <td>出库状态</td>
  5163. <td>发货时间</td>
  5164. <td>物流状态</td>
  5165. <td>快递公司</td>
  5166. <td>运单号</td>
  5167. <td>消息状态</td>
  5168. <td>错误提示</td>
  5169. <td>物流信息</td>
  5170. </tr>
  5171. </table>";
  5172. $filename = $title.".xls";
  5173. $tail = "\n";
  5174. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  5175. }
  5176. public function _statedcwl()
  5177. {
  5178. $user = $this->user->get_api($_SESSION['api']);
  5179. if($user)
  5180. {
  5181. $fgshop = "";$sid = "";
  5182. $user = explode('|',trim($user['shop'],'|'));
  5183. foreach ($user as $value)
  5184. {
  5185. $fgshop .= " shop = ".$value." or";
  5186. $sid .= " id = ".$value." or";
  5187. }
  5188. }
  5189. $post = $this->input->get(NULL, TRUE);
  5190. if(isset($post['timetk']))
  5191. {
  5192. $dowid = $this->input->get('a');
  5193. $wid = "";
  5194. if($dowid != "")
  5195. {
  5196. $id_arr = explode(',',rtrim($dowid,','));
  5197. $wid .= " id = 0 or";
  5198. foreach ($id_arr as $v)
  5199. {
  5200. $wid .= " id = '$v' or";
  5201. }
  5202. $wid = " and".rtrim($wid,'or');
  5203. }
  5204. $page = $this->input->get('page',true);
  5205. $perpage = $this->input->get('perpage',true);
  5206. $timetk = $this->input->get('timetk',true);
  5207. $timetj = $this->input->get('timetj',true);
  5208. $shop = $this->input->get('shop',true);
  5209. $expressstate = $this->input->get('expressstate',true);
  5210. $fs = $this->input->get('fs',true);
  5211. $state = $this->input->get('state',true);
  5212. $express = $this->input->get('express',true);
  5213. $orderinfo = $this->input->get('orderinfo',true);
  5214. $number = $this->input->get('number',true);
  5215. $waybill = $this->input->get('waybill',true);
  5216. $wlyc = $this->input->get('wlyc',true);
  5217. $wltype = $this->input->get('wltype',true);
  5218. $source = $this->input->get('source',true);
  5219. $xztime = $this->input->get('xztime',true);
  5220. $timetk = strtotime($timetk);
  5221. $timetj = strtotime($timetj);
  5222. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5223. if($timetk && $timetj)
  5224. {
  5225. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5226. }
  5227. if($xztime == 'librarytime')
  5228. {
  5229. $order_str = "librarytime desc";
  5230. }
  5231. else if($xztime == 'dtime')
  5232. {
  5233. $order_str = "dtime desc";
  5234. }else if($xztime == 'wlfstime'){
  5235. $order_str = "wlfstime desc";
  5236. }
  5237. if($shop)
  5238. {
  5239. $where .= " and shop = '$shop'";
  5240. }
  5241. if($expressstate)
  5242. {
  5243. $where .= " and expressstate = '$expressstate'";
  5244. }
  5245. if($fs)
  5246. {
  5247. if($fs == '1')
  5248. {
  5249. $where .= " and wlcontent != ''";
  5250. }
  5251. if($fs == '2')
  5252. {
  5253. $where .= " and wlerror != ''";
  5254. }
  5255. if($fs == '3')
  5256. {
  5257. $where .= " and wlcontent = '' and shouldmoney > 100";
  5258. }
  5259. else if($fs == '4')
  5260. {
  5261. $where .= " and wltype = '1'";
  5262. }
  5263. }
  5264. if($state)
  5265. {
  5266. $where .= " and state = '$state'";
  5267. }
  5268. if($express)
  5269. {
  5270. $where .= " and express = '$express'";
  5271. }
  5272. if($orderinfo)
  5273. {
  5274. $where .= " and orderinfo = '$orderinfo'";
  5275. }
  5276. if($number)
  5277. {
  5278. $where .= " and number = '$number'";
  5279. }
  5280. if($waybill)
  5281. {
  5282. $where .= " and waybill = '$waybill'";
  5283. }
  5284. if($wlyc!='')
  5285. {
  5286. $where .= " and wlyc = '$wlyc'";
  5287. }
  5288. if($wltype!='')
  5289. {
  5290. $where .= " and wltype = '$wltype'";
  5291. }
  5292. if($source)
  5293. {
  5294. if($source == 1)
  5295. {
  5296. $where .= " and source = '$source'";
  5297. }
  5298. else
  5299. {
  5300. $where .= " and source != '1'";
  5301. }
  5302. }
  5303. $info_list = $this->fullorder->find_all($where.$wid,'orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,shipremarks,wlfstime,email,phone,wlcontent,wlerror,excontent',$order_str);
  5304. //格式化数据
  5305. foreach ($info_list as $key=>$value)
  5306. {
  5307. $country = $this->country->read($value['country']);
  5308. $info_list[$key]['country'] = $country['name'];
  5309. //$state = $this->typeclass->read($value['state']);
  5310. //$info_list[$key]['state'] = $state['title'];
  5311. if($value['library'] == 1)
  5312. {
  5313. $info_list[$key]['library'] = "未出库";
  5314. }
  5315. else if($value['library'] == 2)
  5316. {
  5317. $info_list[$key]['library'] = "已出库";
  5318. }
  5319. else if($value['library'] == 3)
  5320. {
  5321. $info_list[$key]['library'] = "已退库";
  5322. }
  5323. if($value['librarytime'] == '0')
  5324. {
  5325. $info_list[$key]['librarytime'] = '无';
  5326. }
  5327. else
  5328. {
  5329. $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);
  5330. }
  5331. if($value['expressstate'] == 0)
  5332. {
  5333. $info_list[$key]['expressstate'] = "无信息";
  5334. }
  5335. else if($value['expressstate'] == 2)
  5336. {
  5337. $info_list[$key]['expressstate'] = "已取件";
  5338. }
  5339. else if($value['expressstate'] == 3)
  5340. {
  5341. $info_list[$key]['expressstate'] = "在途中";
  5342. }
  5343. /**
  5344. else if($value['expressstate'] == 4)
  5345. {
  5346. $info_list[$key]['expressstate'] = "到达目的地国";
  5347. }
  5348. **/
  5349. else if($value['expressstate'] == 4 || $value['expressstate'] == 5)
  5350. {
  5351. $info_list[$key]['expressstate'] = "即将派送";
  5352. }
  5353. else if($value['expressstate'] == 6)
  5354. {
  5355. $info_list[$key]['expressstate'] = "已签收";
  5356. }
  5357. else if($value['expressstate'] == 1)
  5358. {
  5359. $info_list[$key]['expressstate'] = "派送异常";
  5360. }
  5361. $info_list[$key]['wlfstime'] = date('Y-m-d H:i:s',$value['wlfstime']);
  5362. $express = $this->express->read($value['express']);
  5363. $info_list[$key]['express'] = $express['servicename'];
  5364. $info_list[$key]['excontent'] = str_replace('<br />','',$value['excontent']);
  5365. }
  5366. }
  5367. $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5368. $titlename = "<table border=1>
  5369. <tr>
  5370. <td>订单号</td>
  5371. <td>编号</td>
  5372. <td>收件人国家</td>
  5373. <td>出库状态</td>
  5374. <td>出库时间</td>
  5375. <td>物流状态</td>
  5376. <td>快递公司</td>
  5377. <td>运单号</td>
  5378. <td>物流备注</td>
  5379. <td>订单备注</td>
  5380. <td>仓库品名</td>
  5381. <td>发送时间</td>
  5382. <td>邮箱</td>
  5383. <td>电话</td>
  5384. <td>邮件发送</td>
  5385. <td>错误提示</td>
  5386. <td>物流信息</td>
  5387. </tr>
  5388. </table>";
  5389. $filename = $title.".xls";
  5390. $tail = "\n";
  5391. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  5392. }
  5393. public function _waybillemail()
  5394. {
  5395. $user = $this->user->get_api($_SESSION['api']);
  5396. if($user)
  5397. {
  5398. $fgshop = "";$sid = "";
  5399. $user = explode('|',trim($user['shop'],'|'));
  5400. foreach ($user as $value)
  5401. {
  5402. $fgshop .= " shop = ".$value." or";
  5403. $sid .= " id = ".$value." or";
  5404. }
  5405. }
  5406. $post = $this->input->post(NULL, TRUE);
  5407. if(isset($post['page']))
  5408. {
  5409. $page = $this->input->post('page',true);
  5410. $perpage = $this->input->post('perpage',true);
  5411. $timetk = $this->input->post('timetk',true);
  5412. $timetj = $this->input->post('timetj',true);
  5413. $shop = $this->input->post('shop',true);
  5414. $source = $this->input->post('source',true);
  5415. $expressstate = $this->input->post('expressstate',true);
  5416. $fs = $this->input->post('fs',true);
  5417. $state = $this->input->post('state',true);
  5418. $express = $this->input->post('express',true);
  5419. $orderinfo = $this->input->post('orderinfo',true);
  5420. $number = $this->input->post('number',true);
  5421. $waybill = $this->input->post('waybill',true);
  5422. $dlzemail = $this->input->post('dlzemail',true);
  5423. $xztime = $this->input->post('xztime',true);
  5424. $timetk = strtotime($timetk);
  5425. $timetj = strtotime($timetj);
  5426. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5427. if($timetk && $timetj)
  5428. {
  5429. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5430. }
  5431. $order_str = $xztime." desc";
  5432. if($source)
  5433. {
  5434. if($source == '2d')
  5435. {
  5436. $where .= " and source >= '2' and shop != 19";
  5437. }
  5438. else
  5439. {
  5440. $where .= " and source = '$source'";
  5441. }
  5442. }
  5443. if($shop)
  5444. {
  5445. $where .= " and shop = '$shop'";
  5446. }
  5447. if($expressstate)
  5448. {
  5449. $where .= " and expressstate = '$expressstate'";
  5450. }
  5451. if($state)
  5452. {
  5453. $where .= " and state = '$state'";
  5454. }
  5455. if($express)
  5456. {
  5457. $where .= " and express = '$express'";
  5458. }
  5459. if($orderinfo)
  5460. {
  5461. $where .= " and orderinfo = '$orderinfo'";
  5462. }
  5463. if($number)
  5464. {
  5465. $where .= " and number = '$number'";
  5466. }
  5467. if($waybill)
  5468. {
  5469. $where .= " and waybill = '$waybill'";
  5470. }
  5471. if($dlzemail != '')
  5472. {
  5473. $where .= " and dlzemail = '$dlzemail'";
  5474. }
  5475. if(empty($page))
  5476. {
  5477. $start = 0;
  5478. $perpage = 1;
  5479. }
  5480. else
  5481. {
  5482. $start = ($page - 1)*$perpage;
  5483. }
  5484. //取得信息列表
  5485. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,dlzemail,dlzemailtime',$order_str,$start,$perpage);
  5486. //格式化数据
  5487. foreach ($info_list as $key=>$value)
  5488. {
  5489. $shop = $this->shop->read($value['shop']);
  5490. $info_list[$key]['shop'] = $shop['shopname'];
  5491. $country = $this->country->read($value['country']);
  5492. $info_list[$key]['country'] = $country['name'];
  5493. //$state = $this->typeclass->read($value['state']);
  5494. //$info_list[$key]['state'] = $state['title'];
  5495. if($value['library'] == 1)
  5496. {
  5497. $info_list[$key]['library'] = "未出库";
  5498. }
  5499. else if($value['library'] == 2)
  5500. {
  5501. $info_list[$key]['library'] = "已出库";
  5502. }
  5503. else if($value['library'] == 3)
  5504. {
  5505. $info_list[$key]['library'] = "已退库";
  5506. }
  5507. if($value['librarytime'] == '0')
  5508. {
  5509. $info_list[$key]['librarytime'] = '无';
  5510. }
  5511. else
  5512. {
  5513. $info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);
  5514. }
  5515. $express = $this->express->read($value['express']);
  5516. $info_list[$key]['express'] = $express['servicename'];
  5517. if($value['dlzemail'] == '1')
  5518. {
  5519. $info_list[$key]['dlzemail'] = '发送成功';
  5520. }
  5521. else if ($value['dlzemail'] == '2')
  5522. {
  5523. $info_list[$key]['dlzemail'] = '发送失败';
  5524. }
  5525. else
  5526. {
  5527. $info_list[$key]['dlzemail'] = '';
  5528. }
  5529. $info_list[$key]['dlzemailtime'] = ($value['dlzemailtime']>0)?date('Y-m-d H:i:s',$value['dlzemailtime']):'';
  5530. }
  5531. $total = $this->fullorder->find_count($where);
  5532. $pagenum = ceil($total/$perpage);
  5533. $over = $total-($start+$perpage);
  5534. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  5535. echo json_encode($rows);exit;
  5536. }
  5537. $notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");
  5538. $this->data['notice'] = $notice;
  5539. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  5540. $this->data['wlshop'] = $wlshop;
  5541. $this->data['express'] = $this->express->find_all();
  5542. $this->_Template('fullorder_waybillemail',$this->data);
  5543. }
  5544. public function _khdd()
  5545. {
  5546. $dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';
  5547. if(isset($_SESSION['api']))
  5548. {
  5549. $user = $this->user->get_api($_SESSION['api']);
  5550. $usp = $user;
  5551. $fgshop = "";$sid = "";
  5552. $usersp = explode('|',trim($user['shop'],'|'));
  5553. foreach ($usersp as $value)
  5554. {
  5555. $fgshop .= " shop = ".$value." or";
  5556. $sid .= " id = ".$value." or";
  5557. }
  5558. if($user['vip'] == 1)
  5559. {
  5560. $vip = 1;
  5561. }
  5562. else
  5563. {
  5564. $vip = 0;
  5565. }
  5566. }
  5567. $post = $this->input->post(NULL, TRUE);
  5568. if(isset($_GET['excel']))
  5569. {
  5570. $page = $this->input->get('page',true);
  5571. $perpage = $this->input->get('perpage',true);
  5572. $warehouse = $this->input->get('warehouse',true);
  5573. $timetk = $this->input->get('timetk',true);
  5574. $timetj = $this->input->get('timetj',true);
  5575. $shop = $this->input->get('shop',true);
  5576. $source = $this->input->get('source',true);
  5577. $state = $this->input->get('state',true);
  5578. $review = $this->input->get('review',true);
  5579. $type = $this->input->get('type',true);
  5580. $express = $this->input->get('express',true);
  5581. $orderinfo = $this->input->get('orderinfo',true);
  5582. $user = $this->input->get('user',true);
  5583. $client = $this->input->get('name',true);
  5584. $waybill = $this->input->get('waybill',true);
  5585. $number = $this->input->get('number',true);
  5586. $email = $this->input->get('email',true);
  5587. $phone = $this->input->get('phone',true);
  5588. $dlz = $this->input->get('dlz',true);
  5589. $print = $this->input->get('print',true);
  5590. $library = $this->input->get('library',true);
  5591. $js = $this->input->get('js',true);
  5592. $exstate = $this->input->get('exstate',true);
  5593. $xztime = $this->input->get('xztime',true);
  5594. $libraryconfirm = $this->input->get('libraryconfirm',true);
  5595. $timetk = strtotime($timetk);
  5596. $timetj = strtotime($timetj);
  5597. $plorder = $this->input->get('pl',true);
  5598. $paypal = $this->input->get('paypal',true);
  5599. $zf = $this->input->get('zf',true);
  5600. $pay = $this->input->get('pay',true);
  5601. $excel = $this->input->get('excel',true);
  5602. $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";
  5603. if($warehouse)
  5604. {
  5605. $where .= " and type = '$warehouse'";
  5606. }
  5607. if($timetk && $timetj)
  5608. {
  5609. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  5610. }
  5611. if($shop)
  5612. {
  5613. $where .= " and shop = '$shop'";
  5614. }
  5615. if($source)
  5616. {
  5617. if($source == '2d')
  5618. {
  5619. $where .= " and source >= '2'";
  5620. }
  5621. else
  5622. {
  5623. $where .= " and source = '$source'";
  5624. }
  5625. }
  5626. if($state)
  5627. {
  5628. $where .= " and state = '$state'";
  5629. }
  5630. if($review)
  5631. {
  5632. $where .= " and review = '$review'";
  5633. }
  5634. if($type)
  5635. {
  5636. $where .= " and type = '$type'";
  5637. }
  5638. if($express)
  5639. {
  5640. $where .= " and express = '$express'";
  5641. }
  5642. if($orderinfo)
  5643. {
  5644. $where .= " and orderinfo = '$orderinfo'";
  5645. }
  5646. if($user)
  5647. {
  5648. $where .= " and user = '$user'";
  5649. }
  5650. if($client)
  5651. {
  5652. $where .= " and client like '%$client%'";
  5653. }
  5654. if($waybill)
  5655. {
  5656. $where .= " and waybill = '$waybill'";
  5657. }
  5658. if($number)
  5659. {
  5660. $where .= " and number = '$number'";
  5661. }
  5662. if($email)
  5663. {
  5664. $where .= " and email = '$email'";
  5665. }
  5666. if($phone)
  5667. {
  5668. $where .= " and phone like '%$phone%'";
  5669. }
  5670. if($library)
  5671. {
  5672. $where .= " and library = '$library'";
  5673. }
  5674. if($print)
  5675. {
  5676. $where .= " and print = '$print'";
  5677. }
  5678. if($dlz != '')
  5679. {
  5680. $where .= " and dlz = '$dlz'";
  5681. }
  5682. if($js)
  5683. {
  5684. $where .= " and js = '$js'";
  5685. }
  5686. if($exstate)
  5687. {
  5688. $where .= " and exstate = '$exstate'";
  5689. }
  5690. if($libraryconfirm)
  5691. {
  5692. $where .= " and libraryconfirm = '$libraryconfirm'";
  5693. }
  5694. if($paypal)
  5695. {
  5696. $where .= " and paypal = '$paypal'";
  5697. }
  5698. if($pay)
  5699. {
  5700. $where .= " and pay = '$pay'";
  5701. }
  5702. if($zf)
  5703. {
  5704. if($zf == 1)
  5705. {
  5706. $where .= " and paypal not like '%-%-%-%'";
  5707. }
  5708. else
  5709. {
  5710. $where .= " and paypal like '%-%-%-%'";
  5711. }
  5712. }
  5713. if($plorder)
  5714. {
  5715. $plorderinfo = '';$plnumber = '';$pln = 0;
  5716. $plorder = explode(',',trim($plorder,','));
  5717. foreach ($plorder as $value)
  5718. {
  5719. if(is_numeric($value))
  5720. {
  5721. $plorderinfo .= " orderinfo = ".$value." or";
  5722. }
  5723. else if($value != '')
  5724. {
  5725. $plorderinfo .= " number = '".$value."' or";
  5726. }
  5727. }
  5728. if($pln > 0)
  5729. {
  5730. $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")";
  5731. }
  5732. else
  5733. {
  5734. $where .= " and (".rtrim($plorderinfo,'or').")";
  5735. }
  5736. }
  5737. //数据排序
  5738. $order_str = "dtime desc";
  5739. if(empty($page))
  5740. {
  5741. $start = 0;
  5742. $perpage = 1;
  5743. }
  5744. else
  5745. {
  5746. $start = ($page - 1)*$perpage;
  5747. }
  5748. if($excel == '1')
  5749. {
  5750. $shop = array();
  5751. $shopdata = $this->shop->find_all("type = '269'");
  5752. foreach ($shopdata as $v)
  5753. {
  5754. $shop[$v['id']] = array('t'=>$v['brandname'],'z'=>0,'l'=>0,'x'=>0);//店铺名称,总客户,老客户,新客户
  5755. }
  5756. $oldnumber = 0;$newnumber = 0;
  5757. $info_list = $this->db->query('select distinct shop,email from crowd_fullorder where '.$where)->result_array();
  5758. foreach ($info_list as $key=>$v)
  5759. {
  5760. $shop[$v['shop']]['z'] += 1;
  5761. $num = $this->fullorder->find_count("email = '".$v['email']."' and shop = '".$v['shop']."' and ".$xztime." < '$timetj'");
  5762. if($num > 1)
  5763. {
  5764. $shop[$v['shop']]['l'] += 1;
  5765. }
  5766. else
  5767. {
  5768. $shop[$v['shop']]['x'] += 1;
  5769. }
  5770. if(isset($v['email']) && $usp['excelpass'] == '1')
  5771. {
  5772. $emailpass = $this->setting->get_excelpass($v['email']);
  5773. $info_list[$key]['email'] = $emailpass;
  5774. }
  5775. }
  5776. $title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5777. $titlename = "<table border=1>
  5778. <tr>
  5779. <td>店铺</td>
  5780. <td>客户数</td>
  5781. <td>老客户数</td>
  5782. <td>新客户数</td>
  5783. </tr>
  5784. </table>";
  5785. $filename = $title.".xls";
  5786. $tail = "\n";
  5787. $this->excel->get_fz2($shop,$titlename,$filename,$tail);
  5788. }
  5789. else if($excel == '2' || $excel == '3')
  5790. {
  5791. $kh = array();
  5792. $info_list = $this->db->query('select distinct shop,email from crowd_fullorder where email != "" and '.$where)->result_array();
  5793. foreach ($info_list as $key=>$v)
  5794. {
  5795. $k = $this->fullorder->find_all("shop = '".$v['shop']."' and email = '".$v['email']."' and ".$xztime." < '$timetj'",'name,email,dtime,shouldmoney','dtime desc');
  5796. if($excel == 2 && count($k) > 1)
  5797. {
  5798. $kh[] = array($k[0]['name'],$k[0]['email'],date("Y-m-d H:i:s",$k[0]['dtime']),count($k),array_sum(array_column($k,'shouldmoney')));
  5799. }
  5800. if($excel == 3 && count($k) < 2)
  5801. {
  5802. $kh[] = array($k[0]['name'],$k[0]['email'],date("Y-m-d H:i:s",$k[0]['dtime']),count($k),array_sum(array_column($k,'shouldmoney')));
  5803. }
  5804. if(isset($v['email']) && $usp['excelpass'] == '1')
  5805. {
  5806. $emailpass = $this->setting->get_excelpass($v['email']);
  5807. $info_list[$key]['email'] = $emailpass;
  5808. }
  5809. }
  5810. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5811. $titlename = "<table border=1>
  5812. <tr>
  5813. <td>名称</td>
  5814. <td>邮箱</td>
  5815. <td>最后购买时间</td>
  5816. <td>购买次数</td>
  5817. <td>购买总额</td>
  5818. </tr>
  5819. </table>";
  5820. $filename = $title.".xls";
  5821. $tail = "\n";
  5822. $this->excel->get_fz2($kh,$titlename,$filename,$tail);
  5823. }
  5824. else if($excel == '4' || $excel == '5')
  5825. {
  5826. $kh = array();
  5827. $info_list = $this->db->query('select distinct shop,email from crowd_fullorder where email != "" and '.$where)->result_array();
  5828. foreach ($info_list as $key=>$value)
  5829. {
  5830. $k = $this->fullorder->find_all("shop = '".$value['shop']."' and email = '".$value['email']."' and ".$xztime." < '$timetj'",'orderinfo,state,product,name,email,dtime,shouldmoney','dtime desc');
  5831. if($excel == 4 && count($k) > 1)
  5832. {
  5833. foreach ($k as $v)
  5834. {
  5835. $typeclass = $this->typeclass->read($v['state']);
  5836. $kh[] = array($v['orderinfo'],$typeclass['spare'],$v['product'],$v['name'],$v['email'],date("Y-m-d H:i:s",$v['dtime']),$v['shouldmoney']);
  5837. }
  5838. }
  5839. if($excel == 5 && count($k) < 2)
  5840. {
  5841. if(!isset($k[0]['state']))
  5842. {
  5843. $typeclass = $k[0]['state'].'-数据字典无此信息';
  5844. }
  5845. else
  5846. {
  5847. $typeclass = $this->typeclass->read($k[0]['state']);
  5848. }
  5849. $kh[] = array($k[0]['orderinfo'],$typeclass['spare'],$k[0]['product'],$k[0]['name'],$k[0]['email'],date("Y-m-d H:i:s",$k[0]['dtime']),$k[0]['shouldmoney']);
  5850. }
  5851. if(isset($value['email']) && $usp['excelpass'] == '1')
  5852. {
  5853. $emailpass = $this->setting->get_excelpass($value['email']);
  5854. $info_list[$key]['email'] = $emailpass;
  5855. }
  5856. }
  5857. $title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);
  5858. $titlename = "<table border=1>
  5859. <tr>
  5860. <td>订单号</td>
  5861. <td>订单状态</td>
  5862. <td>产品名</td>
  5863. <td>客户名</td>
  5864. <td>客户邮箱</td>
  5865. <td>下单时间</td>
  5866. <td>订单金额</td>
  5867. </tr>
  5868. </table>";
  5869. $filename = $title.".xls";
  5870. $tail = "\n";
  5871. $this->excel->get_fz2($kh,$titlename,$filename,$tail);
  5872. }
  5873. }
  5874. }
  5875. public function _klarnadata()
  5876. {
  5877. $post = $this->input->post(NULL, TRUE);
  5878. if(isset($post['number']))
  5879. {
  5880. $number = $this->input->post('number',true);
  5881. $data = $this->fullorder->get_number($number);
  5882. $shop = $this->shop->read($data['shop']);
  5883. $f = '';
  5884. if($data['pay'] == '23')
  5885. {
  5886. $url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$data['paypal'];
  5887. $header[] = "Content-Type:application/json";
  5888. $header[] = "Authorization: Basic ".base64_encode($shop['klarnaname'].":".$shop['klarnapass']);
  5889. $ch = curl_init();
  5890. curl_setopt($ch, CURLOPT_URL, $url);
  5891. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5892. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5893. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5894. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5895. $res = curl_exec($ch);
  5896. curl_close($ch);
  5897. $res = json_decode($res,true);
  5898. if(isset($res['fraud_status']) && $shop['klarnaname'] != '')
  5899. {
  5900. $f = (($res['fraud_status'] == 'ACCEPTED')?1:2).'|<strong>'.$res['purchase_currency'].($res['order_amount']/100).'</strong> , '.(($res['fraud_status'] != 'ACCEPTED')?'<font style="color:#f00">'.$res['fraud_status'].'</font>':$res['fraud_status']).' , description:'.$res['initial_payment_method']['description'].' , number of installments:'.$res['initial_payment_method']['number_of_installments'].'|'.$res['billing_address']['street_address'].(($res['billing_address']['street_address2']!='')?' '.$res['billing_address']['street_address2']:'').','.$res['billing_address']['city'].','.$res['billing_address']['region'].','.$res['billing_address']['postal_code'].','.$res['billing_address']['country'].','.$res['billing_address']['given_name'].' '.$res['billing_address']['family_name'].','.$res['billing_address']['phone'].','.$res['billing_address']['email'].'|'.$res['shipping_address']['street_address'].(($res['shipping_address']['street_address2']!='')?' '.$res['shipping_address']['street_address2']:'').','.$res['shipping_address']['city'].','.$res['shipping_address']['region'].','.$res['shipping_address']['postal_code'].','.$res['shipping_address']['country'].','.$res['shipping_address']['given_name'].' '.$res['shipping_address']['family_name'].','.$res['shipping_address']['phone'].','.$res['shipping_address']['email'];
  5901. }
  5902. }
  5903. else if(($data['pay'] == '22' || $data['pay'] == '7') && $shop['paypalname'] != '')
  5904. {
  5905. $f = $this->paypal->data($data['paypal'],$shop);
  5906. }
  5907. else if(($data['pay'] == '26') && $shop['afterpayname'] != '')
  5908. {
  5909. $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];
  5910. $header[] = "Accept:application/json";
  5911. $header[] = "User-Agent: Readme.io API Simulator'";
  5912. $header[] = "Authorization: Basic ".base64_encode($shop['afterpayname'].":".$shop['afterpaypass']);
  5913. $ch = curl_init();
  5914. curl_setopt($ch, CURLOPT_URL, $url);
  5915. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5916. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5917. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5918. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5919. $res = curl_exec($ch);
  5920. curl_close($ch);
  5921. $res = json_decode($res,true);
  5922. if(isset($res['results'][0]['orderDetails']['consumer']['email']))
  5923. {
  5924. $f = $res['results'][0]['orderDetails']['consumer']['email'].'|'.$res['results'][0]['orderDetails']['billing']['line1'].','.$res['results'][0]['orderDetails']['billing']['line2'].','.$res['results'][0]['orderDetails']['billing']['area1'].','.$res['results'][0]['orderDetails']['billing']['region'].','.$res['results'][0]['orderDetails']['billing']['postcode'].','.$res['results'][0]['orderDetails']['billing']['countryCode'].','.$res['results'][0]['orderDetails']['billing']['name'].','.$res['results'][0]['orderDetails']['billing']['phoneNumber'].'|'.$res['results'][0]['orderDetails']['shipping']['line1'].','.$res['results'][0]['orderDetails']['shipping']['line2'].','.$res['results'][0]['orderDetails']['shipping']['area1'].','.$res['results'][0]['orderDetails']['shipping']['region'].','.$res['results'][0]['orderDetails']['shipping']['postcode'].','.$res['results'][0]['orderDetails']['shipping']['countryCode'].','.$res['results'][0]['orderDetails']['shipping']['name'].','.$res['results'][0]['orderDetails']['shipping']['phoneNumber'];
  5925. $f = str_replace(',,',',',$f);
  5926. }
  5927. }
  5928. else if(($data['pay'] == '27') && $shop['clearpayname'] != '')
  5929. {
  5930. $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];
  5931. $header[] = "Accept:application/json";
  5932. $header[] = "User-Agent: Readme.io API Simulator'";
  5933. $header[] = "Authorization: Basic ".base64_encode($shop['clearpayname'].":".$shop['clearpaypass']);
  5934. $ch = curl_init();
  5935. curl_setopt($ch, CURLOPT_URL, $url);
  5936. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5937. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5938. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5939. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5940. $res = curl_exec($ch);
  5941. curl_close($ch);
  5942. $res = json_decode($res,true);
  5943. if(isset($res['results'][0]['orderDetails']['consumer']['email']))
  5944. {
  5945. $f = $res['results'][0]['orderDetails']['consumer']['email'].'|'.$res['results'][0]['orderDetails']['billing']['line1'].','.$res['results'][0]['orderDetails']['billing']['line2'].','.$res['results'][0]['orderDetails']['billing']['area1'].','.$res['results'][0]['orderDetails']['billing']['region'].','.$res['results'][0]['orderDetails']['billing']['postcode'].','.$res['results'][0]['orderDetails']['billing']['countryCode'].','.$res['results'][0]['orderDetails']['billing']['name'].','.$res['results'][0]['orderDetails']['billing']['phoneNumber'].'|'.$res['results'][0]['orderDetails']['shipping']['line1'].','.$res['results'][0]['orderDetails']['shipping']['line2'].','.$res['results'][0]['orderDetails']['shipping']['area1'].','.$res['results'][0]['orderDetails']['shipping']['region'].','.$res['results'][0]['orderDetails']['shipping']['postcode'].','.$res['results'][0]['orderDetails']['shipping']['countryCode'].','.$res['results'][0]['orderDetails']['shipping']['name'].','.$res['results'][0]['orderDetails']['shipping']['phoneNumber'];
  5946. $f = str_replace(',,',',',$f);
  5947. }
  5948. }
  5949. else if($data['pay'] == '1211')
  5950. {
  5951. $url = 'https://api.stripe.com/v1/payment_intents/'.$data['paypal'];
  5952. $header[] = "Authorization:Bearer ".$shop['stripe'];
  5953. $ch = curl_init();
  5954. curl_setopt($ch, CURLOPT_URL, $url);
  5955. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5956. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  5957. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5958. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  5959. $res = curl_exec($ch);
  5960. curl_close($ch);
  5961. $res = json_decode($res,true);
  5962. $f = '';
  5963. if(isset($res['shipping']['name']))
  5964. {
  5965. $line = ($res['shipping']['address']['line2'] != '')?$res['shipping']['address']['line1'].' '.$res['shipping']['address']['line2']:$res['shipping']['address']['line1'];
  5966. $f = 'stripe|'.json_encode(array('name'=>$res['shipping']['name'],'email'=>$res['receipt_email'],'address'=>$line.','.$res['shipping']['address']['city'].','.$res['shipping']['address']['state'].','.$res['shipping']['address']['postal_code'].','.$res['shipping']['address']['country'].','.$res['shipping']['phone'],'shouldmoney'=>$res['amount']/100));
  5967. }
  5968. }
  5969. else
  5970. {
  5971. echo json_encode(array('msg'=>'此店铺没有对接信息','success'=>false));exit;
  5972. }
  5973. if($f != '')
  5974. {
  5975. if($this->fullorder->save(array('klarnadata'=>$f),$data['id']))
  5976. {
  5977. echo json_encode(array('msg'=>'获取成功,请关闭此页重新打开','success'=>true));exit;
  5978. }
  5979. else
  5980. {
  5981. echo json_encode(array('msg'=>'写入失败,请重试','success'=>false));exit;
  5982. }
  5983. }
  5984. else
  5985. {
  5986. echo json_encode(array('msg'=>'获取失败,请稍后重试','cl'=>base64_encode($shop['afterpayname'].":".$shop['afterpaypass']),'a'=>$data['paypal'],'success'=>false));exit;
  5987. }
  5988. }
  5989. }
  5990. public function _kcyz($warehouse,$whlabel,$id,$shop,$number)
  5991. {
  5992. if(!$whlabel || $whlabel == '|')
  5993. {
  5994. return array('t'=>1,'m'=>json_encode(array('t'=>1,'msg'=>'请先添加产品信息!','success'=>false)));exit;
  5995. }
  5996. $w = $this->warehouse->read($warehouse);
  5997. if($w['zd'] != 1)
  5998. {
  5999. return 1;
  6000. }
  6001. $pp = explode('|',trim($whlabel,'|'));
  6002. $x = 0;$save = array();
  6003. foreach ($pp as $va)
  6004. {
  6005. $num = explode('-',$va);
  6006. if($number)
  6007. {
  6008. $whlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and (zd = '$number' or zd = '') and (shop IS NULL or shop = '')");//通用
  6009. $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and (zd = '$number' or zd = '') and shop like '%,".$shop.",%'");//专属
  6010. }
  6011. else
  6012. {
  6013. $whlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and (shop IS NULL or shop = '')");//通用
  6014. $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and shop like '%,".$shop.",%'");//专属
  6015. }
  6016. $x++;
  6017. if(count($whlabel)+count($shopwhlabel) < $num[1])
  6018. {
  6019. $save[] = $x-1;continue;//提前先加X不然出错,所以要减1
  6020. }
  6021. }
  6022. return $save;
  6023. }
  6024. public function _epod()
  6025. {
  6026. $post = $this->input->post(NULL, TRUE);
  6027. if(isset($post['number']))
  6028. {
  6029. $number = $this->input->post('number',true);
  6030. $data = $this->fullorder->get_number($number);
  6031. if(is_file('./data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf'))
  6032. {
  6033. echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].'/data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf','success'=>true));exit;
  6034. }
  6035. else
  6036. {
  6037. $epod = $this->dhl->get_epod($data);
  6038. if($epod['c'] == 1)
  6039. {
  6040. echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].$epod['d'],'success'=>true));exit;
  6041. }
  6042. else
  6043. {
  6044. echo json_encode(array('msg'=>$epod['d'],'success'=>false));exit;
  6045. }
  6046. }
  6047. }
  6048. }
  6049. public function _zw($arg_array)
  6050. {
  6051. $arg_array = $arg_array[0];$fpdata = array();
  6052. $fullorder = $this->fullorder->read($arg_array);
  6053. $fullorder['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$fullorder['shipremarks']);
  6054. $fullorder['parameter'] = str_replace(",","---",$fullorder['parameter']);
  6055. $this->data['fullorder'] = $fullorder;
  6056. $this->data['countrys'] = $this->country->find_all();
  6057. $this->data['express'] = $this->express->find_all();
  6058. $warehouse = $this->warehouse->read($fullorder['type']);
  6059. if(stripos($fullorder['fpdata'],';') !== false)
  6060. {
  6061. $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
  6062. foreach ($fpdata as $k=>$v)
  6063. {
  6064. $xxv = explode('|',$v);
  6065. if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)
  6066. {
  6067. $xxv['zd'] = "<p>已占单</p>";
  6068. $bdck = $warehouse['bdck'];
  6069. if(stripos($xxv[9],'~') !== false)
  6070. {
  6071. $dxxv = explode('~',trim($xxv[9],'~'));
  6072. foreach ($dxxv as $val)
  6073. {
  6074. $wzid = $this->$bdck->read(trim($val,$warehouse['hz']));
  6075. if($wzid['details'] != '')
  6076. {
  6077. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  6078. }
  6079. }
  6080. }
  6081. else
  6082. {
  6083. $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));
  6084. if($wzid['details'] != '')
  6085. {
  6086. $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';
  6087. }
  6088. }
  6089. }
  6090. $fpdata[$k] = $xxv;
  6091. }
  6092. }
  6093. $this->data['fpdata'] = $fpdata;
  6094. $this->data['fpdata'] = $fpdata;
  6095. $thfpdataxs = array();
  6096. if($fullorder['thfpdata'] != '')
  6097. {
  6098. $thfpdata = explode(';',trim($fullorder['thfpdata'],';'));
  6099. foreach ($thfpdata as $k=>$v)
  6100. {
  6101. $thxs = explode('~',trim($v,'~'));
  6102. $thxs[0] = explode('|',trim($thxs[0],'|'));
  6103. $thxs[1] = explode('|',trim($thxs[1],'|'));
  6104. $thfpdataxs[] = array("<p>".$thxs[0][1]."<i class='fa fa-level-down'></i></p><p>".$thxs[1][1]."</p>","<p>".$thxs[0][2]."</p><p>".$thxs[1][2]."</p>","<p>旧</p><p>新</p>",$thxs[1][0]);
  6105. }
  6106. }
  6107. $this->data['thfpdata'] = $thfpdataxs;
  6108. $shop = $this->shop->read($fullorder['shop']);
  6109. $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例
  6110. $is = 0;
  6111. if($shop['type'] == 269 || $shop['type'] == 2678)//判断是否独立站,269是独立站
  6112. {
  6113. $is = 1;
  6114. }
  6115. $this->data['is'] = $is;
  6116. //单项开始
  6117. $warehouse = $this->warehouse->read($fullorder['warehouse']);//发货仓库
  6118. $state = $this->typeclass->read($fullorder['state']);//订单状态
  6119. $country = $this->country->read($fullorder['country']);//国家
  6120. if($fullorder['capital'] == 1)
  6121. {
  6122. $capital = '暂未支付';
  6123. }
  6124. else if($fullorder['capital'] == 2)
  6125. {
  6126. $capital = '部分支付';
  6127. }
  6128. else if($fullorder['capital'] == 3)
  6129. {
  6130. $capital = '全部支付';
  6131. }
  6132. if($fullorder['printtype'] == 1)
  6133. {
  6134. $printtype = '运单';
  6135. }
  6136. else if($fullorder['printtype'] == 2)
  6137. {
  6138. $printtype = '发货单';
  6139. }
  6140. else if($fullorder['printtype'] == 3)
  6141. {
  6142. $printtype = '不打印单据';
  6143. }
  6144. else
  6145. {
  6146. $printtype = '未选择';
  6147. }
  6148. $this->data['warehouse'] = $warehouse['title'];
  6149. $this->data['state'] = $state['title'];
  6150. $this->data['capital'] = $capital;
  6151. $this->data['country'] = $country['name'];
  6152. $this->data['printtype'] = $printtype;
  6153. //单项结束
  6154. /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/
  6155. $downwaybill = '';$dwls = array();
  6156. $oldwaybill = explode('-',ltrim($fullorder['oldwaybill'],'-'));
  6157. if(isset($oldwaybill[0][1]))
  6158. {
  6159. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  6160. foreach ($oldwaybill as $v)
  6161. {
  6162. $dw = explode('/',$v);
  6163. if(isset($dw[1]))
  6164. {
  6165. if(stripos($downwaybill,$dw[1]) === false)
  6166. {
  6167. $dwls[$dw[1]] = 1;
  6168. $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';
  6169. }
  6170. }
  6171. }
  6172. }
  6173. if($fullorder['printtype'] == 1)
  6174. {
  6175. if($fullorder['waybill'] != '' && !isset($dwls[$fullorder['waybill']]))
  6176. {
  6177. $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorder['printtime']).'/y-'.$fullorder['waybill'].'.pdf" target="_blank">'.$fullorder['waybill'].'</a>、'.$downwaybill;
  6178. }
  6179. }
  6180. $this->data['downwaybill'] = rtrim($downwaybill,'、');
  6181. /** 历史打印时间 **/
  6182. $printtime = '';
  6183. if($fullorder['oldprinttime'])
  6184. {
  6185. $pte = explode('-',rtrim($fullorder['oldprinttime'],'-'));
  6186. foreach ($pte as $v)
  6187. {
  6188. $printtime .= date('Y-m-d H:i:s',$v).'、';
  6189. }
  6190. }
  6191. $this->data['printtime'] = rtrim($printtime,'、');
  6192. $product = '';
  6193. $fullorder['product'] = str_replace("'","",$fullorder['product']);
  6194. if($fullorder['link'] != '' && $fullorder['source'] != '1')
  6195. {
  6196. $pt = explode(',',$fullorder['product']);
  6197. $lk = explode(',',$fullorder['link']);
  6198. for($i=0;$i<count($pt);$i++)
  6199. {
  6200. if(isset($lk[$i]))
  6201. {
  6202. $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);
  6203. }
  6204. else
  6205. {
  6206. $octs = '';
  6207. }
  6208. $a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];
  6209. //$a = (stripos($pt[$i],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($pt[$i],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($pt[$i],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($pt[$i],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($pt[$i],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($pt[$i],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($pt[$i],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($pt[$i],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($pt[$i],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$pt[$i].'</font>':$pt[$i];
  6210. if(isset($lk[$i]))
  6211. {
  6212. $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';
  6213. }
  6214. else
  6215. {
  6216. $product .= ($product != '')?' , '.$a:$a;
  6217. }
  6218. }
  6219. }
  6220. else
  6221. {
  6222. $octs = $this->colourorderts->get_text($fullorder['product']);
  6223. $a = $octs?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
  6224. //$a = (stripos($fullorder['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorder['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorder['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorder['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorder['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorder['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorder['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorder['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorder['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorder['product'].'</font>':$fullorder['product'];
  6225. $product = $a;
  6226. }
  6227. $this->data['product'] = $product;
  6228. $out = $this->systemtransfer->find_all("number = '".$fullorder['number']."'");
  6229. $outread = '';
  6230. if($out)
  6231. {
  6232. foreach ($out as $val)
  6233. {
  6234. $list = '';
  6235. $rk = explode('|',trim($val['rk'],'|'));
  6236. $rktime = explode('|',trim($val['rktime'],'|'));
  6237. $zw = array();
  6238. $t = $this->transfer->find_all("1=1");
  6239. foreach ($t as $v)
  6240. {
  6241. $zw[$v['id']] = $v['title'];
  6242. }
  6243. if($val['rk'] != '' && count($rk) > 0)
  6244. {
  6245. for($i=0;$i<count($rk);$i++)
  6246. {
  6247. if(!isset($rktime[$i]))
  6248. {
  6249. $list .= $zw[$cz[$i]];
  6250. }
  6251. else
  6252. {
  6253. $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';
  6254. }
  6255. }
  6256. }
  6257. $outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';
  6258. }
  6259. }
  6260. else
  6261. {
  6262. $systemwigsout = $this->systemwigsout->find_all("number = '".$fullorder['number']."'");
  6263. $outread = array();
  6264. if($systemwigsout)
  6265. {
  6266. foreach ($systemwigsout as $v)
  6267. {
  6268. if($v['czwarehouse'] == 37)
  6269. {
  6270. $outread[] = '华荣厂';
  6271. }
  6272. else if($v['czwarehouse'] == 0)
  6273. {
  6274. $outread[] = '龙盈厂';
  6275. }
  6276. $cz = explode('|',trim($v['cz'],'|'));
  6277. $cztime = explode('|',trim($v['cztime'],'|'));
  6278. $zw = $this->transfer->get_list();
  6279. if($v['cz'] != '' && count($cz) > 0)
  6280. {
  6281. for($i=0;$i<count($cz);$i++)
  6282. {
  6283. if(!isset($cztime[$i]))
  6284. {
  6285. $outread[] = $zw[$cz[$i]].' -&gt; ';
  6286. }
  6287. else
  6288. {
  6289. $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -&gt; ';
  6290. }
  6291. }
  6292. $outread[] = '<br>';
  6293. }
  6294. }
  6295. }
  6296. }
  6297. $klarnacolor = '';
  6298. if($fullorder['klarnadata'] !='')
  6299. {
  6300. $klarnadata = explode('|',$fullorder['klarnadata']);
  6301. if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')
  6302. {
  6303. $klarnadata[1] = json_decode($klarnadata[1],true);
  6304. if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorder['shouldmoney'] && $fullorder['pay'] == 1211)
  6305. {
  6306. $klarnacolor = 'style="color:#F00"';
  6307. }
  6308. }
  6309. else if($klarnadata[0]!=1 && $fullorder['pay']!=26 && $fullorder['pay']!=27 && $fullorder['pay']!=1211)
  6310. {
  6311. $klarnacolor = 'style="color:#F00"';
  6312. }
  6313. if($fullorder['pay'] == 23)//klarna
  6314. {
  6315. $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
  6316. $ToState = array_flip($ToState);
  6317. $klarnadata3 = str_replace(' ','',$klarnadata[3]);
  6318. $city = str_replace(' ','',$fullorder['city']);
  6319. $klarnadataaddress = explode($city,$klarnadata3);
  6320. if(isset($klarnadataaddress[1]))
  6321. {
  6322. $klarnadata3 = $city.$klarnadataaddress[1];
  6323. $klarnadatacolor = explode(',',$klarnadata3);
  6324. unset($klarnadatacolor[4]);
  6325. unset($klarnadatacolor[6]);
  6326. if(isset($ToState[$klarnadatacolor[1]]))
  6327. {
  6328. $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);
  6329. }
  6330. $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);
  6331. }
  6332. else
  6333. {
  6334. $klarnadata['color'] = $klarnadata3;
  6335. }
  6336. }
  6337. }
  6338. else
  6339. {
  6340. $klarnadata = '';
  6341. }
  6342. $p = explode('-',$fullorder['paypal']);
  6343. $this->data['klarnacolor'] = $klarnacolor;
  6344. $this->data['klarnadata'] = $klarnadata;
  6345. $this->data['systemwigsout'] = $outread;
  6346. $this->_Template('fullorder_zw',$this->data);
  6347. }
  6348. public function _dcdxyz()
  6349. {
  6350. $post = $this->input->get(NULL, TRUE);
  6351. if(isset($post['timetk']))
  6352. {
  6353. $timetk = $this->input->get('timetk',true);
  6354. $timetj = $this->input->get('timetj',true);
  6355. $timetk = strtotime($timetk);
  6356. $timetj = strtotime($timetj);
  6357. $where = "oldwaybill != ''";
  6358. if($timetk && $timetj)
  6359. {
  6360. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  6361. }
  6362. //数据排序
  6363. $order_str = "dtime desc";
  6364. //取得信息列表
  6365. $info_list = $this->fullorder->find_all($where,'orderinfo,number,oldwaybill',$order_str);
  6366. $data = array();
  6367. foreach ($info_list as $key=>$value)
  6368. {
  6369. $ob = '';
  6370. $oldwaybill = explode('-',trim($value['oldwaybill'],'-'));
  6371. if(count($oldwaybill) < 2)
  6372. {
  6373. continue;
  6374. }
  6375. $oldwaybill = array_reverse($oldwaybill); //调整顺序
  6376. foreach ($oldwaybill as $v)
  6377. {
  6378. $dw = explode('/',$v);
  6379. if(isset($dw[1]))
  6380. {
  6381. $dwls[$dw[1]] = 1;
  6382. $ob .= $dw[1].'、';
  6383. }
  6384. }
  6385. $info_list[$key]['oldwaybill'] = trim($ob,'、');
  6386. $data[] = $info_list[$key];
  6387. }
  6388. $title = "多运单信息 ".date("Y-m-d");
  6389. $titlename = "<table border=1>
  6390. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  6391. <tr>
  6392. <td>订单号</td>
  6393. <td>编号</td>
  6394. <td>运单号</td>
  6395. </tr>
  6396. </table>";
  6397. $filename = $title.".xls";
  6398. $tail = "\n";
  6399. $this->excel->get_fz2($data,$titlename,$filename,$tail);
  6400. }
  6401. }
  6402. public function _thxz()
  6403. {
  6404. $post = $this->input->get(NULL, TRUE);
  6405. if(isset($post['timetk']))
  6406. {
  6407. $timetk = $this->input->get('timetk',true);
  6408. $timetj = $this->input->get('timetj',true);
  6409. $timetk = strtotime($timetk);
  6410. $timetj = strtotime($timetj);
  6411. $where = "returndata != ''";
  6412. if($timetk && $timetj)
  6413. {
  6414. $where .= " and dtime > '$timetk' and dtime < '$timetj'";
  6415. }
  6416. //数据排序
  6417. $order_str = "dtime desc";
  6418. //取得信息列表
  6419. $info_list = $this->fullorder->find_all($where,'orderinfo,number,returndata',$order_str);
  6420. foreach ($info_list as $key=>$value)
  6421. {
  6422. $ydh = explode('">',$value['returndata']);
  6423. $ydh = explode('</a>',$ydh[1]);
  6424. $info_list[$key]['returndata'] = $ydh[0];
  6425. $time = explode('pdf/',$value['returndata']);
  6426. $time = explode('/',$time[1]);
  6427. $info_list[$key]['time'] = $time[0];
  6428. }
  6429. $title = "退货订单信息 ".date("Y-m-d");
  6430. $titlename = "<table border=1>
  6431. <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>
  6432. <tr>
  6433. <td>订单号</td>
  6434. <td>编号</td>
  6435. <td>退货运单号</td>
  6436. <td>退货时间</td>
  6437. </tr>
  6438. </table>";
  6439. $filename = $title.".xls";
  6440. $tail = "\n";
  6441. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  6442. }
  6443. }
  6444. public function _ddcf()
  6445. {
  6446. $post = $this->input->post(NULL, TRUE);
  6447. if(isset($post['number']))
  6448. {
  6449. $number = $this->input->post('number',true);
  6450. $data = $this->fullorder->get_number($number);
  6451. if(!$data)
  6452. {
  6453. echo json_encode(array('msg'=>'没有找到此订单','success'=>false));exit;
  6454. }
  6455. if($data['review'] != 1 && $data['review'] != 2)
  6456. {
  6457. echo json_encode(array('msg'=>'必须是 待审核 状态才能拆分','success'=>false));exit;
  6458. }
  6459. if($data['merge'] != 0)
  6460. {
  6461. echo json_encode(array('msg'=>'已合并的订单无法使用此拆分功能','success'=>false));exit;
  6462. }
  6463. $cfnum = explode('-',trim($number,'-'));
  6464. // if((count($cfnum) > 3 && stripos($number,'-PF-') === false))
  6465. // {
  6466. // echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit;
  6467. // }
  6468. if(count($cfnum) > 4 && stripos($number,'-PF-') !== false)
  6469. {
  6470. echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit;
  6471. }
  6472. $num = $this->fullorder->find_count("number like '".$number."%'");
  6473. $data['number'] = $data['number'].'-'.$num;
  6474. $data['orderinfo'] = $data['shop'].date('ymdHis',time()).rand(0,1);;
  6475. $data['shouldmoney'] = 0;
  6476. $data['budget'] = 0;
  6477. $data['shipremarks'] = '';
  6478. $data['source'] = 1;
  6479. //$data['review'] = 2;
  6480. $data['extra_status'] = 1;//拆分的订单
  6481. unset($data['id']);
  6482. unset($data['jweight']);
  6483. unset($data['fpcount']);
  6484. unset($data['returndata']);
  6485. unset($data['waybill']);
  6486. unset($data['oldwaybill']);
  6487. unset($data['printtime']);
  6488. if($this->fullorder->insert($data))
  6489. {
  6490. echo json_encode(array('msg'=>'拆分成功!新订单编号:'.$data['number'],'success'=>true));exit;
  6491. }
  6492. else
  6493. {
  6494. echo json_encode(array('msg'=>'拆分失败,请重试','success'=>false));exit;
  6495. }
  6496. }
  6497. }
  6498. public function _cf() //合并订单拆分
  6499. {
  6500. $post = $this->input->post(NULL, TRUE);
  6501. if(isset($post['id']))
  6502. {
  6503. $id = $this->input->post('id',true);
  6504. $b = $this->fullorder->read($id);
  6505. $order = array();
  6506. if($b['merge'] == $b['id'])
  6507. {
  6508. $data = $this->fullorder->find_all("merge = '".$b['merge']."'");
  6509. foreach ($data as $v)
  6510. {
  6511. $a = $this->fullorderhb->get_orderinfo($v['orderinfo']);
  6512. if($a)
  6513. {
  6514. $this->fullorder->save($a,$v['id']);
  6515. }
  6516. $order[] = $v['id'];
  6517. }
  6518. echo json_encode(array('msg'=>'拆分成功!','d'=>$order,'success'=>true));exit;
  6519. }
  6520. else
  6521. {
  6522. echo json_encode(array('msg'=>'拆分条件错误!','success'=>false));exit;
  6523. }
  6524. }
  6525. }
  6526. }