pbl.js 219 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233
  1. // ROUTES FOR OUR APIselectClassStudent
  2. // =============================================================================
  3. var express = require("express");
  4. var request = require("request");
  5. var bcrypt = require("bcryptjs");
  6. var router = express.Router(); // get an instance of the express Router
  7. const querystring = require("querystring");
  8. var mysql = require("./mysql");
  9. // const _mysqlLabor = ["123.58.32.151", "pbl"]; //edu數據庫信息
  10. // const _mysqluser = ["123.58.32.151", "cocorobouser"]; //用户数据库信息
  11. // const _getmysqlLabor = ["123.58.32.152", "pbl"]; //edu數據庫信息
  12. // const _getmysqluser = ["123.58.32.152", "cocorobouser"]; //edu數據庫信息
  13. const _mysqlLabor = ["172.16.12.5", "pbl"]; //edu數據庫信息
  14. const _mysqluser = ["172.16.12.5", "cocorobouser"]; //edu數據庫信息
  15. const _getmysqlLabor = ["172.16.12.5", "pbl"]; //edu數據庫信息
  16. const _getmysqluser = ["172.16.12.5", "cocorobouser"]; //edu數據庫信息
  17. // const _getmysqlLabor = ["172.16.12.7", "pbl"]; //edu數據庫信息
  18. // const _getmysqluser = ["172.16.12.7", "cocorobouser"]; //edu數據庫信息
  19. var crypto = require("crypto");
  20. var https = require("https");
  21. //統壹處理區域
  22. router.use(async function(req, res, next) {
  23. await asynnext(req, res, next);
  24. //// make sure we go to the next routes and don't stop here
  25. //res.end("");
  26. });
  27. /**
  28. * @des 參數解釋同上
  29. */
  30. function asynnext(req, res, next) {
  31. //異步處理
  32. return new Promise(async(resolve, reject) => {
  33. next();
  34. //resolve(true);aa
  35. });
  36. }
  37. /*測試*/
  38. router.route("/a").all((req, res, next) => {
  39. var json = queryString(req.url);
  40. getmysql(req, res, "a", json["ph"], json["pa"]);
  41. });
  42. router.route("/b").all((req, res, next) => {
  43. var json = queryString(req.url);
  44. getmysql(req, res, "b", json["ph"], json["pa"]);
  45. });
  46. /* 注册接口 */
  47. router.route("/register").post(function(req, res, next) {
  48. //mode的处理
  49. if (req.body[0]) {
  50. // 0 用户名 1 用户密码 2用户身份 3 第三方id(可有可无)
  51. p = Object.values(req.body[0]); //获取用户密码
  52. //没有第三方id的处理
  53. // if (p.length < 4) {
  54. // p.push("")
  55. // }
  56. p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
  57. //密码加密
  58. // bcrypt.hash(p[1], 10, function (err, hash) {
  59. // if (err) {
  60. // return next(err);
  61. // }
  62. // p[1] = hash;
  63. // });
  64. //参数拼接,注册
  65. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "register");
  66. //返回注册用户数据
  67. // mysql.usselect(p, function (ret) {
  68. // res.end(ret);
  69. // });
  70. mysql.usselect(p, function(ret) {
  71. res.end(JSON.stringify(ret));
  72. });
  73. }
  74. });
  75. /*登录接口*/
  76. router.route("/login").all((req, res, next) => {
  77. //mode的处理
  78. if (req.body[0]) {
  79. // 0 用户名 1 用户密码
  80. c = Object.values(req.body[0]); //获取用户密码
  81. p = [c[0]];
  82. // p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
  83. var _password = [c[0]];
  84. _password.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectPassword");
  85. mysql.usselect(_password, function(ret) {
  86. var _ret = ret;
  87. var paJ = _ret[0][0].userpassword;
  88. bcrypt.compare(c[1], paJ, function(err, result) {
  89. // console.log(result)
  90. if (result) {
  91. //参数拼接,登录
  92. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectLogin");
  93. //执行存储过程
  94. mysql.usselect(p, function(ret) {
  95. res.end(JSON.stringify({ status: "1", ...ret }));
  96. });
  97. } else {
  98. res.end(JSON.stringify([{ status: "0" }]));
  99. }
  100. });
  101. });
  102. // console.log(isEqual)
  103. }
  104. });
  105. /*手机登录接口*/
  106. router.route("/phoneLogin").all((req, res, next) => {
  107. //mode的处理
  108. if (req.body[0]) {
  109. // 0 用户名 1 用户密码
  110. c = Object.values(req.body[0]); //获取用户密码
  111. p = [c[0]];
  112. // p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
  113. var _password = [c[0]];
  114. _password.unshift(_mysqluser[0], _mysqluser[1], "selectPassword");
  115. mysql.usselect(_password, function(ret) {
  116. if (ret[0].length) {
  117. var _ret = ret;
  118. var paJ = _ret[0][0].password;
  119. let uid = _ret[0][0].userid;
  120. let duid = [uid];
  121. bcrypt.compare(c[1], paJ, function(err, result) {
  122. // console.log(result)
  123. if (result) {
  124. //参数拼接,登录
  125. duid.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectUser");
  126. //执行存储过程
  127. mysql.usselect(duid, function(ret) {
  128. res.end(JSON.stringify({ status: "1", ...ret }));
  129. });
  130. } else {
  131. res.end(JSON.stringify([{ status: "0" }]));
  132. }
  133. });
  134. } else {
  135. res.end(JSON.stringify([{ status: "0" }]));
  136. }
  137. });
  138. // console.log(isEqual)
  139. }
  140. });
  141. // 图片转base64
  142. router.route("/imgToBase64").all((req, res, next) => {
  143. var json = queryString(req.url);
  144. //mode的处理
  145. https.get(json["img"], function(res2) {
  146. var chunks = [];
  147. var size = 0;
  148. res2.on("data", function(chunk) {
  149. chunks.push(chunk);
  150. size += chunk.length; //累加缓冲数据的长度
  151. });
  152. res2.on("end", function(err) {
  153. var data = Buffer.concat(chunks, size);
  154. var base64Img = data.toString("base64");
  155. res.end(JSON.stringify([{ img: `data:image/png;base64,${base64Img}` }]));
  156. });
  157. });
  158. });
  159. router.route("/download").all(async(req, res, next) => {
  160. var json = queryString(req.url);
  161. // 查询文件名和下载链接
  162. const fileName = json["name"];
  163. const link = json["url"];
  164. // 发送下载请求
  165. request.get(link, (err, response) => {
  166. if (err) {
  167. res.status(500).end("Internal Server Error");
  168. return;
  169. }
  170. https.get(link, function(res2) {
  171. var chunks = [];
  172. var size = 0;
  173. res2.on("data", function(chunk) {
  174. chunks.push(chunk);
  175. size += chunk.length; //累加缓冲数据的长度
  176. });
  177. res2.on("end", function(err) {
  178. var data = Buffer.concat(chunks, size);
  179. var base64Img = data.toString("base64");
  180. res.end(JSON.stringify({ response, data }));
  181. });
  182. });
  183. });
  184. });
  185. /*登录接口*/
  186. router.route("/loginRace").all((req, res, next) => {
  187. //mode的处理
  188. if (req.body[0]) {
  189. // 0 用户名 1 用户密码
  190. c = Object.values(req.body[0]); //获取用户密码
  191. p = [c[0]];
  192. // p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
  193. var _password = [c[0]];
  194. _password.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectPasswordRace");
  195. mysql.usselect(_password, function(ret) {
  196. var _ret = ret;
  197. var paJ = _ret[0][0].password;
  198. bcrypt.compare(c[1], paJ, function(err, result) {
  199. // console.log(result)
  200. if (result) {
  201. //参数拼接,登录
  202. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectLoginRace");
  203. //执行存储过程
  204. mysql.usselect(p, function(ret) {
  205. res.end(JSON.stringify({ status: "1", ...ret }));
  206. });
  207. } else {
  208. res.end(JSON.stringify([{ status: "0" }]));
  209. }
  210. });
  211. });
  212. // console.log(isEqual)
  213. }
  214. });
  215. /* 修改密码接口 */
  216. router.route("/updatePassword").post(function(req, res, next) {
  217. //mode的处理
  218. if (req.body[0]) {
  219. let p = [req.body[0].userid];
  220. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "getPassword"); //執行存儲過程
  221. mysql.usselect(p, function(ret) {
  222. var paJ = ret[0][0].password;
  223. var op = bcrypt.hashSync(req.body[0].opassword, bcrypt.genSaltSync(10));
  224. bcrypt.compare(req.body[0].opassword, paJ, function(err, result) {
  225. // console.log(result)
  226. if (result) {
  227. let p2 = [
  228. req.body[0].userid,
  229. bcrypt.hashSync(req.body[0].password, bcrypt.genSaltSync(10)),
  230. ];
  231. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updatePassword"); //執行存儲過程
  232. mysql.usselect(p2, function(ret) {
  233. res.end(JSON.stringify([{ success: 1 }]));
  234. });
  235. } else {
  236. res.end(JSON.stringify([{ success: 0 }]));
  237. }
  238. });
  239. });
  240. }
  241. });
  242. /* 赛事修改密码 */
  243. router.route("/updatePassword1").post(function(req, res, next) {
  244. //mode的处理
  245. if (req.body[0]) {
  246. let p = [req.body[0].userid];
  247. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "getPassword1"); //執行存儲過程
  248. mysql.usselect(p, function(ret) {
  249. var paJ = ret[0][0].password;
  250. var op = bcrypt.hashSync(req.body[0].opassword, bcrypt.genSaltSync(10));
  251. bcrypt.compare(req.body[0].opassword, paJ, function(err, result) {
  252. // console.log(result)
  253. if (result) {
  254. let p2 = [
  255. req.body[0].userid,
  256. bcrypt.hashSync(req.body[0].password, bcrypt.genSaltSync(10)),
  257. ];
  258. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updatePassword1"); //執行存儲過程
  259. mysql.usselect(p2, function(ret) {
  260. res.end(JSON.stringify([{ success: 1 }]));
  261. });
  262. } else {
  263. res.end(JSON.stringify([{ success: 0 }]));
  264. }
  265. });
  266. });
  267. }
  268. });
  269. /* 找寻重复手机号 */
  270. router.route("/findPhone").all((req, res, next) => {
  271. var json = queryString(req.url);
  272. getmysql(req, res, "findPhone", json["un"]);
  273. });
  274. /* 找寻是否有此账号 */
  275. router.route("/findUsername").all((req, res, next) => {
  276. var json = queryString(req.url);
  277. getmysql(req, res, "findUsername", json["un"]);
  278. });
  279. /* 找寻重复邮箱 */
  280. router.route("/findMail").all((req, res, next) => {
  281. var json = queryString(req.url);
  282. usergetmysql(req, res, "findMail", json["un"]);
  283. });
  284. /* 找寻重复学号 */
  285. router.route("/findSid").all((req, res, next) => {
  286. var json = queryString(req.url);
  287. getmysql(req, res, "findSid", json["un"]);
  288. });
  289. /* 新增班级 修1 */
  290. router.route("/insertClass").all((req, res, next) => {
  291. var json = queryString(req.url);
  292. getmysql2(req, res, "insertClass", json["name"], json["oid"], json["uid"]);
  293. });
  294. /* 新增教研室 修1 */
  295. router.route("/insertTeacherOffice").all((req, res, next) => {
  296. var json = queryString(req.url);
  297. getmysql(req, res, "insertTeacherOffice", json["name"], json["oid"], json["uid"]);
  298. });
  299. /* 新增年级 修1 */
  300. router.route("/insertGrade").all((req, res, next) => {
  301. var json = queryString(req.url);
  302. getmysql(req, res, "insertGrade", json["name"], json["oid"], json["uid"]);
  303. });
  304. /* 修改班级 修1 */
  305. router.route("/updateClass").all((req, res, next) => {
  306. var json = queryString(req.url);
  307. getmysql(req, res, "updateClass", json["id"], json["n"], json["oid"]);
  308. });
  309. // 修改教研室 修1
  310. router.route("/updateTeacherOffice").all((req, res, next) => {
  311. var json = queryString(req.url);
  312. getmysql(req, res, "updateTeacherOffice", json["id"], json["n"], json["oid"]);
  313. });
  314. /* 修改年级 修1 */
  315. router.route("/updateGrade").all((req, res, next) => {
  316. var json = queryString(req.url);
  317. getmysql(req, res, "updateGrade", json["id"], json["n"], json["oid"]);
  318. });
  319. /* 查询班级 */
  320. router.route("/selectClass").all((req, res, next) => {
  321. var json = queryString(req.url);
  322. getmysql(req, res, "selectClass", json["cu"], json["oid"], json["cn"], json["page"], 10);
  323. });
  324. // 教研室查询
  325. router.route("/selectTeacherOffice").all((req, res, next) => {
  326. var json = queryString(req.url);
  327. getmysql(req, res, "selectTeacherOffice", json["cu"], json["oid"], json["cn"], json["page"], 10);
  328. });
  329. /* 查询班级 */
  330. router.route("/selectClass2").all((req, res, next) => {
  331. var json = queryString(req.url);
  332. getmysql(req, res, "selectClass2", json["cid"], json["oid"], json["cn"], json["page"], 10);
  333. });
  334. /* 查询年级 */
  335. router.route("/selectGrade").all((req, res, next) => {
  336. var json = queryString(req.url);
  337. getmysql(req, res, "selectGrade", json["cu"], json["oid"], json["cn"], json["page"], 10);
  338. });
  339. /* 删除1班级 */
  340. router.route("/deleteClass").all((req, res, next) => {
  341. var json = queryString(req.url);
  342. getmysql2(req, res, "deleteClass", json["id"]);
  343. });
  344. /* 删除1年级 */
  345. router.route("/deleteGrade").all((req, res, next) => {
  346. var json = queryString(req.url);
  347. getmysql2(req, res, "deleteGrade", json["id"]);
  348. });
  349. /* 查询学校 */
  350. router.route("/selectOrg").all((req, res, next) => {
  351. var json = queryString(req.url);
  352. getmysql(req, res, "selectOrg");
  353. });
  354. /* 查询组织 */
  355. router.route("/selectorg2").all((req, res, next) => {
  356. var json = queryString(req.url);
  357. getmysql(req, res, "selectorg2");
  358. });
  359. /* 修改学校名称 修1 */
  360. router.route("/updateSN").all((req, res, next) => {
  361. var json = queryString(req.url);
  362. getmysql(req, res, "updateSchoolName", json["oid"], json["n"]);
  363. });
  364. /* 教师端修改学校名称 修1 */
  365. router.route("/updateSchoolByOrg").all((req, res, next) => {
  366. var json = queryString(req.url);
  367. getmysql(req, res, "updateSchoolByOrg", json["n"], json["d"], json["id"]);
  368. });
  369. /* 教师端查询未联结学校 */
  370. router.route("/selectNoCSchool").all((req, res, next) => {
  371. var json = queryString(req.url);
  372. getmysql(req, res, "selectNoCSchool");
  373. });
  374. /* 教师端新增或修改联结学校 修1 */
  375. router.route("/addNoSchool").all((req, res, next) => {
  376. var json = queryString(req.url);
  377. getmysql(req, res, "addNoSchool", json["id"], json["coid"]);
  378. });
  379. /* 新增学生 修1 */
  380. router.route("/insertStudent").all((req, res, next) => {
  381. var json = queryString(req.url);
  382. json["userpassword"] = bcrypt.hashSync(
  383. json["userpassword"],
  384. bcrypt.genSaltSync(10)
  385. );
  386. getmysql(
  387. req,
  388. res,
  389. "insertStudent",
  390. json["ph"],
  391. json["username"],
  392. json["userpassword"],
  393. json["type"],
  394. json["oid"],
  395. json["tid"],
  396. json["cid"]
  397. );
  398. });
  399. // /* 新增学生 */
  400. // router.route('/iStudent').all((req, res, next) => {
  401. // var json = queryString(req.url);
  402. // json['userpassword'] = bcrypt.hashSync(json['userpassword'], bcrypt.genSaltSync(10))
  403. // getmysql(req, res, "insertStudent", json['ph'], json['username'], json['userpassword'], json['type'], json['oid'], json['tid'], json['cid']);
  404. // });
  405. /* 查询学生 */
  406. router.route("/selectStudent").all((req, res, next) => {
  407. var json = queryString(req.url);
  408. getmysql(
  409. req,
  410. res,
  411. "selectStudent",
  412. json["oid"],
  413. json["cu"],
  414. json["cn"],
  415. json["page"],
  416. 10
  417. );
  418. });
  419. /* ppt根据学校查询学生 */
  420. router.route("/selectStudentByScoolPPt").all((req, res, next) => {
  421. var json = queryString(req.url);
  422. getmysql(req, res, "selectStudentByScoolPPt", json["oid"], json["cid"]);
  423. });
  424. /* 查询学校底下的所有学生 */
  425. router.route("/selectOrgStu").all((req, res, next) => {
  426. var json = queryString(req.url);
  427. getmysql(req, res, "selectOrgStu", json["oid"]);
  428. });
  429. /* 查询学生 */
  430. router.route("/selectStudentAdd").all((req, res, next) => {
  431. var json = queryString(req.url);
  432. getmysql(req, res, "selectStudentAdd", json["oid"], json["cu"], json["cn"]);
  433. });
  434. /* 查询老师 */
  435. router.route("/selectTeacherAdd").all((req, res, next) => {
  436. var json = queryString(req.url);
  437. getmysql(req, res, "selectTeacherAdd", json["oid"], json["cu"], json["cn"]);
  438. });
  439. /* 查询老师 */
  440. router.route("/selectTeacherAddOrg").all((req, res, next) => {
  441. var json = queryString(req.url);
  442. getmysql(
  443. req,
  444. res,
  445. "selectTeacherAddOrg",
  446. json["oid"],
  447. json["cu"],
  448. json["cn"]
  449. );
  450. });
  451. /* 查询学生 */
  452. router.route("/selectStudentAddOrg").all((req, res, next) => {
  453. var json = queryString(req.url);
  454. getmysql(
  455. req,
  456. res,
  457. "selectStudentAddOrg",
  458. json["oid"],
  459. json["cu"],
  460. json["cn"]
  461. );
  462. });
  463. /* 查询全部用户 */
  464. router.route("/selectUserAddOrg").all((req, res, next) => {
  465. var json = queryString(req.url);
  466. getmysql(req, res, "selectUserAddOrg", json["oid"], json["cu"], json["cn"]);
  467. });
  468. /* 查询全部用户 */
  469. router.route("/selectUserAdd").all((req, res, next) => {
  470. var json = queryString(req.url);
  471. getmysql(req, res, "selectUserAdd", json["oid"], json["cu"], json["cn"]);
  472. });
  473. /* 查询全部用户 */
  474. router.route("/selectUserByOidS").all((req, res, next) => {
  475. var json = queryString(req.url);
  476. getmysql(
  477. req,
  478. res,
  479. "selectUserByOidS",
  480. json["oid"],
  481. json["org"],
  482. json["cu"],
  483. json["cn"]
  484. );
  485. });
  486. /* 查询全部用户 */
  487. router.route("/selectUserByOidS2").all((req, res, next) => {
  488. var json = queryString(req.url);
  489. getmysql(
  490. req,
  491. res,
  492. "selectUserByOidS2",
  493. json["oid"],
  494. json["org"],
  495. json["cu"],
  496. json["cn"],
  497. json["page"],
  498. json["pageSize"]
  499. );
  500. });
  501. /* 查询全部用户 */
  502. router.route("/selectUserByOidS2Studio").all((req, res, next) => {
  503. var json = queryString(req.url);
  504. getmysql(
  505. req,
  506. res,
  507. "selectUserByOidS2Studio",
  508. json["oid"],
  509. json["org"],
  510. json["cu"],
  511. json["cn"],
  512. json["page"],
  513. json["pageSize"]
  514. );
  515. });
  516. /* 查询班级是否有重复 */
  517. router.route("/selectC").all((req, res, next) => {
  518. var json = queryString(req.url);
  519. getmysql(req, res, "selectC", json["className"]);
  520. });
  521. /* 查询学校是否有重复 */
  522. router.route("/selectS").all((req, res, next) => {
  523. var json = queryString(req.url);
  524. getmysql(req, res, "selectS", json["schoolName"]);
  525. });
  526. /* 修改个人信息 */
  527. router.route("/updateUser").all((req, res, next) => {
  528. postmysql(req, res, "updateUser");
  529. });
  530. //查询老师的信息
  531. router.route("/getUser").all((req, res, next) => {
  532. var json = queryString(req.url);
  533. getmysql(req, res, "selectUserDeail", json["uid"]);
  534. });
  535. //查询老师的信息
  536. router.route("/getRaceUser").all((req, res, next) => {
  537. var json = queryString(req.url);
  538. getmysql(req, res, "getRaceUser", json["uid"]);
  539. });
  540. router.route("/selectUser").all((req, res, next) => {
  541. var json = queryString(req.url);
  542. getmysql(req, res, "selectUser", json["userid"]);
  543. });
  544. //查询教师端消息
  545. router.route("/getNewsTeacher").all((req, res, next) => {
  546. var json = queryString(req.url);
  547. getmysql(req, res, "selectNew", json["uid"], json["page"], 10);
  548. });
  549. //查询教师端消息
  550. router.route("/selectNotice").all((req, res, next) => {
  551. var json = queryString(req.url);
  552. getmysql(
  553. req,
  554. res,
  555. "selectNotice",
  556. json["uid"],
  557. json["oid"],
  558. json["org"],
  559. json["page"],
  560. 10
  561. );
  562. });
  563. //查询教师端消息
  564. router.route("/selectNotice2").all((req, res, next) => {
  565. var json = queryString(req.url);
  566. getmysql(req, res, "selectNotice2", json["uid"], json["oid"], json["org"]);
  567. });
  568. //查询教师端消息
  569. router.route("/addNotice").all((req, res, next) => {
  570. postmysql(req, res, "addNotice");
  571. });
  572. //查询教师端消息
  573. router.route("/deleteNotice").all((req, res, next) => {
  574. postmysql(req, res, "deleteNotice");
  575. });
  576. //查询通知详情
  577. router.route("/selectNewDetail").all((req, res, next) => {
  578. var json = queryString(req.url);
  579. getmysql(req, res, "selectNewDetail", json["nid"]);
  580. });
  581. //查出分组分类
  582. router.route("/getGroup").all((req, res, next) => {
  583. getmysql(req, res, "selectGroupTeacher");
  584. });
  585. //查询这个老师底下的学生提交的作业
  586. router.route("/getWorks").all((req, res, next) => {
  587. //已经不用
  588. var json = queryString(req.url);
  589. getmysql(req, res, "selectWorks", json["cn"], json["cid"], json["page"], 10);
  590. });
  591. //查询项目
  592. router.route("/getProject").all((req, res, next) => {
  593. var json = queryString(req.url);
  594. getmysql(
  595. req,
  596. res,
  597. "selectProject",
  598. json["type"],
  599. json["uid"],
  600. json["oid"],
  601. json["cn"],
  602. json["page"],
  603. 10
  604. );
  605. });
  606. //新评价查询项目
  607. router.route("/getProject1").all((req, res, next) => {
  608. //已经不用
  609. var json = queryString(req.url);
  610. getmysql(
  611. req,
  612. res,
  613. "selectProject1",
  614. json["uid"],
  615. json["cid"],
  616. json["eid"],
  617. json["cn"],
  618. json["page"],
  619. 10
  620. );
  621. });
  622. //查询项目
  623. router.route("/getMyProject").all((req, res, next) => {
  624. var json = queryString(req.url);
  625. getmysql(req, res, "selectMyProject", json["uid"], json["page"], 10);
  626. });
  627. //查询项目成员
  628. router.route("/selectProjectStudent").all((req, res, next) => {
  629. var json = queryString(req.url);
  630. getmysql(req, res, "select_student", json["cn"], json["oid"], json["uid"]);
  631. });
  632. //查询Banner列表
  633. router.route("/selectBannerList").all((req, res, next) => {
  634. var json = queryString(req.url);
  635. getmysql(req, res, "selectBannerList", json["page"], 10);
  636. });
  637. //查询Banner列表
  638. router.route("/selectAllBanner").all((req, res, next) => {
  639. var json = queryString(req.url);
  640. getmysql(req, res, "selectAllBanner", json["t"]);
  641. });
  642. //新增Banner
  643. router.route("/insertBannerList").all((req, res, next) => {
  644. postmysql(req, res, "insertBannerList");
  645. });
  646. //删除提交的作业
  647. router.route("/deleteCourseWork").all((req, res, next) => {
  648. postmysql(req, res, "deleteCourseWork");
  649. });
  650. //删除提交的作业
  651. router.route("/deleteCourseWorkS").all((req, res, next) => {
  652. postmysql(req, res, "deleteCourseWorkS");
  653. });
  654. //删除1Banner
  655. router.route("/deleteBannerList").all((req, res, next) => {
  656. var json = queryString(req.url);
  657. getmysql2(req, res, "deleteBannerList", json["id"]);
  658. });
  659. //新增课程
  660. router.route("/addWork").all((req, res, next) => {
  661. postmysql(req, res, "insert_teacher_work");
  662. });
  663. //点赞评论
  664. router.route("/insertComment").all((req, res, next) => {
  665. postmysql(req, res, "insertComment");
  666. });
  667. //点赞评论
  668. router.route("/getComment").all((req, res, next) => {
  669. postmysql(req, res, "getComment");
  670. });
  671. //取消点赞 修1
  672. router.route("/deleteComment").all((req, res, next) => {
  673. var json = queryString(req.url);
  674. getmysql(req, res, "deleteComment", json["wid"], json["lid"]);
  675. });
  676. //删除1评论
  677. router.route("/deleteComment2").all((req, res, next) => {
  678. var json = queryString(req.url);
  679. getmysql2(req, res, "deleteComment2", json["id"]);
  680. });
  681. //上传批注图片
  682. router.route("/updateCourseWorks").all((req, res, next) => {
  683. postmysql(req, res, "updateCourseWorks");
  684. });
  685. //上传文件
  686. router.route("/addCourseWorks").all((req, res, next) => {
  687. postmysql(req, res, "addCourseWorks");
  688. });
  689. //上传文件
  690. router.route("/addCourseWorksS").all((req, res, next) => {
  691. postmysql(req, res, "addCourseWorksS");
  692. });
  693. //上传文件
  694. router.route("/addCourseWorksS2").all((req, res, next) => {
  695. postmysql(req, res, "addCourseWorksS2");
  696. });
  697. //修改作业名字
  698. router.route("/updateSCourseName").all((req, res, next) => {
  699. postmysql(req, res, "updateSCourseName");
  700. });
  701. //可上传多个文件
  702. router.route("/addCourseWorksR").all((req, res, next) => {
  703. postmysql(req, res, "addCourseWorksR");
  704. });
  705. //上传文件
  706. router.route("/addCourseWorksTeacher").all((req, res, next) => {
  707. postmysql(req, res, "addCourseWorksTeacher");
  708. });
  709. //上传文件
  710. router.route("/addCourseWorks2").all((req, res, next) => {
  711. var json = queryString(req.url);
  712. postmysql(
  713. req,
  714. res,
  715. "addCourseWorks",
  716. json["uid"],
  717. json["cid"],
  718. json["stage"],
  719. json["task"],
  720. json["tool"],
  721. json["content"],
  722. json["type"]
  723. );
  724. });
  725. //上传文件 修1
  726. router.route("/addCourseWorks3").all((req, res, next) => {
  727. var json = queryString(req.url);
  728. getmysql(
  729. req,
  730. res,
  731. "addCourseWorks2",
  732. json["uid"],
  733. json["cid"],
  734. json["stage"],
  735. json["task"],
  736. json["tool"],
  737. json["content"],
  738. json["type"],
  739. json["atool"]
  740. );
  741. });
  742. //上传文件
  743. router.route("/addCourseWorks3-2").all((req, res, next) => {
  744. var json = queryString(req.url);
  745. postmysql(req, res, "addCourseWorks2");
  746. });
  747. //上传文件
  748. router.route("/addCourseWorks2Inter").all((req, res, next) => {
  749. var json = queryString(req.url);
  750. postmysql(req, res, "addCourseWorks2Inter");
  751. });
  752. //上传文件
  753. router.route("/addCourseWorks4").all((req, res, next) => {
  754. postmysql3(req, res, "addCourseWorks3");
  755. });
  756. //上传文件
  757. router.route("/addCourseWorks4-u").all((req, res, next) => {
  758. postmysql2(req, res, "addCourseWorks3");
  759. });
  760. //上传文件
  761. router.route("/addCourseWorks4E").all((req, res, next) => {
  762. postmysql3(req, res, "addCourseWorks3E");
  763. });
  764. //上传文件
  765. router.route("/addCourseWorks4s").all((req, res, next) => {
  766. postmysql3(req, res, "addCourseWorks4s");
  767. });
  768. //上传文件
  769. router.route("/addCourseWorks4s2").all((req, res, next) => {
  770. postmysql3(req, res, "addCourseWorks4s2");
  771. });
  772. //上传文件
  773. router.route("/addCourseWorks5").all((req, res, next) => {
  774. postmysql(req, res, "addCourseWorks3");
  775. });
  776. //上传批量文件
  777. router.route("/addCourseWorksPl").all((req, res, next) => {
  778. if (req.body[0]) {
  779. var p = Object.values(req.body[0]);
  780. let ateacher = p[0];
  781. let cid = p[1];
  782. let stage = p[2];
  783. let task = p[3];
  784. let tool = p[4];
  785. let files = JSON.parse(decodeURIComponent(p[5]));
  786. for (let i = 0; i < files.length; i++) {
  787. var k = [
  788. encodeURIComponent(files[i].username),
  789. cid,
  790. stage,
  791. task,
  792. tool,
  793. encodeURIComponent(files[i].url),
  794. encodeURIComponent(files[i].fileType),
  795. ateacher,
  796. "50",
  797. ];
  798. k.unshift(_mysqlLabor[0], _mysqlLabor[1], "addCourseWorksPl");
  799. //執行存儲過程
  800. mysql.usselect(k, function(ret) {
  801. if (i == files.length - 1) {
  802. res.end(JSON.stringify(ret));
  803. }
  804. });
  805. }
  806. }
  807. });
  808. //修改课程权限(学生是否能查看所有作业) 修1
  809. router.route("/updateCourseSLook").all((req, res, next) => {
  810. var json = queryString(req.url);
  811. getmysql(req, res, "updateCourseSLook", json["sopen"], json["cid"]);
  812. });
  813. //修改课程权限(学生是否能查看所有作业) 修1
  814. router.route("/updateTrainCourseSLook").all((req, res, next) => {
  815. var json = queryString(req.url);
  816. getmysql(req, res, "updateTrainCourseSLook", json["sopen"], json["cid"]);
  817. });
  818. //修改跟随模式阶段-任务
  819. router.route("/updateCourseFollowC").all((req, res, next) => {
  820. postmysql(req, res, "updateCourseFollowC");
  821. });
  822. //修改跟随模式阶段-任务
  823. router.route("/updateTrainCourseFollowC").all((req, res, next) => {
  824. postmysql(req, res, "updateTrainCourseFollowC");
  825. });
  826. //修改跟随模式
  827. router.route("/updateCourseFollow").all((req, res, next) => {
  828. postmysql(req, res, "updateCourseFollow");
  829. });
  830. //修改跟随模式
  831. router.route("/updateTrainCourseFollow").all((req, res, next) => {
  832. postmysql(req, res, "updateTrainCourseFollow");
  833. });
  834. //选人回答
  835. router.route("/updateCoursePick").all((req, res, next) => {
  836. postmysql(req, res, "updateCoursePick");
  837. });
  838. //删除
  839. router.route("/deletePick").all((req, res, next) => {
  840. postmysql(req, res, "deletePick");
  841. });
  842. //修改阶段锁定状态
  843. router.route("/updateCourseLookOpen").all((req, res, next) => {
  844. postmysql(req, res, "updateCourseLookOpen");
  845. });
  846. //修改阶段锁定状态
  847. router.route("/updateTrainCourseLookOpen").all((req, res, next) => {
  848. postmysql(req, res, "updateTrainCourseLookOpen");
  849. });
  850. //查看阶段锁定的状态
  851. router.route("/getCourseState").all((req, res, next) => {
  852. var json = queryString(req.url);
  853. getmysql(req, res, "getCourseState", json["cid"]);
  854. });
  855. //添加锁定状态
  856. router.route("/addCourseState").all((req, res, next) => {
  857. postmysql(req, res, "addCourseState");
  858. });
  859. //修改锁定状态
  860. router.route("/updateCourseSate").all((req, res, next) => {
  861. postmysql(req, res, "updateCourseSate");
  862. });
  863. //修改课程管理模式
  864. router.route("/updateCourseMode").all((req, res, next) => {
  865. postmysql(req, res, "updateCourseMode");
  866. });
  867. //修改课程管理模式
  868. router.route("/updateTrainCourseMode").all((req, res, next) => {
  869. postmysql(req, res, "updateTrainCourseMode");
  870. });
  871. //查询课程权限(学生是否能查看所有作业)
  872. router.route("/selectCourseSLook").all((req, res, next) => {
  873. var json = queryString(req.url);
  874. getmysql(req, res, "selectCourseSLook", json["cid"]);
  875. });
  876. //查询课程权限(学生是否能查看所有作业)
  877. router.route("/selectTrainCourseSLook").all((req, res, next) => {
  878. var json = queryString(req.url);
  879. getmysql(req, res, "selectTrainCourseSLook", json["cid"]);
  880. });
  881. //查询被挑的人
  882. router.route("/getPick").all((req, res, next) => {
  883. var json = queryString(req.url);
  884. getmysql(req, res, "getPick", json["cid"]);
  885. });
  886. //查询作业详情
  887. router.route("/selectWorksDetail2").all((req, res, next) => {
  888. var json = queryString(req.url);
  889. getmysql(
  890. req,
  891. res,
  892. "selectWorksDetail2",
  893. json["uid"],
  894. json["cid"],
  895. json["stage"],
  896. json["task"]
  897. );
  898. });
  899. //查询作业详情
  900. router.route("/selectWorksDetail2u").all((req, res, next) => {
  901. //var json = queryString(req.url);//, json['uid'], json['cid'], json['stage'], json['task'], json['tool'], json['type'], json['atool']
  902. postmysql2(req, res, "selectWorksDetail2u");
  903. });
  904. //查询课程全部作业详情
  905. router.route("/selectWorksDetail3").all((req, res, next) => {
  906. var json = queryString(req.url);
  907. getmysql(req, res, "selectWorksDetail3", json["uid"], json["cid"]);
  908. });
  909. //查询课程所有作业详情
  910. router.route("/selectAllWorksDetail").all((req, res, next) => {
  911. var json = queryString(req.url);
  912. getmysql(req, res, "selectAllWorksDetail", json["uid"], json["cid"]);
  913. });
  914. //查询多个课程全部作业详情
  915. router.route("/selectWorksDetailMore").all((req, res, next) => {
  916. var json = queryString(req.url);
  917. getmysql(req, res, "selectWorksDetailMore", json["uid"], json["cid"]);
  918. });
  919. //查询课程某个阶段某个任务下的评价 修1 这个update,但标题查询
  920. router.route("/updateWorksEva").all((req, res, next) => {
  921. var json = queryString(req.url);
  922. getmysql(
  923. req,
  924. res,
  925. "updateWorksEva",
  926. json["cid"],
  927. json["s"],
  928. json["t"],
  929. json["uid"],
  930. json["rate"]
  931. );
  932. });
  933. //学习中心教师查询作业
  934. router.route("/selectSWorks").all((req, res, next) => {
  935. var json = queryString(req.url);
  936. getmysql(req, res, "selectSWorks", json["cid"], json["s"], json["t"]);
  937. });
  938. //学习中心教师查询作业全部展示
  939. router.route("/selectSWorks2").all((req, res, next) => {
  940. var json = queryString(req.url);
  941. getmysql(req, res, "selectSWorks2", json["cid"]);
  942. });
  943. //学习中心学生查询作业
  944. router.route("/selectStudentWorks").all((req, res, next) => {
  945. var json = queryString(req.url);
  946. getmysql(
  947. req,
  948. res,
  949. "selectStudentWorks",
  950. json["uid"],
  951. json["cid"],
  952. json["s"],
  953. json["t"]
  954. );
  955. });
  956. //实时课堂作业评价
  957. router.route("/updateStudentWork").all((req, res, next) => {
  958. postmysql(req, res, "updateStudentWork");
  959. });
  960. //学习中心查询学生
  961. router.route("/selectWorksStudent").all((req, res, next) => {
  962. var json = queryString(req.url);
  963. getmysql(req, res, "selectWorksStudent", json["oid"], json["cid"]);
  964. });
  965. //批量上传查询学生
  966. router.route("/selectSnameByCid").all((req, res, next) => {
  967. var json = queryString(req.url);
  968. getmysql(req, res, "selectSnameByCid", json["cid"]);
  969. });
  970. //批量上传查询学生分页
  971. router.route("/selectSnameByCidPage").all((req, res, next) => {
  972. var json = queryString(req.url);
  973. getmysql(
  974. req,
  975. res,
  976. "selectSnameByCidPage",
  977. json["cid"],
  978. json["cn"],
  979. json["page"],
  980. json["num"]
  981. );
  982. });
  983. //分组查询学生
  984. router.route("/selectSnameByCidGroup").all((req, res, next) => {
  985. var json = queryString(req.url);
  986. getmysql(
  987. req,
  988. res,
  989. "selectSnameByCidGroup",
  990. json["cid"],
  991. json["oid"],
  992. json["cn"]
  993. );
  994. });
  995. /* 查询学生 */
  996. router.route("/selectStudent2").all((req, res, next) => {
  997. var json = queryString(req.url);
  998. getmysql(
  999. req,
  1000. res,
  1001. "selectStudent2",
  1002. json["oid"],
  1003. json["cu"],
  1004. json["cn"],
  1005. json["cid"],
  1006. json["page"],
  1007. 10
  1008. );
  1009. });
  1010. /* 查询教师 */
  1011. router.route("/selectTeacher2").all((req, res, next) => {
  1012. var json = queryString(req.url);
  1013. getmysql(
  1014. req,
  1015. res,
  1016. "selectTeacher2",
  1017. json["oid"],
  1018. json["cu"],
  1019. json["cn"],
  1020. json["cid"],
  1021. json["page"],
  1022. 10
  1023. );
  1024. });
  1025. /* 查询教师 */
  1026. router.route("/selectTeacher").all((req, res, next) => {
  1027. var json = queryString(req.url);
  1028. getmysql(
  1029. req,
  1030. res,
  1031. "selectTeacher",
  1032. json["org"],
  1033. json["cu"],
  1034. json["cn"],
  1035. json["page"],
  1036. 10
  1037. );
  1038. });
  1039. /* 添加教师页面查询教师 */
  1040. router.route("/selectTcTeacher").all((req, res, next) => {
  1041. var json = queryString(req.url);
  1042. getmysql(
  1043. req,
  1044. res,
  1045. "selectTcTeacher",
  1046. json["org"],
  1047. json["oid"],
  1048. json["cu"],
  1049. json["cn"],
  1050. json["page"],
  1051. 10
  1052. );
  1053. });
  1054. /* 查询所有评价体系 */
  1055. router.route("/selectAllEvaluation").all((req, res, next) => {
  1056. var json = queryString(req.url);
  1057. getmysql(req, res, "selectAllEvaluation", json["oid"]);
  1058. });
  1059. /* 根据市级用户查询评审员 */
  1060. router.route("/selectReviewer").all((req, res, next) => {
  1061. var json = queryString(req.url);
  1062. getmysql(
  1063. req,
  1064. res,
  1065. "selectReviewer",
  1066. json["uid"],
  1067. json["cn"],
  1068. json["page"],
  1069. 10
  1070. );
  1071. });
  1072. /* 市级区县管理接口 */
  1073. router.route("/selectCReviewer").all((req, res, next) => {
  1074. var json = queryString(req.url);
  1075. getmysql(
  1076. req,
  1077. res,
  1078. "selectCReviewer",
  1079. json["uid"],
  1080. json["cn"],
  1081. json["page"],
  1082. 10
  1083. );
  1084. });
  1085. /* 修改评审员 修1 */
  1086. router.route("/updateReviewer").all((req, res, next) => {
  1087. var json = queryString(req.url);
  1088. getmysql(
  1089. req,
  1090. res,
  1091. "updateReviewer",
  1092. json["n"],
  1093. json["p"],
  1094. json["t"],
  1095. json["s"],
  1096. json["uid"]
  1097. );
  1098. });
  1099. /* 删除1评审员 */
  1100. router.route("/deleteReviewer").all((req, res, next) => {
  1101. var json = queryString(req.url);
  1102. getmysql2(req, res, "deleteReviewer", json["uid"]);
  1103. });
  1104. /* 查询区县案例 */
  1105. router.route("/selecAnliBox").all((req, res, next) => {
  1106. var json = queryString(req.url);
  1107. getmysql(req, res, "selecAnliBox", json["title"]);
  1108. });
  1109. /* 查询市级案例 */
  1110. router.route("/selecAnliBox1").all((req, res, next) => {
  1111. var json = queryString(req.url);
  1112. getmysql(req, res, "selecAnliBox1", json["title"]);
  1113. });
  1114. /* 查询省级案例 */
  1115. router.route("/selecAnliBox2").all((req, res, next) => {
  1116. var json = queryString(req.url);
  1117. getmysql(req, res, "selecAnliBox2");
  1118. });
  1119. /* 案例征集查询通知公告 */
  1120. router.route("/selectRaceNotice").all((req, res, next) => {
  1121. var json = queryString(req.url);
  1122. getmysql(req, res, "selectRaceNotice", json["page"], 10);
  1123. });
  1124. /* 案例征集查询通知公告详情 */
  1125. router.route("/getRaceNoticeDetail").all((req, res, next) => {
  1126. var json = queryString(req.url);
  1127. getmysql(req, res, "getRaceNoticeDetail", json["nid"]);
  1128. });
  1129. /* 案例征集发送通知 修1 */
  1130. router.route("/insertRaceNote").all((req, res, next) => {
  1131. var json = queryString(req.url);
  1132. getmysql(req, res, "insertRaceNote", json["t"], json["c"], json["uid"]);
  1133. });
  1134. /* 查看随机码是否重复 */
  1135. router.route("/selectInviteCode").all((req, res, next) => {
  1136. var json = queryString(req.url);
  1137. getmysql(req, res, "selectInviteCode", json["code"], json["oid"]);
  1138. });
  1139. /* 查看随机码是否重复 */
  1140. router.route("/selectInviteCode2").all((req, res, next) => {
  1141. var json = queryString(req.url);
  1142. getmysql(req, res, "selectInviteCode2", json["code"], json["oid"]);
  1143. });
  1144. /* 根据随机码获取学校 */
  1145. router.route("/selectCourseByIc").all((req, res, next) => {
  1146. var json = queryString(req.url);
  1147. getmysql(req, res, "selectCourseByIc", json["code"], json["oid"]);
  1148. });
  1149. /* 根据随机码获取学校 */
  1150. router.route("/selectCourseByIc2").all((req, res, next) => {
  1151. var json = queryString(req.url);
  1152. getmysql(req, res, "selectCourseByIc2", json["code"], json["oid"]);
  1153. });
  1154. /* 根据随机码获取学校 */
  1155. router.route("/selectCourseByIc2SZ").all((req, res, next) => {
  1156. var json = queryString(req.url);
  1157. getmysql(req, res, "selectCourseByIc2SZ", json["code"], json["oid"]);
  1158. });
  1159. router.route("/addWorkNew").all((req, res, next) => {
  1160. // postmysql(req, res, "insert_teacher_work_new");
  1161. if (req.body[0]) {
  1162. // p = Object.values(req.body[0]);
  1163. p = [
  1164. req.body[0].uid,
  1165. req.body[0].title,
  1166. req.body[0].brief,
  1167. req.body[0].cover,
  1168. req.body[0].astudent,
  1169. req.body[0].see,
  1170. req.body[0].chapters,
  1171. req.body[0].template,
  1172. ];
  1173. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new");
  1174. //執行存儲過程
  1175. mysql.usselect(p, function(ret) {
  1176. let course = req.body[0].courseType;
  1177. let courseId = ret[0][0].courseId;
  1178. let userid = req.body[0].uid;
  1179. delCourseType(course, courseId, userid);
  1180. res.end(
  1181. JSON.stringify({
  1182. ordernumber: ret[0][0].ordernumber,
  1183. courseId: ret[0][0].courseId,
  1184. success: 1,
  1185. })
  1186. );
  1187. // res.end(JSON.stringify(ret));
  1188. });
  1189. }
  1190. });
  1191. router.route("/addWorkNew2").all((req, res, next) => {
  1192. if (req.body[0]) {
  1193. p = [
  1194. req.body[0].uid,
  1195. req.body[0].title,
  1196. req.body[0].brief,
  1197. req.body[0].cover,
  1198. req.body[0].evaId,
  1199. req.body[0].astudent,
  1200. req.body[0].see,
  1201. req.body[0].chapters,
  1202. req.body[0].template,
  1203. req.body[0].ateacher,
  1204. ];
  1205. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2"); //執行存儲過程
  1206. mysql.usselect(p, function(ret) {
  1207. let course = req.body[0].courseType;
  1208. let courseId = ret[0][0].courseId;
  1209. let userid = req.body[0].uid;
  1210. delCourseType(course, courseId, userid);
  1211. res.end(
  1212. JSON.stringify({
  1213. ordernumber: ret[0][0].ordernumber,
  1214. courseId: ret[0][0].courseId,
  1215. success: 1,
  1216. })
  1217. );
  1218. });
  1219. }
  1220. });
  1221. router.route("/addWorkNew2AI").all((req, res, next) => {
  1222. if (req.body[0]) {
  1223. p = [
  1224. req.body[0].uid,
  1225. req.body[0].title,
  1226. req.body[0].brief,
  1227. req.body[0].cover,
  1228. req.body[0].evaId,
  1229. req.body[0].astudent,
  1230. req.body[0].see,
  1231. req.body[0].chapters,
  1232. req.body[0].template,
  1233. req.body[0].ateacher,
  1234. req.body[0].refile,
  1235. req.body[0].reBrief,
  1236. ];
  1237. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2_ai"); //執行存儲過程
  1238. mysql.usselect(p, function(ret) {
  1239. let course = req.body[0].courseType;
  1240. let courseId = ret[0][0].courseId;
  1241. let userid = req.body[0].uid;
  1242. delCourseType(course, courseId, userid);
  1243. res.end(
  1244. JSON.stringify({
  1245. ordernumber: ret[0][0].ordernumber,
  1246. courseId: ret[0][0].courseId,
  1247. success: 1,
  1248. })
  1249. );
  1250. });
  1251. }
  1252. });
  1253. router.route("/addWorkNew2New").all((req, res, next) => {
  1254. if (req.body[0]) {
  1255. p = [
  1256. req.body[0].uid,
  1257. req.body[0].title,
  1258. req.body[0].brief,
  1259. req.body[0].cover,
  1260. req.body[0].evaId,
  1261. req.body[0].astudent,
  1262. req.body[0].see,
  1263. req.body[0].chapters,
  1264. req.body[0].template,
  1265. req.body[0].ateacher,
  1266. req.body[0].highSetting,
  1267. req.body[0].courseState,
  1268. ];
  1269. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2New"); //執行存儲過程
  1270. mysql.usselect(p, function(ret) {
  1271. let course = req.body[0].courseType;
  1272. let courseId = ret[0][0].courseId;
  1273. let userid = req.body[0].uid;
  1274. delCourseType(course, courseId, userid);
  1275. res.end(
  1276. JSON.stringify({
  1277. ordernumber: ret[0][0].ordernumber,
  1278. courseId: ret[0][0].courseId,
  1279. success: 1,
  1280. })
  1281. );
  1282. });
  1283. }
  1284. });
  1285. router.route("/addTrainCourseNew2").all((req, res, next) => {
  1286. if (req.body[0]) {
  1287. p = [
  1288. req.body[0].uid,
  1289. req.body[0].title,
  1290. req.body[0].brief,
  1291. req.body[0].cover,
  1292. req.body[0].evaId,
  1293. req.body[0].astudent,
  1294. req.body[0].see,
  1295. req.body[0].chapters,
  1296. req.body[0].template,
  1297. req.body[0].ateacher,
  1298. ];
  1299. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addTrainCourseNew2"); //執行存儲過程
  1300. mysql.usselect(p, function(ret) {
  1301. let course = req.body[0].courseType;
  1302. let courseId = ret[0][0].courseId;
  1303. let userid = req.body[0].uid;
  1304. delCourseType(course, courseId, userid);
  1305. res.end(
  1306. JSON.stringify({
  1307. ordernumber: ret[0][0].ordernumber,
  1308. courseId: ret[0][0].courseId,
  1309. success: 1,
  1310. })
  1311. );
  1312. });
  1313. }
  1314. });
  1315. router.route("/addTestCourse").all((req, res, next) => { //添加评测
  1316. if (req.body[0]) {
  1317. p = [
  1318. req.body[0].uid,
  1319. req.body[0].title,
  1320. req.body[0].brief,
  1321. req.body[0].cover,
  1322. req.body[0].evaId,
  1323. req.body[0].astudent,
  1324. req.body[0].see,
  1325. req.body[0].chapters,
  1326. req.body[0].template,
  1327. req.body[0].ateacher,
  1328. req.body[0].typeid,
  1329. req.body[0].overtime,
  1330. req.body[0].j2,
  1331. ];
  1332. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addTestCourse"); //執行存儲過程
  1333. mysql.usselect(p, function(ret) {
  1334. let course = req.body[0].courseType;
  1335. let courseId = ret[0][0].courseId;
  1336. let userid = req.body[0].uid;
  1337. delCourseType(course, courseId, userid);
  1338. res.end(
  1339. JSON.stringify({
  1340. ordernumber: ret[0][0].ordernumber,
  1341. courseId: ret[0][0].courseId,
  1342. success: 1,
  1343. })
  1344. );
  1345. });
  1346. }
  1347. });
  1348. router.route("/addTestCourse2").all((req, res, next) => { //添加评测 类型
  1349. if (req.body[0]) {
  1350. p = [
  1351. req.body[0].uid,
  1352. req.body[0].title,
  1353. req.body[0].brief,
  1354. req.body[0].cover,
  1355. req.body[0].evaId,
  1356. req.body[0].astudent,
  1357. req.body[0].see,
  1358. req.body[0].chapters,
  1359. req.body[0].template,
  1360. req.body[0].ateacher,
  1361. req.body[0].typeid,
  1362. ];
  1363. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addTestCourse2"); //執行存儲過程
  1364. mysql.usselect(p, function(ret) {
  1365. let course = req.body[0].courseType;
  1366. let courseId = ret[0][0].courseId;
  1367. let userid = req.body[0].uid;
  1368. delCourseType(course, courseId, userid);
  1369. res.end(
  1370. JSON.stringify({
  1371. ordernumber: ret[0][0].ordernumber,
  1372. courseId: ret[0][0].courseId,
  1373. success: 1,
  1374. })
  1375. );
  1376. });
  1377. }
  1378. });
  1379. router.route("/addWorkNew2E").all((req, res, next) => {
  1380. if (req.body[0]) {
  1381. p = [
  1382. req.body[0].uid,
  1383. req.body[0].title,
  1384. req.body[0].brief,
  1385. req.body[0].cover,
  1386. req.body[0].evaId,
  1387. req.body[0].astudent,
  1388. req.body[0].see,
  1389. req.body[0].chapters,
  1390. req.body[0].template,
  1391. req.body[0].ateacher,
  1392. ];
  1393. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2E"); //執行存儲過程
  1394. mysql.usselect(p, function(ret) {
  1395. let course = req.body[0].courseType;
  1396. let courseId = ret[0][0].courseId;
  1397. let userid = req.body[0].uid;
  1398. delCourseType(course, courseId, userid);
  1399. res.end(
  1400. JSON.stringify({
  1401. ordernumber: ret[0][0].ordernumber,
  1402. courseId: ret[0][0].courseId,
  1403. success: 1,
  1404. })
  1405. );
  1406. });
  1407. }
  1408. });
  1409. router.route("/addWorkNew2T").all((req, res, next) => {
  1410. if (req.body[0]) {
  1411. p = [
  1412. req.body[0].uid,
  1413. req.body[0].title,
  1414. req.body[0].brief,
  1415. req.body[0].cover,
  1416. req.body[0].evaId,
  1417. req.body[0].astudent,
  1418. req.body[0].see,
  1419. req.body[0].chapters,
  1420. req.body[0].template,
  1421. req.body[0].ateacher,
  1422. ];
  1423. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2T"); //執行存儲過程
  1424. mysql.usselect(p, function(ret) {
  1425. let course = req.body[0].courseType;
  1426. let courseId = ret[0][0].courseId;
  1427. let userid = req.body[0].uid;
  1428. delCourseType(course, courseId, userid);
  1429. res.end(
  1430. JSON.stringify({
  1431. ordernumber: ret[0][0].ordernumber,
  1432. courseId: ret[0][0].courseId,
  1433. success: 1,
  1434. })
  1435. );
  1436. });
  1437. }
  1438. });
  1439. router.route("/addTrainCourseNew2T").all((req, res, next) => {
  1440. if (req.body[0]) {
  1441. p = [
  1442. req.body[0].uid,
  1443. req.body[0].title,
  1444. req.body[0].brief,
  1445. req.body[0].cover,
  1446. req.body[0].evaId,
  1447. req.body[0].astudent,
  1448. req.body[0].see,
  1449. req.body[0].chapters,
  1450. req.body[0].template,
  1451. req.body[0].ateacher,
  1452. ];
  1453. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addTrainCourseNew2T"); //執行存儲過程
  1454. mysql.usselect(p, function(ret) {
  1455. let course = req.body[0].courseType;
  1456. let courseId = ret[0][0].courseId;
  1457. let userid = req.body[0].uid;
  1458. delCourseType(course, courseId, userid);
  1459. res.end(
  1460. JSON.stringify({
  1461. ordernumber: ret[0][0].ordernumber,
  1462. courseId: ret[0][0].courseId,
  1463. success: 1,
  1464. })
  1465. );
  1466. });
  1467. }
  1468. });
  1469. router.route("/addSynergyCourse").all((req, res, next) => {
  1470. if (req.body[0]) {
  1471. p = [
  1472. req.body[0].uid,
  1473. req.body[0].title,
  1474. req.body[0].brief,
  1475. req.body[0].cover,
  1476. req.body[0].evaId,
  1477. req.body[0].astudent,
  1478. req.body[0].see,
  1479. req.body[0].chapters,
  1480. req.body[0].template,
  1481. req.body[0].ateacher,
  1482. ];
  1483. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_synergy"); //執行存儲過程
  1484. mysql.usselect(p, function(ret) {
  1485. let course = req.body[0].courseType;
  1486. let courseId = ret[0][0].courseId;
  1487. let userid = req.body[0].uid;
  1488. delCourseType(course, courseId, userid);
  1489. res.end(
  1490. JSON.stringify({
  1491. ordernumber: ret[0][0].ordernumber,
  1492. courseId: ret[0][0].courseId,
  1493. success: 1,
  1494. })
  1495. );
  1496. });
  1497. }
  1498. });
  1499. router.route("/addSynergyCourse2").all((req, res, next) => {
  1500. if (req.body[0]) {
  1501. p = [
  1502. req.body[0].cid,
  1503. req.body[0].uid,
  1504. req.body[0].title,
  1505. req.body[0].brief,
  1506. req.body[0].cover,
  1507. req.body[0].evaId,
  1508. req.body[0].astudent,
  1509. req.body[0].see,
  1510. req.body[0].chapters,
  1511. req.body[0].template,
  1512. req.body[0].ateacher,
  1513. ];
  1514. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_synergy2"); //執行存儲過程
  1515. mysql.usselect(p, function(ret) {
  1516. let course = req.body[0].courseType;
  1517. let courseId = ret[0][0].courseId;
  1518. let userid = req.body[0].uid;
  1519. delCourseType(course, courseId, userid);
  1520. res.end(
  1521. JSON.stringify({
  1522. ordernumber: ret[0][0].ordernumber,
  1523. courseId: ret[0][0].courseId,
  1524. success: 1,
  1525. })
  1526. );
  1527. });
  1528. }
  1529. });
  1530. router.route("/addWorkNew4").all((req, res, next) => {
  1531. if (req.body[0]) {
  1532. p = [
  1533. req.body[0].uid,
  1534. req.body[0].title,
  1535. req.body[0].brief,
  1536. req.body[0].cover,
  1537. req.body[0].evaId,
  1538. req.body[0].astudent,
  1539. req.body[0].see,
  1540. req.body[0].chapters,
  1541. req.body[0].template,
  1542. req.body[0].ateacher,
  1543. req.body[0].inviteCode,
  1544. ];
  1545. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new4"); //執行存儲過程
  1546. mysql.usselect(p, function(ret) {
  1547. let course = req.body[0].courseType;
  1548. let courseId = ret[0][0].courseId;
  1549. let userid = req.body[0].uid;
  1550. delCourseType(course, courseId, userid);
  1551. res.end(
  1552. JSON.stringify({
  1553. ordernumber: ret[0][0].ordernumber,
  1554. courseId: ret[0][0].courseId,
  1555. success: 1,
  1556. })
  1557. );
  1558. });
  1559. }
  1560. });
  1561. router.route("/addCourseWorkNew2").all((req, res, next) => {
  1562. //学生
  1563. if (req.body[0]) {
  1564. p = [
  1565. req.body[0].uid,
  1566. req.body[0].title,
  1567. req.body[0].brief,
  1568. req.body[0].cover,
  1569. req.body[0].evaId,
  1570. req.body[0].astudent,
  1571. req.body[0].see,
  1572. req.body[0].chapters,
  1573. req.body[0].template,
  1574. req.body[0].ateacher,
  1575. ];
  1576. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addCourseWorkNew2"); //執行存儲過程
  1577. mysql.usselect(p, function(ret) {
  1578. let course = req.body[0].courseType;
  1579. let courseId = ret[0][0].courseId;
  1580. let userid = req.body[0].uid;
  1581. delCourseType(course, courseId, userid);
  1582. res.end(
  1583. JSON.stringify({
  1584. ordernumber: ret[0][0].ordernumber,
  1585. courseId: ret[0][0].courseId,
  1586. success: 1,
  1587. })
  1588. );
  1589. });
  1590. }
  1591. });
  1592. router.route("/addCourseWorkNew22").all((req, res, next) => {
  1593. //学生
  1594. if (req.body[0]) {
  1595. p = [
  1596. req.body[0].uid,
  1597. req.body[0].title,
  1598. req.body[0].brief,
  1599. req.body[0].cover,
  1600. req.body[0].evaId,
  1601. req.body[0].astudent,
  1602. req.body[0].see,
  1603. req.body[0].chapters,
  1604. req.body[0].template,
  1605. req.body[0].ateacher,
  1606. ];
  1607. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addCourseWorkNew2"); //執行存儲過程
  1608. mysql.usselect(p, function(ret) {
  1609. let course = req.body[0].courseType;
  1610. let courseId = ret[0][0].courseId;
  1611. let userid = req.body[0].uid;
  1612. delCourseTypeS(course, courseId, userid);
  1613. res.end(
  1614. JSON.stringify({
  1615. ordernumber: ret[0][0].ordernumber,
  1616. courseId: ret[0][0].courseId,
  1617. success: 1,
  1618. })
  1619. );
  1620. });
  1621. }
  1622. });
  1623. //新增赛事项目
  1624. router.route("/addRace").all((req, res, next) => {
  1625. if (req.body[0]) {
  1626. p = [
  1627. req.body[0].uid,
  1628. req.body[0].info,
  1629. req.body[0].over,
  1630. req.body[0].pro,
  1631. req.body[0].act,
  1632. req.body[0].exc,
  1633. req.body[0].res,
  1634. ];
  1635. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addRace"); //執行存儲過程
  1636. mysql.usselect(p, function(ret) {
  1637. let course = req.body[0].courseType;
  1638. let courseId = ret[0][0].id;
  1639. let userid = req.body[0].uid;
  1640. delCourseType1(course, courseId, userid);
  1641. res.end(JSON.stringify({ courseId: courseId, success: 1 }));
  1642. });
  1643. }
  1644. });
  1645. //新增赛事账号信息
  1646. router.route("/addRaceUser").all((req, res, next) => {
  1647. if (req.body[0]) {
  1648. p = [
  1649. req.body[0].reg,
  1650. req.body[0].res,
  1651. req.body[0].sch,
  1652. req.body[0].n,
  1653. req.body[0].p,
  1654. req.body[0].t,
  1655. req.body[0].parent,
  1656. ];
  1657. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addRaceUser"); //執行存儲過程
  1658. mysql.usselect(p, function(ret) {
  1659. let num = ret[0][0].num;
  1660. let userid = ret[0][0].userid;
  1661. if (num < 10) {
  1662. num = "SZ" + "00" + num + "@gdae.com";
  1663. } else if (num < 100) {
  1664. num = "SZ" + "0" + num + "@gdae.com";
  1665. } else if (num > 100) {
  1666. num = "SZ" + num + "@gdae.com";
  1667. }
  1668. y = [userid, num, bcrypt.hashSync("123456", bcrypt.genSaltSync(10))];
  1669. //参数拼接,注册
  1670. y.unshift(_mysqlLabor[0], _mysqlLabor[1], "upRaceUserNamePassword");
  1671. mysql.usselect(y, function(ret) {
  1672. res.end(JSON.stringify(ret));
  1673. });
  1674. res.end(JSON.stringify({ num: num, success: 1 }));
  1675. });
  1676. }
  1677. });
  1678. //修改赛事项目
  1679. router.route("/updateRace").all((req, res, next) => {
  1680. if (req.body[0]) {
  1681. p = [
  1682. req.body[0].id,
  1683. req.body[0].info,
  1684. req.body[0].over,
  1685. req.body[0].pro,
  1686. req.body[0].act,
  1687. req.body[0].exc,
  1688. req.body[0].res,
  1689. ];
  1690. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateRace"); //執行存儲過程
  1691. mysql.usselect(p, function(ret) {
  1692. let course = req.body[0].courseType;
  1693. let courseId = req.body[0].id;
  1694. let userid = req.body[0].uid;
  1695. delCourseType1(course, courseId, userid);
  1696. res.end(JSON.stringify({ success: 1 }));
  1697. });
  1698. }
  1699. });
  1700. router.route("/addWorkNew3").all((req, res, next) => {
  1701. if (req.body[0]) {
  1702. p = [
  1703. req.body[0].uid,
  1704. req.body[0].title,
  1705. req.body[0].brief,
  1706. req.body[0].cover,
  1707. req.body[0].astudent,
  1708. req.body[0].see,
  1709. req.body[0].chapters,
  1710. req.body[0].template,
  1711. req.body[0].ateacher,
  1712. ];
  1713. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new3"); //執行存儲過程
  1714. mysql.usselect(p, function(ret) {
  1715. let course = req.body[0].courseType;
  1716. let courseId = ret[0][0].courseId;
  1717. let userid = req.body[0].uid;
  1718. delCourseType(course, courseId, userid);
  1719. res.end(
  1720. JSON.stringify({
  1721. ordernumber: ret[0][0].ordernumber,
  1722. courseId: ret[0][0].courseId,
  1723. success: 1,
  1724. })
  1725. );
  1726. });
  1727. }
  1728. });
  1729. router.route("/addInviteCode").all((req, res, next) => {
  1730. if (req.body[0]) {
  1731. addCourseInviteCode(
  1732. req.body[0].courseId,
  1733. JSON.parse(decodeURIComponent(req.body[0].inviteCode))
  1734. );
  1735. }
  1736. });
  1737. function delCourseInviteCode(courseId, inviteCode) {
  1738. let _courseId = courseId;
  1739. var _userdata = [_courseId];
  1740. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_courseInviteCode");
  1741. mysql.usselect(_userdata, function(ret) {
  1742. // console.log(ret);
  1743. addCourseInviteCode(_courseId, inviteCode);
  1744. });
  1745. }
  1746. function delCourseType(course, courseId, userid) {
  1747. let _courseId = courseId;
  1748. var _userdata = [_courseId];
  1749. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_courseType");
  1750. mysql.usselect(_userdata, function(ret) {
  1751. // console.log(ret);
  1752. addCourseType(userid, course, _courseId);
  1753. });
  1754. // setTimeout(() => {
  1755. // }, 1000);
  1756. }
  1757. function delCourseType1(course, courseId, userid) {
  1758. let _courseId = courseId;
  1759. var _userdata = [_courseId];
  1760. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_courseType1");
  1761. mysql.usselect(_userdata, function(ret) {
  1762. // console.log(ret);
  1763. });
  1764. setTimeout(() => {
  1765. addCourseType1(userid, course, _courseId);
  1766. }, 1000);
  1767. }
  1768. function delCourseTypeS(course, courseId, userid) {
  1769. let _courseId = courseId;
  1770. var _userdata = [_courseId];
  1771. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_courseTypeS");
  1772. mysql.usselect(_userdata, function(ret) {
  1773. // console.log(ret);
  1774. addCourseTypeS(userid, course, _courseId);
  1775. });
  1776. // setTimeout(() => {
  1777. // }, 1000);
  1778. }
  1779. function addCourseInviteCode(courseId, inviteCode) {
  1780. var _courses = courseId;
  1781. var _tid = inviteCode;
  1782. for (let i = 0; i < _tid.length; i++) {
  1783. let _userdata = [_courses, _tid[i].cid, _tid[i].ic];
  1784. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_courseInviteCode");
  1785. setTimeout(() => {
  1786. mysql.usselect(_userdata, function(ret) {
  1787. // console.log(ret);
  1788. });
  1789. }, i * 500);
  1790. }
  1791. }
  1792. function addCourseType(userid, course, _courseId) {
  1793. var _uid = userid;
  1794. var _courses = _courseId;
  1795. var _tid = JSON.parse(decodeURIComponent(course));
  1796. for (let i = 0; i < _tid.length; i++) {
  1797. if (_tid[i] == "") {
  1798. continue;
  1799. }
  1800. var _userdata = [_courses, _tid[i], _uid];
  1801. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_courseType");
  1802. mysql.usselect(_userdata, function(ret) {
  1803. // console.log(ret);
  1804. });
  1805. }
  1806. }
  1807. function addCourseType1(userid, course, _courseId) {
  1808. var _uid = userid;
  1809. var _courses = _courseId;
  1810. var _tid = JSON.parse(decodeURIComponent(course));
  1811. for (let i = 0; i < _tid.length; i++) {
  1812. if (_tid[i] == "") {
  1813. continue;
  1814. }
  1815. var _userdata = [_courses, _tid[i], _uid];
  1816. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_courseType1");
  1817. mysql.usselect(_userdata, function(ret) {
  1818. // console.log(ret);
  1819. });
  1820. }
  1821. }
  1822. function addCourseTypeS(userid, course, _courseId) {
  1823. var _uid = userid;
  1824. var _courses = _courseId;
  1825. var _tid = JSON.parse(decodeURIComponent(course));
  1826. for (let i = 0; i < _tid.length; i++) {
  1827. if (_tid[i] == "") {
  1828. continue;
  1829. }
  1830. var _userdata = [_courses, _tid[i], _uid];
  1831. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_courseTypeS");
  1832. mysql.usselect(_userdata, function(ret) {
  1833. // console.log(ret);
  1834. });
  1835. }
  1836. }
  1837. //修改课程
  1838. // router.route('/updateWork').all((req, res, next) => {
  1839. // postmysql(req, res, "update_teacher_work");
  1840. // });
  1841. router.route("/updateWorkNew").all((req, res, next) => {
  1842. if (req.body[0]) {
  1843. // p = Object.values(req.body[0]);
  1844. p = [
  1845. req.body[0].cid,
  1846. req.body[0].title,
  1847. req.body[0].brief,
  1848. req.body[0].cover,
  1849. req.body[0].astudent,
  1850. req.body[0].see,
  1851. req.body[0].chapters,
  1852. req.body[0].template,
  1853. ];
  1854. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new");
  1855. //執行存儲過程
  1856. mysql.usselect(p, function(ret) {
  1857. let course = req.body[0].courseType;
  1858. let courseId = req.body[0].cid;
  1859. let userid = req.body[0].uid;
  1860. delCourseType(course, courseId, userid);
  1861. res.end(JSON.stringify({ success: 1 }));
  1862. // res.end(JSON.stringify(ret));
  1863. });
  1864. }
  1865. });
  1866. //查询课程
  1867. // router.route('/selectCourse').all((req, res, next) => {
  1868. // var json = queryString(req.url);
  1869. // getmysql(req, res, "select_course", json['type'], json['uid'], json['oid'], json['page'], 10);
  1870. // });
  1871. router.route("/updateWorkNew2").all((req, res, next) => {
  1872. if (req.body[0]) {
  1873. p = [
  1874. req.body[0].cid,
  1875. req.body[0].title,
  1876. req.body[0].brief,
  1877. req.body[0].cover,
  1878. req.body[0].evaId,
  1879. req.body[0].astudent,
  1880. req.body[0].see,
  1881. req.body[0].chapters,
  1882. req.body[0].template,
  1883. req.body[0].ateacher,
  1884. ];
  1885. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new2"); //執行存儲過程
  1886. mysql.usselect(p, function(ret) {
  1887. let course = req.body[0].courseType;
  1888. let courseId = req.body[0].cid;
  1889. let userid = req.body[0].uid;
  1890. delCourseType(course, courseId, userid);
  1891. res.end(JSON.stringify({ success: 1 }));
  1892. });
  1893. }
  1894. });
  1895. router.route("/updateWorkNew2AI").all((req, res, next) => {
  1896. if (req.body[0]) {
  1897. p = [
  1898. req.body[0].cid,
  1899. req.body[0].title,
  1900. req.body[0].brief,
  1901. req.body[0].cover,
  1902. req.body[0].evaId,
  1903. req.body[0].astudent,
  1904. req.body[0].see,
  1905. req.body[0].chapters,
  1906. req.body[0].template,
  1907. req.body[0].ateacher,
  1908. req.body[0].refile,
  1909. req.body[0].reBrief,
  1910. ];
  1911. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new2_ai"); //執行存儲過程
  1912. mysql.usselect(p, function(ret) {
  1913. let course = req.body[0].courseType;
  1914. let courseId = req.body[0].cid;
  1915. let userid = req.body[0].uid;
  1916. delCourseType(course, courseId, userid);
  1917. res.end(JSON.stringify({ success: 1 }));
  1918. });
  1919. }
  1920. });
  1921. router.route("/updateWorkNew2New").all((req, res, next) => {
  1922. if (req.body[0]) {
  1923. p = [
  1924. req.body[0].cid,
  1925. req.body[0].title,
  1926. req.body[0].brief,
  1927. req.body[0].cover,
  1928. req.body[0].evaId,
  1929. req.body[0].astudent,
  1930. req.body[0].see,
  1931. req.body[0].chapters,
  1932. req.body[0].template,
  1933. req.body[0].ateacher,
  1934. req.body[0].highSetting
  1935. ];
  1936. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new2New"); //執行存儲過程
  1937. mysql.usselect(p, function(ret) {
  1938. let course = req.body[0].courseType;
  1939. let courseId = req.body[0].cid;
  1940. let userid = req.body[0].uid;
  1941. delCourseType(course, courseId, userid);
  1942. res.end(JSON.stringify({ success: 1 }));
  1943. });
  1944. }
  1945. });
  1946. router.route("/updateTrainCourseNew2").all((req, res, next) => {
  1947. if (req.body[0]) {
  1948. p = [
  1949. req.body[0].cid,
  1950. req.body[0].title,
  1951. req.body[0].brief,
  1952. req.body[0].cover,
  1953. req.body[0].evaId,
  1954. req.body[0].astudent,
  1955. req.body[0].see,
  1956. req.body[0].chapters,
  1957. req.body[0].template,
  1958. req.body[0].ateacher,
  1959. ];
  1960. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew2"); //執行存儲過程
  1961. mysql.usselect(p, function(ret) {
  1962. let course = req.body[0].courseType;
  1963. let courseId = req.body[0].cid;
  1964. let userid = req.body[0].uid;
  1965. delCourseType(course, courseId, userid);
  1966. res.end(JSON.stringify({ success: 1 }));
  1967. });
  1968. }
  1969. });
  1970. router.route("/updateTestCourse").all((req, res, next) => { //修改评测
  1971. if (req.body[0]) {
  1972. p = [
  1973. req.body[0].cid,
  1974. req.body[0].title,
  1975. req.body[0].brief,
  1976. req.body[0].cover,
  1977. req.body[0].evaId,
  1978. req.body[0].astudent,
  1979. req.body[0].see,
  1980. req.body[0].chapters,
  1981. req.body[0].template,
  1982. req.body[0].ateacher,
  1983. req.body[0].look,
  1984. req.body[0].typeid,
  1985. req.body[0].overtime,
  1986. req.body[0].j2,
  1987. ];
  1988. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTestCourse"); //執行存儲過程
  1989. mysql.usselect(p, function(ret) {
  1990. let course = req.body[0].courseType;
  1991. let courseId = req.body[0].cid;
  1992. let userid = req.body[0].uid;
  1993. delCourseType(course, courseId, userid);
  1994. res.end(JSON.stringify({ success: 1 }));
  1995. });
  1996. }
  1997. });
  1998. router.route("/updateTestCourse2").all((req, res, next) => { //修改评测
  1999. if (req.body[0]) {
  2000. p = [
  2001. req.body[0].cid,
  2002. req.body[0].title,
  2003. req.body[0].brief,
  2004. req.body[0].cover,
  2005. req.body[0].evaId,
  2006. req.body[0].astudent,
  2007. req.body[0].see,
  2008. req.body[0].chapters,
  2009. req.body[0].template,
  2010. req.body[0].ateacher,
  2011. req.body[0].look,
  2012. req.body[0].typeid,
  2013. ];
  2014. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTestCourse2"); //執行存儲過程
  2015. mysql.usselect(p, function(ret) {
  2016. let course = req.body[0].courseType;
  2017. let courseId = req.body[0].cid;
  2018. let userid = req.body[0].uid;
  2019. delCourseType(course, courseId, userid);
  2020. res.end(JSON.stringify({ success: 1 }));
  2021. });
  2022. }
  2023. });
  2024. router.route("/updateSynergy").all((req, res, next) => {
  2025. if (req.body[0]) {
  2026. p = [
  2027. req.body[0].cid,
  2028. req.body[0].title,
  2029. req.body[0].brief,
  2030. req.body[0].cover,
  2031. req.body[0].evaId,
  2032. req.body[0].astudent,
  2033. req.body[0].see,
  2034. req.body[0].chapters,
  2035. req.body[0].template,
  2036. req.body[0].ateacher,
  2037. ];
  2038. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_synergy"); //執行存儲過程
  2039. mysql.usselect(p, function(ret) {
  2040. let course = req.body[0].courseType;
  2041. let courseId = req.body[0].cid;
  2042. let userid = req.body[0].uid;
  2043. delCourseType(course, courseId, userid);
  2044. res.end(JSON.stringify({ success: 1 }));
  2045. });
  2046. }
  2047. });
  2048. router.route("/updateWorkNew5").all((req, res, next) => {
  2049. if (req.body[0]) {
  2050. p = [
  2051. req.body[0].cid,
  2052. req.body[0].title,
  2053. req.body[0].brief,
  2054. req.body[0].cover,
  2055. req.body[0].evaId,
  2056. req.body[0].astudent,
  2057. req.body[0].see,
  2058. req.body[0].chapters,
  2059. req.body[0].template,
  2060. req.body[0].ateacher,
  2061. req.body[0].inviteCode,
  2062. ];
  2063. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new5"); //執行存儲過程
  2064. mysql.usselect(p, function(ret) {
  2065. let course = req.body[0].courseType;
  2066. let courseId = req.body[0].cid;
  2067. let userid = req.body[0].uid;
  2068. delCourseType(course, courseId, userid);
  2069. res.end(JSON.stringify({ success: 1 }));
  2070. });
  2071. }
  2072. });
  2073. router.route("/updateStudentWorkNew2").all((req, res, next) => {
  2074. //学生
  2075. if (req.body[0]) {
  2076. p = [
  2077. req.body[0].cid,
  2078. req.body[0].title,
  2079. req.body[0].brief,
  2080. req.body[0].cover,
  2081. req.body[0].evaId,
  2082. req.body[0].astudent,
  2083. req.body[0].see,
  2084. req.body[0].chapters,
  2085. req.body[0].template,
  2086. req.body[0].ateacher,
  2087. ];
  2088. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudentWorkNew2"); //執行存儲過程
  2089. mysql.usselect(p, function(ret) {
  2090. let course = req.body[0].courseType;
  2091. let courseId = req.body[0].cid;
  2092. let userid = req.body[0].uid;
  2093. delCourseType(course, courseId, userid);
  2094. res.end(JSON.stringify({ success: 1 }));
  2095. });
  2096. }
  2097. });
  2098. router.route("/updateStudentWorkNew22").all((req, res, next) => {
  2099. //学生
  2100. if (req.body[0]) {
  2101. p = [
  2102. req.body[0].cid,
  2103. req.body[0].title,
  2104. req.body[0].brief,
  2105. req.body[0].cover,
  2106. req.body[0].evaId,
  2107. req.body[0].astudent,
  2108. req.body[0].see,
  2109. req.body[0].chapters,
  2110. req.body[0].template,
  2111. req.body[0].ateacher,
  2112. ];
  2113. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudentWorkNew2"); //執行存儲過程
  2114. mysql.usselect(p, function(ret) {
  2115. let course = req.body[0].courseType;
  2116. let courseId = req.body[0].cid;
  2117. let userid = req.body[0].uid;
  2118. delCourseTypeS(course, courseId, userid);
  2119. res.end(JSON.stringify({ success: 1 }));
  2120. });
  2121. }
  2122. });
  2123. router.route("/updateWorkNew3").all((req, res, next) => {
  2124. if (req.body[0]) {
  2125. p = [
  2126. req.body[0].cid,
  2127. req.body[0].title,
  2128. req.body[0].brief,
  2129. req.body[0].cover,
  2130. req.body[0].astudent,
  2131. req.body[0].see,
  2132. req.body[0].chapters,
  2133. req.body[0].template,
  2134. req.body[0].ateacher,
  2135. ];
  2136. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new3"); //執行存儲過程
  2137. mysql.usselect(p, function(ret) {
  2138. let course = req.body[0].courseType;
  2139. let courseId = req.body[0].cid;
  2140. let userid = req.body[0].uid;
  2141. delCourseType(course, courseId, userid);
  2142. res.end(JSON.stringify({ success: 1 }));
  2143. });
  2144. }
  2145. });
  2146. function guid() {
  2147. var _num,
  2148. i,
  2149. _guid = "";
  2150. for (i = 0; i < 32; i++) {
  2151. _guid += Math.floor(Math.random() * 16).toString(16); //随机0 - 16 的数字 转变为16进制的字符串
  2152. _num = Math.floor((i - 7) / 4); //计算 (i-7)除4
  2153. if (_num > -1 && _num < 4 && i == 7 + 4 * _num) {
  2154. //会使guid中间加 "-" 形式为xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  2155. _guid += "-";
  2156. }
  2157. }
  2158. return _guid;
  2159. }
  2160. router.route("/updateWorkNew4").all((req, res, next) => {
  2161. if (req.body[0]) {
  2162. let p = [req.body[0].cid];
  2163. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_course_detail"); //執行存儲過程
  2164. mysql.usselect(p, function(ret) {
  2165. let _unitIndex = parseInt(req.body[0].unitIndex);
  2166. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2167. let _unitJson = JSON.parse(ret[0][0].chapters);
  2168. if (_unitJson.length - 1 < _unitIndex) {
  2169. let _i = _unitIndex - (_unitJson.length - 1);
  2170. for (let i = 0; i < _i; i++) {
  2171. _unitJson.push({
  2172. dyName: "", //单元标题
  2173. chapterInfo: [{
  2174. isread: false,
  2175. chapterid: guid(),
  2176. title: "",
  2177. courseName: "",
  2178. taskJson: [{
  2179. task: "",
  2180. taskDetail: "",
  2181. chapterData: [],
  2182. toolText: "",
  2183. toolChoose: [{
  2184. tool: [],
  2185. toolDetail: "",
  2186. toolType: 0,
  2187. askCount: 1,
  2188. askTitle: "",
  2189. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  2190. }, ],
  2191. isShowTools: false,
  2192. askCount: 1,
  2193. isFold: 0,
  2194. askTitle: "",
  2195. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  2196. checkJson: [{ checkCount: [], checkPerent: [] }],
  2197. homeworkList: [],
  2198. }, ],
  2199. itemCount: 1,
  2200. fileList1: [],
  2201. video: [],
  2202. testData: [],
  2203. pData: [],
  2204. templateArray: [],
  2205. }, ],
  2206. });
  2207. }
  2208. _unitJson[_unitIndex] = _chapters[_unitIndex];
  2209. } else {
  2210. _unitJson[_unitIndex] = _chapters[_unitIndex];
  2211. }
  2212. // console.log(_unitJson);
  2213. let p2 = [
  2214. req.body[0].cid,
  2215. // JSON.stringify(_unitJson).replaceAll(/%/g, "%25")
  2216. encodeURIComponent(JSON.stringify(_unitJson)),
  2217. ];
  2218. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new4"); //執行存儲過程
  2219. mysql.usselect(p2, function(ret) {
  2220. res.end(JSON.stringify({ success: 1 }));
  2221. });
  2222. // res.end(JSON.stringify({ success: 1 }));
  2223. });
  2224. }
  2225. });
  2226. router.route("/updateTrainCourseNew4").all((req, res, next) => {
  2227. if (req.body[0]) {
  2228. let p = [req.body[0].cid];
  2229. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_trainCourse_detail"); //執行存儲過程
  2230. mysql.usselect(p, function(ret) {
  2231. let _unitIndex = parseInt(req.body[0].unitIndex);
  2232. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2233. let _unitJson = JSON.parse(ret[0][0].chapters);
  2234. if (_unitJson.length - 1 < _unitIndex) {
  2235. let _i = _unitIndex - (_unitJson.length - 1);
  2236. for (let i = 0; i < _i; i++) {
  2237. _unitJson.push({
  2238. dyName: "", //单元标题
  2239. chapterInfo: [{
  2240. isread: false,
  2241. chapterid: guid(),
  2242. title: "",
  2243. courseName: "",
  2244. taskJson: [{
  2245. task: "",
  2246. taskDetail: "",
  2247. chapterData: [],
  2248. toolText: "",
  2249. toolChoose: [{
  2250. tool: [],
  2251. toolDetail: "",
  2252. toolType: 0,
  2253. askCount: 1,
  2254. askTitle: "",
  2255. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  2256. }, ],
  2257. isShowTools: false,
  2258. askCount: 1,
  2259. isFold: 0,
  2260. askTitle: "",
  2261. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  2262. checkJson: [{ checkCount: [], checkPerent: [] }],
  2263. homeworkList: [],
  2264. }, ],
  2265. itemCount: 1,
  2266. fileList1: [],
  2267. video: [],
  2268. testData: [],
  2269. pData: [],
  2270. templateArray: [],
  2271. }, ],
  2272. });
  2273. }
  2274. _unitJson[_unitIndex] = _chapters[_unitIndex];
  2275. } else {
  2276. _unitJson[_unitIndex] = _chapters[_unitIndex];
  2277. }
  2278. // console.log(_unitJson);
  2279. let p2 = [
  2280. req.body[0].cid,
  2281. encodeURIComponent(JSON.stringify(_unitJson)),
  2282. ];
  2283. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew4"); //執行存儲過程
  2284. mysql.usselect(p2, function(ret) {
  2285. res.end(JSON.stringify({ success: 1 }));
  2286. });
  2287. // res.end(JSON.stringify({ success: 1 }));
  2288. });
  2289. }
  2290. });
  2291. router.route("/updateStudentWorkNew4").all((req, res, next) => {
  2292. //学生
  2293. if (req.body[0]) {
  2294. let p = [req.body[0].cid];
  2295. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_student_course_detail2"); //執行存儲過程
  2296. mysql.usselect(p, function(ret) {
  2297. let _unitIndex = parseInt(req.body[0].unitIndex);
  2298. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2299. let _unitJson = JSON.parse(ret[0][0].chapters);
  2300. if (_unitJson.length - 1 < _unitIndex) {
  2301. let _i = _unitIndex - (_unitJson.length - 1);
  2302. for (let i = 0; i < _i; i++) {
  2303. _unitJson.push({
  2304. dyName: "", //单元标题
  2305. chapterInfo: [{
  2306. isread: false,
  2307. chapterid: guid(),
  2308. title: "",
  2309. courseName: "",
  2310. taskJson: [{
  2311. task: "",
  2312. taskDetail: "",
  2313. chapterData: [],
  2314. toolText: "",
  2315. toolChoose: [{
  2316. tool: [],
  2317. toolDetail: "",
  2318. toolType: 0,
  2319. askCount: 1,
  2320. askTitle: "",
  2321. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  2322. }, ],
  2323. isShowTools: false,
  2324. askCount: 1,
  2325. isFold: 0,
  2326. askTitle: "",
  2327. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  2328. checkJson: [{ checkCount: [], checkPerent: [] }],
  2329. homeworkList: [],
  2330. }, ],
  2331. itemCount: 1,
  2332. fileList1: [],
  2333. video: [],
  2334. testData: [],
  2335. pData: [],
  2336. templateArray: [],
  2337. }, ],
  2338. });
  2339. }
  2340. _unitJson[_unitIndex] = _chapters[_unitIndex];
  2341. } else {
  2342. _unitJson[_unitIndex] = _chapters[_unitIndex];
  2343. }
  2344. // console.log(_unitJson);
  2345. let p2 = [
  2346. req.body[0].cid,
  2347. encodeURIComponent(JSON.stringify(_unitJson)),
  2348. ];
  2349. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudentWorkNew4"); //執行存儲過程
  2350. mysql.usselect(p2, function(ret) {
  2351. res.end(JSON.stringify({ success: 1 }));
  2352. });
  2353. // res.end(JSON.stringify({ success: 1 }));
  2354. });
  2355. }
  2356. });
  2357. //协同删除阶段
  2358. router.route("/deleteWork").all((req, res, next) => {
  2359. if (req.body[0]) {
  2360. let p = [req.body[0].cid];
  2361. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_course_detail"); //執行存儲過程
  2362. mysql.usselect(p, function(ret) {
  2363. let _chapid = req.body[0].chapid;
  2364. // console.log(_chapid);
  2365. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2366. let _unitJson = JSON.parse(ret[0][0].chapters);
  2367. let _unitJson2 = [];
  2368. for (var i = 0; i < _unitJson.length; i++) {
  2369. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  2370. // console.log(1);
  2371. // _unitJson.splice(i, -1)
  2372. _unitJson2.push(_unitJson[i]);
  2373. // break;
  2374. }
  2375. }
  2376. // console.log(_unitJson2);
  2377. let p2 = [
  2378. req.body[0].cid,
  2379. encodeURIComponent(JSON.stringify(_unitJson2)),
  2380. ];
  2381. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new4"); //執行存儲過程
  2382. mysql.usselect(p2, function(ret) {
  2383. res.end(JSON.stringify({ success: 1 }));
  2384. });
  2385. // res.end(JSON.stringify({ success: 1 }));
  2386. });
  2387. }
  2388. });
  2389. router.route("/deletetrainCourseWork").all((req, res, next) => {
  2390. if (req.body[0]) {
  2391. let p = [req.body[0].cid];
  2392. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_trainCourse_detail"); //執行存儲過程
  2393. mysql.usselect(p, function(ret) {
  2394. let _chapid = req.body[0].chapid;
  2395. // console.log(_chapid);
  2396. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2397. let _unitJson = JSON.parse(ret[0][0].chapters);
  2398. let _unitJson2 = [];
  2399. for (var i = 0; i < _unitJson.length; i++) {
  2400. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  2401. // console.log(1);
  2402. // _unitJson.splice(i, -1)
  2403. _unitJson2.push(_unitJson[i]);
  2404. // break;
  2405. }
  2406. }
  2407. // console.log(_unitJson2);
  2408. let p2 = [
  2409. req.body[0].cid,
  2410. encodeURIComponent(JSON.stringify(_unitJson2)),
  2411. ];
  2412. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew4"); //執行存儲過程
  2413. mysql.usselect(p2, function(ret) {
  2414. res.end(JSON.stringify({ success: 1 }));
  2415. });
  2416. // res.end(JSON.stringify({ success: 1 }));
  2417. });
  2418. }
  2419. });
  2420. //协同删除阶段
  2421. router.route("/deleteStudentWork").all((req, res, next) => {
  2422. //学生
  2423. if (req.body[0]) {
  2424. let p = [req.body[0].cid];
  2425. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_student_course_detail2"); //執行存儲過程
  2426. mysql.usselect(p, function(ret) {
  2427. let _chapid = req.body[0].chapid;
  2428. // console.log(_chapid);
  2429. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2430. let _unitJson = JSON.parse(ret[0][0].chapters);
  2431. let _unitJson2 = [];
  2432. for (var i = 0; i < _unitJson.length; i++) {
  2433. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  2434. // console.log(1);
  2435. // _unitJson.splice(i, -1)
  2436. _unitJson2.push(_unitJson[i]);
  2437. // break;
  2438. }
  2439. }
  2440. // console.log(_unitJson2);
  2441. let p2 = [
  2442. req.body[0].cid,
  2443. encodeURIComponent(JSON.stringify(_unitJson2)),
  2444. ];
  2445. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudentWorkNew4"); //執行存儲過程
  2446. mysql.usselect(p2, function(ret) {
  2447. res.end(JSON.stringify({ success: 1 }));
  2448. });
  2449. // res.end(JSON.stringify({ success: 1 }));
  2450. });
  2451. }
  2452. });
  2453. //协同恢复删除的阶段
  2454. router.route("/restoreWork").all((req, res, next) => {
  2455. if (req.body[0]) {
  2456. let p = [req.body[0].cid];
  2457. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_course_detail"); //執行存儲過程
  2458. mysql.usselect(p, function(ret) {
  2459. let _chapid = req.body[0].chapid;
  2460. // console.log(_chapid);
  2461. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2462. let _unitJson = JSON.parse(ret[0][0].chapters);
  2463. let _unitJson2 = [];
  2464. let chpaindex;
  2465. for (var i = 0; i < _chapters.length; i++) {
  2466. if (_chapters[i].chapterInfo[0].chapterid == _chapid) {
  2467. chpaindex = i;
  2468. }
  2469. }
  2470. for (var i = 0; i < _unitJson.length; i++) {
  2471. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  2472. // console.log(1);
  2473. // _unitJson.splice(i, -1)
  2474. _unitJson2.push(_unitJson[i]);
  2475. // break;
  2476. }
  2477. }
  2478. _unitJson2.splice(chpaindex, 0, _chapters[chpaindex]);
  2479. // console.log(_unitJson2);
  2480. let p2 = [
  2481. req.body[0].cid,
  2482. encodeURIComponent(JSON.stringify(_unitJson2)),
  2483. ];
  2484. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new4"); //執行存儲過程
  2485. mysql.usselect(p2, function(ret) {
  2486. res.end(JSON.stringify({ success: 1 }));
  2487. });
  2488. // res.end(JSON.stringify({ success: 1 }));
  2489. });
  2490. }
  2491. });
  2492. //协同恢复删除的阶段
  2493. router.route("/restoreTrainCourse").all((req, res, next) => {
  2494. if (req.body[0]) {
  2495. let p = [req.body[0].cid];
  2496. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_trainCourse_detail"); //執行存儲過程
  2497. mysql.usselect(p, function(ret) {
  2498. let _chapid = req.body[0].chapid;
  2499. // console.log(_chapid);
  2500. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2501. let _unitJson = JSON.parse(ret[0][0].chapters);
  2502. let _unitJson2 = [];
  2503. let chpaindex;
  2504. for (var i = 0; i < _chapters.length; i++) {
  2505. if (_chapters[i].chapterInfo[0].chapterid == _chapid) {
  2506. chpaindex = i;
  2507. }
  2508. }
  2509. for (var i = 0; i < _unitJson.length; i++) {
  2510. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  2511. // console.log(1);
  2512. // _unitJson.splice(i, -1)
  2513. _unitJson2.push(_unitJson[i]);
  2514. // break;
  2515. }
  2516. }
  2517. _unitJson2.splice(chpaindex, 0, _chapters[chpaindex]);
  2518. // console.log(_unitJson2);
  2519. let p2 = [
  2520. req.body[0].cid,
  2521. encodeURIComponent(JSON.stringify(_unitJson2)),
  2522. ];
  2523. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew4"); //執行存儲過程
  2524. mysql.usselect(p2, function(ret) {
  2525. res.end(JSON.stringify({ success: 1 }));
  2526. });
  2527. // res.end(JSON.stringify({ success: 1 }));
  2528. });
  2529. }
  2530. });
  2531. //协同恢复删除的阶段
  2532. router.route("/restoreStudentWork").all((req, res, next) => {
  2533. //学生
  2534. if (req.body[0]) {
  2535. let p = [req.body[0].cid];
  2536. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_student_course_detail2"); //執行存儲過程
  2537. mysql.usselect(p, function(ret) {
  2538. let _chapid = req.body[0].chapid;
  2539. // console.log(_chapid);
  2540. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  2541. let _unitJson = JSON.parse(ret[0][0].chapters);
  2542. let _unitJson2 = [];
  2543. let chpaindex;
  2544. for (var i = 0; i < _chapters.length; i++) {
  2545. if (_chapters[i].chapterInfo[0].chapterid == _chapid) {
  2546. chpaindex = i;
  2547. }
  2548. }
  2549. for (var i = 0; i < _unitJson.length; i++) {
  2550. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  2551. // console.log(1);
  2552. // _unitJson.splice(i, -1)
  2553. _unitJson2.push(_unitJson[i]);
  2554. // break;
  2555. }
  2556. }
  2557. _unitJson2.splice(chpaindex, 0, _chapters[chpaindex]);
  2558. // console.log(_unitJson2);
  2559. let p2 = [
  2560. req.body[0].cid,
  2561. encodeURIComponent(JSON.stringify(_unitJson2)),
  2562. ];
  2563. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudentWorkNew4"); //執行存儲過程
  2564. mysql.usselect(p2, function(ret) {
  2565. res.end(JSON.stringify({ success: 1 }));
  2566. });
  2567. // res.end(JSON.stringify({ success: 1 }));
  2568. });
  2569. }
  2570. });
  2571. router.route("/selectCourseNew").all((req, res, next) => {
  2572. var json = queryString(req.url);
  2573. getmysql(
  2574. req,
  2575. res,
  2576. "select_course_new",
  2577. json["type"],
  2578. json["uid"],
  2579. json["oid"],
  2580. json["typea"],
  2581. json["typeb"],
  2582. json["typec"],
  2583. json["typed"],
  2584. json["typeE"],
  2585. json["cu"],
  2586. json["cn"],
  2587. json["page"],
  2588. 10
  2589. );
  2590. });
  2591. router.route("/selectCourseNew2").all((req, res, next) => {
  2592. var json = queryString(req.url);
  2593. getmysql(
  2594. req,
  2595. res,
  2596. "select_course_new2",
  2597. json["type"],
  2598. json["uid"],
  2599. json["oid"],
  2600. json["org"],
  2601. json["typea"],
  2602. json["typeb"],
  2603. json["typec"],
  2604. json["typed"],
  2605. json["typeE"],
  2606. json["cu"],
  2607. json["cn"],
  2608. json["page"],
  2609. json["pageSize"]
  2610. );
  2611. });
  2612. router.route("/selectTrainCourseNew2").all((req, res, next) => {
  2613. var json = queryString(req.url);
  2614. getmysql(
  2615. req,
  2616. res,
  2617. "selectTrainCourseNew2",
  2618. json["type"],
  2619. json["uid"],
  2620. json["oid"],
  2621. json["org"],
  2622. json["typea"],
  2623. json["typeb"],
  2624. json["typec"],
  2625. json["typed"],
  2626. json["typeE"],
  2627. json["cu"],
  2628. json["cn"],
  2629. json["page"],
  2630. json["pageSize"]
  2631. );
  2632. });
  2633. router.route("/selectSynergyCourse").all((req, res, next) => {
  2634. var json = queryString(req.url);
  2635. getmysql(
  2636. req,
  2637. res,
  2638. "selectSynergyCourse",
  2639. json["type"],
  2640. json["uid"],
  2641. json["oid"],
  2642. json["org"],
  2643. json["typea"],
  2644. json["typeb"],
  2645. json["typec"],
  2646. json["typed"],
  2647. json["typeE"],
  2648. json["cu"],
  2649. json["cn"],
  2650. json["page"],
  2651. json["pageSize"]
  2652. );
  2653. });
  2654. router.route("/selectStudentCourseNew2").all((req, res, next) => {
  2655. var json = queryString(req.url);
  2656. getmysql(
  2657. req,
  2658. res,
  2659. "selectStudentCourseNew2",
  2660. json["type"],
  2661. json["uid"],
  2662. json["oid"],
  2663. json["org"],
  2664. json["typea"],
  2665. json["typeb"],
  2666. json["typec"],
  2667. json["typed"],
  2668. json["typeE"],
  2669. json["cu"],
  2670. json["cn"],
  2671. json["page"],
  2672. 10
  2673. );
  2674. });
  2675. router.route("/selectStudentCourseNew22").all((req, res, next) => {
  2676. var json = queryString(req.url);
  2677. getmysql(
  2678. req,
  2679. res,
  2680. "selectStudentCourseNew22",
  2681. json["type"],
  2682. json["uid"],
  2683. json["oid"],
  2684. json["org"],
  2685. json["typea"],
  2686. json["typeb"],
  2687. json["typec"],
  2688. json["typed"],
  2689. json["typef"],
  2690. json["typeE"],
  2691. json["cu"],
  2692. json["cn"],
  2693. json["page"],
  2694. json["pageSize"]
  2695. );
  2696. });
  2697. router.route("/selectStudentCourseNew222").all((req, res, next) => {
  2698. var json = queryString(req.url);
  2699. getmysql(
  2700. req,
  2701. res,
  2702. "selectStudentCourseNew222",
  2703. json["type"],
  2704. json["uid"],
  2705. json["oid"],
  2706. json["org"],
  2707. json["typea"],
  2708. json["typeb"],
  2709. json["typec"],
  2710. json["typed"],
  2711. json["typef"],
  2712. json["typeE"],
  2713. json["cu"],
  2714. json["cn"],
  2715. json["page"],
  2716. json["pageSize"]
  2717. );
  2718. });
  2719. //查询评测
  2720. router.route("/selectTesttCourse").all((req, res, next) => {
  2721. var json = queryString(req.url);
  2722. getmysql(
  2723. req,
  2724. res,
  2725. "selectTesttCourse",
  2726. json["type"],
  2727. json["uid"],
  2728. json["oid"],
  2729. json["org"],
  2730. json["typea"],
  2731. json["typeb"],
  2732. json["typec"],
  2733. json["typed"],
  2734. json["typef"],
  2735. json["typeE"],
  2736. json["cu"],
  2737. json["cn"],
  2738. json["page"],
  2739. json["pageSize"]
  2740. );
  2741. });
  2742. //查询评测
  2743. router.route("/selectTesttCourse2").all((req, res, next) => {
  2744. var json = queryString(req.url);
  2745. getmysql(
  2746. req,
  2747. res,
  2748. "selectTesttCourse2",
  2749. json["oid"],
  2750. json["org"],
  2751. json["type"],
  2752. json["cn"],
  2753. json["page"],
  2754. json["pageSize"]
  2755. );
  2756. });
  2757. //查询评测 评测中心
  2758. router.route("/selectTesttCourseCenter").all((req, res, next) => {
  2759. var json = queryString(req.url);
  2760. getmysql(
  2761. req,
  2762. res,
  2763. "selectTesttCourseCenter",
  2764. json["type"],
  2765. json["uid"],
  2766. json["oid"],
  2767. json["org"],
  2768. json["classid"],
  2769. json["typea"],
  2770. json["typeb"],
  2771. json["typec"],
  2772. json["typed"],
  2773. json["typef"],
  2774. json["typeE"],
  2775. json["cu"],
  2776. json["cn"],
  2777. json["page"],
  2778. json["pageSize"]
  2779. );
  2780. });
  2781. //查询评测 评测中心及作业
  2782. router.route("/selectTesttCourseCenter1").all((req, res, next) => {
  2783. var json = queryString(req.url);
  2784. getmysql(
  2785. req,
  2786. res,
  2787. "selectTesttCourseCenter1",
  2788. json["type"],
  2789. json["uid"],
  2790. json["oid"],
  2791. json["org"],
  2792. json["classid"],
  2793. json["typea"],
  2794. json["typeb"],
  2795. json["typec"],
  2796. json["typed"],
  2797. json["typef"],
  2798. json["typeE"],
  2799. json["cu"],
  2800. json["cn"],
  2801. json["page"],
  2802. json["pageSize"]
  2803. );
  2804. });
  2805. router.route("/selectStudentCourseNew22Mode").all((req, res, next) => {
  2806. var json = queryString(req.url);
  2807. getmysql(
  2808. req,
  2809. res,
  2810. "selectStudentCourseNew22Mode",
  2811. json["type"],
  2812. json["uid"],
  2813. json["oid"],
  2814. json["org"],
  2815. json["typea"],
  2816. json["typeb"],
  2817. json["typec"],
  2818. json["typed"],
  2819. json["typef"],
  2820. json["typeE"],
  2821. json["cu"],
  2822. json["cn"]
  2823. );
  2824. });
  2825. //查询协同编辑课程
  2826. router.route("/selectCourseTeam").all((req, res, next) => {
  2827. var json = queryString(req.url);
  2828. getmysql(req, res, "selectCourseTeam", json["uid"], json["oid"]);
  2829. });
  2830. //查询学校
  2831. router.route("/selectSchoolName").all((req, res, next) => {
  2832. var json = queryString(req.url);
  2833. getmysql(req, res, "selectOidName", json["cu"], json["cn"], json["page"], 10);
  2834. });
  2835. //查询组织
  2836. router.route("/selectOrgName").all((req, res, next) => {
  2837. var json = queryString(req.url);
  2838. getmysql(req, res, "selectOrgName", json["page"], 10);
  2839. });
  2840. //查询学校
  2841. router.route("/selectSchoolName2").all((req, res, next) => {
  2842. var json = queryString(req.url);
  2843. getmysql(req, res, "selectOidName2", json["oid"]);
  2844. });
  2845. //查询学校
  2846. router.route("/selectSchoolNameOrg").all((req, res, next) => {
  2847. var json = queryString(req.url);
  2848. getmysql(req, res, "selectSchoolNameOrg", json["org"], json["page"], 10);
  2849. });
  2850. //查询协同学校和被协同学校
  2851. router.route("/selectOrgType").all((req, res, next) => {
  2852. var json = queryString(req.url);
  2853. getmysql(req, res, "selectOrgType", json["t"], json["org"], json["page"], 10);
  2854. });
  2855. //新增批注
  2856. router.route("/addPz").all((req, res, next) => {
  2857. postmysql(req, res, "addPz");
  2858. });
  2859. //新增批注
  2860. router.route("/addPz2").all((req, res, next) => {
  2861. postmysql(req, res, "addPz2");
  2862. });
  2863. //新增回复
  2864. router.route("/addHf").all((req, res, next) => {
  2865. postmysql(req, res, "addHf");
  2866. });
  2867. //删除批注
  2868. router.route("/deletePz").all((req, res, next) => {
  2869. postmysql(req, res, "deletePz");
  2870. });
  2871. //删除回复
  2872. router.route("/deleteReply").all((req, res, next) => {
  2873. postmysql(req, res, "deleteReply");
  2874. });
  2875. //查询批注列表
  2876. router.route("/selectPzList").all((req, res, next) => {
  2877. var json = queryString(req.url);
  2878. getmysql(req, res, "selectPzList", json["cid"], json["s"], json["t"]);
  2879. });
  2880. //查询批注列表
  2881. router.route("/selectPzListType").all((req, res, next) => {
  2882. var json = queryString(req.url);
  2883. getmysql(req, res, "selectPzListType", json["cid"], json["s"], json["t"], json["type"], json["uid"]);
  2884. });
  2885. //评分
  2886. router.route("/scoreWork").all((req, res, next) => {
  2887. postmysql(req, res, "scoreWork");
  2888. });
  2889. //删除学生
  2890. router.route("/deleteStudent").all((req, res, next) => {
  2891. postmysql(req, res, "delete_student");
  2892. });
  2893. //查询学校底下的班级
  2894. router.route("/selectClassBySchool").all((req, res, next) => {
  2895. var json = queryString(req.url);
  2896. getmysql(req, res, "selectClassBySchool", json["oid"]);
  2897. });
  2898. //查询学校底下的教研室
  2899. router.route("/selectTeacherOfficeBySchool").all((req, res, next) => {
  2900. var json = queryString(req.url);
  2901. getmysql(req, res, "selectTeacherOfficeBySchool", json["oid"]);
  2902. });
  2903. //查询学校底下的年级
  2904. router.route("/selectGrageBySchool").all((req, res, next) => {
  2905. var json = queryString(req.url);
  2906. getmysql(req, res, "selectGrageBySchool", json["oid"]);
  2907. });
  2908. //查询学校底下的班级
  2909. router.route("/selectClassBySchoolSearch").all((req, res, next) => {
  2910. var json = queryString(req.url);
  2911. getmysql(req, res, "selectClassBySchoolSearch", json["oid"], json["cn"]);
  2912. });
  2913. //查询学校底下的班级
  2914. router.route("/selectClassBySchoolSearch2").all((req, res, next) => {
  2915. var json = queryString(req.url);
  2916. getmysql(req, res, "selectClassBySchoolSearch2", json["oid"], json["gid"], json["cn"]);
  2917. });
  2918. //查询组织底下的学校
  2919. router.route("/selectSchoolByOrg").all((req, res, next) => {
  2920. var json = queryString(req.url);
  2921. getmysql(req, res, "selectSchoolByOrg", json["org"]);
  2922. });
  2923. //学生注册接口
  2924. router.route("/register_student").post(function(req, res, next) {
  2925. //mode的处理
  2926. if (req.body[0]) {
  2927. // 0 用户名 1 用户密码 2用户身份 3 第三方id(可有可无)
  2928. p = Object.values(req.body[0]); //获取用户密码
  2929. //没有第三方id的处理
  2930. // if (p.length < 4) {
  2931. // p.push("")
  2932. // }
  2933. p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
  2934. //密码加密
  2935. // bcrypt.hash(p[1], 10, function (err, hash) {
  2936. // if (err) {
  2937. // return next(err);
  2938. // }
  2939. // p[1] = hash;
  2940. // });
  2941. //参数拼接,注册
  2942. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "register_student");
  2943. //返回注册用户数据
  2944. // mysql.usselect(p, function (ret) {
  2945. // res.end(ret);
  2946. // });
  2947. mysql.usselect(p, function(ret) {
  2948. res.end(JSON.stringify(ret));
  2949. });
  2950. }
  2951. });
  2952. //查询课程详情
  2953. router.route("/selectCourseDetail").all((req, res, next) => {
  2954. var json = queryString(req.url);
  2955. getmysql(req, res, "selectCourseDetail", json["courseId"]);
  2956. });
  2957. //查询课程详情
  2958. router.route("/selectTrainCourseDetail").all((req, res, next) => {
  2959. var json = queryString(req.url);
  2960. getmysql(req, res, "selectTrainCourseDetail", json["courseId"]);
  2961. });
  2962. //查询课程详情
  2963. router.route("/selectCourseDetail2").all((req, res, next) => {
  2964. var json = queryString(req.url);
  2965. getmysql(req, res, "selectCourseDetail2", json["courseId"]);
  2966. });
  2967. //查询课程详情
  2968. router.route("/selectTrainCourseDetail2").all((req, res, next) => {
  2969. var json = queryString(req.url);
  2970. getmysql(req, res, "selectTrainCourseDetail2", json["courseId"]);
  2971. });
  2972. //查询课程详情
  2973. router.route("/selectCourseDetail3").all((req, res, next) => {
  2974. var json = queryString(req.url);
  2975. getmysql(req, res, "selectCourseDetail3", json["courseId"]);
  2976. });
  2977. //查询课程详情
  2978. router.route("/selectTrainCourseDetail3").all((req, res, next) => {
  2979. var json = queryString(req.url);
  2980. getmysql(req, res, "selectTrainCourseDetail3", json["courseId"]);
  2981. });
  2982. //查询学校底下的所有赛事
  2983. router.route("/selectRaceByOid").all((req, res, next) => {
  2984. var json = queryString(req.url);
  2985. getmysql(req, res, "selectRaceByOid", json["sid"]);
  2986. });
  2987. //修改作业学生名称 修1
  2988. router.route("/updateCourseWorksName").all((req, res, next) => {
  2989. var json = queryString(req.url);
  2990. getmysql(req, res, "updateCourseWorksName", json["n"], json["cid"]);
  2991. });
  2992. //查询课程详情
  2993. router.route("/selectStudentCourseDetail").all((req, res, next) => {
  2994. //学生
  2995. var json = queryString(req.url);
  2996. getmysql(req, res, "selectStudentCourseDetail", json["courseId"]);
  2997. });
  2998. //查询课程详情
  2999. router.route("/selectStudentCourseDetail3").all((req, res, next) => {
  3000. //学生
  3001. var json = queryString(req.url);
  3002. getmysql(req, res, "selectStudentCourseDetail3", json["courseId"]);
  3003. });
  3004. //查询课程详情
  3005. router.route("/selectStudentCourseDetail2").all((req, res, next) => {
  3006. //学生
  3007. var json = queryString(req.url);
  3008. getmysql(req, res, "selectStudentCourseDetail2", json["courseId"]);
  3009. });
  3010. //跳转阶段时,如果有课程就查询1返回,如果没有就插入 修1
  3011. router.route("/addUserR").all((req, res, next) => {
  3012. var json = queryString(req.url);
  3013. getmysql(req, res, "insertUserR", json["uid"], json["cid"]);
  3014. });
  3015. //新增学生端作业
  3016. router.route("/addWorks").all((req, res, next) => {
  3017. postmysql(req, res, "add_works");
  3018. });
  3019. //查询已提交作业
  3020. router.route("/selectWork").all((req, res, next) => {
  3021. var json = queryString(req.url);
  3022. getmysql(
  3023. req,
  3024. res,
  3025. "selectWork",
  3026. json["cid"],
  3027. json["stage"],
  3028. json["task"],
  3029. json["uid"]
  3030. );
  3031. });
  3032. //查询作业详情
  3033. router.route("/selectWorksDetail").all((req, res, next) => {
  3034. var json = queryString(req.url);
  3035. getmysql(req, res, "selectWorksDetail", json["uid"], json["cid"]);
  3036. });
  3037. //新增作业评分 修1
  3038. router.route("/updateWorks").all((req, res, next) => {
  3039. var json = queryString(req.url);
  3040. getmysql(req, res, "updateWorks", json["rate"], json["tuid"], json["id"]);
  3041. });
  3042. //新增素材信息 修1
  3043. router.route("/addMtl").all((req, res, next) => {
  3044. var json = queryString(req.url);
  3045. getmysql(req, res, "add_mtl", json["cInfo"], json["t"], json["cBy"]);
  3046. });
  3047. //根据类型查询素材信息
  3048. router.route("/selectMtl").all((req, res, next) => {
  3049. var json = queryString(req.url);
  3050. getmysql(req, res, "selectMtl", json["t"], json["page"], 10);
  3051. });
  3052. //根据类型查询素材信息
  3053. router.route("/selectMtl2").all((req, res, next) => {
  3054. var json = queryString(req.url);
  3055. getmysql(req, res, "selectMtl2", json["t"], json["uid"], json["page"], 10);
  3056. });
  3057. //学习中心
  3058. //新增学习资源信息 修1
  3059. router.route("/addStuMtl").all((req, res, next) => {
  3060. var json = queryString(req.url);
  3061. getmysql(req, res, "addStuMtl", json["cInfo"], json["t"], json["cBy"]);
  3062. });
  3063. //根据类型查询学习资料信息
  3064. router.route("/selectStuMtl").all((req, res, next) => {
  3065. var json = queryString(req.url);
  3066. getmysql(req, res, "selectStuMtl", json["t"], json["page"], 10);
  3067. });
  3068. //删除1素材
  3069. router.route("/deleteStuM").all((req, res, next) => {
  3070. var json = queryString(req.url);
  3071. getmysql2(req, res, "deleteStuM", json["id"]);
  3072. });
  3073. //查询学生信息
  3074. router.route("/selectSDetail").all((req, res, next) => {
  3075. var json = queryString(req.url);
  3076. getmysql(req, res, "selectStudentDetail", json["uid"]);
  3077. });
  3078. //查询个人课程
  3079. router.route("/selectMyCourse").all((req, res, next) => {
  3080. var json = queryString(req.url);
  3081. getmysql(req, res, "selectMyCourse", json["uid"]);
  3082. });
  3083. //查询个人课程groupby课程id
  3084. router.route("/selectMyCourseBycid").all((req, res, next) => {
  3085. var json = queryString(req.url);
  3086. getmysql(req, res, "selectMyCourseBycid", json["uid"]);
  3087. });
  3088. //查询所有课程
  3089. router.route("/selectAllCourse").all((req, res, next) => {
  3090. var json = queryString(req.url);
  3091. getmysql(req, res, "selectAllCourse", json["oid"], json["page"], 10);
  3092. });
  3093. //根据班级查询所有课程
  3094. router.route("/selectAllCourseByCid").all((req, res, next) => {
  3095. var json = queryString(req.url);
  3096. getmysql(
  3097. req,
  3098. res,
  3099. "selectAllCourseByCid",
  3100. json["oid"],
  3101. json["cid"],
  3102. json["page"],
  3103. 10
  3104. );
  3105. });
  3106. //根据分类查询所有课程
  3107. router.route("/selectTypeCourse").all((req, res, next) => {
  3108. var json = queryString(req.url);
  3109. getmysql(
  3110. req,
  3111. res,
  3112. "selectTypeCourse",
  3113. json["uid"],
  3114. json["oid"],
  3115. json["typea"],
  3116. json["typeb"],
  3117. json["typec"],
  3118. json["typed"],
  3119. json["typeE"],
  3120. json["cu"],
  3121. json["cn"],
  3122. json["classid"],
  3123. json["page"],
  3124. 10
  3125. );
  3126. });
  3127. //根据分类查询所有课程
  3128. router.route("/selectTypeCourse2").all((req, res, next) => {
  3129. var json = queryString(req.url);
  3130. getmysql(
  3131. req,
  3132. res,
  3133. "selectTypeCourse2",
  3134. json["uid"],
  3135. json["oid"],
  3136. json["typea"],
  3137. json["typeb"],
  3138. json["typec"],
  3139. json["typed"],
  3140. json["typeE"],
  3141. json["cu"],
  3142. json["cn"],
  3143. json["classid"],
  3144. json["org"],
  3145. json["page"],
  3146. json["pageSize"]
  3147. );
  3148. });
  3149. //根据分类查询所有课程
  3150. router.route("/selectTypeTrainCourse2").all((req, res, next) => {
  3151. var json = queryString(req.url);
  3152. getmysql(
  3153. req,
  3154. res,
  3155. "selectTypeTrainCourse2",
  3156. json["uid"],
  3157. json["oid"],
  3158. json["typea"],
  3159. json["typeb"],
  3160. json["typec"],
  3161. json["typed"],
  3162. json["typeE"],
  3163. json["cu"],
  3164. json["cn"],
  3165. json["classid"],
  3166. json["org"],
  3167. json["page"],
  3168. json["pageSize"]
  3169. );
  3170. });
  3171. //根据分类查询所有课程
  3172. router.route("/selectTypeCourse2Mode").all((req, res, next) => {
  3173. var json = queryString(req.url);
  3174. getmysql(
  3175. req,
  3176. res,
  3177. "selectTypeCourse2Mode",
  3178. json["uid"],
  3179. json["oid"],
  3180. json["typea"],
  3181. json["typeb"],
  3182. json["typec"],
  3183. json["typed"],
  3184. json["typeE"],
  3185. json["cu"],
  3186. json["cn"],
  3187. json["classid"],
  3188. json["org"]
  3189. );
  3190. });
  3191. //根据分类查询所有课程
  3192. router.route("/selectTypeTrainCourse2Mode").all((req, res, next) => {
  3193. var json = queryString(req.url);
  3194. getmysql(
  3195. req,
  3196. res,
  3197. "selectTypeTrainCourse2Mode",
  3198. json["uid"],
  3199. json["oid"],
  3200. json["typea"],
  3201. json["typeb"],
  3202. json["typec"],
  3203. json["typed"],
  3204. json["typeE"],
  3205. json["cu"],
  3206. json["cn"],
  3207. json["classid"],
  3208. json["org"]
  3209. );
  3210. });
  3211. //根据分类查询所有课程
  3212. router.route("/selectTypeCourse2GM").all((req, res, next) => {
  3213. var json = queryString(req.url);
  3214. getmysql(
  3215. req,
  3216. res,
  3217. "selectTypeCourse2GM",
  3218. json["uid"],
  3219. json["oid"],
  3220. json["typea"],
  3221. json["typeb"],
  3222. json["typec"],
  3223. json["typed"],
  3224. json["typeE"],
  3225. json["cu"],
  3226. json["cn"],
  3227. json["classid"],
  3228. json["org"],
  3229. json["page"],
  3230. 10
  3231. );
  3232. });
  3233. //根据分类查询所有课程
  3234. router.route("/selectCourseExamine").all((req, res, next) => {
  3235. var json = queryString(req.url);
  3236. getmysql(
  3237. req,
  3238. res,
  3239. "selectCourseExamine",
  3240. json["oid"],
  3241. json["org"],
  3242. json["cn"],
  3243. json["page"],
  3244. 10
  3245. );
  3246. });
  3247. //根据分类查询所有课程
  3248. router.route("/selectTypeCourse3").all((req, res, next) => {
  3249. var json = queryString(req.url);
  3250. getmysql(
  3251. req,
  3252. res,
  3253. "selectTypeCourse3",
  3254. json["uid"],
  3255. json["oid"],
  3256. json["typea"],
  3257. json["typeb"],
  3258. json["typec"],
  3259. json["typed"],
  3260. json["typeE"],
  3261. json["cu"],
  3262. json["cn"],
  3263. json["classid"],
  3264. json["org"],
  3265. json["page"],
  3266. 10
  3267. );
  3268. });
  3269. //审核课程
  3270. router.route("/examineCourse").all((req, res, next) => {
  3271. postmysql(req, res, "examineCourse");
  3272. });
  3273. //删除1素材
  3274. router.route("/deleteM").all((req, res, next) => {
  3275. var json = queryString(req.url);
  3276. getmysql2(req, res, "deleteM", json["id"]);
  3277. });
  3278. //点击阶段时添加观看人数 修1
  3279. router.route("/updateVc").all((req, res, next) => {
  3280. var json = queryString(req.url);
  3281. getmysql2(req, res, "updateVc", json["cid"]);
  3282. });
  3283. //点击阶段时添加观看人数 修1
  3284. router.route("/updateVcTrain").all((req, res, next) => {
  3285. var json = queryString(req.url);
  3286. getmysql(req, res, "updateVcTrain", json["cid"]);
  3287. });
  3288. //删除1课程
  3289. router.route("/deleteCourse").all((req, res, next) => {
  3290. var json = queryString(req.url);
  3291. getmysql2(req, res, "deleteCourse", json["cid"]);
  3292. });
  3293. //删除1课程
  3294. router.route("/deleteTrainCourse").all((req, res, next) => {
  3295. var json = queryString(req.url);
  3296. getmysql2(req, res, "deleteTrainCourse", json["cid"]);
  3297. });
  3298. //删除1课程
  3299. router.route("/deleteSynergyCourse").all((req, res, next) => {
  3300. var json = queryString(req.url);
  3301. getmysql2(req, res, "deleteSynergyCourse", json["cid"]);
  3302. });
  3303. //删除1课程
  3304. router.route("/deleteStudentCourse").all((req, res, next) => {
  3305. var json = queryString(req.url);
  3306. getmysql2(req, res, "deleteStudentCourse", json["cid"]);
  3307. });
  3308. //复制课程
  3309. router.route("/copyCourse").all((req, res, next) => {
  3310. postmysql(req, res, "copyCourse");
  3311. });
  3312. //复制课程
  3313. router.route("/copyCourseSz").all((req, res, next) => {
  3314. postmysql2(req, res, "copyCourse");
  3315. });
  3316. //返回复制课程
  3317. router.route("/getcopyCourseSz").all((req, res, next) => {
  3318. postmysql2(req, res, "getcopyCourseSz");
  3319. });
  3320. //查看课程信息
  3321. router.route("/selectCourseDetailSz").all((req, res, next) => {
  3322. postmysql2(req, res, "selectCourseDetailSz");
  3323. });
  3324. //复制课程
  3325. router.route("/copyTrainCourse").all((req, res, next) => {
  3326. postmysql(req, res, "copyTrainCourse");
  3327. });
  3328. //复制课程
  3329. router.route("/copyTest").all((req, res, next) => {
  3330. postmysql(req, res, "copyTest");
  3331. });
  3332. //复制课程
  3333. router.route("/copySynergyCourse").all((req, res, next) => {
  3334. postmysql(req, res, "copySynergyCourse");
  3335. });
  3336. //复制评价体系
  3337. router.route("/copyEva").all((req, res, next) => {
  3338. postmysql(req, res, "copyEva");
  3339. });
  3340. //复制课程
  3341. router.route("/copySCourse").all((req, res, next) => {
  3342. postmysql(req, res, "copySCourse");
  3343. });
  3344. //查看课程
  3345. router.route("/select_course_detail").all((req, res, next) => {
  3346. var json = queryString(req.url);
  3347. getmysql(req, res, "select_course_detail", json["cid"]);
  3348. });
  3349. //查看课程
  3350. router.route("/select_trainCourse_detail").all((req, res, next) => {
  3351. var json = queryString(req.url);
  3352. getmysql(req, res, "select_trainCourse_detail", json["cid"]);
  3353. });
  3354. //删除评测
  3355. router.route("/deleteTestCourseWorks").all((req, res, next) => {
  3356. postmysql(req, res, "deleteTestCourseWorks");
  3357. });
  3358. //查看评测
  3359. router.route("/selectTestType").all((req, res, next) => {
  3360. var json = queryString(req.url);
  3361. getmysql(req, res, "selectTestType", json["oid"]);
  3362. });
  3363. //查看评测
  3364. router.route("/getTestCourseDetail").all((req, res, next) => {
  3365. var json = queryString(req.url);
  3366. getmysql(req, res, "getTestCourseDetail", json["cid"]);
  3367. });
  3368. //查看评测
  3369. router.route("/selectPostilByUid").all((req, res, next) => {
  3370. var json = queryString(req.url);
  3371. getmysql(req, res, "selectPostilByUid", json["uid"]);
  3372. });
  3373. //查看评测
  3374. router.route("/getTestWorkShare").all((req, res, next) => {
  3375. var json = queryString(req.url);
  3376. getmysql(req, res, "getTestWorkShare", json["id"]);
  3377. });
  3378. //查看课程
  3379. router.route("/select_synergy").all((req, res, next) => {
  3380. var json = queryString(req.url);
  3381. getmysql(req, res, "select_synergy", json["cid"]);
  3382. });
  3383. //查看课程
  3384. router.route("/select_student_course_detail").all((req, res, next) => {
  3385. //学生
  3386. var json = queryString(req.url);
  3387. getmysql(req, res, "select_student_course_detail", json["cid"]);
  3388. });
  3389. //查看课程
  3390. router.route("/select_student_course_detail2").all((req, res, next) => {
  3391. //学生
  3392. var json = queryString(req.url);
  3393. getmysql(req, res, "select_student_course_detail2", json["cid"]);
  3394. });
  3395. //查看课程
  3396. router.route("/getExportScourse").all((req, res, next) => {
  3397. //学生
  3398. var json = queryString(req.url);
  3399. getmysql(req, res, "getExportScourse", json["cid"]);
  3400. });
  3401. //模糊查找课程
  3402. // router.route('/searchCourse').all((req, res, next) => {
  3403. // var json = queryString(req.url);
  3404. // getmysql(req, res, "searchCourse", json['cu'], json['cn'], json['page'], 10);
  3405. // });
  3406. //创建调查问卷
  3407. router.route("/addAsk").all((req, res, next) => {
  3408. postmysql(req, res, "insert_ask");
  3409. });
  3410. //学生提交问卷
  3411. router.route("/addAskList").all((req, res, next) => {
  3412. postmysql(req, res, "insert_askList");
  3413. });
  3414. //根据课程id阶段id获取已提交的问卷
  3415. router.route("/getAskListByCidStage").all((req, res, next) => {
  3416. var json = queryString(req.url);
  3417. getmysql(
  3418. req,
  3419. res,
  3420. "getAskListByCidStage",
  3421. json["cid"],
  3422. json["stage"],
  3423. json["task"]
  3424. );
  3425. });
  3426. //获取调查问卷
  3427. router.route("/getAsk").all((req, res, next) => {
  3428. var json = queryString(req.url);
  3429. getmysql(req, res, "select_ask", json["uid"], json["page"], 10);
  3430. });
  3431. //删除问卷
  3432. router.route("/deleteAsk").all((req, res, next) => {
  3433. postmysql(req, res, "deleteAsk");
  3434. });
  3435. //问卷调查数据统计
  3436. router.route("/getAskListByAskid").all((req, res, next) => {
  3437. var json = queryString(req.url);
  3438. getmysql(req, res, "select_askListByAskid", json["aid"]);
  3439. });
  3440. //删除学生提交问卷
  3441. router.route("/deleteAskList").all((req, res, next) => {
  3442. postmysql(req, res, "update_askList_delete");
  3443. });
  3444. //根据id获取调查问卷
  3445. router.route("/getAskList").all((req, res, next) => {
  3446. var json = queryString(req.url);
  3447. getmysql(req, res, "select_askList", json["uid"], json["page"], 10);
  3448. });
  3449. //查看便签列表
  3450. router.route("/selectNote").all((req, res, next) => {
  3451. var json = queryString(req.url);
  3452. getmysql(req, res, "selectNote", json["uid"]);
  3453. });
  3454. //新增便签列表 修1
  3455. router.route("/insertNote").all((req, res, next) => {
  3456. var json = queryString(req.url);
  3457. getmysql(req, res, "insertNote", json["uid"], json["c"]);
  3458. });
  3459. //根据便签id修改便签内容 修1
  3460. router.route("/updateNote").all((req, res, next) => {
  3461. var json = queryString(req.url);
  3462. getmysql(req, res, "updateNote", json["nid"], json["c"]);
  3463. });
  3464. //删除1便签
  3465. router.route("/deleteNote").all((req, res, next) => {
  3466. var json = queryString(req.url);
  3467. getmysql2(req, res, "deleteNote", json["nid"]);
  3468. });
  3469. //查询便签
  3470. router.route("/selectNoteContent").all((req, res, next) => {
  3471. var json = queryString(req.url);
  3472. getmysql(req, res, "selectNoteContent", json["cn"]);
  3473. });
  3474. //修改用户信息
  3475. router.route("/updateUserByEdu").all((req, res, next) => {
  3476. postmysql(req, res, "updateUserByEdu");
  3477. });
  3478. //修改用户信息
  3479. router.route("/updateUserByEdu1").all((req, res, next) => {
  3480. postmysql(req, res, "updateUserByEdu1");
  3481. });
  3482. //修改用户信息
  3483. router.route("/updateUserByEduOid").all((req, res, next) => {
  3484. postmysql(req, res, "updateUserByEduOid");
  3485. });
  3486. //修改学生信息
  3487. router.route("/updateStudentInfo").all((req, res, next) => {
  3488. postmysql(req, res, "updateStudentInfo");
  3489. });
  3490. //教师端data修改pbl用户信息
  3491. router.route("/updatePblMessage").all((req, res, next) => {
  3492. postmysql2(req, res, "updatePblMessage");
  3493. });
  3494. //登录次数
  3495. router.route("/addLoginOperation").all((req, res, next) => {
  3496. postmysql2(req, res, "addLoginOperation");
  3497. });
  3498. //当日登录时间
  3499. router.route("/addOperationTime").all((req, res, next) => {
  3500. postmysql2(req, res, "addOperationTime");
  3501. });
  3502. //课程学习时间
  3503. router.route("/addOperationTime2").all((req, res, next) => {
  3504. postmysql(req, res, "addOperationTime");
  3505. });
  3506. //当日登录时间
  3507. router.route("/addOperationTimeT").all((req, res, next) => {
  3508. postmysql2(req, res, "addOperationTime2");
  3509. });
  3510. //课程学习时间
  3511. router.route("/addOperationTimeT2").all((req, res, next) => {
  3512. postmysql(req, res, "addOperationTime2");
  3513. });
  3514. //记录用户协同建构操作
  3515. router.route("/add_OperationCSCL").all((req, res, next) => {
  3516. postmysql2(req, res, "add_OperationCSCL");
  3517. });
  3518. //获取所有分组协同数据
  3519. router.route("/select_CSCLDataByID").all((req, res, next) => {
  3520. postmysql2(req, res, "select_CSCLDataByID");
  3521. });
  3522. //获取项目所有的分组所有的人操作数据的总数和时间
  3523. router.route("/select_CSCLDataCount").all((req, res, next) => {
  3524. postmysql2(req, res, "select_CSCLDataCount");
  3525. });
  3526. //获取用户在某个分组的操作日志
  3527. router.route("/select_CSCLDataByUserIdID").all((req, res, next) => {
  3528. postmysql2(req, res, "select_CSCLDataByUserIdID");
  3529. });
  3530. router.route("/updatePblMessage2").all((req, res, next) => {
  3531. postmysql(req, res, "updatePblMessage");
  3532. });
  3533. router.route("/updateUserInfoText").all((req, res, next) => {
  3534. postmysql(req, res, "updateUserInfoText");
  3535. });
  3536. //修改幼儿园评价个人信息
  3537. router.route("/updateStudentInfoText").all((req, res, next) => {
  3538. postmysql(req, res, "updateStudentInfoText");
  3539. });
  3540. router.route("/updateRaceUser").all((req, res, next) => {
  3541. postmysql(req, res, "updateRaceUser");
  3542. });
  3543. //查询用户信息
  3544. router.route("/selectUser").all((req, res, next) => {
  3545. var json = queryString(req.url);
  3546. getmysql(req, res, "selectUser", json["userid"]);
  3547. });
  3548. //查询用户信息
  3549. router.route("/selectUserSzdjg").all((req, res, next) => {
  3550. var json = queryString(req.url);
  3551. getmysql(req, res, "selectUserSzdjg", json["username"]);
  3552. });
  3553. //新增英语写作批改 修1
  3554. router.route("/addEngC").all((req, res, next) => {
  3555. var json = queryString(req.url);
  3556. getmysql(req, res, "insertEngCorrect", json["cid"], json["s"], json["t"], json["tool"], json["wid"], json["c"], json["w"]);
  3557. });
  3558. //查询英语写作批改
  3559. router.route("/selectEngC").all((req, res, next) => {
  3560. var json = queryString(req.url);
  3561. getmysql(req, res, "selectEngCorrect", json["workid"]);
  3562. });
  3563. //查询英语写作作业
  3564. router.route("/selectEngWork").all((req, res, next) => {
  3565. var json = queryString(req.url);
  3566. getmysql(req, res, "selectEngWork", json["wid"]);
  3567. });
  3568. //新增或修改英语写作评价 修1
  3569. router.route("/addEngEva").all((req, res, next) => {
  3570. var json = queryString(req.url);
  3571. getmysql(req, res, "addEngEva", json["id"], json["aic"], json["tc"]);
  3572. });
  3573. //查询分类及所有子分类
  3574. router.route("/selectAllType").all((req, res, next) => {
  3575. var json = queryString(req.url);
  3576. getmysql(req, res, "selectAllType", json["org"], json["oid"]);
  3577. });
  3578. //查询分类及所有子分类
  3579. router.route("/selectAllTrainType").all((req, res, next) => {
  3580. var json = queryString(req.url);
  3581. getmysql(req, res, "selectAllTrainType", json["org"], json["oid"]);
  3582. });
  3583. //查询分类及所有子分类
  3584. router.route("/selectAllTypeS").all((req, res, next) => {
  3585. var json = queryString(req.url);
  3586. getmysql(req, res, "selectAllTypeS", json["org"], json["oid"]);
  3587. });
  3588. //查询分类及所有子分类
  3589. router.route("/selectAllTypeT").all((req, res, next) => {
  3590. var json = queryString(req.url);
  3591. getmysql(req, res, "selectAllTypeT", json["org"], json["oid"]);
  3592. });
  3593. //查询分类及子分类
  3594. router.route("/selectType").all((req, res, next) => {
  3595. var json = queryString(req.url);
  3596. getmysql(req, res, "selectType");
  3597. });
  3598. //查询分类及子分类
  3599. router.route("/selectStudentType").all((req, res, next) => {
  3600. var json = queryString(req.url);
  3601. getmysql(req, res, "selectStudentType");
  3602. });
  3603. //查询赛事分类及子分类
  3604. router.route("/selectMatType").all((req, res, next) => {
  3605. var json = queryString(req.url);
  3606. getmysql(req, res, "selectMatType");
  3607. });
  3608. //根据学校查询分类
  3609. router.route("/selectPtype").all((req, res, next) => {
  3610. var json = queryString(req.url);
  3611. getmysql(req, res, "selectPtype", json["page"], 10);
  3612. });
  3613. //根据学校查询学生项目分类
  3614. router.route("/selectSPtype").all((req, res, next) => {
  3615. var json = queryString(req.url);
  3616. getmysql(req, res, "selectSPtype", json["page"], 10);
  3617. });
  3618. //根据学校查询分类1
  3619. router.route("/selectPtype1").all((req, res, next) => {
  3620. var json = queryString(req.url);
  3621. getmysql(req, res, "selectPtype1", json["oid"], json["page"], 10);
  3622. });
  3623. //添加分类 修1
  3624. router.route("/addPtype").all((req, res, next) => {
  3625. var json = queryString(req.url);
  3626. getmysql(req, res, "addPtype", json["n"], json["uid"], json["oid"]);
  3627. });
  3628. //修改分类 修1
  3629. router.route("/updatePtype").all((req, res, next) => {
  3630. var json = queryString(req.url);
  3631. getmysql(req, res, "updatePtype", json["n"], json["tid"]);
  3632. });
  3633. //修改学生项目分类 修1
  3634. router.route("/updateSPtype").all((req, res, next) => {
  3635. var json = queryString(req.url);
  3636. getmysql(req, res, "updateSPtype", json["n"], json["tid"]);
  3637. });
  3638. //删除1分类
  3639. router.route("/deletePtype").all((req, res, next) => {
  3640. var json = queryString(req.url);
  3641. getmysql2(req, res, "deletePtype", json["tid"]);
  3642. });
  3643. //删除1学生项目分类
  3644. router.route("/deleteSPtype").all((req, res, next) => {
  3645. var json = queryString(req.url);
  3646. getmysql2(req, res, "deleteSPtype", json["tid"]);
  3647. });
  3648. //查询子分类列表
  3649. router.route("/selectStype").all((req, res, next) => {
  3650. var json = queryString(req.url);
  3651. getmysql(req, res, "selectStype", json["pid"], json["oid"], json["page"], 10);
  3652. });
  3653. //查询学生项目子分类列表
  3654. router.route("/selectSStype").all((req, res, next) => {
  3655. var json = queryString(req.url);
  3656. getmysql(
  3657. req,
  3658. res,
  3659. "selectSStype",
  3660. json["pid"],
  3661. json["oid"],
  3662. json["page"],
  3663. 10
  3664. );
  3665. });
  3666. //添加子分类 修1
  3667. router.route("/addStype").all((req, res, next) => {
  3668. var json = queryString(req.url);
  3669. getmysql(
  3670. req,
  3671. res,
  3672. "addStype",
  3673. json["pid"],
  3674. json["n"],
  3675. json["uid"],
  3676. json["oid"]
  3677. );
  3678. });
  3679. //添加学生项目子分类 修1
  3680. router.route("/addSStype").all((req, res, next) => {
  3681. var json = queryString(req.url);
  3682. getmysql(
  3683. req,
  3684. res,
  3685. "addSStype",
  3686. json["pid"],
  3687. json["n"],
  3688. json["uid"],
  3689. json["oid"]
  3690. );
  3691. });
  3692. //根据学校查询工作分类
  3693. router.route("/selectStudioPtype").all((req, res, next) => {
  3694. var json = queryString(req.url);
  3695. getmysql(req, res, "selectStudioPtype", json["page"], 10);
  3696. });
  3697. //查询工作室项目子分类列表
  3698. router.route("/selectStudioStype").all((req, res, next) => {
  3699. var json = queryString(req.url);
  3700. getmysql(
  3701. req,
  3702. res,
  3703. "selectStudioStype",
  3704. json["pid"],
  3705. json["oid"],
  3706. json["page"],
  3707. 10
  3708. );
  3709. });
  3710. //添加工作室项目子分类 修1
  3711. router.route("/addStudioStype").all((req, res, next) => {
  3712. var json = queryString(req.url);
  3713. getmysql(
  3714. req,
  3715. res,
  3716. "addStudioStype",
  3717. json["pid"],
  3718. json["n"],
  3719. json["uid"],
  3720. json["oid"]
  3721. );
  3722. });
  3723. //修改工作项目分类 修1
  3724. router.route("/updateStudioPtype").all((req, res, next) => {
  3725. var json = queryString(req.url);
  3726. getmysql(req, res, "updateStudioPtype", json["n"], json["tid"]);
  3727. });
  3728. //删除1工作项目分类
  3729. router.route("/deleteStudioPtype").all((req, res, next) => {
  3730. var json = queryString(req.url);
  3731. getmysql2(req, res, "deleteStudioPtype", json["tid"]);
  3732. });
  3733. //查看本校所有学生(分页)
  3734. router.route("/selectAllStudent").all((req, res, next) => {
  3735. var json = queryString(req.url);
  3736. getmysql(
  3737. req,
  3738. res,
  3739. "selectAllStudent",
  3740. json["oid"],
  3741. json["cn"],
  3742. json["cid"],
  3743. json["page"],
  3744. 10
  3745. );
  3746. });
  3747. //根据学校id查询子分类
  3748. router.route("/selectTypeByOid").all((req, res, next) => {
  3749. var json = queryString(req.url);
  3750. getmysql(req, res, "selectTypeByOid", json["oid"]);
  3751. });
  3752. //根据学校id查询子分类
  3753. router.route("/selectTypeByOrg").all((req, res, next) => {
  3754. var json = queryString(req.url);
  3755. getmysql(req, res, "selectTypeByOid", json["oid"]);
  3756. });
  3757. //根据组织id查询子分类
  3758. router.route("/selectStudentTypeByOid").all((req, res, next) => {
  3759. var json = queryString(req.url);
  3760. getmysql(req, res, "selectStudentTypeByOid", json["oid"]);
  3761. });
  3762. //更加父id查询分类
  3763. router.route("/selectTypeByPid").all((req, res, next) => {
  3764. var json = queryString(req.url);
  3765. getmysql(req, res, "selectTypeByPid", json["pid"]);
  3766. });
  3767. //点击工具计数 修1
  3768. router.route("/insertToolsCount").all((req, res, next) => {
  3769. var json = queryString(req.url);
  3770. getmysql(
  3771. req,
  3772. res,
  3773. "insertToolsCount",
  3774. json["cid"],
  3775. json["chid"],
  3776. json["uid"],
  3777. json["tid"],
  3778. json["count"]
  3779. );
  3780. });
  3781. //修改工具次数 修1
  3782. router.route("/updateToolsCount").all((req, res, next) => {
  3783. var json = queryString(req.url);
  3784. getmysql(
  3785. req,
  3786. res,
  3787. "updateToolsCount",
  3788. json["cid"],
  3789. json["chid"],
  3790. json["uid"],
  3791. json["tid"],
  3792. json["count"]
  3793. );
  3794. });
  3795. //查询工具次数
  3796. router.route("/selectToolsCount").all((req, res, next) => {
  3797. var json = queryString(req.url);
  3798. getmysql(
  3799. req,
  3800. res,
  3801. "selectToolsCount",
  3802. json["cid"],
  3803. json["chid"],
  3804. json["uid"]
  3805. );
  3806. });
  3807. //导出学生
  3808. router.route("/selectUserBySchool").all((req, res, next) => {
  3809. var json = queryString(req.url);
  3810. getmysql(req, res, "selectUserBySchool", json["oid"]);
  3811. });
  3812. //上传学生作业 修1
  3813. router.route("/insertSWork").all((req, res, next) => {
  3814. var json = queryString(req.url);
  3815. getmysql(
  3816. req,
  3817. res,
  3818. "insertSWork",
  3819. json["uid"],
  3820. json["cid"],
  3821. json["p"],
  3822. json["t"],
  3823. json["upload"]
  3824. );
  3825. });
  3826. //查询学生作业
  3827. router.route("/selectSWork").all((req, res, next) => {
  3828. var json = queryString(req.url);
  3829. getmysql(
  3830. req,
  3831. res,
  3832. "selectSWork",
  3833. json["uid"],
  3834. json["cid"],
  3835. json["p"],
  3836. json["type"]
  3837. );
  3838. });
  3839. //课程进展数据
  3840. router.route("/selectCase").all((req, res, next) => {
  3841. var json = queryString(req.url);
  3842. getmysql(req, res, "selectCase", json["org"]);
  3843. });
  3844. //课程进展数据
  3845. router.route("/selectCase2").all((req, res, next) => {
  3846. var json = queryString(req.url);
  3847. getmysql(req, res, "selectCase2", json["org"]);
  3848. });
  3849. //课程进展数据
  3850. router.route("/selectCase3").all((req, res, next) => {
  3851. var json = queryString(req.url);
  3852. getmysql(
  3853. req,
  3854. res,
  3855. "selectCase3",
  3856. json["org"],
  3857. json["oid"],
  3858. json["page"],
  3859. json["pageSize"]
  3860. );
  3861. });
  3862. //项目进展数据
  3863. router.route("/selectCaseS").all((req, res, next) => {
  3864. var json = queryString(req.url);
  3865. getmysql(req, res, "selectCaseS", json["org"], json["oid"]);
  3866. });
  3867. //项目进展数据
  3868. router.route("/selectCaseS2").all((req, res, next) => {
  3869. var json = queryString(req.url);
  3870. getmysql(
  3871. req,
  3872. res,
  3873. "selectCaseS2",
  3874. json["org"],
  3875. json["oid"],
  3876. json["type"],
  3877. json["page"],
  3878. json["pageSize"]
  3879. );
  3880. });
  3881. //查询赛事项目列表
  3882. router.route("/selectRaceList").all((req, res, next) => {
  3883. var json = queryString(req.url);
  3884. getmysql(req, res, "selectRaceList", json["uid"], json["t"]);
  3885. });
  3886. //修改赛事状态 修1
  3887. router.route("/updateRaceState").all((req, res, next) => {
  3888. var json = queryString(req.url);
  3889. getmysql(req, res, "updateRaceState", json["id"], json["s"]);
  3890. });
  3891. //查询赛事项目详情
  3892. router.route("/selectRaceDetail").all((req, res, next) => {
  3893. var json = queryString(req.url);
  3894. getmysql(req, res, "selectRaceDetail", json["id"]);
  3895. });
  3896. //race 查询学校
  3897. router.route("/getSchool").all((req, res, next) => {
  3898. var json = queryString(req.url);
  3899. getmysql(req, res, "getSchool", json["n"]);
  3900. });
  3901. //查询我的学习报告
  3902. router.route("/selectMrEva").all((req, res, next) => {
  3903. var json = queryString(req.url);
  3904. getmysql(req, res, "selectMrEva", json["uid"], json["oid"], json["cid"]);
  3905. });
  3906. //查询行为数据库
  3907. router.route("/selectModelList").all((req, res, next) => {
  3908. var json = queryString(req.url);
  3909. getmysql(req, res, "selectModelList", json["cn"], json["oid"]);
  3910. });
  3911. //lsc
  3912. //admin 查询学校
  3913. router.route("/getSchoolAdmin").all((req, res, next) => {
  3914. var json = queryString(req.url);
  3915. getmysql(req, res, "select_school", json["page"], 10);
  3916. });
  3917. //admin 添加学校
  3918. router.route("/addSchoolAdmin").all((req, res, next) => {
  3919. postmysql(req, res, "add_school");
  3920. });
  3921. //组织添加学校
  3922. router.route("/addSchoolOrg").all((req, res, next) => {
  3923. postmysql(req, res, "addSchoolOrg");
  3924. });
  3925. //教师端组织添加学校
  3926. router.route("/insertSchoolByOrg").all((req, res, next) => {
  3927. postmysql(req, res, "insertSchoolByOrg");
  3928. });
  3929. //admin 删除学校
  3930. router.route("/deleteSchoolAdmin").all((req, res, next) => {
  3931. postmysql(req, res, "delete_school");
  3932. });
  3933. //admin 查询班级
  3934. router.route("/getClassAdmin").all((req, res, next) => {
  3935. var json = queryString(req.url);
  3936. getmysql(req, res, "select_classAdmin", json["cn"], json["page"], 10);
  3937. });
  3938. //admin 添加班级
  3939. router.route("/addClassAdmin").all((req, res, next) => {
  3940. postmysql(req, res, "add_classAdmin");
  3941. });
  3942. //admin 查询班级是否重复
  3943. router.route("/getClassRepeat").all((req, res, next) => {
  3944. var json = queryString(req.url);
  3945. getmysql(req, res, "select_classRepeatAdmin", json["n"], json["oid"]);
  3946. });
  3947. //查询未在此班级的学生
  3948. router.route("/getClassStudent").all((req, res, next) => {
  3949. var json = queryString(req.url);
  3950. getmysql(
  3951. req,
  3952. res,
  3953. "getClassStudent",
  3954. json["cid"],
  3955. json["oid"],
  3956. json["cn"],
  3957. json["page"],
  3958. json["num"]
  3959. );
  3960. });
  3961. //查询未在此教研室的老师
  3962. router.route("/getClassTeacher").all((req, res, next) => {
  3963. var json = queryString(req.url);
  3964. getmysql(
  3965. req,
  3966. res,
  3967. "getClassTeacher",
  3968. json["cid"],
  3969. json["oid"],
  3970. json["cn"],
  3971. json["page"],
  3972. json["num"]
  3973. );
  3974. });
  3975. //查询未在此年级的班级
  3976. router.route("/getGradeClass").all((req, res, next) => {
  3977. var json = queryString(req.url);
  3978. getmysql(
  3979. req,
  3980. res,
  3981. "getGradeClass",
  3982. json["cid"],
  3983. json["oid"],
  3984. json["cn"],
  3985. json["page"],
  3986. json["num"]
  3987. );
  3988. });
  3989. //添加学生到班级
  3990. router.route("/addClassStudent").all((req, res, next) => {
  3991. let cid = req.body[0].cid;
  3992. let student = JSON.parse(decodeURIComponent(req.body[0].student));
  3993. for (let i = 0; i < student.length; i++) {
  3994. let _userdata = [student[i]];
  3995. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectUser");
  3996. mysql.usselect(_userdata, function(ret) {
  3997. let classid = ret[0][0].classid;
  3998. if (!classid || classid.indexOf(cid) == -1) {
  3999. classid = classid ? classid.split(",") : [];
  4000. classid.push(cid);
  4001. let _userdata2 = [student[i], classid.join(",")];
  4002. _userdata2.unshift(
  4003. _mysqlLabor[0],
  4004. _mysqlLabor[1],
  4005. "updateStudentClass"
  4006. );
  4007. mysql.usselect(_userdata2, function(ret) {
  4008. if (i == student.length - 1) {
  4009. res.end(JSON.stringify({ success: 1 }));
  4010. }
  4011. });
  4012. }
  4013. });
  4014. }
  4015. });
  4016. //添加老师到教研室
  4017. router.route("/addClassTeacher").all((req, res, next) => {
  4018. let cid = req.body[0].cid;
  4019. let student = JSON.parse(decodeURIComponent(req.body[0].student));
  4020. for (let i = 0; i < student.length; i++) {
  4021. let _userdata = [student[i]];
  4022. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectUser");
  4023. mysql.usselect(_userdata, function(ret) {
  4024. let classid = ret[0][0].cclassid;
  4025. if (!classid || classid.indexOf(cid) == -1) {
  4026. classid = classid ? classid.split(",") : [];
  4027. classid.push(cid);
  4028. let _userdata2 = [student[i], classid.join(",")];
  4029. _userdata2.unshift(
  4030. _mysqlLabor[0],
  4031. _mysqlLabor[1],
  4032. "updateTeacherClass"
  4033. );
  4034. mysql.usselect(_userdata2, function(ret) {
  4035. if (i == student.length - 1) {
  4036. res.end(JSON.stringify({ success: 1 }));
  4037. }
  4038. });
  4039. }
  4040. });
  4041. }
  4042. });
  4043. //添加班级到年级
  4044. router.route("/addGradeClass").all((req, res, next) => {
  4045. let cid = req.body[0].cid;
  4046. let student = JSON.parse(decodeURIComponent(req.body[0].student));
  4047. for (let i = 0; i < student.length; i++) {
  4048. let _userdata = [cid, student[i]];
  4049. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "addGradeClass");
  4050. mysql.usselect(_userdata, function(ret) {
  4051. if (i == student.length - 1) {
  4052. res.end(JSON.stringify({ success: 1 }));
  4053. }
  4054. });
  4055. }
  4056. });
  4057. //移除学生此班级
  4058. router.route("/deleteClassStudent").all((req, res, next) => {
  4059. let cid = req.body[0].cid;
  4060. let student = req.body[0].uid;
  4061. let _userdata = [student];
  4062. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectUser");
  4063. mysql.usselect(_userdata, function(ret) {
  4064. let classid = ret[0][0].classid;
  4065. if (classid.indexOf(cid) != -1) {
  4066. classid = classid.split(",");
  4067. classid.splice(classid.indexOf(cid), 1);
  4068. let _userdata2 = [student, classid.join(",")];
  4069. _userdata2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudentClass");
  4070. mysql.usselect(_userdata2, function(ret) {
  4071. res.end(JSON.stringify({ success: 1 }));
  4072. });
  4073. }
  4074. });
  4075. });
  4076. //移除学生此班级
  4077. router.route("/deleteClassTeacher").all((req, res, next) => {
  4078. let cid = req.body[0].cid;
  4079. let student = req.body[0].uid;
  4080. let _userdata = [student];
  4081. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectUser");
  4082. mysql.usselect(_userdata, function(ret) {
  4083. let classid = ret[0][0].cclassid;
  4084. if (classid.indexOf(cid) != -1) {
  4085. classid = classid.split(",");
  4086. classid.splice(classid.indexOf(cid), 1);
  4087. let _userdata2 = [student, classid.join(",")];
  4088. _userdata2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTeacherClass");
  4089. mysql.usselect(_userdata2, function(ret) {
  4090. res.end(JSON.stringify({ success: 1 }));
  4091. });
  4092. }
  4093. });
  4094. });
  4095. //移除班级
  4096. router.route("/deleteGradeClass").all((req, res, next) => {
  4097. let cid = req.body[0].cid;
  4098. let student = req.body[0].uid;
  4099. let _userdata = ['', student];
  4100. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "addGradeClass");
  4101. mysql.usselect(_userdata, function(ret) {
  4102. res.end(JSON.stringify({ success: 1 }));
  4103. });
  4104. });
  4105. //admin 发布通知
  4106. router.route("/addNews").all((req, res, next) => {
  4107. postmysql(req, res, "add_news");
  4108. });
  4109. //admin 删除通知
  4110. router.route("/deleteNews").all((req, res, next) => {
  4111. postmysql(req, res, "delete_news");
  4112. });
  4113. //admin 添加banner
  4114. router.route("/addBanner").all((req, res, next) => {
  4115. postmysql(req, res, "add_banner");
  4116. });
  4117. //admin 添加banner
  4118. router.route("/deleteBanner").all((req, res, next) => {
  4119. postmysql(req, res, "delete_banner");
  4120. });
  4121. //admin 查询banner
  4122. router.route("/getBanner").all((req, res, next) => {
  4123. var json = queryString(req.url);
  4124. getmysql(req, res, "select_banner");
  4125. });
  4126. //根据学校查询banner
  4127. router.route("/selectBannerByOid").all((req, res, next) => {
  4128. var json = queryString(req.url);
  4129. getmysql(req, res, "selectBannerByOid", json["oid"]);
  4130. });
  4131. //admin 查询banner
  4132. router.route("/getBannerS").all((req, res, next) => {
  4133. var json = queryString(req.url);
  4134. getmysql(req, res, "getBannerS");
  4135. });
  4136. //根据学校查询banner
  4137. router.route("/selectBannerByOidS").all((req, res, next) => {
  4138. var json = queryString(req.url);
  4139. getmysql(req, res, "selectBannerByOidS", json["oid"]);
  4140. });
  4141. //admin 查询课程getSearchCourse
  4142. router.route("/getSearchCourse").all((req, res, next) => {
  4143. var json = queryString(req.url);
  4144. getmysql(req, res, "selectAll_courseSearch", json["t"]);
  4145. });
  4146. //根据学校查询课程
  4147. router.route("/getSearchCourseByoid").all((req, res, next) => {
  4148. var json = queryString(req.url);
  4149. getmysql(req, res, "selectAll_courseByOid", json["t"], json["oid"]);
  4150. });
  4151. //admin 查询所有课程专区
  4152. router.route("/getZone").all((req, res, next) => {
  4153. getmysql(req, res, "select_zone");
  4154. });
  4155. //admin 添加课程专区
  4156. router.route("/addZone").all((req, res, next) => {
  4157. postmysql(req, res, "insert_classZone");
  4158. });
  4159. //评审
  4160. router.route("/reviewCourse").all((req, res, next) => {
  4161. postmysql(req, res, "reviewCourse");
  4162. });
  4163. //查询评审
  4164. router.route("/getReview").all((req, res, next) => {
  4165. var json = queryString(req.url);
  4166. getmysql(req, res, "getReview", json["cid"]);
  4167. });
  4168. //查询所有课程专区下的课程
  4169. router.route("/getZoneClass").all((req, res, next) => {
  4170. var json = queryString(req.url);
  4171. getmysql(
  4172. req,
  4173. res,
  4174. "select_zoneClass",
  4175. json["bid"],
  4176. json["oid"],
  4177. json["page"],
  4178. 10
  4179. );
  4180. });
  4181. //查询所有课程专区下的课程
  4182. router.route("/getZoneClass").all((req, res, next) => {
  4183. var json = queryString(req.url);
  4184. getmysql(
  4185. req,
  4186. res,
  4187. "select_zoneClass",
  4188. json["bid"],
  4189. json["oid"],
  4190. json["page"],
  4191. 10
  4192. );
  4193. });
  4194. //查询所有课程专区下的课程
  4195. router.route("/getZoneClassStudent").all((req, res, next) => {
  4196. var json = queryString(req.url);
  4197. getmysql(
  4198. req,
  4199. res,
  4200. "select_zoneClass",
  4201. json["bid"],
  4202. json["oid"],
  4203. json["page"],
  4204. 20
  4205. );
  4206. });
  4207. //admin 后台查看专区下课程的数量
  4208. router.route("/getZoneClassNum").all((req, res, next) => {
  4209. var json = queryString(req.url);
  4210. getmysql(req, res, "select_zoneClassNum", json["bid"]);
  4211. });
  4212. //admin 后台添加课程专区时查看课程是否在此专区重复
  4213. router.route("/getZoneClassRepeat").all((req, res, next) => {
  4214. var json = queryString(req.url);
  4215. getmysql(req, res, "select_zoneClassRepeat", json["pid"], json["cid"]);
  4216. });
  4217. //把课程添加进专区
  4218. router.route("/addZoneCourse").all((req, res, next) => {
  4219. postmysql(req, res, "insert_app");
  4220. });
  4221. //admin 删除课程专区底下的课程
  4222. router.route("/deleteZoneCourse").all((req, res, next) => {
  4223. postmysql(req, res, "delete_app");
  4224. });
  4225. //admin 删除班级
  4226. router.route("/deleteZone").all((req, res, next) => {
  4227. postmysql(req, res, "delete_zone");
  4228. });
  4229. //admin 后台专区上移下移
  4230. router.route("/zoneRank").all((req, res, next) => {
  4231. postmysql(req, res, "update_classRank");
  4232. });
  4233. //admin 添加模板文档
  4234. router.route("/addTemplateAdmin").all((req, res, next) => {
  4235. postmysql(req, res, "add_template");
  4236. });
  4237. //admin 添加模板文档
  4238. router.route("/deleteTemplateAdmin").all((req, res, next) => {
  4239. postmysql(req, res, "delete_template");
  4240. });
  4241. //admin 查询模板文档
  4242. router.route("/getTemplateAdmin").all((req, res, next) => {
  4243. var json = queryString(req.url);
  4244. getmysql(req, res, "select_template", json["page"], 10);
  4245. });
  4246. //查询上传作业
  4247. router.route("/getCourseWorks").all((req, res, next) => {
  4248. var json = queryString(req.url); //cid 课程id,page 页数
  4249. getmysql(
  4250. req,
  4251. res,
  4252. "select_courseWorks",
  4253. json["cid"],
  4254. json["stage"],
  4255. json["task"],
  4256. json["page"],
  4257. 10
  4258. );
  4259. });
  4260. //查询上传作业
  4261. router.route("/getCourseWorks2").all((req, res, next) => {
  4262. var json = queryString(req.url); //cid 课程id,page 页数
  4263. getmysql(
  4264. req,
  4265. res,
  4266. "select_courseWorks2",
  4267. json["cid"],
  4268. json["uname"],
  4269. json["stage"],
  4270. json["task"],
  4271. json["page"],
  4272. 10
  4273. );
  4274. });
  4275. //查询上传作业
  4276. router.route("/getCourseWorks3").all((req, res, next) => {
  4277. var json = queryString(req.url); //cid 课程id,page 页数
  4278. getmysql(
  4279. req,
  4280. res,
  4281. "select_courseWorks3",
  4282. json["cid"],
  4283. json["uname"],
  4284. json["stage"],
  4285. json["task"],
  4286. json["page"],
  4287. 10
  4288. );
  4289. });
  4290. //查询上传作业--加上筛选班级
  4291. router.route("/getCourseWorks5").all((req, res, next) => {
  4292. var json = queryString(req.url); //cid 课程id,page 页数
  4293. getmysql(
  4294. req,
  4295. res,
  4296. "select_courseWorks5",
  4297. json["cid"],
  4298. json["uname"],
  4299. json["choseClass"],
  4300. json["stage"],
  4301. json["task"],
  4302. json["page"],
  4303. 10
  4304. );
  4305. });
  4306. //查询所有学生上传作业--加上筛选班级
  4307. router.route("/getCourseWorks6").all((req, res, next) => {
  4308. var json = queryString(req.url); //cid 课程id,page 页数
  4309. getmysql(
  4310. req,
  4311. res,
  4312. "select_courseWorks6",
  4313. json["cid"],
  4314. json["uname"],
  4315. json['choseClass'],
  4316. json["stage"],
  4317. json["task"]
  4318. );
  4319. });
  4320. //查询所有学生上传作业
  4321. router.route("/getCourseWorks4").all((req, res, next) => {
  4322. var json = queryString(req.url); //cid 课程id,page 页数
  4323. getmysql(
  4324. req,
  4325. res,
  4326. "select_courseWorks4",
  4327. json["cid"],
  4328. json["uname"],
  4329. json["stage"],
  4330. json["task"]
  4331. );
  4332. });
  4333. //查询学生课程作业
  4334. router.route("/selectStudentCourseWorks").all((req, res, next) => {
  4335. var json = queryString(req.url); //cid 课程id,page 页数
  4336. getmysql(
  4337. req,
  4338. res,
  4339. "selectStudentCourseWorks",
  4340. json["uid"],
  4341. json["cid"],
  4342. json["stage"],
  4343. json["task"],
  4344. json["page"],
  4345. 10
  4346. );
  4347. });
  4348. //查询报告数据
  4349. router.route("/getCourseWorksReport").all((req, res, next) => {
  4350. var json = queryString(req.url); //cid 课程id,page 页数
  4351. getmysql(req, res, "getCourseWorksReport", json["cid"]);
  4352. });
  4353. //查询报告数据--根据班级
  4354. router.route("/getCourseWorksReport2").all((req, res, next) => {
  4355. var json = queryString(req.url); //cid 课程id,page 页数
  4356. getmysql(req, res, "getCourseWorksReport2", json["cid"],json["choseClass"]);
  4357. });
  4358. //查询多个课程报告数据
  4359. router.route("/getCourseWorksReportMore").all((req, res, next) => {
  4360. var json = queryString(req.url); //cid 课程id,page 页数
  4361. getmysql(req, res, "getCourseWorksReportMore", json["cid"]);
  4362. });
  4363. //查询学生课程报告数据
  4364. router.route("/getStudentCourseWorksReport").all((req, res, next) => {
  4365. var json = queryString(req.url); //cid 课程id,page 页数
  4366. getmysql(req, res, "getStudentCourseWorksReport", json["uid"]);
  4367. });
  4368. //admin 添加项目模板文档
  4369. router.route("/addCourseTemplateAdmin").all((req, res, next) => {
  4370. postmysql(req, res, "add_courseTemplate");
  4371. });
  4372. //admin 添加项目模板文档
  4373. router.route("/deleteCourseTemplateAdmin").all((req, res, next) => {
  4374. postmysql(req, res, "delete_courseTemplate");
  4375. });
  4376. //admin 查询项目模板文档
  4377. router.route("/getCourseTemplateAdmin").all((req, res, next) => {
  4378. var json = queryString(req.url);
  4379. getmysql(req, res, "select_courseTemplate", json["page"], 10);
  4380. });
  4381. //teacher 查询项目模板
  4382. router.route("/getCourseTemplateT").all((req, res, next) => {
  4383. var json = queryString(req.url);
  4384. getmysql(req, res, "select_courseTemplateT");
  4385. });
  4386. //teacher 查询项目模板
  4387. router.route("/getTrainCourseTemplateT").all((req, res, next) => {
  4388. var json = queryString(req.url);
  4389. getmysql(req, res, "getTrainCourseTemplateT");
  4390. });
  4391. //teacher 查询项目模板
  4392. router.route("/getCourseTemplateTByOid").all((req, res, next) => {
  4393. var json = queryString(req.url);
  4394. getmysql(req, res, "getCourseTemplateTByOid", json["oid"]);
  4395. });
  4396. //teacher 查询项目模板
  4397. router.route("/getTrainCourseTemplateTByOid").all((req, res, next) => {
  4398. var json = queryString(req.url);
  4399. getmysql(req, res, "getTrainCourseTemplateTByOid", json["oid"]);
  4400. });
  4401. //目标管理查询目标模板
  4402. router.route("/selectEvaTemplate").all((req, res, next) => {
  4403. var json = queryString(req.url);
  4404. getmysql(req, res, "select_evaTemplate", json["oid"]);
  4405. });
  4406. //目标管理新增目标模板 修1
  4407. router.route("/addEvaTemplate").all((req, res, next) => {
  4408. var json = queryString(req.url);
  4409. getmysql(req, res, "add_evaTemplate", json["t"], json["c"], json["uid"], json["oid"]);
  4410. });
  4411. //teacher 查询项目模板
  4412. router.route("/getCourseTemplateTs").all((req, res, next) => {
  4413. var json = queryString(req.url);
  4414. getmysql(req, res, "getCourseTemplateTs", json["oid"]);
  4415. });
  4416. //teacher 查询项目模板
  4417. router.route("/getCourseTemplateTStudio").all((req, res, next) => {
  4418. var json = queryString(req.url);
  4419. getmysql(req, res, "getCourseTemplateTStudio", json["oid"]);
  4420. });
  4421. //admin 查询课程
  4422. router.route("/getCourseAdmin").all((req, res, next) => {
  4423. var json = queryString(req.url);
  4424. getmysql(req, res, "select_courseAdmin", json["cn"], json["page"], 10);
  4425. });
  4426. //admin 查询模板文档
  4427. router.route("/deleteCourseAdmin").all((req, res, next) => {
  4428. postmysql(req, res, "delete_courseAdmin");
  4429. });
  4430. //设置分组
  4431. router.route("/setCourseGroup").all((req, res, next) => {
  4432. postmysql(req, res, "setCourseGroup");
  4433. });
  4434. //删除分组
  4435. router.route("/deleteCourseGroup").all((req, res, next) => {
  4436. postmysql(req, res, "deleteCourseGroup");
  4437. });
  4438. //获取分组
  4439. router.route("/getCourseGroup").all((req, res, next) => {
  4440. var json = queryString(req.url);
  4441. getmysql(req, res, "getCourseGroup", json["cid"], json["classid"]);
  4442. });
  4443. //获取分组
  4444. router.route("/getCourseGroup2").all((req, res, next) => {
  4445. var json = queryString(req.url);
  4446. getmysql(req, res, "getCourseGroup2", json["cid"], json["classid"]);
  4447. });
  4448. //加入分组
  4449. router.route("/joinCourseGroup").all((req, res, next) => {
  4450. postmysql(req, res, "joinCourseGroup");
  4451. });
  4452. //退出分组
  4453. router.route("/exitCourseGroup").all((req, res, next) => {
  4454. postmysql(req, res, "exitCourseGroup");
  4455. });
  4456. //加入分组
  4457. router.route("/joinGroup").all((req, res, next) => {
  4458. postmysql(req, res, "joinGroup");
  4459. });
  4460. //退出分组
  4461. router.route("/exitGroup").all((req, res, next) => {
  4462. postmysql(req, res, "exitGroup");
  4463. });
  4464. //查看分组
  4465. router.route("/selectGroup").all((req, res, next) => {
  4466. postmysql(req, res, "selectGroup");
  4467. });
  4468. //查询ppt在哪页
  4469. router.route("/selectPptPage").all((req, res, next) => {
  4470. var json = queryString(req.url);
  4471. getmysql(req, res, "selectPptPage", json["id"]);
  4472. });
  4473. //修改ppt页码
  4474. router.route("/updatePptPage").all((req, res, next) => {
  4475. postmysql(req, res, "updatePptPage");
  4476. });
  4477. //修改ppt操作
  4478. router.route("/updatePPTHandle").all((req, res, next) => {
  4479. postmysql(req, res, "updatePPTHandle");
  4480. });
  4481. //查询实时课堂
  4482. router.route("/getRealTimeClass").all((req, res, next) => {
  4483. var json = queryString(req.url);
  4484. getmysql(
  4485. req,
  4486. res,
  4487. "getRealTimeClass",
  4488. json["cn"],
  4489. json["uid"],
  4490. json["page"],
  4491. 10
  4492. );
  4493. });
  4494. //查询实时课堂学生
  4495. router.route("/getRealTimeClassStu").all((req, res, next) => {
  4496. var json = queryString(req.url);
  4497. getmysql(
  4498. req,
  4499. res,
  4500. "getRealTimeClassStu",
  4501. json["oid"],
  4502. json["cid"],
  4503. json["page"],
  4504. 10
  4505. );
  4506. });
  4507. //查询实时课堂学生
  4508. router.route("/getRealTimeClassById").all((req, res, next) => {
  4509. var json = queryString(req.url);
  4510. getmysql(req, res, "getRealTimeClassById", json["id"]);
  4511. });
  4512. //根据区级管理者查询案例
  4513. router.route("/selectAnliList").all((req, res, next) => {
  4514. var json = queryString(req.url);
  4515. getmysql(
  4516. req,
  4517. res,
  4518. "selectAnliList",
  4519. json["typea"],
  4520. json["typeb"],
  4521. json["typec"],
  4522. json["typed"],
  4523. json["typeE"],
  4524. json["cn"],
  4525. json["cid"],
  4526. json["title"],
  4527. json["page"],
  4528. 10
  4529. );
  4530. });
  4531. //根据市级管理者查询案例
  4532. router.route("/selectAnliList1").all((req, res, next) => {
  4533. var json = queryString(req.url);
  4534. getmysql(
  4535. req,
  4536. res,
  4537. "selectAnliList1",
  4538. json["typea"],
  4539. json["typeb"],
  4540. json["typec"],
  4541. json["typed"],
  4542. json["typeE"],
  4543. json["cn"],
  4544. json["cid"],
  4545. json["title"],
  4546. json["page"],
  4547. 10
  4548. );
  4549. });
  4550. //根据省级级管理者查询案例
  4551. router.route("/selectAnliList2").all((req, res, next) => {
  4552. var json = queryString(req.url);
  4553. getmysql(
  4554. req,
  4555. res,
  4556. "selectAnliList2",
  4557. json["typea"],
  4558. json["typeb"],
  4559. json["typec"],
  4560. json["typed"],
  4561. json["typeE"],
  4562. json["cn"],
  4563. json["cid"],
  4564. json["title"],
  4565. json["page"],
  4566. 10
  4567. );
  4568. });
  4569. //删除1案例
  4570. router.route("/deleteAnli").all((req, res, next) => {
  4571. var json = queryString(req.url);
  4572. getmysql2(req, res, "deleteAnli", json["id"]);
  4573. });
  4574. //根据区县管理者查询评分
  4575. router.route("/selectPoint").all((req, res, next) => {
  4576. var json = queryString(req.url);
  4577. getmysql(
  4578. req,
  4579. res,
  4580. "selectPoint",
  4581. json["typea"],
  4582. json["typeb"],
  4583. json["typec"],
  4584. json["typed"],
  4585. json["typeE"],
  4586. json["cn"],
  4587. json["cid"],
  4588. json["title"],
  4589. json["page"],
  4590. 10
  4591. );
  4592. });
  4593. //根据市级管理者查询评分
  4594. router.route("/selectPoint1").all((req, res, next) => {
  4595. var json = queryString(req.url);
  4596. getmysql(
  4597. req,
  4598. res,
  4599. "selectPoint1",
  4600. json["typea"],
  4601. json["typeb"],
  4602. json["typec"],
  4603. json["typed"],
  4604. json["typeE"],
  4605. json["cn"],
  4606. json["cid"],
  4607. json["title"],
  4608. json["page"],
  4609. 10
  4610. );
  4611. });
  4612. //根据市级管理者查询全部评分
  4613. router.route("/selectPointAll").all((req, res, next) => {
  4614. var json = queryString(req.url);
  4615. getmysql(
  4616. req,
  4617. res,
  4618. "selectPointAll",
  4619. json["typea"],
  4620. json["typeb"],
  4621. json["typec"],
  4622. json["typed"],
  4623. json["typeE"],
  4624. json["cn"],
  4625. json["cid"],
  4626. json["title"]
  4627. );
  4628. });
  4629. //查询分配案例
  4630. router.route("/selectCaseUser").all((req, res, next) => {
  4631. var json = queryString(req.url);
  4632. getmysql(req, res, "select_case", json["uid"]);
  4633. });
  4634. //根据用户id,课程id,阶段,任务,工具去查询协同
  4635. router.route("/selectWord").all((req, res, next) => {
  4636. var json = queryString(req.url);
  4637. getmysql(
  4638. req,
  4639. res,
  4640. "selectWord",
  4641. json["uid"],
  4642. json["cid"],
  4643. json["s"],
  4644. json["task"],
  4645. json["t"]
  4646. );
  4647. });
  4648. //根据用户id,课程id,阶段,任务,工具去查询协同
  4649. router.route("/selectWord2").all((req, res, next) => {
  4650. var json = queryString(req.url);
  4651. getmysql(
  4652. req,
  4653. res,
  4654. "selectWord2",
  4655. json["uid"],
  4656. json["cid"],
  4657. json["s"],
  4658. json["task"],
  4659. json["t"],
  4660. json["type"]
  4661. );
  4662. });
  4663. //根据用户id,课程id,阶段,任务,工具去查询协同
  4664. router.route("/selectWords").all((req, res, next) => {
  4665. var json = queryString(req.url);
  4666. getmysql(
  4667. req,
  4668. res,
  4669. "selectWords",
  4670. json["uid"],
  4671. json["cid"],
  4672. json["s"],
  4673. json["task"],
  4674. json["t"],
  4675. json["type"]
  4676. );
  4677. });
  4678. //根据用户id,课程id,阶段,任务,工具去查询协同
  4679. router.route("/selectWordsY").all((req, res, next) => {
  4680. var json = queryString(req.url);
  4681. getmysql(
  4682. req,
  4683. res,
  4684. "selectWordsY",
  4685. json["uid"],
  4686. json["cid"],
  4687. json["s"],
  4688. json["task"],
  4689. json["t"],
  4690. json["type"]
  4691. );
  4692. });
  4693. //新增协同内容
  4694. router.route("/insertWord2y").all((req, res, next) => {
  4695. var json = queryString(req.url);
  4696. // getmysql(req, res, "insertWord2y", json["uid"], json["cid"], json["s"], json["task"], json["t"], json["text"], json["type"]);
  4697. postmysql3(req, res, "insertWord2y");
  4698. });
  4699. //新增协同内容 修1
  4700. router.route("/insertWord").all((req, res, next) => {
  4701. var json = queryString(req.url);
  4702. getmysql(
  4703. req,
  4704. res,
  4705. "insertWord",
  4706. json["uid"],
  4707. json["cid"],
  4708. json["s"],
  4709. json["task"],
  4710. json["t"],
  4711. json["text"]
  4712. );
  4713. });
  4714. //分配案例
  4715. router.route("/insertCase").all((req, res, next) => {
  4716. if (req.body[0]) {
  4717. p = [req.body[0].uid, req.body[0].box];
  4718. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insertCase"); //執行存儲過程
  4719. mysql.usselect(p, function(ret) {
  4720. res.end(JSON.stringify({ success: 1 }));
  4721. });
  4722. }
  4723. });
  4724. //新增评分
  4725. router.route("/addScore").all((req, res, next) => {
  4726. postmysql(req, res, "addScore");
  4727. });
  4728. //添加用户标签
  4729. router.route("/add_userlabel").all((req, res, next) => {
  4730. postmysql2(req, res, "add_userlabel");
  4731. });
  4732. //查询评分
  4733. router.route("/selectScore").all((req, res, next) => {
  4734. var json = queryString(req.url);
  4735. getmysql(req, res, "selectScore", json["rid"], json["suser"]);
  4736. });
  4737. //查询所有评分
  4738. router.route("/selectAllScore").all((req, res, next) => {
  4739. var json = queryString(req.url);
  4740. getmysql(req, res, "selectAllScore");
  4741. });
  4742. //查询所有学校以及组织
  4743. router.route("/selectAllSchool").all((req, res, next) => {
  4744. var json = queryString(req.url);
  4745. getmysql(req, res, "selectAllSchool");
  4746. });
  4747. //根据用户id查询评分
  4748. router.route("/selectScoreByUid").all((req, res, next) => {
  4749. var json = queryString(req.url);
  4750. getmysql(req, res, "selectScoreByUid", json["uid"]);
  4751. });
  4752. //查询单个案例所有评分
  4753. router.route("/selectAnliScore").all((req, res, next) => {
  4754. var json = queryString(req.url);
  4755. getmysql(req, res, "selectAnliScore", json["rid"]);
  4756. });
  4757. //赛事推荐 修1
  4758. router.route("/updateRaceRec").all((req, res, next) => {
  4759. var json = queryString(req.url);
  4760. getmysql(req, res, "updateRaceRec", json["id"], json["rec"]);
  4761. });
  4762. //查询数据报告学生报告列表
  4763. router.route("/selectSr").all((req, res, next) => {
  4764. var json = queryString(req.url);
  4765. getmysql(
  4766. req,
  4767. res,
  4768. "selectSr",
  4769. json["cu"],
  4770. json["cn"],
  4771. json["oid"],
  4772. json["page"],
  4773. 10
  4774. );
  4775. });
  4776. //查询数据报告班级报告列表
  4777. router.route("/selectCr").all((req, res, next) => {
  4778. var json = queryString(req.url);
  4779. getmysql(
  4780. req,
  4781. res,
  4782. "selectCr",
  4783. json["cu"],
  4784. json["cn"],
  4785. json["oid"],
  4786. json["page"],
  4787. 10
  4788. );
  4789. });
  4790. //查询数据报告查看班级报告底下学生列表
  4791. router.route("/selectCStudent").all((req, res, next) => {
  4792. var json = queryString(req.url);
  4793. getmysql(req, res, "selectCStudent", json["cid"], json["courseid"]);
  4794. });
  4795. //查询数据报告课程报告列表
  4796. router.route("/selectCourseR").all((req, res, next) => {
  4797. var json = queryString(req.url);
  4798. getmysql(
  4799. req,
  4800. res,
  4801. "selectCourseR",
  4802. json["cu"],
  4803. json["cn"],
  4804. json["cl"],
  4805. json["oid"],
  4806. json["page"],
  4807. 10
  4808. );
  4809. });
  4810. //根据学校id查询学校底下有评价的课程
  4811. router.route("/selectCourseByOid").all((req, res, next) => {
  4812. var json = queryString(req.url);
  4813. getmysql(req, res, "selectCourseByOid", json["oid"]);
  4814. });
  4815. //根据目标id和班级id查询底下有作业的课程
  4816. router.route("/selectEvaCourse").all((req, res, next) => {
  4817. var json = queryString(req.url);
  4818. getmysql(req, res, "selectEvaCourse", json["eid"], json["cid"]);
  4819. });
  4820. //teacher 查询模板
  4821. router.route("/getTemplateT").all((req, res, next) => {
  4822. var json = queryString(req.url);
  4823. getmysql(req, res, "select_templateT");
  4824. });
  4825. //思维网格 创建房间
  4826. router.route("/insertRoom").all((req, res, next) => {
  4827. postmysql(req, res, "insertRoom");
  4828. });
  4829. //删除作业阶段任务工具
  4830. router.route("/deleteStudentToolSTT").all((req, res, next) => {
  4831. postmysql(req, res, "deleteStudentToolSTT");
  4832. });
  4833. //删除作业阶段任务
  4834. router.route("/deleteStudentToolST").all((req, res, next) => {
  4835. postmysql(req, res, "deleteStudentToolST");
  4836. });
  4837. //删除作业阶段
  4838. router.route("/deleteStudentToolS").all((req, res, next) => {
  4839. postmysql(req, res, "deleteStudentToolST");
  4840. });
  4841. //协同编辑 创建房间
  4842. router.route("/insertRoomByFile").all((req, res, next) => {
  4843. //var json = queryString(req.url);
  4844. postmysql2(req, res, "insertRoomByFile");
  4845. //getmysql(req, res, "insertRoomByFile", json["uid"], json["n"], json["d"]);
  4846. });
  4847. //思维网格 查询是否是重复房间号
  4848. router.route("/checkRoomNum").all((req, res, next) => {
  4849. var json = queryString(req.url);
  4850. getmysql(req, res, "checkRoomNum", json["num"]);
  4851. });
  4852. //思维网格 查询房间列表
  4853. router.route("/selectRoomList").all((req, res, next) => {
  4854. var json = queryString(req.url);
  4855. getmysql(
  4856. req,
  4857. res,
  4858. "selectRoomList",
  4859. json["uid"],
  4860. json["oid"],
  4861. json["cid"],
  4862. json["cu"],
  4863. json["cn"]
  4864. );
  4865. });
  4866. //查询pdf列表
  4867. router.route("/selectRTC").all((req, res, next) => {
  4868. var json = queryString(req.url);
  4869. getmysql(req, res, "selectRTC", json["uid"], json["cu"], json["cn"]);
  4870. });
  4871. //协同文档 查询房间列表
  4872. router.route("/selectFileList").all((req, res, next) => {
  4873. var json = queryString(req.url);
  4874. getmysql(
  4875. req,
  4876. res,
  4877. "selectFileList",
  4878. json["uid"],
  4879. json["oid"],
  4880. json["cid"],
  4881. json["cu"],
  4882. json["cn"]
  4883. );
  4884. });
  4885. //协同编辑 查询是否是重复房间号
  4886. router.route("/checkRoomNumByFile").all((req, res, next) => {
  4887. var json = queryString(req.url);
  4888. getmysql(req, res, "checkRoomNumByFile", json["num"]);
  4889. });
  4890. //思维网格 根据房间号或者用户id查询房间信息
  4891. router.route("/selectRoom").all((req, res, next) => {
  4892. var json = queryString(req.url);
  4893. getmysql(req, res, "selectRoom", json["uid"]);
  4894. });
  4895. //思维网格 根据房间号或者用户id查询房间信息
  4896. router.route("/getRoom").all((req, res, next) => {
  4897. var json = queryString(req.url);
  4898. getmysql(req, res, "select_room", json["fid"]);
  4899. });
  4900. //协同编辑 根据房间号或者用户id查询房间信息
  4901. router.route("/selectRoomByFile").all((req, res, next) => {
  4902. var json = queryString(req.url);
  4903. getmysql(req, res, "selectRoomByFile", json["uid"]);
  4904. });
  4905. //思维网格 修改房间数据
  4906. router.route("/updateRoomData").all((req, res, next) => {
  4907. postmysql(req, res, "updateRoomData");
  4908. });
  4909. // 修1
  4910. router.route("/updateFileData").all((req, res, next) => {
  4911. var json = queryString(req.url);
  4912. var json2 = json["mode"].split(",");
  4913. getmysql(req, res, "updateFileData", json2[0], json2[1]);
  4914. });
  4915. router.route("/select_file").all((req, res, next) => {
  4916. var json = queryString(req.url);
  4917. getmysql(req, res, "select_file", json["fid"]);
  4918. });
  4919. //思维网格 解散房间
  4920. router.route("/dismiss").all((req, res, next) => {
  4921. postmysql(req, res, "update_room");
  4922. });
  4923. //提交提问
  4924. router.route("/addProblem").all((req, res, next) => {
  4925. postmysql(req, res, "add_problem");
  4926. //cid 课程id,chid 章节id,t 提问内容,uid 用户id
  4927. });
  4928. //查询提交的提问
  4929. router.route("/getProblem").all((req, res, next) => {
  4930. var json = queryString(req.url); //cid 课程id,page 页数
  4931. getmysql(req, res, "select_problem", json["cid"], json["page"], 10);
  4932. });
  4933. //获取用户基本信息
  4934. router.route("/getUserInfo").all((req, res, next) => {
  4935. var json = queryString(req.url);
  4936. getmysql(req, res, "getUserInfo", json["uid"], json["cid"]);
  4937. });
  4938. //获取用户多个课程基本信息
  4939. router.route("/getUserInfoMore").all((req, res, next) => {
  4940. var json = queryString(req.url);
  4941. getmysql(req, res, "getUserInfoMore", json["uid"], json["cid"]);
  4942. });
  4943. //获取多个用户单个课程基本信息
  4944. router.route("/getClassUserInfoMore").all((req, res, next) => {
  4945. var json = queryString(req.url);
  4946. getmysql(req, res, "getClassUserInfoMore", json["uid"], json["cid"]);
  4947. });
  4948. //获取课程下所有有作业的学生id
  4949. router.route("/selectCourseSuid").all((req, res, next) => {
  4950. var json = queryString(req.url);
  4951. getmysql(req, res, "selectCourseSuid", json["cid"], json["courseid"]);
  4952. });
  4953. //获取项目基本信息
  4954. router.route("/getCourseInfo").all((req, res, next) => {
  4955. var json = queryString(req.url);
  4956. getmysql(req, res, "getCourseInfo", json["cid"]);
  4957. });
  4958. //课程中心 总评添加和修改功能
  4959. router.route("/opCourseScore").all((req, res, next) => {
  4960. postmysql(req, res, "opCourseScore");
  4961. });
  4962. //查询已评价功能
  4963. router.route("/getCourseScoreP").all((req, res, next) => {
  4964. var json = queryString(req.url);
  4965. getmysql(req, res, "getCourseScoreP", json["cid"], json["uid"]);
  4966. });
  4967. //查询所有已评价功能
  4968. router.route("/getCourseScore").all((req, res, next) => {
  4969. var json = queryString(req.url);
  4970. getmysql(req, res, "getCourseScore", json["cid"]);
  4971. });
  4972. //获取多个项目基本信息
  4973. router.route("/getCourseInfoMore").all((req, res, next) => {
  4974. var json = queryString(req.url);
  4975. getmysql(req, res, "getCourseInfoMore", json["cid"]);
  4976. });
  4977. //获取用户基本信息
  4978. router.route("/getAllUserById").all((req, res, next) => {
  4979. var json = queryString(req.url);
  4980. getmysql(req, res, "getAllUserById", json["uid"]);
  4981. });
  4982. //作业生成报告
  4983. router.route("/getWorkData").all((req, res, next) => {
  4984. var json = queryString(req.url); //cid 课程id,page 页数
  4985. getmysql(req, res, "select_work_data", json["cid"]);
  4986. });
  4987. //查询评价体系
  4988. router.route("/getEvaluation").all((req, res, next) => {
  4989. var json = queryString(req.url); //cid 课程id,page 页数
  4990. getmysql(
  4991. req,
  4992. res,
  4993. "select_evaluation",
  4994. json["oid"],
  4995. json["n"],
  4996. json["page"],
  4997. 10
  4998. );
  4999. });
  5000. //添加评价体系
  5001. router.route("/addEvaluation").all((req, res, next) => {
  5002. postmysql(req, res, "add_evaluation");
  5003. //uid 用户id t标题 c内容
  5004. });
  5005. //修改评价体系
  5006. router.route("/updateEvaluation").all((req, res, next) => {
  5007. postmysql(req, res, "update_evaluation");
  5008. //c内容 t标题 id评价id
  5009. });
  5010. //删除评价体系
  5011. router.route("/deleteEvaluation").all((req, res, next) => {
  5012. postmysql(req, res, "delete_evaluation");
  5013. // id评价id
  5014. });
  5015. //删除评价体系前查询课程是否有该评价
  5016. router.route("/selectCourseEva").all((req, res, next) => {
  5017. var json = queryString(req.url); //cid 课程id,page 页数
  5018. getmysql(
  5019. req,
  5020. res,
  5021. "select_course_eva",
  5022. json["eid"],
  5023. );
  5024. });
  5025. //批量添加学校
  5026. router.route("/batchRegistrationSchool").post(function(req, res, next) {
  5027. let users = req.body[0];
  5028. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5029. for (let i = 0; i < arr.length; i++) {
  5030. let _school = encodeURIComponent(arr[i].school);
  5031. let _org = users.org;
  5032. //用戶數據
  5033. let _data = [_school, _org, "", "1", ""];
  5034. //參數拼接,註冊
  5035. _data.unshift(_mysqlLabor[0], _mysqlLabor[1], "insertSchoolByOrg");
  5036. //用戶註冊處理
  5037. mysql.usselect(_data, function(ret) {
  5038. res.end(JSON.stringify({ success: 1 }));
  5039. });
  5040. }
  5041. });
  5042. //批量添加学生
  5043. router.route("/batchRegistrationMore").post(function(req, res, next) {
  5044. let users = req.body[0];
  5045. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5046. for (let i = 0; i < arr.length; i++) {
  5047. let _username = encodeURIComponent(arr[i].name);
  5048. let _mail = encodeURIComponent(arr[i].mail)
  5049. let _password = users.password || "123456";
  5050. let _alias = encodeURIComponent(arr[i].name)
  5051. let _oid = users.oid;
  5052. let _ph = encodeURIComponent(arr[i].phone ? arr[i].phone : "")
  5053. let _class = encodeURIComponent(arr[i].class)
  5054. let _sId = encodeURIComponent(arr[i].sId)
  5055. //加密密碼
  5056. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5057. //生成激活碼
  5058. let _hashstr = new Date().getTime() + "";
  5059. let _digest = crypto
  5060. .createHash("sha256")
  5061. .update(_hashstr, "utf8")
  5062. .digest("hex");
  5063. //用戶數據
  5064. let _userdata = [
  5065. _mail,
  5066. _password,
  5067. _alias,
  5068. "",
  5069. 1, //0老师 1学生
  5070. _username,
  5071. "",
  5072. generateAPIKey(_username),
  5073. _digest,
  5074. "",
  5075. _username,
  5076. _sId,
  5077. 2, //1老师 2学生
  5078. _oid,
  5079. _ph,
  5080. _class,
  5081. "",
  5082. "0",
  5083. ];
  5084. //參數拼接,註冊
  5085. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
  5086. //用戶註冊處理
  5087. mysql.usselect(_userdata, function(ret) {
  5088. // let _pbluserdata = [
  5089. // ret[1][0].uid,
  5090. // _username,
  5091. // _sId,
  5092. // 2,
  5093. // _oid,
  5094. // _ph,
  5095. // _class,
  5096. // '',
  5097. // "0",
  5098. // ];
  5099. // _pbluserdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateUserByEdu");
  5100. // mysql.usselect(_pbluserdata, function(ret) {
  5101. res.end(JSON.stringify({ success: 1 }));
  5102. // });
  5103. });
  5104. }
  5105. });
  5106. //幼儿园评价
  5107. // 获取所有班级
  5108. router.route("/select_techerAllClass").all(function(req, res, next) {
  5109. // let users = req.query;
  5110. var json = queryString(req.url);
  5111. console.log(json);
  5112. getmysql(req, res, "select_techerAllClass", json['cid']);
  5113. });
  5114. // 获取所有班级学生
  5115. router.route("/selectClassStudent").all(function(req, res, next) {
  5116. var json = queryString(req.url);
  5117. getmysql(req, res, "selectClassStudent", json['cid']);
  5118. });
  5119. // 获取学生详情
  5120. router.route("/selectStudentDetail").all(function(req, res, next) {
  5121. // let users = req.query;
  5122. var json = queryString(req.url);
  5123. console.log(json);
  5124. getmysql(req, res, "selectStudentDetail", json['uid']);
  5125. });
  5126. // 获取学生记录筛选框
  5127. router.route("/selectVeiDoo").all(function(req, res, next) {
  5128. // let users = req.query;
  5129. var json = queryString(req.url);
  5130. // console.log(json);
  5131. getmysql(req, res, "selectVeiDoo", json['oid']);
  5132. });
  5133. // 上传学生评价
  5134. router.route("/insertRecord").all(function(req, res, next) {
  5135. // console.log(req.query);
  5136. postmysql(req, res, "insertRecord");
  5137. });
  5138. // 获取学生记录
  5139. router.route("/selectRecord").all(function(req, res, next) {
  5140. // let users = req.query;
  5141. var json = queryString(req.url);
  5142. // console.log(json);
  5143. // let txt=
  5144. getmysql(req, res, "selectRecord", json['uid'], json['trm'], json['txt']);
  5145. });
  5146. // 获取学生记录详情
  5147. router.route("/selectRecordDetail").all(function(req, res, next) {
  5148. // let users = req.query;
  5149. var json = queryString(req.url);
  5150. // console.log(json);
  5151. getmysql(req, res, "selectRecordDetail", json['id']);
  5152. });
  5153. // 删除学生评价
  5154. router.route("/updateRecord").all(function(req, res, next) {
  5155. // console.log(req.query);
  5156. postmysql(req, res, "updateRecord");
  5157. });
  5158. // 更新学生评价
  5159. router.route("/updateRecordData").all(function(req, res, next) {
  5160. // console.log(req.query);
  5161. postmysql(req, res, "updateRecordData");
  5162. });
  5163. // 获取学生记录详情
  5164. router.route("/selectSerStudent").all(function(req, res, next) {
  5165. // let users = req.query;
  5166. var json = queryString(req.url);
  5167. // console.log(json);
  5168. getmysql(req, res, "selectSerStudent", json['id'], json['txt']);
  5169. });
  5170. // 获取学期
  5171. router.route("/selectTerm").all(function(req, res, next) {
  5172. var json = queryString(req.url);
  5173. getmysql(req, res, "selectTerm");
  5174. });
  5175. // 获取班级信息
  5176. router.route("/selectManyClassStudent").all(function(req, res, next) {
  5177. var json = queryString(req.url);
  5178. getmysql(req, res, "selectManyClassStudent", json['cid'], json['uid']);
  5179. });
  5180. //幼儿园学生评价获取学生列表
  5181. router.route("/selectStudentAndRecord").all(function(req, res, next) {
  5182. var json = queryString(req.url);
  5183. getmysql(req, res, "selectStudentAndRecord", json['cid'], json['cu'], json['cn'], json['oid'], json['org'], json['page'], 10);
  5184. });
  5185. // pbl教师端观察日记
  5186. router.route("/selectVeidooType").all(function(req, res, next) {
  5187. var json = queryString(req.url);
  5188. // console.log(json);
  5189. getmysql(req, res, "selectVeidooType", json['uid'], json['cid'], json['cu'], json['cn'], json['cm'], json['page'], 10);
  5190. });
  5191. //查询幼儿园分类
  5192. router.route("/selectSTEType").all(function(req, res, next) {
  5193. var json = queryString(req.url);
  5194. // console.log(json);
  5195. getmysql(req, res, "selectSTEType", json['org'], json['oid']);
  5196. });
  5197. //查询口语分类
  5198. router.route("/select_englishVoiceType").all(function(req, res, next) {
  5199. var json = queryString(req.url);
  5200. // console.log(json);
  5201. getmysql(req, res, "select_englishVoiceType", json['oid'], json['org']);
  5202. });
  5203. //查询我的口语分类
  5204. router.route("/selectMySubTalk").all(function(req, res, next) {
  5205. var json = queryString(req.url);
  5206. // console.log(json);
  5207. getmysql(req, res, "selectMySubTalk", json['userid']);
  5208. });
  5209. //查询学情报告雷达图数据
  5210. router.route("/selectMapStuScore").all(function(req, res, next) {
  5211. var json = queryString(req.url);
  5212. // console.log(json);
  5213. getmysql(req, res, "selectMapStuScore", json['uid'], json['year']);
  5214. });
  5215. //每个大分类下的关键证据
  5216. router.route("/selectHealthRecord").all(function(req, res, next) {
  5217. var json = queryString(req.url);
  5218. // console.log(json);
  5219. getmysql(req, res, "selectHealthRecord", json['uid'], json['year'], json['txt'], json['page'], 4);
  5220. });
  5221. //手机端 获取记录地点list
  5222. router.route("/selectSTEPlace").all(function(req, res, next) {
  5223. var json = queryString(req.url);
  5224. // console.log(json);
  5225. getmysql(req, res, "selectSTEPlace", json['org'], json['oid']);
  5226. });
  5227. //获取所有的记录进行下载
  5228. router.route("/selectClassAllRecord").all(function(req, res, next) {
  5229. var json = queryString(req.url);
  5230. // console.log(json);
  5231. getmysql(req, res, "selectClassAllRecord",json['cid'], json['id']);
  5232. });
  5233. //record页面计算班级平均分
  5234. router.route("/selectClaAverageScore").all(function(req, res, next) {
  5235. var json = queryString(req.url);
  5236. // console.log(json);
  5237. getmysql(req, res, "selectClaAverageScore", json["cu"], json["oid"], json["cn"], json["trm"], json["page"], 10);
  5238. });
  5239. //record页面下载班级分数数据
  5240. router.route("/selectAllClaAvaRescore").all(function(req, res, next) {
  5241. var json = queryString(req.url);
  5242. // console.log(json);
  5243. getmysql(req, res, "selectAllClaAvaRescore", json["cu"], json["oid"], json["cn"], json["trm"]);
  5244. });
  5245. //学情报告计算班级平均分
  5246. router.route("/selectClaAvaScore").all(function(req, res, next) {
  5247. var json = queryString(req.url);
  5248. // console.log(json);
  5249. getmysql(req, res, "selectClaAvaScore", json["cid"], json["trm"]);
  5250. });
  5251. // 获取教师管理table数据
  5252. router.route("/selectOrgTeachar").all((req, res, next) => {
  5253. var json = queryString(req.url);
  5254. getmysql(
  5255. req,
  5256. res,
  5257. "selectOrgTeachar",
  5258. json["org"],
  5259. json["oid"],
  5260. json["cu"],
  5261. json["cn"],
  5262. json["page"],
  5263. 10
  5264. );
  5265. });
  5266. // 更新老师信息数据
  5267. router.route("/updateYTeacherInfo").all(function(req, res, next) {
  5268. // console.log(req.query);
  5269. postmysql(req, res, "updateYTeacherInfo");
  5270. });
  5271. //教师管理新增教师
  5272. router.route("/teacherRegistration").post(function(req, res, next) {
  5273. var users = req.body[0];
  5274. //循环注册
  5275. var _username = users.alias;
  5276. var _mail = users.username;
  5277. var _password = users.password || "123456";
  5278. var _alias = users.alias;
  5279. var _org = users.org;
  5280. var _oid = users.oid;
  5281. var _ph = users.ph;
  5282. var _class = users.cid;
  5283. var _sId = users.sid;
  5284. var _typ = users.typ;
  5285. var _rol = users.rol;
  5286. //加密密碼
  5287. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5288. //生成激活碼
  5289. let _hashstr = new Date().getTime() + "";
  5290. let _digest = crypto
  5291. .createHash("sha256")
  5292. .update(_hashstr, "utf8")
  5293. .digest("hex");
  5294. //用戶數據
  5295. var _userdata = [
  5296. _mail,
  5297. _password,
  5298. _alias,
  5299. "",
  5300. 0,
  5301. _username,
  5302. "",
  5303. generateAPIKey(_username),
  5304. _digest,
  5305. "",
  5306. _username,
  5307. _sId,
  5308. _typ,
  5309. _org,
  5310. _oid,
  5311. _ph,
  5312. _class,
  5313. "",
  5314. "0",
  5315. _rol
  5316. ];
  5317. //參數拼接,註冊
  5318. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_teacherRegistration");
  5319. //用戶註冊處理
  5320. mysql.usselect(_userdata, function(ret) {
  5321. res.end(
  5322. JSON.stringify({
  5323. uid: ret[1][0].uid,
  5324. ph: _ph,
  5325. oid: _oid,
  5326. cid: _class,
  5327. success: 1,
  5328. })
  5329. );
  5330. });
  5331. });
  5332. //初始化密码
  5333. router.route("/iniPassword").post(function(req, res, next) {
  5334. let users = req.body[0];
  5335. _password = users.pa;
  5336. //加密密碼
  5337. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5338. //用戶數據
  5339. let _userList = [users.uid, _password];
  5340. _userList.unshift(_mysqlLabor[0], _mysqlLabor[1], "iniPassword");
  5341. mysql.usselect(_userList, function(ret) {
  5342. res.end(JSON.stringify({ success: 1 }));
  5343. });
  5344. });
  5345. //批量添加教师
  5346. router.route("/batchRegistrationMore1").post(function(req, res, next) {
  5347. let users = req.body[0];
  5348. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5349. for (let i = 0; i < arr.length; i++) {
  5350. let _username = encodeURIComponent(arr[i].name)
  5351. let _mail = encodeURIComponent(arr[i].mail)
  5352. let _password = users.password || "123456";
  5353. let _alias = encodeURIComponent(arr[i].name)
  5354. let _org = users.org;
  5355. let _oid = encodeURIComponent(arr[i].school)
  5356. let _ph = encodeURIComponent(arr[i].phone ? arr[i].phone : "")
  5357. let _class = encodeURIComponent(arr[i].class)
  5358. let _sId = encodeURIComponent(arr[i].sId)
  5359. //加密密碼
  5360. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5361. //生成激活碼
  5362. let _hashstr = new Date().getTime() + "";
  5363. let _digest = crypto
  5364. .createHash("sha256")
  5365. .update(_hashstr, "utf8")
  5366. .digest("hex");
  5367. //用戶數據
  5368. let _userdata = [
  5369. _mail,
  5370. _password,
  5371. _alias,
  5372. "",
  5373. 0, //0老师 1学生
  5374. _username,
  5375. "",
  5376. generateAPIKey(_username),
  5377. _digest,
  5378. "",
  5379. _username,
  5380. _sId,
  5381. 1, //1老师 2学生
  5382. _org,
  5383. _oid,
  5384. "",
  5385. "",
  5386. "",
  5387. "0",
  5388. ];
  5389. //參數拼接,註冊
  5390. _userdata.unshift(
  5391. _mysqluser[0],
  5392. _mysqluser[1],
  5393. "pbl_add_batchregister_oid"
  5394. );
  5395. //用戶註冊處理
  5396. mysql.usselect(_userdata, function(ret) {
  5397. res.end(JSON.stringify({ success: 1 }));
  5398. });
  5399. }
  5400. });
  5401. //赛事批量注册老师
  5402. router.route("/pbl_add_raceuser_oid").post(function(req, res, next) {
  5403. let users = req.body[0];
  5404. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5405. for (let i = 0; i < arr.length; i++) {
  5406. let _username = encodeURIComponent(arr[i].name)
  5407. let _mail = encodeURIComponent(arr[i].mail)
  5408. let _password = users.password || "123456";
  5409. let _oid = encodeURIComponent(arr[i].school)
  5410. //加密密碼
  5411. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5412. //生成激活碼
  5413. let _hashstr = new Date().getTime() + "";
  5414. let _digest = crypto
  5415. .createHash("sha256")
  5416. .update(_hashstr, "utf8")
  5417. .digest("hex");
  5418. //用戶數據
  5419. let _userdata = [
  5420. _mail,
  5421. _oid,
  5422. _password,
  5423. _username,
  5424. 1, //1普通教师 2市级 3省级 4市级子级评委 5县区评委 6县区子级
  5425. ];
  5426. //參數拼接,註冊
  5427. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "pbl_add_raceuser_oid");
  5428. //用戶註冊處理
  5429. mysql.usselect(_userdata, function(ret) {
  5430. res.end(JSON.stringify({ success: 1 }));
  5431. });
  5432. }
  5433. });
  5434. //新增学生
  5435. router.route("/batchRegistration").post(function(req, res, next) {
  5436. var users = req.body[0];
  5437. //循环注册
  5438. var _username = users.alias;
  5439. var _mail = users.username;
  5440. var _password = users.password || "123456";
  5441. var _alias = users.alias;
  5442. var _oid = users.oid;
  5443. var _ph = users.ph;
  5444. var _class = users.cid;
  5445. var _sId = users.sid;
  5446. //加密密碼
  5447. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5448. //生成激活碼
  5449. let _hashstr = new Date().getTime() + "";
  5450. let _digest = crypto
  5451. .createHash("sha256")
  5452. .update(_hashstr, "utf8")
  5453. .digest("hex");
  5454. //用戶數據
  5455. var _userdata = [
  5456. _mail,
  5457. _password,
  5458. _alias,
  5459. "",
  5460. 1,
  5461. _username,
  5462. "",
  5463. generateAPIKey(_username),
  5464. _digest,
  5465. "",
  5466. _username,
  5467. _sId,
  5468. 2,
  5469. _oid,
  5470. _ph,
  5471. _class,
  5472. "",
  5473. "0",
  5474. ];
  5475. //參數拼接,註冊
  5476. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
  5477. //用戶註冊處理
  5478. mysql.usselect(_userdata, function(ret) {
  5479. res.end(
  5480. JSON.stringify({
  5481. uid: ret[1][0].uid,
  5482. ph: _ph,
  5483. oid: _oid,
  5484. cid: _class,
  5485. success: 1,
  5486. })
  5487. );
  5488. });
  5489. });
  5490. //深圳电教馆注册
  5491. router.route("/batchRegistrationSzdjg").post(function(req, res, next) {
  5492. var users = Object.values(req.body)[0].split(",");
  5493. //循环注册
  5494. var _username = users[0]; //名字
  5495. var _mail = users[1]; //用户名 账号
  5496. var _password = "123456";
  5497. var _alias = _username;
  5498. var _org = users[2];
  5499. var _oid = users[3];
  5500. var _ph = users[4];
  5501. var _class = users[5];
  5502. var _type = users[6];
  5503. var _openid = users[7];
  5504. //加密密碼
  5505. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5506. //生成激活碼
  5507. let _hashstr = new Date().getTime() + "";
  5508. let _digest = crypto
  5509. .createHash("sha256")
  5510. .update(_hashstr, "utf8")
  5511. .digest("hex");
  5512. //用戶數據
  5513. var _userdata = [
  5514. _mail,
  5515. _password,
  5516. _alias,
  5517. "",
  5518. 0,
  5519. _username,
  5520. _openid,
  5521. generateAPIKey(_username),
  5522. _digest,
  5523. "",
  5524. _username,
  5525. '',
  5526. _type,
  5527. _org,
  5528. _oid,
  5529. _ph,
  5530. _class,
  5531. "",
  5532. "0",
  5533. ];
  5534. //參數拼接,註冊
  5535. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregisterSzdjg");
  5536. //用戶註冊處理
  5537. mysql.usselect(_userdata, function(ret) {
  5538. res.end(
  5539. JSON.stringify({
  5540. uid: ret[1][0].uid,
  5541. ph: _ph,
  5542. oid: _oid,
  5543. cid: _class,
  5544. success: 1,
  5545. })
  5546. );
  5547. });
  5548. });
  5549. //新增教师
  5550. router.route("/batchRegistration1").post(function(req, res, next) {
  5551. var users = req.body[0];
  5552. //循环注册
  5553. var _username = users.alias;
  5554. var _mail = users.username;
  5555. var _password = users.password || "123456";
  5556. var _alias = users.alias;
  5557. var _org = users.org;
  5558. var _oid = users.oid;
  5559. var _ph = users.ph;
  5560. var _class = users.cid;
  5561. var _sId = users.sid;
  5562. //加密密碼
  5563. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5564. //生成激活碼
  5565. let _hashstr = new Date().getTime() + "";
  5566. let _digest = crypto
  5567. .createHash("sha256")
  5568. .update(_hashstr, "utf8")
  5569. .digest("hex");
  5570. //用戶數據
  5571. var _userdata = [
  5572. _mail,
  5573. _password,
  5574. _alias,
  5575. "",
  5576. 0,
  5577. _username,
  5578. "",
  5579. generateAPIKey(_username),
  5580. _digest,
  5581. "",
  5582. _username,
  5583. _sId,
  5584. 1,
  5585. _org,
  5586. _oid,
  5587. _ph,
  5588. _class,
  5589. "",
  5590. "0",
  5591. ];
  5592. //參數拼接,註冊
  5593. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister1");
  5594. //用戶註冊處理
  5595. mysql.usselect(_userdata, function(ret) {
  5596. res.end(
  5597. JSON.stringify({
  5598. uid: ret[1][0].uid,
  5599. ph: _ph,
  5600. oid: _oid,
  5601. cid: _class,
  5602. success: 1,
  5603. })
  5604. );
  5605. });
  5606. });
  5607. router.route("/batchRegistrationOrg").post(function(req, res, next) {
  5608. var users = req.body[0];
  5609. //循环注册
  5610. var _username = users.alias;
  5611. var _mail = users.username;
  5612. var _password = users.password || "123456";
  5613. var _alias = users.alias;
  5614. var _oid = users.oid;
  5615. var _ph = users.ph;
  5616. var _class = users.cid;
  5617. var _sId = users.sid;
  5618. var _org = users.org;
  5619. //加密密碼
  5620. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5621. //生成激活碼
  5622. let _hashstr = new Date().getTime() + "";
  5623. let _digest = crypto
  5624. .createHash("sha256")
  5625. .update(_hashstr, "utf8")
  5626. .digest("hex");
  5627. //用戶數據
  5628. var _userdata = [
  5629. _mail,
  5630. _password,
  5631. _alias,
  5632. "",
  5633. 1,
  5634. _username,
  5635. "",
  5636. generateAPIKey(_username),
  5637. _digest,
  5638. "",
  5639. _username,
  5640. _sId,
  5641. 2,
  5642. _oid,
  5643. _ph,
  5644. _class,
  5645. "",
  5646. "0",
  5647. _org,
  5648. ];
  5649. //參數拼接,註冊
  5650. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister_org");
  5651. //用戶註冊處理
  5652. mysql.usselect(_userdata, function(ret) {
  5653. res.end(
  5654. JSON.stringify({
  5655. uid: ret[1][0].uid,
  5656. ph: _ph,
  5657. oid: _oid,
  5658. cid: _class,
  5659. success: 1,
  5660. })
  5661. );
  5662. });
  5663. });
  5664. router.route("/batchRegistrationMoreOrg").post(function(req, res, next) {
  5665. let users = req.body[0];
  5666. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5667. for (let i = 0; i < arr.length; i++) {
  5668. let _username = encodeURIComponent(arr[i].name)
  5669. let _mail = encodeURIComponent(arr[i].mail)
  5670. let _password = users.password || "123456";
  5671. let _alias = encodeURIComponent(arr[i].name)
  5672. let _oid = users.oid;
  5673. let _ph = encodeURIComponent(arr[i].phone ? arr[i].phone : "")
  5674. let _class = encodeURIComponent(arr[i].class)
  5675. let _sId = encodeURIComponent(arr[i].sId)
  5676. let _org = users.org;
  5677. //加密密碼
  5678. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5679. //生成激活碼
  5680. let _hashstr = new Date().getTime() + "";
  5681. let _digest = crypto
  5682. .createHash("sha256")
  5683. .update(_hashstr, "utf8")
  5684. .digest("hex");
  5685. //用戶數據
  5686. let _userdata = [
  5687. _mail,
  5688. _password,
  5689. _alias,
  5690. "",
  5691. 1, //0老师 1学生
  5692. _username,
  5693. "",
  5694. generateAPIKey(_username),
  5695. _digest,
  5696. "",
  5697. _username,
  5698. _sId,
  5699. 2, //1老师 2学生
  5700. _oid,
  5701. _ph,
  5702. _class,
  5703. "",
  5704. "0",
  5705. _org,
  5706. ];
  5707. //參數拼接,註冊
  5708. _userdata.unshift(
  5709. _mysqluser[0],
  5710. _mysqluser[1],
  5711. "pbl_add_batchregister_org2"
  5712. );
  5713. //用戶註冊處理
  5714. mysql.usselect(_userdata, function(ret) {
  5715. res.end(JSON.stringify({ success: 1 }));
  5716. });
  5717. }
  5718. });
  5719. //工作室管理
  5720. router.route("/updateStudioWorkNew4").all((req, res, next) => {
  5721. //学生
  5722. if (req.body[0]) {
  5723. let p = [req.body[0].cid];
  5724. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_studio_course_detail2"); //執行存儲過程
  5725. mysql.usselect(p, function(ret) {
  5726. let _unitIndex = parseInt(req.body[0].unitIndex);
  5727. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  5728. let _unitJson = JSON.parse(ret[0][0].chapters);
  5729. if (_unitJson.length - 1 < _unitIndex) {
  5730. let _i = _unitIndex - (_unitJson.length - 1);
  5731. for (let i = 0; i < _i; i++) {
  5732. _unitJson.push({
  5733. dyName: "", //单元标题
  5734. chapterInfo: [{
  5735. isread: false,
  5736. chapterid: guid(),
  5737. title: "",
  5738. courseName: "",
  5739. taskJson: [{
  5740. task: "",
  5741. taskDetail: "",
  5742. chapterData: [],
  5743. toolText: "",
  5744. toolChoose: [{
  5745. tool: [],
  5746. toolDetail: "",
  5747. toolType: 0,
  5748. askCount: 1,
  5749. askTitle: "",
  5750. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  5751. }, ],
  5752. isShowTools: false,
  5753. askCount: 1,
  5754. isFold: 0,
  5755. askTitle: "",
  5756. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  5757. checkJson: [{ checkCount: [], checkPerent: [] }],
  5758. homeworkList: [],
  5759. }, ],
  5760. itemCount: 1,
  5761. fileList1: [],
  5762. video: [],
  5763. testData: [],
  5764. pData: [],
  5765. templateArray: [],
  5766. }, ],
  5767. });
  5768. }
  5769. _unitJson[_unitIndex] = _chapters[_unitIndex];
  5770. } else {
  5771. _unitJson[_unitIndex] = _chapters[_unitIndex];
  5772. }
  5773. // console.log(_unitJson);
  5774. let p2 = [
  5775. req.body[0].cid,
  5776. encodeURIComponent(JSON.stringify(_unitJson)),
  5777. ];
  5778. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudioWorkNew4"); //執行存儲過程
  5779. mysql.usselect(p2, function(ret) {
  5780. res.end(JSON.stringify({ success: 1 }));
  5781. });
  5782. // res.end(JSON.stringify({ success: 1 }));
  5783. });
  5784. }
  5785. });
  5786. router.route("/updateStudioWorkNew2").all((req, res, next) => {
  5787. //学生
  5788. if (req.body[0]) {
  5789. p = [
  5790. req.body[0].cid,
  5791. req.body[0].title,
  5792. req.body[0].brief,
  5793. req.body[0].cover,
  5794. req.body[0].evaId,
  5795. req.body[0].astudent,
  5796. req.body[0].see,
  5797. req.body[0].chapters,
  5798. req.body[0].template,
  5799. req.body[0].ateacher,
  5800. ];
  5801. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudioWorkNew2"); //執行存儲過程
  5802. mysql.usselect(p, function(ret) {
  5803. let course = req.body[0].courseType;
  5804. let courseId = req.body[0].cid;
  5805. let userid = req.body[0].uid;
  5806. delStudioCourseTypeS(course, courseId, userid);
  5807. res.end(JSON.stringify({ success: 1 }));
  5808. });
  5809. }
  5810. });
  5811. router.route("/addStudioCourseWorkNew2").all((req, res, next) => {
  5812. //学生
  5813. if (req.body[0]) {
  5814. p = [
  5815. req.body[0].uid,
  5816. req.body[0].title,
  5817. req.body[0].brief,
  5818. req.body[0].cover,
  5819. req.body[0].evaId,
  5820. req.body[0].astudent,
  5821. req.body[0].see,
  5822. req.body[0].chapters,
  5823. req.body[0].template,
  5824. req.body[0].ateacher,
  5825. ];
  5826. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addStudioCourseWorkNew2"); //執行存儲過程
  5827. mysql.usselect(p, function(ret) {
  5828. let course = req.body[0].courseType;
  5829. let courseId = ret[0][0].courseId;
  5830. let userid = req.body[0].uid;
  5831. delStudioCourseTypeS(course, courseId, userid);
  5832. res.end(
  5833. JSON.stringify({
  5834. ordernumber: ret[0][0].ordernumber,
  5835. courseId: ret[0][0].courseId,
  5836. success: 1,
  5837. })
  5838. );
  5839. });
  5840. }
  5841. });
  5842. //teacher 查询项目模板
  5843. router.route("/getStudioTemplateTs").all((req, res, next) => {
  5844. var json = queryString(req.url);
  5845. getmysql(req, res, "getStudioTemplateTs", json["oid"]);
  5846. });
  5847. //查看课程
  5848. router.route("/select_studio_course_detail").all((req, res, next) => {
  5849. //学生
  5850. var json = queryString(req.url);
  5851. getmysql(req, res, "select_studio_course_detail", json["cid"]);
  5852. });
  5853. //查看课程
  5854. router.route("/select_studio_course_detail2").all((req, res, next) => {
  5855. //学生
  5856. var json = queryString(req.url);
  5857. getmysql(req, res, "select_studio_course_detail2", json["cid"]);
  5858. });
  5859. //协同恢复删除的阶段
  5860. router.route("/restoreStudioWork").all((req, res, next) => {
  5861. //学生
  5862. if (req.body[0]) {
  5863. let p = [req.body[0].cid];
  5864. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_studio_course_detail2"); //執行存儲過程
  5865. mysql.usselect(p, function(ret) {
  5866. let _chapid = req.body[0].chapid;
  5867. // console.log(_chapid);
  5868. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  5869. let _unitJson = JSON.parse(ret[0][0].chapters);
  5870. let _unitJson2 = [];
  5871. let chpaindex;
  5872. for (var i = 0; i < _chapters.length; i++) {
  5873. if (_chapters[i].chapterInfo[0].chapterid == _chapid) {
  5874. chpaindex = i;
  5875. }
  5876. }
  5877. for (var i = 0; i < _unitJson.length; i++) {
  5878. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  5879. // console.log(1);
  5880. // _unitJson.splice(i, -1)
  5881. _unitJson2.push(_unitJson[i]);
  5882. // break;
  5883. }
  5884. }
  5885. _unitJson2.splice(chpaindex, 0, _chapters[chpaindex]);
  5886. // console.log(_unitJson2);
  5887. let p2 = [
  5888. req.body[0].cid,
  5889. JSON.stringify(_unitJson2).replaceAll(/%/g, "%25"),
  5890. ];
  5891. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudioWorkNew4"); //執行存儲過程
  5892. mysql.usselect(p2, function(ret) {
  5893. res.end(JSON.stringify({ success: 1 }));
  5894. });
  5895. // res.end(JSON.stringify({ success: 1 }));
  5896. });
  5897. }
  5898. });
  5899. //查询分类及所有子分类
  5900. router.route("/selectAllTypeStudio").all((req, res, next) => {
  5901. var json = queryString(req.url);
  5902. getmysql(req, res, "selectAllTypeStudio", json["org"], json["oid"]);
  5903. });
  5904. //上传文件
  5905. router.route("/addStudioCourseWorksS").all((req, res, next) => {
  5906. postmysql(req, res, "addStudioCourseWorksS");
  5907. });
  5908. //删除提交的作业
  5909. router.route("/deleteStudioCourseWorkS").all((req, res, next) => {
  5910. postmysql(req, res, "deleteStudioCourseWorkS");
  5911. });
  5912. //创建新话题
  5913. router.route("/addSubTalk").all((req, res, next) => {
  5914. postmysql(req, res, "addSubTalk");
  5915. });
  5916. //创建新子分类
  5917. router.route("/addEngVType").all((req, res, next) => {
  5918. postmysql(req, res, "addEngVType");
  5919. });
  5920. router.route("/selectStudioCourseNew222").all((req, res, next) => {
  5921. var json = queryString(req.url);
  5922. getmysql(
  5923. req,
  5924. res,
  5925. "selectStudioCourseNew222",
  5926. json["type"],
  5927. json["uid"],
  5928. json["oid"],
  5929. json["org"],
  5930. json["typea"],
  5931. json["typeb"],
  5932. json["typec"],
  5933. json["typed"],
  5934. json["typef"],
  5935. json["typeE"],
  5936. json["cu"],
  5937. json["cn"],
  5938. json["page"],
  5939. json["pageSize"]
  5940. );
  5941. });
  5942. //删除1课程
  5943. router.route("/deleteStudioCourse").all((req, res, next) => {
  5944. var json = queryString(req.url);
  5945. getmysql2(req, res, "deleteStudioCourse", json["cid"]);
  5946. });
  5947. //添加分享课程数据
  5948. router.route("/addShareCourse").post((req, res, next) => {
  5949. var json = queryString(req.url);
  5950. postmysql(req, res, "addShareCourse");
  5951. });
  5952. //获取分享课程数据
  5953. router.route("/getShareCourse").all((req, res, next) => {
  5954. var json = queryString(req.url);
  5955. getmysql(req, res, "getShareCourse", json["cid"],json["type"]);
  5956. });
  5957. router.route("/delShareCourse").all((req, res, next) => {
  5958. var json = queryString(req.url);
  5959. postmysql(req, res, "delShareCourse");
  5960. });
  5961. function delStudioCourseTypeS(course, courseId, userid) {
  5962. let _courseId = courseId;
  5963. var _userdata = [_courseId];
  5964. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_studioCourseTypeS");
  5965. mysql.usselect(_userdata, function(ret) {
  5966. // console.log(ret);
  5967. addStudioCourseTypeS(userid, course, _courseId);
  5968. });
  5969. // setTimeout(() => {
  5970. // }, 1000);
  5971. }
  5972. function addStudioCourseTypeS(userid, course, _courseId) {
  5973. var _uid = userid;
  5974. var _courses = _courseId;
  5975. var _tid = JSON.parse(decodeURIComponent(course));
  5976. for (let i = 0; i < _tid.length; i++) {
  5977. if (_tid[i] == "") {
  5978. continue;
  5979. }
  5980. var _userdata = [_courses, _tid[i], _uid];
  5981. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_studioCourseTypeS");
  5982. mysql.usselect(_userdata, function(ret) {
  5983. // console.log(ret);
  5984. });
  5985. }
  5986. }
  5987. //删除作业阶段任务工具
  5988. router.route("/deleteStudioToolSTT").all((req, res, next) => {
  5989. postmysql(req, res, "deleteStudioToolSTT");
  5990. });
  5991. //删除作业阶段任务
  5992. router.route("/deleteStudioToolST").all((req, res, next) => {
  5993. postmysql(req, res, "deleteStudioToolST");
  5994. });
  5995. //删除作业阶段
  5996. router.route("/deleteStudioToolS").all((req, res, next) => {
  5997. postmysql(req, res, "deleteStudioToolST");
  5998. });
  5999. //工作管理首页查询分类
  6000. router.route("/selectStudioCourseNew22Mode").all((req, res, next) => {
  6001. var json = queryString(req.url);
  6002. getmysql(
  6003. req,
  6004. res,
  6005. "selectStudioCourseNew22Mode",
  6006. json["type"],
  6007. json["uid"],
  6008. json["oid"],
  6009. json["org"],
  6010. json["typea"],
  6011. json["typeb"],
  6012. json["typec"],
  6013. json["typed"],
  6014. json["typef"],
  6015. json["typeE"],
  6016. json["cu"],
  6017. json["cn"]
  6018. );
  6019. });
  6020. //工作管理首页查询
  6021. router.route("/selectStudioCourseNew22").all((req, res, next) => {
  6022. var json = queryString(req.url);
  6023. getmysql(
  6024. req,
  6025. res,
  6026. "selectStudioCourseNew22",
  6027. json["type"],
  6028. json["uid"],
  6029. json["oid"],
  6030. json["org"],
  6031. json["typea"],
  6032. json["typeb"],
  6033. json["typec"],
  6034. json["typed"],
  6035. json["typef"],
  6036. json["typeE"],
  6037. json["cu"],
  6038. json["cn"],
  6039. json["page"],
  6040. json["pageSize"]
  6041. );
  6042. });
  6043. //根据学校查询banner
  6044. router.route("/selectBannerByOidStudio").all((req, res, next) => {
  6045. var json = queryString(req.url);
  6046. getmysql(req, res, "selectBannerByOidStudio", json["oid"]);
  6047. });
  6048. //admin 查询banner
  6049. router.route("/getBannerStudio").all((req, res, next) => {
  6050. var json = queryString(req.url);
  6051. getmysql(req, res, "getBannerStudio");
  6052. });
  6053. //查询工作课程详情
  6054. router.route("/selectStudioCourseDetail2").all((req, res, next) => {
  6055. //学生
  6056. var json = queryString(req.url);
  6057. getmysql(req, res, "selectStudioCourseDetail2", json["courseId"]);
  6058. });
  6059. //查询工作课程详情
  6060. router.route("/selectStudioCourseDetail3").all((req, res, next) => {
  6061. //学生
  6062. var json = queryString(req.url);
  6063. getmysql(req, res, "selectStudioCourseDetail3", json["courseId"]);
  6064. });
  6065. //上传文件
  6066. router.route("/addCourseWorks4studio").all((req, res, next) => {
  6067. postmysql3(req, res, "addCourseWorks4studio");
  6068. });
  6069. //查询教师资源分类
  6070. router.route("/selectAllSourceType").all((req, res, next) => {
  6071. //学生
  6072. var json = queryString(req.url);
  6073. getmysql(req, res, "selectAllSourceType", json["oid"], json["org"]);
  6074. });
  6075. //查询资源分类
  6076. router.route("/selectAllEvaType").all((req, res, next) => {
  6077. var json = queryString(req.url);
  6078. getmysql(req, res, "selectAllEvaType", json["oid"], json["org"]);
  6079. });
  6080. router.route("/addSource").all((req, res, next) => {
  6081. //添加资源
  6082. if (req.body[0]) {
  6083. p = [
  6084. req.body[0].name,
  6085. req.body[0].url,
  6086. req.body[0].detail,
  6087. req.body[0].label,
  6088. req.body[0].userid,
  6089. ];
  6090. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addSource");
  6091. //執行存儲過程
  6092. mysql.usselect(p, function(ret) {
  6093. let course = req.body[0].courseType;
  6094. let courseId = ret[0][0].id;
  6095. let userid = req.body[0].userid;
  6096. delSourceType(course, courseId, userid);
  6097. res.end(JSON.stringify({ id: ret[0][0].id, success: 1 }));
  6098. // res.end(JSON.stringify(ret));
  6099. });
  6100. }
  6101. });
  6102. //删除1资源模板分类
  6103. router.route("/deleteCETLabel").all((req, res, next) => {
  6104. var json = queryString(req.url);
  6105. getmysql2(req, res, "deleteCETLabel", json["cid"]);
  6106. });
  6107. //添加资源模板分类
  6108. router.route("/addCETLabel").all((req, res, next) => {
  6109. postmysql(req, res, "addCETLabel");
  6110. });
  6111. //资源模板分享
  6112. router.route("/addCETShare").all((req, res, next) => {
  6113. // if (req.body[0]) {
  6114. // p = [
  6115. // req.body[0].uid,
  6116. // req.body[0].n,
  6117. // req.body[0].json,
  6118. // req.body[0].t,
  6119. // req.body[0].oid,
  6120. // ];
  6121. // p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addCETShare");
  6122. // //執行存儲過程
  6123. // mysql.usselect(p, function(ret) {
  6124. // res.end(JSON.stringify({ id: ret[0][0].id, success: 1 }));
  6125. // // res.end(JSON.stringify(ret));
  6126. // });
  6127. // }
  6128. postmysql(req, res, "addCETShare");
  6129. });
  6130. router.route("/updateSource").all((req, res, next) => {
  6131. //修改资源
  6132. if (req.body[0]) {
  6133. p = [
  6134. req.body[0].id,
  6135. req.body[0].name,
  6136. req.body[0].url,
  6137. req.body[0].detail,
  6138. req.body[0].label,
  6139. req.body[0].userid,
  6140. ];
  6141. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateSource");
  6142. //執行存儲過程
  6143. mysql.usselect(p, function(ret) {
  6144. let course = req.body[0].courseType;
  6145. let courseId = req.body[0].id;
  6146. let userid = req.body[0].userid;
  6147. delSourceType(course, courseId, userid);
  6148. res.end(JSON.stringify({ id: req.body[0].id, success: 1 }));
  6149. // res.end(JSON.stringify(ret));
  6150. });
  6151. }
  6152. });
  6153. function delSourceType(course, courseId, userid) {
  6154. let _courseId = courseId;
  6155. var _userdata = [_courseId];
  6156. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_sourceType");
  6157. mysql.usselect(_userdata, function(ret) {
  6158. addSourceType(userid, course, _courseId);
  6159. });
  6160. }
  6161. function addSourceType(userid, course, _courseId) {
  6162. var _uid = userid;
  6163. var _courses = _courseId;
  6164. var _tid = JSON.parse(decodeURIComponent(course));
  6165. for (let i = 0; i < _tid.length; i++) {
  6166. if (_tid[i] == "") {
  6167. continue;
  6168. }
  6169. var _userdata = [_courses, _tid[i], _uid];
  6170. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_sourceType");
  6171. mysql.usselect(_userdata, function(ret) {
  6172. // console.log(ret);
  6173. });
  6174. }
  6175. }
  6176. //资源查询
  6177. router.route("/selectSource").all((req, res, next) => {
  6178. var json = queryString(req.url);
  6179. getmysql(
  6180. req,
  6181. res,
  6182. "selectSource",
  6183. json["uid"],
  6184. json["oid"],
  6185. json["org"],
  6186. json["typea"],
  6187. json["typeb"],
  6188. json["typeE"],
  6189. json["cn"],
  6190. json["page"],
  6191. json["pageSize"]
  6192. );
  6193. });
  6194. //评价资源查询
  6195. router.route("/selectCourseEvaT").all((req, res, next) => {
  6196. var json = queryString(req.url);
  6197. getmysql(
  6198. req,
  6199. res,
  6200. "selectCourseEvaT",
  6201. json["uid"],
  6202. json["oid"],
  6203. json["org"],
  6204. json["typea"],
  6205. json["typeb"],
  6206. json["typeE"],
  6207. json["cn"],
  6208. json["type"],
  6209. json["page"],
  6210. json["pageSize"]
  6211. );
  6212. });
  6213. //评价资源重命名 修1
  6214. router.route("/updateCourseET").all((req, res, next) => {
  6215. var json = queryString(req.url);
  6216. getmysql(
  6217. req,
  6218. res,
  6219. "updateCourseET",
  6220. json["id"],
  6221. json["n"],
  6222. );
  6223. });
  6224. //删除1评价资源
  6225. router.route("/deleteCourseET").all((req, res, next) => {
  6226. var json = queryString(req.url);
  6227. getmysql2(
  6228. req,
  6229. res,
  6230. "deleteCourseET",
  6231. json["id"],
  6232. );
  6233. });
  6234. //添加评价资源分类 修1
  6235. router.route("/addCETType").all((req, res, next) => {
  6236. var json = queryString(req.url);
  6237. getmysql(
  6238. req,
  6239. res,
  6240. "addCETType",
  6241. json["pid"],
  6242. json["ppid"],
  6243. json["n"],
  6244. json["uid"],
  6245. json["oid"],
  6246. );
  6247. });
  6248. //数据看板-综合数据
  6249. router.route("/selectDataBoardSchool").all((req, res, next) => {
  6250. postmysql(req, res, "selectDataBoardSchool");
  6251. });
  6252. //数据看板-教师数据
  6253. router.route("/selectDataBoardTeacher").all((req, res, next) => {
  6254. postmysql(req, res, "selectDataBoardTeacher");
  6255. });
  6256. //数据看板-学生数据
  6257. router.route("/selectDataBoardStudent").all((req, res, next) => {
  6258. postmysql(req, res, "selectDataBoardStudent");
  6259. });
  6260. //数据看板-课程数据
  6261. router.route("/selectDataBoardCourse").all((req, res, next) => {
  6262. postmysql(req, res, "selectDataBoardCourse");
  6263. });
  6264. //数据看板-综合数据
  6265. router.route("/selectDataBoardSchoolNew").all((req, res, next) => {
  6266. postmysql(req, res, "selectDataBoardSchoolNew");
  6267. });
  6268. //数据看板-教师数据
  6269. router.route("/selectDataBoardTeacherNew").all((req, res, next) => {
  6270. postmysql(req, res, "selectDataBoardTeacherNew");
  6271. });
  6272. //数据看板-学生数据
  6273. router.route("/selectDataBoardStudentNew").all((req, res, next) => {
  6274. postmysql(req, res, "selectDataBoardStudentNew");
  6275. });
  6276. //数据看板-课程数据
  6277. router.route("/selectDataBoardCourseNew").all((req, res, next) => {
  6278. postmysql(req, res, "selectDataBoardCourseNew");
  6279. });
  6280. //数据看板-课程数据
  6281. router.route("/selectDataBoardStudentCourseNew").all((req, res, next) => {
  6282. postmysql(req, res, "selectDataBoardStudentCourseNew");
  6283. });
  6284. //数据看板-学生排行榜
  6285. router.route("/selectDataboardStudentRank").all((req, res, next) => {
  6286. postmysql(req, res, "selectDataboardStudentRank");
  6287. });
  6288. //数据看板-教师排行榜
  6289. router.route("/selectDataboardTeacherRank").all((req, res, next) => {
  6290. postmysql(req, res, "selectDataboardTeacherRank");
  6291. });
  6292. //数据看板-评测
  6293. router.route("/selectDataBoardTest").all((req, res, next) => {
  6294. postmysql(req, res, "selectDataBoardTest");
  6295. });
  6296. //数据看板-市级数据
  6297. router.route("/selectDataBoardCitySz").all((req, res, next) => {
  6298. postmysql(req, res, "selectDataBoardCitySz");
  6299. });
  6300. //数据看板-区级数据
  6301. router.route("/selectDataBoardAreaSz").all((req, res, next) => {
  6302. postmysql(req, res, "selectDataBoardAreaSz");
  6303. });
  6304. //数据看板-综合数据
  6305. router.route("/getDataBoardSchoolNew").all((req, res, next) => {
  6306. let p = Object.values(req.body[0]);
  6307. let d = Object.values(req.body[0]);
  6308. console.log(p)
  6309. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6310. mysql.usselect(p, function(ret) {
  6311. if(!ret[0].length){
  6312. let p2 = [d[0], d[1]];
  6313. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardSchoolNew');
  6314. mysql.usselect(p2, function(ret) {
  6315. res.end(JSON.stringify(ret));
  6316. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'1'];
  6317. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6318. mysql.usselect(p3, function(ret) {})
  6319. });
  6320. }else{
  6321. console.log(1);
  6322. res.end(ret[0][0].json);
  6323. }
  6324. // res.end(JSON.stringify(ret));
  6325. });
  6326. });
  6327. //数据看板-课程数据
  6328. router.route("/getDataBoardCourseNew").all((req, res, next) => {
  6329. let p = Object.values(req.body[0]);
  6330. let d = Object.values(req.body[0]);
  6331. console.log(p)
  6332. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6333. mysql.usselect(p, function(ret) {
  6334. if(!ret[0].length){
  6335. let p2 = [d[0], d[1]];
  6336. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardCourseNew');
  6337. mysql.usselect(p2, function(ret) {
  6338. res.end(JSON.stringify(ret));
  6339. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'2'];
  6340. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6341. mysql.usselect(p3, function(ret) {})
  6342. });
  6343. }else{
  6344. console.log(1);
  6345. res.end(ret[0][0].json);
  6346. }
  6347. // res.end(JSON.stringify(ret));
  6348. });
  6349. });
  6350. //数据看板-项目数据
  6351. router.route("/getDataBoardStudentCourseNew").all((req, res, next) => {
  6352. let p = Object.values(req.body[0]);
  6353. let d = Object.values(req.body[0]);
  6354. console.log(p)
  6355. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6356. mysql.usselect(p, function(ret) {
  6357. if(!ret[0].length){
  6358. let p2 = [d[0], d[1]];
  6359. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardStudentCourseNew');
  6360. mysql.usselect(p2, function(ret) {
  6361. res.end(JSON.stringify(ret));
  6362. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'3'];
  6363. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6364. mysql.usselect(p3, function(ret) {})
  6365. });
  6366. }else{
  6367. console.log(1);
  6368. res.end(ret[0][0].json);
  6369. }
  6370. // res.end(JSON.stringify(ret));
  6371. });
  6372. });
  6373. //数据看板-学生数据
  6374. router.route("/getDataBoardStudentNew").all((req, res, next) => {
  6375. let p = Object.values(req.body[0]);
  6376. let d = Object.values(req.body[0]);
  6377. console.log(p)
  6378. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6379. mysql.usselect(p, function(ret) {
  6380. if(!ret[0].length){
  6381. let p2 = [d[0], d[1]];
  6382. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardStudentNew');
  6383. mysql.usselect(p2, function(ret) {
  6384. res.end(JSON.stringify(ret));
  6385. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'5'];
  6386. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6387. mysql.usselect(p3, function(ret) {})
  6388. });
  6389. }else{
  6390. console.log(1);
  6391. res.end(ret[0][0].json);
  6392. }
  6393. // res.end(JSON.stringify(ret));
  6394. });
  6395. });
  6396. //数据看板-教师数据
  6397. router.route("/getDataBoardTeacherNew").all((req, res, next) => {
  6398. let p = Object.values(req.body[0]);
  6399. let d = Object.values(req.body[0]);
  6400. console.log(p)
  6401. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6402. mysql.usselect(p, function(ret) {
  6403. if(!ret[0].length){
  6404. let p2 = [d[0], d[1]];
  6405. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardTeacherNew');
  6406. mysql.usselect(p2, function(ret) {
  6407. res.end(JSON.stringify(ret));
  6408. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'4'];
  6409. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6410. mysql.usselect(p3, function(ret) {})
  6411. });
  6412. }else{
  6413. console.log(1);
  6414. res.end(ret[0][0].json);
  6415. }
  6416. // res.end(JSON.stringify(ret));
  6417. });
  6418. });
  6419. //数据看板-查询项目数据长度
  6420. router.route("/getCourseLength").all((req, res, next) => {
  6421. postmysql(req, res, "getCourseLength");
  6422. });
  6423. //评测中心-上传评测
  6424. router.route("/addTestWorks").all((req, res, next) => {
  6425. postmysql(req, res, "addTestWorks");
  6426. });
  6427. //评测中心-上传评测
  6428. router.route("/addTestWorks2").all((req, res, next) => {
  6429. postmysql(req, res, "addTestWorks2");
  6430. });
  6431. //评测中心-删除评测
  6432. router.route("/deleteTestCourse").all((req, res, next) => {
  6433. postmysql(req, res, "deleteTestCourse");
  6434. });
  6435. //评测中心-批改
  6436. router.route("/addTestWorksTeacher").all((req, res, next) => {
  6437. postmysql(req, res, "addTestWorksTeacher");
  6438. });
  6439. //评测中心-复制评测
  6440. router.route("/copyTestWorks").all((req, res, next) => {
  6441. postmysql(req, res, "copyTestWorks");
  6442. });
  6443. //评测中心-查询用户测评总览
  6444. router.route("/selectTestUserY").all((req, res, next) => {
  6445. var json = queryString(req.url);
  6446. getmysql(req, res, "selectTestUserY", json["uid"], json["oid"], json["org"]);
  6447. });
  6448. //查询用户学习记录总览
  6449. router.route("/selectSRecordY").all((req, res, next) => {
  6450. var json = queryString(req.url);
  6451. getmysql(req, res, "selectSRecordY", json["uid"], json["oid"], json["org"]);
  6452. });
  6453. //查询幼儿园全部及学校分类
  6454. router.route("/selectSEAllType").all((req, res, next) => {
  6455. var json = queryString(req.url);
  6456. getmysql(req, res, "selectSEAllType", json["oid"]);
  6457. });
  6458. //根据学期查询幼儿园个人评分
  6459. router.route("/selectSETable").all((req, res, next) => {
  6460. var json = queryString(req.url);
  6461. getmysql(req, res, "selectSETable", json["uid"], json["oid"], json["org"], json["cu"]);
  6462. });
  6463. //根据学期保存幼儿园个人评分 修1
  6464. router.route("/addSRScore").all((req, res, next) => {
  6465. var json = queryString(req.url);
  6466. getmysql(req, res, "addSRScore", json["uid"], json["j"], json["t"]);
  6467. });
  6468. //评测中心-数据 修1 这个不确定所以先加上了
  6469. router.route("/testDataBoard").all((req, res, next) => {
  6470. var json = queryString(req.url);
  6471. getmysql(req, res, "testDataBoard", json["oid"], json["org"]);
  6472. });
  6473. //评测中心-查询用户数据
  6474. router.route("/selectTestUser").all((req, res, next) => {
  6475. var json = queryString(req.url);
  6476. getmysql(req, res, "selectTestUser", json["uid"]);
  6477. });
  6478. //评测中心-获取评测提交详情
  6479. router.route("/getTestWorks").all((req, res, next) => {
  6480. var json = queryString(req.url);
  6481. getmysql(req, res, "getTestWorks", json["cid"], json["uid"]);
  6482. });
  6483. //评测中心-获取评测提交详情
  6484. router.route("/getTestWorks2").all((req, res, next) => {
  6485. var json = queryString(req.url);
  6486. getmysql(req, res, "getTestWorks2", json["cid"], json["tid"]);
  6487. });
  6488. //评测中心-获取评测提交详情
  6489. router.route("/selectTestCourseWorks").all((req, res, next) => {
  6490. var json = queryString(req.url);
  6491. getmysql(req, res, "selectTestCourseWorks", json["cid"], json["tid"]);
  6492. });
  6493. //评测中心-获取评测提交详情
  6494. router.route("/getTestWorksPage").all((req, res, next) => {
  6495. var json = queryString(req.url);
  6496. getmysql(req, res, "getTestWorksPage", json["cid"], json["page"], json["pageSize"]);
  6497. });
  6498. //评测中心-获取评测提交详情
  6499. router.route("/getTestWorksPage3").all((req, res, next) => {
  6500. var json = queryString(req.url);
  6501. getmysql(req, res, "getTestWorksPage3", json["cid"], json["cn"], json["page"], json["pageSize"]);
  6502. });
  6503. //评测中心-获取评测提交详情
  6504. router.route("/getTestWorksNoPage").all((req, res, next) => {
  6505. var json = queryString(req.url);
  6506. getmysql(req, res, "getTestWorksNoPage", json["cid"], json["cn"]);
  6507. });
  6508. //评测中心-获取评测提交详情
  6509. router.route("/getTestWorksPage2").all((req, res, next) => {
  6510. var json = queryString(req.url);
  6511. getmysql(req, res, "getTestWorksPage2", json["cid"], json["page"], json["pageSize"]);
  6512. });
  6513. //评测中心-个人中心
  6514. router.route("/getTestWorksPerson").all((req, res, next) => {
  6515. var json = queryString(req.url);
  6516. getmysql(req, res, "getTestWorksPerson", json["uid"], json["typeid"]);
  6517. });
  6518. //查询英语写作评价模板
  6519. router.route("/selectEnglishEva").all((req, res, next) => {
  6520. var json = queryString(req.url);
  6521. getmysql(req, res, "selectEnglishEva", json["oid"]);
  6522. });
  6523. //新增英语写作评价模板
  6524. router.route("/insertEnglishEva").all((req, res, next) => {
  6525. postmysql(req, res, "insertEnglishEva");
  6526. });
  6527. //获取作业数量
  6528. router.route("/getStudentCourseWorkCount").all((req, res, next) => {
  6529. postmysql(req, res, "getStudentCourseWorkCount");
  6530. });
  6531. //获取作业数量
  6532. router.route("/getCourseWorkCount").all((req, res, next) => {
  6533. postmysql(req, res, "getCourseWorkCount");
  6534. });
  6535. //根据id查询英语写作评价模板
  6536. router.route("/selectEnglishEvaById").all((req, res, next) => {
  6537. var json = queryString(req.url);
  6538. getmysql(req, res, "selectEnglishEvaById", json["id"], json["oid"]);
  6539. });
  6540. //根据id删除1英语写作评价模板
  6541. router.route("/deleteEnglishEvaById").all((req, res, next) => {
  6542. var json = queryString(req.url);
  6543. getmysql2(req, res, "deleteEnglishEvaById", json["id"]);
  6544. });
  6545. //获取评价模板
  6546. router.route("/getCourseEvaTemplate").all((req, res, next) => {
  6547. var json = queryString(req.url);
  6548. getmysql(req, res, "getCourseEvaTemplate", json["oid"], json["org"], json["n"]);
  6549. });
  6550. //案例新项目登录接口
  6551. router.route("/loginNewEvenManage").all((req, res, next) => {
  6552. postmysql(req, res, "loginNewEvenManage");
  6553. });
  6554. //案例新项目创建用户接口
  6555. router.route("/addNewRaceUser").all((req, res, next) => {
  6556. postmysql(req, res, "addNewRaceUser");
  6557. });
  6558. //查询老师的信息
  6559. router.route("/getRaceUser1").all((req, res, next) => {
  6560. var json = queryString(req.url);
  6561. getmysql(req, res, "getRaceUser1", json["uid"]);
  6562. });
  6563. //修改用户信息
  6564. router.route("/updateRaceUser1").all((req, res, next) => {
  6565. postmysql(req, res, "updateRaceUser1");
  6566. });
  6567. /* 修改评审员 修1 */
  6568. router.route("/updateReviewer").all((req, res, next) => {
  6569. var json = queryString(req.url);
  6570. getmysql(
  6571. req,
  6572. res,
  6573. "updateReviewer",
  6574. json["n"],
  6575. json["p"],
  6576. json["t"],
  6577. json["s"],
  6578. json["uid"]
  6579. );
  6580. });
  6581. //race 查询学校
  6582. router.route("/getSchool1").all((req, res, next) => {
  6583. var json = queryString(req.url);
  6584. getmysql(req, res, "getSchool1", json["n"]);
  6585. });
  6586. //查询赛事项目列表
  6587. router.route("/selectRaceList1").all((req, res, next) => {
  6588. var json = queryString(req.url);
  6589. getmysql(req, res, "selectRaceList1", json["uid"], json["t"], json["oid"], json["org"]);
  6590. });
  6591. //修改赛事状态 修1
  6592. router.route("/updateRaceStateGM").all((req, res, next) => {
  6593. var json = queryString(req.url);
  6594. getmysql(req, res, "updateRaceStateGM", json["id"], json["s"]);
  6595. });
  6596. //删除1案例
  6597. router.route("/deleteAnliGM").all((req, res, next) => {
  6598. var json = queryString(req.url);
  6599. getmysql2(req, res, "deleteAnliGM", json["id"]);
  6600. });
  6601. //新增赛事项目
  6602. router.route("/addRaceGM").all((req, res, next) => {
  6603. if (req.body[0]) {
  6604. p = [
  6605. req.body[0].uid,
  6606. req.body[0].info,
  6607. req.body[0].over,
  6608. req.body[0].pro,
  6609. req.body[0].act,
  6610. req.body[0].exc,
  6611. req.body[0].res,
  6612. ];
  6613. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addRaceGM"); //執行存儲過程
  6614. mysql.usselect(p, function(ret) {
  6615. let course = req.body[0].courseType;
  6616. let courseId = ret[0][0].id;
  6617. let userid = req.body[0].uid;
  6618. delCourseType1(course, courseId, userid);
  6619. res.end(JSON.stringify({ courseId: courseId, success: 1 }));
  6620. });
  6621. }
  6622. });
  6623. //修改赛事项目
  6624. router.route("/updateRaceGM").all((req, res, next) => {
  6625. if (req.body[0]) {
  6626. p = [
  6627. req.body[0].id,
  6628. req.body[0].info,
  6629. req.body[0].over,
  6630. req.body[0].pro,
  6631. req.body[0].act,
  6632. req.body[0].exc,
  6633. req.body[0].res,
  6634. ];
  6635. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateRaceGM"); //執行存儲過程
  6636. mysql.usselect(p, function(ret) {
  6637. let course = req.body[0].courseType;
  6638. let courseId = req.body[0].id;
  6639. let userid = req.body[0].uid;
  6640. delCourseType1(course, courseId, userid);
  6641. res.end(JSON.stringify({ success: 1 }));
  6642. });
  6643. }
  6644. });
  6645. //查询赛事项目详情
  6646. router.route("/selectRaceDetailGM").all((req, res, next) => {
  6647. var json = queryString(req.url);
  6648. getmysql(req, res, "selectRaceDetailGM", json["id"]);
  6649. });
  6650. //查询赛事分类及子分类
  6651. router.route("/selectMatTypeGM").all((req, res, next) => {
  6652. var json = queryString(req.url);
  6653. getmysql(req, res, "selectMatTypeGM");
  6654. });
  6655. //添加资源库分类
  6656. router.route("/addSourceFileType").all((req, res, next) => {
  6657. postmysql(req, res, "addSourceFileType");
  6658. });
  6659. //查询资源库分类
  6660. router.route("/getSourceFileType").all((req, res, next) => {
  6661. var json = queryString(req.url);
  6662. getmysql(req, res, "getSourceFileType", json["uid"]);
  6663. });
  6664. //删除资源库分类
  6665. router.route("/deleteSoureFileType").all((req, res, next) => {
  6666. postmysql(req, res, "deleteSoureFileType");
  6667. });
  6668. //修改资源库分类名字
  6669. router.route("/updateSourceFileName").all((req, res, next) => {
  6670. postmysql(req, res, "updateSourceFileName");
  6671. });
  6672. //修改资源库分类父级
  6673. router.route("/updateSourceFileTypePid").all((req, res, next) => {
  6674. postmysql(req, res, "updateSourceFileTypePid");
  6675. });
  6676. //添加资源库
  6677. router.route("/addSourceFile").all((req, res, next) => {
  6678. postmysql(req, res, "addSourceFile");
  6679. });
  6680. //查询资源库上传文件
  6681. router.route("/getSourceFile").all((req, res, next) => {
  6682. var json = queryString(req.url);
  6683. getmysql(req, res, "getSourceFile", json["uid"], json["pid"], json["n"]);
  6684. });
  6685. //删除资源库
  6686. router.route("/deleteSourceFile").all((req, res, next) => {
  6687. postmysql(req, res, "deleteSourceFile");
  6688. });
  6689. //移动资源库
  6690. router.route("/updateSourceFilePid").all((req, res, next) => {
  6691. postmysql(req, res, "updateSourceFilePid");
  6692. });
  6693. //查询资源库上传文件
  6694. router.route("/getCourseInfoTest").all((req, res, next) => {
  6695. var json = queryString(req.url);
  6696. getmysql(req, res, "getCourseInfoTest", json["cid"]);
  6697. });
  6698. //查看已经的作业
  6699. router.route("/selectTestWorksCid").all((req, res, next) => {
  6700. var json = queryString(req.url);
  6701. getmysql(req, res, "selectTestWorksCid", json["cid"], json["uid"]);
  6702. });
  6703. //查询资源库上传文件
  6704. router.route("/getCourseInfoTestAll").all((req, res, next) => {
  6705. var json = queryString(req.url);
  6706. getmysql(req, res, "getCourseInfoTestAll", json["cid"]);
  6707. });
  6708. //还原课程功能
  6709. router.route("/revertCourse").all((req, res, next) => {
  6710. postmysql(req, res, "revertCourse");
  6711. });
  6712. //还原课程功能
  6713. router.route("/revertCourseSz").all((req, res, next) => {
  6714. postmysql2(req, res, "revertCourse");
  6715. });
  6716. //根据课程id查询关联的表单
  6717. router.route("/selectTestCourseByCid").all((req, res, next) => {
  6718. var json = queryString(req.url);
  6719. getmysql(req, res, "selectTestCourseByCid", json["cid"]);
  6720. });
  6721. //qgt 根据用户id和文件标题获取答案来自动填写
  6722. router.route("/selectTestCourseAutoFillType3").all((req,res,next)=>{
  6723. var json = queryString(req.url);
  6724. getmysql(req, res, "selectTestCourseAutoFillType3", json["uid"],json["tit"]);
  6725. });
  6726. function generateAPIKey(username) {
  6727. let timeStamp = new Date().getTime();
  6728. let hashStr = timeStamp + username;
  6729. let digest = crypto
  6730. .createHash("sha256")
  6731. .update(hashStr, "utf8")
  6732. .digest("hex");
  6733. return digest;
  6734. }
  6735. queryString = function(url) {
  6736. var a = url.split("?");
  6737. var json = querystring.parse(a[1]);
  6738. return json;
  6739. };
  6740. //post存儲過程處理
  6741. postmysql = function(req, res, functionname) {
  6742. //mode的處理
  6743. if (req.body[0]) {
  6744. p = Object.values(req.body[0]);
  6745. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6746. //執行存儲過程
  6747. mysql.usselect(p, function(ret) {
  6748. res.end(JSON.stringify(ret));
  6749. });
  6750. }
  6751. };
  6752. //post存儲過程處理
  6753. postmysql2 = function(req, res, functionname) {
  6754. //mode的處理
  6755. if (req.body) {
  6756. p = Object.values(req.body)[0].split(",");
  6757. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6758. //執行存儲過程
  6759. mysql.usselect(p, function(ret) {
  6760. res.end(JSON.stringify(ret));
  6761. });
  6762. }
  6763. };
  6764. //post存儲過程處理
  6765. postmysql3 = function(req, res, functionname) {
  6766. //mode的處理
  6767. if (req.body) {
  6768. p = Object.values(req.body);
  6769. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6770. //執行存儲過程
  6771. mysql.usselect(p, function(ret) {
  6772. res.end(JSON.stringify(ret));
  6773. });
  6774. }
  6775. };
  6776. //get獲取數據庫信息
  6777. getmysql = function(req, res, functionname, ...p) {
  6778. p = p || [];
  6779. p.unshift(_getmysqlLabor[0], _getmysqlLabor[1], functionname);
  6780. //執行存儲過程
  6781. mysql.usselect(p, function(ret) {
  6782. res.end(JSON.stringify(ret));
  6783. }); //
  6784. };
  6785. //get獲取數據庫信息
  6786. getmysql2 = function(req, res, functionname, ...p) {
  6787. p = p || [];
  6788. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6789. //執行存儲過程
  6790. mysql.usselect(p, function(ret) {
  6791. res.end(JSON.stringify(ret));
  6792. }); //
  6793. };
  6794. //post存储过程处理
  6795. userpostmysql = function(req, res, functionname) {
  6796. //mode的处理
  6797. if (req.body.mode) {
  6798. p = req.body.mode.split(",");
  6799. p.unshift(_mysqluser[0], _mysqluser[1], functionname);
  6800. //执行存储过程
  6801. mysql.usselect(p, function(ret) {
  6802. res.end(JSON.stringify(ret));
  6803. });
  6804. }
  6805. };
  6806. //get获取数据库信息
  6807. usergetmysql = function(req, res, functionname, ...p) {
  6808. p = p || [];
  6809. p.unshift(_getmysqluser[0], _getmysqluser[1], functionname);
  6810. //执行存储过程
  6811. mysql.usselect(p, function(ret) {
  6812. res.end(JSON.stringify(ret));
  6813. }); //
  6814. };
  6815. module.exports = router;