pbl.js 218 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. //取消点赞
  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. //查询课程某个阶段某个任务下的评价
  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. //新增学习资源信息
  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. //点击阶段时添加观看人数
  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. //新增便签列表
  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修改便签内容
  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. //新增英语写作批改
  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. //新增或修改英语写作评价
  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. //添加分类
  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. //修改分类
  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. //修改学生项目分类
  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. //添加子分类
  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. //添加学生项目子分类
  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. //添加工作室项目子分类
  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. //修改工作项目分类
  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. //点击工具计数
  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. //修改工具次数
  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. //上传学生作业
  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. //修改赛事状态
  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. //目标管理新增目标模板
  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. //新增协同内容
  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. //赛事推荐
  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. router.route("/updateFileData").all((req, res, next) => {
  4910. var json = queryString(req.url);
  4911. var json2 = json["mode"].split(",");
  4912. getmysql(req, res, "updateFileData", json2[0], json2[1]);
  4913. });
  4914. router.route("/select_file").all((req, res, next) => {
  4915. var json = queryString(req.url);
  4916. getmysql(req, res, "select_file", json["fid"]);
  4917. });
  4918. //思维网格 解散房间
  4919. router.route("/dismiss").all((req, res, next) => {
  4920. postmysql(req, res, "update_room");
  4921. });
  4922. //提交提问
  4923. router.route("/addProblem").all((req, res, next) => {
  4924. postmysql(req, res, "add_problem");
  4925. //cid 课程id,chid 章节id,t 提问内容,uid 用户id
  4926. });
  4927. //查询提交的提问
  4928. router.route("/getProblem").all((req, res, next) => {
  4929. var json = queryString(req.url); //cid 课程id,page 页数
  4930. getmysql(req, res, "select_problem", json["cid"], json["page"], 10);
  4931. });
  4932. //获取用户基本信息
  4933. router.route("/getUserInfo").all((req, res, next) => {
  4934. var json = queryString(req.url);
  4935. getmysql(req, res, "getUserInfo", json["uid"], json["cid"]);
  4936. });
  4937. //获取用户多个课程基本信息
  4938. router.route("/getUserInfoMore").all((req, res, next) => {
  4939. var json = queryString(req.url);
  4940. getmysql(req, res, "getUserInfoMore", json["uid"], json["cid"]);
  4941. });
  4942. //获取多个用户单个课程基本信息
  4943. router.route("/getClassUserInfoMore").all((req, res, next) => {
  4944. var json = queryString(req.url);
  4945. getmysql(req, res, "getClassUserInfoMore", json["uid"], json["cid"]);
  4946. });
  4947. //获取课程下所有有作业的学生id
  4948. router.route("/selectCourseSuid").all((req, res, next) => {
  4949. var json = queryString(req.url);
  4950. getmysql(req, res, "selectCourseSuid", json["cid"], json["courseid"]);
  4951. });
  4952. //获取项目基本信息
  4953. router.route("/getCourseInfo").all((req, res, next) => {
  4954. var json = queryString(req.url);
  4955. getmysql(req, res, "getCourseInfo", json["cid"]);
  4956. });
  4957. //课程中心 总评添加和修改功能
  4958. router.route("/opCourseScore").all((req, res, next) => {
  4959. postmysql(req, res, "opCourseScore");
  4960. });
  4961. //查询已评价功能
  4962. router.route("/getCourseScoreP").all((req, res, next) => {
  4963. var json = queryString(req.url);
  4964. getmysql(req, res, "getCourseScoreP", json["cid"], json["uid"]);
  4965. });
  4966. //查询所有已评价功能
  4967. router.route("/getCourseScore").all((req, res, next) => {
  4968. var json = queryString(req.url);
  4969. getmysql(req, res, "getCourseScore", json["cid"]);
  4970. });
  4971. //获取多个项目基本信息
  4972. router.route("/getCourseInfoMore").all((req, res, next) => {
  4973. var json = queryString(req.url);
  4974. getmysql(req, res, "getCourseInfoMore", json["cid"]);
  4975. });
  4976. //获取用户基本信息
  4977. router.route("/getAllUserById").all((req, res, next) => {
  4978. var json = queryString(req.url);
  4979. getmysql(req, res, "getAllUserById", json["uid"]);
  4980. });
  4981. //作业生成报告
  4982. router.route("/getWorkData").all((req, res, next) => {
  4983. var json = queryString(req.url); //cid 课程id,page 页数
  4984. getmysql(req, res, "select_work_data", json["cid"]);
  4985. });
  4986. //查询评价体系
  4987. router.route("/getEvaluation").all((req, res, next) => {
  4988. var json = queryString(req.url); //cid 课程id,page 页数
  4989. getmysql(
  4990. req,
  4991. res,
  4992. "select_evaluation",
  4993. json["oid"],
  4994. json["n"],
  4995. json["page"],
  4996. 10
  4997. );
  4998. });
  4999. //添加评价体系
  5000. router.route("/addEvaluation").all((req, res, next) => {
  5001. postmysql(req, res, "add_evaluation");
  5002. //uid 用户id t标题 c内容
  5003. });
  5004. //修改评价体系
  5005. router.route("/updateEvaluation").all((req, res, next) => {
  5006. postmysql(req, res, "update_evaluation");
  5007. //c内容 t标题 id评价id
  5008. });
  5009. //删除评价体系
  5010. router.route("/deleteEvaluation").all((req, res, next) => {
  5011. postmysql(req, res, "delete_evaluation");
  5012. // id评价id
  5013. });
  5014. //删除评价体系前查询课程是否有该评价
  5015. router.route("/selectCourseEva").all((req, res, next) => {
  5016. var json = queryString(req.url); //cid 课程id,page 页数
  5017. getmysql(
  5018. req,
  5019. res,
  5020. "select_course_eva",
  5021. json["eid"],
  5022. );
  5023. });
  5024. //批量添加学校
  5025. router.route("/batchRegistrationSchool").post(function(req, res, next) {
  5026. let users = req.body[0];
  5027. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5028. for (let i = 0; i < arr.length; i++) {
  5029. let _school = encodeURIComponent(arr[i].school);
  5030. let _org = users.org;
  5031. //用戶數據
  5032. let _data = [_school, _org, "", "1", ""];
  5033. //參數拼接,註冊
  5034. _data.unshift(_mysqlLabor[0], _mysqlLabor[1], "insertSchoolByOrg");
  5035. //用戶註冊處理
  5036. mysql.usselect(_data, function(ret) {
  5037. res.end(JSON.stringify({ success: 1 }));
  5038. });
  5039. }
  5040. });
  5041. //批量添加学生
  5042. router.route("/batchRegistrationMore").post(function(req, res, next) {
  5043. let users = req.body[0];
  5044. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5045. for (let i = 0; i < arr.length; i++) {
  5046. let _username = encodeURIComponent(arr[i].name);
  5047. let _mail = encodeURIComponent(arr[i].mail)
  5048. let _password = users.password || "123456";
  5049. let _alias = encodeURIComponent(arr[i].name)
  5050. let _oid = users.oid;
  5051. let _ph = encodeURIComponent(arr[i].phone ? arr[i].phone : "")
  5052. let _class = encodeURIComponent(arr[i].class)
  5053. let _sId = encodeURIComponent(arr[i].sId)
  5054. //加密密碼
  5055. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5056. //生成激活碼
  5057. let _hashstr = new Date().getTime() + "";
  5058. let _digest = crypto
  5059. .createHash("sha256")
  5060. .update(_hashstr, "utf8")
  5061. .digest("hex");
  5062. //用戶數據
  5063. let _userdata = [
  5064. _mail,
  5065. _password,
  5066. _alias,
  5067. "",
  5068. 1, //0老师 1学生
  5069. _username,
  5070. "",
  5071. generateAPIKey(_username),
  5072. _digest,
  5073. "",
  5074. _username,
  5075. _sId,
  5076. 2, //1老师 2学生
  5077. _oid,
  5078. _ph,
  5079. _class,
  5080. "",
  5081. "0",
  5082. ];
  5083. //參數拼接,註冊
  5084. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
  5085. //用戶註冊處理
  5086. mysql.usselect(_userdata, function(ret) {
  5087. // let _pbluserdata = [
  5088. // ret[1][0].uid,
  5089. // _username,
  5090. // _sId,
  5091. // 2,
  5092. // _oid,
  5093. // _ph,
  5094. // _class,
  5095. // '',
  5096. // "0",
  5097. // ];
  5098. // _pbluserdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateUserByEdu");
  5099. // mysql.usselect(_pbluserdata, function(ret) {
  5100. res.end(JSON.stringify({ success: 1 }));
  5101. // });
  5102. });
  5103. }
  5104. });
  5105. //幼儿园评价
  5106. // 获取所有班级
  5107. router.route("/select_techerAllClass").all(function(req, res, next) {
  5108. // let users = req.query;
  5109. var json = queryString(req.url);
  5110. console.log(json);
  5111. getmysql(req, res, "select_techerAllClass", json['cid']);
  5112. });
  5113. // 获取所有班级学生
  5114. router.route("/selectClassStudent").all(function(req, res, next) {
  5115. var json = queryString(req.url);
  5116. getmysql(req, res, "selectClassStudent", json['cid']);
  5117. });
  5118. // 获取学生详情
  5119. router.route("/selectStudentDetail").all(function(req, res, next) {
  5120. // let users = req.query;
  5121. var json = queryString(req.url);
  5122. console.log(json);
  5123. getmysql(req, res, "selectStudentDetail", json['uid']);
  5124. });
  5125. // 获取学生记录筛选框
  5126. router.route("/selectVeiDoo").all(function(req, res, next) {
  5127. // let users = req.query;
  5128. var json = queryString(req.url);
  5129. // console.log(json);
  5130. getmysql(req, res, "selectVeiDoo", json['oid']);
  5131. });
  5132. // 上传学生评价
  5133. router.route("/insertRecord").all(function(req, res, next) {
  5134. // console.log(req.query);
  5135. postmysql(req, res, "insertRecord");
  5136. });
  5137. // 获取学生记录
  5138. router.route("/selectRecord").all(function(req, res, next) {
  5139. // let users = req.query;
  5140. var json = queryString(req.url);
  5141. // console.log(json);
  5142. // let txt=
  5143. getmysql(req, res, "selectRecord", json['uid'], json['trm'], json['txt']);
  5144. });
  5145. // 获取学生记录详情
  5146. router.route("/selectRecordDetail").all(function(req, res, next) {
  5147. // let users = req.query;
  5148. var json = queryString(req.url);
  5149. // console.log(json);
  5150. getmysql(req, res, "selectRecordDetail", json['id']);
  5151. });
  5152. // 删除学生评价
  5153. router.route("/updateRecord").all(function(req, res, next) {
  5154. // console.log(req.query);
  5155. postmysql(req, res, "updateRecord");
  5156. });
  5157. // 更新学生评价
  5158. router.route("/updateRecordData").all(function(req, res, next) {
  5159. // console.log(req.query);
  5160. postmysql(req, res, "updateRecordData");
  5161. });
  5162. // 获取学生记录详情
  5163. router.route("/selectSerStudent").all(function(req, res, next) {
  5164. // let users = req.query;
  5165. var json = queryString(req.url);
  5166. // console.log(json);
  5167. getmysql(req, res, "selectSerStudent", json['id'], json['txt']);
  5168. });
  5169. // 获取学期
  5170. router.route("/selectTerm").all(function(req, res, next) {
  5171. var json = queryString(req.url);
  5172. getmysql(req, res, "selectTerm");
  5173. });
  5174. // 获取班级信息
  5175. router.route("/selectManyClassStudent").all(function(req, res, next) {
  5176. var json = queryString(req.url);
  5177. getmysql(req, res, "selectManyClassStudent", json['cid'], json['uid']);
  5178. });
  5179. //幼儿园学生评价获取学生列表
  5180. router.route("/selectStudentAndRecord").all(function(req, res, next) {
  5181. var json = queryString(req.url);
  5182. getmysql(req, res, "selectStudentAndRecord", json['cid'], json['cu'], json['cn'], json['oid'], json['org'], json['page'], 10);
  5183. });
  5184. // pbl教师端观察日记
  5185. router.route("/selectVeidooType").all(function(req, res, next) {
  5186. var json = queryString(req.url);
  5187. // console.log(json);
  5188. getmysql(req, res, "selectVeidooType", json['uid'], json['cid'], json['cu'], json['cn'], json['cm'], json['page'], 10);
  5189. });
  5190. //查询幼儿园分类
  5191. router.route("/selectSTEType").all(function(req, res, next) {
  5192. var json = queryString(req.url);
  5193. // console.log(json);
  5194. getmysql(req, res, "selectSTEType", json['org'], json['oid']);
  5195. });
  5196. //查询口语分类
  5197. router.route("/select_englishVoiceType").all(function(req, res, next) {
  5198. var json = queryString(req.url);
  5199. // console.log(json);
  5200. getmysql(req, res, "select_englishVoiceType", json['oid'], json['org']);
  5201. });
  5202. //查询我的口语分类
  5203. router.route("/selectMySubTalk").all(function(req, res, next) {
  5204. var json = queryString(req.url);
  5205. // console.log(json);
  5206. getmysql(req, res, "selectMySubTalk", json['userid']);
  5207. });
  5208. //查询学情报告雷达图数据
  5209. router.route("/selectMapStuScore").all(function(req, res, next) {
  5210. var json = queryString(req.url);
  5211. // console.log(json);
  5212. getmysql(req, res, "selectMapStuScore", json['uid'], json['year']);
  5213. });
  5214. //每个大分类下的关键证据
  5215. router.route("/selectHealthRecord").all(function(req, res, next) {
  5216. var json = queryString(req.url);
  5217. // console.log(json);
  5218. getmysql(req, res, "selectHealthRecord", json['uid'], json['year'], json['txt'], json['page'], 4);
  5219. });
  5220. //手机端 获取记录地点list
  5221. router.route("/selectSTEPlace").all(function(req, res, next) {
  5222. var json = queryString(req.url);
  5223. // console.log(json);
  5224. getmysql(req, res, "selectSTEPlace", json['org'], json['oid']);
  5225. });
  5226. //获取所有的记录进行下载
  5227. router.route("/selectClassAllRecord").all(function(req, res, next) {
  5228. var json = queryString(req.url);
  5229. // console.log(json);
  5230. getmysql(req, res, "selectClassAllRecord",json['cid'], json['id']);
  5231. });
  5232. //record页面计算班级平均分
  5233. router.route("/selectClaAverageScore").all(function(req, res, next) {
  5234. var json = queryString(req.url);
  5235. // console.log(json);
  5236. getmysql(req, res, "selectClaAverageScore", json["cu"], json["oid"], json["cn"], json["trm"], json["page"], 10);
  5237. });
  5238. //record页面下载班级分数数据
  5239. router.route("/selectAllClaAvaRescore").all(function(req, res, next) {
  5240. var json = queryString(req.url);
  5241. // console.log(json);
  5242. getmysql(req, res, "selectAllClaAvaRescore", json["cu"], json["oid"], json["cn"], json["trm"]);
  5243. });
  5244. //学情报告计算班级平均分
  5245. router.route("/selectClaAvaScore").all(function(req, res, next) {
  5246. var json = queryString(req.url);
  5247. // console.log(json);
  5248. getmysql(req, res, "selectClaAvaScore", json["cid"], json["trm"]);
  5249. });
  5250. // 获取教师管理table数据
  5251. router.route("/selectOrgTeachar").all((req, res, next) => {
  5252. var json = queryString(req.url);
  5253. getmysql(
  5254. req,
  5255. res,
  5256. "selectOrgTeachar",
  5257. json["org"],
  5258. json["oid"],
  5259. json["cu"],
  5260. json["cn"],
  5261. json["page"],
  5262. 10
  5263. );
  5264. });
  5265. // 更新老师信息数据
  5266. router.route("/updateYTeacherInfo").all(function(req, res, next) {
  5267. // console.log(req.query);
  5268. postmysql(req, res, "updateYTeacherInfo");
  5269. });
  5270. //教师管理新增教师
  5271. router.route("/teacherRegistration").post(function(req, res, next) {
  5272. var users = req.body[0];
  5273. //循环注册
  5274. var _username = users.alias;
  5275. var _mail = users.username;
  5276. var _password = users.password || "123456";
  5277. var _alias = users.alias;
  5278. var _org = users.org;
  5279. var _oid = users.oid;
  5280. var _ph = users.ph;
  5281. var _class = users.cid;
  5282. var _sId = users.sid;
  5283. var _typ = users.typ;
  5284. var _rol = users.rol;
  5285. //加密密碼
  5286. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5287. //生成激活碼
  5288. let _hashstr = new Date().getTime() + "";
  5289. let _digest = crypto
  5290. .createHash("sha256")
  5291. .update(_hashstr, "utf8")
  5292. .digest("hex");
  5293. //用戶數據
  5294. var _userdata = [
  5295. _mail,
  5296. _password,
  5297. _alias,
  5298. "",
  5299. 0,
  5300. _username,
  5301. "",
  5302. generateAPIKey(_username),
  5303. _digest,
  5304. "",
  5305. _username,
  5306. _sId,
  5307. _typ,
  5308. _org,
  5309. _oid,
  5310. _ph,
  5311. _class,
  5312. "",
  5313. "0",
  5314. _rol
  5315. ];
  5316. //參數拼接,註冊
  5317. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_teacherRegistration");
  5318. //用戶註冊處理
  5319. mysql.usselect(_userdata, function(ret) {
  5320. res.end(
  5321. JSON.stringify({
  5322. uid: ret[1][0].uid,
  5323. ph: _ph,
  5324. oid: _oid,
  5325. cid: _class,
  5326. success: 1,
  5327. })
  5328. );
  5329. });
  5330. });
  5331. //初始化密码
  5332. router.route("/iniPassword").post(function(req, res, next) {
  5333. let users = req.body[0];
  5334. _password = users.pa;
  5335. //加密密碼
  5336. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5337. //用戶數據
  5338. let _userList = [users.uid, _password];
  5339. _userList.unshift(_mysqlLabor[0], _mysqlLabor[1], "iniPassword");
  5340. mysql.usselect(_userList, function(ret) {
  5341. res.end(JSON.stringify({ success: 1 }));
  5342. });
  5343. });
  5344. //批量添加教师
  5345. router.route("/batchRegistrationMore1").post(function(req, res, next) {
  5346. let users = req.body[0];
  5347. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5348. for (let i = 0; i < arr.length; i++) {
  5349. let _username = encodeURIComponent(arr[i].name)
  5350. let _mail = encodeURIComponent(arr[i].mail)
  5351. let _password = users.password || "123456";
  5352. let _alias = encodeURIComponent(arr[i].name)
  5353. let _org = users.org;
  5354. let _oid = encodeURIComponent(arr[i].school)
  5355. let _ph = encodeURIComponent(arr[i].phone ? arr[i].phone : "")
  5356. let _class = encodeURIComponent(arr[i].class)
  5357. let _sId = encodeURIComponent(arr[i].sId)
  5358. //加密密碼
  5359. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5360. //生成激活碼
  5361. let _hashstr = new Date().getTime() + "";
  5362. let _digest = crypto
  5363. .createHash("sha256")
  5364. .update(_hashstr, "utf8")
  5365. .digest("hex");
  5366. //用戶數據
  5367. let _userdata = [
  5368. _mail,
  5369. _password,
  5370. _alias,
  5371. "",
  5372. 0, //0老师 1学生
  5373. _username,
  5374. "",
  5375. generateAPIKey(_username),
  5376. _digest,
  5377. "",
  5378. _username,
  5379. _sId,
  5380. 1, //1老师 2学生
  5381. _org,
  5382. _oid,
  5383. "",
  5384. "",
  5385. "",
  5386. "0",
  5387. ];
  5388. //參數拼接,註冊
  5389. _userdata.unshift(
  5390. _mysqluser[0],
  5391. _mysqluser[1],
  5392. "pbl_add_batchregister_oid"
  5393. );
  5394. //用戶註冊處理
  5395. mysql.usselect(_userdata, function(ret) {
  5396. res.end(JSON.stringify({ success: 1 }));
  5397. });
  5398. }
  5399. });
  5400. //赛事批量注册老师
  5401. router.route("/pbl_add_raceuser_oid").post(function(req, res, next) {
  5402. let users = req.body[0];
  5403. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5404. for (let i = 0; i < arr.length; i++) {
  5405. let _username = encodeURIComponent(arr[i].name)
  5406. let _mail = encodeURIComponent(arr[i].mail)
  5407. let _password = users.password || "123456";
  5408. let _oid = encodeURIComponent(arr[i].school)
  5409. //加密密碼
  5410. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5411. //生成激活碼
  5412. let _hashstr = new Date().getTime() + "";
  5413. let _digest = crypto
  5414. .createHash("sha256")
  5415. .update(_hashstr, "utf8")
  5416. .digest("hex");
  5417. //用戶數據
  5418. let _userdata = [
  5419. _mail,
  5420. _oid,
  5421. _password,
  5422. _username,
  5423. 1, //1普通教师 2市级 3省级 4市级子级评委 5县区评委 6县区子级
  5424. ];
  5425. //參數拼接,註冊
  5426. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "pbl_add_raceuser_oid");
  5427. //用戶註冊處理
  5428. mysql.usselect(_userdata, function(ret) {
  5429. res.end(JSON.stringify({ success: 1 }));
  5430. });
  5431. }
  5432. });
  5433. //新增学生
  5434. router.route("/batchRegistration").post(function(req, res, next) {
  5435. var users = req.body[0];
  5436. //循环注册
  5437. var _username = users.alias;
  5438. var _mail = users.username;
  5439. var _password = users.password || "123456";
  5440. var _alias = users.alias;
  5441. var _oid = users.oid;
  5442. var _ph = users.ph;
  5443. var _class = users.cid;
  5444. var _sId = users.sid;
  5445. //加密密碼
  5446. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5447. //生成激活碼
  5448. let _hashstr = new Date().getTime() + "";
  5449. let _digest = crypto
  5450. .createHash("sha256")
  5451. .update(_hashstr, "utf8")
  5452. .digest("hex");
  5453. //用戶數據
  5454. var _userdata = [
  5455. _mail,
  5456. _password,
  5457. _alias,
  5458. "",
  5459. 1,
  5460. _username,
  5461. "",
  5462. generateAPIKey(_username),
  5463. _digest,
  5464. "",
  5465. _username,
  5466. _sId,
  5467. 2,
  5468. _oid,
  5469. _ph,
  5470. _class,
  5471. "",
  5472. "0",
  5473. ];
  5474. //參數拼接,註冊
  5475. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
  5476. //用戶註冊處理
  5477. mysql.usselect(_userdata, function(ret) {
  5478. res.end(
  5479. JSON.stringify({
  5480. uid: ret[1][0].uid,
  5481. ph: _ph,
  5482. oid: _oid,
  5483. cid: _class,
  5484. success: 1,
  5485. })
  5486. );
  5487. });
  5488. });
  5489. //深圳电教馆注册
  5490. router.route("/batchRegistrationSzdjg").post(function(req, res, next) {
  5491. var users = Object.values(req.body)[0].split(",");
  5492. //循环注册
  5493. var _username = users[0]; //名字
  5494. var _mail = users[1]; //用户名 账号
  5495. var _password = "123456";
  5496. var _alias = _username;
  5497. var _org = users[2];
  5498. var _oid = users[3];
  5499. var _ph = users[4];
  5500. var _class = users[5];
  5501. var _type = users[6];
  5502. var _openid = users[7];
  5503. //加密密碼
  5504. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5505. //生成激活碼
  5506. let _hashstr = new Date().getTime() + "";
  5507. let _digest = crypto
  5508. .createHash("sha256")
  5509. .update(_hashstr, "utf8")
  5510. .digest("hex");
  5511. //用戶數據
  5512. var _userdata = [
  5513. _mail,
  5514. _password,
  5515. _alias,
  5516. "",
  5517. 0,
  5518. _username,
  5519. _openid,
  5520. generateAPIKey(_username),
  5521. _digest,
  5522. "",
  5523. _username,
  5524. '',
  5525. _type,
  5526. _org,
  5527. _oid,
  5528. _ph,
  5529. _class,
  5530. "",
  5531. "0",
  5532. ];
  5533. //參數拼接,註冊
  5534. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregisterSzdjg");
  5535. //用戶註冊處理
  5536. mysql.usselect(_userdata, function(ret) {
  5537. res.end(
  5538. JSON.stringify({
  5539. uid: ret[1][0].uid,
  5540. ph: _ph,
  5541. oid: _oid,
  5542. cid: _class,
  5543. success: 1,
  5544. })
  5545. );
  5546. });
  5547. });
  5548. //新增教师
  5549. router.route("/batchRegistration1").post(function(req, res, next) {
  5550. var users = req.body[0];
  5551. //循环注册
  5552. var _username = users.alias;
  5553. var _mail = users.username;
  5554. var _password = users.password || "123456";
  5555. var _alias = users.alias;
  5556. var _org = users.org;
  5557. var _oid = users.oid;
  5558. var _ph = users.ph;
  5559. var _class = users.cid;
  5560. var _sId = users.sid;
  5561. //加密密碼
  5562. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5563. //生成激活碼
  5564. let _hashstr = new Date().getTime() + "";
  5565. let _digest = crypto
  5566. .createHash("sha256")
  5567. .update(_hashstr, "utf8")
  5568. .digest("hex");
  5569. //用戶數據
  5570. var _userdata = [
  5571. _mail,
  5572. _password,
  5573. _alias,
  5574. "",
  5575. 0,
  5576. _username,
  5577. "",
  5578. generateAPIKey(_username),
  5579. _digest,
  5580. "",
  5581. _username,
  5582. _sId,
  5583. 1,
  5584. _org,
  5585. _oid,
  5586. _ph,
  5587. _class,
  5588. "",
  5589. "0",
  5590. ];
  5591. //參數拼接,註冊
  5592. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister1");
  5593. //用戶註冊處理
  5594. mysql.usselect(_userdata, function(ret) {
  5595. res.end(
  5596. JSON.stringify({
  5597. uid: ret[1][0].uid,
  5598. ph: _ph,
  5599. oid: _oid,
  5600. cid: _class,
  5601. success: 1,
  5602. })
  5603. );
  5604. });
  5605. });
  5606. router.route("/batchRegistrationOrg").post(function(req, res, next) {
  5607. var users = req.body[0];
  5608. //循环注册
  5609. var _username = users.alias;
  5610. var _mail = users.username;
  5611. var _password = users.password || "123456";
  5612. var _alias = users.alias;
  5613. var _oid = users.oid;
  5614. var _ph = users.ph;
  5615. var _class = users.cid;
  5616. var _sId = users.sid;
  5617. var _org = users.org;
  5618. //加密密碼
  5619. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5620. //生成激活碼
  5621. let _hashstr = new Date().getTime() + "";
  5622. let _digest = crypto
  5623. .createHash("sha256")
  5624. .update(_hashstr, "utf8")
  5625. .digest("hex");
  5626. //用戶數據
  5627. var _userdata = [
  5628. _mail,
  5629. _password,
  5630. _alias,
  5631. "",
  5632. 1,
  5633. _username,
  5634. "",
  5635. generateAPIKey(_username),
  5636. _digest,
  5637. "",
  5638. _username,
  5639. _sId,
  5640. 2,
  5641. _oid,
  5642. _ph,
  5643. _class,
  5644. "",
  5645. "0",
  5646. _org,
  5647. ];
  5648. //參數拼接,註冊
  5649. _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister_org");
  5650. //用戶註冊處理
  5651. mysql.usselect(_userdata, function(ret) {
  5652. res.end(
  5653. JSON.stringify({
  5654. uid: ret[1][0].uid,
  5655. ph: _ph,
  5656. oid: _oid,
  5657. cid: _class,
  5658. success: 1,
  5659. })
  5660. );
  5661. });
  5662. });
  5663. router.route("/batchRegistrationMoreOrg").post(function(req, res, next) {
  5664. let users = req.body[0];
  5665. let arr = JSON.parse(decodeURIComponent(req.body[0].arr));
  5666. for (let i = 0; i < arr.length; i++) {
  5667. let _username = encodeURIComponent(arr[i].name)
  5668. let _mail = encodeURIComponent(arr[i].mail)
  5669. let _password = users.password || "123456";
  5670. let _alias = encodeURIComponent(arr[i].name)
  5671. let _oid = users.oid;
  5672. let _ph = encodeURIComponent(arr[i].phone ? arr[i].phone : "")
  5673. let _class = encodeURIComponent(arr[i].class)
  5674. let _sId = encodeURIComponent(arr[i].sId)
  5675. let _org = users.org;
  5676. //加密密碼
  5677. _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
  5678. //生成激活碼
  5679. let _hashstr = new Date().getTime() + "";
  5680. let _digest = crypto
  5681. .createHash("sha256")
  5682. .update(_hashstr, "utf8")
  5683. .digest("hex");
  5684. //用戶數據
  5685. let _userdata = [
  5686. _mail,
  5687. _password,
  5688. _alias,
  5689. "",
  5690. 1, //0老师 1学生
  5691. _username,
  5692. "",
  5693. generateAPIKey(_username),
  5694. _digest,
  5695. "",
  5696. _username,
  5697. _sId,
  5698. 2, //1老师 2学生
  5699. _oid,
  5700. _ph,
  5701. _class,
  5702. "",
  5703. "0",
  5704. _org,
  5705. ];
  5706. //參數拼接,註冊
  5707. _userdata.unshift(
  5708. _mysqluser[0],
  5709. _mysqluser[1],
  5710. "pbl_add_batchregister_org2"
  5711. );
  5712. //用戶註冊處理
  5713. mysql.usselect(_userdata, function(ret) {
  5714. res.end(JSON.stringify({ success: 1 }));
  5715. });
  5716. }
  5717. });
  5718. //工作室管理
  5719. router.route("/updateStudioWorkNew4").all((req, res, next) => {
  5720. //学生
  5721. if (req.body[0]) {
  5722. let p = [req.body[0].cid];
  5723. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_studio_course_detail2"); //執行存儲過程
  5724. mysql.usselect(p, function(ret) {
  5725. let _unitIndex = parseInt(req.body[0].unitIndex);
  5726. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  5727. let _unitJson = JSON.parse(ret[0][0].chapters);
  5728. if (_unitJson.length - 1 < _unitIndex) {
  5729. let _i = _unitIndex - (_unitJson.length - 1);
  5730. for (let i = 0; i < _i; i++) {
  5731. _unitJson.push({
  5732. dyName: "", //单元标题
  5733. chapterInfo: [{
  5734. isread: false,
  5735. chapterid: guid(),
  5736. title: "",
  5737. courseName: "",
  5738. taskJson: [{
  5739. task: "",
  5740. taskDetail: "",
  5741. chapterData: [],
  5742. toolText: "",
  5743. toolChoose: [{
  5744. tool: [],
  5745. toolDetail: "",
  5746. toolType: 0,
  5747. askCount: 1,
  5748. askTitle: "",
  5749. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  5750. }, ],
  5751. isShowTools: false,
  5752. askCount: 1,
  5753. isFold: 0,
  5754. askTitle: "",
  5755. askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
  5756. checkJson: [{ checkCount: [], checkPerent: [] }],
  5757. homeworkList: [],
  5758. }, ],
  5759. itemCount: 1,
  5760. fileList1: [],
  5761. video: [],
  5762. testData: [],
  5763. pData: [],
  5764. templateArray: [],
  5765. }, ],
  5766. });
  5767. }
  5768. _unitJson[_unitIndex] = _chapters[_unitIndex];
  5769. } else {
  5770. _unitJson[_unitIndex] = _chapters[_unitIndex];
  5771. }
  5772. // console.log(_unitJson);
  5773. let p2 = [
  5774. req.body[0].cid,
  5775. encodeURIComponent(JSON.stringify(_unitJson)),
  5776. ];
  5777. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudioWorkNew4"); //執行存儲過程
  5778. mysql.usselect(p2, function(ret) {
  5779. res.end(JSON.stringify({ success: 1 }));
  5780. });
  5781. // res.end(JSON.stringify({ success: 1 }));
  5782. });
  5783. }
  5784. });
  5785. router.route("/updateStudioWorkNew2").all((req, res, next) => {
  5786. //学生
  5787. if (req.body[0]) {
  5788. p = [
  5789. req.body[0].cid,
  5790. req.body[0].title,
  5791. req.body[0].brief,
  5792. req.body[0].cover,
  5793. req.body[0].evaId,
  5794. req.body[0].astudent,
  5795. req.body[0].see,
  5796. req.body[0].chapters,
  5797. req.body[0].template,
  5798. req.body[0].ateacher,
  5799. ];
  5800. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudioWorkNew2"); //執行存儲過程
  5801. mysql.usselect(p, function(ret) {
  5802. let course = req.body[0].courseType;
  5803. let courseId = req.body[0].cid;
  5804. let userid = req.body[0].uid;
  5805. delStudioCourseTypeS(course, courseId, userid);
  5806. res.end(JSON.stringify({ success: 1 }));
  5807. });
  5808. }
  5809. });
  5810. router.route("/addStudioCourseWorkNew2").all((req, res, next) => {
  5811. //学生
  5812. if (req.body[0]) {
  5813. p = [
  5814. req.body[0].uid,
  5815. req.body[0].title,
  5816. req.body[0].brief,
  5817. req.body[0].cover,
  5818. req.body[0].evaId,
  5819. req.body[0].astudent,
  5820. req.body[0].see,
  5821. req.body[0].chapters,
  5822. req.body[0].template,
  5823. req.body[0].ateacher,
  5824. ];
  5825. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addStudioCourseWorkNew2"); //執行存儲過程
  5826. mysql.usselect(p, function(ret) {
  5827. let course = req.body[0].courseType;
  5828. let courseId = ret[0][0].courseId;
  5829. let userid = req.body[0].uid;
  5830. delStudioCourseTypeS(course, courseId, userid);
  5831. res.end(
  5832. JSON.stringify({
  5833. ordernumber: ret[0][0].ordernumber,
  5834. courseId: ret[0][0].courseId,
  5835. success: 1,
  5836. })
  5837. );
  5838. });
  5839. }
  5840. });
  5841. //teacher 查询项目模板
  5842. router.route("/getStudioTemplateTs").all((req, res, next) => {
  5843. var json = queryString(req.url);
  5844. getmysql(req, res, "getStudioTemplateTs", json["oid"]);
  5845. });
  5846. //查看课程
  5847. router.route("/select_studio_course_detail").all((req, res, next) => {
  5848. //学生
  5849. var json = queryString(req.url);
  5850. getmysql(req, res, "select_studio_course_detail", json["cid"]);
  5851. });
  5852. //查看课程
  5853. router.route("/select_studio_course_detail2").all((req, res, next) => {
  5854. //学生
  5855. var json = queryString(req.url);
  5856. getmysql(req, res, "select_studio_course_detail2", json["cid"]);
  5857. });
  5858. //协同恢复删除的阶段
  5859. router.route("/restoreStudioWork").all((req, res, next) => {
  5860. //学生
  5861. if (req.body[0]) {
  5862. let p = [req.body[0].cid];
  5863. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_studio_course_detail2"); //執行存儲過程
  5864. mysql.usselect(p, function(ret) {
  5865. let _chapid = req.body[0].chapid;
  5866. // console.log(_chapid);
  5867. let _chapters = JSON.parse(decodeURIComponent(req.body[0].chapters));
  5868. let _unitJson = JSON.parse(ret[0][0].chapters);
  5869. let _unitJson2 = [];
  5870. let chpaindex;
  5871. for (var i = 0; i < _chapters.length; i++) {
  5872. if (_chapters[i].chapterInfo[0].chapterid == _chapid) {
  5873. chpaindex = i;
  5874. }
  5875. }
  5876. for (var i = 0; i < _unitJson.length; i++) {
  5877. if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
  5878. // console.log(1);
  5879. // _unitJson.splice(i, -1)
  5880. _unitJson2.push(_unitJson[i]);
  5881. // break;
  5882. }
  5883. }
  5884. _unitJson2.splice(chpaindex, 0, _chapters[chpaindex]);
  5885. // console.log(_unitJson2);
  5886. let p2 = [
  5887. req.body[0].cid,
  5888. JSON.stringify(_unitJson2).replaceAll(/%/g, "%25"),
  5889. ];
  5890. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateStudioWorkNew4"); //執行存儲過程
  5891. mysql.usselect(p2, function(ret) {
  5892. res.end(JSON.stringify({ success: 1 }));
  5893. });
  5894. // res.end(JSON.stringify({ success: 1 }));
  5895. });
  5896. }
  5897. });
  5898. //查询分类及所有子分类
  5899. router.route("/selectAllTypeStudio").all((req, res, next) => {
  5900. var json = queryString(req.url);
  5901. getmysql(req, res, "selectAllTypeStudio", json["org"], json["oid"]);
  5902. });
  5903. //上传文件
  5904. router.route("/addStudioCourseWorksS").all((req, res, next) => {
  5905. postmysql(req, res, "addStudioCourseWorksS");
  5906. });
  5907. //删除提交的作业
  5908. router.route("/deleteStudioCourseWorkS").all((req, res, next) => {
  5909. postmysql(req, res, "deleteStudioCourseWorkS");
  5910. });
  5911. //创建新话题
  5912. router.route("/addSubTalk").all((req, res, next) => {
  5913. postmysql(req, res, "addSubTalk");
  5914. });
  5915. //创建新子分类
  5916. router.route("/addEngVType").all((req, res, next) => {
  5917. postmysql(req, res, "addEngVType");
  5918. });
  5919. router.route("/selectStudioCourseNew222").all((req, res, next) => {
  5920. var json = queryString(req.url);
  5921. getmysql(
  5922. req,
  5923. res,
  5924. "selectStudioCourseNew222",
  5925. json["type"],
  5926. json["uid"],
  5927. json["oid"],
  5928. json["org"],
  5929. json["typea"],
  5930. json["typeb"],
  5931. json["typec"],
  5932. json["typed"],
  5933. json["typef"],
  5934. json["typeE"],
  5935. json["cu"],
  5936. json["cn"],
  5937. json["page"],
  5938. json["pageSize"]
  5939. );
  5940. });
  5941. //删除1课程
  5942. router.route("/deleteStudioCourse").all((req, res, next) => {
  5943. var json = queryString(req.url);
  5944. getmysql2(req, res, "deleteStudioCourse", json["cid"]);
  5945. });
  5946. //添加分享课程数据
  5947. router.route("/addShareCourse").post((req, res, next) => {
  5948. var json = queryString(req.url);
  5949. postmysql(req, res, "addShareCourse");
  5950. });
  5951. //获取分享课程数据
  5952. router.route("/getShareCourse").all((req, res, next) => {
  5953. var json = queryString(req.url);
  5954. getmysql(req, res, "getShareCourse", json["cid"],json["type"]);
  5955. });
  5956. router.route("/delShareCourse").all((req, res, next) => {
  5957. var json = queryString(req.url);
  5958. postmysql(req, res, "delShareCourse");
  5959. });
  5960. function delStudioCourseTypeS(course, courseId, userid) {
  5961. let _courseId = courseId;
  5962. var _userdata = [_courseId];
  5963. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_studioCourseTypeS");
  5964. mysql.usselect(_userdata, function(ret) {
  5965. // console.log(ret);
  5966. addStudioCourseTypeS(userid, course, _courseId);
  5967. });
  5968. // setTimeout(() => {
  5969. // }, 1000);
  5970. }
  5971. function addStudioCourseTypeS(userid, course, _courseId) {
  5972. var _uid = userid;
  5973. var _courses = _courseId;
  5974. var _tid = JSON.parse(decodeURIComponent(course));
  5975. for (let i = 0; i < _tid.length; i++) {
  5976. if (_tid[i] == "") {
  5977. continue;
  5978. }
  5979. var _userdata = [_courses, _tid[i], _uid];
  5980. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_studioCourseTypeS");
  5981. mysql.usselect(_userdata, function(ret) {
  5982. // console.log(ret);
  5983. });
  5984. }
  5985. }
  5986. //删除作业阶段任务工具
  5987. router.route("/deleteStudioToolSTT").all((req, res, next) => {
  5988. postmysql(req, res, "deleteStudioToolSTT");
  5989. });
  5990. //删除作业阶段任务
  5991. router.route("/deleteStudioToolST").all((req, res, next) => {
  5992. postmysql(req, res, "deleteStudioToolST");
  5993. });
  5994. //删除作业阶段
  5995. router.route("/deleteStudioToolS").all((req, res, next) => {
  5996. postmysql(req, res, "deleteStudioToolST");
  5997. });
  5998. //工作管理首页查询分类
  5999. router.route("/selectStudioCourseNew22Mode").all((req, res, next) => {
  6000. var json = queryString(req.url);
  6001. getmysql(
  6002. req,
  6003. res,
  6004. "selectStudioCourseNew22Mode",
  6005. json["type"],
  6006. json["uid"],
  6007. json["oid"],
  6008. json["org"],
  6009. json["typea"],
  6010. json["typeb"],
  6011. json["typec"],
  6012. json["typed"],
  6013. json["typef"],
  6014. json["typeE"],
  6015. json["cu"],
  6016. json["cn"]
  6017. );
  6018. });
  6019. //工作管理首页查询
  6020. router.route("/selectStudioCourseNew22").all((req, res, next) => {
  6021. var json = queryString(req.url);
  6022. getmysql(
  6023. req,
  6024. res,
  6025. "selectStudioCourseNew22",
  6026. json["type"],
  6027. json["uid"],
  6028. json["oid"],
  6029. json["org"],
  6030. json["typea"],
  6031. json["typeb"],
  6032. json["typec"],
  6033. json["typed"],
  6034. json["typef"],
  6035. json["typeE"],
  6036. json["cu"],
  6037. json["cn"],
  6038. json["page"],
  6039. json["pageSize"]
  6040. );
  6041. });
  6042. //根据学校查询banner
  6043. router.route("/selectBannerByOidStudio").all((req, res, next) => {
  6044. var json = queryString(req.url);
  6045. getmysql(req, res, "selectBannerByOidStudio", json["oid"]);
  6046. });
  6047. //admin 查询banner
  6048. router.route("/getBannerStudio").all((req, res, next) => {
  6049. var json = queryString(req.url);
  6050. getmysql(req, res, "getBannerStudio");
  6051. });
  6052. //查询工作课程详情
  6053. router.route("/selectStudioCourseDetail2").all((req, res, next) => {
  6054. //学生
  6055. var json = queryString(req.url);
  6056. getmysql(req, res, "selectStudioCourseDetail2", json["courseId"]);
  6057. });
  6058. //查询工作课程详情
  6059. router.route("/selectStudioCourseDetail3").all((req, res, next) => {
  6060. //学生
  6061. var json = queryString(req.url);
  6062. getmysql(req, res, "selectStudioCourseDetail3", json["courseId"]);
  6063. });
  6064. //上传文件
  6065. router.route("/addCourseWorks4studio").all((req, res, next) => {
  6066. postmysql3(req, res, "addCourseWorks4studio");
  6067. });
  6068. //查询教师资源分类
  6069. router.route("/selectAllSourceType").all((req, res, next) => {
  6070. //学生
  6071. var json = queryString(req.url);
  6072. getmysql(req, res, "selectAllSourceType", json["oid"], json["org"]);
  6073. });
  6074. //查询资源分类
  6075. router.route("/selectAllEvaType").all((req, res, next) => {
  6076. var json = queryString(req.url);
  6077. getmysql(req, res, "selectAllEvaType", json["oid"], json["org"]);
  6078. });
  6079. router.route("/addSource").all((req, res, next) => {
  6080. //添加资源
  6081. if (req.body[0]) {
  6082. p = [
  6083. req.body[0].name,
  6084. req.body[0].url,
  6085. req.body[0].detail,
  6086. req.body[0].label,
  6087. req.body[0].userid,
  6088. ];
  6089. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addSource");
  6090. //執行存儲過程
  6091. mysql.usselect(p, function(ret) {
  6092. let course = req.body[0].courseType;
  6093. let courseId = ret[0][0].id;
  6094. let userid = req.body[0].userid;
  6095. delSourceType(course, courseId, userid);
  6096. res.end(JSON.stringify({ id: ret[0][0].id, success: 1 }));
  6097. // res.end(JSON.stringify(ret));
  6098. });
  6099. }
  6100. });
  6101. //删除1资源模板分类
  6102. router.route("/deleteCETLabel").all((req, res, next) => {
  6103. var json = queryString(req.url);
  6104. getmysql2(req, res, "deleteCETLabel", json["cid"]);
  6105. });
  6106. //添加资源模板分类
  6107. router.route("/addCETLabel").all((req, res, next) => {
  6108. postmysql(req, res, "addCETLabel");
  6109. });
  6110. //资源模板分享
  6111. router.route("/addCETShare").all((req, res, next) => {
  6112. // if (req.body[0]) {
  6113. // p = [
  6114. // req.body[0].uid,
  6115. // req.body[0].n,
  6116. // req.body[0].json,
  6117. // req.body[0].t,
  6118. // req.body[0].oid,
  6119. // ];
  6120. // p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addCETShare");
  6121. // //執行存儲過程
  6122. // mysql.usselect(p, function(ret) {
  6123. // res.end(JSON.stringify({ id: ret[0][0].id, success: 1 }));
  6124. // // res.end(JSON.stringify(ret));
  6125. // });
  6126. // }
  6127. postmysql(req, res, "addCETShare");
  6128. });
  6129. router.route("/updateSource").all((req, res, next) => {
  6130. //修改资源
  6131. if (req.body[0]) {
  6132. p = [
  6133. req.body[0].id,
  6134. req.body[0].name,
  6135. req.body[0].url,
  6136. req.body[0].detail,
  6137. req.body[0].label,
  6138. req.body[0].userid,
  6139. ];
  6140. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateSource");
  6141. //執行存儲過程
  6142. mysql.usselect(p, function(ret) {
  6143. let course = req.body[0].courseType;
  6144. let courseId = req.body[0].id;
  6145. let userid = req.body[0].userid;
  6146. delSourceType(course, courseId, userid);
  6147. res.end(JSON.stringify({ id: req.body[0].id, success: 1 }));
  6148. // res.end(JSON.stringify(ret));
  6149. });
  6150. }
  6151. });
  6152. function delSourceType(course, courseId, userid) {
  6153. let _courseId = courseId;
  6154. var _userdata = [_courseId];
  6155. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_sourceType");
  6156. mysql.usselect(_userdata, function(ret) {
  6157. addSourceType(userid, course, _courseId);
  6158. });
  6159. }
  6160. function addSourceType(userid, course, _courseId) {
  6161. var _uid = userid;
  6162. var _courses = _courseId;
  6163. var _tid = JSON.parse(decodeURIComponent(course));
  6164. for (let i = 0; i < _tid.length; i++) {
  6165. if (_tid[i] == "") {
  6166. continue;
  6167. }
  6168. var _userdata = [_courses, _tid[i], _uid];
  6169. _userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_sourceType");
  6170. mysql.usselect(_userdata, function(ret) {
  6171. // console.log(ret);
  6172. });
  6173. }
  6174. }
  6175. //资源查询
  6176. router.route("/selectSource").all((req, res, next) => {
  6177. var json = queryString(req.url);
  6178. getmysql(
  6179. req,
  6180. res,
  6181. "selectSource",
  6182. json["uid"],
  6183. json["oid"],
  6184. json["org"],
  6185. json["typea"],
  6186. json["typeb"],
  6187. json["typeE"],
  6188. json["cn"],
  6189. json["page"],
  6190. json["pageSize"]
  6191. );
  6192. });
  6193. //评价资源查询
  6194. router.route("/selectCourseEvaT").all((req, res, next) => {
  6195. var json = queryString(req.url);
  6196. getmysql(
  6197. req,
  6198. res,
  6199. "selectCourseEvaT",
  6200. json["uid"],
  6201. json["oid"],
  6202. json["org"],
  6203. json["typea"],
  6204. json["typeb"],
  6205. json["typeE"],
  6206. json["cn"],
  6207. json["type"],
  6208. json["page"],
  6209. json["pageSize"]
  6210. );
  6211. });
  6212. //评价资源重命名
  6213. router.route("/updateCourseET").all((req, res, next) => {
  6214. var json = queryString(req.url);
  6215. getmysql(
  6216. req,
  6217. res,
  6218. "updateCourseET",
  6219. json["id"],
  6220. json["n"],
  6221. );
  6222. });
  6223. //删除1评价资源
  6224. router.route("/deleteCourseET").all((req, res, next) => {
  6225. var json = queryString(req.url);
  6226. getmysql2(
  6227. req,
  6228. res,
  6229. "deleteCourseET",
  6230. json["id"],
  6231. );
  6232. });
  6233. //添加评价资源分类
  6234. router.route("/addCETType").all((req, res, next) => {
  6235. var json = queryString(req.url);
  6236. getmysql(
  6237. req,
  6238. res,
  6239. "addCETType",
  6240. json["pid"],
  6241. json["ppid"],
  6242. json["n"],
  6243. json["uid"],
  6244. json["oid"],
  6245. );
  6246. });
  6247. //数据看板-综合数据
  6248. router.route("/selectDataBoardSchool").all((req, res, next) => {
  6249. postmysql(req, res, "selectDataBoardSchool");
  6250. });
  6251. //数据看板-教师数据
  6252. router.route("/selectDataBoardTeacher").all((req, res, next) => {
  6253. postmysql(req, res, "selectDataBoardTeacher");
  6254. });
  6255. //数据看板-学生数据
  6256. router.route("/selectDataBoardStudent").all((req, res, next) => {
  6257. postmysql(req, res, "selectDataBoardStudent");
  6258. });
  6259. //数据看板-课程数据
  6260. router.route("/selectDataBoardCourse").all((req, res, next) => {
  6261. postmysql(req, res, "selectDataBoardCourse");
  6262. });
  6263. //数据看板-综合数据
  6264. router.route("/selectDataBoardSchoolNew").all((req, res, next) => {
  6265. postmysql(req, res, "selectDataBoardSchoolNew");
  6266. });
  6267. //数据看板-教师数据
  6268. router.route("/selectDataBoardTeacherNew").all((req, res, next) => {
  6269. postmysql(req, res, "selectDataBoardTeacherNew");
  6270. });
  6271. //数据看板-学生数据
  6272. router.route("/selectDataBoardStudentNew").all((req, res, next) => {
  6273. postmysql(req, res, "selectDataBoardStudentNew");
  6274. });
  6275. //数据看板-课程数据
  6276. router.route("/selectDataBoardCourseNew").all((req, res, next) => {
  6277. postmysql(req, res, "selectDataBoardCourseNew");
  6278. });
  6279. //数据看板-课程数据
  6280. router.route("/selectDataBoardStudentCourseNew").all((req, res, next) => {
  6281. postmysql(req, res, "selectDataBoardStudentCourseNew");
  6282. });
  6283. //数据看板-学生排行榜
  6284. router.route("/selectDataboardStudentRank").all((req, res, next) => {
  6285. postmysql(req, res, "selectDataboardStudentRank");
  6286. });
  6287. //数据看板-教师排行榜
  6288. router.route("/selectDataboardTeacherRank").all((req, res, next) => {
  6289. postmysql(req, res, "selectDataboardTeacherRank");
  6290. });
  6291. //数据看板-评测
  6292. router.route("/selectDataBoardTest").all((req, res, next) => {
  6293. postmysql(req, res, "selectDataBoardTest");
  6294. });
  6295. //数据看板-市级数据
  6296. router.route("/selectDataBoardCitySz").all((req, res, next) => {
  6297. postmysql(req, res, "selectDataBoardCitySz");
  6298. });
  6299. //数据看板-区级数据
  6300. router.route("/selectDataBoardAreaSz").all((req, res, next) => {
  6301. postmysql(req, res, "selectDataBoardAreaSz");
  6302. });
  6303. //数据看板-综合数据
  6304. router.route("/getDataBoardSchoolNew").all((req, res, next) => {
  6305. let p = Object.values(req.body[0]);
  6306. let d = Object.values(req.body[0]);
  6307. console.log(p)
  6308. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6309. mysql.usselect(p, function(ret) {
  6310. if(!ret[0].length){
  6311. let p2 = [d[0], d[1]];
  6312. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardSchoolNew');
  6313. mysql.usselect(p2, function(ret) {
  6314. res.end(JSON.stringify(ret));
  6315. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'1'];
  6316. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6317. mysql.usselect(p3, function(ret) {})
  6318. });
  6319. }else{
  6320. console.log(1);
  6321. res.end(ret[0][0].json);
  6322. }
  6323. // res.end(JSON.stringify(ret));
  6324. });
  6325. });
  6326. //数据看板-课程数据
  6327. router.route("/getDataBoardCourseNew").all((req, res, next) => {
  6328. let p = Object.values(req.body[0]);
  6329. let d = Object.values(req.body[0]);
  6330. console.log(p)
  6331. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6332. mysql.usselect(p, function(ret) {
  6333. if(!ret[0].length){
  6334. let p2 = [d[0], d[1]];
  6335. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardCourseNew');
  6336. mysql.usselect(p2, function(ret) {
  6337. res.end(JSON.stringify(ret));
  6338. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'2'];
  6339. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6340. mysql.usselect(p3, function(ret) {})
  6341. });
  6342. }else{
  6343. console.log(1);
  6344. res.end(ret[0][0].json);
  6345. }
  6346. // res.end(JSON.stringify(ret));
  6347. });
  6348. });
  6349. //数据看板-项目数据
  6350. router.route("/getDataBoardStudentCourseNew").all((req, res, next) => {
  6351. let p = Object.values(req.body[0]);
  6352. let d = Object.values(req.body[0]);
  6353. console.log(p)
  6354. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6355. mysql.usselect(p, function(ret) {
  6356. if(!ret[0].length){
  6357. let p2 = [d[0], d[1]];
  6358. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardStudentCourseNew');
  6359. mysql.usselect(p2, function(ret) {
  6360. res.end(JSON.stringify(ret));
  6361. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'3'];
  6362. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6363. mysql.usselect(p3, function(ret) {})
  6364. });
  6365. }else{
  6366. console.log(1);
  6367. res.end(ret[0][0].json);
  6368. }
  6369. // res.end(JSON.stringify(ret));
  6370. });
  6371. });
  6372. //数据看板-学生数据
  6373. router.route("/getDataBoardStudentNew").all((req, res, next) => {
  6374. let p = Object.values(req.body[0]);
  6375. let d = Object.values(req.body[0]);
  6376. console.log(p)
  6377. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6378. mysql.usselect(p, function(ret) {
  6379. if(!ret[0].length){
  6380. let p2 = [d[0], d[1]];
  6381. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardStudentNew');
  6382. mysql.usselect(p2, function(ret) {
  6383. res.end(JSON.stringify(ret));
  6384. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'5'];
  6385. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6386. mysql.usselect(p3, function(ret) {})
  6387. });
  6388. }else{
  6389. console.log(1);
  6390. res.end(ret[0][0].json);
  6391. }
  6392. // res.end(JSON.stringify(ret));
  6393. });
  6394. });
  6395. //数据看板-教师数据
  6396. router.route("/getDataBoardTeacherNew").all((req, res, next) => {
  6397. let p = Object.values(req.body[0]);
  6398. let d = Object.values(req.body[0]);
  6399. console.log(p)
  6400. p.unshift(_mysqlLabor[0], _mysqlLabor[1], 'getDataBoard');
  6401. mysql.usselect(p, function(ret) {
  6402. if(!ret[0].length){
  6403. let p2 = [d[0], d[1]];
  6404. p2.unshift(_mysqlLabor[0], _mysqlLabor[1], 'selectDataBoardTeacherNew');
  6405. mysql.usselect(p2, function(ret) {
  6406. res.end(JSON.stringify(ret));
  6407. let p3 = [d[0], d[1],encodeURIComponent(JSON.stringify(ret)),'4'];
  6408. p3.unshift(_mysqlLabor[0], _mysqlLabor[1], 'addDataBoard');
  6409. mysql.usselect(p3, function(ret) {})
  6410. });
  6411. }else{
  6412. console.log(1);
  6413. res.end(ret[0][0].json);
  6414. }
  6415. // res.end(JSON.stringify(ret));
  6416. });
  6417. });
  6418. //数据看板-查询项目数据长度
  6419. router.route("/getCourseLength").all((req, res, next) => {
  6420. postmysql(req, res, "getCourseLength");
  6421. });
  6422. //评测中心-上传评测
  6423. router.route("/addTestWorks").all((req, res, next) => {
  6424. postmysql(req, res, "addTestWorks");
  6425. });
  6426. //评测中心-上传评测
  6427. router.route("/addTestWorks2").all((req, res, next) => {
  6428. postmysql(req, res, "addTestWorks2");
  6429. });
  6430. //评测中心-删除评测
  6431. router.route("/deleteTestCourse").all((req, res, next) => {
  6432. postmysql(req, res, "deleteTestCourse");
  6433. });
  6434. //评测中心-批改
  6435. router.route("/addTestWorksTeacher").all((req, res, next) => {
  6436. postmysql(req, res, "addTestWorksTeacher");
  6437. });
  6438. //评测中心-复制评测
  6439. router.route("/copyTestWorks").all((req, res, next) => {
  6440. postmysql(req, res, "copyTestWorks");
  6441. });
  6442. //评测中心-查询用户测评总览
  6443. router.route("/selectTestUserY").all((req, res, next) => {
  6444. var json = queryString(req.url);
  6445. getmysql(req, res, "selectTestUserY", json["uid"], json["oid"], json["org"]);
  6446. });
  6447. //查询用户学习记录总览
  6448. router.route("/selectSRecordY").all((req, res, next) => {
  6449. var json = queryString(req.url);
  6450. getmysql(req, res, "selectSRecordY", json["uid"], json["oid"], json["org"]);
  6451. });
  6452. //查询幼儿园全部及学校分类
  6453. router.route("/selectSEAllType").all((req, res, next) => {
  6454. var json = queryString(req.url);
  6455. getmysql(req, res, "selectSEAllType", json["oid"]);
  6456. });
  6457. //根据学期查询幼儿园个人评分
  6458. router.route("/selectSETable").all((req, res, next) => {
  6459. var json = queryString(req.url);
  6460. getmysql(req, res, "selectSETable", json["uid"], json["oid"], json["org"], json["cu"]);
  6461. });
  6462. //根据学期保存幼儿园个人评分
  6463. router.route("/addSRScore").all((req, res, next) => {
  6464. var json = queryString(req.url);
  6465. getmysql(req, res, "addSRScore", json["uid"], json["j"], json["t"]);
  6466. });
  6467. //评测中心-数据
  6468. router.route("/testDataBoard").all((req, res, next) => {
  6469. var json = queryString(req.url);
  6470. getmysql(req, res, "testDataBoard", json["oid"], json["org"]);
  6471. });
  6472. //评测中心-查询用户数据
  6473. router.route("/selectTestUser").all((req, res, next) => {
  6474. var json = queryString(req.url);
  6475. getmysql(req, res, "selectTestUser", json["uid"]);
  6476. });
  6477. //评测中心-获取评测提交详情
  6478. router.route("/getTestWorks").all((req, res, next) => {
  6479. var json = queryString(req.url);
  6480. getmysql(req, res, "getTestWorks", json["cid"], json["uid"]);
  6481. });
  6482. //评测中心-获取评测提交详情
  6483. router.route("/getTestWorks2").all((req, res, next) => {
  6484. var json = queryString(req.url);
  6485. getmysql(req, res, "getTestWorks2", json["cid"], json["tid"]);
  6486. });
  6487. //评测中心-获取评测提交详情
  6488. router.route("/selectTestCourseWorks").all((req, res, next) => {
  6489. var json = queryString(req.url);
  6490. getmysql(req, res, "selectTestCourseWorks", json["cid"], json["tid"]);
  6491. });
  6492. //评测中心-获取评测提交详情
  6493. router.route("/getTestWorksPage").all((req, res, next) => {
  6494. var json = queryString(req.url);
  6495. getmysql(req, res, "getTestWorksPage", json["cid"], json["page"], json["pageSize"]);
  6496. });
  6497. //评测中心-获取评测提交详情
  6498. router.route("/getTestWorksPage3").all((req, res, next) => {
  6499. var json = queryString(req.url);
  6500. getmysql(req, res, "getTestWorksPage3", json["cid"], json["cn"], json["page"], json["pageSize"]);
  6501. });
  6502. //评测中心-获取评测提交详情
  6503. router.route("/getTestWorksNoPage").all((req, res, next) => {
  6504. var json = queryString(req.url);
  6505. getmysql(req, res, "getTestWorksNoPage", json["cid"], json["cn"]);
  6506. });
  6507. //评测中心-获取评测提交详情
  6508. router.route("/getTestWorksPage2").all((req, res, next) => {
  6509. var json = queryString(req.url);
  6510. getmysql(req, res, "getTestWorksPage2", json["cid"], json["page"], json["pageSize"]);
  6511. });
  6512. //评测中心-个人中心
  6513. router.route("/getTestWorksPerson").all((req, res, next) => {
  6514. var json = queryString(req.url);
  6515. getmysql(req, res, "getTestWorksPerson", json["uid"], json["typeid"]);
  6516. });
  6517. //查询英语写作评价模板
  6518. router.route("/selectEnglishEva").all((req, res, next) => {
  6519. var json = queryString(req.url);
  6520. getmysql(req, res, "selectEnglishEva", json["oid"]);
  6521. });
  6522. //新增英语写作评价模板
  6523. router.route("/insertEnglishEva").all((req, res, next) => {
  6524. postmysql(req, res, "insertEnglishEva");
  6525. });
  6526. //获取作业数量
  6527. router.route("/getStudentCourseWorkCount").all((req, res, next) => {
  6528. postmysql(req, res, "getStudentCourseWorkCount");
  6529. });
  6530. //获取作业数量
  6531. router.route("/getCourseWorkCount").all((req, res, next) => {
  6532. postmysql(req, res, "getCourseWorkCount");
  6533. });
  6534. //根据id查询英语写作评价模板
  6535. router.route("/selectEnglishEvaById").all((req, res, next) => {
  6536. var json = queryString(req.url);
  6537. getmysql(req, res, "selectEnglishEvaById", json["id"], json["oid"]);
  6538. });
  6539. //根据id删除1英语写作评价模板
  6540. router.route("/deleteEnglishEvaById").all((req, res, next) => {
  6541. var json = queryString(req.url);
  6542. getmysql2(req, res, "deleteEnglishEvaById", json["id"]);
  6543. });
  6544. //获取评价模板
  6545. router.route("/getCourseEvaTemplate").all((req, res, next) => {
  6546. var json = queryString(req.url);
  6547. getmysql(req, res, "getCourseEvaTemplate", json["oid"], json["org"], json["n"]);
  6548. });
  6549. //案例新项目登录接口
  6550. router.route("/loginNewEvenManage").all((req, res, next) => {
  6551. postmysql(req, res, "loginNewEvenManage");
  6552. });
  6553. //案例新项目创建用户接口
  6554. router.route("/addNewRaceUser").all((req, res, next) => {
  6555. postmysql(req, res, "addNewRaceUser");
  6556. });
  6557. //查询老师的信息
  6558. router.route("/getRaceUser1").all((req, res, next) => {
  6559. var json = queryString(req.url);
  6560. getmysql(req, res, "getRaceUser1", json["uid"]);
  6561. });
  6562. //修改用户信息
  6563. router.route("/updateRaceUser1").all((req, res, next) => {
  6564. postmysql(req, res, "updateRaceUser1");
  6565. });
  6566. /* 修改评审员 */
  6567. router.route("/updateReviewer").all((req, res, next) => {
  6568. var json = queryString(req.url);
  6569. getmysql(
  6570. req,
  6571. res,
  6572. "updateReviewer",
  6573. json["n"],
  6574. json["p"],
  6575. json["t"],
  6576. json["s"],
  6577. json["uid"]
  6578. );
  6579. });
  6580. //race 查询学校
  6581. router.route("/getSchool1").all((req, res, next) => {
  6582. var json = queryString(req.url);
  6583. getmysql(req, res, "getSchool1", json["n"]);
  6584. });
  6585. //查询赛事项目列表
  6586. router.route("/selectRaceList1").all((req, res, next) => {
  6587. var json = queryString(req.url);
  6588. getmysql(req, res, "selectRaceList1", json["uid"], json["t"], json["oid"], json["org"]);
  6589. });
  6590. //修改赛事状态
  6591. router.route("/updateRaceStateGM").all((req, res, next) => {
  6592. var json = queryString(req.url);
  6593. getmysql(req, res, "updateRaceStateGM", json["id"], json["s"]);
  6594. });
  6595. //删除1案例
  6596. router.route("/deleteAnliGM").all((req, res, next) => {
  6597. var json = queryString(req.url);
  6598. getmysql2(req, res, "deleteAnliGM", json["id"]);
  6599. });
  6600. //新增赛事项目
  6601. router.route("/addRaceGM").all((req, res, next) => {
  6602. if (req.body[0]) {
  6603. p = [
  6604. req.body[0].uid,
  6605. req.body[0].info,
  6606. req.body[0].over,
  6607. req.body[0].pro,
  6608. req.body[0].act,
  6609. req.body[0].exc,
  6610. req.body[0].res,
  6611. ];
  6612. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addRaceGM"); //執行存儲過程
  6613. mysql.usselect(p, function(ret) {
  6614. let course = req.body[0].courseType;
  6615. let courseId = ret[0][0].id;
  6616. let userid = req.body[0].uid;
  6617. delCourseType1(course, courseId, userid);
  6618. res.end(JSON.stringify({ courseId: courseId, success: 1 }));
  6619. });
  6620. }
  6621. });
  6622. //修改赛事项目
  6623. router.route("/updateRaceGM").all((req, res, next) => {
  6624. if (req.body[0]) {
  6625. p = [
  6626. req.body[0].id,
  6627. req.body[0].info,
  6628. req.body[0].over,
  6629. req.body[0].pro,
  6630. req.body[0].act,
  6631. req.body[0].exc,
  6632. req.body[0].res,
  6633. ];
  6634. p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateRaceGM"); //執行存儲過程
  6635. mysql.usselect(p, function(ret) {
  6636. let course = req.body[0].courseType;
  6637. let courseId = req.body[0].id;
  6638. let userid = req.body[0].uid;
  6639. delCourseType1(course, courseId, userid);
  6640. res.end(JSON.stringify({ success: 1 }));
  6641. });
  6642. }
  6643. });
  6644. //查询赛事项目详情
  6645. router.route("/selectRaceDetailGM").all((req, res, next) => {
  6646. var json = queryString(req.url);
  6647. getmysql(req, res, "selectRaceDetailGM", json["id"]);
  6648. });
  6649. //查询赛事分类及子分类
  6650. router.route("/selectMatTypeGM").all((req, res, next) => {
  6651. var json = queryString(req.url);
  6652. getmysql(req, res, "selectMatTypeGM");
  6653. });
  6654. //添加资源库分类
  6655. router.route("/addSourceFileType").all((req, res, next) => {
  6656. postmysql(req, res, "addSourceFileType");
  6657. });
  6658. //查询资源库分类
  6659. router.route("/getSourceFileType").all((req, res, next) => {
  6660. var json = queryString(req.url);
  6661. getmysql(req, res, "getSourceFileType", json["uid"]);
  6662. });
  6663. //删除资源库分类
  6664. router.route("/deleteSoureFileType").all((req, res, next) => {
  6665. postmysql(req, res, "deleteSoureFileType");
  6666. });
  6667. //修改资源库分类名字
  6668. router.route("/updateSourceFileName").all((req, res, next) => {
  6669. postmysql(req, res, "updateSourceFileName");
  6670. });
  6671. //修改资源库分类父级
  6672. router.route("/updateSourceFileTypePid").all((req, res, next) => {
  6673. postmysql(req, res, "updateSourceFileTypePid");
  6674. });
  6675. //添加资源库
  6676. router.route("/addSourceFile").all((req, res, next) => {
  6677. postmysql(req, res, "addSourceFile");
  6678. });
  6679. //查询资源库上传文件
  6680. router.route("/getSourceFile").all((req, res, next) => {
  6681. var json = queryString(req.url);
  6682. getmysql(req, res, "getSourceFile", json["uid"], json["pid"], json["n"]);
  6683. });
  6684. //删除资源库
  6685. router.route("/deleteSourceFile").all((req, res, next) => {
  6686. postmysql(req, res, "deleteSourceFile");
  6687. });
  6688. //移动资源库
  6689. router.route("/updateSourceFilePid").all((req, res, next) => {
  6690. postmysql(req, res, "updateSourceFilePid");
  6691. });
  6692. //查询资源库上传文件
  6693. router.route("/getCourseInfoTest").all((req, res, next) => {
  6694. var json = queryString(req.url);
  6695. getmysql(req, res, "getCourseInfoTest", json["cid"]);
  6696. });
  6697. //查看已经的作业
  6698. router.route("/selectTestWorksCid").all((req, res, next) => {
  6699. var json = queryString(req.url);
  6700. getmysql(req, res, "selectTestWorksCid", json["cid"], json["uid"]);
  6701. });
  6702. //查询资源库上传文件
  6703. router.route("/getCourseInfoTestAll").all((req, res, next) => {
  6704. var json = queryString(req.url);
  6705. getmysql(req, res, "getCourseInfoTestAll", json["cid"]);
  6706. });
  6707. //还原课程功能
  6708. router.route("/revertCourse").all((req, res, next) => {
  6709. postmysql(req, res, "revertCourse");
  6710. });
  6711. //还原课程功能
  6712. router.route("/revertCourseSz").all((req, res, next) => {
  6713. postmysql2(req, res, "revertCourse");
  6714. });
  6715. //根据课程id查询关联的表单
  6716. router.route("/selectTestCourseByCid").all((req, res, next) => {
  6717. var json = queryString(req.url);
  6718. getmysql(req, res, "selectTestCourseByCid", json["cid"]);
  6719. });
  6720. //qgt 根据用户id和文件标题获取答案来自动填写
  6721. router.route("/selectTestCourseAutoFillType3").all((req,res,next)=>{
  6722. var json = queryString(req.url);
  6723. getmysql(req, res, "selectTestCourseAutoFillType3", json["uid"],json["tit"]);
  6724. });
  6725. function generateAPIKey(username) {
  6726. let timeStamp = new Date().getTime();
  6727. let hashStr = timeStamp + username;
  6728. let digest = crypto
  6729. .createHash("sha256")
  6730. .update(hashStr, "utf8")
  6731. .digest("hex");
  6732. return digest;
  6733. }
  6734. queryString = function(url) {
  6735. var a = url.split("?");
  6736. var json = querystring.parse(a[1]);
  6737. return json;
  6738. };
  6739. //post存儲過程處理
  6740. postmysql = function(req, res, functionname) {
  6741. //mode的處理
  6742. if (req.body[0]) {
  6743. p = Object.values(req.body[0]);
  6744. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6745. //執行存儲過程
  6746. mysql.usselect(p, function(ret) {
  6747. res.end(JSON.stringify(ret));
  6748. });
  6749. }
  6750. };
  6751. //post存儲過程處理
  6752. postmysql2 = function(req, res, functionname) {
  6753. //mode的處理
  6754. if (req.body) {
  6755. p = Object.values(req.body)[0].split(",");
  6756. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6757. //執行存儲過程
  6758. mysql.usselect(p, function(ret) {
  6759. res.end(JSON.stringify(ret));
  6760. });
  6761. }
  6762. };
  6763. //post存儲過程處理
  6764. postmysql3 = function(req, res, functionname) {
  6765. //mode的處理
  6766. if (req.body) {
  6767. p = Object.values(req.body);
  6768. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6769. //執行存儲過程
  6770. mysql.usselect(p, function(ret) {
  6771. res.end(JSON.stringify(ret));
  6772. });
  6773. }
  6774. };
  6775. //get獲取數據庫信息
  6776. getmysql = function(req, res, functionname, ...p) {
  6777. p = p || [];
  6778. p.unshift(_getmysqlLabor[0], _getmysqlLabor[1], functionname);
  6779. //執行存儲過程
  6780. mysql.usselect(p, function(ret) {
  6781. res.end(JSON.stringify(ret));
  6782. }); //
  6783. };
  6784. //get獲取數據庫信息
  6785. getmysql2 = function(req, res, functionname, ...p) {
  6786. p = p || [];
  6787. p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
  6788. //執行存儲過程
  6789. mysql.usselect(p, function(ret) {
  6790. res.end(JSON.stringify(ret));
  6791. }); //
  6792. };
  6793. //post存储过程处理
  6794. userpostmysql = function(req, res, functionname) {
  6795. //mode的处理
  6796. if (req.body.mode) {
  6797. p = req.body.mode.split(",");
  6798. p.unshift(_mysqluser[0], _mysqluser[1], functionname);
  6799. //执行存储过程
  6800. mysql.usselect(p, function(ret) {
  6801. res.end(JSON.stringify(ret));
  6802. });
  6803. }
  6804. };
  6805. //get获取数据库信息
  6806. usergetmysql = function(req, res, functionname, ...p) {
  6807. p = p || [];
  6808. p.unshift(_getmysqluser[0], _getmysqluser[1], functionname);
  6809. //执行存储过程
  6810. mysql.usselect(p, function(ret) {
  6811. res.end(JSON.stringify(ret));
  6812. }); //
  6813. };
  6814. module.exports = router;