pbl.js 240 KB

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