| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425 | <?php defined('BASEPATH') OR exit('No direct script access allowed');class Fullorderamz extends Start_Controller {	public function __construct(){		parent::__construct();		$this->load->library('session');		$this->load->_model('Model_fullorderamz','fullorderamz');		$this->load->_model('Model_fullorderexcel','fullorderexcel');		$this->load->_model('Model_shop','shop');		$this->load->_model('Model_typeclass','typeclass');		$this->load->_model('Model_express','express');		$this->load->_model('Model_country','country');		$this->load->_model('Model_productdescribe','productdescribe');		$this->load->_model('Model_customs','customs');		$this->load->_model('Model_detailed','detailed');		$this->load->_model('Model_productdescription','productdescription');		$this->load->_model('Model_logistics','logistics');		$this->load->_model('Model_hl','hl');		$this->load->_model('Model_excel','excel');		$this->load->_model('Model_warehouse','warehouse');		$this->load->_model('Model_customeramz','customeramz');		$this->load->_model('Model_user','user');		$this->load->_model('Model_dhl','dhl');		$this->load->_model('Model_ali','ali');		$this->load->_model('Model_notice','notice');		$this->load->_model('Model_api','api');		$this->load->_model('Model_usps','usps');		$this->load->_model('Model_whlabel','whlabel');		$this->load->_model('Model_reset','fullreset');		$this->load->_model('Model_specialstock','specialstock');		$this->load->_model('Model_systemwigsout','systemwigsout');		$this->load->_model('Model_colourorderts','colourorderts');		$this->load->_model('Model_paypal','paypal');		$this->load->_model('Model_ck','ck');		$this->load->_model('Model_weight','weight');		$this->load->_model('Model_pay','pay');		$this->load->_model('Model_setting','setting');		$this->load->_model('Model_whlabel_fc','whlabel_fc');		$this->load->_model('Model_transfer','transfer');		$this->load->_model('Model_systemtransfer','systemtransfer');		$this->load->_model('Model_power','power');		$this->load->_model('Model_fullorderamzhb','fullorderamzhb');		$this->load->_model('Model_returngoods','returngoods');		$this->load->_model("Model_fullordererrors","fullordererrors");			}	//定义方法的调用规则 获取URI第二段值    public function _remap($arg,$arg_array)    {		if($arg == 'add')//添加        {             $this->_add();        }		else if($arg == 'edit')//修改        {             $this->_edit($arg_array);        }		else if($arg == 'readonly')//修改        {             $this->_readonly($arg_array);        }		else if($arg == 'readlist')        {             $this->_readlist();        }		else if($arg == 'readlistdown')        {             $this->_readlistdown();        }		else if($arg == 'del')//修改        {             $this->_del();        }		else if($arg == 'price')//价格明细        {             $this->_price();        }		else if($arg == 'customs')        {             $this->_customs();        }		else if($arg == 'express')        {             $this->_express();        }		else if($arg == 'hl')        {             $this->_hl();        }		else if($arg == 'repeat')        {             $this->_repeat();        }		else if($arg == 'operation')        {             $this->_operation();        }		else if($arg == 'merge')        {             $this->_merge();        }		else if($arg == 'fmexcel')        {             $this->_fmexcel();        }		else if($arg == 'fdexcel')        {             $this->_fdexcel();        }		else if($arg == 'fdfexcel')        {             $this->_fdfexcel();        }		else if($arg == 'evaluate')        {             $this->_evaluate();        }		else if($arg == 'state')        {             $this->_state();        }		else if($arg == 'wl')        {             $this->_wl();        }		else if($arg == 'wlbz')        {             $this->_wlbz($arg_array);        }		else if($arg == 'review')        {             $this->_review();        }		else if($arg == 'black')        {             $this->_black();        }		else if($arg == 'ryf')        {             $this->_ryf();        }		else if($arg == 'expresstype')        {             $this->_expresstype();        }		else if($arg == 'fsstate')        {             $this->_fsstate();        }		else if($arg == 'power')        {             $this->_power();        }		else if($arg == 'error')        {             $this->_error();        }		else if($arg == 'yc')        {             $this->_yc();        }		else if($arg == 'yzaddress')        {             $this->_yzaddress();        }		else if($arg == 'return')        {             $this->_return();        }		else if($arg == 'clearreturn')        {             $this->_clearreturn();        }		else if($arg == 'ali')        {             $this->_ali();        }		else if($arg == 'dqpm')        {             $this->_dqpm();        }		else if($arg == 'ddpmdata')        {             $this->_ddpmdata($arg_array);        }		else if($arg == 'dqpmprovince')        {             $this->_dqpmprovince($arg_array);        }		else if($arg == 'ddpmexcel')        {             $this->_ddpmexcel($arg_array);        }		else if($arg == 'statedc')        {             $this->_statedc();        }		else if($arg == 'statedcwl')        {             $this->_statedcwl();        }		else if($arg == 'waybillemail')        {             $this->_waybillemail();        }		else if($arg == 'khdd')        {             $this->_khdd();        }		else if($arg == 'klarnadata')        {             $this->_klarnadata();        }		else if($arg == 'epod')        {             $this->_epod();        }		else if($arg == 'zw')        {             $this->_zw($arg_array);        }		else if($arg == 'thxz')        {             $this->_thxz($arg_array);        }		else if($arg == 'dcdxyz')        {             $this->_dcdxyz();        }		else if($arg == 'ddcf')        {             $this->_ddcf();        }		else if($arg == 'cf')        {             $this->_cf();        }		else if($arg == 'pljzzd')        {             $this->_pljzzd();        }		else		{			 $this->_index();		}    }	//管理	public function _index()	{		$dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}			if($user['vip'] == 1)			{				$vip = 1;			}			else			{				$vip = 0;			}		}		else		{			$vip = 0;			header('Location: /');exit;		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$warehouse = $this->input->post('warehouse',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$source = $this->input->post('source',true);			$state = $this->input->post('state',true);			$review = $this->input->post('review',true);			$type = $this->input->post('type',true);			$express = $this->input->post('express',true);			$orderinfo = $this->input->post('orderinfo',true);			$user = $this->input->post('user',true);			$client = $this->input->post('name');			$waybill = $this->input->post('waybill',true);			$number = $this->input->post('number',true);			$email = $this->input->post('email',true);			$phone = $this->input->post('phone',true);			$dlz = $this->input->post('dlz',true);			$print = $this->input->post('print',true);			$library = $this->input->post('library',true);			$js = $this->input->post('js',true);			$exstate = $this->input->post('exstate',true);			$xztime = $this->input->post('xztime',true);			$libraryconfirm = $this->input->post('libraryconfirm',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$plorder = $this->input->post('pl',true);			$paypal = $this->input->post('paypal',true);			$pay = $this->input->post('pay',true);			$klarna = $this->input->post('klarna',true);			$zf = $this->input->post('zf',true);			$where = "1=1 and (".rtrim($fgshop,'or').")";			if($warehouse)            {                $where  .= " and type = '$warehouse'";            }			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($source)            {				if($source == '2d')				{					$where  .= " and source >= '2'";				}				else				{                    $where  .= " and source = '$source'";				}            }			if($state)            {				$where  .= " and state = '$state'";            }			if($review)            {                $where  .= " and review = '$review'";            }			if($type)            {                $where  .= " and type = '$type'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo' and orderinfo != '0'";            }			if($user)            {                $where  .= " and user = '$user'";            }			if($client)            {                $where  .= " and client like '%$client%'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($number)            {                $where  .= " and number like '$number%'";            }			if($email)            {                $where  .= " and email = '$email'";            }			if($phone)            {                $where  .= " and phone like '%$phone%'";            }			if($library)            {                $where  .= " and library = '$library'";            }			if($print)            {                $where  .= " and print = '$print'";            }			if($dlz != '')            {                $where  .= " and dlz = '$dlz'";            }			if($js)            {                $where  .= " and js = '$js'";            }			if($exstate)            {                $where  .= " and exstate = '$exstate'";            }			if($libraryconfirm)            {                $where  .= " and libraryconfirm = '$libraryconfirm'";            }			if($klarna != '')            {				if($klarna == 2)				{                    $where  .= " and klarna >= '$klarna'";				}				else				{					$where  .= " and klarna = '$klarna'";				}            }			if($paypal)            {                $where  .= " and paypal = '$paypal'";            }			if($pay)            {                $where  .= " and pay = '$pay'";            }			if($zf)            {				if($zf == 1)				{                    $where  .= " and paypal not like '%-%-%-%'";				}				else				{					$where  .= " and paypal like '%-%-%-%'";				}            }			if($plorder)            {				$plorderinfo = '';$plnumber = '';$pln = 0;				$plorder = explode(',',trim($plorder,','));				foreach ($plorder as $value) 		    	{					if(is_numeric($value))					{					    $plorderinfo .= " orderinfo = ".$value." or";					}					else if($value != '')					{						$plorderinfo .= " number = '".$value."' or";					}				}				if($pln > 0)				{                    $where  .= "  and (".rtrim($plorderinfo,'or').")  and (".rtrim($plnumber,'or').")";				}				else				{					 $where  .= "  and (".rtrim($plorderinfo,'or').")";				}            }            //数据排序            $order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black                 $info_list = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,sname,phone,state,dtime,review,libraryconfirm,express,waybill,orderremarks,library,black,clientremarks',$order_str,$start,$perpage);		 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$ud = $this->fullorderamz->read($value['id']);				$ud['address'] = str_replace("'","’",$ud['address']);				$ud['name'] = str_replace("'","’",$ud['name']);				$customer = $this->customeramz->get_email($ud['email'],$value['shop']);				$customernum = $this->fullorderamz->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."' and  extra_status = 0");				preg_match_all('/[0-9]/u',$ud['phone'],$result);				$numphone = join('',$result[0]);				$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']));			    $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']));			    $hmdaddress3 = str_replace(array(' avenue',' ave',' av'),array(' ave',' avenue',' ave'),strtolower($ud['address']));				if($numphone == '0')				{					$customerb = $this->customeramz->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');				}				else				{				    $customerb = $this->customeramz->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');				}				$customerc = $this->customeramz->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');				$customerd = $this->customeramz->find_all("type = 2 and shop = '".$ud['shop']."' and email = '".$ud['email']."'",'*','id desc');				//$a = array_column($customer, 'email'); //三维找其中健的数组			    //$a = array_flip($a); //键和值调换				$djcount = '';				$lkh = $value['sname'];				$djlkh = 0;$djhmd = 0;				if($customer)				{					if($customer['count'] != '' && $customernum < 2)					{						$count = '<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>';						$djcount = $count;					}					if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1					{						$count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';						$lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";						$djlkh = 1;						$djcount = $count;					}					else if(isset($customerc[0]['num']))					{						if($customerc[0]['num'] > 1)						{							$count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';							$lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户(".$customer['num'].")</p>";							$djlkh = 1;							$djcount = $count;						}					}				}				if($customerb)				{					 $hmsp = $this->shop->read($customerb[0]['shop']);					 $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';					 $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC' data-id='".$customerb[0]['id']."'>来自".$hmsp['shopname']."</p>";					 $djhmd = 1;					 if($customerd)					 {						 if($customerd[0]['num'] > 1)						 {						$count = $customerd[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerd[0]['count'].'"></i>':'';						$lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";						$djlkh = 1;						$djcount = $count;						 $djlkh = 1;						 }					 }				}				if($djlkh == '1' && $djhmd == '1')				{					$lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";				}				if($djlkh != '1' && $djhmd != '1' && $djcount)				{				    $info_list[$key]['sname'] = $lkh."<p style='color:#FF3333'>".$djcount."</p>";				}				else				{					$info_list[$key]['sname'] = $lkh;				}				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				//$info_list[$key]['user'] = $shop['shopuser'];				$warehouse = $this->warehouse->read($value['type']);				$warehousetitle = $warehouse['title'];				if($value['type'] != 13){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}				$info_list[$key]['type'] = $warehousetitle;				$info_list[$key]['phone'] = $value['phone'];				$typeclass = $this->typeclass->read($value['state']);				$info_list[$key]['state'] = "<font style='font-size: 13px;'>".$typeclass['spare']."</font>";				/**				$wl = '';				if($value['exstate'] == '99')				{					$wl = '<font style="color:#ccc">未获取到物流信息</font>';				}				else if($value['exstate'] == '1')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '2')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '3')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '4')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '5')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';				}				$info_list[$key]['exstate'] = $wl.'<br />';				**/				if($ud['source'] == 1) //线下单用订单时间,其他用付款时间				{					$info_list[$key]['dtime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$ud['dtime']).'</p><p style="font-size: 13px;">'.date('H:i:s',$ud['dtime']).'</p>';				}				else				{				    $info_list[$key]['dtime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$value['dtime']+$dt).'</p><p style="font-size: 13px;">'.date('H:i:s',$value['dtime']+$dt).'</p>';				}				if($value['review'] == 1)				{					$info_list[$key]['review'] =  "<font style='font-size: 13px;'>未送审</font>";				}				else if($value['review'] == 2)				{					$info_list[$key]['review'] = "<font style='color:#555;font-size: 13px;'>待审核</font>";				}				else if($value['review'] == 3)				{					$info_list[$key]['review'] = "<font style='color:#f90f4b;font-size: 13px;'>不通过</font>";				}				else if($value['review'] == 4)				{					$info_list[$key]['review'] =  "<font style='font-size: 13px;'>取消重审</font>";				}				else if($value['review'] == 5)				{					$info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>审核通过</font>";				}				else if($value['review'] == 6)				{					$info_list[$key]['review'] = "<font style='color:#2f80f9;font-size: 13px;'>自动通过</font>";				}				if($ud['dlz'] == 1)				{					$dlz = "<p>独立站已更新</p>";				}				else if($ud['dlz'] == 3)				{					$dlz = "<p>不需要更新</p>";				}				else if($ud['dlz'] == 2)				{					$dlz = "<p style='color:#C3C'>独立站更新失败</p>";				}				else				{					$dlz = "";				}				if($value['waybill'] != "")				{					$info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;				}				if($value['express'] != 0)				{				    $express = $this->express->read($value['express']);					$expressservicename = $express['servicename'];					if($value['express'] != 1 && $value['express'] != 63)					{						$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";					}					else if($value['express'] == 63)					{						$expressservicename = "<font style='color:#a910f8'>".$express['servicename']."</font>";					}				    $info_list[$key]['express'] = $expressservicename;				}				else				{					$info_list[$key]['express'] = "无";				}				$x = "";				if($value['libraryconfirm'] == 2 && $value['review'] > 4 && $ud['library'] == 1)				{				    $x = "<p class='ckn'><b class='fojz' data-type='1'>禁止发货</b></p>";				}				else if(($value['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1)				{					$x = "<p class='ckn'><b class='fojzof' data-type='6' data-id='".$value['id']."'>允许发货</b></p>";				}				if(($value['review'] > 4) && $ud['print'] == 2)				{				    $x = "<p class='ckn'><b class='fojzof' data-type='7' data-id='".$value['id']."'>禁止打印</b></p>";				}				else if($value['review'] >4 && $ud['print'] == 1)				{				    $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";				}				if($value['waybill'] == "" && $value['review'] > 4)				{					$x .= "<p><b class='kn' data-type='2'>填写运单号</b></p>";				}				else if($value['waybill'] != "" && $value['review'] > 4)				{					$x .= "<p><b class='kn' data-type='2'>修改运单号</b></p>";				}				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)				{					$x .= "<p><b class='focz' data-type='2' data-id='".$value['id']."'>提交审核</b></p>";				}				$x .= "<p><b class='window' data-h='/customeramz/edit/".$customer['id']."' data-t='客户信息 - 修改'>客户信息</b></p>";				$info_list[$key]['black'] = $x;				$tly = "";				if($value['clientremarks'] != "")				{					$tly = "<p style='color:#FF3333'>有客户留言</p>";				}				if($value['review'] > 4 && $usp['vip'] != 1 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id']))				{					$info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorderamz/readonly/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";				}				else if($ud['merge'] == 0 || $ud['merge'] == $ud['id'])				{					$info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorderamz/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p>".$tly."</h9>";				}				else if($ud['merge'] != 0 && $ud['merge'] != $ud['id'])				{					$info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorderamz/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."' style='color:#000'><p>".$value['orderinfo']."</p>".$tly."</h9>"."<p>合并订单</p>";				}				if($value['library'] == 1 && $ud['printtype'] == 3)				{					$info_list[$key]['library'] = "不需要";				}				else if($value['library'] == 1 && $ud['printtype'] != 3)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';				}				            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['express'] = $this->express->find_all();		$user = $this->user->get_api($_SESSION['api']);		$powerid = $this->power->read($user['power']);		$powertext = explode('|',trim($powerid['excelid'],'|'));		$pid = '';		foreach ($powertext as $v) 		{			$pid .= " id = ".$v." or";		}		$fullorderexcel = $this->fullorderexcel->find_all("type = '100009' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板		$this->data['fullorderexcel'] = $fullorderexcel;		$error = $this->fullorderamz->find_count("failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').") and dtime > '".(time()-90*24*3600)."'");		$this->data['error'] = $error;		$yc = $this->fullorderamz->find_count("library = 2 and state = 214 and (".rtrim($fgshop,'or').")");		$this->data['yc'] = $yc;		$this->data['power'] = $vip;		$cs_num = $this->fullordererrors->find_count( " plat = 'fullorderamz' and error_type = 1 and (".rtrim($fgshop,'or'). " ) and error_time > '".(time()-90*24*3600)."'");		$this->data['cs_num'] = $cs_num;		$this->_Template('fullorderamz',$this->data);	}		//筛选重复订单	public function _repeat()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$shop = $this->input->post('shop',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "print != 999 and state = 207 and review = 1 and number NOT like '%-%-%-%-%' and (".rtrim($fgshop,'or').")";			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "id desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,name,phone,address,state,dtime,shipremarks,type,merge');			$info = array();			$len = count($info_list); 			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$ud = $this->fullorderamz->read($value['id']);				$shop = $this->shop->read($value['shop']);				$warehouse = $this->warehouse->read($value['type']);				$info_list[$key]['shop'] = '<p>'.$shop['shopname'].'</p>'.'<p>'.$warehouse['title'].'</p>';				$typeclass = $this->typeclass->read($value['state']);				$info_list[$key]['state'] = $typeclass['spare'];				$info_list[$key]['type'] = $ud['orderremarks']; 				$info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']).'</p><p>'.date('H:i:s',$value['dtime']).'</p>';				if($value['merge'] == 0)				{					$info_list[$key]['merge'] = "<p>可合并</p>";				}				else				{					if($value['merge'] == $value['id'])					{						if($ud['print'] < '3' && $ud['library'] == '1')						{							$info_list[$key]['merge'] = "<p><b class='cforder' data-id='".$value['id']."'>拆分订单</b></p>";						}						else						{						    $info_list[$key]['merge'] = "已合并";						}					}					else					{						$info_list[$key]['merge'] = "被合并";					}				}            }			/** 操作合并			if($value['merge'] == 0)				{					$info_list[$key]['merge'] = "<p><b class='jd' data-type='5'>合并订单</b></p>";				}				else				{					if($value['merge'] == $value['id'])				    {						$info_list[$key]['merge'] = "已合并";					}					else					{						$info_list[$key]['merge'] = "被合并";					}				}			**/			$asd = array();			for($i=0;$i<$len;$i++) 			{ 			    for($j=$i+1;$j<$len;$j++) 				{                      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']					 {					     if(!array_key_exists($j,$info))						 {							 $info[$j] = $info_list[$j];						 }						 if(!array_key_exists($i,$info))						 {							 $info[$i] = $info_list[$i];						 }                     }                }            }			rsort($info);		    $total = count($info);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage)));		    echo json_encode($rows);exit;		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->_Template('fullorderamz_repeat',$this->data);	}	//修改	public function _edit($arg_array)	{		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			if($user['vip'] == 1)			{				$vip = 1;			}			else			{				$vip = 0;			}		}		else		{			$vip = 0;		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['id']))		{			$id = $this->input->post('id',true);			$data = $this->fullorderamz->read($id);			$post['type'] = $this->input->post('warehouse',true);			$post['country'] = $this->input->post('country',true);			$currency = $this->country->read($post['country']);			$post['al'] = $currency['lb'];			$post['freight'] = $this->input->post('freight',true);			$post['expressmoney'] = $this->input->post('expressmoney',true);			$post['shouldmoney'] = $this->input->post('shouldmoney',true);			$orderremarks = $this->input->post('orderremarks');			$orderremarks = str_replace(array('%26','%2B'),array('&','+'),$orderremarks);			$post['orderremarks'] = $orderremarks;			$shipremarks = $this->input->post('shipremarks');			$shipremarks = str_replace(array('%26','%2B'),array('&','+'),$shipremarks);			$post['shipremarks'] = preg_replace('/( | | |\s)/',' ',$shipremarks);			$post['email'] = $this->input->post('email',true);			//$post['paypal'] = $this->input->post('paypal',true);			$name = $this->input->post('name',true);			$post['name'] = str_replace("'","’",$name);			$post['phone'] = $this->input->post('phone',true);			$post['phone'] = preg_replace('/\D/s','',$post['phone']);			$post['country'] = $this->input->post('country',true);			$post['province'] = $this->input->post('province',true);//省、州			$post['province'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['province']); //替换开头空字符            $post['province'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['province']); //替换结尾空字符			$post['city'] = $this->input->post('city',true);//城市			$post['city'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['city']); //替换开头空字符            $post['city'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['city']); //替换结尾空字符			$post['zipcode'] = $this->input->post('zipcode',true);//邮编			$post['zipcode'] = preg_replace("/^[\s\v".chr(227).chr(128)."]+/","", $post['zipcode']); //替换开头空字符            $post['zipcode'] = preg_replace("/[\s\v".chr(227).chr(128)."]+$/","", $post['zipcode']); //替换结尾空字符			$post['street'] = $this->input->post('street',true);			$address = $this->input->post('address',true);			$address = preg_replace('/( | | |\s)/',' ',$address);			$post['address'] = str_replace("'","’",$address);			$address2 = $this->input->post('address2',true);			$address2 = preg_replace('/( | | |\s)/',' ',$address2);			if($address2 == ' ')			{				$address2 = '';			}			$post['address2'] = str_replace("'","’",$address2);			$post['express'] = $this->input->post('express',true);			$post['printtype'] = $this->input->post('printtype',true);			$fpdata = $this->input->post('fpdata');			$fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);			$post['fpdata'] = $fpdata;			$post['waybill'] = $this->input->post('waybill',true);			$post['msg'] = $this->input->post('msg',true);			$post['zsbjz'] = $this->input->post('zsbjz',true);			$post['refundy'] = $this->input->post('refundy',true);			$post['refundj'] = $this->input->post('refundj',true);			$rtime = $this->input->post('rtime',true);			$post['rtime'] = strtotime($rtime);			$post['rpaypal'] = $this->input->post('rpaypal',true);			$post['rtext'] = $this->input->post('rtext',true);			$post['sbpm'] = $this->input->post('sbpm',true);			$post['edittime'] = time();			$editstate = $this->input->post('state',true);			$whlabel = $this->input->post('whlabel',true);			$fpcount = $this->input->post('fpcount',true);			$post['ioss'] = $this->input->post('ioss',true);			$post['waybill'] = preg_replace('/( | | | |\s)/','',$post['waybill']);			$pay = $this->pay->get_typeclass($data['pay']);			$yga = $post['shouldmoney'];			$ygc = $data['estimaterate'];			$post['budget'] = $this->input->post('newbudget',true);			//$post['budget'] = $this->input->post('newbudget',true);			/**			$post['budget'] = 0;			$ifbudget = eval("return $yga*1.$ygc;");			if($ifbudget > 0)			{			    $post['budget'] = eval("return $yga*1.$ygc;");			}			**/			$whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;			foreach ($whlabeldata as $va)			{				if(stripos($va,'z') !== false)				{					$way += 1;				}			}			//如果备注中出现网红的两个字 ,那么在fpdata种的品名中必须有 WH这两个字     且美仓不用			if($post['type'] !=5 ){			    if(stripos($post['shipremarks'],'网红') !== false){    				if(stripos($post['fpdata'],'-2090-') === false){    					echo json_encode(array('msg'=>'网红单请在商品名称中勾选WH!','success'=>false));exit;    				}	    			}			}			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))			{				echo json_encode(array('msg'=>'此快递方式不可从美仓发货!','success'=>false));exit;			}			if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods' && $post['type'] != 34)//$post['express'] == 3 || 			{				echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit;			}			if($post['express'] == 24 && $post['sbpm'] != 'Hair Sample' && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods' && $post['type'] != 34)//$post['express'] == 3 || 			{				echo json_encode(array('msg'=>'此快递方式必须选择Hair Sample/Human Hair Wigs/Human Hair Goods!','success'=>false));exit;			}			if($post['country'] != 192 && $post['express'] == 1 && $post['sbpm'] != 'Synthetic Hair Wigs' && $post['sbpm'] != 'Synthetic Hair Goods' && $post['type'] != 34)//$post['express'] == 3 || 			{				echo json_encode(array('msg'=>'非美国选择官方DHL必须选择Synthetic Hair Wigs/Synthetic Hair Goods','success'=>false));exit;			}			if($way == count($whlabeldata) && $post['type'] != 12)			{				echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;			}			if($way == '0' && $post['type'] == 12)			{				echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;			}			$post['review'] = 1;			if($post['zsbjz'] < '0.01' && $post['type'] != 34)			{				echo json_encode(array('msg'=>'总申报价错误!'.$post['type'],'success'=>false));exit;			}			if($data['library'] == 1)			{			    if($data['print'] != 3)			    {			    	$post['print'] = 1;				    $post['libraryconfirm'] = 1;				    $post['librarynot'] = "订单未打印,未审核或未通过";			    }			    else			    {			    	$post['libraryconfirm'] = 1;			    	$post['librarynot'] = "订单被修改或重新提交";			    }			}			if($data['yhs'] == 1)			{				 echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;			}			if($post['express'] == 2 && (stripos($post['name'],'&') !== false || stripos($post['name'],"'") !== false))			{				echo json_encode(array('msg'=>'USPS收件人或公司名不可用特殊符号!','success'=>false));exit;			}			if(strlen($post['client']) > 34 || strlen($post['name']) > 34)//收件人姓名或公司名不允许超过35位			{				echo json_encode(array('msg'=>'收件人姓名或公司名不可超过34个字符!','success'=>false));exit;			}			if($post['express'] == '3' && $post['address2'] != '')//UPS不允许提交地址2			{				echo json_encode(array('msg'=>'UPS不允许提交地址2','success'=>false));exit;			}			if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $post['country'] != 192 && $post['type'] != 34)			{				echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;			}			if($post['express'] == '3' && $post['country'] != 192 && $post['country'] != 35)			{				echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;			}			if($post['country'] == 35 && $post['zsbjz'] > 20)			{				echo json_encode(array('msg'=>'加拿大最高申报不可超过20','success'=>false));exit;			}			if(($post['express'] == '28' || $post['express'] == '7') && $post['country'] != 191)			{				echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;			}			$express = $this->express->read($post['express']);			if($express['ioss'] == 1 && $post['ioss'] == '')			{				 echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;			}			if(strlen($post['address']) > $express['addresssize'] || strlen($post['address2']) > $express['addresssize'])			{				echo json_encode(array('msg'=>'此快递地址不可超出'.$express['addresssize'].'个字符','success'=>false));exit;			}			// if(strlen($post['address']) > 32 && ($post['express'] == 2 || $post['express'] == 16))			// {			// 	echo json_encode(array('msg'=>'此快递地址不可超出32个字符','success'=>false));exit;			// }			if(strlen($post['address']) < 5)			{				echo json_encode(array('msg'=>'地址不可留空!','success'=>false));exit;			}			if($post['zsbjz'] > $express['sbjz'])			{				echo json_encode(array('msg'=>'总申报价值不可超出'.$express['sbjz'],'success'=>false));exit;			}			if($post['shouldmoney'] > $express['shouldmoney'] && $express['shouldmoney'] != 0)			{				echo json_encode(array('msg'=>'订单金额不可超出'.$express['shouldmoney'],'success'=>false));exit;			}			if($post['express'] == '2' && $post['zzl'] > '16' && isset($post['js']) && $post['js'] == '0')			{				echo json_encode(array('msg'=>'重量大于16不可按Ground Advantage提交!','success'=>false));exit;			}			if($post['express'] == '2' && isset($post['js']) && $post['js'] == '0'&& $post['qm'] == '1')			{				echo json_encode(array('msg'=>'Ground Advantage不可使用签名服务!','success'=>false));exit;			}			if(isset($post['bx']))			{			if($post['express'] == '99' && $post['bx'] > 0)			{				echo json_encode(array('msg'=>'此物流不允许购买保险','success'=>false));exit;			}			}			if(($post['express'] == '3' || $post['express'] == '42' || $post['express'] == '24') && $post['shouldmoney'] < 1)			{				//echo json_encode(array('msg'=>'零金额订单不可发 UPS/DHL官方-美国/Fedex(杭州)','success'=>false));exit;			}			if($post['express'] == '42' && $post['zsbjz'] < 1)			{				echo json_encode(array('msg'=>'零申报金额不可发 DHL官方-美国','success'=>false));exit;			}			if($post['express'] == '6' && $post['province'] == '')			{				echo json_encode(array('msg'=>'选择DPEX必须填写州信息','success'=>false));exit;			}			if(($post['express'] == '24' || $post['express'] == '3') && $post['shouldmoney'] == 0)			{				echo json_encode(array('msg'=>'0金额订单不可发UPS/Fedex(杭州)!!!','success'=>false));exit;			}			if($post['country'] == '35' && $post['zsbjz'] > 20)			{				echo json_encode(array('msg'=>'加拿大不可申报超过20美金!!!','success'=>false));exit;			}			if($post['printtype'] == 1)//如果是运单			{				$post['productdescription'] = $this->input->post('productdescription',true);			    $post['customs'] = $this->input->post('customs',true);			}			if($post['express'] == 2 && strlen($post['zipcode']) != 5)//如果usps 邮编不是5位			{				echo json_encode(array('msg'=>'USPS-USA的邮编需按5位数格式提交!','success'=>false));exit;			}			if(strlen($post['phone']) > 11 && $post['express'] == 63)			{				echo json_encode(array('msg'=>'美国联邦,电话号码不允许超过11位!','success'=>false));exit;			}			/**			if($post['paypal'] != '')			{			    $pp = $this->fullorderamz->get_paypal($post['paypal']);				    if(isset($pp['number']) && $pp['number'] != $data['number'])			    {				    echo json_encode(array('msg'=>'此交易号的订单已存在!-'.$pp['number'],'success'=>false));exit;			    }		    }			**/			/**			if($editstate == 216 && $data['state'] != 216)			{				echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;			}			**/			if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true)			{				//echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit;			}			else			{				$post['review'] = $data['review'];				$post['state'] = $editstate;			}			$thisdata =  $this->fullorderamz->read($id);			$warehouse = $this->warehouse->read($thisdata['type']);			$warehousenew = $this->warehouse->read($post['type']);			if($warehousenew['bdcountry'] != 0 && $post['country'] != $warehousenew['bdcountry'])			{				echo json_encode(array('msg'=>'当前国家无法选择'.$warehousenew['title'].'!','success'=>false));exit;			}			/**			if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库			{				echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;			}			**/			if($thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库			{				echo json_encode(array('msg'=>'此单已出库,无法更改仓库!','success'=>false));exit;			}			$expt = $this->express->read($post['express']);			if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false && $post['type'] != 34)			{				echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;			}			if($expt['province'] != '' && stripos($expt['province'],$post['province'].'、') !== false)			{				echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;			}			/**			if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])			{				echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;			}			**/			//开始注释 xyxg 			/**			$ft = array();			$ftdata = explode('|',rtrim($fpcount,'|'));			foreach ($ftdata as $va)			{				$ftitle = '';				$va = explode('-',trim($va,'-'));				foreach ($va as $v)			    {					$v = $this->typeclass->read($v);					$ftitle .= $v['title'].' ';				}				$ft[] = rtrim($ftitle,' ');			}			if($data['library'] == 1)			{				$tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$data['shop'],$data['number']);			if(isset($tqkcyz[0]))            {				echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;            }				    if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)			    {			        $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);				    if($tskcyz['t'] > '0')			        {				    echo $tskcyz['m'];exit;			        }			    }			    $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']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字			    if($kcyz['t'] > '0')			    {				    echo $kcyz['m'];exit;			    }			}			//结束注释			**/			/** 重新写产品名称 			$dtctitle = array();			$dictionaries = $this->typeclass->find_all();			foreach ($dictionaries as $v)			{				$dtctitle[$v['id']] = array($v['title'],$v['bqsku']);			}			if(stripos($fpdata,'-128-') !== false || stripos($fpdata,'-127-') !== false)			{			    $dfp =  explode(';',trim($fpdata,';'));			    $fdata = '';			    foreach ($dfp as $k=>$v)			    {				    $ptitleb = '';				    $fp = explode('|',trim($v,'|'));				    $fp0 = explode(',',$fp[0]);				    $fp1 = explode('-',trim($fp0[1],'-'));				    foreach ($fp1 as $vv)				    {					    $ptitleb .= isset($dtctitle[$vv])?$dtctitle[$vv][0].' ':'';				    }				    $ptitleb .= $dtctitle[$fp0[0]][1].'inch ';				    $fp[1] = $ptitleb;				    $fdata .= implode("|",$fp).";";			    }			    $fpdata = $fdata;			}			**/			$warehouse = $this->warehouse->read($post['type']);			if($data['library'] == 1 || ($data['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))			{			    $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);			    if($kcyz['t'] > '0')			    {				    echo $kcyz['m'];exit;			    }			    else if($kcyz['fpdata'] != '')			    {				    $post['whlabel'] = $kcyz['whlabel'];				    $post['fpdata'] = $kcyz['fpdata'];			    }			}			$fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);			$post['sfxh'] = $fl['sfxh'];			$post['ckfl'] = $fl['ckfl'];						//查询净重开始			$post['jweight'] = $this->weight->get_weightcx($post['fpdata']);			//查询净重结束			    if($this->fullorderamz->save($post,$id))        	    {					if($data['printtime'] == '0')					{						$xghz = ',将自动禁止打印';					}					else if($data['printtime'] > '0' && $data['librarytime'] == '0')					{						$q = '';						if($data['libraryconfirm'] == 1)						{							$q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';						}						$xghz = ',将自动禁止发货'.$q;					}					else					{						$xghz = '';					}         		    echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           		    echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;        	    }					}		$this->data['vip'] = $vip;		$arg_array = $arg_array[0];$fpdata = array();		$fullorderamz = $this->fullorderamz->read($arg_array);		$returngoods = $this->returngoods->get_orderinfo($fullorderamz['orderinfo']);		$this->data['returngoods'] = $returngoods?1:0;		$fullorderamz['parameter'] = str_replace(",","---",$fullorderamz['parameter']);		$country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息		$express = $this->express->find_all('1=1');//所有快递配置信息		$this->data['fullorderamz'] = $fullorderamz;		if($fullorderamz['express'] == 2)		{			$zzhl = 'oz';		}		else		{			$zzhl = 'kg';		}		$this->data['zzhl'] = $zzhl;		$this->data['country'] = $country;		$this->data['express'] = $express;		$this->data['dtime'] = date('Y-m-d H:i:s',$fullorderamz['dtime']);		$warehouse = $this->warehouse->read($fullorderamz['type']);		if(stripos($fullorderamz['fpdata'],';') !== false)		{		    $fpdata = explode(';',rtrim($fullorderamz['fpdata'],';'));		    foreach ($fpdata as $k=>$v) 		    {			    $xxv = explode('|',$v);				if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)				{					$xxv['zd'] = "<p>已占单</p>";					$bdck = $warehouse['bdck'];					if(stripos($xxv[9],'~') !== false)					{						$dxxv = explode('~',trim($xxv[9],'~'));						foreach ($dxxv as $val) 		                {					    	$wzid = $this->$bdck->read(trim($val,$warehouse['hz']));							if($wzid['details'] != '')						    {					    	    $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';							}						}					}					else					{					    $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));						if($wzid['details'] != '')						{					        $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';						}					}				}				$fpdata[$k] = $xxv;            }		}		$this->data['fpdata'] = $fpdata;		$thfpdataxs = array();		if($fullorderamz['thfpdata'] != '')		{			$thfpdata =  explode(';',trim($fullorderamz['thfpdata'],';'));			foreach ($thfpdata as $k=>$v) 		    {				$thxs = explode('~',trim($v,'~'));				$thxs[0] = explode('|',trim($thxs[0],'|'));				$thxs[1] = explode('|',trim($thxs[1],'|'));				$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]);			}		}		$this->data['thfpdata'] = $thfpdataxs;		$shop = $this->shop->read($fullorderamz['shop']);		$this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例		$is = 0;		if($shop['type'] == 269)//判断是否独立站,269是独立站		{			$is = 1;		}		$this->data['is'] = $is;		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			if($user['vip'] == 1)			{				$vip = 1;			}			else			{				$vip = 0;			}		}		else		{			$vip = 0;		}		$this->data['power'] = $vip;		/** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/		$downwaybill = '';$dwls = array();		$oldwaybill = explode('-',ltrim($fullorderamz['oldwaybill'],'-'));		if(isset($oldwaybill[0][1]))		{			$oldwaybill = array_reverse($oldwaybill); //调整顺序		    foreach ($oldwaybill as $v) 		    {				$dw = explode('/',$v);				if(isset($dw[1]))				{					if(stripos($downwaybill,$dw[1]) === false)					{					    $dwls[$dw[1]] = 1;			    	    $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';					}				}        	}		}		if($fullorderamz['printtype'] == 1)		{			if($fullorderamz['waybill'] != '' && !isset($dwls[$fullorderamz['waybill']]))			{		        $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorderamz['printtime']).'/y-'.$fullorderamz['waybill'].'.pdf" target="_blank">'.$fullorderamz['waybill'].'</a>、'.$downwaybill;			}		}		$this->data['downwaybill'] = rtrim($downwaybill,'、');		/** 历史打印时间 **/		$printtime = '';		if($fullorderamz['oldprinttime'])		{			$pte = explode('-',rtrim($fullorderamz['oldprinttime'],'-'));		    foreach ($pte as $v) 		    {				$printtime .= date('Y-m-d H:i:s',$v).'、';        	}		}		$this->data['printtime'] = rtrim($printtime,'、');		$product = '';		$fullorderamz['product'] = str_replace("'","",$fullorderamz['product']);		if($fullorderamz['link'] != '' && $fullorderamz['source'] != '1')		{			$pt = explode(',',$fullorderamz['product']);			$lk = explode(',',$fullorderamz['link']);			for($i=0;$i<count($pt);$i++)			{				if(isset($lk[$i]))				{				    $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);				}				else				{					$octs = '';				}				$a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];				//$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];				if(isset($lk[$i]))				{				    $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';				}				else				{					 $product .= ($product != '')?' , '.$a:$a;				}							}		}		else		{			$octs = $this->colourorderts->get_text($fullorderamz['product']);			$a = $octs?'<font style="color:#F39">'.$fullorderamz['product'].'</font>':$fullorderamz['product'];			//$a = (stripos($fullorderamz['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorderamz['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorderamz['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorderamz['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorderamz['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorderamz['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorderamz['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorderamz['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorderamz['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorderamz['product'].'</font>':$fullorderamz['product'];			$product = $a;		}		$this->data['product'] = $product;		$out = $this->systemtransfer->find_all("number = '".$fullorderamz['number']."'");				$outread = '';				if($out)				{					foreach ($out as $val) 		            {						$list = '';						$rk = explode('|',trim($val['rk'],'|'));					    $rktime = explode('|',trim($val['rktime'],'|'));					    $zw = array();					    $t = $this->transfer->find_all("1=1");					    foreach ($t as $v)		   		        {						    $zw[$v['id']] = $v['title'];					    }					    if($val['rk'] != '' && count($rk) > 0)					    {							for($i=0;$i<count($rk);$i++)		       		        {							    if(!isset($rktime[$i]))							    {									$list .= $zw[$cz[$i]];							    }							    else							    {					   		        $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';							    }							}						}						//$outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';						$outread .= '<span style="color:#f00">'.$val['shipremarks'].'</span>:'.$list.'<br>';					}				}				else				{						$systemwigsout = $this->systemwigsout->find_all("number = '".$fullorderamz['number']."'");						$outread = array();						if($systemwigsout)						{		    				foreach ($systemwigsout as $v) 		    				{								if($v['czwarehouse'] == 37)								{									$outread[] = '华荣厂';								}								else if($v['czwarehouse'] == 0)								{									$outread[] = '龙盈厂';								}			    				$cz = explode('|',trim($v['cz'],'|'));			    				$cztime = explode('|',trim($v['cztime'],'|'));			    				$zw = $this->transfer->get_list();			    				if($v['cz'] != '' && count($cz) > 0)			    				{			    					for($i=0;$i<count($cz);$i++)		            				{				    					if(!isset($cztime[$i]))					    				{					    					$outread[] = $zw[$cz[$i]].' -> ';					    				}					    				else					   				 {					       				 $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -> ';					    				}				    				}									$outread[] = '<br>';			    				}		    				}						}				}		$klarnacolor = '';		if($fullorderamz['klarnadata'] !='')		{			$klarnadata = explode('|',$fullorderamz['klarnadata']);			if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')			{				$klarnadata[1] = json_decode($klarnadata[1],true);				if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorderamz['shouldmoney'] && $fullorderamz['pay'] == 1211)				{					$klarnacolor = 'style="color:#F00"';				}			}			else if($klarnadata[0]!=1 && $fullorderamz['pay']!=26 && $fullorderamz['pay']!=27 && $fullorderamz['pay']!=1211)			{				$klarnacolor = 'style="color:#F00"';			}			if($fullorderamz['pay'] == 23)//klarna			{				$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');				$ToState = array_flip($ToState);				$klarnadata3 = str_replace(' ','',$klarnadata[3]);				$city = str_replace(' ','',$fullorderamz['city']);				$klarnadataaddress = explode($city,$klarnadata3);				if(isset($klarnadataaddress[1]))				{				    $klarnadata3 = $city.$klarnadataaddress[1];				    $klarnadatacolor = explode(',',$klarnadata3);				    unset($klarnadatacolor[4]);				    unset($klarnadatacolor[6]);				    if(isset($ToState[$klarnadatacolor[1]]))				    {					    $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);				    }				    $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);				}				else				{					$klarnadata['color'] = $klarnadata3;				}			}		}		else		{			$klarnadata = '';		}		$p = explode('-',$fullorderamz['paypal']);		$this->data['klarnacolor'] = $klarnacolor;		$this->data['klarnadata'] = $klarnadata;		$this->data['systemwigsout'] = $outread;		$quantity = explode(';',trim($fullorderamz['quantity'],';'));		$qc = 0;		foreach ($quantity as $v) 		{			if($v > 1)			{				$qc += 1;			}		}		$this->data['qc'] = $qc;		$this->_Template('fullorderamz_edit',$this->data);	}	//不可修改	public function _readonly($arg_array)	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['id']))		{			$id = $this->input->post('id',true);			$ud = $this->fullorderamz->read($id);			$post['type'] = $this->input->post('warehouse',true);			$post['orderremarks'] = $this->input->post('orderremarks',true);			$post['state'] = $this->input->post('state',true);			$post['msg'] = $this->input->post('msg',true);			$post['refundy'] = $this->input->post('refundy',true);			$post['refundj'] = $this->input->post('refundj',true);			$fpdata = $this->input->post('fpdata');			$fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata);			$post['fpdata'] = $fpdata;			$rtime = $this->input->post('rtime',true);			$post['rtime'] = strtotime($rtime);			$post['rpaypal'] = $this->input->post('rpaypal',true);			$post['rtext'] = $this->input->post('rtext',true); 			$post['express'] = $this->input->post('express',true);			$whlabel = $this->input->post('whlabel',true);			$post['budget'] = $this->input->post('newbudget',true);			//$post['ioss'] = $this->input->post('ioss',true);			$post['edittime'] = time();			$editstate = $post['state'];			/**			if($post['state'] == 216 && $ud['state'] != 216)			{				echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit;			}			**/			$whlabeldata = explode('|',trim($whlabel,'|'));$way = 0;			foreach ($whlabeldata as $va)			{				if(stripos($va,'z') !== false)				{					$way += 1;				}			}			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))			{				echo json_encode(array('msg'=>'此快递方式必须选择美国仓!','success'=>false));exit;			}			if($way == count($whlabeldata) && $post['type'] != 12)			{				echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit;			}			if($way == '0' && $post['type'] == 12)			{				echo json_encode(array('msg'=>'特殊仓必须包含特殊仓货物!','success'=>false));exit;			}			$fpcount = $this->input->post('fpcount',true);			if(!$fpcount)			{				echo json_encode(array('msg'=>'需要先清理浏览器缓存,刷新当前页面后再试!','success'=>false));exit;			}			if($ud['library'] == 1)			{			    if($ud['print'] != 3)			    {			    	$post['print'] = 1;				    $post['libraryconfirm'] = 1;				    $post['librarynot'] = "订单未打印,未审核或未通过";			    }			    else			    {			    	$post['libraryconfirm'] = 1;			    	$post['librarynot'] = "订单被重新提交";			    }			}			if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '42' || $post['express'] == '31') && $ud['country'] != 192)			{				echo json_encode(array('msg'=>'非美国无法选择Fedex、DHL官方-美国!','success'=>false));exit;			}			if($post['express'] == '3' && $ud['country'] != 192 && $ud['country'] != 35)			{				echo json_encode(array('msg'=>'非美国和加拿大无法选择UPS!','success'=>false));exit;			}						if(($post['express'] == '28' || $post['express'] == '7') && $ud['country'] != 191)			{				echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit;			}			$express = $this->express->read($post['express']);			/**			if($express['ioss'] == 1 && $post['ioss'] == '')			{				 echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit;			}			**/			$thisdata =  $this->fullorderamz->read($id);			$warehouse = $this->warehouse->read($thisdata['type']);			$warehousenew = $this->warehouse->read($post['type']);			if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库			{				echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit;			}			if($ud['yhs'] == 1)			{				 echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit;			}			$expt = $this->express->read($post['express']);			if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false)			{				echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit;			}			if($expt['province'] != '' && stripos($expt['province'],$ud['province'].'、') !== false)			{				echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit;			}			/**			if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata'])			{				echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit;			}			**/			/**			if($warehousenew['zd'] == '1' && $editstate != $thisdata['state'] && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝			{				echo json_encode(array('msg'=>'如需更改订单状态,请先把仓库选择为非开启库存模式仓库或等待订单出库!','success'=>false));exit;			}			if($warehousenew['zd'] == '1' && $editstate != '207' && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝			{				echo json_encode(array('msg'=>'非待发货状态,不允许修改为开启库存模式仓库','success'=>false));exit;			}			**/			//开始注释 xyxg 			/**			$ft = array();			$ftdata = explode('|',rtrim($fpcount,'|'));			foreach ($ftdata as $va)			{				$ftitle = '';				$va = explode('-',trim($va,'-'));				foreach ($va as $v)			    {					$v = $this->typeclass->read($v);					$ftitle .= $v['title'].' ';				}				$ft[] = rtrim($ftitle,' ');			}			$user = $this->user->get_api($_SESSION['api']);			if($ud['library'] == 1)			{				$tqkcyz = $this->_kcyz($post['type'],$whlabel,$id,$ud['shop'],$ud['number']);				 if(isset($tqkcyz[0]))                {				    echo json_encode(array('t'=>2,'msg'=>"红色商品名库存匹配错误或库存不够扣减",'error'=>$tqkcyz,'success'=>false));exit;                }			    if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false)			    {			        $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']);				    if($tskcyz['t'] > '0')			        {				        echo $tskcyz['m'];exit;			        }			    }			    $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']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字			    if($kcyz['t'] > '0')			    {				    echo $kcyz['m'];exit;			    }			}			//结束注释			**/			$warehouse = $this->warehouse->read($post['type']);			if($ud['library'] == 1 || ($ud['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209')))			{			    $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata);			    if($kcyz['t'] > '0')			    {				    echo $kcyz['m'];exit;			    }			    else if($kcyz['fpdata'] != '')			    {				    $post['whlabel'] = $kcyz['whlabel'];				    $post['fpdata'] = $kcyz['fpdata'];			    }			}			$fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata);			$post['sfxh'] = $fl['sfxh'];			$post['ckfl'] = $fl['ckfl'];						//查询净重开始			$post['jweight'] = $this->weight->get_weightcx($post['fpdata']);			//查询净重结束						    if($this->fullorderamz->save($post,$id))        	    {					if($ud['printtime'] == '0')					{						$xghz = ',将自动禁止打印';					}					else if($ud['printtime'] > '0' && $ud['librarytime'] == '0')					{						$q = '';						if($ud['libraryconfirm'] == 1)						{							$q = ',<em style="color: #F00;">改前状态为:禁止出库</em>';						}						$xghz = ',将自动禁止发货'.$q;					}					else					{						$xghz = '';					}         		    echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           		    echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;        	    }					}		$arg_array = $arg_array[0];$fpdata = array();		$fullorderamz = $this->fullorderamz->read($arg_array);		$returngoods = $this->returngoods->get_orderinfo($fullorderamz['orderinfo']);		$this->data['returngoods'] = $returngoods?1:0;		$fullorderamz['shipremarks'] = str_replace(array('<','>'),array('<','>'),$fullorderamz['shipremarks']);		$fullorderamz['parameter'] = str_replace(",","---",$fullorderamz['parameter']);		$this->data['fullorderamz'] = $fullorderamz;		if($fullorderamz['express'] == 2)		{			$zzhl = 'oz';		}		else		{			$zzhl = 'kg';		}		$this->data['zzhl'] = $zzhl;		$this->data['countrys'] = $this->country->find_all();		$this->data['express'] = $this->express->find_all();		$warehouse = $this->warehouse->read($fullorderamz['type']);		if(stripos($fullorderamz['fpdata'],';') !== false)		{		    $fpdata = explode(';',rtrim($fullorderamz['fpdata'],';'));		    foreach ($fpdata as $k=>$v) 		    {			    $xxv = explode('|',$v);				if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)				{					$xxv['zd'] = "<p>已占单</p>";					$bdck = $warehouse['bdck'];					if(stripos($xxv[9],'~') !== false)					{						$dxxv = explode('~',trim($xxv[9],'~'));						foreach ($dxxv as $val) 		                {					    	$wzid = $this->$bdck->read(trim($val,$warehouse['hz']));							if($wzid['details'] != '')						    {					    	    $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';							}						}					}					else					{					    $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));						if($wzid['details'] != '')						{					        $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';						}					}				}				$fpdata[$k] = $xxv;            }		}		$this->data['fpdata'] = $fpdata;		$this->data['fpdata'] = $fpdata;		$thfpdataxs = array();		if($fullorderamz['thfpdata'] != '')		{			$thfpdata =  explode(';',trim($fullorderamz['thfpdata'],';'));			foreach ($thfpdata as $k=>$v) 		    {				$thxs = explode('~',trim($v,'~'));				$thxs[0] = explode('|',trim($thxs[0],'|'));				$thxs[1] = explode('|',trim($thxs[1],'|'));				$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]);			}		}		$this->data['thfpdata'] = $thfpdataxs;		$shop = $this->shop->read($fullorderamz['shop']);		$this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例		$is = 0;		if($shop['type'] == 269)//判断是否独立站,269是独立站		{			$is = 1;		}		$this->data['is'] = $is;		//单项开始		$warehouse = $this->warehouse->read($fullorderamz['warehouse']);//发货仓库		$state = $this->typeclass->read($fullorderamz['state']);//订单状态		$country = $this->country->read($fullorderamz['country']);//国家		if($fullorderamz['capital'] == 1)		{			$capital = '暂未支付';		}		else if($fullorderamz['capital'] == 2)		{			$capital = '部分支付';		}		else if($fullorderamz['capital'] == 3)		{			$capital = '全部支付';		}		if($fullorderamz['printtype'] == 1)		{			$printtype = '运单';		}		else if($fullorderamz['printtype'] == 2)		{			$printtype = '发货单';		}		else if($fullorderamz['printtype'] == 3)		{			$printtype = '不打印单据';		}		else		{			$printtype = '未选择';		}		$this->data['warehouse'] = $warehouse['title'];		$this->data['state'] = $state['title'];		$this->data['capital'] = $capital;		$this->data['country'] = $country['name'];		$this->data['printtype'] = $printtype;		//单项结束		/** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/		$downwaybill = '';$dwls = array();		$oldwaybill = explode('-',ltrim($fullorderamz['oldwaybill'],'-'));		if(isset($oldwaybill[0][1]))		{			$oldwaybill = array_reverse($oldwaybill); //调整顺序		    foreach ($oldwaybill as $v) 		    {				$dw = explode('/',$v);				if(isset($dw[1]))				{					if(stripos($downwaybill,$dw[1]) === false)					{					    $dwls[$dw[1]] = 1;			    	    $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';					}				}        	}		}		if($fullorderamz['printtype'] == 1)		{			if($fullorderamz['waybill'] != '' && !isset($dwls[$fullorderamz['waybill']]))			{		        $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorderamz['printtime']).'/y-'.$fullorderamz['waybill'].'.pdf" target="_blank">'.$fullorderamz['waybill'].'</a>、'.$downwaybill;			}		}		$this->data['downwaybill'] = rtrim($downwaybill,'、');		/** 历史打印时间 **/		$printtime = '';		if($fullorderamz['oldprinttime'])		{			$pte = explode('-',rtrim($fullorderamz['oldprinttime'],'-'));		    foreach ($pte as $v) 		    {				if(is_numeric($v) && $v > 0)				{				    $printtime .= date('Y-m-d H:i:s',$v).'、';				}        	}		}		$this->data['printtime'] = rtrim($printtime,'、');		$product = '';		$fullorderamz['product'] = str_replace("'","",$fullorderamz['product']);		if($fullorderamz['link'] != '' && $fullorderamz['source'] != '1')		{			$pt = explode(',',$fullorderamz['product']);			$lk = explode(',',$fullorderamz['link']);			for($i=0;$i<count($pt);$i++)			{				if(isset($lk[$i]))				{				    $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);				}				else				{					$octs = '';				}				$a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];				//$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];				if(isset($lk[$i]))				{				    $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';				}				else				{					 $product .= ($product != '')?' , '.$a:$a;				}			}		}		else		{			$octs = $this->colourorderts->get_text($fullorderamz['product']);			$a = $octs?'<font style="color:#F39">'.$fullorderamz['product'].'</font>':$fullorderamz['product'];			//$a = (stripos($fullorderamz['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorderamz['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorderamz['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorderamz['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorderamz['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorderamz['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorderamz['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorderamz['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorderamz['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorderamz['product'].'</font>':$fullorderamz['product'];			$product = $a;		}		$this->data['product'] = $product;		$out = $this->systemtransfer->find_all("number = '".$fullorderamz['number']."'");				$outread = '';				if($out)				{					foreach ($out as $val) 		            {						$list = '';						$rk = explode('|',trim($val['rk'],'|'));					    $rktime = explode('|',trim($val['rktime'],'|'));					    $zw = array();					    $t = $this->transfer->find_all("1=1");					    foreach ($t as $v)		   		        {						    $zw[$v['id']] = $v['title'];					    }					    if($val['rk'] != '' && count($rk) > 0)					    {							for($i=0;$i<count($rk);$i++)		       		        {							    if(!isset($rktime[$i]))							    {									$list .= $zw[$cz[$i]];							    }							    else							    {					   		        $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';							    }							}						}						$outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';					}				}				else				{						$systemwigsout = $this->systemwigsout->find_all("number = '".$fullorderamz['number']."'");						$outread = array();						if($systemwigsout)						{		    				foreach ($systemwigsout as $v) 		    				{								if($v['czwarehouse'] == 37)								{									$outread[] = '华荣厂';								}								else if($v['czwarehouse'] == 0)								{									$outread[] = '龙盈厂';								}			    				$cz = explode('|',trim($v['cz'],'|'));			    				$cztime = explode('|',trim($v['cztime'],'|'));			    				$zw = $this->transfer->get_list();			    				if($v['cz'] != '' && count($cz) > 0)			    				{			    					for($i=0;$i<count($cz);$i++)		            				{				    					if(!isset($cztime[$i]))					    				{					    					$outread[] = $zw[$cz[$i]].' -> ';					    				}					    				else					   				 {					       				 $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -> ';					    				}				    				}									$outread[] = '<br>';			    				}		    				}						}				}		$klarnacolor = '';		if($fullorderamz['klarnadata'] !='')		{			$klarnadata = explode('|',$fullorderamz['klarnadata']);			if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')			{				$klarnadata[1] = json_decode($klarnadata[1],true);				if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorderamz['shouldmoney'] && $fullorderamz['pay'] == 1211)				{					$klarnacolor = 'style="color:#F00"';				}			}			else if($klarnadata[0]!=1 && $fullorderamz['pay']!=26 && $fullorderamz['pay']!=27 && $fullorderamz['pay']!=1211)			{				$klarnacolor = 'style="color:#F00"';			}			if($fullorderamz['pay'] == 23)//klarna			{				$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');				$ToState = array_flip($ToState);				$klarnadata3 = str_replace(' ','',$klarnadata[3]);				$city = str_replace(' ','',$fullorderamz['city']);				$klarnadataaddress = explode($city,$klarnadata3);				if(isset($klarnadataaddress[1]))				{				    $klarnadata3 = $city.$klarnadataaddress[1];				    $klarnadatacolor = explode(',',$klarnadata3);				    unset($klarnadatacolor[4]);				    unset($klarnadatacolor[6]);				    if(isset($ToState[$klarnadatacolor[1]]))				    {					    $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);				    }				    $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);				}				else				{					$klarnadata['color'] = $klarnadata3;				}			}		}		else		{			$klarnadata = '';		}		$p = explode('-',$fullorderamz['paypal']);		$this->data['klarnacolor'] = $klarnacolor;		$this->data['klarnadata'] = $klarnadata;		$this->data['systemwigsout'] = $outread;		$quantity = explode(';',trim($fullorderamz['quantity'],';'));		$qc = 0;		foreach ($quantity as $v) 		{			if($v > 1)			{				$qc += 1;			}		}		$this->data['qc'] = $qc;		$this->_Template('fullorderamz_readonly',$this->data);	}	//浏览列表	public function _readlist()	{		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$shop = $this->input->post('shop',true);			$warehouse = $this->input->post('warehouse',true);			$express = $this->input->post('express',true);			$state = $this->input->post('state',true);			$print = $this->input->post('print',true);			$libraryconfirm = $this->input->post('libraryconfirm',true);			$orderinfo = $this->input->post('orderinfo',true);			$client = $this->input->post('name',true);			$email = $this->input->post('email',true);			$number = $this->input->post('number',true);			$waybill = $this->input->post('waybill',true);			$authorid = $this->input->post('authorid',true);			$sourcecontentid = $this->input->post('sourcecontentid',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);				$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($warehouse)            {                $where  .= " and type = '$warehouse'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($state)            {				$where  .= " and state = '$state'";            }			if($print)            {				$where  .= " and print = '$print'";            }			if($libraryconfirm)            {				$where  .= " and libraryconfirm = '$libraryconfirm'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($client)            {                $where  .= " and client like '%$client%'";            }			if($email)            {                $where  .= " and email = '$email'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($authorid)            {                $where  .= " and authorid = '$authorid'";            }			if($sourcecontentid)            {                $where  .= " and sourcecontentid = '$sourcecontentid'";            }			if($timetk && $timetj)            {				$timetj = $timetj+24*3600;                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,sname,state,dtime,review,libraryconfirm,express,waybill,exstate,orderremarks,library,clientremarks',$order_str,$start,$perpage);			 //格式化数据			 $dt = 0;            foreach ($info_list as $key=>$value) 		    {				$ud = $this->fullorderamz->read($value['id']);				$ud['address'] = str_replace("'","’",$ud['address']);				$ud['name'] = str_replace("'","’",$ud['name']);				$customer = $this->customeramz->get_email($ud['email'],$value['shop']);				$customernum = $this->fullorderamz->find_count("email = '".$ud['email']."' and shop = '".$value['shop']."'");				preg_match_all('/[0-9]/u',$ud['phone'],$result);				$numphone = join('',$result[0]);				$customerb = $this->customeramz->find_all("type = 2 and (email = '".$ud['email']."' or address = '".$ud['address']."' or numphone = '".$numphone."')",'*','id desc');				$customerc = $this->customeramz->find_all("type = 1 and shop = '".$ud['shop']."' and address = '".$ud['address']."' and numphone = '".$numphone."'",'*','id desc');				//$a = array_column($customer, 'email'); //三维找其中健的数组			    //$a = array_flip($a); //键和值调换				$lkh = $value['sname'];				$djlkh = 0;$djhmd = 0;				if($customer)				{					if(($customer['type'] == 1 && $customernum > 1))// || $customerc['type'] == 1 && $customerc['num'] > 1					{						$count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';						$lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";						$djlkh = 1;						$djcount = $count;					}					else if(isset($customerc[0]['num']))					{						if($customerc[0]['num'] > 1)						{							$count = $customer['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customer['count'].'"></i>':'';							$lkh = "<p>".$value['sname']."</p><p style='color:#FF3333'>".$count."老客户</p>";							$djlkh = 1;							$djcount = $count;						}					}				}				if($customerb)				{					 $hmsp = $this->shop->read($customerb[0]['shop']);					 $count = $customerb[0]['count']?'<i class="method fa fa-exclamation-circle" data-t="'.$customerb[0]['count'].'"></i>':'';					 $lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'>".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";					 $djhmd = 1;				}				if($djlkh == '1' && $djhmd == '1')				{					$lkh = "<p>".$value['sname']."</p><p style='color:#9900CC'><em style='color:#FF3333'>".$djcount."老客户</em> - ".$count."黑名单</p><p style='color:#9900CC'>来自".$hmsp['shopname']."</p>";				}				$info_list[$key]['sname'] = $lkh;				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				//$info_list[$key]['user'] = $shop['shopuser'];				$warehouse = $this->warehouse->read($value['type']);				$warehousetitle = $warehouse['title'];				if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}				$info_list[$key]['type'] = $warehousetitle;				$typeclass = $this->typeclass->read($value['state']);				$info_list[$key]['state'] = $typeclass['spare'];				$wl = '';				if($value['exstate'] == '99')				{					$wl = '<font style="color:#ccc">未获取到物流信息</font>';				}				else if($value['exstate'] == '1')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已揽收<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '2')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">在途中<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '3')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送中<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '4')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">已签收<font style="display: none">'.$ud['excontent'].'</font></font>';				}				else if($value['exstate'] == '5')				{					$wl = '<font id="wl'.$ud['id'].'" class="lbwlxx">派送异常<font style="display: none">'.$ud['excontent'].'</font></font>';				}				$info_list[$key]['exstate'] = $wl.'<br />';				if($ud['source'] == 1) //线下单用订单时间,其他用付款时间				{					$info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$ud['dtime']).'</p><p>'.date('H:i:s',$ud['dtime']).'</p>';				}				else				{				    $info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']+$dt).'</p><p>'.date('H:i:s',$value['dtime']+$dt).'</p>';				}				if($value['review'] == 1)				{					$info_list[$key]['review'] = "未送审";				}				else if($value['review'] == 2)				{					$info_list[$key]['review'] = "<font style='color:#555'>待审核</font>";				}				else if($value['review'] == 3)				{					$info_list[$key]['review'] = "<font style='color:#f90f4b'>不通过</font>";				}				else if($value['review'] == 4)				{					$info_list[$key]['review'] = "取消重审";				}				else if($value['review'] == 5)				{					$info_list[$key]['review'] = "<font style='color:#2f80f9'>审核通过</font>";				}				else if($value['review'] == 6)				{					$info_list[$key]['review'] = "<font style='color:#2f80f9'>自动通过</font>";				}				if($ud['dlz'] == 1)				{					$dlz = "<p>独立站已更新</p>";				}				else if($ud['dlz'] == 3)				{					$dlz = "<p>不需要更新</p>";				}				else if($ud['dlz'] == 2)				{					$dlz = "<p style='color:#C3C'>独立站更新失败</p>";				}				else				{					$dlz = "";				}				if($value['waybill'] != "")				{					$info_list[$key]['waybill'] = "<p>".$value['waybill']."</p>".$dlz;				}				if($value['express'] != 0)				{				    $express = $this->express->read($value['express']);					$expressservicename = $express['servicename'];				if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}				    $info_list[$key]['express'] = $expressservicename;				}				else				{					$info_list[$key]['express'] = "无";				}				$tly = "";				if($value['clientremarks'] != "")				{					$tly = "<p style='color:#FF3333'>有客户留言</p>";				}				if($value['library'] == 1 && $ud['printtype'] == 3)				{					$info_list[$key]['library'] = "不需要";				}				else if($value['library'] == 1 && $ud['printtype'] != 3)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';				}				if($ud['authorid'] != '' && $ud['authorid'] != 0)				{				    $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>';				}            }			$total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->_Template('fullorderamz_readlist',$this->data);	}			public function _readlistdown()	{		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->get(NULL, TRUE);		if(isset($post['excel']))		{			$shop = $this->input->get('shop',true);			$warehouse = $this->input->get('warehouse',true);			$express = $this->input->get('express',true);			$state = $this->input->get('state',true);			$print = $this->input->get('print',true);			$libraryconfirm = $this->input->get('libraryconfirm',true);			$orderinfo = $this->input->get('orderinfo',true);			$client = $this->input->get('name',true);			$email = $this->input->get('email',true);			$number = $this->input->get('number',true);			$waybill = $this->input->get('waybill',true);			$authorid = $this->input->get('authorid',true);			$sourcecontentid = $this->input->get('sourcecontentid',true);			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);				$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($warehouse)            {                $where  .= " and type = '$warehouse'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($state)            {				$where  .= " and state = '$state'";            }			if($print)            {				$where  .= " and print = '$print'";            }			if($libraryconfirm)            {				$where  .= " and libraryconfirm = '$libraryconfirm'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($client)            {                $where  .= " and client like '%$client%'";            }			if($email)            {                $where  .= " and email = '$email'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($authorid)            {                $where  .= " and authorid = '$authorid'";            }			if($sourcecontentid)            {                $where  .= " and sourcecontentid = '$sourcecontentid'";            }			if($timetk && $timetj)            {				$timetj = $timetj+24*3600;                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "dtime desc";            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'shop,number,orderinfo,dtime,name,express,waybill,email,shipremarks,shouldmoney,orderremarks,librarytime,authorid,sourcecontentid',$order_str);			 //格式化数据			 $dt = 0;            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);				if($value['librarytime'] > 0)				{				    $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);				}				if($value['express'] != 0)				{				    $express = $this->express->read($value['express']);				    $info_list[$key]['express'] = $express['servicename'];				}				else				{					$info_list[$key]['express'] = "无";				}				            }			$title = "订单列表 ".date("Y-m-d");             $titlename = "<table border=1>            <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>            <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>author_id</td>			<td>source_content_id</td>            </tr>            </table>";             $filename = $title.".xls"; 			$tail = "\n";             $this->excel->get_fz2($info_list,$titlename,$filename,$tail);		}	}	//删除	public function _del()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['s']))  		{            $id_arr = $this->input->post('s');            $id_arr =  explode(',',$id_arr);            if(!$id_arr)            {                echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;            }            //循环删除记录            foreach ($id_arr as $v) 		    {                $this->fullorderamz->remove($v);            }            echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));		}    }	//查找商品价格	public function _price()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['data']))  		{            $data = $this->input->post('data');            $data =  explode('-',$data);			$number = '';$num = count($data);            //循环删除记录            for($i=0;$i<$num-1;$i++)		    {				if($data[$i] != 0)				{				    $number=$number.$data[$i];					if($i == 2)				    {					    $number=$number.$data[$num-1];				    }				}            }			$list = $this->productdescribe->get_number($number);			if($list)			{				echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));			}			else			{				$list = array('purchase'=>0,'cost'=>0,'salesprice'=>0);				//echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit;				echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit;			}		}    }		public function _customs()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['e']))  		{			$e = $this->input->post('e');//快递信息			$c = $this->input->post('c');//国家信息            $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"');			$list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"');			$rows = array();			foreach ($data as $key=>$value) 		    {				$detailed = explode('|',trim($value['detailed'],'|'));				//此处未对比重量选择价值,暂直接选择第一条海关价值				$detailed = $this->detailed->read($detailed[0]);				$money = $detailed['customsval'];//找到海关价值			}			foreach ($list as $key=>$value) 		    {				$description = $this->typeclass->read($value['description']);				$list[$key]['title'] = $description['title'];//产品描述名称							}			if(!$data && !$list)			{				echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit;			}			else			{				//$list-title -description 取值				echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true));			}		}    }	public function _express()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['e']))  		{			$e = $this->input->post('e');//快递信息			$c = $this->input->post('c');//国家信息            $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"');			if(!$data)			{				echo json_encode(array('success'=>false));exit;			}			else			{				echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true));			}		}    }	public function _hl()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['cy']))  		{			$hl = 0;			$cy = $this->input->post('cy');//币种ID			$cy = $this->typeclass->read($cy);			$gethl = $this->hl->get_hl();			foreach ($gethl as $v) 		    {				$code = str_replace(" ","",$v['code']);				if($code == $cy['title'])				{					$hl = $v['refePrice']/100;				}							}			echo json_encode(array('msg'=>$hl,'success'=>true));		}    }	public function _operation()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['type']))  		{			$type = $this->input->post('type');			$id = $this->input->post('id');			$msg = $this->input->post('msg');			if($type == 1)//禁止发货			{				$d = $this->fullorderamz->read($id);				if($d['library'] != 1)				{					echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit;				}				if($msg == "")				{					echo json_encode(array('msg'=>'必须填写禁止原因!','success'=>false));exit;				}				if($d['print'] < 3)				{					$a = "订单未打印,";				}				else				{					$a = "";				}				if($this->fullorderamz->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id))        	    {         		    echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           	    	echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}			if($type == 6)//允许发货			{				$d = $this->fullorderamz->read($id);				if($d['library'] > 1)				{					echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;				}				if($d['print'] < 3)				{					$a = "订单未打印,";				}				else				{					$a = "";				}				if($this->fullorderamz->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id))        	    {         		    echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           	    	echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}			if($type == 7)//禁止打印			{				$d = $this->fullorderamz->read($id);				if($d['printtime'] != 0)				{					echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;				}				if($d['library'] > 1)				{					echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;				}				if($d['print'] < 3)				{					$a = "订单未打印,";				}				else				{					$a = "";				}				if($this->fullorderamz->save(array('print'=>1),$id))        	    {         		    echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           	    	echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}			if($type == 8)//允许打印			{				$d = $this->fullorderamz->read($id);				/**				if($d['printtime'] != 0)				{					echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit;				}				**/				if($d['library'] > 1)				{					echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit;				}				if($d['print'] < 3)				{					$a = "订单未打印,";				}				else				{					$a = "";				}				if($d['printtime'] == '0')				{					$bcprint = 2;				}				else				{					$bcprint = 3;				}				if($this->fullorderamz->save(array('print'=>$bcprint,'failed'=>''),$id))        	    {         		    echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           	    	echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}			if($type == 9)//关闭			{				if($this->fullorderamz->save(array('failed'=>''),$id))        	    {         		    echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit;       	 	    }       		    else        	    {           	    	echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}			if($type == 2)//填写运单、修改运单			{				$d = $this->fullorderamz->read($id);				if($d['express'] == 0)				{					echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit;				}				if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1))				{					echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit;				}				$xg = $this->fullorderamz->read($id);				$shop = $this->shop->read($xg['shop']);				$ex = $this->express->read($xg['express']);				$fs = $this->notice->get_ordertatus(216);//216成功状态				if($xg['source'] != 1)				{				    //独立站地址更新订单状态、物流信息				    $gx = $this->api->get_gx(substr($xg['orderinfo'],1),$msg,$xg,$shop,$ex,$xg['msg'],$xg['shopify']);				}				else if($xg['source'] == 1)				{					$gx['res'] = 3;					$gx['state'] = 216;				}				if(!isset($gx['res']))				{					$gx['res'] = 2;					$gx['state'] = $xg['state'];				}				if($gx['res'] > 0 && $fs)				{					$warehouse = $this->warehouse->read($xg['type']);					$ck = $this->_email($fs['content'],$xg,$warehouse['company']);				}				$msg = preg_replace('/( | | | |\s)/','',$msg);				if($this->fullorderamz->save(array('waybill'=>$msg,'state'=>$gx['state'],'dlz'=>$gx['res']),$id))        	    {         		    echo json_encode(array('msg'=>'操作成功','success'=>true));exit;       	 	    }       		    else        	    {           	    	echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}		}    }	public function _merge()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['s']))  		{            $id_arr = $this->input->post('s');            $id_arr =  explode(',',trim( $id_arr,','));			$id_arr = array_reverse($id_arr);            if(!$id_arr)            {                echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;            }			if(count($id_arr) < 2)			{				echo json_encode(array('msg'=>'缺少可合并单!','success'=>false));exit;			}			$post = array();			$u = $this->fullorderamz->read($id_arr[0]);			unset($id_arr[0]);				$this->db->trans_begin();				$hd = $this->fullorderamzhb->get_orderinfo($u['orderinfo']);				if(!$hd)				{					$this->fullorderamzhb->insert($u);				}				//相加				$post['shouldmoney'] = $u['shouldmoney'];//购买应收金额				$post['budget'] = $u['budget'];//预估到帐金额				$post['expressmoney']= $u['expressmoney'];//物流金额				//$post['refundy'] = $u['refundy'];//补/退原额				//$post['refundj'] = $u['refundj'];//补/退净额				$post['cost']  = $u['cost'];//成本金额				//$post['zzl']  = $u['zzl'];//总重量				//$post['zsbjz']  = $u['zsbjz'];//总申报价值				$post['ts']  = $u['ts'];//条数				$post['cost']  = $u['cost'];//成本金额				//追加				$post['rpaypal'] = $u['rpaypal'];//补/退交易号				$post['rtext'] = $u['rtext'];//补/退原因				$post['pay'] = $u['pay'];//付款方式				$post['paypal'] = $u['paypal'];//交易号				$post['clientremarks'] = $u['clientremarks'];//客户留言				$post['product'] = $u['product'];//商品名称				//$post['issku'] = $u['issku'];//sku				//$post['orderremarks'] = $u['orderremarks'];//订单备注				$post['shipremarks'] = $u['shipremarks'];//仓库品名				//产品追加				$post['fpdata'] = $u['fpdata'];//产品内容				$post['whlabel'] = $u['whlabel'];//产品对应库存码								$merge = $u['id'];				$d = array($u['id']);$order = '';				$zsl = 0;$zccsl = 0;				foreach ($id_arr as $v) 		        {					$v = $this->fullorderamz->read($v);					if($u['type'] != $v['type'])					{						echo json_encode(array('msg'=>'仓库不一致,无法合并!','success'=>false));exit;					}					if($v['shop'] = $u['shop'])					{						$hd = $this->fullorderamzhb->get_orderinfo($v['orderinfo']);						if(!$hd)						{							$this->fullorderamzhb->insert($v);						}				        $post['shouldmoney'] += $v['shouldmoney'];//购买应收金额				        $post['budget'] += $v['budget'];//预估到帐金额				        $post['expressmoney'] += $v['expressmoney'];//物流金额				        //$post['refundy'] += $v['refundy'];//补/退原额				        //$post['refundj'] += $v['refundj'];//补/退净额				        $post['cost'] += $v['cost'];//成本金额				        //$post['zzl']  += $v['zzl'];//总重量				        //$post['zsbjz']  += $v['zsbjz'];//总申报价值				        $post['ts']  += $v['ts'];//条数												//$post['rpaypal'] .= $v['rpaypal'];//补/退交易号						//$post['rtext'] .= $v['rtext'];//补/退原因						//$post['pay'] .= (stripos($post['pay'],$v['pay']) !== false)?'':';'.$v['pay'];//付款方式						//$post['paypal'] .= $v['paypal'];//交易号						$post['clientremarks'] .= $v['clientremarks'];//客户留言						$post['product'] .= $v['product'];//商品名称						//$post['issku'] .= $v['issku'];//sku						//$post['orderremarks'] .= $v['orderremarks'];//订单备注						$post['shipremarks'] .= $v['shipremarks'];//仓库品名												$post['fpdata'] .= $v['fpdata'];//产品内容						$post['whlabel'] .= $v['whlabel'];//产品对应库存码											    $d[] = $v['id'];						$order .= $v['orderinfo'].'('.$v['number'].')、';												$wl = $this->whlabel->find_all("zd = '".$v['number']."'");//查找是否有占用库存情况						$i = 0;						if($wl)//如果有那么清除所有占用						{							foreach ($wl as $val)			   			    {								if($val['sku'] == 'Preset' && $val['state'] == '9')								{									$this->whlabel->remove($val['id']);//删除预设									$i++;								}								else								{					    			$this->whlabel->save(array('zd'=>''),$val['id']);//专属									$i++;								}							}						}						$zsl += count($wl);						$zccsl += $i;					    $this->fullorderamz->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']);					}				}				//计算出单条价值				/**				if($post['zsbjz'] < 1 || $post['ts'] < 1)				{					//$post['dtsbjz'] = 0;				}				else				{				    //$post['dtsbjz']  = $post['zsbjz']/$post['ts'];//单条申报价				}				**/				$post['orderremarks'] = '  《合并信息》:由'.rtrim($order,'、').'合并而来; '.$u['orderremarks'];								$post['merge'] = $u['id'];								//$post['mergeid'] = 1;								//合并重复项				//解决whlabel 合并在一起是 多出的那个|				$post['whlabel'] = str_replace("||","|",$post['whlabel']);				$hbcfw = explode('|',trim($post['whlabel'],'|'));				$hbcff = explode(';',trim($post['fpdata'],';'));				$c = 0;				$hbw = array();				$hbf = array();				for($i=0;$i<count($hbcfw);$i++)				{					$w = explode('-',$hbcfw[$i]);					$f = explode('|',$hbcff[$i]);					$w2 = ($w[2]==0)?0:'';					if(!isset($hbw[$w[0].$w2]))					{						$hbw[$w[0].$w2] = $hbcfw[$i];						$hbf[$w[0].$w2] = $hbcff[$i];					}					else					{						$c++;						$cw = explode('-',$hbw[$w[0].$w2]);						$cf = explode('|',$hbf[$w[0].$w2]);						if($cw[2] != 0 && $w[2] != 0)						{							$cf[2] += $f[2];							$cf[9] .= '~'.$f[9];						    $hbf[$w[0].$w2] = implode("|",$cf);						    $cw[1] += $f[2];							$cw[2] .= '~'.$f[9];						    $hbw[$w[0].$w2] = implode("-",$cw);						}						else if($cw[2] == 0 && $w[2] == 0)						{						    $cf[2] += $f[2];						    $hbf[$w[0].$w2] = implode("|",$cf);						    $cw[1] += $f[2];						    $hbw[$w[0].$w2] = implode("-",$cw);						}						else						{							$hbw[] = $hbcfw[$i];						    $hbf[] = $hbcff[$i];						}					}				}				if($c > 0)				{					$post['fpdata'] = implode(";",$hbf).';';					$post['whlabel'] = '|'.implode("|",$hbw).'|';				}				//合并重复项结束								$this->fullorderamz->save($post,$u['id']);				if ($this->db->trans_status() === FALSE)				{				    $this->db->trans_commit();				     echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;				}				else				{				    $this->db->trans_commit();					echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$u['id'],'success'=>true));				}		}	}	//评价管理	public function _evaluate()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$shop = $this->input->post('shop',true);			$where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")";			if($shop)            {                $where  .= " and shop = '$shop'";            }            //数据排序            $order_str = "id desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$info_list[$key]['operation'] = "评价";            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$this->_Template('fullorderamz_evaluate',$this->data);	}		//订单消息	public function _state()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$expressstate = $this->input->post('expressstate',true);			$fs = $this->input->post('fs',true);			$state = $this->input->post('state',true);			$express = $this->input->post('express',true);			$review = $this->input->post('review',true);			$orderinfo = $this->input->post('orderinfo',true);			$number = $this->input->post('number',true);			$waybill = $this->input->post('waybill',true);			$xztime = $this->input->post('xztime',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			if($xztime == 'librarytime')			{				 $order_str = "librarytime desc";			}			else if($xztime == 'dtime')			{				 $order_str = "dtime desc";			}			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($expressstate)            {                    $where  .= " and expressstate = '$expressstate'";            }			if($review)            {                $where  .= " and review = '$review'";            }			if($fs)            {				if($fs == '2')				{				    $where  .= " and exstateerror != ''";				}				else				{					$where  .= " and exstateerror = ''";				}            }			if($state)            {				$where  .= " and state = '$state'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,content,orderremarks,exstateerror',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = $country['name'];				//$state = $this->typeclass->read($value['state']);				//$info_list[$key]['state'] = $state['title'];				if($value['library'] == 1)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = "已出库";				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = "已退库";				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '无';				}				else				{					$info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$notice = $this->notice->find_all("type = '1' and (".rtrim($fgshop,'or').")");		$this->data['notice'] = $notice;		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['express'] = $this->express->find_all();		$this->_Template('fullorderamz_state',$this->data);	}		//物流信息	public function _wl()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$expressstate = $this->input->post('expressstate',true);			$fs = $this->input->post('fs',true);			$state = $this->input->post('state',true);			$express = $this->input->post('express',true);			$orderinfo = $this->input->post('orderinfo',true);			$number = $this->input->post('number',true);			$waybill = $this->input->post('waybill',true);			$wlyc = $this->input->post('wlyc',true);			$wltype = $this->input->post('wltype',true);			$source = $this->input->post('source',true);			$xztime = $this->input->post('xztime',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			if($xztime == 'librarytime')			{				 $order_str = "librarytime desc";			}			else if($xztime == 'dtime')			{				 $order_str = "dtime desc";			}			else if ($xztime == 'wlfstime')			{				$order_str = "wlfstime desc";			}			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($expressstate != '')            {                    $where  .= " and expressstate = '$expressstate'";            }			if($fs)            {				if($fs == '1')				{				    $where  .= " and wlcontent != ''";				}				if($fs == '2')				{				    $where  .= " and wlerror != ''";				}				if($fs == '3')				{				    $where  .= " and wlcontent = '' and shouldmoney > 100";				}				else if($fs == '4')				{				    $where  .= " and wltype = '1'";				}            }			if($state)            {				$where  .= " and state = '$state'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($wlyc!='')            {                $where  .= " and wlyc = '$wlyc'";            }			if($wltype!='')            {                $where  .= " and wltype = '$wltype'";            }			if($source)            {				if($source == 1)				{                    $where  .= " and source = '$source'";				}				else				{					$where  .= " and source != '1'";				}            }			            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,wlcontent,wlerror,excontent,wltype',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$f = $this->fullorderamz->read($value['id']);				$info_list[$key]['number'] = "<p>".$value['number']."</p>"."<p>".$f['email']."</p>";				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = "<p>".$country['name']."</p><p>".$f['phone']."</p>";				//$state = $this->typeclass->read($value['state']);				//$info_list[$key]['state'] = $state['title'];				if($value['library'] == 1)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = "已出库";				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = "已退库";				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '无';				}				else				{					$info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']).'<br>'.$f['shouldmoney'];				}				if($value['expressstate'] == 0)				{					$info_list[$key]['expressstate'] = "无信息";				}				else if($value['expressstate'] == 2)				{					$info_list[$key]['expressstate'] = "已取件";				}				else if($value['expressstate'] == 3)				{					$info_list[$key]['expressstate'] = "在途中";				}				else if($value['expressstate'] == 4)				{					$info_list[$key]['expressstate'] = "到达目的地国".$value['expressstate'];				}				else if($value['expressstate'] == 5)				{					$info_list[$key]['expressstate'] = "即将派送";				}				else if($value['expressstate'] == 6)				{					$info_list[$key]['expressstate'] = "已签收";				}				else if($value['expressstate'] == 1)				{					$info_list[$key]['expressstate'] = "派送异常";				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				if($value['wltype'] == '0')				{				    $info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>禁止发送</b></p>";				}				else				{					$info_list[$key]['wltype'] = "<p class='ckn'><b class='wlfsxx' data-id='".$value['id']."' data-q='1'>允许发送</b></p>";				}				if($f['wlyc'] == '0')				{					$info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='1'>加入异常</b></p>";				}				else if($f['wlyc'] == '1')				{					$info_list[$key]['wltype'] .= "<p class='yc'><b class='wlyc' data-id='".$value['id']."' data-t='2'>物流异常</b></p>";				}				else if($f['wlyc'] == '2')				{					$info_list[$key]['wltype'] .= "<p><b>异常已处理</b></p>";				}				if(stripos($value['excontent'],'<br />') !== false)				{					$excontent = explode('<br />',$value['excontent']);					$info_list[$key]['excontent'] = '<i class="method fa fa-list-ul" data-t="'.$value['excontent'].'"></i> '.$excontent[0];				}            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		if(isset($post['q']))		{			$id = $this->input->post('id',true);			$f = $this->fullorderamz->read($id);		        $wl = ($f['wltype']=='0')?1:0;			    $wltitle = ($f['wltype']=='0')?'已禁发送':'已允发送';			    if($this->fullorderamz->save(array('wltype'=>$wl),$id))			    {				     echo json_encode(array('msg'=>'ckn','id'=>$id,'wltitle'=>$wltitle,'success'=>true));exit;			    }			    else			    {				     echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$wltitle,'success'=>false));exit;			    }		}		if(isset($post['t']))		{			$id = $this->input->post('id',true);			$f = $this->fullorderamz->read($id);			$t = $this->input->post('t',true);			$yc = ($f['wlyc']=='0')?1:2;			$yctitle = ($f['wlyc']=='0')?'物流异常':'异常已处理';			    if($this->fullorderamz->save(array('wlyc'=>$yc),$id))			    {				     echo json_encode(array('msg'=>'yc','id'=>$id,'wltitle'=>$yctitle,'success'=>true));exit;			    }			    else			    {				     echo json_encode(array('msg'=>'失败,请重试','id'=>$id,'wltitle'=>$yctitle,'success'=>false));exit;			    }			}				$notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");		$this->data['notice'] = $notice;		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['express'] = $this->express->find_all();		$this->_Template('fullorderamz_wl',$this->data);	}		//审核订单	public function _review()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$sid .= " id = ".$value." or";			    $fgshop .= " shop = ".$value." or";			}			$fgshop = " and (".rtrim($fgshop,'or').")";		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$source = $this->input->post('source',true);			$warehouse = $this->input->post('warehouse',true);			$express = $this->input->post('express',true);			$orderremarks = $this->input->post('orderremarks',true);			$shop = $this->input->post('shop',true);			$review = $this->input->post('review',true);			$orderinfo = $this->input->post('orderinfo',true);			$shipremarks = $this->input->post('shipremarks',true);			$number = $this->input->post('number',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "mergeid = 0 and state = '207'".$fgshop;			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }			if($source)            {				if($source == '2d')				{					$where  .= " and source >= '2'";				}				else				{                    $where  .= " and source = '$source'";				}            }			if($review)            {                $where  .= " and review = '$review'";            }			else			{				 $where  .= " and ((review = '2' and source = '1') or (review = '1' and source >= '2'))";			}			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($warehouse)            {                $where  .= " and type = '$warehouse'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderremarks)            {                $where  .= " and orderremarks like '%$orderremarks%'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($shipremarks)            {                $where  .= " and shipremarks like '%$shipremarks%'";            }            //数据排序            $order_str = "id desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表             $info_list = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,client,express,dtime,shouldmoney,review,orderremarks');			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$lr = $this->fullorderamz->read($value['id']);				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$warehouse = $this->warehouse->read($value['type']);				$info_list[$key]['type'] = $warehouse['title'];				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$info_list[$key]['dtime'] = '<p>'.date('Y-m-d',$value['dtime']).'</p><p>'.date('H:i:s',$value['dtime']).'</p>';				if($value['review'] == 1)				{					$info_list[$key]['review'] = "未送审";				}				else if($value['review'] == 2)				{					$info_list[$key]['review'] = "待审核";				}				else if($value['review'] == 3)				{					$info_list[$key]['review'] = "不通过";				}				else if($value['review'] == 4)				{					$info_list[$key]['review'] = "取消重审";				}				else if($value['review'] == 5)				{					$info_list[$key]['review'] = "审核通过";				}				else if($value['review'] == 6)				{					$info_list[$key]['review'] = "自动通过";				}				/**				$info_list[$key]['library'] = "";				if($value['review'] == 1)				{					$info_list[$key]['library'] = "<p><b class='focz' data-type='6' data-id='".$value['id']."'>审核通过</b></p>";				}				if($value['review'] == 2)				{					$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>";				}				else if($value['review'] == 3)				{					$info_list[$key]['library'] = "<p><b class='fullorderamzreview' data-type='5' data-id='".$value['id']."'>审核通过</b></p>";				}				else if($value['review'] == 5)				{					$info_list[$key]['library'] = "<p><b class='fullorderamzreview' data-type='3' data-id='".$value['id']."'>不通过</b></p>";				}				$info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle'];				$lr['hl'] = $lr['hl']==0?6.71:$lr['hl'];				$cost = $lr['cost']/$lr['hl'];				$currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney'];				$info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle'];				**/            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['shop'] = $wlshop;		$this->_Template('fullorderamz_review',$this->data);	}			public function _wlbz($arg_array)	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['id']))		{			$id = $this->input->post('id',true);			$post['wlbz'] = $this->input->post('wlbz',true);			if($post['wlbz'] == '')			{				echo json_encode(array('msg'=>'备注不能为空','success'=>false));exit;			}			if($this->fullorderamz->save($post,$id))        	{         		echo json_encode(array('msg'=>'修改成功','id'=>$id,'success'=>true));exit;       	 	}       		else        	{           		echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;        	}		}		$arg_array = $arg_array[0];		$fullorderamz = $this->fullorderamz->read($arg_array);		$this->data['fullorderamz'] = $fullorderamz;		$this->_Template('fullorderamz_wlbz',$this->data);	}			//导出资金统计excel	public function _fmexcel()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		if(isset($_GET['excel']))  		{			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);			$shop = $this->input->get('shop',true);			$source = $this->input->get('source',true);			$state = $this->input->get('state',true);			$type = $this->input->get('type',true);			$orderinfo = $this->input->get('orderinfo',true);			$user = $this->input->get('user',true);			$name = $this->input->get('name',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($source)            {                $where  .= " and source = '$source'";            }			if($state)            {				if($state == 1)				{                    $where  .= " and state = '$state'";				}            }			if($type)            {                $where  .= " and type = '$type'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($user)            {                $where  .= " and user = '$user'";            }			if($name)            {                $where  .= " and name = '$name'";            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle');			 //格式化数据			 $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1;            foreach ($info_list as $key=>$value) 		    {				$info_list[$key]['id'] = $i;								if($value['currencytitle'] != "CNY")				{					$hl=$value['hl'];				}				$shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);				$budget=$budget+($value['budget']*$hl);				$currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl);				$refund=$refund+($value['refund']*$hl);								$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$info_list[$key]['user'] = $shop['shopuser'];				$info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);				$info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = $country['name'];				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];				$info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle'];				$info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle'];				$info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle'];				$fpdata = array();				if(stripos($value['fpdata'],';') !== false)				{		   		    $fpdata = explode(';',rtrim($value['fpdata'],';'));		            foreach ($fpdata as $ke=>$va)		            {			            $v = explode('|',rtrim($va,'|'));					    $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数                    }				}				$info_list[$key]['fpdata'] = $fpdata;				$i++;            }			$data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY');            $title = "订单资金信息";             $titlename = "<table border=1>            <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>            <tr>            <td>NO.</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>            <table border=1>            <tr><td colspan='3' align='center'>订单产品信息</td></tr>            <tr>            <td>产品</td>            <td>条数</td>            <td>数量</td>            </tr>            </table>            </td>			<td>总条数</td>            </tr>            </table>";             $filename = $title.".xls"; 			$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";             $this->excel->get_fz($info_list,$titlename,$filename,$tail);	    }	}	//导出订单excel	public function _fdexcel()	{		if(isset($_GET['excel']))  		{			$page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$source = $this->input->post('source',true);			$state = $this->input->post('state',true);			$review = $this->input->post('review',true);			$express = $this->input->post('express',true);			$orderinfo = $this->input->post('orderinfo',true);			$user = $this->input->post('user',true);			$name = $this->input->post('name',true);			$waybill = $this->input->post('waybill',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0";			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($source)            {                $where  .= " and source = '$source'";            }			if($state)            {				$where  .= " and state = '$state'";            }			if($review)            {                $where  .= " and review = '$review'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($user)            {                $where  .= " and user = '$user'";            }			if($name)            {                $where  .= " and name = '$name'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }            //取得信息列表            $info_list = $this->fullorderamz->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');			 //格式化数据			 $i = 1;$shouldmoney = 0;$hl=1;            foreach ($info_list as $key=>$value) 		    {				$info_list[$key]['id'] = $i;				if($value['source'] == 1)				{					$info_list[$key]['source'] = "线下订单";				}				else if($value['source'] == 2)				{					$info_list[$key]['source'] = "PC订单";				}				else if($value['source'] == 3)				{					$info_list[$key]['source'] = "手机订单";				}								if($value['currencytitle'] != "CNY")				{					$hl=$value['hl'];				}				$shouldmoney=$shouldmoney+($value['shouldmoney']*$hl);								$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']);				$info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']);				$state = $this->typeclass->read($value['state']);				$info_list[$key]['state'] = $state['title'];				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = $country['name'];				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle'];				$fpdata = array();				if(stripos($value['fpdata'],';') !== false)				{		   		    $fpdata = explode(';',rtrim($value['fpdata'],';'));		            foreach ($fpdata as $ke=>$va)		            {			            $v = explode('|',rtrim($va,'|'));					    $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数                    }				}				$info_list[$key]['fpdata'] = $fpdata;				$i++;            }			$data = array($shouldmoney.' CNY');            $title = "订单信息表";             $titlename = "<table border=1>            <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>            <tr>            <td>NO.</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>			<td>快递公司</td>			<td>运单号</td>			<td>订单备注</td>			<td>客户备注</td>            <td>            <table border=1>            <tr><td colspan='3' align='center'>订单产品信息</td></tr>            <tr>            <td>产品</td>            <td>条数</td>            <td>数量</td>            </tr>            </table>            </td>			<td>总条数</td>            </tr>            </table>";             $filename = $title.".xls"; 			$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";             $this->excel->get_fz($info_list,$titlename,$filename,$tail);	    }	}	public function _black()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['bd']))  		{			$bd = $this->input->post('bd',true);			$rows = $this->fullorderamz->read($bd);			$post['shop'] = $rows['shop'];			$post['source'] = 1;			$post['name'] = $rows['client'];			$post['email'] = $rows['email'];			$post['phone'] = $rows['phone'];			$post['country'] = $rows['country'];			$post['money'] = $rows['shouldmoney'];			$post['num'] = 1;			$post['time'] = $rows['dtime'];			$post['province'] = $rows['province'];			$post['city'] = $rows['city'];			$post['street'] = $rows['street'];			$post['address'] = $rows['address'];			$post['address2'] = $rows['address2'];			$post['zipcode'] = $rows['zipcode'];			$post['type'] = 2;			if($this->customeramz->insert($post))        	{				$this->fullorderamz->save(array('black'=>1),$bd);         		echo json_encode(array('msg'=>'操作成功','success'=>true));exit;       	 	}       		else        	{           	    echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	}		}	}	public function _ryf()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['bd']))  		{			$bd = $this->input->post('bd',true);			$d = $this->fullorderamz->read($bd);			if($d['state'] == 207 || $d['state'] == 207)//订单状态为等待发货或等待部分发货才可更改为允许发货			{			    if($d['print'] < 3)//打印状态为未打印			    {				    $print = 1;//未打印				    $libraryconfirm = 1;//不允许出库				    $a = "订单未打印,";			    }			    else//已打印订单			    {				    $libraryconfirm = 2;//允许出库				    $a = "";			    }				if($this->fullorderamz->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))        	    {         		    echo json_encode(array('msg'=>'操作成功','success'=>true));exit;       	 	    }       		    else        	    {           	       echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	    }			}			if($this->fullorderamz->save(array('librarynot'=>$a,'libraryconfirm'=>$libraryconfirm,'print'=>$print),$bd))        	{         		echo json_encode(array('msg'=>'操作失败!订单未非发货状态','success'=>false));exit;       	 	}       		else        	{           	   echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit;        	}		}	}	public function _fsstate()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['s']))  		{            $id_arr = $this->input->post('s');            $id_arr =  explode(',',$id_arr);            if(!$id_arr)            {                echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;            }            foreach ($id_arr as $v) 		    {				$data = $this->fullorderamz->read($v);				$warehouse = $this->warehouse->read($data['type']);				$fs = $this->notice->get_ordertatus($data['state']);				if($fs)				{					$ck = $this->_email($fs['content'],$data,$warehouse['company']);					if($ck == 1)					{						$this->fullorderamz->save(array('fscontent'=>date('Y-m-d H:i:s',time()).'已发送:'.$fs['title'].' - '),$v);					}				}            }			echo json_encode(array('msg'=>'发送完成!','success'=>true));exit;		}	}	public function _power()	{		$user = $this->user->get_api($_SESSION['api']);		$post = $this->input->post(NULL, TRUE);		if(isset($post['id']))  		{			$id = $this->input->post('id',true);			$fullorderamz = $this->fullorderamz->read($id);			$express = $this->express->read($fullorderamz['express']);			$warehouse = $this->warehouse->read($fullorderamz['type']);			if(($warehouse['zd'] == '1' || stripos($fullorderamz['whlabel'],'z|') !== false) && $fullorderamz['library'] == '2')			{				echo json_encode(array('msg'=>'需要先退库释放库存后才可重置!','success'=>false));exit;			}			/**			if($fullorderamz['print'] == '3' && isset($express['iscode']) && ($express['iscode'] == 'ARAMEX' || $express['iscode'] == 'TOLL' || $express['iscode'] == 'FEDEX'))			{			    $lj = $this->ali->get_lj($fullorderamz['number'],2,'订单修改');			    if($lj != '1' && $lj != '订单不存在')			    {				     echo json_encode(array('msg'=>$lj,'success'=>false));exit;			    }			}**/			$warehouse = $this->warehouse->read($fullorderamz['warehouse']);			$typeclass = $this->typeclass->read($fullorderamz['state']);			$express = $this->express->read($fullorderamz['express']);			$printtype = array(1=>'运单',2=>'发货单',3=>'不打印单据');			$teset['number']=$fullorderamz['number'];            $teset['orderinfo']=$fullorderamz['orderinfo'];			$teset['shop']=$fullorderamz['shop'];            $teset['user']=$user['userid'];            $teset['ip']=$this->input->ip_address();            $teset['time']=time();            $teset['warehouse']=(isset($warehouse['title']))?$warehouse['title']:'未选择';            $teset['state']=(isset($typeclass['title']))?$typeclass['spare']:'未选择';            $teset['express']=(isset($express['title']))?$express['servicename']:'未选择';            $teset['printtype']=(isset($printtype[$fullorderamz['printtype']]))?$printtype[$fullorderamz['printtype']]:'未选择';            $teset['reviewtime']=($fullorderamz['reviewtime'] > '0')?date('Y-m-d H:i:s',$fullorderamz['reviewtime']):'无';            $teset['printtime']=($fullorderamz['printtime'] > '0')?date('Y-m-d H:i:s',$fullorderamz['printtime']):'无';            $teset['librarytime']=($fullorderamz['librarytime'] > '0')?date('Y-m-d H:i:s',$fullorderamz['librarytime']):'无';            $teset['shipremarks']=$fullorderamz['shipremarks'];            $teset['fpdata']=$fullorderamz['fpdata'];			$teset['oldwaybill']=$fullorderamz['oldwaybill'];			$teset['oldprinttime']=$fullorderamz['oldprinttime'];			if($fullorderamz['printtype'] == 1)		    {			    if($fullorderamz['waybill'] != '' && stripos($fullorderamz['oldwaybill'],$fullorderamz['waybill']) === false)			    {		            $teset['oldwaybill'] .= '-'.date('Ymd',$fullorderamz['printtime']).'/'.$fullorderamz['waybill'];					$teset['oldprinttime'] .= '-'.$fullorderamz['printtime'];			    }		    }			$review = ($fullorderamz['source']==1)?2:1;//线下单审核状态直接为待审核			if(!$this->fullreset->insert($teset))        	{         		echo json_encode(array('msg'=>'重置失败,请重试','success'=>true));exit;       	 	}						if($this->fullorderamz->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'=>'','oldwaybill'=>$teset['oldwaybill'],'oldprinttime'=>$teset['oldprinttime'],'dlzemail'=>0,'yhs'=>0,'failed'=>''),$id))        	{         		echo json_encode(array('msg'=>'重置成功!如需再次提交,请先保存、再提交','success'=>true));exit;       	 	}       		else        	{           	    echo json_encode(array('msg'=>'重置失败,请重试','success'=>false));exit;        	}		}	}	public function _expresstype()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['id']))  		{            $id = $this->input->post('id',true);            $data =  $this->express->read($id);			echo json_encode(array('msg'=>$data['type'],'success'=>true));exit;		}	}	public function _email($content,$data,$shopname)	{		$express = $this->express->read($data['express']);		$t= array('$userName','$orderid','$trackingNumber','$expressCompany','$contactPerson','$mobileNo','$zip','$recipientAddress');//需要被替换的内容		$h= array($data['client'],$data['orderinfo'],$data['waybill'],$express['servicename'],$data['name'],$data['phone'],$data['zipcode'],$data['address']);//替换的内容		$content = str_replace($t,$h,$content);		$this->load->library('email');				$config['protocol'] = 'smtp';		$config['smtp_host'] = 'smtpdm-ap-southeast-1.aliyun.com';		$config['smtp_port'] = 465; 		$config['smtp_user'] = 'service@email.supernovahair.com';		$config['smtp_pass'] = 'LONGyihair374';		$config['smtp_crypto'] = 'ssl';		$config['crlf'] = "\r\n"; 		$config['newline'] = "\r\n";		$this->email->initialize($config);		$this->email->from('service@email.supernovahair.com',$shopname);		$this->email->to($data['email']);//收件		$this->email->subject('The product you purchased has a new progress');//标题		$this->email->message($content);//内容		if ( ! $this->email->send())        {			return 2;        }		else		{			return 1;		}	}	public function _error()	{		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$orderinfo = $this->input->post('orderinfo',true);			$waybill = $this->input->post('waybill',true);			$number = $this->input->post('number',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "failed !='' and mergeid = 0 and print != 3 and (".rtrim($fgshop,'or').")";			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($timetk && $timetj)            {				$timetj = $timetj+24*3600;                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            $info_list = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,express,failed,operation',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$ud = $this->fullorderamz->read($value['id']);				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorderamz/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";				$warehouse = $this->warehouse->read($value['type']);				$warehousetitle = $warehouse['title'];				if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}				$info_list[$key]['type'] = $warehousetitle;				if($value['express'] != 0)				{				    $express = $this->express->read($value['express']);					$expressservicename = $express['servicename'];				if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}				    $info_list[$key]['express'] = $expressservicename;				}				else				{					$info_list[$key]['express'] = "无";				}				$x = "";				if($ud['review'] >4 && $ud['print'] == 1)				{				    $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";				}				else				{					$x = "<p class='ckn'><b class='fojzof' data-type='9' data-id='".$value['id']."'>关闭</b></p>";				}				$info_list[$key]['operation'] = $x;            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['express'] = $this->express->find_all();		$user = $this->user->get_api($_SESSION['api']);		$powerid = $this->power->read($user['power']);		$powertext = explode('|',trim($powerid['excelid'],'|'));		$pid = '';		foreach ($powertext as $v) 		{			$pid .= " id = ".$v." or";		}		$fullorderexcel = $this->fullorderexcel->find_all("type = '100009' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板		$this->data['fullorderexcel'] = $fullorderexcel;		$this->_Template('fullorderamz_error',$this->data);	}		public function _yc()	{		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$orderinfo = $this->input->post('orderinfo',true);			$waybill = $this->input->post('waybill',true);			$number = $this->input->post('number',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "library = 2 and state = 214 and (".rtrim($fgshop,'or').")";			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($timetk && $timetj)            {				$timetj = $timetj+24*3600;                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            $info_list = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,state,dtime,express,waybill,library,operation',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$ud = $this->fullorderamz->read($value['id']);				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorderamz/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";				$warehouse = $this->warehouse->read($value['type']);				$warehousetitle = $warehouse['title'];				if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}				$info_list[$key]['type'] = $warehousetitle;				if($value['express'] != 0)				{				    $express = $this->express->read($value['express']);					$expressservicename = $express['servicename'];				if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}				    $info_list[$key]['express'] = $expressservicename;				}				else				{					$info_list[$key]['express'] = "无";				}				$typeclass = $this->typeclass->read($value['state']);				$info_list[$key]['state'] = "<font style='font-size: 13px;'>".$typeclass['spare']."</font>";				$info_list[$key]['dtime'] = '<p style="font-size: 13px;">'.date('Y-m-d',$ud['dtime']).'</p><p style="font-size: 13px;">'.date('H:i:s',$ud['dtime']).'</p>';				if($value['library'] == 1 && $ud['printtype'] == 3)				{					$info_list[$key]['library'] = "不需要";				}				else if($value['library'] == 1 && $ud['printtype'] != 3)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['librarytime']).'</p><p>'.date('H:i:s',$ud['librarytime']).'出库</p>';				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = '<p>'.date('Y-m-d',$ud['retreattime']).'</p><p>'.date('H:i:s',$ud['retreattime']).'退库</p>';				}				$info_list[$key]['operation'] = "<p class='ckn'><b class='ycyc' data-id='".$value['id']."'>移 出</b></p>";            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		if(isset($post['id']))		{			$id = $this->input->post('id',true);			$data = $this->fullorderamz->read($id);			if($this->fullorderamz->save(array('state'=>217),$id))			{				echo json_encode(array('msg'=>'移除成功','id'=>$id,'success'=>true));exit;			}			else			{				echo json_encode(array('msg'=>"操作失败请重试",'success'=>false));exit;			}		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['express'] = $this->express->find_all();		$user = $this->user->get_api($_SESSION['api']);		$powerid = $this->power->read($user['power']);		$powertext = explode('|',trim($powerid['excelid'],'|'));		$pid = '';		foreach ($powertext as $v) 		{			$pid .= " id = ".$v." or";		}		$fullorderexcel = $this->fullorderexcel->find_all("type = '100009' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板		$this->data['fullorderexcel'] = $fullorderexcel;		$this->_Template('fullorderamz_yc',$this->data);	}	//验证地址	public function _yzaddress()	{	    $post = $this->input->post(NULL, TRUE);		if(isset($post['address']))		{			$address = $this->input->post('address',true);			$address2 = $this->input->post('address2',true);			$city = $this->input->post('city',true);			$province = $this->input->post('province',true);			$zipcode = $this->input->post('zipcode',true);			$barcode = $this->usps->get_address(array('address'=>$address,'address2'=>$address2,'city'=>$city,'province'=>$province,'zipcode'=>$zipcode));			echo $barcode;		}	}	//清除退货信息	public function _clearreturn()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['orderinfo']))		{			$orderinfo = $this->input->post('orderinfo',true);			$data = $this->fullorderamz->get_orderinfo($orderinfo);			$fu = 'fullorderamz';			if(!$data)			{				$data = $this->fullorder_smt->get_orderinfo($orderinfo);				$fu = 'fullorder_smt';			}		    $this->$fu->save(array('library'=>'2','retreattime'=>'0','returndata'=>''),$data['id']);			echo json_encode(array('msg'=>'清除成功!','success'=>true));exit;		}	}		//订单退货	public function _return()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['orderinfo']))		{			$orderinfo = $this->input->post('orderinfo',true);			$data = $this->fullorderamz->get_orderinfo($orderinfo);			$fu = 'fullorderamz';			if(!$data)			{				$data = $this->fullorder_smt->get_orderinfo($orderinfo);				$fu = 'fullorder_smt';			}			$bctime = date('Ymd',time());			if($data['returndata'] != "")			{				echo json_encode(array('msg'=>'请求失败,已有Return Label信息!','success'=>false));exit;			}			$barcode = $this->usps->get_return($data);			if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription']))			{				echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit;			}			else if(isset($barcode['TrackingNumber']))			{				$pdf = $this->_pdf($barcode['ReturnLabel'],'t-'.$barcode['TrackingNumber'],$bctime);				$read = 'PostalRouting:'.$barcode['PostalRouting'].' - TrackingNumber:<a href="/data/pdf/'.$bctime.'/'.'t-'.$barcode['TrackingNumber'].'.pdf" target="_blank">'.$barcode['TrackingNumber'].'</a>';				$this->$fu->save(array('returndata'=>$read),$data['id']);			 	echo json_encode(array('msg'=>'生成Return Label成功!','data'=>$read,'success'=>true));exit;			}			else			{				echo json_encode(array('msg'=>'请求失败,请稍后重试!','cs'=>$barcode,'success'=>false));exit;			}		}	}	public function _pdf($pdf,$title,$bctime)    {    	$pdf_path = './data/pdf/'.$bctime.'/';        $file_base64 = $pdf;         $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);          $file_base64 = base64_decode($file_base64);		if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建        file_put_contents($pdf_path.$title.'.pdf',$file_base64);		return $bctime;    }		public function _find($find)    {		preg_match_all('/\d+/',$find,$n);		$a = '';		foreach($n[0] as $v)		{			$a .= $v;		}		return $a;	}	public function _dqpm()    {		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }			//数据排序            $order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }			$continentdata = '';			$continent = array();//陆地板块			$num = $this->fullorderamz->find_count($where);//订单总数量			$country = $this->country->find_all('1=1','id,continent,ename,zname');			foreach ($country as $k=>$v) 		    {				$tc = $this->typeclass->read($v['continent']);				$continent[$v['continent']] = array(0=>$tc['title'],1=>0,2=>'');		    }			foreach ($country as $k=>$v) 		    {                $n = $this->fullorderamz->find_count($where.' and country = "'.$v['id'].'"');				$country[$k]['continent'] = $continent[$v['continent']][0];//此国家数量				$country[$k]['zname'] = '<a href="/fullorderamz/dqpmprovince/'.$v['id'].'/'.$timetk.'/'.$timetj.'">'.$v['zname'].'</a>';//此国家数量                $country[$k]['num'] = $n;//此国家数量				$country[$k]['zb'] = (sprintf("%.4f",$n/$num)*100).'%';//此国家占比				$continent[$v['continent']]['1'] += $n;//此洲数量增加;			}			array_multisort(array_column($continent, '1'), SORT_DESC, $continent);			array_multisort(array_column($country, 'num'), SORT_DESC, $country);			foreach ($continent as $k=>$v) 		    {				$continentdata .= $v['0'].' 总量:'.$v['1'].' 占比:'.(sprintf("%.4f",$v['1']/$num)*100).'%   -   ';		    }			echo json_encode(array('ewnr'=>$continentdata,'rows'=>$country,'total'=>count($country),'over'=>0,'pagenum'=>1,'success'=>true));exit;		}		$this->_Template('fullorderamz_dqpm',$this->data);	}	public function _dqpmprovince($arg_array)    {		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{			$country = $this->input->post('country',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";			$province = array();			$city_list = $this->fullorderamz->find_all($where,'id,province');			$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');			foreach ($city_list as $k=>$v) 			{				$v['province'] = strtoupper(trim($v['province'],' '));				if(isset($ToState[$v['province']]))				{					$v['province'] = $ToState[$v['province']];				}				if(!isset($province[$v['province']]))				{					$province[$v['province']] = array('id'=>$v['id'],'province'=>'<a href="/fullorderamz/ddpmdata/'.$country.'/'.$timetk.'/'.$timetj.'/'.strtoupper($v['province']).'">'.$v['province'].'</a>','num'=>0,'zb'=>'');				}				$province[$v['province']]['num'] += 1;							}			array_multisort(array_column($province, 'num'), SORT_DESC, $province);			$province = array_values($province);			foreach ($province as $k=>$v) 		    {				$province[$k]['zb'] = (sprintf("%.4f",$v['num']/count($city_list))*100).'%';		    }			echo json_encode(array('rows'=>($province),'total'=>count($province),'over'=>0,'pagenum'=>1,'success'=>true));exit;		}		$this->data['arg_array'] = $arg_array;		$this->_Template('fullorderamz_dqpmprovince',$this->data);	}	public function _ddpmdata($arg_array)    {		$arg_array[3] = str_replace('%20',' ',$arg_array[3]);		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))		{			$page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$province = $this->input->post('province',true);			$timetk = $this->input->post('timetk',true);;			$timetj = $this->input->post('timetj',true);;			$country = $this->input->post('country',true);;			$where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";			if($province)            {                $where  .= " and province = '$province'";            }			$order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }			$info_list = $this->fullorderamz->find_all($where,'id,orderinfo,number,shipremarks,shouldmoney',$order_str,$start,$perpage);			$total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$province = array();		$city_list = $this->fullorderamz->find_all("mergeid = 0 and dtime > '$arg_array[1]' and dtime < '$arg_array[2]' and country = '$arg_array[0]' and (".rtrim($fgshop,'or').")",'province');		$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');		foreach ($city_list as $k=>$v) 		{			$v['province'] = strtoupper(trim($v['province'],' '));			if(isset($ToState[$v['province']]))			{				$v['province'] = $ToState[$v['province']];			}			$province[$v['province']] = array('province'=>$v['province']);		}		$this->data['province'] = $province;		$this->data['arg_array'] = $arg_array;		$this->_Template('fullorderamz_ddpmdata',$this->data);	}	public function _ddpmexcel($arg_array)    {		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}			$province = $this->input->get('province',true);			$timetk = $arg_array[1];			$timetj = $arg_array[2];			$country = $arg_array[0];			$where = "mergeid = 0 and dtime > '$timetk' and dtime < '$timetj' and country = '$country' and (".rtrim($fgshop,'or').")";			if($province)            {                $where  .= " and province = '$province'";            }			$order_str = "dtime desc";			$info_list = $this->fullorderamz->find_all($where,'orderinfo,number,shipremarks,shouldmoney',$order_str);			$country = $this->country->read($arg_array[0]);			$title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);             $titlename = "<table border=1>            <tr><th colspan='4' align='left'><h3>".$title."<h3></th></tr>            <tr>            <td>订单号</td>            <td>订单编号</td>            <td>仓库品名</td>            <td>订单金额</td>            </tr>            </table>";             $filename = $title.".xls"; 			$tail = "\n";            $this->excel->get_fz2($info_list,$titlename,$filename,$tail);	}		public function _statedc()    {		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->get(NULL, TRUE);		if(isset($post['timetk']))  		{		    $page = $this->input->get('page',true);		    $perpage = $this->input->get('perpage',true);			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);			$shop = $this->input->get('shop',true);			$source = $this->input->get('source',true);			$state = $this->input->get('state',true);			$review = $this->input->get('review',true);			$express = $this->input->get('express',true);			$fs = $this->input->get('fs',true);			$orderinfo = $this->input->get('orderinfo',true);			$number = $this->input->get('number',true);			$user = $this->input->get('user',true);			$name = $this->input->get('name',true);			$waybill = $this->input->get('waybill',true);			$expressstate = $this->input->get('expressstate',true);			$wltype = $this->input->get('wltype',true);			$wlyc = $this->input->get('wlyc',true);			$xztime = $this->input->get('xztime',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			if($xztime == 'librarytime')			{				 $order_str = "librarytime desc";			}			else if($xztime == 'dtime')			{				 $order_str = "dtime desc";			}			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($source)            {				if($source == 11)				{					$where  .= " and source != '1'";				}				else				{                    $where  .= " and source = '$source'";				}            }			if($fs)            {				if($fs == '2')				{				    $where  .= " and exstateerror != ''";				}				else				{					$where  .= " and exstateerror = ''";				}            }			if($state)            {				$where  .= " and state = '$state'";            }			if($review)            {                $where  .= " and review = '$review'";            }			if($expressstate != "")            {                $where  .= " and expressstate = '$expressstate'";            }			if($wltype != "")            {                $where  .= " and wltype = '$wltype'";            }			if($wlyc != "")            {                $where  .= " and wlyc = '$wlyc'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($user)            {                $where  .= " and user = '$user'";            }			if($name)            {                $where  .= " and name = '$name'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }                        if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'shop,number,country,library,librarytime,expressstate,express,waybill,content,exstateerror,excontent',$order_str);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = $country['name'];				//$state = $this->typeclass->read($value['state']);				//$info_list[$key]['state'] = $state['title'];				if($value['library'] == 1)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = "已出库";				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = "已退库";				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '无';				}				else				{					$info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);				}				if($value['expressstate'] == 0)				{					$info_list[$key]['expressstate'] = "无信息";				}				else if($value['expressstate'] == 2)				{					$info_list[$key]['expressstate'] = "已取件";				}				else if($value['expressstate'] == 3)				{					$info_list[$key]['expressstate'] = "在途中";				}				else if($value['expressstate'] == 4)				{					$info_list[$key]['expressstate'] = "到达目的地国";				}				else if($value['expressstate'] == 5)				{					$info_list[$key]['expressstate'] = "即将派送";				}				else if($value['expressstate'] == 6)				{					$info_list[$key]['expressstate'] = "已签收";				}				else if($value['expressstate'] == 1)				{					$info_list[$key]['expressstate'] = "派送异常";				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];            }		}			$title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);             $titlename = "<table border=1>            <tr>            <td>店铺名称</td>            <td>编号</td>            <td>收件人国家</td>            <td>出库状态</td>            <td>发货时间</td>            <td>物流状态</td>            <td>快递公司</td>            <td>运单号</td>            <td>消息状态</td>            <td>错误提示</td>            <td>物流信息</td>            </tr>            </table>";             $filename = $title.".xls"; 			$tail = "\n";            $this->excel->get_fz2($info_list,$titlename,$filename,$tail);	}		public function _statedcwl()    {		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->get(NULL, TRUE);		if(isset($post['timetk']))  		{			$dowid = $this->input->get('a');			$wid = "";			if($dowid != "")			{				$id_arr =  explode(',',rtrim($dowid,','));				$wid  .= " id = 0 or";				foreach ($id_arr as $v) 		        {                    $wid  .= " id = '$v' or";                }				$wid = " and".rtrim($wid,'or');			}		    $page = $this->input->get('page',true);		    $perpage = $this->input->get('perpage',true);			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);			$shop = $this->input->get('shop',true);			$expressstate = $this->input->get('expressstate',true);			$fs = $this->input->get('fs',true);			$state = $this->input->get('state',true);			$express = $this->input->get('express',true);			$orderinfo = $this->input->get('orderinfo',true);			$number = $this->input->get('number',true);			$waybill = $this->input->get('waybill',true);			$wlyc = $this->input->get('wlyc',true);			$wltype = $this->input->get('wltype',true);			$source = $this->input->get('source',true);			$xztime = $this->input->get('xztime',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			if($xztime == 'librarytime')			{				 $order_str = "librarytime desc";			}			else if($xztime == 'dtime')			{				 $order_str = "dtime desc";			}			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($expressstate)            {                    $where  .= " and expressstate = '$expressstate'";            }			if($fs)            {				if($fs == '1')				{				    $where  .= " and wlcontent != ''";				}				if($fs == '2')				{				    $where  .= " and wlerror != ''";				}				if($fs == '3')				{				    $where  .= " and wlcontent = '' and shouldmoney > 100";				}				else if($fs == '4')				{				    $where  .= " and wltype = '1'";				}            }			if($state)            {				$where  .= " and state = '$state'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($wlyc!='')            {                $where  .= " and wlyc = '$wlyc'";            }			if($wltype!='')            {                $where  .= " and wltype = '$wltype'";            }			if($source)            {				if($source == 1)				{                    $where  .= " and source = '$source'";				}				else				{					$where  .= " and source != '1'";				}            }			 $info_list = $this->fullorderamz->find_all($where.$wid,'orderinfo,number,country,library,librarytime,expressstate,express,waybill,wlbz,orderremarks,shipremarks,wlfstime,email,phone,wlcontent,wlerror,excontent',$order_str);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = $country['name'];				//$state = $this->typeclass->read($value['state']);				//$info_list[$key]['state'] = $state['title'];				if($value['library'] == 1)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = "已出库";				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = "已退库";				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '无';				}				else				{					$info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']);				}				if($value['expressstate'] == 0)				{					$info_list[$key]['expressstate'] = "无信息";				}				else if($value['expressstate'] == 2)				{					$info_list[$key]['expressstate'] = "已取件";				}				else if($value['expressstate'] == 3)				{					$info_list[$key]['expressstate'] = "在途中";				}				else if($value['expressstate'] == 4)				{					$info_list[$key]['expressstate'] = "到达目的地国";				}				else if($value['expressstate'] == 5)				{					$info_list[$key]['expressstate'] = "即将派送";				}				else if($value['expressstate'] == 6)				{					$info_list[$key]['expressstate'] = "已签收";				}				else if($value['expressstate'] == 1)				{					$info_list[$key]['expressstate'] = "派送异常";				}				$info_list[$key]['wlfstime'] = date('Y-m-d H:i:s',$value['wlfstime']);				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$info_list[$key]['excontent'] = str_replace('<br />','',$value['excontent']);            }		}			$title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);             $titlename = "<table border=1>            <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>物流信息</td>            </tr>            </table>";             $filename = $title.".xls"; 			$tail = "\n";            $this->excel->get_fz2($info_list,$titlename,$filename,$tail);	}			public function _waybillemail()	{		$user = $this->user->get_api($_SESSION['api']);		if($user)		{		    $fgshop = "";$sid = "";		    $user = explode('|',trim($user['shop'],'|'));			foreach ($user as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$expressstate = $this->input->post('expressstate',true);			$fs = $this->input->post('fs',true);			$state = $this->input->post('state',true);			$express = $this->input->post('express',true);			$orderinfo = $this->input->post('orderinfo',true);			$number = $this->input->post('number',true);			$waybill = $this->input->post('waybill',true);			$dlzemail = $this->input->post('dlzemail',true);			$xztime = $this->input->post('xztime',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			$order_str = $xztime." desc";			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($expressstate)            {                    $where  .= " and expressstate = '$expressstate'";            }			if($state)            {				$where  .= " and state = '$state'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($dlzemail != '')            {                $where  .= " and dlzemail = '$dlzemail'";            }            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,country,library,librarytime,express,waybill,dlzemail,dlzemailtime',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$country = $this->country->read($value['country']);				$info_list[$key]['country'] = $country['name'];				//$state = $this->typeclass->read($value['state']);				//$info_list[$key]['state'] = $state['title'];				if($value['library'] == 1)				{					$info_list[$key]['library'] = "未出库";				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = "已出库";				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = "已退库";				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '无';				}				else				{					$info_list[$key]['librarytime'] = date('Y-m-d',$value['librarytime']).'<br>'.date('H:i:s',$value['librarytime']);				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				if($value['dlzemail'] == '1')				{				    $info_list[$key]['dlzemail'] = '发送成功';				}				else if ($value['dlzemail'] == '2')				{					$info_list[$key]['dlzemail'] = '发送失败';				}				else				{					$info_list[$key]['dlzemail'] = '';				}				$info_list[$key]['dlzemailtime'] = ($value['dlzemailtime']>0)?date('Y-m-d H:i:s',$value['dlzemailtime']):'';            }		    $total = $this->fullorderamz->find_count($where);		    $pagenum = ceil($total/$perpage);		    $over = $total-($start+$perpage);		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));		    echo json_encode($rows);exit;		}		$notice = $this->notice->find_all("type = '2' and (".rtrim($fgshop,'or').")");		$this->data['notice'] = $notice;		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['express'] = $this->express->find_all();		$this->_Template('fullorderamz_waybillemail',$this->data);	}			public function _khdd()	{		$dt = 0;$fgshop = "shop = 0";$sid = 'id = 0';		if(isset($_SESSION['api']))		{			$user = $this->user->get_api($_SESSION['api']);			$usp = $user;		    $fgshop = "";$sid = "";		    $usersp = explode('|',trim($user['shop'],'|'));			foreach ($usersp as $value) 		    {				$fgshop .= " shop = ".$value." or";				$sid .= " id = ".$value." or";			}			if($user['vip'] == 1)			{				$vip = 1;			}			else			{				$vip = 0;			}		}		$post = $this->input->post(NULL, TRUE);		if(isset($_GET['excel']))		{		    $page = $this->input->get('page',true);		    $perpage = $this->input->get('perpage',true);			$warehouse = $this->input->get('warehouse',true);			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);			$shop = $this->input->get('shop',true);			$source = $this->input->get('source',true);			$state = $this->input->get('state',true);			$review = $this->input->get('review',true);			$type = $this->input->get('type',true);			$express = $this->input->get('express',true);			$orderinfo = $this->input->get('orderinfo',true);			$user = $this->input->get('user',true);			$client = $this->input->get('name',true);			$waybill = $this->input->get('waybill',true);			$number = $this->input->get('number',true);			$email = $this->input->get('email',true);			$phone = $this->input->get('phone',true);			$dlz = $this->input->get('dlz',true);			$print = $this->input->get('print',true);			$library = $this->input->get('library',true);			$js = $this->input->get('js',true);			$exstate = $this->input->get('exstate',true);			$xztime = $this->input->get('xztime',true);			$libraryconfirm = $this->input->get('libraryconfirm',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$plorder = $this->input->get('pl',true);			$paypal = $this->input->get('paypal',true);			$zf = $this->input->get('zf',true);			$pay = $this->input->get('pay',true);			$excel = $this->input->get('excel',true);			$where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")";			if($warehouse)            {                $where  .= " and type = '$warehouse'";            }			if($timetk && $timetj)            {                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($source)            {				if($source == '2d')				{					$where  .= " and source >= '2'";				}				else				{                    $where  .= " and source = '$source'";				}            }			if($state)            {				$where  .= " and state = '$state'";            }			if($review)            {                $where  .= " and review = '$review'";            }			if($type)            {                $where  .= " and type = '$type'";            }			if($express)            {                $where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($user)            {                $where  .= " and user = '$user'";            }			if($client)            {                $where  .= " and client like '%$client%'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($email)            {                $where  .= " and email = '$email'";            }			if($phone)            {                $where  .= " and phone like '%$phone%'";            }			if($library)            {                $where  .= " and library = '$library'";            }			if($print)            {                $where  .= " and print = '$print'";            }			if($dlz != '')            {                $where  .= " and dlz = '$dlz'";            }			if($js)            {                $where  .= " and js = '$js'";            }			if($exstate)            {                $where  .= " and exstate = '$exstate'";            }			if($libraryconfirm)            {                $where  .= " and libraryconfirm = '$libraryconfirm'";            }			if($paypal)            {                $where  .= " and paypal = '$paypal'";            }			if($pay)            {                $where  .= " and pay = '$pay'";            }			if($zf)            {				if($zf == 1)				{                    $where  .= " and paypal not like '%-%-%-%'";				}				else				{					$where  .= " and paypal like '%-%-%-%'";				}            }			if($plorder)            {				$plorderinfo = '';$plnumber = '';$pln = 0;				$plorder = explode(',',trim($plorder,','));				foreach ($plorder as $value) 		    	{					if(is_numeric($value))					{					    $plorderinfo .= " orderinfo = ".$value." or";					}					else if($value != '')					{						$plorderinfo .= " number = '".$value."' or";					}				}				if($pln > 0)				{                    $where  .= "  and (".rtrim($plorderinfo,'or').")  and (".rtrim($plnumber,'or').")";				}				else				{					 $where  .= "  and (".rtrim($plorderinfo,'or').")";				}            }            //数据排序            $order_str = "dtime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            if($excel == '1')			{				$shop = array();			    $shopdata = $this->shop->find_all("type = '269'");			    foreach ($shopdata as $v) 		        {				    $shop[$v['id']] = array('t'=>$v['brandname'],'z'=>0,'l'=>0,'x'=>0);//店铺名称,总客户,老客户,新客户			    }				$oldnumber = 0;$newnumber = 0;                $info_list = $this->db->query('select distinct shop,email from crowd_fullorderamz where '.$where)->result_array();				foreach ($info_list as $key=>$v) 		        {					$shop[$v['shop']]['z'] += 1; 					$num = $this->fullorderamz->find_count("email = '".$v['email']."' and shop = '".$v['shop']."' and ".$xztime." < '$timetj'");					if($num > 1)					{						$shop[$v['shop']]['l'] += 1; 					}					else					{						$shop[$v['shop']]['x'] += 1; 					}					if(isset($v['email']) && $usp['excelpass'] == '1')					{						$emailpass = $this->setting->get_excelpass($v['email']);						$info_list[$key]['email'] = $emailpass;					}				}				$title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);             	$titlename = "<table border=1>            	<tr>				<td>店铺</td>            	<td>客户数</td>            	<td>老客户数</td>            	<td>新客户数</td>            	</tr>            	</table>";             	$filename = $title.".xls"; 				$tail = "\n";            	$this->excel->get_fz2($shop,$titlename,$filename,$tail);			}			else if($excel == '2' || $excel == '3')			{				$kh = array();                $info_list = $this->db->query('select distinct shop,email from crowd_fullorderamz where email != "" and '.$where)->result_array();				foreach ($info_list as $key=>$v) 		        {					$k = $this->fullorderamz->find_all("shop = '".$v['shop']."' and email = '".$v['email']."' and ".$xztime." < '$timetj'",'name,email,dtime,shouldmoney','dtime desc');					if($excel == 2 && count($k) > 1)					{						$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')));					}					if($excel == 3 && count($k) < 2)					{						$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')));					}					if(isset($v['email']) && $usp['excelpass'] == '1')					{						$emailpass = $this->setting->get_excelpass($v['email']);						$info_list[$key]['email'] = $emailpass;					}				}				$title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);             	$titlename = "<table border=1>            	<tr>            	<td>名称</td>            	<td>邮箱</td>            	<td>最后购买时间</td>				<td>购买次数</td>				<td>购买总额</td>            	</tr>            	</table>";             	$filename = $title.".xls"; 				$tail = "\n";            	$this->excel->get_fz2($kh,$titlename,$filename,$tail);			}			else if($excel == '4' || $excel == '5')			{				$kh = array();                $info_list = $this->db->query('select distinct shop,email from crowd_fullorderamz where email != "" and '.$where)->result_array();				foreach ($info_list as $key=>$value) 		        {					$k = $this->fullorderamz->find_all("shop = '".$value['shop']."' and email = '".$value['email']."' and ".$xztime." < '$timetj'",'orderinfo,state,product,name,email,dtime,shouldmoney','dtime desc');					if($excel == 4 && count($k) > 1)					{						foreach ($k as $v) 		                {							$typeclass = $this->typeclass->read($v['state']);						    $kh[] = array($v['orderinfo'],$typeclass['spare'],$v['product'],$v['name'],$v['email'],date("Y-m-d H:i:s",$v['dtime']),$v['shouldmoney']);						}					}					if($excel == 5 && count($k) < 2)					{						if(!isset($k[0]['state']))						{						    $typeclass = $k[0]['state'].'-数据字典无此信息';						}						else						{							$typeclass = $this->typeclass->read($k[0]['state']);						}						$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']);					}					if(isset($value['email']) && $usp['excelpass'] == '1')					{						$emailpass = $this->setting->get_excelpass($value['email']);						$info_list[$key]['email'] = $emailpass;					}				}				$title = $country['zname'].date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj);             	$titlename = "<table border=1>            	<tr>            	<td>订单号</td>            	<td>订单状态</td>            	<td>产品名</td>				<td>客户名</td>				<td>客户邮箱</td>				<td>下单时间</td>				<td>订单金额</td>            	</tr>            	</table>";             	$filename = $title.".xls"; 				$tail = "\n";            	$this->excel->get_fz2($kh,$titlename,$filename,$tail);			}		}	}		public function _klarnadata()    {		$post = $this->input->post(NULL, TRUE);		if(isset($post['number']))  		{			$number = $this->input->post('number',true);			$data = $this->fullorderamz->get_number($number);			$shop = $this->shop->read($data['shop']);			$f = '';			if($data['pay'] == '23')			{		        $url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$data['paypal'];		        $header[] = "Content-Type:application/json";                $header[] = "Authorization: Basic ".base64_encode($shop['klarnaname'].":".$shop['klarnapass']);                $ch = curl_init();                curl_setopt($ch, CURLOPT_URL, $url);                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                curl_setopt($ch, CURLOPT_HTTPHEADER, $header);                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);                $res = curl_exec($ch);                curl_close($ch);		        $res = json_decode($res,true);		        if(isset($res['fraud_status']) && $shop['klarnaname'] != '')		        {		            $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'];		        }			}			else if($data['pay'] == '22' && $shop['paypalname'] != '')			{				$f = $this->paypal->data($data['paypal'],$shop);			}			else if(($data['pay'] == '26') && $shop['afterpayname'] != '')			{		       $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];		       $header[] = "Accept:application/json";		       $header[] = "User-Agent: Readme.io API Simulator'";               $header[] = "Authorization: Basic ".base64_encode($shop['afterpayname'].":".$shop['afterpaypass']);               $ch = curl_init();               curl_setopt($ch, CURLOPT_URL, $url);               curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);               curl_setopt($ch, CURLOPT_HTTPHEADER, $header);               curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);               curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);               $res = curl_exec($ch);               curl_close($ch);		       $res = json_decode($res,true);		       if(isset($res['results'][0]['orderDetails']['consumer']['email']))		       {			       $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'];				   $f = str_replace(',,',',',$f);		       }			}			else if(($data['pay'] == '27') && $shop['clearpayname'] != '')			{		       $url = 'https://global-api.afterpay.com/v2/payments?ids='.$data['paypal'];		       $header[] = "Accept:application/json";		       $header[] = "User-Agent: Readme.io API Simulator'";               $header[] = "Authorization: Basic ".base64_encode($shop['clearpayname'].":".$shop['clearpaypass']);               $ch = curl_init();               curl_setopt($ch, CURLOPT_URL, $url);               curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);               curl_setopt($ch, CURLOPT_HTTPHEADER, $header);               curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);               curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);               $res = curl_exec($ch);               curl_close($ch);		       $res = json_decode($res,true);		       if(isset($res['results'][0]['orderDetails']['consumer']['email']))		       {			       $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'];				   $f = str_replace(',,',',',$f);		       }			}			else if($data['pay'] == '1211')			{				$url = 'https://api.stripe.com/v1/payment_intents/'.$data['paypal'];                $header[] = "Authorization:Bearer ".$shop['stripe'];                $ch = curl_init();                curl_setopt($ch, CURLOPT_URL, $url);                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                curl_setopt($ch, CURLOPT_HTTPHEADER, $header);                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);                $res = curl_exec($ch);                curl_close($ch);		        $res = json_decode($res,true);		        $f = '';		        if(isset($res['shipping']['name']))		        {					$line = ($res['shipping']['address']['line2'] != '')?$res['shipping']['address']['line1'].' '.$res['shipping']['address']['line2']:$res['shipping']['address']['line1'];		            $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));		        }			}			else			{				echo json_encode(array('msg'=>'此店铺没有对接信息','success'=>false));exit;			}			if($f != '')			{				if($this->fullorderamz->save(array('klarnadata'=>$f),$data['id']))				{					echo json_encode(array('msg'=>'获取成功,请关闭此页重新打开','success'=>true));exit;				}				else				{					echo json_encode(array('msg'=>'写入失败,请重试','success'=>false));exit;				}			}			else			{				echo json_encode(array('msg'=>'获取失败,请稍后重试','cl'=>base64_encode($shop['afterpayname'].":".$shop['afterpaypass']),'a'=>$data['paypal'],'success'=>false));exit;			}		}	}		 public function _kcyz($warehouse,$whlabel,$id,$shop,$number)	{			if(!$whlabel || $whlabel == '|')			{				return array('t'=>1,'m'=>json_encode(array('t'=>1,'msg'=>'请先添加产品信息!','success'=>false)));exit;			}			$w = $this->warehouse->read($warehouse);			if($w['zd'] != 1)			{				return 1;			}			$pp = explode('|',trim($whlabel,'|'));			$x = 0;$save = array();			foreach ($pp as $va)			{				$num = explode('-',$va);				if($number)				{				    $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 = '')");//通用				    $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and (zd = '$number' or zd = '') and shop like '%,".$shop.",%'");//专属				}				else				{					$whlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and (shop IS NULL or shop = '')");//通用				    $shopwhlabel = $this->whlabel->find_all("state = 0 and number = '$num[0]' and warehouse = '$warehouse' and zd = '' and shop like '%,".$shop.",%'");//专属				}				$x++;				if(count($whlabel)+count($shopwhlabel) < $num[1])				{					$save[] = $x-1;continue;//提前先加X不然出错,所以要减1				}			}			return $save;		}		public function _epod()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['number']))  		{			$number = $this->input->post('number',true);			$data = $this->fullorderamz->get_number($number);			if(is_file('./data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf'))			{				 echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].'/data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf','success'=>true));exit;			}	        else			{			    $epod = $this->dhl->get_epod($data);			    if($epod['c'] == 1)			    {					echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].$epod['d'],'success'=>true));exit;			    }			    else			    {					echo json_encode(array('msg'=>$epod['d'],'success'=>false));exit;			    }		    }		}	}		public function _zw($arg_array)	{	   $arg_array = $arg_array[0];$fpdata = array();		$fullorderamz = $this->fullorderamz->read($arg_array);		$fullorderamz['shipremarks'] = str_replace(array('<','>'),array('<','>'),$fullorderamz['shipremarks']);		$fullorderamz['parameter'] = str_replace(",","---",$fullorderamz['parameter']);		$this->data['fullorderamz'] = $fullorderamz;		$this->data['countrys'] = $this->country->find_all();		$this->data['express'] = $this->express->find_all();		$warehouse = $this->warehouse->read($fullorderamz['type']);		if(stripos($fullorderamz['fpdata'],';') !== false)		{		    $fpdata = explode(';',rtrim($fullorderamz['fpdata'],';'));		    foreach ($fpdata as $k=>$v) 		    {			    $xxv = explode('|',$v);				if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1)				{					$xxv['zd'] = "<p>已占单</p>";					$bdck = $warehouse['bdck'];					if(stripos($xxv[9],'~') !== false)					{						$dxxv = explode('~',trim($xxv[9],'~'));						foreach ($dxxv as $val) 		                {					    	$wzid = $this->$bdck->read(trim($val,$warehouse['hz']));							if($wzid['details'] != '')						    {					    	    $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';							}						}					}					else					{					    $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz']));						if($wzid['details'] != '')						{					        $xxv['zd'] .= '<p>位置:'.$wzid['details'].' - '.$wzid['cpid'].'</p>';						}					}				}				$fpdata[$k] = $xxv;            }		}		$this->data['fpdata'] = $fpdata;		$this->data['fpdata'] = $fpdata;		$thfpdataxs = array();		if($fullorderamz['thfpdata'] != '')		{			$thfpdata =  explode(';',trim($fullorderamz['thfpdata'],';'));			foreach ($thfpdata as $k=>$v) 		    {				$thxs = explode('~',trim($v,'~'));				$thxs[0] = explode('|',trim($thxs[0],'|'));				$thxs[1] = explode('|',trim($thxs[1],'|'));				$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]);			}		}		$this->data['thfpdata'] = $thfpdataxs;		$shop = $this->shop->read($fullorderamz['shop']);		$this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例		$is = 0;		if($shop['type'] == 269)//判断是否独立站,269是独立站		{			$is = 1;		}		$this->data['is'] = $is;		//单项开始		$warehouse = $this->warehouse->read($fullorderamz['warehouse']);//发货仓库		$state = $this->typeclass->read($fullorderamz['state']);//订单状态		$country = $this->country->read($fullorderamz['country']);//国家		if($fullorderamz['capital'] == 1)		{			$capital = '暂未支付';		}		else if($fullorderamz['capital'] == 2)		{			$capital = '部分支付';		}		else if($fullorderamz['capital'] == 3)		{			$capital = '全部支付';		}		if($fullorderamz['printtype'] == 1)		{			$printtype = '运单';		}		else if($fullorderamz['printtype'] == 2)		{			$printtype = '发货单';		}		else if($fullorderamz['printtype'] == 3)		{			$printtype = '不打印单据';		}		else		{			$printtype = '未选择';		}		$this->data['warehouse'] = $warehouse['title'];		$this->data['state'] = $state['title'];		$this->data['capital'] = $capital;		$this->data['country'] = $country['name'];		$this->data['printtype'] = $printtype;		//单项结束		/** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/		$downwaybill = '';$dwls = array();		$oldwaybill = explode('-',ltrim($fullorderamz['oldwaybill'],'-'));		if(isset($oldwaybill[0][1]))		{			$oldwaybill = array_reverse($oldwaybill); //调整顺序		    foreach ($oldwaybill as $v) 		    {				$dw = explode('/',$v);				if(isset($dw[1]))				{					if(stripos($downwaybill,$dw[1]) === false)					{					    $dwls[$dw[1]] = 1;			    	    $downwaybill .= '<a href="/data/pdf/'.$dw[0].'/y-'.$dw[1].'.pdf" target="_blank">'.$dw[1].'</a>、';					}				}        	}		}		if($fullorderamz['printtype'] == 1)		{			if($fullorderamz['waybill'] != '' && !isset($dwls[$fullorderamz['waybill']]))			{		        $downwaybill = '<a href="/data/pdf/'.date('Ymd',$fullorderamz['printtime']).'/y-'.$fullorderamz['waybill'].'.pdf" target="_blank">'.$fullorderamz['waybill'].'</a>、'.$downwaybill;			}		}		$this->data['downwaybill'] = rtrim($downwaybill,'、');		/** 历史打印时间 **/		$printtime = '';		if($fullorderamz['oldprinttime'])		{			$pte = explode('-',rtrim($fullorderamz['oldprinttime'],'-'));		    foreach ($pte as $v) 		    {				$printtime .= date('Y-m-d H:i:s',$v).'、';        	}		}		$this->data['printtime'] = rtrim($printtime,'、');		$product = '';		$fullorderamz['product'] = str_replace("'","",$fullorderamz['product']);		if($fullorderamz['link'] != '' && $fullorderamz['source'] != '1')		{			$pt = explode(',',$fullorderamz['product']);			$lk = explode(',',$fullorderamz['link']);			for($i=0;$i<count($pt);$i++)			{				if(isset($lk[$i]))				{				    $octs = $this->colourorderts->get_texturl($pt[$i],$lk[$i]);				}				else				{					$octs = '';				}				$a = $octs?'<font style="color:#'.$octs['colour'].'">'.$pt[$i].'</font>':$pt[$i];				//$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];				if(isset($lk[$i]))				{				    $product .= ($product != '')?' , <a href="'.$lk[$i].'" target="_blank">'.$a.'</a>':'<a href="'.$lk[$i].'" target="_blank">'.$a.'</a>';				}				else				{					 $product .= ($product != '')?' , '.$a:$a;				}			}		}		else		{			$octs = $this->colourorderts->get_text($fullorderamz['product']);			$a = $octs?'<font style="color:#F39">'.$fullorderamz['product'].'</font>':$fullorderamz['product'];			//$a = (stripos($fullorderamz['product'],'Lace Front Wig Body Wave Human Hair Wigs Pre Plucked Brazilian Virgin Hair') !== false || stripos($fullorderamz['product'],'Deep Wave Wig 100 Human Hair Swiss Lace Curly Hair Lace Front Wig') !== false || stripos($fullorderamz['product'],'Alipearl Lace Front Wig Silky Straight 100% Virgin Human Hair') !== false || stripos($fullorderamz['product'],'Long Wigs Water Wave Lace Front Wigs Natural Wave Wigs For Sale') !== false || stripos($fullorderamz['product'],'Deep Wave Long Hair Wigs Lace Front Wigs Cheap Human Hair Wigs') !== false || stripos($fullorderamz['product'],'Long Wigs Loose Deep Wave Lace Front Wigs For Black Women') !== false || stripos($fullorderamz['product'],'Long Black Wigs Body Wave Lace Front Wigs With Baby Hair') !== false || stripos($fullorderamz['product'],'Long Curly Wigs Lace Front Wigs Human Hair Lace Front Wigs') !== false || stripos($fullorderamz['product'],'Blonde Skunk Stripe Hair Natural Body Wave Hairstyle Lace Wigs for Women') !== false)?'<font style="color:#F39">'.$fullorderamz['product'].'</font>':$fullorderamz['product'];			$product = $a;		}		$this->data['product'] = $product;		$out = $this->systemtransfer->find_all("number = '".$fullorderamz['number']."'");				$outread = '';				if($out)				{					foreach ($out as $val) 		            {						$list = '';						$rk = explode('|',trim($val['rk'],'|'));					    $rktime = explode('|',trim($val['rktime'],'|'));					    $zw = array();					    $t = $this->transfer->find_all("1=1");					    foreach ($t as $v)		   		        {						    $zw[$v['id']] = $v['title'];					    }					    if($val['rk'] != '' && count($rk) > 0)					    {							for($i=0;$i<count($rk);$i++)		       		        {							    if(!isset($rktime[$i]))							    {									$list .= $zw[$cz[$i]];							    }							    else							    {					   		        $list .= $zw[$rk[$i]].' :'.date('Y-m-d H:i',$rktime[$i]).',';							    }							}						}						$outread .= '<span style="color:#f00">'.$val['pm'].'</span>:'.$list.'<br>';					}				}				else				{						$systemwigsout = $this->systemwigsout->find_all("number = '".$fullorderamz['number']."'");						$outread = array();						if($systemwigsout)						{		    				foreach ($systemwigsout as $v) 		    				{								if($v['czwarehouse'] == 37)								{									$outread[] = '华荣厂';								}								else if($v['czwarehouse'] == 0)								{									$outread[] = '龙盈厂';								}			    				$cz = explode('|',trim($v['cz'],'|'));			    				$cztime = explode('|',trim($v['cztime'],'|'));			    				$zw = $this->transfer->get_list();			    				if($v['cz'] != '' && count($cz) > 0)			    				{			    					for($i=0;$i<count($cz);$i++)		            				{				    					if(!isset($cztime[$i]))					    				{					    					$outread[] = $zw[$cz[$i]].' -> ';					    				}					    				else					   				 {					       				 $outread[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).' -> ';					    				}				    				}									$outread[] = '<br>';			    				}		    				}						}				}		$klarnacolor = '';		if($fullorderamz['klarnadata'] !='')		{			$klarnadata = explode('|',$fullorderamz['klarnadata']);			if($klarnadata[0] == 'paypal' || $klarnadata[0] == 'stripe')			{				$klarnadata[1] = json_decode($klarnadata[1],true);				if($klarnadata[0] == 'stripe' && $klarnadata[1]['shouldmoney'] != $fullorderamz['shouldmoney'] && $fullorderamz['pay'] == 1211)				{					$klarnacolor = 'style="color:#F00"';				}			}			else if($klarnadata[0]!=1 && $fullorderamz['pay']!=26 && $fullorderamz['pay']!=27 && $fullorderamz['pay']!=1211)			{				$klarnacolor = 'style="color:#F00"';			}			if($fullorderamz['pay'] == 23)//klarna			{				$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');				$ToState = array_flip($ToState);				$klarnadata3 = str_replace(' ','',$klarnadata[3]);				$city = str_replace(' ','',$fullorderamz['city']);				$klarnadataaddress = explode($city,$klarnadata3);				if(isset($klarnadataaddress[1]))				{				    $klarnadata3 = $city.$klarnadataaddress[1];				    $klarnadatacolor = explode(',',$klarnadata3);				    unset($klarnadatacolor[4]);				    unset($klarnadatacolor[6]);				    if(isset($ToState[$klarnadatacolor[1]]))				    {					    $klarnadatacolor[1] = ucwords($ToState[$klarnadatacolor[1]]);				    }				    $klarnadata['color'] = $klarnadataaddress[0].implode(",",$klarnadatacolor);				}				else				{					$klarnadata['color'] = $klarnadata3;				}			}		}		else		{			$klarnadata = '';		}		$p = explode('-',$fullorderamz['paypal']);		$this->data['klarnacolor'] = $klarnacolor;		$this->data['klarnadata'] = $klarnadata;		$this->data['systemwigsout'] = $outread;		$this->_Template('fullorderamz_zw',$this->data);	}		public function _dcdxyz()	{		$post = $this->input->get(NULL, TRUE);		if(isset($post['timetk']))		{			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);				$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "oldwaybill != ''";			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "dtime desc";            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'orderinfo,number,oldwaybill',$order_str);            $data = array();            foreach ($info_list as $key=>$value) 		    {				$ob = '';				$oldwaybill = explode('-',trim($value['oldwaybill'],'-'));				if(count($oldwaybill) < 2)				{					continue;				}					$oldwaybill = array_reverse($oldwaybill); //调整顺序		   		    foreach ($oldwaybill as $v) 		   		    {						$dw = explode('/',$v);						if(isset($dw[1]))						{								$dwls[$dw[1]] = 1;			    	    		$ob .= $dw[1].'、';													}        			}				$info_list[$key]['oldwaybill'] = trim($ob,'、');				$data[] = $info_list[$key];            }			$title = "多运单信息 ".date("Y-m-d");             $titlename = "<table border=1>            <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>            <tr>            <td>订单号</td>            <td>编号</td>			<td>运单号</td>            </tr>            </table>";             $filename = $title.".xls"; 			$tail = "\n";             $this->excel->get_fz2($data,$titlename,$filename,$tail);		}	}		public function _thxz()	{		$post = $this->input->get(NULL, TRUE);		if(isset($post['timetk']))		{			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);				$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "returndata != ''";			if($timetk && $timetj)            {                $where  .= " and dtime > '$timetk' and dtime < '$timetj'";            }            //数据排序            $order_str = "dtime desc";            //取得信息列表            $info_list = $this->fullorderamz->find_all($where,'orderinfo,number,returndata',$order_str);            foreach ($info_list as $key=>$value) 		    {				$ydh = explode('">',$value['returndata']);				$ydh = explode('</a>',$ydh[1]);				$info_list[$key]['returndata'] = $ydh[0];				$time = explode('pdf/',$value['returndata']);				$time = explode('/',$time[1]);				$info_list[$key]['time'] = $time[0];            }			$title = "退货订单信息 ".date("Y-m-d");             $titlename = "<table border=1>            <tr><th colspan='14' align='left'><h3>".$title."<h3></th></tr>            <tr>            <td>订单号</td>            <td>编号</td>			<td>退货运单号</td>			<td>退货时间</td>            </tr>            </table>";             $filename = $title.".xls"; 			$tail = "\n";             $this->excel->get_fz2($info_list,$titlename,$filename,$tail);		}	}		public function _ddcf()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['number']))		{			$number = $this->input->post('number',true);			$data = $this->fullorderamz->get_number($number);			if(!$data)			{				echo json_encode(array('msg'=>'没有找到此订单','success'=>false));exit;			}			if($data['review'] != 1 && $data['review'] != 2)			{				echo json_encode(array('msg'=>'必须是 待审核 状态才能拆分','success'=>false));exit;			}			if($data['merge'] != 0)			{				echo json_encode(array('msg'=>'已合并的订单无法使用此拆分功能','success'=>false));exit;			}			$cfnum = explode('-',trim($number,'-'));			if(count($cfnum)> 4)			{				echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit;			}			$num = $this->fullorderamz->find_count("number like '".$number."%'");			$data['number'] = $data['number'].'-'.$num;			$data['orderinfo'] = $data['shop'].date('ymdHis',time()).rand(0,1);			$data['shouldmoney'] = 0;			$data['budget'] = 0;			$data['shipremarks'] = '';			$data['source'] = 1;			$data['extra_status'] = 1;//拆分的订单			unset($data['id']);			unset($data['jweight']);			unset($data['fpcount']);			unset($data['returndata']);			unset($data['oldwaybill']);			unset($data['waybill']);			unset($data['printtime']);			if($this->fullorderamz->insert($data))			{				echo json_encode(array('msg'=>'拆分成功!新订单编号:'.$data['number'],'success'=>true));exit;			}			else			{				echo json_encode(array('msg'=>'拆分失败,请重试','success'=>false));exit;			}		}	}	public function _cf() //合并订单拆分	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['id']))		{			$id = $this->input->post('id',true);		    $b = $this->fullorderamz->read($id);			$order = array();			if($b['merge'] == $b['id'])			{				$data = $this->fullorderamz->find_all("merge = '".$b['merge']."'");			    foreach ($data as $v) 			    {				    $a = $this->fullorderamzhb->get_orderinfo($v['orderinfo']);					if($a)					{					    $this->fullorderamz->save($a,$v['id']);					}					$order[] = $v['id'];			    }				echo json_encode(array('msg'=>'拆分成功!','d'=>$order,'success'=>true));exit;			}			else			{				echo json_encode(array('msg'=>'拆分条件错误!','success'=>false));exit;			}		}	}		public function _pljzzd()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['s']))  		{            $id_arr = $this->input->post('s');            $id_arr =  explode(',',$id_arr);            if(!$id_arr)            {                echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;            }            //循环删除记录			$this->db->trans_begin();            foreach ($id_arr as $value) 		    {				$post = $this->fullorderamz->read($value);                $hbw = explode('|',trim($post['whlabel'],'|'));				$hbf = explode(';',trim($post['fpdata'],';'));				foreach ($hbw as $k=>$val) 		        {					$w = explode('-',$val);					$f = explode('|',$hbf[$k]);					$w[2] = "DNOTO";					$f[9] = "DNOTO";					$hbf[$k] =  implode("|",$f);					$hbw[$k] = implode("-",$w);				}				$w = $this->whlabel->find_all("zd = '".$post['number']."'");				foreach ($w as $k=>$val) 		        {					$this->whlabel->save(array('zd'=>''),$val['id']);				}				$fpdata = implode(";",$hbf).';';				$whlabel = '|'.implode("|",$hbw).'|';				$this->fullorderamz->save(array('fpdata'=>$fpdata,'whlabel'=>$whlabel),$post['id']);            }			if ($this->db->trans_status() === FALSE)			{    			$this->db->trans_rollback();			}			else			{    			$this->db->trans_commit();			}            echo json_encode(array('del'=>$id_arr,'msg'=>'操作成功,已暂时隐藏,可继续操作其它订单,刷新即可显示!','success'=>true));		}	}}
 |