| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112 |
- [
- {
- "id": "config_tWYTe8AA5E",
- "name": "基础框架后台服务",
- "type": "config",
- "props": {
- "style": {}
- }
- },
- {
- "id": "front_ctkTrCwYCZ",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- }
- },
- {
- "id": "backend_jzdPReGsSz",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "state_j8WNn5AEbC",
- "type": "state",
- "children": [
- {
- "id": "group_MwjTCbYw43",
- "name": "cos配置相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "variable_AfFA3mx7bR",
- "name": "cos SecretId",
- "type": "variable",
- "props": {
- "value": "AKID73j9IAl7fwwf7ICpCI7e2A2ez5uSjjSv"
- }
- },
- {
- "id": "variable_KKzzykcBtS",
- "name": "cos SecretKey",
- "type": "variable",
- "props": {
- "value": "DArHQIuGL9hyzjDRO4TcU5PTIrADJ7eu"
- }
- },
- {
- "id": "variable_5Fder6BiDX",
- "name": "cos region",
- "type": "variable",
- "props": {
- "value": "ap-beijing"
- }
- },
- {
- "id": "variable_cs76GrPQBS",
- "name": "cos bucket",
- "type": "variable",
- "props": {
- "value": "ivx-1256799882"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "services_cwPd4skP8D",
- "type": "services",
- "children": [
- {
- "id": "group_fMQ4Zx2Siy",
- "name": "缓存相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bCache_5Zik8bAEj5",
- "type": "bCache",
- "props": {}
- },
- {
- "id": "service_7w8aDmK8DS",
- "name": "获取及设置缓存",
- "type": "service",
- "props": {
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nlet inParam = param;\r\n\r\nconst 缓存名称 = param.缓存名称;\r\nconst 缓存参数 = param.查询参数;\r\nconst 缓存时间 = param.缓存时间 || 60;\r\n\r\nif(缓存参数?.token)delete 缓存参数.token;\r\n\r\nconst 缓存Key = `${缓存名称}_${encodeURI(JSON.stringify(缓存参数))}`;\r\n\r\nconsole.log('缓存Key',`${缓存名称}_${JSON.stringify(缓存参数)}`);\r\n\r\nemitter.on('getCache', async () => {\r\n //缓存获取\r\n const cacheRes = await _F('bCache_5Zik8bAEj5').callMethod('get', {\r\n key: 缓存Key\r\n }).catch((error) => {\r\n console.log('获取缓存失败',error.toString());\r\n emitter.emit('getDb');\r\n });\r\n\r\n try {\r\n if(cacheRes){\r\n console.log('获取缓存成功', cacheRes);\r\n const cacheVal = JSON.parse(cacheRes);\r\n _funcCb(cacheVal);\r\n }else{\r\n console.log('缓存不存在');\r\n emitter.emit('getDb');\r\n }\r\n \r\n } catch (error) {\r\n console.log('获取缓存失败',error.toString());\r\n emitter.emit('getDb');\r\n }\r\n\r\n});\r\n\r\nemitter.on('setCache', async (cacheVal) => {\r\n //设置缓存\r\n await _F('bCache_5Zik8bAEj5').callMethod('set', {\r\n key: 缓存Key,\r\n value: JSON.stringify(cacheVal),\r\n expire: 缓存时间\r\n }).catch((error) => {\r\n console.log('设置缓存失败');\r\n });\r\n});\r\n\r\nemitter.on('getDb', ()=>{\r\n const setCache = (data) => {\r\n emitter.emit('setCache',data);\r\n _funcCb(data);\r\n }\r\n if(typeof param.查询回调 === 'function')param.查询回调(setCache);\r\n else _funcCb(null);\r\n});\r\n\r\nemitter.emit('getCache');",
- "inParams": [
- "缓存名称",
- "查询参数",
- "查询回调",
- "缓存时间"
- ],
- "inParamsDebug": {
- "查询参数": "",
- "查询回调": "",
- "缓存名称": "",
- "缓存时间": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_drzhDzmzBS",
- "name": "请求频率控制相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bCache_PBAxP5t5SD",
- "name": "请求控制缓存",
- "type": "bCache",
- "props": {}
- },
- {
- "id": "service_7Xb7XyFRTb",
- "name": "请求频率控制",
- "type": "service",
- "props": {
- "isOpen": false,
- "isSync": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nconsole.log('请求控制.param',param);\r\n\r\nconst 请求控制秒数 = param.请求控制秒数 ? param.请求控制秒数 : 5;\r\nconst 控制服务标识 = param.控制服务标识 ? param.控制服务标识 : '';\r\nconst 用户ID = param.用户ID ? param.用户ID : '';\r\nconst 请求控制缓存Key = `userReqLimit_${控制服务标识}_${用户ID}`;\r\n\r\nconsole.log('请求控制缓存Key',请求控制缓存Key);\r\n\r\n//缓存获取\r\nconst cacheRes = await _F('bCache_PBAxP5t5SD').callMethod('get', {\r\n key: 请求控制缓存Key\r\n}).catch((error) => {\r\n console.log('获取缓存失败');\r\n _funcCb({ code: 0, errMsg: '获取缓存失败', result: {} })\r\n});\r\n\r\nif (cacheRes) _funcCb({ code: 0, errMsg: '操作太频繁', result: {} });\r\nelse {\r\n //设置缓存\r\n await _F('bCache_PBAxP5t5SD').callMethod('set', {\r\n key: 请求控制缓存Key,\r\n value: 控制服务标识,\r\n expire: parseInt(请求控制秒数)\r\n }).catch((error) => {\r\n console.log('设置缓存失败');\r\n _funcCb({ code: 0, errMsg: '设置缓存失败', result: {} })\r\n });\r\n\r\n _funcCb({ code: 200, errMsg: '请求控制缓存设置成功', result: {} });\r\n}\r\n\r\n",
- "inParams": [
- "请求控制秒数",
- "控制服务标识",
- "用户ID"
- ],
- "isMiddle": false,
- "inParamsDebug": {
- "用户ID": "2",
- "控制服务标识": "xxx",
- "请求控制秒数": "3"
- }
- }
- },
- {
- "id": "service_ZpjSybt7r2",
- "name": "请求控制测试服务",
- "type": "service",
- "props": {
- "isOpen": true,
- "isSync": true,
- "jsCode": "const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n \"请求控制秒数\": \"15\",\r\n \"控制服务标识\": \"service_ZpjSybt7r2\",\r\n \"用户ID\": 33,\r\n})\r\n\r\n_funcCb(reqRes);",
- "openApiPath": "req/limit/test"
- }
- }
- ]
- },
- {
- "id": "group_6eFT4QWGKS",
- "name": "中间件相关",
- "type": "group",
- "props": {
- "devId": "group_6eFT4QWGKS"
- },
- "children": [
- {
- "id": "service_iGm76di4Ky",
- "name": "员工登录检测中间件",
- "type": "service",
- "props": {
- "devId": "service_iGm76di4Ky",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\nlet condition = {};\r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('service_Skm27cT882').call({\r\n token: param.token,\r\n },(res)=>{\r\n //console.log('getUserInfo',res);\r\n if(res.code == 200){\r\n _F('middle_func').callMethod('next',res.result);\r\n }\r\n else _funcCb(res);\r\n })\r\n});\r\n\r\n\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "isMiddle": true,
- "outParams": [],
- "middlePath": "v1/admin",
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_zkYrj5fZGA",
- "name": "用户小程序登录检测中间件",
- "type": "service",
- "props": {
- "devId": "service_zkYrj5fZGA",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\nlet condition = {};\r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('service_Ym7XyfYNkf').call({\r\n token: param.token,\r\n },(res)=>{\r\n //console.log('getUserInfo',res);\r\n if(res.code == 200){\r\n _F('middle_func').callMethod('next',res.result);\r\n }\r\n else _funcCb(res);\r\n })\r\n});\r\n\r\n\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "isMiddle": true,
- "outParams": [],
- "middlePath": "v1/mini/user",
- "openApiPath": "",
- "inParamsDebug": {
- "token": "o3eT3rBB1UiWGH7Mm0HboplLIYE6KSCD"
- }
- }
- }
- ]
- },
- {
- "id": "group_2ZJb6TyeKk",
- "name": "管理后台框架相关",
- "type": "group",
- "props": {
- "devId": "group_2ZJb6TyeKk"
- },
- "children": [
- {
- "id": "group_kMTbkKi8iK",
- "name": "员工中台相关",
- "type": "group",
- "props": {
- "devId": "group_kMTbkKi8iK"
- },
- "children": [
- {
- "id": "bComponent_ixwS77E2Mw",
- "name": "员工中台组件",
- "type": "bComponent",
- "props": {
- "attr": [
- {
- "attrId": "variable_GP2sBWntRd",
- "attrType": "string",
- "attrValue": "n925_staff_",
- "attrJsCode": ""
- }
- ],
- "devId": "bComponent_ixwS77E2Mw",
- "moduleId": "module_SQHw2mER25",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_6xG6thEJQS",
- "tableId": "dbTable_hdbHcrwH23"
- },
- {
- "tempId": "dbViewTemp_R34dNixksn",
- "tableId": "dbView_3i5A4HYEaS"
- }
- ],
- "bCacheConnect": [
- {
- "tempId": "bCacheTemp_wJfaNQwj3d",
- "bCacheId": "bCache_H2Ey7Dih53"
- }
- ]
- }
- },
- {
- "id": "group_4RXZiyttzj",
- "name": "api相关",
- "type": "group",
- "props": {
- "devId": "group_4RXZiyttzj"
- },
- "children": [
- {
- "id": "service_s5y2wckW6G",
- "name": "员工关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_s5y2wckW6G",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nparam.显示关联 = 1;\r\n\r\nemitter.on('getUserList', ()=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_JT4zdxjSc6',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserList');",
- "inParams": [
- "pageNum",
- "pageSize",
- "部门ID",
- "角色ID",
- "关键字",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/staff/search",
- "inParamsDebug": {
- "关键字": "xxx.com",
- "是否删除": ""
- }
- }
- },
- {
- "id": "service_mXRwwYDWQz",
- "name": "禁用员工",
- "type": "service",
- "props": {
- "devId": "service_mXRwwYDWQz",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('editUser', (userId)=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_bazaCNCCK3',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\n//let userInfo = _F('middle_func').callMethod('last');\r\nemitter.emit('editUser',param.用户ID);",
- "inParams": [
- "员工ID",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/staff/stop",
- "inParamsDebug": {
- "员工ID": "1",
- "是否禁用": "0"
- }
- }
- },
- {
- "id": "service_HJ7dGEJNYz",
- "name": "删除员工",
- "type": "service",
- "props": {
- "devId": "service_HJ7dGEJNYz",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('editUser', (userId)=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_PQd7Zr4nK6',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\n//let userInfo = _F('middle_func').callMethod('last');\r\nemitter.emit('editUser',param.用户ID);",
- "inParams": [
- "员工ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/staff/del",
- "inParamsDebug": {
- "员工ID": "1",
- "是否删除": "0"
- }
- }
- },
- {
- "id": "service_CkhyA3FBeF",
- "name": "编辑员工信息",
- "type": "service",
- "props": {
- "devId": "service_CkhyA3FBeF",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('editUser', (userId)=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_7PnxyXDPAT',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\n//let userInfo = _F('middle_func').callMethod('last');\r\nemitter.emit('editUser',param.用户ID);",
- "inParams": [
- "员工ID",
- "姓名",
- "角色ID",
- "部门ID",
- "邮箱",
- "手机号",
- "用户名"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/staff/edit",
- "inParamsDebug": {
- "姓名": "",
- "邮箱": "",
- "员工ID": "1",
- "角色ID": "1",
- "部门ID": "1",
- "手机号": "",
- "用户名": ""
- }
- }
- },
- {
- "id": "service_z7BMJtSeRG",
- "name": "员工用户名密码登录",
- "type": "service",
- "props": {
- "devId": "service_z7BMJtSeRG",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_DE3rN7bad6',{\r\n inParam:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n\t\t\t\t使用cookie:param.使用cookie==false?0:1,\r\n\t\t\t\tcookie域名:param.cookie域名,\r\n 登录有效时长:3600 * 24,\r\n\t\t\t\t允许多端登录:1,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码",
- "cookie域名",
- "使用cookie"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/staff/login",
- "inParamsDebug": {
- "密码": "123123",
- "用户名": "张学友",
- "cookie域名": ".devstudio.aliyuncs.com",
- "使用cookie": "1"
- }
- }
- },
- {
- "id": "service_WjjfcXy7h2",
- "name": "员工用户名密码注册",
- "type": "service",
- "props": {
- "devId": "service_WjjfcXy7h2",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_5xT7BspmbA',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码",
- "姓名",
- "角色ID",
- "部门ID",
- "邮箱",
- "手机号"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/admin/staff/reg",
- "inParamsDebug": {
- "姓名": "超级管理员",
- "密码": "123123",
- "用户名": "超级管理员"
- }
- }
- },
- {
- "id": "service_Skm27cT882",
- "name": "获取员工登录信息",
- "type": "service",
- "props": {
- "devId": "service_Skm27cT882",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_8rNTjXTpbf',{\r\n inParam:{\r\n token: param.token,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/admin/staff/logined/info",
- "inParamsDebug": {
- "token": "zrlHaNgH4nMb9HXk2XlJtGv4aBRQ3hrw"
- }
- }
- },
- {
- "id": "service_SdiRyy5Tz6",
- "name": "员工退出登录",
- "type": "service",
- "props": {
- "devId": "service_SdiRyy5Tz6",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('delUserInfo', ()=>{\r\n _F('bComponent_ixwS77E2Mw').callMethod('service_hB82nRtmDR',{\r\n inParam:{\r\n token: param.token,\r\n\t\t\t\tcookie域名:'.devstudio.aliyuncs.com',\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/admin/staff/logout",
- "inParamsDebug": {}
- }
- }
- ]
- },
- {
- "id": "group_Rr8kThAAic",
- "name": "数据库相关",
- "type": "group",
- "props": {
- "devId": "group_Rr8kThAAic"
- },
- "children": [
- {
- "id": "dbTable_hdbHcrwH23",
- "name": "员工表",
- "type": "dbTable",
- "props": {
- "devId": "dbTable_hdbHcrwH23",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "用户名",
- "columnType": "text"
- },
- {
- "columnName": "手机号",
- "columnType": "text"
- },
- {
- "columnName": "邮箱",
- "columnType": "text"
- },
- {
- "columnName": "昵称",
- "columnType": "text"
- },
- {
- "columnName": "姓名",
- "columnType": "text"
- },
- {
- "columnName": "密码",
- "columnType": "text"
- },
- {
- "columnName": "角色ID",
- "columnType": "int"
- },
- {
- "columnName": "部门ID",
- "columnType": "int"
- },
- {
- "columnName": "是否禁用",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "bCache_H2Ey7Dih53",
- "name": "用户登录信息缓存",
- "type": "bCache",
- "props": {
- "devId": "bCache_H2Ey7Dih53"
- }
- },
- {
- "id": "dbView_3i5A4HYEaS",
- "name": "员工列表视图",
- "type": "dbView",
- "props": {
- "devId": "dbView_3i5A4HYEaS",
- "columns": [
- {
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "condition": []
- },
- "columnName": "*",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_hdbHcrwH23",
- "tField": "*"
- }
- },
- {
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "condition": []
- },
- "columnName": "部门名称",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_27HfwMiSTt",
- "tField": "部门名称"
- }
- },
- {
- "joinParam": {
- "lTName": "dbTable_hdbHcrwH23",
- "rTName": "dbTable_27HfwMiSTt",
- "lTField": "部门ID",
- "rTField": "_id",
- "condition": []
- },
- "columnName": "部门ID关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": ""
- }
- },
- {
- "joinParam": {
- "lTName": "dbTable_hdbHcrwH23",
- "rTName": "dbTable_iHj2cMawrr",
- "lTField": "角色ID",
- "rTField": "_id",
- "condition": []
- },
- "columnName": "角色ID关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": ""
- }
- },
- {
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "condition": []
- },
- "columnName": "角色名称",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_iHj2cMawrr",
- "tField": "角色名称"
- }
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_Xw6QKB744N",
- "name": "菜单中台相关",
- "type": "group",
- "props": {
- "devId": "group_Xw6QKB744N"
- },
- "children": [
- {
- "id": "bComponent_bJiEYkYtPn",
- "name": "菜单管理后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_bJiEYkYtPn",
- "moduleId": "module_FBsbDYPT8B",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_EtNEzKsaYk"
- }
- ]
- }
- },
- {
- "id": "group_Pt2JYJmKTN",
- "name": "api相关",
- "type": "group",
- "props": {
- "devId": "group_Pt2JYJmKTN"
- },
- "children": [
- {
- "id": "service_3t5ecYRD7J",
- "name": "菜单关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_3t5ecYRD7J",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('菜单名称'))inParam['菜单名称'] = param.菜单名称;\r\nif(param.hasOwnProperty('上级菜单ID'))inParam['上级菜单ID'] = param.上级菜单ID;\r\nif(param.hasOwnProperty('当前页码'))inParam['当前页码'] = param.当前页码;\r\nif(param.hasOwnProperty('每页大小'))inParam['每页大小'] = param.每页大小;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_bJiEYkYtPn').callMethod('service_zYN6Kpynpy',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "菜单名称",
- "上级菜单ID",
- "当前页码",
- "每页大小",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/menu/search",
- "inParamsDebug": {
- "上级菜单ID": "all"
- }
- }
- },
- {
- "id": "service_6JPfXkCpiH",
- "name": "菜单删除服务",
- "type": "service",
- "props": {
- "devId": "service_6JPfXkCpiH",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('菜单ID'))inParam['菜单ID'] = param.菜单ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_bJiEYkYtPn').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "菜单ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/menu/del",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_FtdGdw5G5Z",
- "name": "菜单新增服务",
- "type": "service",
- "props": {
- "devId": "service_FtdGdw5G5Z",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_bJiEYkYtPn').callMethod('service_jQ4AEAwPSy',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');",
- "inParams": [
- "菜单名称",
- "上级菜单ID",
- "类型",
- "排序",
- "页面路径",
- "接口路径",
- "key"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/menu/add",
- "inParamsDebug": {
- "key": "system_menu",
- "排序": "600",
- "类型": "页面",
- "菜单名称": "菜单管理",
- "部门名称": "多八多总部",
- "页面路径": "/admin/system/menu",
- "上级菜单ID": "1",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_r7fD7G6dwQ",
- "name": "菜单编辑服务",
- "type": "service",
- "props": {
- "devId": "service_r7fD7G6dwQ",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_bJiEYkYtPn').callMethod('service_cF6TRXP68X',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "菜单ID",
- "菜单名称",
- "上级菜单ID",
- "是否禁用",
- "是否删除",
- "类型",
- "排序",
- "页面路径",
- "接口路径",
- "key"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/menu/edit",
- "inParamsDebug": {
- "菜单ID": "6",
- "部门ID": "1",
- "是否删除": "",
- "是否禁用": "",
- "部门名称": "多八多总部2",
- "上级菜单ID": "0",
- "上级部门ID": "0"
- }
- }
- }
- ]
- },
- {
- "id": "group_G53bPSRtKQ",
- "name": "数据库相关",
- "type": "group",
- "props": {
- "devId": "group_G53bPSRtKQ"
- },
- "children": [
- {
- "id": "dbTable_EtNEzKsaYk",
- "name": "菜单表",
- "type": "dbTable",
- "props": {
- "devId": "dbTable_EtNEzKsaYk",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "key",
- "columnType": "text"
- },
- {
- "columnName": "菜单名称",
- "columnType": "text"
- },
- {
- "columnName": "上级菜单ID",
- "columnType": "text"
- },
- {
- "columnName": "类型",
- "columnType": "text"
- },
- {
- "columnName": "排序",
- "columnType": "int"
- },
- {
- "columnName": "页面路径",
- "columnType": "text"
- },
- {
- "columnName": "接口路径",
- "columnType": "text"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_3RnxpS8ibY",
- "name": "角色中台相关",
- "type": "group",
- "props": {
- "devId": "group_3RnxpS8ibY"
- },
- "children": [
- {
- "id": "bComponent_A5KPDe2K5M",
- "name": "角色管理后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_A5KPDe2K5M",
- "moduleId": "module_fNRWBJ426W",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_iHj2cMawrr"
- }
- ]
- }
- },
- {
- "id": "group_7rBcrQX748",
- "name": "api相关",
- "type": "group",
- "props": {
- "devId": "group_7rBcrQX748"
- },
- "children": [
- {
- "id": "service_XcwkicXF2d",
- "name": "角色关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_XcwkicXF2d",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('角色名称'))inParam['角色名称'] = param.角色名称;\r\nif(param.hasOwnProperty('当前页码'))inParam['当前页码'] = param.当前页码;\r\nif(param.hasOwnProperty('每页大小'))inParam['每页大小'] = param.每页大小;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_A5KPDe2K5M').callMethod('service_zYN6Kpynpy',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "角色名称",
- "当前页码",
- "每页大小",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/search",
- "inParamsDebug": {
- "上级菜单ID": "all"
- }
- }
- },
- {
- "id": "service_J6ciGBd2kf",
- "name": "角色删除服务",
- "type": "service",
- "props": {
- "devId": "service_J6ciGBd2kf",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('角色ID'))inParam['角色ID'] = param.角色ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_A5KPDe2K5M').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "角色ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/del",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_Ty8QksQJaE",
- "name": "角色新增服务",
- "type": "service",
- "props": {
- "devId": "service_Ty8QksQJaE",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_A5KPDe2K5M').callMethod('service_jQ4AEAwPSy',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');",
- "inParams": [
- "角色名称",
- "菜单IDs"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/add",
- "inParamsDebug": {
- "部门名称": "多八多总部",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_jD3Myn6WHG",
- "name": "角色编辑服务",
- "type": "service",
- "props": {
- "devId": "service_jD3Myn6WHG",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_A5KPDe2K5M').callMethod('service_cF6TRXP68X',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "角色ID",
- "角色名称",
- "菜单IDs",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/edit",
- "inParamsDebug": {
- "菜单ID": "6",
- "部门ID": "1",
- "是否删除": "",
- "是否禁用": "",
- "部门名称": "多八多总部2",
- "上级菜单ID": "0",
- "上级部门ID": "0"
- }
- }
- }
- ]
- },
- {
- "id": "group_NBcdD4mHhM",
- "name": "数据库相关",
- "type": "group",
- "props": {
- "devId": "group_NBcdD4mHhM"
- },
- "children": [
- {
- "id": "dbTable_iHj2cMawrr",
- "name": "角色表",
- "type": "dbTable",
- "props": {
- "devId": "dbTable_iHj2cMawrr",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "角色名称",
- "columnType": "text"
- },
- {
- "columnName": "菜单IDs",
- "columnType": "json"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_b587tD2T78",
- "name": "部门中台相关",
- "type": "group",
- "props": {
- "devId": "group_b587tD2T78"
- },
- "children": [
- {
- "id": "bComponent_nQ8HKdd4cT",
- "name": "部门编辑后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_nQ8HKdd4cT",
- "moduleId": "module_C8GjKaaHBs",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_27HfwMiSTt"
- }
- ]
- }
- },
- {
- "id": "group_7sNkDzW5BS",
- "name": "api相关",
- "type": "group",
- "props": {
- "devId": "group_7sNkDzW5BS"
- },
- "children": [
- {
- "id": "service_eymdXAJHNA",
- "name": "部门关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_eymdXAJHNA",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('部门名称'))inParam['部门名称'] = param.部门名称;\r\nif(param.hasOwnProperty('上级部门ID'))inParam['上级部门ID'] = param.上级部门ID;\r\nif(param.hasOwnProperty('当前页码'))inParam['当前页码'] = param.当前页码;\r\nif(param.hasOwnProperty('每页大小'))inParam['每页大小'] = param.每页大小;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_nQ8HKdd4cT').callMethod('service_zYN6Kpynpy',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "部门名称",
- "上级部门ID",
- "当前页码",
- "每页大小",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/dept/search",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_abRrAnRzSD",
- "name": "部门删除服务",
- "type": "service",
- "props": {
- "devId": "service_abRrAnRzSD",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('部门ID'))inParam['部门ID'] = param.部门ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_nQ8HKdd4cT').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "部门ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/dept/del",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_BBajpw3kXs",
- "name": "部门新增服务",
- "type": "service",
- "props": {
- "devId": "service_BBajpw3kXs",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_nQ8HKdd4cT').callMethod('service_jQ4AEAwPSy',{\r\n inParam:{\r\n 部门名称: param.部门名称,\r\n 上级部门ID: param.上级部门ID,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');",
- "inParams": [
- "部门名称",
- "上级部门ID"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/dept/add",
- "inParamsDebug": {
- "部门名称": "多八多总部",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_SkW7dYZHe2",
- "name": "部门编辑服务",
- "type": "service",
- "props": {
- "devId": "service_SkW7dYZHe2",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('部门ID'))inParam['部门ID'] = param.部门ID;\r\nif(param.hasOwnProperty('部门名称'))inParam['部门名称'] = param.部门名称;\r\nif(param.hasOwnProperty('上级部门ID'))inParam['上级部门ID'] = param.上级部门ID;\r\nif(param.hasOwnProperty('是否禁用'))inParam['是否禁用'] = param.是否禁用 == 1?1:0;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_nQ8HKdd4cT').callMethod('service_cF6TRXP68X',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "部门ID",
- "部门名称",
- "上级部门ID",
- "是否禁用",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/dept/edit",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "总部",
- "上级部门ID": "0"
- }
- }
- }
- ]
- },
- {
- "id": "group_w38DGdWw6H",
- "name": "数据库相关",
- "type": "group",
- "props": {
- "devId": "group_w38DGdWw6H"
- },
- "children": [
- {
- "id": "dbTable_27HfwMiSTt",
- "name": "部门表",
- "type": "dbTable",
- "props": {
- "devId": "dbTable_27HfwMiSTt",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "部门名称",
- "columnType": "text"
- },
- {
- "columnName": "上级部门ID",
- "columnType": "text"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_2BEJfDwNxw",
- "name": "用户中台相关",
- "type": "group",
- "props": {
- "devId": "group_2BEJfDwNxw"
- },
- "children": [
- {
- "id": "bComponent_dbwbpXWs3P",
- "name": "用户中台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_dbwbpXWs3P",
- "moduleId": "module_Rn2saN62Y8",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_6xG6thEJQS",
- "tableId": "dbTable_nhr7fMnmKE"
- }
- ],
- "bCacheConnect": [
- {
- "tempId": "bCacheTemp_wJfaNQwj3d",
- "bCacheId": "bCache_mZzh8THMJd"
- }
- ]
- }
- },
- {
- "id": "group_xZZbaimRkc",
- "name": "前台api",
- "type": "group",
- "props": {
- "devId": "group_xZZbaimRkc"
- },
- "children": [
- {
- "id": "service_ZkhdCsahs4",
- "name": "组件用户密码登录",
- "type": "service",
- "props": {
- "devId": "service_ZkhdCsahs4",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_dbwbpXWs3P').callMethod('service_DE3rN7bad6',{\r\n inParam:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n\t\t\t\t使用cookie:param.使用cookie==false?0:1,\r\n\t\t\t\tcookie域名:param.cookie域名,\r\n 登录有效时长:3600 * 24,\r\n\t\t\t\t允许多端登录:1,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码",
- "cookie域名",
- "使用cookie"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/user/login",
- "inParamsDebug": {
- "密码": "123123",
- "用户名": "13800138000",
- "cookie域名": ".devstudio.aliyuncs.com",
- "使用cookie": "1"
- }
- }
- },
- {
- "id": "service_T3wf7xG4wN",
- "name": "组件用户密码注册",
- "type": "service",
- "props": {
- "devId": "service_T3wf7xG4wN",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_dbwbpXWs3P').callMethod('service_5xT7BspmbA',{\r\n inParam:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/user/reg",
- "inParamsDebug": {
- "密码": "123123",
- "用户名": "13800138000"
- }
- }
- },
- {
- "id": "service_s8WQ4km4c3",
- "name": "组件获取用户登录信息",
- "type": "service",
- "props": {
- "devId": "service_s8WQ4km4c3",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_dbwbpXWs3P').callMethod('service_8rNTjXTpbf',{\r\n inParam:{\r\n token: param.token,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/user/logined/info",
- "inParamsDebug": {
- "token": "zrlHaNgH4nMb9HXk2XlJtGv4aBRQ3hrw"
- }
- }
- },
- {
- "id": "service_GjMdGAeYR8",
- "name": "组件用户退出登录",
- "type": "service",
- "props": {
- "devId": "service_GjMdGAeYR8",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('delUserInfo', ()=>{\r\n _F('bComponent_dbwbpXWs3P').callMethod('service_hB82nRtmDR',{\r\n inParam:{\r\n token: param.token,\r\n\t\t\t\tcookie域名:'.devstudio.aliyuncs.com',\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/user/logout",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_zz8PfZQRQG",
- "name": "编辑用户信息",
- "type": "service",
- "props": {
- "devId": "service_zz8PfZQRQG",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('editUser', (userId)=>{\r\n _F('bComponent_dbwbpXWs3P').callMethod('service_amBQpHZ56h',{\r\n inParam:{\r\n 用户ID: userId,\r\n 昵称: param.昵称,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nlet userInfo = _F('middle_func').callMethod('last');\r\nemitter.emit('editUser',userInfo._id);",
- "inParams": [
- "昵称"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/mine/user/edit",
- "inParamsDebug": {}
- }
- }
- ]
- },
- {
- "id": "group_Bxrmyp7RKj",
- "name": "数据库相关",
- "type": "group",
- "props": {
- "devId": "group_Bxrmyp7RKj"
- },
- "children": [
- {
- "id": "dbTable_nhr7fMnmKE",
- "name": "用户表",
- "type": "dbTable",
- "props": {
- "devId": "dbTable_nhr7fMnmKE",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "用户名",
- "columnType": "text"
- },
- {
- "columnName": "手机号",
- "columnType": "text"
- },
- {
- "columnName": "昵称",
- "columnType": "text"
- },
- {
- "columnName": "密码",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "bCache_mZzh8THMJd",
- "name": "用户登录信息缓存",
- "type": "bCache",
- "props": {
- "devId": "bCache_mZzh8THMJd"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_ZMjZ54ZwwS",
- "name": "分类中台相关",
- "type": "group",
- "props": {
- "devId": "group_ZMjZ54ZwwS"
- },
- "children": [
- {
- "id": "bComponent_DeYT3tRNET",
- "name": "分类编辑后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_DeYT3tRNET",
- "moduleId": "module_iCEhkHXdGz",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": ""
- }
- ]
- }
- },
- {
- "id": "group_e25HaBcAA8",
- "name": "api相关",
- "type": "group",
- "props": {
- "devId": "group_e25HaBcAA8"
- },
- "children": [
- {
- "id": "service_E34TDiwH6m",
- "name": "分类关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_E34TDiwH6m",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('分类名称'))inParam['分类名称'] = param.分类名称;\r\nif(param.hasOwnProperty('上级分类ID'))inParam['上级分类ID'] = param.上级分类ID;\r\nif(param.hasOwnProperty('当前页码'))inParam['当前页码'] = param.当前页码;\r\nif(param.hasOwnProperty('每页大小'))inParam['每页大小'] = param.每页大小;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_DeYT3tRNET').callMethod('service_zYN6Kpynpy',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "分类名称",
- "上级分类ID",
- "当前页码",
- "每页大小",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/point_class/search",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_zz2Ha87iS4",
- "name": "分类删除服务",
- "type": "service",
- "props": {
- "devId": "service_zz2Ha87iS4",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('分类ID'))inParam['分类ID'] = param.分类ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_DeYT3tRNET').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "分类ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/point_class/del",
- "inParamsDebug": {
- "分类ID": "1",
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_BraRYbRnRY",
- "name": "分类新增服务",
- "type": "service",
- "props": {
- "devId": "service_BraRYbRnRY",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_DeYT3tRNET').callMethod('service_jQ4AEAwPSy',{\r\n inParam:{\r\n 分类名称: param.分类名称,\r\n 上级分类ID: param.上级分类ID,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');",
- "inParams": [
- "分类名称",
- "上级分类ID"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/point_class/add",
- "inParamsDebug": {
- "分类名称": "安全积分",
- "部门名称": "多八多总部",
- "上级分类ID": "0",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_X85AxF2pZw",
- "name": "分类编辑服务",
- "type": "service",
- "props": {
- "devId": "service_X85AxF2pZw",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_DeYT3tRNET').callMethod('service_cF6TRXP68X',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "分类ID",
- "分类名称",
- "上级分类ID",
- "是否禁用",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/point_class/edit",
- "inParamsDebug": {
- "分类ID": "1",
- "部门ID": "1",
- "分类名称": "临时积分",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级分类ID": "0",
- "上级部门ID": "0"
- }
- }
- }
- ]
- },
- {
- "id": "group_cfFd2CMdNz",
- "name": "数据库相关",
- "type": "group",
- "props": {
- "devId": "group_cfFd2CMdNz"
- },
- "children": [
- {
- "id": "dbTable_7FS4dn5YHj",
- "name": "分类表",
- "type": "dbTable",
- "props": {
- "devId": "dbTable_7FS4dn5YHj",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "分类名称",
- "columnType": "text"
- },
- {
- "columnName": "上级分类ID",
- "columnType": "text"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_7xHpR4TAk2",
- "name": "广告中台相关",
- "type": "group",
- "props": {
- "devId": "group_7xHpR4TAk2"
- },
- "children": [
- {
- "id": "bComponent_QPh7NtTCfp",
- "name": "广告管理后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_QPh7NtTCfp",
- "moduleId": "module_3GdzS7iAEJ",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_kTF3TXAEEB"
- },
- {
- "tempId": "dbTableTemp_DeEzJeMkjd",
- "tableId": "dbTable_xSTwEQ32HH"
- },
- {
- "tempId": "dbTableTemp_pTM2d2xs45",
- "tableId": "dbTable_XdneF2SM7h"
- },
- {
- "tempId": "dbTableTemp_Gf83SMhtNs",
- "tableId": "dbTable_DywGDZA3mJ"
- }
- ]
- }
- },
- {
- "id": "group_fcC4GjwW2i",
- "name": "小程序api相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_4NACTMSGWk",
- "name": "广告关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_4NACTMSGWk",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_QPh7NtTCfp').callMethod('service_nwS5JzCrxZ',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/ad/search",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_nzrcQkRXFX",
- "name": "管理后台api相关",
- "type": "group",
- "props": {
- "devId": "group_nzrcQkRXFX"
- },
- "children": [
- {
- "id": "service_DG2zNxTXyD",
- "name": "广告关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_DG2zNxTXyD",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_QPh7NtTCfp').callMethod('service_nwS5JzCrxZ',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/ad/search",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- },
- {
- "id": "service_D2SxEJ7Fkc",
- "name": "角色删除服务",
- "type": "service",
- "props": {
- "devId": "service_D2SxEJ7Fkc",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('角色ID'))inParam['角色ID'] = param.角色ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_QPh7NtTCfp').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "角色ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/del",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_tyKb8rdTk2",
- "name": "广告编辑服务",
- "type": "service",
- "props": {
- "devId": "service_tyKb8rdTk2",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_QPh7NtTCfp').callMethod('service_MjCiFc8xna',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "广告ID",
- "广告位ID",
- "链接地址",
- "图片地址"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/ad/edit",
- "inParamsDebug": {
- "广告ID": "",
- "广告位ID": "",
- "图片地址": "",
- "链接地址": ""
- }
- }
- },
- {
- "id": "service_mRpFsiidkY",
- "name": "广告新增服务",
- "type": "service",
- "props": {
- "devId": "service_mRpFsiidkY",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_QPh7NtTCfp').callMethod('service_PeFDMcznnm',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');\r\n",
- "inParams": [
- "广告位ID",
- "链接地址",
- "图片地址"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/ad/add",
- "inParamsDebug": {
- "广告位ID": "",
- "图片地址": "",
- "链接地址": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_x7daMiQxNQ",
- "name": "数据表相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "dbTable_DywGDZA3mJ",
- "name": "广告表",
- "type": "dbTable",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "广告位ID",
- "columnType": "int"
- },
- {
- "columnName": "链接地址",
- "columnType": "text"
- },
- {
- "columnName": "图片地址",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "group_zjbGj4Qi2c",
- "name": "用户相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bComponent_3QDpwPzfJh",
- "name": "用户中台组件",
- "type": "bComponent",
- "props": {
- "moduleId": "module_Rn2saN62Y8",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_6xG6thEJQS",
- "tableId": "dbTable_54DZwzihAy"
- }
- ],
- "bCacheConnect": [
- {
- "tempId": "bCacheTemp_wJfaNQwj3d",
- "bCacheId": "bCache_E43WZB3276"
- }
- ]
- }
- },
- {
- "id": "group_8TSZCyFfPd",
- "name": "小程序api",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_2xday3FbFe",
- "name": "用户openid密码注册及登录",
- "type": "service",
- "props": {
- "devId": "service_2xday3FbFe",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3QDpwPzfJh').callMethod('service_DTz27rE4GR',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "openid",
- "密码"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "service_2xday3FbFe",
- "inParamsDebug": {
- "openid": "oPC5r5bZArKsVFeH4I7fO1p1y4yk",
- "姓名": "超级管理员",
- "密码": "123123",
- "用户名": "超级管理员"
- }
- }
- },
- {
- "id": "service_kp2PEdfefX",
- "name": "openid登录",
- "type": "service",
- "props": {
- "devId": "service_kp2PEdfefX",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3QDpwPzfJh').callMethod('service_edcBYDzKcE',{\r\n inParam:{\r\n openid: param.openid,\r\n\t\t\t\t使用cookie:param.使用cookie==false?0:1,\r\n\t\t\t\tcookie域名:param.cookie域名,\r\n 登录有效时长:3600 * 24 * 10,\r\n\t\t\t\t允许多端登录:1,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "openid",
- "cookie域名",
- "使用cookie"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "service_kp2PEdfefX",
- "inParamsDebug": {
- "openid": "oPC5r5bZArKsVFeH4I7fO1p1y4yk",
- "密码": "123123",
- "用户名": "13800138000",
- "cookie域名": ".devstudio.aliyuncs.com",
- "使用cookie": "0"
- }
- }
- },
- {
- "id": "service_Ym7XyfYNkf",
- "name": "获取用户登录信息",
- "type": "service",
- "props": {
- "devId": "service_Ym7XyfYNkf",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3QDpwPzfJh').callMethod('service_8rNTjXTpbf',{\r\n inParam:{\r\n token: param.token,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/mini/logined/info",
- "inParamsDebug": {
- "token": "HBINJdWdXUoszV46BES0tdcWJD2Gru17"
- }
- }
- },
- {
- "id": "service_nkWQS65mJQ",
- "name": "更新用户手机号",
- "type": "service",
- "props": {
- "devId": "service_nkWQS65mJQ",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3QDpwPzfJh').callMethod('service_amBQpHZ56h',{\r\n inParam:param,\r\n callback:(data)=>{\r\n //_funcCb(data);\r\n emitter.emit('mobileLogin');\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.on('mobileLogin', () => {\r\n _F('service_wS7EfNXKyH').call({ 手机号:param.手机号 }, (data) => {\r\n _funcCb(data);\r\n });\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户ID",
- "手机号"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "service_nkWQS65mJQ",
- "inParamsDebug": {
- "用户ID": "1",
- "手机号": "13900139000"
- }
- }
- },
- {
- "id": "service_wS7EfNXKyH",
- "name": "手机号登录",
- "type": "service",
- "props": {
- "devId": "service_wS7EfNXKyH",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3QDpwPzfJh').callMethod('service_c2SDBJeYBs',{\r\n inParam:{\r\n 手机号: param.手机号,\r\n\t\t\t\t使用cookie:0,\r\n\t\t\t\tcookie域名:param.cookie域名,\r\n 登录有效时长:3600 * 24 * 10,\r\n\t\t\t\t允许多端登录:0,\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "手机号",
- "cookie域名",
- "使用cookie"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "service_wS7EfNXKyH",
- "inParamsDebug": {
- "openid": "oPC5r5bZArKsVFeH4I7fO1p1y4yk",
- "密码": "123123",
- "用户名": "13800138000",
- "cookie域名": ".devstudio.aliyuncs.com",
- "使用cookie": "0"
- }
- }
- }
- ]
- },
- {
- "id": "group_TPtW7z3Xbn",
- "name": "数据表",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bCache_E43WZB3276",
- "name": "用户登录信息缓存",
- "type": "bCache",
- "props": {}
- },
- {
- "id": "dbTable_54DZwzihAy",
- "name": "用户表",
- "type": "dbTable",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "用户名",
- "columnType": "text"
- },
- {
- "columnName": "手机号",
- "columnType": "text"
- },
- {
- "columnName": "openid",
- "columnType": "text"
- },
- {
- "columnName": "昵称",
- "columnType": "text"
- },
- {
- "columnName": "密码",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_yrdDCNCXHZ",
- "name": "微信小程序相关",
- "type": "group",
- "props": {
- "devId": "group_yrdDCNCXHZ"
- },
- "children": [
- {
- "id": "bComponent_3XnF6CPCPb",
- "name": "微信小程序后台服务组件",
- "type": "bComponent",
- "props": {
- "attr": [
- {
- "attrId": "variable_hQPh5XXb7r",
- "attrType": "string",
- "attrValue": "wxfea9bdc8104eede9",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_FS858Nw8zp",
- "attrType": "string",
- "attrValue": "a397f38085dad044f1309921e0ea3d3c",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_rdHsEMsaxT",
- "attrType": "string",
- "attrValue": "a397f38085dad044f1309921e0ea3d3c",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_PW6x3zcJxP",
- "attrType": "string",
- "attrValue": "wxfea9bdc8104eede9",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_f2dzhTjDPA",
- "attrType": "string",
- "attrValue": "a397f38085dad044f1309921e0ea3d3c",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_y3XJtNPm74",
- "attrType": "string",
- "attrValue": "wxfea9bdc8104eede9",
- "attrJsCode": ""
- }
- ],
- "devId": "bComponent_3XnF6CPCPb",
- "moduleId": "module_Pj3CGzPFxA",
- "bCacheConnect": [
- {
- "tempId": "bCacheTemp_i326Wbnmrd",
- "bCacheId": "bCache_2kyhtca3jC"
- },
- {
- "tempId": "bCacheTemp_ij3SB8mrTY",
- "bCacheId": "bCache_2kyhtca3jC"
- },
- {
- "tempId": "bCacheTemp_QcXEkT3pzc",
- "bCacheId": "bCache_2kyhtca3jC"
- }
- ]
- }
- },
- {
- "id": "group_eh8tpZxmZc",
- "name": "缓存相关",
- "type": "group",
- "props": {
- "devId": "group_eh8tpZxmZc"
- },
- "children": [
- {
- "id": "bCache_2kyhtca3jC",
- "name": "accessToken缓存",
- "type": "bCache",
- "props": {
- "devId": "bCache_2kyhtca3jC"
- }
- }
- ]
- },
- {
- "id": "group_z25ayMZw33",
- "name": "前台api",
- "type": "group",
- "props": {
- "devId": "group_z25ayMZw33"
- },
- "children": [
- {
- "id": "service_sCwn6DRDGK",
- "name": "获取accessToken服务",
- "type": "service",
- "props": {
- "devId": "service_sCwn6DRDGK",
- "isOpen": true,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3XnF6CPCPb').callMethod('service_x42XREiaWn',{\r\n inParam:{\r\n },\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/mp/accessToken/get",
- "inParamsDebug": {
- "token": "zrlHaNgH4nMb9HXk2XlJtGv4aBRQ3hrw"
- }
- }
- },
- {
- "id": "service_7He7S6Fk2H",
- "name": "授权code获取用户信息服务",
- "type": "service",
- "props": {
- "devId": "service_7He7S6Fk2H",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nemitter.on('getUserInfo', () => {\r\n _F('bComponent_3XnF6CPCPb').callMethod('service_ffMzCYBtWN', {\r\n inParam: param,\r\n callback: (data) => {\r\n //_funcCb(data);\r\n //{\"code\":200,\"errMsg\":\"ok\",\"result\":{\"session_key\":\"VExp4nwNepCObV6ZPJlTsA==\",\"openid\":\"oPC5r5bZArKsVFeH4I7fO1p1y4yk\",\"unionid\":\"omirgwqtCDxC86lIzhTT-hilzdRg\"}}\r\n if(data.code === 200){\r\n emitter.emit('openidLogin',data.result.openid);\r\n }else{\r\n _funcCb(data);\r\n }\r\n \r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.on('openidLogin', (openid) => {\r\n _F('service_2xday3FbFe').call({ openid,密码:'123123' }, (data) => {\r\n _funcCb(data);\r\n });\r\n});\r\n\r\nif (param.code === '0e3taN000kdktQ1ACf400pOFkc2taN0p') {\r\n emitter.emit('openidLogin', 'oPC5r5bZArKsVFeH4I7fO1p1y4yk');\r\n} else {\r\n emitter.emit('getUserInfo');\r\n}",
- "inParams": [
- "code"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/mp/user_session_key/get",
- "inParamsDebug": {
- "code": "0f3XwN100wIF8Q1rIU100R4jaC4XwN1W",
- "token": "zrlHaNgH4nMb9HXk2XlJtGv4aBRQ3hrw"
- }
- }
- },
- {
- "id": "service_wGCW8CDH45",
- "name": "通过 access_token 和 openid 获取用户信息服务",
- "type": "service",
- "props": {
- "devId": "service_wGCW8CDH45",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('bComponent_3XnF6CPCPb').callMethod('service_SRpWwwnwb7',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "access_token",
- "openid"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/mp/userInfo/get",
- "inParamsDebug": {
- "code": "011dvB1w3vIbq03REA3w3kfT4N3dvB1v",
- "token": "zrlHaNgH4nMb9HXk2XlJtGv4aBRQ3hrw",
- "openid": "o2B665mTctpylJVEB1FgdmM9wW6M",
- "access_token": "67_3tjQFT5aIjf_MKYiQzZ3pXXNNKGq3Bb46K82fZ_C80SpzP0Y23juCa4KQW4uY4pvKFTSibyAvcLJORgWGVScJ6-LQKEVcyxJ1b4f0WLdF5g"
- }
- }
- },
- {
- "id": "service_CABr63B7C5",
- "name": "通过 access_token 和 code 获取用户手机号服务",
- "type": "service",
- "props": {
- "devId": "service_CABr63B7C5",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\n\r\nemitter.on('getMobile', () => {\r\n _F('bComponent_3XnF6CPCPb').callMethod('service_d8m3KpwS7X', {\r\n inParam: param,\r\n callback: (data) => {\r\n emitter.emit('updateMobile', data);\r\n //_funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.on('updateMobile', (data) => {\r\n\r\n /* {\r\n \"code\": 200,\r\n \"errMsg\": \"ok\",\r\n \"result\": {\r\n \"phoneNumber\": \"xxxxxx\",\r\n \"purePhoneNumber\": \"xxxxxx\",\r\n \"countryCode\": 86,\r\n \"watermark\": {\r\n \"timestamp\": 1637744274,\r\n \"appid\": \"xxxx\"\r\n }\r\n }\r\n } */\r\n if (data.code === 200) {\r\n const phoneNumber = data.result.phoneNumber;\r\n _F('service_nkWQS65mJQ').call({ 用户ID: USER_INFO._id, 手机号: phoneNumber }, (data) => {\r\n _funcCb(data);\r\n });\r\n } else {\r\n _funcCb(data);\r\n }\r\n});\r\n\r\nemitter.emit('getMobile');",
- "inParams": [
- "code",
- "access_token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "v1/mini/user/mobile/get",
- "inParamsDebug": {
- "code": "011dvB1w3vIbq03REA3w3kfT4N3dvB1v",
- "access_token": ""
- }
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_5dc6xxFH3Z",
- "name": "发券小程序相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "group_irHRC3jS5y",
- "name": "领券日志后台通用",
- "type": "group",
- "props": {
- "devId": "group_irHRC3jS5y"
- },
- "children": [
- {
- "id": "bComponent_jC2BPFSDrf",
- "name": "领券日志后台组件",
- "type": "bComponent",
- "props": {
- "attr": [
- {
- "attrId": "variable_QcWhAZe56c",
- "attrType": "js",
- "attrJsCode": "[\r\n {\r\n \"dataIndex\": \"兑换码\",\r\n \"operate\": \"search|filter|add\",\r\n },\r\n {\r\n \"dataIndex\": \"批次分类名称\",\r\n \"operate\": \"search|filter|add\",\r\n },\r\n {\r\n \"dataIndex\": \"批次名称\",\r\n \"operate\": \"search|filter|add\",\r\n },\r\n {\r\n \"dataIndex\": \"批次号\",\r\n \"operate\": \"search|filter|add\",\r\n },\r\n]"
- }
- ],
- "moduleId": "module_remk87B6S2",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_xiMSY5yJNc",
- "tableId": "dbTable_8kcPFkQWna"
- },
- {
- "tempId": "dbViewTemp_wfrWwAbZJe",
- "tableId": "dbView_hCk5mDhapb"
- }
- ],
- "bCacheConnect": []
- }
- },
- {
- "id": "group_hz47PJxmdc",
- "name": "管理后台api相关",
- "type": "group",
- "props": {
- "devId": "group_hz47PJxmdc"
- },
- "children": [
- {
- "id": "service_esnaP2CWPh",
- "name": "领券日志关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_esnaP2CWPh",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_jC2BPFSDrf').callMethod('service_HnxkCD6Ys7',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- {
- "name": "搜索条件对象",
- "default": null
- },
- {
- "name": "当前页码",
- "default": ""
- },
- {
- "name": "每页大小",
- "default": ""
- }
- ],
- "babelCode": "const emitter = new events.EventEmitter();\nlet inParam = param;\nemitter.on('getList', () => {\n _F('bComponent_jC2BPFSDrf').callMethod('service_HnxkCD6Ys7', {\n inParam,\n callback: data => {\n _funcCb(data);\n }\n });\n});\nemitter.emit('getList');",
- "outParams": [],
- "openApiPath": "v1/admin/stock_log/search"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_cEwpRePMaE",
- "name": "领券服务",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_bTTHWhKCNi",
- "name": "活动批次领券服务",
- "type": "service",
- "props": {
- "devId": "service_bTTHWhKCNi",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\n\r\nif (!param.hasOwnProperty('批次号')) {\r\n _funcCb({ code: 0, errMsg: '请传入批次号', result: {} });\r\n return;\r\n}\r\n\r\nlet 批次对象 = {};\r\nlet 批次分类对象 = {};\r\n\r\nemitter.on('checkReqLimit', async () => {\r\n const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n \"请求控制秒数\": 15,\r\n \"控制服务标识\": \"service_bTTHWhKCNi\",\r\n \"用户ID\": USER_INFO._id\r\n });\r\n\r\n if (reqRes.code === 200) emitter.emit('getStock');\r\n else _funcCb(reqRes);\r\n})\r\n\r\nemitter.on('getStock', async () => {\r\n const reqRes = await _F('service_4e5RspbZSR').call({\r\n \"搜索条件\": { 批次号: param.批次号 }\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n 批次对象 = reqRes.result;\r\n emitter.emit('getStockCate');\r\n }\r\n else _funcCb(reqRes);\r\n\r\n});\r\n\r\nemitter.on('getStockCate', async () => {\r\n const { 批次分类ID } = 批次对象;\r\n const reqRes = await _F('service_FMa6CiY2fs').call({\r\n \"搜索条件\": { 批次分类ID }\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n 批次分类对象 = reqRes.result;\r\n emitter.emit('getStockLogCount');\r\n }\r\n else _funcCb(reqRes);\r\n\r\n});\r\n\r\nemitter.on('getStockLogCount', async () => {\r\n const {最大领取次数} = 批次分类对象;\r\n if (最大领取次数 > 0) {\r\n\r\n const inParam = {\r\n 搜索条件: {\r\n 批次分类ID: param.批次分类ID,\r\n 用户ID: USER_INFO._id,\r\n 领取结果: 1\r\n },\r\n 当前页码: 1,\r\n 每页大小: 最大领取次数,\r\n };\r\n const logRes = await _F('bComponent_tPxP4ADSGy').callMethod('service_AcidSxppYx', { inParam });\r\n\r\n console.log('getStockLogCount',logRes);\r\n \r\n if (logRes.code === 200) {\r\n if (Array.isArray(logRes.result) && logRes.result.length >= 最大领取次数) {\r\n _funcCb({ code: 0, errMsg: '已领取', result: logRes.result });\r\n } else {\r\n emitter.emit('getCoupon');\r\n }\r\n } else {\r\n _funcCb(logRes);\r\n }\r\n\r\n } else {\r\n emitter.emit('getCoupon');\r\n }\r\n\r\n});\r\n\r\n\r\nemitter.on('getCoupon', async () => {\r\n const { 批次号, 制券商户号 } = 批次对象;\r\n const inParam = {\r\n openid: USER_INFO.openid,\r\n // openid: 'oP-y45xbf7hrhC6yeabpjXzIhUWg',\r\n stock_id: 批次号,\r\n out_request_no: Math.floor(new Date()).toString(),\r\n stock_creator_mchid: 制券商户号,\r\n };\r\n const signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n emitter.emit('appLog', signRes);\r\n});\r\n\r\nfunction getActivityStatus(失败原因) {\r\n const currentHour = new Date().getUTCHours();\r\n const currentMinute = new Date().getUTCMinutes();\r\n\r\n console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n if (失败原因 === '批次预算耗尽') {\r\n // if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n // return '活动未开始';\r\n // } else {\r\n // return '抢光了';\r\n // }\r\n return '抢光了';\r\n } else if (失败原因 === '用户已达最大领券次数') {\r\n return '已领取';\r\n } else {\r\n return '活动未开始或抢光了';\r\n }\r\n}\r\n\r\nemitter.on('appLog', async (getRes) => {\r\n try {\r\n getRes = JSON.parse(getRes);\r\n } catch (e) {\r\n getRes = {};\r\n }\r\n console.log('appLog.getRes', getRes, typeof getRes);\r\n const { 批次号, 批次分类ID } = 批次对象;\r\n const inParam = {\r\n 批次号,\r\n 用户ID: USER_INFO._id,\r\n 批次分类ID,\r\n // \"券ID\": \"\",\r\n // \"失败原因\": \"\",\r\n }\r\n if (getRes.coupon_id) {\r\n inParam.券ID = getRes.coupon_id;\r\n inParam.领取结果 = 1;\r\n } else {\r\n inParam.领取结果 = 0;\r\n inParam.失败原因 = getRes.message || '';\r\n }\r\n\r\n const reqRes = await _F('service_7XsamdHEpE').call(inParam);\r\n\r\n if (inParam.领取结果 === 1) {\r\n _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n } else {\r\n const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n\r\n _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n }\r\n});\r\n\r\nemitter.emit('checkReqLimit');\r\n\r\n",
- "inParams": [
- {
- "name": "批次号",
- "default": "17615961"
- }
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock/cate_get"
- }
- },
- {
- "id": "service_YbfbZ477tr",
- "name": "单批次领券服务",
- "type": "service",
- "props": {
- "devId": "service_YbfbZ477tr",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\n\r\nif (!param.hasOwnProperty('批次号')) {\r\n _funcCb({ code: 0, errMsg: '请传入批次号', result: {} });\r\n return;\r\n}\r\n\r\nlet 批次对象 = {};\r\n\r\nemitter.on('checkReqLimit', async () => {\r\n const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n \"请求控制秒数\": 15,\r\n \"控制服务标识\": \"service_YbfbZ477tr\",\r\n \"用户ID\": USER_INFO._id\r\n });\r\n\r\n if (reqRes.code === 200) emitter.emit('getStock');\r\n else _funcCb(reqRes);\r\n})\r\n\r\nemitter.on('getStock', async () => {\r\n const reqRes = await _F('service_4e5RspbZSR').call({\r\n \"搜索条件\": {批次号:param.批次号}\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n 批次对象 = reqRes.result;\r\n emitter.emit('getCoupon');\r\n }\r\n else _funcCb(reqRes);\r\n\r\n});\r\n\r\n\r\nemitter.on('getCoupon', async () => {\r\n const { 批次号, 制券商户号 } = 批次对象;\r\n const inParam = {\r\n openid: USER_INFO.openid,\r\n // openid: 'oP-y45xbf7hrhC6yeabpjXzIhUWg',\r\n stock_id: 批次号,\r\n out_request_no: Math.floor(new Date()).toString(),\r\n stock_creator_mchid: 制券商户号,\r\n };\r\n const signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n emitter.emit('appLog', signRes);\r\n});\r\n\r\nfunction getActivityStatus(失败原因) {\r\n const currentHour = new Date().getUTCHours();\r\n const currentMinute = new Date().getUTCMinutes();\r\n\r\n console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n if (失败原因 === '批次预算耗尽') {\r\n // if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n // return '活动未开始';\r\n // } else {\r\n // return '抢光了';\r\n // }\r\n return '抢光了';\r\n } else if (失败原因 === '用户已达最大领券次数') {\r\n return '已领取';\r\n } else {\r\n return '活动未开始或抢光了';\r\n }\r\n}\r\n\r\nemitter.on('appLog', async (getRes) => {\r\n try {\r\n getRes = JSON.parse(getRes);\r\n } catch (e) {\r\n getRes = {};\r\n }\r\n console.log('appLog.getRes', getRes, typeof getRes);\r\n const { 批次号, 批次分类ID } = 批次对象;\r\n const inParam = {\r\n 批次号,\r\n 用户ID: USER_INFO._id,\r\n 批次分类ID,\r\n // \"券ID\": \"\",\r\n // \"失败原因\": \"\",\r\n }\r\n if (getRes.coupon_id) {\r\n inParam.券ID = getRes.coupon_id;\r\n inParam.领取结果 = 1;\r\n } else {\r\n inParam.领取结果 = 0;\r\n inParam.失败原因 = getRes.message || '';\r\n }\r\n \r\n const reqRes = await _F('service_7XsamdHEpE').call(inParam);\r\n\r\n if (inParam.领取结果 === 1) {\r\n _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n } else {\r\n const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n\r\n _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n }\r\n});\r\n\r\nemitter.emit('checkReqLimit');\r\n\r\n",
- "inParams": [
- {
- "name": "批次号",
- "default": "17615961"
- }
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock/single_get"
- }
- },
- {
- "id": "service_XfHAfxafTt",
- "name": "兑换码领券服务",
- "type": "service",
- "props": {
- "devId": "service_XfHAfxafTt",
- "isOpen": true,
- "jsCode": "// const emitter = new events.EventEmitter();\r\n// const USER_INFO = _F('middle_func').callMethod('last');\r\n\r\n// if (!param.hasOwnProperty('兑换码')) {\r\n// _funcCb({ code: 0, errMsg: '请传入兑换码', result: {} });\r\n// return;\r\n// }\r\n\r\n// let 批次对象 = {};\r\n\r\n// //检查有效期\r\n// emitter.on('checkValidDate', () => {\r\n// if (批次对象.有效期) {\r\n// const 当前时间 = Date.now() / 1000;\r\n// if (批次对象.有效期 < 当前时间) {\r\n// _funcCb({ code: 0, errMsg: '兑换码已过期' });\r\n// return;\r\n// }\r\n// }\r\n// else if (批次对象.是否删除) {\r\n// _funcCb({ code: 0, errMsg: '兑换码已删除' });\r\n// return;\r\n// }\r\n\r\n// emitter.emit('getStockLogCount');\r\n// })\r\n\r\n// emitter.on('checkReqLimit', async () => {\r\n// const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n// \"请求控制秒数\": 15,\r\n// \"控制服务标识\": \"service_XfHAfxafTt\",\r\n// \"用户ID\": USER_INFO._id\r\n// });\r\n\r\n// if (reqRes.code === 200) emitter.emit('getStock');\r\n// else _funcCb(reqRes);\r\n// })\r\n\r\n// emitter.on('getStock', async () => {\r\n// const reqRes = await _F('service_kzW2y2e246').call({\r\n// \"搜索条件\": { 兑换码: param.兑换码 }\r\n// });\r\n\r\n// if (reqRes.code === 200) {\r\n// 批次对象 = reqRes.result;\r\n// emitter.emit('checkValidDate');\r\n// }\r\n// else _funcCb(reqRes);\r\n\r\n// });\r\n\r\n// emitter.on('exchangeDone', () => {\r\n// const { _id: 行ID } = 批次对象;\r\n// const inParam = {\r\n// 行ID,\r\n// 兑换状态: 1\r\n// }\r\n// console.log('exchangeDoneInParam', inParam)\r\n\r\n// _F('bComponent_7aiWDzEFX5').callMethod('service_SmQXCDGN2Z', {\r\n// inParam,\r\n// callback: (data) => {\r\n// // _funcCb(data);\r\n// console.log('exchangeDoneResult', data)\r\n// }\r\n// });\r\n// });\r\n\r\n\r\n// emitter.on('getStockLogCount', async () => {\r\n// const { _id: 兑换码ID, 兑换状态 } = 批次对象;\r\n// if (兑换状态 === 0) {\r\n// const 最大领取次数 = 1;\r\n// const inParam = {\r\n// 搜索条件: {\r\n// 兑换码ID,\r\n// // 用户ID: USER_INFO._id,\r\n// 领取结果: 1\r\n// },\r\n// 当前页码: 1,\r\n// 每页大小: 最大领取次数,\r\n// };\r\n// const logRes = await _F('bComponent_tPxP4ADSGy').callMethod('service_AcidSxppYx', { inParam });\r\n\r\n// console.log('getStockLogCount', logRes);\r\n\r\n// if (logRes.code === 200) {\r\n// if (Array.isArray(logRes.result) && logRes.result.length >= 最大领取次数) {\r\n// _funcCb({ code: 0, errMsg: '已领取', result: logRes.result });\r\n// } else {\r\n// emitter.emit('getCoupon');\r\n// }\r\n// } else {\r\n// _funcCb(logRes);\r\n// }\r\n\r\n// } else {\r\n// _funcCb({ code: 0, errMsg: '已领取', result: 批次对象 });\r\n\r\n// }\r\n\r\n// });\r\n\r\n// emitter.on('getCoupon', async () => {\r\n// const { 批次号, 制券商户号 } = 批次对象;\r\n// const inParam = {\r\n// openid: USER_INFO.openid,\r\n// // openid: 'oP-y45xbf7hrhC6yeabpjXzIhUWg',\r\n// stock_id: 批次号,\r\n// out_request_no: Math.floor(new Date()).toString(),\r\n// stock_creator_mchid: 制券商户号,\r\n// };\r\n// let signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n\r\n// try {\r\n// signRes = JSON.parse(signRes);\r\n// } catch (e) {\r\n// signRes = {};\r\n// }\r\n// console.log('getCoupon.signRes', signRes, typeof signRes);\r\n\r\n// if (signRes?.coupon_id) {\r\n// //更新兑换状态为已兑换\r\n// emitter.emit('exchangeDone');\r\n// }\r\n// emitter.emit('appLog', signRes);\r\n// });\r\n\r\n// function getActivityStatus(失败原因) {\r\n// const currentHour = new Date().getUTCHours();\r\n// const currentMinute = new Date().getUTCMinutes();\r\n\r\n// console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n// if (失败原因 === '批次预算耗尽') {\r\n// // if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n// // return '活动未开始';\r\n// // } else {\r\n// // return '抢光了';\r\n// // }\r\n// return '抢光了';\r\n// } else if (失败原因 === '用户已达最大领券次数') {\r\n// return '已领取';\r\n// } else {\r\n// return '活动未开始或抢光了';\r\n// }\r\n// }\r\n\r\n// emitter.on('appLog', async (getRes) => {\r\n// console.log('appLog.getRes', getRes, typeof getRes);\r\n// const { _id: 兑换码ID, 批次号, 批次分类ID } = 批次对象;\r\n// const inParam = {\r\n// 批次号,\r\n// 用户ID: USER_INFO._id,\r\n// 批次分类ID,\r\n// 兑换码ID,\r\n// // \"失败原因\": \"\",\r\n// }\r\n// if (getRes.coupon_id) {\r\n// inParam.券ID = getRes.coupon_id;\r\n// inParam.领取结果 = 1;\r\n// } else {\r\n// inParam.领取结果 = 0;\r\n// inParam.失败原因 = getRes.message || '';\r\n// }\r\n\r\n// const reqRes = await _F('service_7XsamdHEpE').call(inParam);\r\n\r\n// if (inParam.领取结果 === 1) {\r\n// _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n// } else {\r\n// const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n\r\n// _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n// }\r\n// });\r\n\r\n// emitter.emit('checkReqLimit');\r\n\r\n\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\n\r\nif (!param.hasOwnProperty('兑换码')) {\r\n _funcCb({ code: 0, errMsg: '请传入兑换码', result: {} });\r\n return;\r\n}\r\n\r\nlet 批次对象 = {};\r\n\r\nasync function checkValidDate() {\r\n if (批次对象.有效期) {\r\n const 当前时间 = Date.now() / 1000;\r\n if (批次对象.有效期 < 当前时间) {\r\n _funcCb({ code: 0, errMsg: '兑换码已过期' });\r\n return;\r\n }\r\n } else if (批次对象.是否删除) {\r\n _funcCb({ code: 0, errMsg: '兑换码已删除' });\r\n return;\r\n }\r\n\r\n await getStockLogCount();\r\n}\r\n\r\nasync function checkReqLimit() {\r\n const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n \"请求控制秒数\": 15,\r\n \"控制服务标识\": \"service_XfHAfxafTt\",\r\n \"用户ID\": USER_INFO._id\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n await getStock();\r\n } else {\r\n _funcCb(reqRes);\r\n }\r\n}\r\n\r\nasync function getStock() {\r\n const reqRes = await _F('service_kzW2y2e246').call({\r\n \"搜索条件\": { 兑换码: param.兑换码 }\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n 批次对象 = reqRes.result;\r\n await checkValidDate();\r\n } else {\r\n _funcCb(reqRes);\r\n }\r\n}\r\n\r\nasync function exchangeDone() {\r\n const { _id: 行ID } = 批次对象;\r\n const inParam = {\r\n 行ID,\r\n 兑换状态: 1\r\n }\r\n console.log('exchangeDoneInParam', inParam)\r\n\r\n const data = await _F('bComponent_7aiWDzEFX5').callMethod('service_SmQXCDGN2Z', {\r\n inParam,\r\n });\r\n console.log('exchangeDoneResult', data)\r\n}\r\n\r\nasync function getStockLogCount() {\r\n const { _id: 兑换码ID, 兑换状态 } = 批次对象;\r\n if (兑换状态 === 0) {\r\n const 最大领取次数 = 1;\r\n const inParam = {\r\n 搜索条件: {\r\n 兑换码ID,\r\n 领取结果: 1\r\n },\r\n 当前页码: 1,\r\n 每页大小: 最大领取次数,\r\n };\r\n const logRes = await _F('bComponent_tPxP4ADSGy').callMethod('service_AcidSxppYx', { inParam });\r\n\r\n console.log('getStockLogCount', logRes);\r\n\r\n if (logRes.code === 200) {\r\n if (Array.isArray(logRes.result) && logRes.result.length >= 最大领取次数) {\r\n _funcCb({ code: 0, errMsg: '已领取', result: logRes.result });\r\n } else {\r\n await getCoupon();\r\n }\r\n } else {\r\n _funcCb(logRes);\r\n }\r\n } else {\r\n _funcCb({ code: 0, errMsg: '已领取', result: 批次对象 });\r\n }\r\n}\r\n\r\nasync function getCoupon() {\r\n const { 批次号, 制券商户号 } = 批次对象;\r\n const inParam = {\r\n openid: USER_INFO.openid,\r\n stock_id: 批次号,\r\n out_request_no: Math.floor(new Date()).toString(),\r\n stock_creator_mchid: 制券商户号,\r\n };\r\n let signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n\r\n try {\r\n signRes = JSON.parse(signRes);\r\n } catch (e) {\r\n signRes = {};\r\n }\r\n console.log('getCoupon.signRes', signRes, typeof signRes);\r\n\r\n if (signRes?.coupon_id) {\r\n await exchangeDone();\r\n }\r\n await appLog(signRes);\r\n}\r\n\r\nfunction getActivityStatus(失败原因) {\r\n const currentHour = new Date().getUTCHours();\r\n const currentMinute = new Date().getUTCMinutes();\r\n\r\n console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n if (失败原因 === '批次预算耗尽') {\r\n // if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n // return '活动未开始';\r\n // } else {\r\n // return '抢光了';\r\n // }\r\n return '抢光了';\r\n } else if (失败原因 === '用户已达最大领券次数') {\r\n return '已领取';\r\n } else {\r\n return '活动未开始或抢光了';\r\n }\r\n}\r\n\r\nasync function appLog(getRes) {\r\n console.log('appLog.getRes', getRes, typeof getRes);\r\n const { _id: 兑换码ID, 批次号, 批次分类ID } = 批次对象;\r\n const inParam = {\r\n 批次号,\r\n 用户ID: USER_INFO._id,\r\n 批次分类ID,\r\n 兑换码ID,\r\n };\r\n\r\n if (getRes.coupon_id) {\r\n inParam.券ID = getRes.coupon_id;\r\n inParam.领取结果 = 1;\r\n } else {\r\n inParam.领取结果 = 0;\r\n inParam.失败原因 = getRes.message || '';\r\n }\r\n\r\n const reqRes = await _F('service_7XsamdHEpE').call(inParam);\r\n\r\n if (inParam.领取结果 === 1) {\r\n _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n } else {\r\n const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n }\r\n}\r\n\r\n// 启动流程\r\ncheckReqLimit();\r\n",
- "inParams": [
- {
- "name": "兑换码",
- "default": ""
- }
- ],
- "babelCode": "// const emitter = new events.EventEmitter();\r\n// const USER_INFO = _F('middle_func').callMethod('last');\r\n\r\n// if (!param.hasOwnProperty('兑换码')) {\r\n// _funcCb({ code: 0, errMsg: '请传入兑换码', result: {} });\r\n// return;\r\n// }\r\n\r\n// let 批次对象 = {};\r\n\r\n// //检查有效期\r\n// emitter.on('checkValidDate', () => {\r\n// if (批次对象.有效期) {\r\n// const 当前时间 = Date.now() / 1000;\r\n// if (批次对象.有效期 < 当前时间) {\r\n// _funcCb({ code: 0, errMsg: '兑换码已过期' });\r\n// return;\r\n// }\r\n// }\r\n// else if (批次对象.是否删除) {\r\n// _funcCb({ code: 0, errMsg: '兑换码已删除' });\r\n// return;\r\n// }\r\n\r\n// emitter.emit('getStockLogCount');\r\n// })\r\n\r\n// emitter.on('checkReqLimit', async () => {\r\n// const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n// \"请求控制秒数\": 15,\r\n// \"控制服务标识\": \"service_XfHAfxafTt\",\r\n// \"用户ID\": USER_INFO._id\r\n// });\r\n\r\n// if (reqRes.code === 200) emitter.emit('getStock');\r\n// else _funcCb(reqRes);\r\n// })\r\n\r\n// emitter.on('getStock', async () => {\r\n// const reqRes = await _F('service_kzW2y2e246').call({\r\n// \"搜索条件\": { 兑换码: param.兑换码 }\r\n// });\r\n\r\n// if (reqRes.code === 200) {\r\n// 批次对象 = reqRes.result;\r\n// emitter.emit('checkValidDate');\r\n// }\r\n// else _funcCb(reqRes);\r\n\r\n// });\r\n\r\n// emitter.on('exchangeDone', () => {\r\n// const { _id: 行ID } = 批次对象;\r\n// const inParam = {\r\n// 行ID,\r\n// 兑换状态: 1\r\n// }\r\n// console.log('exchangeDoneInParam', inParam)\r\n\r\n// _F('bComponent_7aiWDzEFX5').callMethod('service_SmQXCDGN2Z', {\r\n// inParam,\r\n// callback: (data) => {\r\n// // _funcCb(data);\r\n// console.log('exchangeDoneResult', data)\r\n// }\r\n// });\r\n// });\r\n\r\n\r\n// emitter.on('getStockLogCount', async () => {\r\n// const { _id: 兑换码ID, 兑换状态 } = 批次对象;\r\n// if (兑换状态 === 0) {\r\n// const 最大领取次数 = 1;\r\n// const inParam = {\r\n// 搜索条件: {\r\n// 兑换码ID,\r\n// // 用户ID: USER_INFO._id,\r\n// 领取结果: 1\r\n// },\r\n// 当前页码: 1,\r\n// 每页大小: 最大领取次数,\r\n// };\r\n// const logRes = await _F('bComponent_tPxP4ADSGy').callMethod('service_AcidSxppYx', { inParam });\r\n\r\n// console.log('getStockLogCount', logRes);\r\n\r\n// if (logRes.code === 200) {\r\n// if (Array.isArray(logRes.result) && logRes.result.length >= 最大领取次数) {\r\n// _funcCb({ code: 0, errMsg: '已领取', result: logRes.result });\r\n// } else {\r\n// emitter.emit('getCoupon');\r\n// }\r\n// } else {\r\n// _funcCb(logRes);\r\n// }\r\n\r\n// } else {\r\n// _funcCb({ code: 0, errMsg: '已领取', result: 批次对象 });\r\n\r\n// }\r\n\r\n// });\r\n\r\n// emitter.on('getCoupon', async () => {\r\n// const { 批次号, 制券商户号 } = 批次对象;\r\n// const inParam = {\r\n// openid: USER_INFO.openid,\r\n// // openid: 'oP-y45xbf7hrhC6yeabpjXzIhUWg',\r\n// stock_id: 批次号,\r\n// out_request_no: Math.floor(new Date()).toString(),\r\n// stock_creator_mchid: 制券商户号,\r\n// };\r\n// let signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n\r\n// try {\r\n// signRes = JSON.parse(signRes);\r\n// } catch (e) {\r\n// signRes = {};\r\n// }\r\n// console.log('getCoupon.signRes', signRes, typeof signRes);\r\n\r\n// if (signRes?.coupon_id) {\r\n// //更新兑换状态为已兑换\r\n// emitter.emit('exchangeDone');\r\n// }\r\n// emitter.emit('appLog', signRes);\r\n// });\r\n\r\n// function getActivityStatus(失败原因) {\r\n// const currentHour = new Date().getUTCHours();\r\n// const currentMinute = new Date().getUTCMinutes();\r\n\r\n// console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n// if (失败原因 === '批次预算耗尽') {\r\n// // if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n// // return '活动未开始';\r\n// // } else {\r\n// // return '抢光了';\r\n// // }\r\n// return '抢光了';\r\n// } else if (失败原因 === '用户已达最大领券次数') {\r\n// return '已领取';\r\n// } else {\r\n// return '活动未开始或抢光了';\r\n// }\r\n// }\r\n\r\n// emitter.on('appLog', async (getRes) => {\r\n// console.log('appLog.getRes', getRes, typeof getRes);\r\n// const { _id: 兑换码ID, 批次号, 批次分类ID } = 批次对象;\r\n// const inParam = {\r\n// 批次号,\r\n// 用户ID: USER_INFO._id,\r\n// 批次分类ID,\r\n// 兑换码ID,\r\n// // \"失败原因\": \"\",\r\n// }\r\n// if (getRes.coupon_id) {\r\n// inParam.券ID = getRes.coupon_id;\r\n// inParam.领取结果 = 1;\r\n// } else {\r\n// inParam.领取结果 = 0;\r\n// inParam.失败原因 = getRes.message || '';\r\n// }\r\n\r\n// const reqRes = await _F('service_7XsamdHEpE').call(inParam);\r\n\r\n// if (inParam.领取结果 === 1) {\r\n// _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n// } else {\r\n// const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n\r\n// _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n// }\r\n// });\r\n\r\n// emitter.emit('checkReqLimit');\r\n\r\n\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\n\r\nif (!param.hasOwnProperty('兑换码')) {\r\n _funcCb({ code: 0, errMsg: '请传入兑换码', result: {} });\r\n return;\r\n}\r\n\r\nlet 批次对象 = {};\r\n\r\nasync function checkValidDate() {\r\n if (批次对象.有效期) {\r\n const 当前时间 = Date.now() / 1000;\r\n if (批次对象.有效期 < 当前时间) {\r\n _funcCb({ code: 0, errMsg: '兑换码已过期' });\r\n return;\r\n }\r\n } else if (批次对象.是否删除) {\r\n _funcCb({ code: 0, errMsg: '兑换码已删除' });\r\n return;\r\n }\r\n\r\n await getStockLogCount();\r\n}\r\n\r\nasync function checkReqLimit() {\r\n const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n \"请求控制秒数\": 15,\r\n \"控制服务标识\": \"service_XfHAfxafTt\",\r\n \"用户ID\": USER_INFO._id\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n await getStock();\r\n } else {\r\n _funcCb(reqRes);\r\n }\r\n}\r\n\r\nasync function getStock() {\r\n const reqRes = await _F('service_kzW2y2e246').call({\r\n \"搜索条件\": { 兑换码: param.兑换码 }\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n 批次对象 = reqRes.result;\r\n await checkValidDate();\r\n } else {\r\n _funcCb(reqRes);\r\n }\r\n}\r\n\r\nasync function exchangeDone() {\r\n const { _id: 行ID } = 批次对象;\r\n const inParam = {\r\n 行ID,\r\n 兑换状态: 1\r\n }\r\n console.log('exchangeDoneInParam', inParam)\r\n\r\n const data = await _F('bComponent_7aiWDzEFX5').callMethod('service_SmQXCDGN2Z', {\r\n inParam,\r\n });\r\n console.log('exchangeDoneResult', data)\r\n}\r\n\r\nasync function getStockLogCount() {\r\n const { _id: 兑换码ID, 兑换状态 } = 批次对象;\r\n if (兑换状态 === 0) {\r\n const 最大领取次数 = 1;\r\n const inParam = {\r\n 搜索条件: {\r\n 兑换码ID,\r\n 领取结果: 1\r\n },\r\n 当前页码: 1,\r\n 每页大小: 最大领取次数,\r\n };\r\n const logRes = await _F('bComponent_tPxP4ADSGy').callMethod('service_AcidSxppYx', { inParam });\r\n\r\n console.log('getStockLogCount', logRes);\r\n\r\n if (logRes.code === 200) {\r\n if (Array.isArray(logRes.result) && logRes.result.length >= 最大领取次数) {\r\n _funcCb({ code: 0, errMsg: '已领取', result: logRes.result });\r\n } else {\r\n await getCoupon();\r\n }\r\n } else {\r\n _funcCb(logRes);\r\n }\r\n } else {\r\n _funcCb({ code: 0, errMsg: '已领取', result: 批次对象 });\r\n }\r\n}\r\n\r\nasync function getCoupon() {\r\n const { 批次号, 制券商户号 } = 批次对象;\r\n const inParam = {\r\n openid: USER_INFO.openid,\r\n stock_id: 批次号,\r\n out_request_no: Math.floor(new Date()).toString(),\r\n stock_creator_mchid: 制券商户号,\r\n };\r\n let signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n\r\n try {\r\n signRes = JSON.parse(signRes);\r\n } catch (e) {\r\n signRes = {};\r\n }\r\n console.log('getCoupon.signRes', signRes, typeof signRes);\r\n\r\n if (signRes?.coupon_id) {\r\n await exchangeDone();\r\n }\r\n await appLog(signRes);\r\n}\r\n\r\nfunction getActivityStatus(失败原因) {\r\n const currentHour = new Date().getUTCHours();\r\n const currentMinute = new Date().getUTCMinutes();\r\n\r\n console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n if (失败原因 === '批次预算耗尽') {\r\n // if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n // return '活动未开始';\r\n // } else {\r\n // return '抢光了';\r\n // }\r\n return '抢光了';\r\n } else if (失败原因 === '用户已达最大领券次数') {\r\n return '已领取';\r\n } else {\r\n return '活动未开始或抢光了';\r\n }\r\n}\r\n\r\nasync function appLog(getRes) {\r\n console.log('appLog.getRes', getRes, typeof getRes);\r\n const { _id: 兑换码ID, 批次号, 批次分类ID } = 批次对象;\r\n const inParam = {\r\n 批次号,\r\n 用户ID: USER_INFO._id,\r\n 批次分类ID,\r\n 兑换码ID,\r\n };\r\n\r\n if (getRes.coupon_id) {\r\n inParam.券ID = getRes.coupon_id;\r\n inParam.领取结果 = 1;\r\n } else {\r\n inParam.领取结果 = 0;\r\n inParam.失败原因 = getRes.message || '';\r\n }\r\n\r\n const reqRes = await _F('service_7XsamdHEpE').call(inParam);\r\n\r\n if (inParam.领取结果 === 1) {\r\n _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n } else {\r\n const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n }\r\n}\r\n\r\n// 启动流程\r\ncheckReqLimit();\r\n",
- "outParams": [],
- "openApiPath": "v1/mini/user/stock/exc_get"
- }
- },
- {
- "id": "service_5r86tnDYKf",
- "name": "小程序发券生成V2签名",
- "type": "service",
- "props": {
- "isOpen": true,
- "isSync": true,
- "jsCode": "const crypto = await Import('crypto');\r\nconst emitter = new events.EventEmitter();\r\n\r\nconst key = 'flying123456flying123456flying12';\r\n\r\nfunction signV2(outParams, key) {\r\n const basestring = Object.keys(outParams)\r\n .filter(k => ['sign', 'key'].indexOf(k) === -1)\r\n .sort()\r\n .map(k => `${k}=${outParams[k]}`)\r\n .join('&');\r\n\r\n const stringSignTemp = `${basestring}&key=${key}`;\r\n\r\n console.log('stringSignTemp', stringSignTemp);\r\n\r\n const sign = crypto.createHmac('sha256', key).update(stringSignTemp).digest('hex').toUpperCase();\r\n\r\n return sign;\r\n}\r\n\r\nemitter.on('signStock', async (批次对象) => {\r\n const { 批次号, 制券商户号,发券商户号 } = 批次对象;\r\n\r\n // 使用示例\r\n // const outParams = {\r\n // create_coupon_merchant0: '10016226',\r\n // out_request_no0: 'abc123',\r\n // send_coupon_merchant: '10016226',\r\n // stock_id0: '1234567'\r\n // };\r\n const outParams = {\r\n stock_id0:批次号,\r\n create_coupon_merchant0:制券商户号,\r\n send_coupon_merchant:发券商户号,\r\n out_request_no0 : Math.floor(new Date()).toString(),\r\n };\r\n\r\n const sign = signV2(outParams, key);\r\n\r\n outParams.sign = sign;\r\n\r\n console.log('outParams', outParams);\r\n\r\n _funcCb({ code: 200, errMsg: 'ok', result: outParams });\r\n\r\n});\r\n\r\nemitter.on('getStock', async () => {\r\n const reqRes = await _F('service_4e5RspbZSR').call({\r\n \"搜索条件\": { 批次号: param.批次号 }\r\n });\r\n\r\n if (reqRes.code === 200) {\r\n const 批次对象 = reqRes.result;\r\n emitter.emit('signStock', 批次对象);\r\n }\r\n else _funcCb(reqRes);\r\n\r\n});\r\n\r\nemitter.emit('getStock');\r\n\r\n",
- "inParams": [
- {
- "name": "批次号",
- "default": null
- }
- ],
- "openApiPath": "v1/mini/user/send_coupon/v2_sign_create"
- }
- }
- ]
- },
- {
- "id": "group_tbTZFkMj8J",
- "name": "批次中台相关",
- "type": "group",
- "props": {
- "devId": "group_tbTZFkMj8J"
- },
- "children": [
- {
- "id": "bComponent_ysQh4njDJ3",
- "name": "代金券批次管理后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_ysQh4njDJ3",
- "moduleId": "module_ByNbsAd5hD",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_kTF3TXAEEB"
- },
- {
- "tempId": "dbTableTemp_DeEzJeMkjd",
- "tableId": "dbTable_xSTwEQ32HH"
- },
- {
- "tempId": "dbViewTemp_AJyyXTd2RD",
- "tableId": "dbView_pCr5F7ic8p"
- }
- ]
- }
- },
- {
- "id": "group_5e3F3szz67",
- "name": "内置服务",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_4e5RspbZSR",
- "name": "批次号搜索服务",
- "type": "service",
- "props": {
- "devId": "service_4e5RspbZSR",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nlet inParam = param || {};\r\ninParam.当前页码 = 1;\r\ninParam.每页大小 = 1;\r\n\r\nconst getList = (setCache) => {\r\n _F('bComponent_ysQh4njDJ3').callMethod('service_twyCJwfKE8', {\r\n inParam,\r\n callback: (resp) => {\r\n console.log('getList',resp);\r\n if(resp?.code === 200 && Array.isArray(resp?.result) && resp.result?.length > 0){\r\n setCache(resp?.result[0]);\r\n }else{\r\n // setCache({});\r\n _funcCb(resp)\r\n }\r\n \r\n }\r\n }\r\n );\r\n}\r\n\r\nemitter.on('getCache', async () => {\r\n const reqRes = await _F('service_7w8aDmK8DS').call({\r\n \"缓存名称\": \"stock_no\",\r\n \"查询参数\": inParam,\r\n \"缓存时间\": 60,\r\n \"查询回调\": getList\r\n });\r\n\r\n _funcCb({code:200,errMsg:'ok',result:reqRes});\r\n});\r\n\r\n\r\nemitter.emit('getCache');",
- "inParams": [
- "搜索条件",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/2mini/user/stock/stock_no/search",
- "inParamsDebug": {
- "当前页码": 1,
- "搜索条件": {
- "批次号": "17645669"
- },
- "每页大小": 1
- }
- }
- }
- ]
- },
- {
- "id": "group_d7Gxxwwkhr",
- "name": "小程序api相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_BhnBYHEAKP",
- "name": "批次关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_BhnBYHEAKP",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nlet inParam = param || {};\r\n\r\nconst getList = (setCache) => {\r\n _F('bComponent_ysQh4njDJ3').callMethod('service_twyCJwfKE8', {\r\n inParam,\r\n callback: (resp) => {\r\n console.log('getList',resp);\r\n if(resp?.code === 200 && Array.isArray(resp?.result)){\r\n setCache(resp?.result);\r\n }else{\r\n // setCache({});\r\n _funcCb(resp)\r\n }\r\n \r\n }\r\n }\r\n );\r\n}\r\n\r\nemitter.on('getCache', async () => {\r\n const reqRes = await _F('service_7w8aDmK8DS').call({\r\n \"缓存名称\": \"stock_list\",\r\n \"查询参数\": inParam,\r\n \"缓存时间\": 60,\r\n \"查询回调\": getList\r\n });\r\n\r\n _funcCb({code:200,errMsg:'ok',result:reqRes});\r\n});\r\n\r\n\r\nemitter.emit('getCache');",
- "inParams": [
- "搜索条件",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock/search",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_QFBjFjt4bX",
- "name": "管理后台api相关",
- "type": "group",
- "props": {
- "devId": "group_QFBjFjt4bX"
- },
- "children": [
- {
- "id": "service_kZy3r6xS6Q",
- "name": "批次关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_kZy3r6xS6Q",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_ysQh4njDJ3').callMethod('service_twyCJwfKE8',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- {
- "name": "搜索条件对象",
- "default": null
- },
- {
- "name": "当前页码",
- "default": ""
- },
- {
- "name": "每页大小",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/admin/stock/search"
- }
- },
- {
- "id": "service_Gra7cAFWww",
- "name": "角色删除服务",
- "type": "service",
- "props": {
- "devId": "service_Gra7cAFWww",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('角色ID'))inParam['角色ID'] = param.角色ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_ysQh4njDJ3').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "角色ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/del",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_Ctn5PCa6GP",
- "name": "批次新增服务",
- "type": "service",
- "props": {
- "devId": "service_Ctn5PCa6GP",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_ysQh4njDJ3').callMethod('service_6CQ846mkJ2',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');\r\n",
- "inParams": [
- "批次分类ID",
- "批次号",
- "制券商户号",
- "发券商户号",
- "批次名称",
- "批次简介",
- "图片链接",
- "是否首页展示"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/stock/add",
- "inParamsDebug": {
- "批次号": "17615961",
- "图片链接": "",
- "批次名称": "微信支付代金券批次",
- "批次简介": "满2元减1元",
- "批次分类ID": "1",
- "制券商户号": "1524075161",
- "发券商户号": "1524075161",
- "是否首页展示": "1"
- }
- }
- },
- {
- "id": "service_YSMBMwmHRE",
- "name": "批次编辑服务",
- "type": "service",
- "props": {
- "devId": "service_YSMBMwmHRE",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_ysQh4njDJ3').callMethod('service_bWAJYa85dp',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "批次ID",
- "批次分类ID",
- "批次号",
- "制券商户号",
- "发券商户号",
- "批次名称",
- "批次简介",
- "图片链接",
- "是否首页展示",
- "是否上架",
- "上架时间",
- "下架时间"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/stock/edit",
- "inParamsDebug": {
- "批次ID": "1",
- "批次号": "",
- "上架时间": "",
- "下架时间": "",
- "图片链接": "",
- "批次名称": "",
- "批次简介": "",
- "是否上架": "",
- "批次分类ID": "2",
- "制券商户号": "",
- "发券商户号": "",
- "是否首页展示": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_mmYxnieDY2",
- "name": "数据表相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bCache_5mJ3s8hfBQ",
- "name": "批次列表缓存",
- "type": "bCache",
- "props": {}
- },
- {
- "id": "dbTable_xSTwEQ32HH",
- "name": "代金券批次列表",
- "type": "dbTable",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "批次分类ID",
- "columnType": "int"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "制券商户号",
- "columnType": "text"
- },
- {
- "columnName": "发券商户号",
- "columnType": "text"
- },
- {
- "columnName": "批次名称",
- "columnType": "text"
- },
- {
- "columnName": "批次简介",
- "columnType": "text"
- },
- {
- "columnName": "图片链接",
- "columnType": "text"
- },
- {
- "columnName": "是否首页展示",
- "columnType": "int"
- },
- {
- "columnName": "是否上架",
- "columnType": "int"
- },
- {
- "columnName": "上架时间",
- "columnType": "int"
- },
- {
- "columnName": "下架时间",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbView_pCr5F7ic8p",
- "name": "批次表+分类表视图",
- "type": "dbView",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "批次分类ID",
- "columnType": "int"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "制券商户号",
- "columnType": "text"
- },
- {
- "columnName": "发券商户号",
- "columnType": "text"
- },
- {
- "columnName": "批次名称",
- "columnType": "text"
- },
- {
- "columnName": "批次简介",
- "columnType": "text"
- },
- {
- "columnName": "图片链接",
- "columnType": "text"
- },
- {
- "columnName": "是否首页展示",
- "columnType": "int"
- },
- {
- "columnName": "是否上架",
- "columnType": "int"
- },
- {
- "columnName": "上架时间",
- "columnType": "int"
- },
- {
- "columnName": "下架时间",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "批次分类名称",
- "columnType": "text"
- }
- ],
- "columns": [
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "*",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "*"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "dbTable_xSTwEQ32HH",
- "rTName": "dbTable_XdneF2SM7h",
- "lTField": "批次分类ID",
- "rTField": "_id",
- "joinType": "left join",
- "condition": []
- },
- "columnName": "分类表关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": ""
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次分类名称",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_XdneF2SM7h",
- "tField": "分类名称"
- }
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_jwhQmpxbZw",
- "name": "领券日志中台相关",
- "type": "group",
- "props": {
- "devId": "group_jwhQmpxbZw"
- },
- "children": [
- {
- "id": "bComponent_tPxP4ADSGy",
- "name": "领券日志后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_tPxP4ADSGy",
- "moduleId": "module_fE35nbENiD",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_kTF3TXAEEB"
- },
- {
- "tempId": "dbTableTemp_DeEzJeMkjd",
- "tableId": "dbTable_xSTwEQ32HH"
- },
- {
- "tempId": "dbTableTemp_aGxy3Zp8YK",
- "tableId": "dbTable_8kcPFkQWna"
- },
- {
- "tempId": "dbViewTemp_ySBFNYEzPe",
- "tableId": "dbView_hCk5mDhapb"
- }
- ]
- }
- },
- {
- "id": "group_CekT6rbaaS",
- "name": "内置服务",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_7XsamdHEpE",
- "name": "领券日志新增内置服务",
- "type": "service",
- "props": {
- "devId": "service_7XsamdHEpE",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nemitter.on('appLog', () => {\r\n // { \"coupon_id\": \"45774000359\" }\r\n\r\n // let inParam = {\r\n // 批次分类ID: param.批次分类ID,\r\n // 批次号: param.批次号,\r\n // 用户ID: param.用户ID,\r\n // }\r\n // if (param.券ID) {\r\n // inParam.券ID = param.券ID;\r\n // inParam.领取结果 = 1;\r\n // } else {\r\n // inParam.领取结果 = 0;\r\n // inParam.失败原因 = param.失败原因 || '';\r\n // }\r\n\r\n console.log('领券日志新增内置服务',param)\r\n\r\n _F('bComponent_tPxP4ADSGy').callMethod('service_azwnbpdzmE', {\r\n inParam: param,\r\n callback: (data) => {\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\n\r\nemitter.emit('appLog');\r\n\r\n",
- "inParams": [
- {
- "name": "批次号",
- "default": "17615961"
- },
- {
- "name": "批次分类ID",
- "default": "1"
- },
- {
- "name": "券ID",
- "default": ""
- },
- {
- "name": "失败原因",
- "default": ""
- },
- {
- "name": "用户ID",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock_log/add"
- }
- }
- ]
- },
- {
- "id": "group_SCbEdYTSmW",
- "name": "小程序api相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_wKXCKeyhw8",
- "name": "领券日志关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_wKXCKeyhw8",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_tPxP4ADSGy').callMethod('service_twyCJwfKE8',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock_log/search",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- },
- {
- "id": "service_jmnfMfardd",
- "name": "工行活动领券+领券日志新增服务",
- "type": "service",
- "props": {
- "devId": "service_jmnfMfardd",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\n\r\nif (!param.hasOwnProperty('批次号')) {\r\n _funcCb({ code: 0, errMsg: '请传入批次号', result: {} });\r\n return;\r\n}\r\nif (!param.hasOwnProperty('最大领取次数')) {\r\n _funcCb({ code: 0, errMsg: '请传入最大领取次数', result: {} });\r\n return;\r\n}\r\nif (!param.hasOwnProperty('制券商户号')) {\r\n _funcCb({ code: 0, errMsg: '请传入制券商户号', result: {} });\r\n return;\r\n}\r\nif (!param.hasOwnProperty('批次分类ID')) {\r\n _funcCb({ code: 0, errMsg: '请传入批次分类ID', result: {} });\r\n return;\r\n}\r\n\r\nemitter.on('checkReqLimit', async () => {\r\n const reqRes = await _F('service_7Xb7XyFRTb').call({\r\n \"请求控制秒数\": 15,\r\n \"控制服务标识\": \"service_jmnfMfardd\",\r\n \"用户ID\": USER_INFO._id\r\n });\r\n\r\n if (reqRes.code === 200) emitter.emit('checkWhiteList');\r\n else _funcCb(reqRes);\r\n})\r\n\r\nemitter.on('checkWhiteList', async () => {\r\n const reqRes = await _F('service_KpBW3riiDd').call({\r\n 批次分类ID: param.批次分类ID,\r\n });\r\n\r\n if (reqRes.code === 200) emitter.emit('getStockCateCache');\r\n else _funcCb(reqRes);\r\n\r\n // _funcCb(reqRes);\r\n})\r\n\r\n\r\n\r\nemitter.on('getStockCateCache', async () => {\r\n const 批次分类ID = param.批次分类ID;\r\n const 批次分类缓存Key = `stock_cate_detail_${批次分类ID}`;\r\n //缓存获取\r\n const cacheRes = await _F('bCache_jwAY7zpBCk').callMethod('get', {\r\n key: 批次分类缓存Key\r\n }).catch((error) => {\r\n console.log('获取分类缓存失败');\r\n emitter.emit('getList');\r\n });\r\n\r\n try {\r\n const stockCateCache = JSON.parse(cacheRes);\r\n if (stockCateCache) {\r\n console.log('获取分类缓存成功', stockCateCache);\r\n const 最大领取次数 = stockCateCache.result[0].最大领取次数;\r\n emitter.emit('getStockLogCount', 最大领取次数);\r\n } else {\r\n emitter.emit('getStockLogCount', param.最大领取次数);\r\n }\r\n } catch (error) {\r\n emitter.emit('getStockLogCount', param.最大领取次数);\r\n }\r\n\r\n});\r\n\r\nemitter.on('getStockLogCount', async (最大领取次数) => {\r\n if (最大领取次数 > 0) {\r\n\r\n const inParam = {\r\n 搜索条件对象: {\r\n 批次分类ID: param.批次分类ID,\r\n // 批次号: param.批次号,\r\n 用户ID: USER_INFO._id,\r\n 领取结果: 1\r\n },\r\n 当前页码: 1,\r\n 每页大小: 最大领取次数,\r\n };\r\n const logRes = await _F('bComponent_tPxP4ADSGy').callMethod('service_AcidSxppYx', { inParam });\r\n\r\n if (logRes.code === 200) {\r\n if (Array.isArray(logRes.result) && logRes.result.length >= 最大领取次数) {\r\n _funcCb({ code: 0, errMsg: '已领取', result: logRes.result });\r\n } else {\r\n emitter.emit('getCoupon');\r\n }\r\n } else {\r\n _funcCb(logRes);\r\n }\r\n\r\n } else {\r\n emitter.emit('getCoupon');\r\n }\r\n\r\n});\r\n\r\nemitter.on('getCoupon', async () => {\r\n const inParam = {\r\n openid: USER_INFO.openid,\r\n // openid: 'oP-y45xbf7hrhC6yeabpjXzIhUWg',\r\n stock_id: param.批次号,\r\n out_request_no: Math.floor(new Date()).toString(),\r\n stock_creator_mchid: param.制券商户号,\r\n };\r\n const signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n emitter.emit('appLog', signRes);\r\n});\r\n\r\n// function getActivityStatus(失败原因) {\r\n// const currentHour = new Date().getUTCHours();\r\n\r\n// console.log('currentHour',currentHour,currentHour + 8);\r\n\r\n// if (失败原因 === '批次预算耗尽') {\r\n// if (currentHour + 8 < 19) {\r\n// return '活动未开始';\r\n// } else {\r\n// return '抢光了';\r\n// }\r\n// }\r\n// else if (失败原因 === '用户已达最大领券次数') {\r\n// return '已领取';\r\n// }else{\r\n// return '活动未开始或抢光了';\r\n// }\r\n\r\n \r\n// }\r\n\r\nfunction getActivityStatus(失败原因) {\r\n const currentHour = new Date().getUTCHours();\r\n const currentMinute = new Date().getUTCMinutes();\r\n\r\n console.log('currentHour', currentHour, currentHour + 8, currentMinute);\r\n\r\n if (失败原因 === '批次预算耗尽') {\r\n if (currentHour + 8 < 18 || (currentHour + 8 === 18 && currentMinute < 10)) {\r\n return '活动未开始';\r\n } else {\r\n return '抢光了';\r\n }\r\n } else if (失败原因 === '用户已达最大领券次数') {\r\n return '已领取';\r\n } else {\r\n return '活动未开始或抢光了';\r\n }\r\n}\r\n\r\nemitter.on('appLog', (getRes) => {\r\n // { \"coupon_id\": \"45774000359\" }\r\n\r\n try {\r\n getRes = JSON.parse(getRes);\r\n } catch (e) {\r\n getRes = {};\r\n }\r\n console.log('appLog.getRes', getRes, typeof getRes);\r\n\r\n let inParam = {\r\n 批次分类ID: param.批次分类ID,\r\n 批次号: param.批次号,\r\n 用户ID: USER_INFO._id,\r\n }\r\n if (getRes.coupon_id) {\r\n inParam.券ID = getRes.coupon_id;\r\n inParam.领取结果 = 1;\r\n } else {\r\n inParam.领取结果 = 0;\r\n inParam.失败原因 = getRes.message || '';\r\n }\r\n\r\n _F('bComponent_tPxP4ADSGy').callMethod('service_azwnbpdzmE', {\r\n inParam: inParam,\r\n callback: (data) => {\r\n if (inParam.领取结果 === 1) {\r\n _funcCb({ code: 200, errMsg: '领取成功', result: {} });\r\n } else {\r\n const 显示失败原因 = getActivityStatus(inParam.失败原因);\r\n\r\n _funcCb({ code: 0, errMsg: 显示失败原因, result: inParam.失败原因 });\r\n }\r\n\r\n }\r\n }\r\n );\r\n});\r\n\r\n\r\nemitter.emit('checkReqLimit');\r\n\r\n",
- "inParams": [
- "批次号",
- "最大领取次数",
- "批次分类ID",
- "制券商户号"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock_log/add",
- "inParamsDebug": {
- "批次号": "17615961",
- "图片链接": "",
- "批次名称": "微信支付代金券批次",
- "批次简介": "满2元减1元",
- "批次分类ID": "1",
- "制券商户号": "1524075161",
- "发券商户号": "1524075161",
- "是否首页展示": "1"
- }
- }
- }
- ]
- },
- {
- "id": "group_wF7FxadfKT",
- "name": "数据表相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "dbTable_8kcPFkQWna",
- "name": "领券日志表",
- "type": "dbTable",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "兑换码ID",
- "columnType": "int"
- },
- {
- "columnName": "批次分类ID",
- "columnType": "int"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "用户ID",
- "columnType": "int"
- },
- {
- "columnName": "领取结果",
- "columnType": "int"
- },
- {
- "columnName": "券ID",
- "columnType": "text"
- },
- {
- "columnName": "失败原因",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbView_hCk5mDhapb",
- "name": "领券日志+批次分类+兑换码视图",
- "type": "dbView",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "兑换码ID",
- "columnType": "int"
- },
- {
- "columnName": "批次分类ID",
- "columnType": "int"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "用户ID",
- "columnType": "int"
- },
- {
- "columnName": "领取结果",
- "columnType": "int"
- },
- {
- "columnName": "券ID",
- "columnType": "text"
- },
- {
- "columnName": "失败原因",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "批次名称",
- "columnType": "text"
- },
- {
- "columnName": "批次简介",
- "columnType": "text"
- },
- {
- "columnName": "批次分类名称",
- "columnType": "text"
- },
- {
- "columnName": "兑换码",
- "columnType": "varchar(100)"
- }
- ],
- "columns": [
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "*",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_8kcPFkQWna",
- "tField": "*"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "dbTable_8kcPFkQWna",
- "rTName": "dbTable_xSTwEQ32HH",
- "lTField": "批次号",
- "rTField": "批次号",
- "joinType": "left join",
- "condition": []
- },
- "columnName": "批次关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": "批次关联"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次名称",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "批次名称"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次简介",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "批次简介"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "dbTable_8kcPFkQWna",
- "rTName": "dbTable_XdneF2SM7h",
- "lTField": "批次分类ID",
- "rTField": "_id",
- "joinType": "left join",
- "condition": []
- },
- "columnName": "批次分类关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": ""
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次分类名称",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_XdneF2SM7h",
- "tField": "分类名称"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "dbTable_8kcPFkQWna",
- "rTName": "dbTable_QZcxeDYPsz",
- "lTField": "兑换码ID",
- "rTField": "_id",
- "joinType": "left join",
- "condition": []
- },
- "columnName": "兑换码关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": ""
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "兑换码",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_QZcxeDYPsz",
- "tField": "兑换码"
- }
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_3NFzCAWJae",
- "name": "活动分类中台相关",
- "type": "group",
- "props": {
- "devId": "group_3NFzCAWJae"
- },
- "children": [
- {
- "id": "bComponent_GiWSTHw8Xe",
- "name": "活动分类管理后台组件",
- "type": "bComponent",
- "props": {
- "devId": "bComponent_GiWSTHw8Xe",
- "moduleId": "module_KQRf23H6p8",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_nr37DhHs56",
- "tableId": "dbTable_kTF3TXAEEB"
- },
- {
- "tempId": "dbTableTemp_DeEzJeMkjd",
- "tableId": "dbTable_xSTwEQ32HH"
- },
- {
- "tempId": "dbTableTemp_pTM2d2xs45",
- "tableId": "dbTable_XdneF2SM7h"
- }
- ]
- }
- },
- {
- "id": "group_hdZjHsBKe5",
- "name": "小程序api相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_KpBW3riiDd",
- "name": "活动分类白名单核验服务",
- "type": "service",
- "props": {
- "devId": "service_KpBW3riiDd",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\nconst USER_INFO = _F('middle_func').callMethod('last');\r\nconst 用户ID = USER_INFO._id;\r\nconst 手机号 = USER_INFO.手机号;\r\n\r\n\r\nif (!param.hasOwnProperty('批次分类ID')) {\r\n _funcCb({ code: 0, errMsg: '请传入批次分类ID', result: {} });\r\n return;\r\n}\r\n\r\nif (!手机号) {\r\n _funcCb({ code: 0, errMsg: '请先认证手机号', result: {} });\r\n return;\r\n}\r\n\r\nlet inParam = param;\r\n\r\nconst 批次分类ID = param.批次分类ID;\r\nconst 批次分类白名单缓存Key = `stock_cate_whitelist_${批次分类ID}_${用户ID}`;\r\n\r\nemitter.on('getDetailCache', async () => {\r\n //缓存获取\r\n const cacheRes = await _F('bCache_YEHcswD6ad').callMethod('get', {\r\n key: 批次分类白名单缓存Key\r\n }).catch((error) => {\r\n console.log('获取缓存失败');\r\n emitter.emit('checkWhiteList');\r\n });\r\n\r\n try {\r\n if (JSON.parse(cacheRes)) {\r\n console.log('获取缓存成功', cacheRes);\r\n _funcCb({ code: 200, errMsg: '有资格', result: JSON.parse(cacheRes) });\r\n } else {\r\n emitter.emit('checkWhiteList');\r\n }\r\n } catch (error) {\r\n emitter.emit('checkWhiteList');\r\n }\r\n\r\n});\r\n\r\nemitter.on('setDetailCache', async (cacheVal) => {\r\n //设置缓存\r\n await _F('bCache_YEHcswD6ad').callMethod('set', {\r\n key: 批次分类白名单缓存Key,\r\n value: JSON.stringify(cacheVal),\r\n expire: 3600 * 24 * 30\r\n }).catch((error) => {\r\n console.log('设置缓存失败');\r\n });\r\n});\r\n\r\nemitter.on('checkWhiteList', async () => {\r\n const urllib = (await _F('module_func').callMethod('import', 'urllib')).default;\r\n\r\n const url = `https://fwptgzh.sygh.org/wxapi/staffmobile/staffManager/checkPhone?phone=${手机号}`;\r\n\r\n urllib.request(url, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n data: {\r\n },\r\n dataType: 'json'\r\n }).then((response) => {\r\n const checkInfo = response.data;\r\n\r\n console.log('checkWhiteList',checkInfo);\r\n\r\n if (checkInfo.code === 200) {\r\n const flag = checkInfo.data.data.flag;\r\n if (!flag ) {\r\n //if (!flag && 手机号 !== '18675866207') {\r\n _funcCb({ code: 0, errMsg: '请实名认证并申领电子会员服务卡', result: checkInfo });\r\n } else {\r\n emitter.emit('setDetailCache', checkInfo);\r\n _funcCb({ code: 200, errMsg: '有资格', result: checkInfo });\r\n }\r\n\r\n } else {\r\n _funcCb({ code: 0, errMsg: '会员资格获取失败,请稍后再试', result: checkInfo });\r\n }\r\n }).catch(err => {\r\n _funcCb({ code: 0, errMsg: '会员资格获取失败,请稍后再试', result: err });\r\n });\r\n\r\n});\r\n\r\n\r\nemitter.emit('getDetailCache');",
- "inParams": [
- "批次分类ID"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock_cate/whitelist",
- "inParamsDebug": {
- "批次分类ID": ""
- }
- }
- },
- {
- "id": "service_CzHiAYYY7c",
- "name": "活动分类关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_CzHiAYYY7c",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nlet inParam = param || {};\r\n\r\nconst getList = (setCache) => {\r\n _F('bComponent_GiWSTHw8Xe').callMethod('service_MeJ5kQx5GB', {\r\n inParam,\r\n callback: (resp) => {\r\n console.log('getList',resp);\r\n if(resp?.code === 200 && Array.isArray(resp?.result)){\r\n setCache(resp?.result);\r\n }else{\r\n _funcCb(resp)\r\n }\r\n \r\n }\r\n }\r\n );\r\n}\r\n\r\nemitter.on('getCache', async () => {\r\n const reqRes = await _F('service_7w8aDmK8DS').call({\r\n \"缓存名称\": \"stock_cate\",\r\n \"查询参数\": inParam,\r\n \"缓存时间\": 60,\r\n \"查询回调\": getList\r\n });\r\n\r\n _funcCb({code:200,errMsg:'ok',result:reqRes});\r\n});\r\n\r\n\r\nemitter.emit('getCache');",
- "inParams": [
- "搜索条件",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock_cate/search",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- },
- {
- "id": "service_FMa6CiY2fs",
- "name": "活动分类详情服务",
- "type": "service",
- "props": {
- "devId": "service_FMa6CiY2fs",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nlet inParam = param || {};\r\ninParam.当前页码 = 1;\r\ninParam.每页大小 = 1;\r\n\r\nconst getList = (setCache) => {\r\n _F('bComponent_GiWSTHw8Xe').callMethod('service_MeJ5kQx5GB', {\r\n inParam,\r\n callback: (resp) => {\r\n console.log('getList',resp);\r\n if(resp?.code === 200 && Array.isArray(resp?.result) && resp?.result?.length > 0){\r\n setCache(resp?.result[0]);\r\n }else{\r\n _funcCb(resp)\r\n }\r\n \r\n }\r\n }\r\n );\r\n}\r\n\r\nemitter.on('getCache', async () => {\r\n const reqRes = await _F('service_7w8aDmK8DS').call({\r\n \"缓存名称\": \"stock_cate_detail\",\r\n \"查询参数\": inParam,\r\n \"缓存时间\": 60,\r\n \"查询回调\": getList\r\n });\r\n\r\n _funcCb({code:200,errMsg:'ok',result:reqRes});\r\n});\r\n\r\n\r\nemitter.emit('getCache');",
- "inParams": [
- "搜索条件",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/stock_cate/detail",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_PGpJ8Kc2ey",
- "name": "管理后台api相关",
- "type": "group",
- "props": {
- "devId": "group_PGpJ8Kc2ey"
- },
- "children": [
- {
- "id": "service_zwDhc7S3fX",
- "name": "活动分类关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_zwDhc7S3fX",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('getList', ()=>{\r\n _F('bComponent_GiWSTHw8Xe').callMethod('service_MeJ5kQx5GB',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('getList');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/stock_cate/search",
- "inParamsDebug": {
- "批次号": "",
- "当前页码": "",
- "批次名称": "",
- "是否删除": "",
- "每页大小": ""
- }
- }
- },
- {
- "id": "service_3QwFcaxic7",
- "name": "角色删除服务",
- "type": "service",
- "props": {
- "devId": "service_3QwFcaxic7",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = {};\r\nif(param.hasOwnProperty('角色ID'))inParam['角色ID'] = param.角色ID;\r\nif(param.hasOwnProperty('是否删除'))inParam['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\nemitter.on('delDept', ()=>{\r\n _F('bComponent_GiWSTHw8Xe').callMethod('service_FHxSD7RYtT',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('delDept');",
- "inParams": [
- "角色ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/role/del",
- "inParamsDebug": {
- "部门ID": "1",
- "是否删除": "0",
- "是否禁用": "0",
- "部门名称": "多八多总部2",
- "上级部门ID": "0"
- }
- }
- },
- {
- "id": "service_DCZHEkZa4t",
- "name": "活动分类编辑服务",
- "type": "service",
- "props": {
- "devId": "service_DCZHEkZa4t",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet inParam = param;\r\n\r\nemitter.on('editDept', ()=>{\r\n _F('bComponent_GiWSTHw8Xe').callMethod('service_64NNTKrwb3',{\r\n inParam,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "批次分类ID",
- "批次分类",
- "分类名称",
- "图片地址"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/stock_cate/edit",
- "inParamsDebug": {
- "分类名称": "",
- "图片地址": "",
- "批次分类": "",
- "批次分类ID": "1"
- }
- }
- },
- {
- "id": "service_r2NnswehMM",
- "name": "活动分类新增服务",
- "type": "service",
- "props": {
- "devId": "service_r2NnswehMM",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('appDept', ()=>{\r\n _F('bComponent_GiWSTHw8Xe').callMethod('service_7nGTY6s3nQ',{\r\n inParam:param,\r\n callback:(data)=>{\r\n _funcCb(data);\r\n }\r\n }\r\n );\r\n});\r\n\r\nemitter.emit('appDept');\r\n",
- "inParams": [
- "批次分类",
- "分类名称",
- "图片地址"
- ],
- "outParams": [],
- "openApiPath": "v1/admin/stock_cate/add",
- "inParamsDebug": {
- "分类名称": "",
- "图片地址": "",
- "批次分类": ""
- }
- }
- }
- ]
- },
- {
- "id": "group_W7FSSXWth7",
- "name": "数据表相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bCache_YEHcswD6ad",
- "name": "批次分类参加资格白名单缓存",
- "type": "bCache",
- "props": {}
- },
- {
- "id": "bCache_jwAY7zpBCk",
- "name": "批次分类缓存",
- "type": "bCache",
- "props": {}
- },
- {
- "id": "dbTable_XdneF2SM7h",
- "name": "活动分类表",
- "type": "dbTable",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "批次分类",
- "columnType": "text"
- },
- {
- "columnName": "分类名称",
- "columnType": "text"
- },
- {
- "columnName": "图片地址",
- "columnType": "json"
- },
- {
- "columnName": "最大领取次数",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_W7cFFPWANW",
- "name": "兑换码中台相关",
- "type": "group",
- "props": null,
- "children": [
- {
- "id": "bComponent_7aiWDzEFX5",
- "name": "兑换码管理后台组件",
- "type": "bComponent",
- "props": {
- "attr": [
- {
- "attrId": "variable_QcWhAZe56c",
- "attrType": "js",
- "attrJsCode": "[\r\n {\r\n dataIndex: \"兑换码\",\r\n operate: \"search|filter|add|eKey\"\r\n },\r\n {\r\n dataIndex: \"兑换状态\",\r\n operate: \"filter|add|edit\",\r\n default:0\r\n },\r\n {\r\n dataIndex: \"批次ID\",\r\n operate: \"add|edit\"\r\n },\r\n {\r\n dataIndex: \"有效期\",\r\n operate: \"add|edit\",\r\n },\r\n {\r\n dataIndex: \"是否删除\",\r\n operate: \"filter|add|edit\",\r\n default:0\r\n },\r\n]"
- }
- ],
- "moduleId": "module_remk87B6S2",
- "dbConnect": [
- {
- "tempId": "dbTableTemp_xiMSY5yJNc",
- "tableId": "dbTable_QZcxeDYPsz"
- },
- {
- "tempId": "dbViewTemp_wfrWwAbZJe",
- "tableId": "dbView_KQNTWsCCSk"
- }
- ]
- }
- },
- {
- "id": "group_Z8ZsXezbJ7",
- "name": "小程序api相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_7ezJdf5WMc",
- "name": "编辑兑换码服务",
- "type": "service",
- "props": {
- "devId": "service_编辑兑换码",
- "isOpen": true,
- "jsCode": "\n// 调用组件中的编辑服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('edit', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_SmQXCDGN2Z', {\n inParam: param,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('edit');\n",
- "inParams": [
- {
- "name": "行ID",
- "default": null
- },
- {
- "name": "兑换码",
- "default": ""
- },
- {
- "name": "兑换状态",
- "default": ""
- },
- {
- "name": "批次ID",
- "default": ""
- },
- {
- "name": "兑换结果",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/mini/exchange/edit"
- }
- },
- {
- "id": "service_m5wsx5sjia",
- "name": "搜索兑换码服务",
- "type": "service",
- "props": {
- "devId": "service_搜索兑换码",
- "isOpen": true,
- "jsCode": "\n// 调用组件中的搜索服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('search', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_HnxkCD6Ys7', {\n inParam: param,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('search');\n",
- "inParams": [
- "当前页码",
- "每页大小",
- "搜索条件"
- ],
- "outParams": [],
- "openApiPath": "v1/mini/exchange/search",
- "inParamsDebug": {
- "当前页码": "",
- "搜索条件": {
- "关键字": ""
- },
- "每页大小": ""
- }
- }
- },
- {
- "id": "service_kzW2y2e246",
- "name": "兑换码详情服务",
- "type": "service",
- "props": {
- "devId": "service_kzW2y2e246",
- "isOpen": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nlet inParam = param || {};\r\ninParam.当前页码 = 1;\r\ninParam.每页大小 = 1;\r\n\r\nconst getList = (setCache) => {\r\n _F('bComponent_7aiWDzEFX5').callMethod('service_HnxkCD6Ys7', {\r\n inParam,\r\n callback: (resp) => {\r\n console.log('getList', resp);\r\n if (resp?.code === 200 && Array.isArray(resp?.result) && resp?.result?.length > 0) {\r\n setCache(resp?.result[0]);\r\n } else {\r\n _funcCb(resp)\r\n }\r\n\r\n }\r\n }\r\n );\r\n}\r\n\r\nemitter.on('getCache', async () => {\r\n const reqRes = await _F('service_7w8aDmK8DS').call({\r\n \"缓存名称\": \"stock_cate_detail\",\r\n \"查询参数\": inParam,\r\n \"缓存时间\": 60,\r\n \"查询回调\": getList\r\n });\r\n\r\n _funcCb({ code: 200, errMsg: 'ok', result: reqRes });\r\n});\r\n\r\n\r\nemitter.emit('getCache');",
- "inParams": [
- {
- "name": "搜索条件",
- "default": null
- },
- {
- "name": "当前页码",
- "default": ""
- },
- {
- "name": "每页大小",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/mini/user/exchange/detail"
- }
- }
- ]
- },
- {
- "id": "group_ryxiQZTJmz",
- "name": "管理后台api相关",
- "type": "group",
- "props": null,
- "children": [
- {
- "id": "service_ssSCay8jKM",
- "name": "新增兑换码服务",
- "type": "service",
- "props": {
- "devId": "service_新增兑换码",
- "isOpen": true,
- "jsCode": "\n// 调用组件中的新增服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('add', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_8BYpSxRD3x', {\n inParam: param,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('add');\n",
- "inParams": [
- {
- "name": "兑换码",
- "default": ""
- },
- {
- "name": "兑换状态",
- "default": ""
- },
- {
- "name": "批次ID",
- "default": ""
- },
- {
- "name": "兑换结果",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/admin/exchange/add"
- }
- },
- {
- "id": "service_DJXRMdKMad",
- "name": "编辑兑换码服务",
- "type": "service",
- "props": {
- "devId": "service_编辑兑换码",
- "isOpen": true,
- "jsCode": "\n// 调用组件中的编辑服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('edit', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_SmQXCDGN2Z', {\n inParam: param,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('edit');\n",
- "inParams": [
- {
- "name": "行ID",
- "default": null
- },
- {
- "name": "兑换码",
- "default": ""
- },
- {
- "name": "兑换状态",
- "default": ""
- },
- {
- "name": "批次ID",
- "default": ""
- },
- {
- "name": "兑换结果",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/admin/exchange/edit"
- }
- },
- {
- "id": "service_Wn8trXc46c",
- "name": "获取兑换码列表服务",
- "type": "service",
- "props": {
- "devId": "service_获取兑换码列表",
- "isOpen": true,
- "jsCode": "\n// 调用组件中的获取列表服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('list', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_HnxkCD6Ys7', {\n inParam: param,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('list');\n",
- "inParams": [
- {
- "name": "当前页码",
- "default": 1
- },
- {
- "name": "每页大小",
- "default": 10
- },
- {
- "name": "搜索条件",
- "default": {
- "关键字": ""
- }
- }
- ],
- "outParams": [],
- "openApiPath": "v1/admin/exchange/search"
- }
- },
- {
- "id": "service_i28cQzDQe4",
- "name": "批量新增兑换码服务",
- "type": "service",
- "props": {
- "devId": "service_新增兑换码",
- "isOpen": true,
- "jsCode": "// 调用组件中的新增服务\nconst emitter = new events.EventEmitter();\n\nfunction 生成不重复随机数(位数, 个数) {\n // 输入校验\n if (位数 < 1) return '位数必须大于0';\n if (个数 < 1) return '个数必须大于0';\n\n // 最大组合数校验\n if (个数 > Math.pow(10, 位数) - 1) {\n return '个数超过最大组合数'; \n }\n\n // 生成不重复随机数\n let 数组 = [];\n while (数组.length < 个数) {\n let 数字 = Math.floor(Math.random() * Math.pow(10, 位数)).toString().padStart(位数, '0');\n if (!数组.includes(数字)) {\n 数组.push(数字);\n }\n }\n\n return 数组;\n}\nconst 行数组 = [];\nconst 生成数量 = param.生成数量 > 1000 ? 1000 : (param.生成数量 || 1);\nconst 随机数长 = param.随机数长 || 4;\nconst 兑换码 = param.兑换码 || '';\nconst 兑换状态 = param.兑换状态 || 0;\nconst 批次ID = param.批次ID;\nconst 有效期 = param.有效期;\n\n// 使用示例\nlet 不重复随机数数组 = 生成不重复随机数(随机数长, 生成数量);\n\nif (typeof 不重复随机数数组 === 'string') {\n console.log(不重复随机数数组)\n _funcCb({ code: 0, errMsg: 不重复随机数数组, result: {} });\n return;\n} else {\n console.log(不重复随机数数组);\n}\n\nfor (let i = 0; i < 生成数量; i++) {\n\n 行数组.push({\n 兑换码: 兑换码 + 不重复随机数数组[i],\n 兑换状态,\n 批次ID,\n 有效期,\n })\n}\n\nconst inParam = {\n 行数组\n}\n\n\nemitter.on('add', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_Fz8RK7rnPj', {\n inParam: inParam,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('add');\n",
- "inParams": [
- {
- "name": "兑换码",
- "default": ""
- },
- {
- "name": "兑换状态",
- "default": ""
- },
- {
- "name": "批次ID",
- "default": ""
- },
- {
- "name": "兑换结果",
- "default": ""
- }
- ],
- "outParams": [],
- "openApiPath": "v1/admin/exchange/batch_add"
- }
- },
- {
- "id": "service_y3jTKFCKQd",
- "name": "编辑兑换码服务",
- "type": "service",
- "props": {
- "devId": "service_编辑兑换码",
- "isOpen": true,
- "jsCode": "\n// 调用组件中的编辑服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('edit', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_ERbTR6esDz', {\n inParam: param,\n callback: (data) => {\n _funcCb(data);\n }\n });\n});\n\nemitter.emit('edit');\n",
- "inParams": [
- {
- "name": "行ID",
- "default": null
- },
- {
- "name": "是否删除",
- "default": ""
- }
- ],
- "babelCode": "// 调用组件中的编辑服务\nconst emitter = new events.EventEmitter();\nemitter.on('edit', () => {\n _F('bComponent_7aiWDzEFX5').callMethod('service_ERbTR6esDz', {\n inParam: param,\n callback: data => {\n _funcCb(data);\n }\n });\n});\nemitter.emit('edit');",
- "outParams": [],
- "openApiPath": "v1/admin/exchange/del"
- }
- }
- ]
- },
- {
- "id": "group_7Ni8hd6BhC",
- "name": "数据表相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "dbTable_QZcxeDYPsz",
- "name": "兑换码表",
- "type": "dbTable",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "兑换码",
- "columnType": "varchar(100)"
- },
- {
- "columnName": "兑换状态",
- "columnType": "int"
- },
- {
- "columnName": "批次ID",
- "columnType": "int"
- },
- {
- "columnName": "有效期",
- "columnType": "int"
- },
- {
- "columnName": "兑换结果",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbView_KQNTWsCCSk",
- "name": "兑换码+批次视图",
- "type": "dbView",
- "props": {
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "兑换码",
- "columnType": "varchar(100)"
- },
- {
- "columnName": "兑换状态",
- "columnType": "int"
- },
- {
- "columnName": "批次ID",
- "columnType": "int"
- },
- {
- "columnName": "有效期",
- "columnType": "int"
- },
- {
- "columnName": "兑换结果",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "批次简介",
- "columnType": "text"
- },
- {
- "columnName": "批次名称",
- "columnType": "text"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "是否上架",
- "columnType": "int"
- },
- {
- "columnName": "制券商户号",
- "columnType": "text"
- }
- ],
- "columns": [
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "*",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_QZcxeDYPsz",
- "tField": "*"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "dbTable_QZcxeDYPsz",
- "rTName": "dbTable_xSTwEQ32HH",
- "lTField": "批次ID",
- "rTField": "_id",
- "joinType": "left join",
- "condition": []
- },
- "columnName": "批次关联",
- "columnType": "join",
- "fieldParam": {
- "tName": "",
- "tField": ""
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次简介",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "批次简介"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次名称",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "批次名称"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "批次号",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "批次号"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "是否上架",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "是否上架"
- }
- },
- {
- "field": "",
- "direction": "",
- "joinParam": {
- "lTName": "",
- "rTName": "",
- "lTField": "",
- "rTField": "",
- "joinType": "inner join",
- "condition": []
- },
- "columnName": "制券商户号",
- "columnType": "field",
- "fieldParam": {
- "tName": "dbTable_xSTwEQ32HH",
- "tField": "制券商户号"
- }
- }
- ]
- }
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "group_tNcDmx76ti",
- "name": "微信代金券相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "bComponent_67ky8TZdD7",
- "name": "微信支付代金券SDK组件",
- "type": "bComponent",
- "props": {
- "attr": [
- {
- "attrId": "variable_bhTzna4CiM",
- "attrType": "string",
- "attrValue": "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCm9tzs4HJHJCcw rzCzFf9u0Qmr3gdr9WwKqxzQ4n33fOHCE/AYCX+h7j/VtOaZM+YA0G1oyu0ra1xv 2akal8hIDo+d/8LESvxNy0yJBRmtviQge2Elu6dQh9P0bGp5Ozy8Ac9PyoC+PpPa uuHdupIOx8jqLWUR4s8YN9jLbpzRqqtHazrt5eOZcaq5N2xqagjnkcLEm3sgfCQ3 oOBDuwm2eJas/udrZ42v2X0n7cpjqKihHiwUJJVf6KryM7olvdpP4hwYqlf5KsxS Ou0w2P8TrNg5YWEMgZiJfgZrM4sNNkNnCqpirdYJZqojXSR0XB31RjJvr6HUOsBZ 6pMWgJpFAgMBAAECggEAFyUvmRLAJMaJPEF88caB413NBmtAAiJCePQhiX9sUOuZ 7CqRZPOkItGBPeHW+bPtFX3PPPCskhFO/h5hR9N0qzCBjjiPSmDOuwYMtQ3k8mXi YjJYVD/AQPSjWEXTOL0SfUmO8JO05yqLmo2/k9oyNyRQ4M2sLh+P796GCiVqTdIu eyU3ERBPLjUqzITQ341L3Mzs1BjU63QdY80QCggh4gQsCS40aWfdsRXBSdDWz1s4 UnIgRTVyrilH6WZ6t1WESYX4Z1Z0V6EFaVXW5ksX1PHnmByTnVnIiLoixIIkKDZa /fQ5nQEQTFeeYloXoDU1mn+5SmHTWHrWDB/3Gwe1wQKBgQDdHETA/GGk3TaEJRxk s1LEx1hP3OtYsoQ9sMqz9mxOMPN3Oo04Rc6NofmO4BIo8v6zy7E/k94YgbONqeDD fYqneAWT9mwZCulUQfz68Xdr2ANK8fFMbl6sqOuTL5oGSN/iSfQIjW2Uw02rlS+S LdNJBs2QXuu96HNSKrfZtT7BFQKBgQDBT141AuuRbI+oQ5UzRL0OPwd/yCqDL5Sh +KLWL7cp64YiwxygFRsDIIQku7k8RkEyzqZqZHFvRNWA2HH01KioEFoKQKbL4FNO AugUkKXKkv6M9/hbzFZvQiJ71lRSdWx3I+37qLXOb4zfDYfTwOOvGKUauNh32TuJ 1BGxUi/gcQKBgE2z3HmRd+MPFlR0EjlVR3X9tAxEz7QY8B4Z3fJGXCNSUo0I1436 Ai+Fx4StO9SGKHoY0A5OsZMdKXNUSreIi8x0gklQJQbb7cl9cyDg8J3GiMmyoqDA fKbiqf7MkK06uOr2IDtNMEBCLi5pPBF75y9Xo6/jm6beZIBwoLFyXz5NAoGBAJ45 YnitfTc4zpUBTDv8hWoFuROkOPfLmDLDGjWKNLfBKbeGUAXPgJ6cnMycQs/NCUyW zKvErvxOMRsXDp9A+RMm3ywJIv05DbaKtn8uriUTD/s+dDBfHlhOn38RPU+JAVC7 Pe2Ad98SexGPN5/g//uvhmRK7BOc4Ri9VgX3qWxhAoGAc3vcDqXCOdSHJGghBTQC RCBbEYgB27v0nIyeKZCT0HFkAPQHYNJ5Mu9XNkhzl76VYbjhthnf0PeFQSC2+bLa u204zhvdpnwNfnaLA6Re+H7iS11If1zV5SGiauAyH4T7gWSm//cdhkxdaEDxHj7a /BN9q7r60busY4eAkM+Q73w=",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_F6Pac3TGrQ",
- "attrType": "string",
- "attrValue": "1524075161",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_64jPC6yNCs",
- "attrType": "string",
- "attrValue": "5FD0E925D16E68FC5F74F9DF30F9923080520FF2",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_ZZKxrnEpKw",
- "attrType": "string",
- "attrValue": "wx90d230c69b82b4c0",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_CECZhxwhdG",
- "attrType": "string",
- "attrValue": "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCgLrTMgT2iemi5 i1E6foYRKDYhqpd+7QkLajRvaA0wQOyhj63tEZfSFZnlLBGenLVFA/EW3rS2ThtJ g2lQDJ7q7Z5CmYVIfubM0jUKa4Raa7XumRVNnSCA4y4NSY0mkn/fVULs37KoUhwO fFXteKzC7BvLuieYlkbeEnnaZIU/+SXLHINFi5+n84q0zFfOAh5BsiQnaSyCdZgH 1NVGtadspKzZfXFUpOSxhvmTvpePgHtsnxWly1xjhtKIzFZAmo+bM0nxOGPU6q6g c5KmJ1ftGqcejI/3MNOwffhuObLGMsyJGSAK3AQL6TTAtwHj98LIeOPhATVwKnhC xSYpU0ZXAgMBAAECggEAbogsPF4GUOLU9wvarll2W8p6p/qWdYBNWHId4q5TQ3PZ lZaWttsH/3DmdAxX0DJkp04UA+sDmjUFgVHLzvAWjRgQt/ZF0YO38agv75PHjbl7 njxGRfth3W5mbcbOPsqisFKeTuQB3UJjl99WT/qQhCT2/Trkbdds6XqoWPo6NKy5 RN8QBZGopojs3XascpIUstAk0k6Ut1084AEjjqxZmp0DBu3WjVe7xLDf3hpeLLBY cNV8ZJ/YarBwJszGle1f+GKeDpW/pkcC34DziVsSrezlURlXHfuAhRw9eXctFGgs iAgD6V/3xapeWG7HwXwMqA5WAex+jh8al72Z0Ls5SQKBgQDP79E5UTyX4tPOcINx g1sW/5BfG8tyO21WHq6W2pjQv9eYpjiYsM01XmR5DU2sAtRdlUvRvOCnLSrxJAS7 shNAlIXT1jlwAyVewyeKKuPbSFljafcg6sSweEOqxN7lBg63NFJQb1SQQicxC9Zd +QVxzwg2iFxg3TW1LtPz934dfQKBgQDFNSKmfQrYJmQPN+sfZwQS8WGHn2yHeMY3 f8RmFUxwYNRFLCjhBc6thyGvCONYwJuJBbpAZ7fcq8bcHc323qQT4Jrp+GXhz+kG fFsuabv16mn3pAn+rdlWgk6LD4YBDpwqwCdm8qIRl3dZFZvx6ruHqcIdEp3RzWrg gmxyQaeLYwKBgGvoTjFqgQFpSvWE2hGcUzcaJPfWWrvLLzBT99J9WnRqOh4TlKdY iQW7GHThfH9ZcI+oHJKZbBQVkoVVZcdp4CfRa6nFMEV6vHfy2qAPJfP0Fb9LjF3e t3fE0YjbZbiAbj6Qvm7Td5TtX51KQVK/Gh43jFGQbjAuW+LMjF29AAuZAoGBAI0v IFJ/PO9IdOQsTWla8CC7rO5SpXlLbuU21J2c6++ccvvexJls9e1nzCaqv1C/+9oa PqBzYL9cP29A6z6tYFxWtbGBwzbqCVM6XnEZA5boLts7Fmi9f9aeTari/zXshsNY dB0Q4hSkEq61eMK2IXHbh/wWYuRcIwL+fLND67YvAoGBAJdrQzE5c9uoxN8/5QIL t2D/lOAVDoxm3whXllB0Zc633iE9oAg+HBTPcg/XfO12bb9PXitWNNjZmox8roYW Kp52vN7kGkNiw1L/h801pxWat4Giaf1BSq1JeEG/Y7qmI8Oz3aXLbGTT6cb4dCJQ 4jn00sOMnuevyziwnmaU7AtD",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_WGWwxWXhtP",
- "attrType": "string",
- "attrValue": "1395928102",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_Ye37GiY7pQ",
- "attrType": "string",
- "attrValue": "2DD0F3A8FEB0197E85C7B681EB8A135E1D0F181B",
- "attrJsCode": ""
- },
- {
- "attrId": "variable_TKQnZxySr4",
- "attrType": "string",
- "attrValue": "wxfea9bdc8104eede9",
- "attrJsCode": ""
- }
- ],
- "moduleId": "module_PEK2CxS7xC"
- }
- },
- {
- "id": "service_iHnrcE62Mz",
- "name": "查询代金券批次详情服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const inParam = {\r\n openid: 'oPC5r5bZArKsVFeH4I7fO1p1y4yk',\r\n couponId: '31829742841'\r\n};\r\nconst signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_7cSwKHSNyz', { inParam });\r\n\r\n_funcCb(signRes);"
- }
- },
- {
- "id": "service_SW2Max85Rd",
- "name": "发放代金券批次服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const inParam = {\r\n openid: 'oP-y45xbf7hrhC6yeabpjXzIhUWg',\r\n stock_id: '17615961-',\r\n out_request_no: '65436353535435',\r\n stock_creator_mchid: '1524075161',\r\n};\r\nconst signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_FFZCEpzHrA', { inParam });\r\n\r\n_funcCb(signRes);"
- }
- },
- {
- "id": "service_e4PWFA4NzR",
- "name": "条件查询批次列表服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const inParam = {\r\n offset: 1,\r\n limit: 10,\r\n stock_creator_mchid: '1395928102',\r\n // status: 'stoped',\r\n};\r\nconst signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_x7kn8sGBdy', { inParam });\r\n\r\n_funcCb(signRes);"
- }
- },
- {
- "id": "service_QYBtQypeiF",
- "name": "创建代金券批次服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const inParam = {\r\n body: {\r\n \"stock_name\": \"微信支付代金券批次\",\r\n \"comment\": \"零售批次\",\r\n \"belong_merchant\": \"1524075161\",\r\n \"available_begin_time\": \"2023-06-08T15:10:35+08:00\",\r\n \"available_end_time\": \"2023-06-18T13:29:35+08:00\",\r\n \"stock_use_rule\": {\r\n \"max_coupons\": 100,\r\n \"max_amount\": 1000,\r\n \"max_amount_by_day\": 400,\r\n \"max_coupons_per_user\": 3,\r\n \"natural_person_limit\": false,\r\n \"prevent_api_abuse\": false\r\n },\r\n \"pattern_info\": {\r\n \"description\": \"微信支付营销代金券\",\r\n \"merchant_logo\": \"https://qpic.cn/xxx\",\r\n \"merchant_name\": \"微信支付\",\r\n \"background_color\": \"COLOR020\",\r\n \"coupon_image\": \"https://qpic.cn/xxx\"\r\n },\r\n \"coupon_use_rule\": {\r\n\r\n \"fixed_normal_coupon\": {\r\n \"coupon_amount\": 10,\r\n \"transaction_minimum\": 20\r\n },\r\n\r\n \"goods_tag\": [\r\n \"123321\",\r\n \"123322\"\r\n ],\r\n \"trade_type\": [\"OTHER\", \"APPPAY\"],\r\n \"combine_use\": false,\r\n \"available_items\": [\r\n \"123321\",\r\n \"123322\"\r\n ],\r\n \"available_merchants\": [\r\n \"1524075161\",\r\n ]\r\n },\r\n \"no_cash\": true,\r\n \"stock_type\": \"NORMAL\",\r\n \"out_request_no\": \"895600020176543\"\r\n }\r\n};\r\nconst signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_z8227dt5h3', { inParam });\r\n\r\n_funcCb(signRes);"
- }
- },
- {
- "id": "service_aPTkBiZjQD",
- "name": "激活代金券批次服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const inParam = {\r\n stock_id: '17615961',\r\n stock_creator_mchid: '1524075161',\r\n};\r\nconst signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_kx2ADaXesE', { inParam });\r\n\r\n_funcCb(signRes);"
- }
- },
- {
- "id": "group_FAX5mWD7dd",
- "name": "回收站",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "state_M8JDM7k7NM",
- "type": "state",
- "children": [
- {
- "id": "variable_MyfrJ3SPZ5",
- "type": "variable",
- "props": {}
- },
- {
- "id": "variable_CTPr2AxBiA",
- "name": "apiV3私钥",
- "type": "variable",
- "props": {
- "value": ""
- }
- }
- ]
- },
- {
- "id": "service_G7wKRyHE4w",
- "name": "计算微信支付V3签名串服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const inParam = {\r\n httpMethod:'GET',\r\n url:'https://api.mch.weixin.qq.com/v3/marketing/favor/users/oP-y45xbf7hrhC6yeabpjXzIhUWg/coupons/31829742841?appid=wx90d230c69b82b4c0',\r\n body:''\r\n};\r\nconst signRes = await _F('bComponent_67ky8TZdD7').callMethod('service_nmMHiZNT3M',{inParam});\r\n\r\n_funcCb(signRes);"
- }
- },
- {
- "id": "service_B87a2TQtA8",
- "name": "生成一个16位的随机串2",
- "type": "service",
- "props": {
- "isSync": false,
- "jsCode": "function generateNonceStr(length = 32) {\r\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\r\n const maxPos = chars.length;\r\n let nonceStr = '';\r\n for (let i = 0; i < length; i++) {\r\n nonceStr += chars.charAt(Math.floor(Math.random() * maxPos));\r\n }\r\n return nonceStr;\r\n}\r\n\r\nconst str = generateNonceStr(16)\r\n\r\nconsole.log(str); // 生成一个16位的随机串\r\n\r\n_funcCb(str)"
- }
- },
- {
- "id": "service_5rabdPZ3zm",
- "name": "计算微信支付V3签名串服务7",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const crypto = await Import('crypto');\r\nconst urllib = await Import('urllib');\r\nconst { URL } = await Import('url');\r\n\r\nfunction generateWechatPayV3Signature(httpMethod, url, body, mch_private_key, merchant_id, serial_no, nonce) {\r\n \r\n const privateKey = `-----BEGIN PRIVATE KEY-----\\n${mch_private_key}\\n-----END PRIVATE KEY-----`;\r\n\r\n const timestamp = Math.floor(Date.now() / 1000);\r\n\r\n const urlParts = new URL(url);\r\n const canonicalUrl = urlParts.pathname + (urlParts.search || '');\r\n\r\n const message = `${httpMethod}\\n${canonicalUrl}\\n${timestamp}\\n${nonce}\\n${body}\\n`;\r\n //const message = `GET\\n/v3/marketing/favor/users/oP-y45xbf7hrhC6yeabpjXzIhUWg/coupons/31829742841?appid=wx90d230c69b82b4c0\\n1686129065\\nrl6KrYyF6Zx5nAPeqOJSqLoTJs3gBzkk\\n\\n`;\r\n console.log('message',JSON.stringify(message));\r\n\r\n const sign = crypto.createSign('RSA-SHA256');\r\n sign.write(message);\r\n sign.end();\r\n const rawSign = sign.sign(privateKey, 'base64');\r\n\r\n const schema = 'WECHATPAY2-SHA256-RSA2048';\r\n const token = `${schema} mchid=\"${merchant_id}\",nonce_str=\"${nonce}\",timestamp=\"${timestamp}\",serial_no=\"${serial_no}\",signature=\"${rawSign}\"`;\r\n\r\n return token;\r\n}\r\nfunction generateNonceStr(length = 32) {\r\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\r\n const maxPos = chars.length;\r\n let nonceStr = '';\r\n for (let i = 0; i < length; i++) {\r\n nonceStr += chars.charAt(Math.floor(Math.random() * maxPos));\r\n }\r\n return nonceStr;\r\n}\r\n\r\nconsole.log('param',param);\r\n\r\n// 调用示例\r\nconst httpMethod = param.httpMethod;\r\n//const url = param.url;\r\n//const body = JSON.stringify(param.body) || '';\r\nconst body = '';\r\n// const mch_private_key = _F('variable_bhTzna4CiM').callMethod('get');\r\n// const merchant_id = _F('variable_F6Pac3TGrQ').callMethod('get');\r\n// const serial_no = _F('variable_64jPC6yNCs').callMethod('get');\r\n\r\nconst mch_private_key = _F('variable_CTPr2AxBiA').callMethod('get');\r\nconst merchant_id = '1524075161';\r\nconst serial_no = '5FD0E925D16E68FC5F74F9DF30F9923080520FF2';\r\nconst nonce = generateNonceStr(16);\r\n\r\nconst openid = 'oP-y45xbf7hrhC6yeabpjXzIhUWg';\r\nconst couponId = '31829742841';\r\nconst appid = 'wx90d230c69b82b4c0';\r\nconst url = `https://api.mch.weixin.qq.com/v3/marketing/favor/users/${openid}/coupons/${couponId}?appid=${appid}`;\r\n\r\nconst signature = generateWechatPayV3Signature(httpMethod, url, body, mch_private_key, merchant_id, serial_no, nonce);\r\nconsole.log(signature);\r\n\r\n// 发送请求\r\n//\r\n\r\nconsole.log(urllib);\r\n\r\nconst reqRes = await urllib.request(url, {\r\n method: httpMethod,\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Authorization': signature,\r\n 'Accept': 'application/json',\r\n 'User-Agent': 'Your User Agent'\r\n },\r\n});\r\n\r\n_funcCb(reqRes.data.toString());\r\n",
- "inParams": [
- "httpMethod",
- "url",
- "body"
- ],
- "inParamsDebug": {
- "url": "https://api.mch.weixin.qq.com/v3/certificates",
- "body": "",
- "httpMethod": "GET"
- }
- }
- },
- {
- "id": "service_dGZdbA7Mmi",
- "name": "读取私钥base64",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const crypto = await Import('crypto');\r\n\r\nfunction readPrivateKey() {\r\n const privateKeyData = `-----BEGIN PRIVATE KEY-----\r\n${_F('variable_CTPr2AxBiA').callMethod('get')}\r\n-----END PRIVATE KEY-----`;\r\n const privateKey = crypto.createPrivateKey({\r\n key: privateKeyData,\r\n format: 'pem',\r\n passphrase: 'your_passphrase' // 如果私钥有密码,请提供密码,否则可以省略此行\r\n });\r\n\r\n return privateKey;\r\n}\r\n\r\n// 使用示例\r\nconst privateKey = readPrivateKey();\r\n\r\nconsole.log('privateKey',privateKey);\r\n\r\n_funcCb('234242');\r\n"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "group_abFAbG8Csp",
- "name": "腾讯云sts相关",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_s5zkfwxdXE",
- "name": "获取cos sts",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const tencentcloud = await Import(\"tencentcloud-sdk-nodejs\");\r\n\r\n\r\nconst StsClient = tencentcloud.sts.v20180813.Client;\r\n\r\nconst Bucket = _F('variable_cs76GrPQBS').callMethod('get');\r\nconst Region = _F('variable_5Fder6BiDX').callMethod('get');\r\nconst SecretId = _F('variable_AfFA3mx7bR').callMethod('get');\r\nconst SecretKey = _F('variable_KKzzykcBtS').callMethod('get');\r\nconst BucketName = Bucket?.split('-')[0];\r\nconst BucketUid = Bucket?.split('-')[1];\r\nconst Policy = {\r\n \"version\": \"2.0\",\r\n \"statement\": [\r\n {\r\n \"action\": [\r\n // \"name/cos:PutObject\",\r\n \"name/cos:PostObject\",\r\n // \"name/cos:InitiateMultipartUpload\",\r\n // \"name/cos:ListMultipartUploads\",\r\n // \"name/cos:ListParts\",\r\n // \"name/cos:UploadPart\",\r\n // \"name/cos:CompleteMultipartUpload\"\r\n ],\r\n \"effect\": \"allow\",\r\n \"resource\": [\r\n `qcs::cos:${Region}:uid/${BucketUid}:prefix//${BucketUid}/${BucketName}/*`\r\n ]\r\n }\r\n ]\r\n}\r\n\r\nconst clientConfig = {\r\n\tcredential: {\r\n\t\tsecretId:SecretId,\r\n\t\tsecretKey: SecretKey,\r\n\t},\r\n\tregion: Region,\r\n\tprofile: {\r\n\t\thttpProfile: {\r\n\t\t\tendpoint: \"sts.tencentcloudapi.com\",\r\n\t\t},\r\n\t},\r\n};\r\n\r\nconst client = new StsClient(clientConfig);\r\nconst params = {\r\n\t\"Name\": BucketName,\r\n\t\"Policy\": encodeURIComponent(JSON.stringify(Policy)),\r\n\t\"DurationSeconds\": 600\r\n};\r\nclient.GetFederationToken(params).then(\r\n\t(data) => {\r\n\t\tconsole.log(data);\r\n\t\t//return data;\r\n\t\t_funcCb({code:200,errMsg:'ok',result:data});\r\n\t},\r\n\t(err) => {\r\n\t\tconsole.error(\"error\", err);\r\n\t\t//return err;\r\n\t\t_funcCb({code:0,errMsg:'fail',result:err});\r\n\t}\r\n);\r\n"
- }
- },
- {
- "id": "service_H5ynAy5GEG",
- "name": "sts 混合",
- "type": "service",
- "props": {
- "isOpen": false,
- "isSync": true,
- "jsCode": "var COS = await Import('cos-nodejs-sdk-v5');\r\n\r\n\r\nvar Bucket = _F('variable_cs76GrPQBS').callMethod('get');\r\nvar Region = _F('variable_5Fder6BiDX').callMethod('get');\r\nvar Key = param.name;\r\nvar protocol = 'https:';\r\nvar url = protocol + '//' + Bucket + '.cos.' + Region + '.myqcloud.com/';\r\n\r\n\r\n_F('service_s5zkfwxdXE').call(param, (result) => {\r\n\r\n if (result.code === 200) {\r\n\r\n const Credentials = result.result.Credentials;\r\n\r\n var cosAuth = COS.getAuthorization({\r\n SecretId: Credentials.TmpSecretId,\r\n SecretKey: Credentials.TmpSecretKey,\r\n Pathname:'/',\r\n Key,\r\n Method: param.method,\r\n })\r\n\r\n _funcCb({\r\n code: 200, errMsg: 'ok', result: {\r\n url,\r\n fields: {\r\n key: Key,\r\n signature: cosAuth,\r\n 'x-cos-security-token': Credentials.Token,\r\n 'Content-Type': ''\r\n }\r\n }\r\n });\r\n }else{\r\n _funcCb(result);\r\n }\r\n\r\n})\r\n\r\n",
- "inParams": [
- "name",
- "method"
- ],
- "openApiPath": "v1/admin/cos_sts/presign",
- "inParamsDebug": {
- "name": "abc.jpg",
- "method": "post"
- }
- }
- },
- {
- "id": "service_atYdTsxFTW",
- "name": "获取cos 预签名 小程序",
- "type": "service",
- "props": {
- "isOpen": true,
- "jsCode": "_F('service_H5ynAy5GEG').call(param,(result)=>{\r\n _funcCb(result);\r\n})\r\n\r\n",
- "openApiPath": "v1/mini/user/cos_sts/presign"
- }
- },
- {
- "id": "service_wTZ2cytRNj",
- "name": "获取cos 预签名 管理后台",
- "type": "service",
- "props": {
- "isOpen": true,
- "jsCode": "_F('service_H5ynAy5GEG').call(param,(result)=>{\r\n _funcCb(result);\r\n})\r\n\r\n",
- "openApiPath": "v1/admin/cos_sts/presign"
- }
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "modules_xmCxQ8xRQA",
- "name": "模块",
- "type": "modules",
- "props": {},
- "children": [
- {
- "id": "module_Rn2saN62Y8",
- "name": "用户中台模块",
- "type": "module",
- "props": {
- "devId": "module_Rn2saN62Y8",
- "appModuleId": "7",
- "appModuleVersion": 76
- },
- "children": [
- {
- "id": "config_DrYAQPCmzh",
- "name": "用户中台模块",
- "type": "config",
- "props": {
- "style": {}
- }
- },
- {
- "id": "front_EzBatPxrZJ",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_fsQ2FEWfrQ",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_3tfS7BQT3t",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_J72YiPd38d",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_tC3XrhNzXP",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_kZGeEDT6hf",
- "type": "state",
- "children": []
- },
- {
- "id": "method_ip6fsHjBhe",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_xm6yMC3fPC",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "backend_hMYYB26yzB",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_XDTzsbpzzF",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_jZjJ5nRTdX",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_5Af6az6k6J",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_amBQpHZ56h",
- "name": "编辑用户信息",
- "type": "service",
- "props": {
- "devId": "service_amBQpHZ56h",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(!param.用户ID){\r\n _funcCb({code:0,errMsg:'请传入用户ID',result:{}});\r\n return;\r\n}\r\n\r\nlet editObj = {};\r\nif(param.昵称)editObj.昵称 = param.昵称;\r\nif(param.手机号)editObj.手机号 = param.手机号;\r\n\r\nemitter.on('editUser', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('editRow',{\r\n row:editObj,\r\n condition:{\r\n _id:param.用户ID,\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑用户成功',result:data});\r\n },\r\n fail:(err)=>{\r\n _funcCb({code:0,errMsg:'编辑用户失败',result:err});\r\n }\r\n });\r\n});\r\n\r\nemitter.emit('editUser');",
- "inParams": [
- "用户ID",
- "昵称",
- "手机号"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_DE3rN7bad6",
- "name": "用户名密码登录",
- "type": "service",
- "props": {
- "devId": "service_DE3rN7bad6",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名,密码 == 密码)\r\nconst emitter = new events.EventEmitter(); \r\nlet userInfo = null;\r\nlet userToken = null;\r\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key\r\nlet userLoginTokenSetKey = 'userLoginTokenSet';//用户登录串缓存集合key \r\nlet userTokenSet = [];//用户登录串缓存key集合\r\nlet multLogin = param.允许多端登录?true:false;\r\nlet useCookie = param.使用cookie?true:false;\r\nlet cookieHost = param.cookie域名?param.cookie域名:'';\r\nlet loginExpire = param.登录有效时长 > 0?param.登录有效时长:3600;\r\n\r\nemitter.on('showError',(errMsg,result)=>{\r\n\t_funcCb({code:0,errMsg,result:result || {}});\r\n});\r\n\r\nif(!param.用户名){\r\n _funcCb({code:0,errMsg:'请传入用户名',result:{}});\r\n return;\r\n}\r\n\r\nif(!param.密码){\r\n _funcCb({code:0,errMsg:'请传入密码',result:{}});\r\n return;\r\n}\r\n\r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow',{\r\n condition:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n },\r\n success:(data)=>{\r\n if(Array.isArray(data) && data.length <= 0 ) \r\n \temitter.emit('noUserInfo');\r\n else{\r\n\t\t\t\tuserInfo = data[0];\r\n\t\t\t\temitter.emit('getUserToken');\r\n\t\t\t\temitter.emit('setUserLoginTokenKey');\r\n\t\t\t\temitter.emit('getUserTokenSet');\r\n\t\t\t}\r\n \t\r\n },\r\n fail:(err)=>{\r\n emitter.emit('showError','获取用户信息失败',err);\r\n }\r\n });\r\n});\r\n\r\nemitter.on('noUserInfo',()=>{\r\n\t_funcCb({code:0,errMsg:'用户名或密码不正确',result:{}});\r\n});\r\n\r\nemitter.on('setUserLoginTokenKey',()=>{\r\n\tuserLoginTokenKey = `${userLoginTokenKey}:${userToken}`;\r\n\tuserLoginTokenSetKey = `${userLoginTokenSetKey}:${userInfo._id}`;\r\n});\r\n\r\nemitter.on('getUserToken',()=>{\r\n\t_F('service_xk6eian5Dd').call({},(data)=>{\r\n\t\tuserToken = data.result;\r\n\t});\r\n\t\r\n});\r\n\r\nemitter.on('getUserTokenSet',()=>{\r\n\t_F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\r\n\t\t\tkey:userLoginTokenSetKey,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t\tif(data)\r\n\t\t\t\t\tuserTokenSet = JSON.parse(data);\r\n\t\t\t\t\r\n\t\t\t\temitter.emit('checkMultLogin');\r\n\t\t\t\temitter.emit('checkUseCookie');\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n\t\r\n});\r\n\r\nemitter.on('delUserToken',(token)=>{\r\n\t//调用 后台缓存redis组件.缓存删除(用户登录串缓存key)\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('del',{\r\n\t\t\tkey:`userLoginToken:${token}`,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('setUserToken',()=>{\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\r\n\t\t\tkey:userLoginTokenKey,\r\n\t\t\tvalue:JSON.stringify(userInfo),\r\n\t\t\texpire:loginExpire,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('setCookie',()=>{\r\n\t\t_F('cookie_func').callMethod('set',{\r\n\t\t\tname:'userLoginToken',\r\n\t\t\tvalue:userToken,\r\n\t\t\texpire:loginExpire,\r\n\t\t\tpath:'/',\r\n\t\t\tdomain: cookieHost,\r\n\t\t\t//sameSite: 'None'\r\n\t\t});\r\n});\r\n\r\nemitter.on('setUserTokenSet',()=>{\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\r\n\t\t\tkey:userLoginTokenSetKey,\r\n\t\t\tvalue:JSON.stringify(userTokenSet),\r\n\t\t\texpire:3600,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('checkMultLogin',()=>{\r\n\tuserInfo.multLogin = multLogin;\r\n\tconsole.log('checkMultLogin',userTokenSet,!multLogin);\r\n\tif(!multLogin){\r\n\t\tuserTokenSet.map(item => {\r\n\t\t\temitter.emit('delUserToken',item);\r\n\t\t});\r\n\t\tuserTokenSet = [];\r\n\t}\r\n\tuserTokenSet.push(userToken);\r\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key集合,tokenSet,登录有效时长)\r\n\temitter.emit('setUserTokenSet');\r\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key:token,用户信息对象,登录有效时长)\r\n\temitter.emit('setUserToken');\r\n});\r\n\r\nemitter.on('checkUseCookie',()=>{\r\n\tif(useCookie){\r\n\t\t//调用 后台cookie组件.cookie设置(用户登录串缓存key,token,登录有效时长)\r\n\t\temitter.emit('setCookie');\r\n\t}else{\r\n\t\tuserInfo.token = userToken;\r\n\t}\r\n\t\r\n\t_funcCb({code:200,errMsg:'ok',result:userInfo});\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码",
- "登录有效时长",
- "使用cookie",
- "允许多端登录",
- "cookie域名"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_5xT7BspmbA",
- "name": "用户名密码注册",
- "type": "service",
- "props": {
- "devId": "service_5xT7BspmbA",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nif(!param.用户名){\r\n _funcCb({code:0,errMsg:'请传入用户名',result:{}});\r\n return;\r\n}\r\n\r\nif(!param.密码){\r\n _funcCb({code:0,errMsg:'请传入密码',result:{}});\r\n return;\r\n}\r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow',{\r\n condition:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n },\r\n success:(data)=>{\r\n if(Array.isArray(data) && data.length <= 0 ) \r\n \temitter.emit('addUser');\r\n else\r\n \temitter.emit('hadUser');\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n});\r\n\r\nemitter.on('hadUser',()=>{\r\n\t_funcCb({code:0,errMsg:'用户已注册,请直接登录',result:{}});\r\n});\r\n \r\nemitter.on('addUser',()=>{\r\n \tlet userInfo = {};\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('addRow',{\r\n row:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'注册成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n\t\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {
- "密码": "123123",
- "用户名": "13800138000"
- }
- }
- },
- {
- "id": "service_8rNTjXTpbf",
- "name": "获取当前登录用户信息",
- "type": "service",
- "props": {
- "devId": "service_8rNTjXTpbf",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet userToken = param.token;\r\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key \r\nlet userInfo = null;\r\n\r\n\r\nemitter.on('getUserInfo',()=>{\r\n\tif(userToken){\r\n\t\tuserLoginTokenKey = `${userLoginTokenKey}:${userToken}`;\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\r\n\t\t\t\tkey:userLoginTokenKey,\r\n\t\t\t\tsuccess:(data)=>{\r\n\t\t\t\t\tconsole.log('getUserInfo.success',data);\r\n\t\t\t\t\tif(data){\r\n\t\t\t\t\t\tuserInfo = JSON.parse(data);\r\n\t\t\t\t\t\t_funcCb({code:200,errMsg:'已登录',result:userInfo});\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\temitter.emit('noUserInfo');\r\n\t\t\t\t},\r\n\t\t\t\tfail:(err)=>{\r\n\t\t\t\t\t_funcCb({code:0,errMsg:'获取登录信息缓存失败',result:err});\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\r\n\t}\r\n\telse \r\n\t\temitter.emit('noUserInfo');\r\n});\r\n\r\nemitter.on('getUserTokenCookie',()=>{\r\n\t\tuserToken = _F('cookie_func').callMethod('get',{\r\n\t\t\tname:userLoginTokenKey\r\n\t\t});\r\n});\r\n\r\nemitter.on('noUserInfo',()=>{\r\n\t_funcCb({code:0,errMsg:'请先登录',result:{}});\r\n});\r\n\r\nif(!userToken)\r\n\temitter.emit('getUserTokenCookie');\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_hB82nRtmDR",
- "name": "退出登录",
- "type": "service",
- "props": {
- "devId": "service_hB82nRtmDR",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet userToken = param.token;\r\nlet cookieHost = param.cookie域名?param.cookie域名:'';\r\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key \r\nlet userInfo = null;\r\n\r\n\r\nemitter.on('getUserInfo',()=>{\r\n\tif(userToken){\r\n\t\tlet userLoginTokenCacheKey = `${userLoginTokenKey}:${userToken}`;\r\n\t\t _F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\r\n\t\t\t\tkey:userLoginTokenCacheKey,\r\n\t\t\t\tsuccess:(data)=>{\r\n\t\t\t\t\tconsole.log('getUserInfo.success',data);\r\n\t\t\t\t\tif(data){\r\n\t\t\t\t\t\temitter.emit('delUserTokenCache',userLoginTokenCacheKey);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\temitter.emit('noUserInfo');\r\n\t\t\t\t},\r\n\t\t\t\tfail:(err)=>{\r\n\t\t\t\t\t_funcCb({code:0,errMsg:'获取登录信息缓存失败',result:err});\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\r\n\t}\r\n\telse \r\n\t\temitter.emit('noUserInfo');\r\n});\r\n\r\nemitter.on('getUserTokenCookie',()=>{\r\n\t\tuserToken = _F('cookie_func').callMethod('get',{\r\n\t\t\tname:userLoginTokenKey\r\n\t\t});\r\n});\r\n\r\nemitter.on('noUserInfo',()=>{\r\n\t_funcCb({code:0,errMsg:'请先登录',result:{}});\r\n});\r\n\r\nemitter.on('delUserTokenCookie',()=>{\r\n\t_F('cookie_func').callMethod('del',{\r\n name:userLoginTokenKey,\r\n\t\texpire:-3600,\r\n\t\tpath:'/',\r\n\t\tdomain: cookieHost,\r\n });\r\n _funcCb({code:200,errMsg:'退出登录成功',result:{}});\r\n});\r\n\r\nemitter.on('delUserTokenCache',(userLoginTokenCacheKey)=>{\r\n\t_F('bCacheTemp_wJfaNQwj3d').callMethod('del',{\r\n key:userLoginTokenCacheKey,\r\n success:(data)=>{\r\n emitter.emit('delUserTokenCookie');\r\n },\r\n fail:(err)=>{\r\n _funcCb({code:0,errMsg:'删除登录信息缓存失败',result:err});\r\n }\r\n });\r\n});\r\n\r\nif(!userToken)\r\n\temitter.emit('getUserTokenCookie');\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "token",
- "cookie域名"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_DTz27rE4GR",
- "name": "openid密码注册及登录",
- "type": "service",
- "props": {
- "devId": "service_DTz27rE4GR",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter();\r\n\r\nif (!param.openid) {\r\n _funcCb({ code: 0, errMsg: '请传入openid', result: {} });\r\n return;\r\n}\r\n\r\nif (!param.密码) {\r\n _funcCb({ code: 0, errMsg: '请传入密码', result: {} });\r\n return;\r\n}\r\n\r\nemitter.on('getUserInfo', () => {\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow', {\r\n condition: {\r\n openid: param.openid,\r\n 密码: param.密码,\r\n },\r\n success: (data) => {\r\n if (Array.isArray(data) && data.length <= 0)\r\n emitter.emit('addUser');\r\n else\r\n emitter.emit('hadUser');\r\n },\r\n fail: () => {\r\n }\r\n });\r\n});\r\n\r\nemitter.on('hadUser', () => {\r\n //_funcCb({code:0,errMsg:'openid已注册,请直接登录',result:{}});\r\n emitter.emit('openidLogin');\r\n});\r\n\r\nemitter.on('openidLogin', () => {\r\n _F('service_edcBYDzKcE').call({ openid: param.openid, 使用cookie: 0 }, (data) => {\r\n _funcCb(data);\r\n });\r\n});\r\n\r\nemitter.on('addUser', () => {\r\n let userInfo = {};\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('addRow', {\r\n row: {\r\n openid: param.openid,\r\n 密码: param.密码,\r\n },\r\n success: (data) => {\r\n //_funcCb({ code: 200, errMsg: '注册成功', result: data });\r\n emitter.emit('openidLogin');\r\n },\r\n fail: () => {\r\n }\r\n });\r\n\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "openid",
- "密码"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {
- "openid": "",
- "密码": "123123"
- }
- }
- },
- {
- "id": "service_edcBYDzKcE",
- "name": "openid登录",
- "type": "service",
- "props": {
- "devId": "service_edcBYDzKcE",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(openid==openid,密码 == 密码)\r\nconst emitter = new events.EventEmitter(); \r\nlet userInfo = null;\r\nlet userToken = null;\r\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key\r\nlet userLoginTokenSetKey = 'userLoginTokenSet';//用户登录串缓存集合key \r\nlet userTokenSet = [];//用户登录串缓存key集合\r\nlet multLogin = param.允许多端登录?true:false;\r\nlet useCookie = param.使用cookie?true:false;\r\nlet cookieHost = param.cookie域名?param.cookie域名:'';\r\nlet loginExpire = param.登录有效时长 > 0?param.登录有效时长:3600;\r\n\r\nemitter.on('showError',(errMsg,result)=>{\r\n\t_funcCb({code:0,errMsg,result:result || {}});\r\n});\r\n\r\nif(!param.openid){\r\n _funcCb({code:0,errMsg:'请传入openid',result:{}});\r\n return;\r\n}\r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow',{\r\n condition:{\r\n openid: param.openid,\r\n },\r\n success:(data)=>{\r\n if(Array.isArray(data) && data.length <= 0 ) \r\n \temitter.emit('noUserInfo');\r\n else{\r\n\t\t\t\tuserInfo = data[0];\r\n\t\t\t\temitter.emit('getUserToken');\r\n\t\t\t\temitter.emit('setUserLoginTokenKey');\r\n\t\t\t\temitter.emit('getUserTokenSet');\r\n\t\t\t}\r\n \t\r\n },\r\n fail:(err)=>{\r\n emitter.emit('showError','获取用户信息失败',err);\r\n }\r\n });\r\n});\r\n\r\nemitter.on('noUserInfo',()=>{\r\n\t_funcCb({code:0,errMsg:'openid不正确',result:{}});\r\n});\r\n\r\nemitter.on('setUserLoginTokenKey',()=>{\r\n\tuserLoginTokenKey = `${userLoginTokenKey}:${userToken}`;\r\n\tuserLoginTokenSetKey = `${userLoginTokenSetKey}:${userInfo._id}`;\r\n});\r\n\r\nemitter.on('getUserToken',()=>{\r\n\t_F('service_xk6eian5Dd').call({},(data)=>{\r\n\t\tuserToken = data.result;\r\n\t});\r\n\t\r\n});\r\n\r\nemitter.on('getUserTokenSet',()=>{\r\n\t_F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\r\n\t\t\tkey:userLoginTokenSetKey,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t\tif(data)\r\n\t\t\t\t\tuserTokenSet = JSON.parse(data);\r\n\t\t\t\t\r\n\t\t\t\temitter.emit('checkMultLogin');\r\n\t\t\t\temitter.emit('checkUseCookie');\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n\t\r\n});\r\n\r\nemitter.on('delUserToken',(token)=>{\r\n\t//调用 后台缓存redis组件.缓存删除(用户登录串缓存key)\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('del',{\r\n\t\t\tkey:`userLoginToken:${token}`,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('setUserToken',()=>{\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\r\n\t\t\tkey:userLoginTokenKey,\r\n\t\t\tvalue:JSON.stringify(userInfo),\r\n\t\t\texpire:loginExpire,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('setCookie',()=>{\r\n\t\t_F('cookie_func').callMethod('set',{\r\n\t\t\tname:'userLoginToken',\r\n\t\t\tvalue:userToken,\r\n\t\t\texpire:loginExpire,\r\n\t\t\tpath:'/',\r\n\t\t\tdomain: cookieHost,\r\n\t\t\t//sameSite: 'None'\r\n\t\t});\r\n});\r\n\r\nemitter.on('setUserTokenSet',()=>{\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\r\n\t\t\tkey:userLoginTokenSetKey,\r\n\t\t\tvalue:JSON.stringify(userTokenSet),\r\n\t\t\texpire:3600,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('checkMultLogin',()=>{\r\n\tuserInfo.multLogin = multLogin;\r\n\tconsole.log('checkMultLogin',userTokenSet,!multLogin);\r\n\tif(!multLogin){\r\n\t\tuserTokenSet.map(item => {\r\n\t\t\temitter.emit('delUserToken',item);\r\n\t\t});\r\n\t\tuserTokenSet = [];\r\n\t}\r\n\tuserTokenSet.push(userToken);\r\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key集合,tokenSet,登录有效时长)\r\n\temitter.emit('setUserTokenSet');\r\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key:token,用户信息对象,登录有效时长)\r\n\temitter.emit('setUserToken');\r\n});\r\n\r\nemitter.on('checkUseCookie',()=>{\r\n\tif(useCookie){\r\n\t\t//调用 后台cookie组件.cookie设置(用户登录串缓存key,token,登录有效时长)\r\n\t\temitter.emit('setCookie');\r\n\t}else{\r\n\t\tuserInfo.token = userToken;\r\n\t}\r\n\t\r\n\t_funcCb({code:200,errMsg:'ok',result:userInfo});\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "openid",
- "登录有效时长",
- "使用cookie",
- "允许多端登录",
- "cookie域名"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_c2SDBJeYBs",
- "name": "手机号登录",
- "type": "service",
- "props": {
- "devId": "service_c2SDBJeYBs",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(openid==openid,密码 == 密码)\r\nconst emitter = new events.EventEmitter(); \r\nlet userInfo = null;\r\nlet userToken = null;\r\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key\r\nlet userLoginTokenSetKey = 'userLoginTokenSet';//用户登录串缓存集合key \r\nlet userTokenSet = [];//用户登录串缓存key集合\r\nlet multLogin = param.允许多端登录?true:false;\r\nlet useCookie = param.使用cookie?true:false;\r\nlet cookieHost = param.cookie域名?param.cookie域名:'';\r\nlet loginExpire = param.登录有效时长 > 0?param.登录有效时长:3600;\r\n\r\nemitter.on('showError',(errMsg,result)=>{\r\n\t_funcCb({code:0,errMsg,result:result || {}});\r\n});\r\n\r\nif(!param.手机号){\r\n _funcCb({code:0,errMsg:'请传入手机号',result:{}});\r\n return;\r\n}\r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow',{\r\n condition:{\r\n 手机号: param.手机号,\r\n },\r\n success:(data)=>{\r\n if(Array.isArray(data) && data.length <= 0 ) \r\n \temitter.emit('noUserInfo');\r\n else{\r\n\t\t\t\tuserInfo = data[0];\r\n\t\t\t\temitter.emit('getUserToken');\r\n\t\t\t\temitter.emit('setUserLoginTokenKey');\r\n\t\t\t\temitter.emit('getUserTokenSet');\r\n\t\t\t}\r\n \t\r\n },\r\n fail:(err)=>{\r\n emitter.emit('showError','获取用户信息失败',err);\r\n }\r\n });\r\n});\r\n\r\nemitter.on('noUserInfo',()=>{\r\n\t_funcCb({code:0,errMsg:'手机号不正确',result:{}});\r\n});\r\n\r\nemitter.on('setUserLoginTokenKey',()=>{\r\n\tuserLoginTokenKey = `${userLoginTokenKey}:${userToken}`;\r\n\tuserLoginTokenSetKey = `${userLoginTokenSetKey}:${userInfo._id}`;\r\n});\r\n\r\nemitter.on('getUserToken',()=>{\r\n\t_F('service_xk6eian5Dd').call({},(data)=>{\r\n\t\tuserToken = data.result;\r\n\t});\r\n\t\r\n});\r\n\r\nemitter.on('getUserTokenSet',()=>{\r\n\t_F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\r\n\t\t\tkey:userLoginTokenSetKey,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t\tif(data)\r\n\t\t\t\t\tuserTokenSet = JSON.parse(data);\r\n\t\t\t\t\r\n\t\t\t\temitter.emit('checkMultLogin');\r\n\t\t\t\temitter.emit('checkUseCookie');\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n\t\r\n});\r\n\r\nemitter.on('delUserToken',(token)=>{\r\n\t//调用 后台缓存redis组件.缓存删除(用户登录串缓存key)\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('del',{\r\n\t\t\tkey:`userLoginToken:${token}`,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('setUserToken',()=>{\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\r\n\t\t\tkey:userLoginTokenKey,\r\n\t\t\tvalue:JSON.stringify(userInfo),\r\n\t\t\texpire:loginExpire,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('setCookie',()=>{\r\n\t\t_F('cookie_func').callMethod('set',{\r\n\t\t\tname:'userLoginToken',\r\n\t\t\tvalue:userToken,\r\n\t\t\texpire:loginExpire,\r\n\t\t\tpath:'/',\r\n\t\t\tdomain: cookieHost,\r\n\t\t\t//sameSite: 'None'\r\n\t\t});\r\n});\r\n\r\nemitter.on('setUserTokenSet',()=>{\r\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\r\n\t\t\tkey:userLoginTokenSetKey,\r\n\t\t\tvalue:JSON.stringify(userTokenSet),\r\n\t\t\texpire:3600,\r\n\t\t\tsuccess:(data)=>{\r\n\t\t\t},\r\n\t\t\tfail:()=>{\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\nemitter.on('checkMultLogin',()=>{\r\n\tuserInfo.multLogin = multLogin;\r\n\tconsole.log('checkMultLogin',userTokenSet,!multLogin);\r\n\tif(!multLogin){\r\n\t\tuserTokenSet.map(item => {\r\n\t\t\temitter.emit('delUserToken',item);\r\n\t\t});\r\n\t\tuserTokenSet = [];\r\n\t}\r\n\tuserTokenSet.push(userToken);\r\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key集合,tokenSet,登录有效时长)\r\n\temitter.emit('setUserTokenSet');\r\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key:token,用户信息对象,登录有效时长)\r\n\temitter.emit('setUserToken');\r\n});\r\n\r\nemitter.on('checkUseCookie',()=>{\r\n\tif(useCookie){\r\n\t\t//调用 后台cookie组件.cookie设置(用户登录串缓存key,token,登录有效时长)\r\n\t\temitter.emit('setCookie');\r\n\t}else{\r\n\t\tuserInfo.token = userToken;\r\n\t}\r\n\t\r\n\t_funcCb({code:200,errMsg:'ok',result:userInfo});\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "手机号",
- "登录有效时长",
- "使用cookie",
- "允许多端登录",
- "cookie域名"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_brktiPxPbp",
- "type": "state",
- "children": []
- },
- {
- "id": "services_AkMYeYdYhZ",
- "type": "services",
- "children": [
- {
- "id": "group_ZY7j4rRFaE",
- "name": "数据表相关",
- "type": "group",
- "props": {
- "devId": "group_ZY7j4rRFaE"
- },
- "children": [
- {
- "id": "dbTableTemp_6xG6thEJQS",
- "name": "用户表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_6xG6thEJQS",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int"
- },
- {
- "columnName": "用户名",
- "columnType": "text"
- },
- {
- "columnName": "openid",
- "columnType": "text"
- },
- {
- "columnName": "手机号",
- "columnType": "text"
- },
- {
- "columnName": "昵称",
- "columnType": "text"
- },
- {
- "columnName": "密码",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "int"
- },
- {
- "columnName": "_update",
- "columnType": "int"
- }
- ]
- }
- },
- {
- "id": "bCacheTemp_wJfaNQwj3d",
- "name": "用户登录信息缓存",
- "type": "bCacheTemp",
- "props": {
- "devId": "bCacheTemp_wJfaNQwj3d"
- }
- }
- ]
- },
- {
- "id": "group_rTsCTAeH2W",
- "name": "内部方法",
- "type": "group",
- "props": {
- "devId": "group_rTsCTAeH2W"
- },
- "children": [
- {
- "id": "service_xk6eian5Dd",
- "name": "用户token生成",
- "type": "service",
- "props": {
- "devId": "service_xk6eian5Dd",
- "isOpen": false,
- "jsCode": "let token = _F('string_func').callMethod('randomString',{length:32});\n\n_funcCb({code:200,errMsg:'ok',result:token});",
- "inParams": [],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "modules_ZQQHbsTjXz",
- "name": "模块",
- "type": "modules",
- "props": {}
- }
- ]
- },
- {
- "id": "module_SQHw2mER25",
- "name": "员工中台模块",
- "type": "module",
- "props": {
- "devId": "module_SQHw2mER25",
- "appModuleId": "41",
- "appModuleVersion": 33
- },
- "children": [
- {
- "id": "modules_44CNb58X25",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_ETyiYpGrJ5",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_XShGG2Bmac",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_WNrMDDM3ZM",
- "type": "bPAttr",
- "children": [
- {
- "id": "variable_GP2sBWntRd",
- "name": "用户登录串CookieKey前缀",
- "type": "variable",
- "props": {
- "devId": "variable_GP2sBWntRd",
- "value": null
- }
- }
- ]
- },
- {
- "id": "bPMethod_JsDhk6mGAG",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_JT4zdxjSc6",
- "name": "获取员工列表",
- "type": "service",
- "props": {
- "devId": "service_JT4zdxjSc6",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet condition = {};\r\n\r\nlet field;\r\nif(param.显示关联)\r\n field = [\r\n \"_id\",\r\n \"用户名\",\r\n \"手机号\",\r\n \"邮箱\",\r\n \"昵称\",\r\n \"姓名\",\r\n \"角色ID\",\r\n \"角色名称\",\r\n \"部门ID\",\r\n \"部门名称\",\r\n \"是否删除\",\r\n \"_create\",\r\n \"_update\"\r\n ];\r\nelse\r\n field = [\r\n \"_id\",\r\n \"用户名\",\r\n \"手机号\",\r\n \"邮箱\",\r\n \"昵称\",\r\n \"姓名\",\r\n \"角色ID\",\r\n \"部门ID\",\r\n \"是否删除\",\r\n \"_create\",\r\n \"_update\"\r\n ];\r\n\r\n\r\nemitter.on('showError',(errMsg,result)=>{\r\n\t_funcCb({code:0,errMsg,result:result || {},total:0});\r\n});\r\n\r\nemitter.on('setCondition', ()=>{\r\n condition = {};\r\n if(param.部门ID)condition.部门ID = param.部门ID;\r\n if(param.角色ID)condition.角色ID = param.角色ID;\r\n if(param.是否删除)condition.是否删除 = param.是否删除;\r\n if(param.关键字){\r\n condition.or = {\r\n 用户名: ['like',param.关键字],\r\n 手机号: ['like',param.关键字],\r\n 邮箱: ['like',param.关键字],\r\n 姓名: ['like',param.关键字],\r\n };\r\n }\r\n});\r\n\r\nemitter.on('getTotal', ()=>{\r\n _F('dbViewTemp_R34dNixksn').callMethod('getCount',{\r\n condition,\r\n success:(res)=>{\r\n emitter.emit('getList',res[0].count);\r\n },\r\n fail:(err)=>{\r\n emitter.emit('showError','获取列表总数失败',err);\r\n },\r\n \r\n });\r\n});\r\n\r\n\r\nemitter.on('getList', (total)=>{\r\n _F('dbViewTemp_R34dNixksn').callMethod('getRows',{\r\n condition,\r\n field,\r\n pageNum: param.pageNum?param.pageNum:1,\r\n pageSize: param.pageSize?param.pageSize:10,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'ok',result:data,total});\r\n },\r\n fail:(err)=>{\r\n emitter.emit('showError','获取员工列表',err);\r\n }\r\n });\r\n});\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n",
- "inParams": [
- "pageNum",
- "pageSize",
- "部门ID",
- "角色ID",
- "关键字",
- "是否删除",
- "显示关联"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_PQd7Zr4nK6",
- "name": "删除员工",
- "type": "service",
- "props": {
- "devId": "service_PQd7Zr4nK6",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(!param.员工ID){\r\n _funcCb({code:0,errMsg:'请传入员工ID',result:{}});\r\n return;\r\n}\r\n\r\nlet editObj = {};\r\neditObj.是否删除 = param.是否删除?param.是否删除:0;\r\n\r\nemitter.on('editUser', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('editRow',{\r\n row:editObj,\r\n condition:{\r\n _id:param.员工ID,\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'删除员工成功',result:data});\r\n },\r\n fail:(err)=>{\r\n _funcCb({code:0,errMsg:'删除员工失败',result:err});\r\n }\r\n });\r\n});\r\n\r\nemitter.emit('editUser');",
- "inParams": [
- "员工ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_bazaCNCCK3",
- "name": "禁用员工",
- "type": "service",
- "props": {
- "devId": "service_bazaCNCCK3",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(!param.员工ID){\r\n _funcCb({code:0,errMsg:'请传入员工ID',result:{}});\r\n return;\r\n}\r\n\r\nlet editObj = {};\r\neditObj.是否禁用 = param.是否禁用?param.是否禁用:0;\r\n\r\nemitter.on('editUser', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('editRow',{\r\n row:editObj,\r\n condition:{\r\n _id:param.员工ID,\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'禁用员工成功',result:data});\r\n },\r\n fail:(err)=>{\r\n _funcCb({code:0,errMsg:'禁用员工失败',result:err});\r\n }\r\n });\r\n});\r\n\r\nemitter.emit('editUser');",
- "inParams": [
- "员工ID",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_7PnxyXDPAT",
- "name": "编辑员工信息",
- "type": "service",
- "props": {
- "devId": "service_7PnxyXDPAT",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(!param.员工ID){\r\n _funcCb({code:0,errMsg:'请传入员工ID',result:{}});\r\n return;\r\n}\r\n\r\nlet editObj = {};\r\nif(param.用户名)editObj.用户名 = param.用户名;\r\nif(param.姓名)editObj.姓名 = param.姓名;\r\nif(param.角色ID)editObj.角色ID = param.角色ID;\r\nif(param.部门ID)editObj.部门ID = param.部门ID;\r\nif(param.邮箱)editObj.邮箱 = param.邮箱;\r\nif(param.手机号)editObj.手机号 = param.手机号;\r\n\r\nemitter.on('editUser', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('editRow',{\r\n row:editObj,\r\n condition:{\r\n _id:param.员工ID,\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑员工成功',result:data});\r\n },\r\n fail:(err)=>{\r\n _funcCb({code:0,errMsg:'编辑员工失败',result:err});\r\n }\r\n });\r\n});\r\n\r\nemitter.emit('editUser');",
- "inParams": [
- "员工ID",
- "姓名",
- "角色ID",
- "部门ID",
- "邮箱",
- "手机号",
- "用户名"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_DE3rN7bad6",
- "name": "用户名密码登录",
- "type": "service",
- "props": {
- "devId": "service_DE3rN7bad6",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名,密码 == 密码)\nconst emitter = new events.EventEmitter(); \nlet userInfo = null;\nlet userToken = null;\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key\nlet userLoginTokenSetKey = 'userLoginTokenSet';//用户登录串缓存集合key \nlet cookieKeyPrefix = _F('variable_GP2sBWntRd').callMethod('get');\nlet cookieKey = cookieKeyPrefix + userLoginTokenKey;//用户登录串CookieKey\nlet userTokenSet = [];//用户登录串缓存key集合\nlet multLogin = param.允许多端登录?true:false;\nlet useCookie = param.使用cookie?true:false;\nlet cookieHost = param.cookie域名?param.cookie域名:'';\nlet loginExpire = param.登录有效时长 > 0?param.登录有效时长:3600;\n\nconsole.log('用户名密码登录.cookieKey',cookieKey);\n\nemitter.on('getUserInfo', ()=>{\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow',{\n condition:{\n 用户名: param.用户名,\n 密码: param.密码,\n },\n success:(data)=>{\n if(Array.isArray(data) && data.length <= 0 ) \n \temitter.emit('noUserInfo');\n else{\n\t\t\t\tuserInfo = data[0];\n\t\t\t\temitter.emit('getUserToken');\n\t\t\t\temitter.emit('setUserLoginTokenKey');\n\t\t\t\temitter.emit('getUserTokenSet');\n\t\t\t}\n \t\n },\n fail:()=>{\n }\n });\n});\n\nemitter.on('noUserInfo',()=>{\n\t_funcCb({code:0,errMsg:'用户名或密码不正确',result:{}});\n});\n\nemitter.on('setUserLoginTokenKey',()=>{\n\tuserLoginTokenKey = `${userLoginTokenKey}:${userToken}`;\n\tuserLoginTokenSetKey = `${userLoginTokenSetKey}:${userInfo._id}`;\n});\n\nemitter.on('getUserToken',()=>{\n\t_F('service_xk6eian5Dd').call({},(data)=>{\n\t\tuserToken = data.result;\n\t});\n\t\n});\n\nemitter.on('getUserTokenSet',()=>{\n\t_F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\n\t\t\tkey:userLoginTokenSetKey,\n\t\t\tsuccess:(data)=>{\n\t\t\t\tif(data)\n\t\t\t\t\tuserTokenSet = JSON.parse(data);\n\t\t\t\t\n\t\t\t\temitter.emit('checkMultLogin');\n\t\t\t\temitter.emit('checkUseCookie');\n\t\t\t},\n\t\t\tfail:()=>{\n\t\t\t}\n\t\t});\n\t\n});\n\nemitter.on('delUserToken',(token)=>{\n\t//调用 后台缓存redis组件.缓存删除(用户登录串缓存key)\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('del',{\n\t\t\tkey:`userLoginToken:${token}`,\n\t\t\tsuccess:(data)=>{\n\t\t\t},\n\t\t\tfail:()=>{\n\t\t\t}\n\t\t});\n});\n\nemitter.on('setUserToken',()=>{\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\n\t\t\tkey:userLoginTokenKey,\n\t\t\tvalue:JSON.stringify(userInfo),\n\t\t\texpire:loginExpire,\n\t\t\tsuccess:(data)=>{\n\t\t\t},\n\t\t\tfail:()=>{\n\t\t\t}\n\t\t});\n});\n\nemitter.on('setCookie',()=>{\n\t\t_F('cookie_func').callMethod('set',{\n\t\t\tname: cookieKey,\n\t\t\tvalue:userToken,\n\t\t\texpire:loginExpire,\n\t\t\tpath:'/',\n\t\t\tdomain: cookieHost,\n\t\t\t//sameSite: 'None'\n\t\t});\n});\n\nemitter.on('setUserTokenSet',()=>{\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('set',{\n\t\t\tkey:userLoginTokenSetKey,\n\t\t\tvalue:JSON.stringify(userTokenSet),\n\t\t\texpire:3600,\n\t\t\tsuccess:(data)=>{\n\t\t\t},\n\t\t\tfail:()=>{\n\t\t\t}\n\t\t});\n});\n\nemitter.on('checkMultLogin',()=>{\n\tuserInfo.multLogin = multLogin;\n\tconsole.log('checkMultLogin',userTokenSet,!multLogin);\n\tif(!multLogin){\n\t\tuserTokenSet.map(item => {\n\t\t\temitter.emit('delUserToken',item);\n\t\t});\n\t\tuserTokenSet = [];\n\t}\n\tuserTokenSet.push(userToken);\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key集合,tokenSet,登录有效时长)\n\temitter.emit('setUserTokenSet');\n\t//调用 后台缓存redis组件.缓存设置(用户登录串缓存key:token,用户信息对象,登录有效时长)\n\temitter.emit('setUserToken');\n});\n\nemitter.on('checkUseCookie',()=>{\n\tif(useCookie){\n\t\t//调用 后台cookie组件.cookie设置(用户登录串缓存key,token,登录有效时长)\n\t\temitter.emit('setCookie');\n\t}else{\n\t\tuserInfo.token = userToken;\n\t}\n\t\n\t_funcCb({code:200,errMsg:'ok',result:userInfo});\n});\n\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码",
- "登录有效时长",
- "使用cookie",
- "允许多端登录",
- "cookie域名"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_5xT7BspmbA",
- "name": "用户名密码注册",
- "type": "service",
- "props": {
- "devId": "service_5xT7BspmbA",
- "isOpen": false,
- "jsCode": "//let 用户信息对象 = 调用 数据表.数据表查询(用户名==用户名)\r\nconst emitter = new events.EventEmitter(); \r\n\r\nemitter.on('getUserInfo', ()=>{\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('getRow',{\r\n condition:{\r\n 用户名: param.用户名,\r\n },\r\n success:(data)=>{\r\n if(Array.isArray(data) && data.length <= 0 ) \r\n \temitter.emit('addUser');\r\n else\r\n \temitter.emit('hadUser');\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n});\r\n\r\nemitter.on('hadUser',()=>{\r\n\t_funcCb({code:0,errMsg:'用户已注册,请直接登录',result:{}});\r\n});\r\n \r\nemitter.on('addUser',()=>{\r\n \tlet userInfo = {};\r\n _F('dbTableTemp_6xG6thEJQS').callMethod('addRow',{\r\n row:{\r\n 用户名: param.用户名,\r\n 密码: param.密码,\r\n 姓名: param.姓名,\r\n 角色ID: param.角色ID,\r\n 部门ID: param.部门ID,\r\n 邮箱: param.邮箱,\r\n 手机号: param.手机号,\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'注册成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n\t\r\n});\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "用户名",
- "密码",
- "姓名",
- "角色ID",
- "部门ID",
- "邮箱",
- "手机号"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {
- "密码": "123123",
- "用户名": "13800138000"
- }
- }
- },
- {
- "id": "service_8rNTjXTpbf",
- "name": "获取当前登录用户信息",
- "type": "service",
- "props": {
- "devId": "service_8rNTjXTpbf",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \n\nlet userToken = param.token;\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key \nlet cookieKeyPrefix = _F('variable_GP2sBWntRd').callMethod('get');\nlet cookieKey = cookieKeyPrefix + userLoginTokenKey;//用户登录串CookieKey\nlet userInfo = null;\n\n\nemitter.on('getUserInfo',()=>{\n\tif(userToken){\n\t\tuserLoginTokenKey = `${userLoginTokenKey}:${userToken}`;\n\t\t_F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\n\t\t\t\tkey:userLoginTokenKey,\n\t\t\t\tsuccess:(data)=>{\n\t\t\t\t\tconsole.log('getUserInfo.success',data);\n\t\t\t\t\tif(data){\n\t\t\t\t\t\tuserInfo = JSON.parse(data);\n\t\t\t\t\t\t_funcCb({code:200,errMsg:'已登录',result:userInfo});\n\t\t\t\t\t}\n\t\t\t\t\telse \n\t\t\t\t\t\temitter.emit('noUserInfo');\n\t\t\t\t},\n\t\t\t\tfail:(err)=>{\n\t\t\t\t\t_funcCb({code:0,errMsg:'获取登录信息缓存失败',result:err});\n\t\t\t\t}\n\t\t\t});\n\t\t\n\t}\n\telse \n\t\temitter.emit('noUserInfo');\n});\n\nemitter.on('getUserTokenCookie',()=>{\n\t\tuserToken = _F('cookie_func').callMethod('get',{\n\t\t\tname:cookieKey\n\t\t});\n});\n\nemitter.on('noUserInfo',()=>{\n\t_funcCb({code:0,errMsg:'请先登录',result:{}});\n});\n\nif(!userToken)\n\temitter.emit('getUserTokenCookie');\n\nemitter.emit('getUserInfo');",
- "inParams": [
- "token"
- ],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_hB82nRtmDR",
- "name": "退出登录",
- "type": "service",
- "props": {
- "devId": "service_hB82nRtmDR",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \n\nlet userToken = param.token;\nlet cookieHost = param.cookie域名?param.cookie域名:'';\nlet userLoginTokenKey = 'userLoginToken';//用户登录串缓存key \nlet cookieKeyPrefix = _F('variable_GP2sBWntRd').callMethod('get');\nlet cookieKey = cookieKeyPrefix + userLoginTokenKey;//用户登录串CookieKey\nlet userInfo = null;\n\n\nemitter.on('getUserInfo',()=>{\n\tif(userToken){\n\t\tlet userLoginTokenCacheKey = `${userLoginTokenKey}:${userToken}`;\n\t\t _F('bCacheTemp_wJfaNQwj3d').callMethod('get',{\n\t\t\t\tkey:userLoginTokenCacheKey,\n\t\t\t\tsuccess:(data)=>{\n\t\t\t\t\tconsole.log('getUserInfo.success',data);\n\t\t\t\t\tif(data){\n\t\t\t\t\t\temitter.emit('delUserTokenCache',userLoginTokenCacheKey);\n\t\t\t\t\t}\n\t\t\t\t\telse \n\t\t\t\t\t\temitter.emit('noUserInfo');\n\t\t\t\t},\n\t\t\t\tfail:(err)=>{\n\t\t\t\t\t_funcCb({code:0,errMsg:'获取登录信息缓存失败',result:err});\n\t\t\t\t}\n\t\t\t});\n\t\t\n\t}\n\telse \n\t\temitter.emit('noUserInfo');\n});\n\nemitter.on('getUserTokenCookie',()=>{\n\t\tuserToken = _F('cookie_func').callMethod('get',{\n\t\t\tname:cookieKey\n\t\t});\n});\n\nemitter.on('noUserInfo',()=>{\n\t_funcCb({code:0,errMsg:'请先登录',result:{}});\n});\n\nemitter.on('delUserTokenCookie',()=>{\n\t_F('cookie_func').callMethod('del',{\n name:cookieKey,\n\t\texpire:-3600,\n\t\tpath:'/',\n\t\tdomain: cookieHost,\n });\n _funcCb({code:200,errMsg:'退出登录成功',result:{}});\n});\n\nemitter.on('delUserTokenCache',(userLoginTokenCacheKey)=>{\n\t_F('bCacheTemp_wJfaNQwj3d').callMethod('del',{\n key:userLoginTokenCacheKey,\n success:(data)=>{\n emitter.emit('delUserTokenCookie');\n },\n fail:(err)=>{\n _funcCb({code:0,errMsg:'删除登录信息缓存失败',result:err});\n }\n });\n});\n\nif(!userToken)\n\temitter.emit('getUserTokenCookie');\n\nemitter.emit('getUserInfo');",
- "inParams": [
- "token",
- "cookie域名"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_d7R7cMwF2P",
- "type": "state",
- "children": []
- },
- {
- "id": "services_EF2fNWmFBW",
- "type": "services",
- "children": [
- {
- "id": "group_ZY7j4rRFaE",
- "name": "数据表相关",
- "type": "group",
- "props": {
- "devId": "group_ZY7j4rRFaE"
- },
- "children": [
- {
- "id": "dbViewTemp_R34dNixksn",
- "name": "用户表_角色表_部门表视图",
- "type": "dbViewTemp",
- "props": {
- "devId": "dbViewTemp_R34dNixksn"
- }
- },
- {
- "id": "dbTableTemp_6xG6thEJQS",
- "name": "用户表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_6xG6thEJQS",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int"
- },
- {
- "columnName": "用户名",
- "columnType": "text"
- },
- {
- "columnName": "手机号",
- "columnType": "text"
- },
- {
- "columnName": "邮箱",
- "columnType": "text"
- },
- {
- "columnName": "昵称",
- "columnType": "text"
- },
- {
- "columnName": "姓名",
- "columnType": "text"
- },
- {
- "columnName": "密码",
- "columnType": "text"
- },
- {
- "columnName": "角色ID",
- "columnType": "int"
- },
- {
- "columnName": "部门ID",
- "columnType": "int"
- },
- {
- "columnName": "是否禁用",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "int"
- },
- {
- "columnName": "_update",
- "columnType": "int"
- }
- ]
- }
- },
- {
- "id": "bCacheTemp_wJfaNQwj3d",
- "name": "用户登录信息缓存",
- "type": "bCacheTemp",
- "props": {
- "devId": "bCacheTemp_wJfaNQwj3d"
- }
- }
- ]
- },
- {
- "id": "group_rTsCTAeH2W",
- "name": "内部方法",
- "type": "group",
- "props": {
- "devId": "group_rTsCTAeH2W"
- },
- "children": [
- {
- "id": "service_xk6eian5Dd",
- "name": "用户token生成",
- "type": "service",
- "props": {
- "devId": "service_xk6eian5Dd",
- "isOpen": false,
- "jsCode": "let token = _F('string_func').callMethod('randomString',{length:32});\n\n_funcCb({code:200,errMsg:'ok',result:token});",
- "inParams": [],
- "outParams": [
- "code",
- "errMsg",
- "result"
- ],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "front_kef7tp26Qn",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_RPMa4r7Zhn",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_KBYXNxe27H",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_5SiWyamj8E",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_j4csRMZc7X",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_5nzE7DabXz",
- "type": "state",
- "children": []
- },
- {
- "id": "method_FSJADG5KbG",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_nhmXymtpyy",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_hZ3XAC6B2n",
- "name": "员工中台模块",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_FBsbDYPT8B",
- "name": "菜单管理后台组件",
- "type": "module",
- "props": {
- "devId": "module_FBsbDYPT8B",
- "appModuleId": "62",
- "appModuleVersion": 19
- },
- "children": [
- {
- "id": "modules_eGGWa3zPdy",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_A3a5KkSC5Y",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_wctBdy7F2d",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_yhKfrEfrSc",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_HbFJKkNY5J",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_zYN6Kpynpy",
- "name": "菜单关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_zYN6Kpynpy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0?parseInt(param.当前页码):1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0?parseInt(param.每页大小):10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', (parentNames)=>{\r\n\r\n deptList = deptList.map(item => {\r\n let pInfo = parentNames.find(tmp => item.上级菜单ID == tmp._id);\r\n item.上级菜单名称 = pInfo?pInfo.菜单名称:'';\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code:200,\r\n errMsg:'ok',\r\n result:deptList,\r\n total:deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', ()=>{\r\n if(param.hasOwnProperty('菜单名称'))condition['菜单名称'] = ['like',param.菜单名称];\r\n if(param.hasOwnProperty('上级菜单ID') && param.上级菜单ID != 'all')condition['上级菜单ID'] = param.上级菜单ID;\r\n if(param.hasOwnProperty('是否删除'))condition['是否删除'] = param.是否删除;\r\n if(param.hasOwnProperty('是否禁用'))condition['是否禁用'] = param.是否禁用;\r\n});\r\n\r\nemitter.on('getTotal', ()=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getCount',{\r\n condition,\r\n success:(res)=>{\r\n emitter.emit('getList',res[0].count);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表总数失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getList', (total)=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby:'排序',\r\n sort:'desc',\r\n success:(res)=>{\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('getPids');\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getPids', ()=>{\r\n let pids = [];\r\n deptList.map(item => pids.push(item.上级菜单ID));\r\n emitter.emit('getParentNames',pids);\r\n})\r\n\r\nemitter.on('getParentNames', (pids)=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition:{\r\n _id:['in',pids]\r\n },\r\n pageNum:1,\r\n pageSize:100,\r\n orderby:'_update',\r\n sort:'desc',\r\n success:(res)=>{\r\n emitter.emit('output',res);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取上级菜单列表失败',\r\n result:err,\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "菜单名称",
- "上级菜单ID",
- "当前页码",
- "每页大小",
- "是否删除",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_FHxSD7RYtT",
- "name": "菜单删除服务",
- "type": "service",
- "props": {
- "devId": "service_FHxSD7RYtT",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('菜单ID') && param['菜单ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入菜单ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.菜单ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "菜单ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_cF6TRXP68X",
- "name": "菜单编辑服务",
- "type": "service",
- "props": {
- "devId": "service_cF6TRXP68X",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('菜单ID') && param['菜单ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入菜单ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.菜单ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('key'))editObj['key'] = param.key;\r\n if(param.hasOwnProperty('菜单名称'))editObj['菜单名称'] = param.菜单名称;\r\n if(param.hasOwnProperty('上级菜单ID'))editObj['上级菜单ID'] = param.上级菜单ID;\r\n if(param.hasOwnProperty('类型'))editObj['类型'] = param.类型;\r\n if(param.hasOwnProperty('排序'))editObj['排序'] = param.排序;\r\n if(param.hasOwnProperty('页面路径'))editObj['页面路径'] = param.页面路径;\r\n if(param.hasOwnProperty('接口路径'))editObj['接口路径'] = param.接口路径;\r\n if(param.hasOwnProperty('是否禁用'))editObj['是否禁用'] = param.是否禁用 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "菜单ID",
- "菜单名称",
- "上级菜单ID",
- "是否禁用",
- "类型",
- "排序",
- "页面路径",
- "接口路径",
- "key"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_jQ4AEAwPSy",
- "name": "菜单新增服务",
- "type": "service",
- "props": {
- "devId": "service_jQ4AEAwPSy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nlet 上级菜单ID= param.上级菜单ID?param.上级菜单ID:0;\r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('addRow',{\r\n row:{\r\n key: param.key,\r\n 菜单名称: param.菜单名称,\r\n 上级菜单ID,\r\n 类型: param.类型,\r\n 排序: param.排序,\r\n 页面路径: param.页面路径,\r\n 接口路径: param.接口路径,\r\n 是否禁用:0,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "菜单名称",
- "上级菜单ID",
- "类型",
- "排序",
- "页面路径",
- "接口路径",
- "key"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_4BtzhprQ6m",
- "type": "state",
- "children": []
- },
- {
- "id": "services_ZYjkDm6kcb",
- "type": "services",
- "children": [
- {
- "id": "group_NrSDpMdKGr",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_NrSDpMdKGr"
- },
- "children": [
- {
- "id": "dbTableTemp_nr37DhHs56",
- "name": "菜单表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_nr37DhHs56",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int"
- },
- {
- "columnName": "key",
- "columnType": "text"
- },
- {
- "columnName": "菜单名称",
- "columnType": "text"
- },
- {
- "columnName": "上级菜单ID",
- "columnType": "text"
- },
- {
- "columnName": "类型",
- "columnType": "text"
- },
- {
- "columnName": "排序",
- "columnType": "int"
- },
- {
- "columnName": "页面路径",
- "columnType": "text"
- },
- {
- "columnName": "接口路径",
- "columnType": "text"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "int"
- },
- {
- "columnName": "_update",
- "columnType": "int"
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_EyYxZ6nFyk",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_EyYxZ6nFyk"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "front_nBw4mS8TiS",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_JmBY4ZjeRG",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_NyATkW28nD",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_cephaF7hEm",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_8AZirsM2z2",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_dCkEFF82en",
- "type": "state",
- "children": []
- },
- {
- "id": "method_h8N5JjfPzx",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_PCTeGz3GWn",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_PXxWFjM5Ne",
- "name": "菜单管理后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_C8GjKaaHBs",
- "name": "部门编辑后台组件",
- "type": "module",
- "props": {
- "devId": "module_C8GjKaaHBs",
- "appModuleId": "26",
- "appModuleVersion": 29
- },
- "children": [
- {
- "id": "modules_xy4ffTyG4B",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_mSBKMWR8BJ",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_N8CBWDrmnK",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_4zQkaDaSwn",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_DZnrsmfJGF",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_zYN6Kpynpy",
- "name": "部门关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_zYN6Kpynpy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0?parseInt(param.当前页码):1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0?parseInt(param.每页大小):10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', (parentNames)=>{\r\n\r\n deptList = deptList.map(item => {\r\n let pInfo = parentNames.find(tmp => item.上级部门ID == tmp._id);\r\n item.上级部门名称 = pInfo?pInfo.部门名称:'';\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code:200,\r\n errMsg:'ok',\r\n result:deptList,\r\n total:deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', ()=>{\r\n if(param.hasOwnProperty('部门名称'))condition['部门名称'] = ['like',param.部门名称];\r\n if(param.hasOwnProperty('上级部门ID'))condition['上级部门ID'] = param.上级部门ID;\r\n if(param.hasOwnProperty('是否删除'))condition['是否删除'] = param.是否删除;\r\n if(param.hasOwnProperty('是否禁用'))condition['是否禁用'] = param.是否禁用;\r\n});\r\n\r\nemitter.on('getTotal', ()=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getCount',{\r\n condition,\r\n success:(res)=>{\r\n emitter.emit('getList',res[0].count);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表总数失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getList', (total)=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby:'_update',\r\n sort:'desc',\r\n success:(res)=>{\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('getPids');\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getPids', ()=>{\r\n let pids = [];\r\n deptList.map(item => pids.push(item.上级部门ID));\r\n emitter.emit('getParentNames',pids);\r\n})\r\n\r\nemitter.on('getParentNames', (pids)=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition:{\r\n _id:['in',pids]\r\n },\r\n pageNum:1,\r\n pageSize:100,\r\n orderby:'_update',\r\n sort:'desc',\r\n success:(res)=>{\r\n emitter.emit('output',res);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取上级部门列表失败',\r\n result:err,\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "部门名称",
- "上级部门ID",
- "当前页码",
- "每页大小",
- "是否删除",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_FHxSD7RYtT",
- "name": "部门删除服务",
- "type": "service",
- "props": {
- "devId": "service_FHxSD7RYtT",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('部门ID') && param['部门ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入部门ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.部门ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "部门ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_cF6TRXP68X",
- "name": "部门编辑服务",
- "type": "service",
- "props": {
- "devId": "service_cF6TRXP68X",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('部门ID') && param['部门ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入部门ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.部门ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('部门名称'))editObj['部门名称'] = param.部门名称;\r\n if(param.hasOwnProperty('上级部门ID'))editObj['上级部门ID'] = param.上级部门ID;\r\n if(param.hasOwnProperty('是否禁用'))editObj['是否禁用'] = param.是否禁用 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "部门ID",
- "部门名称",
- "上级部门ID",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_jQ4AEAwPSy",
- "name": "部门新增服务",
- "type": "service",
- "props": {
- "devId": "service_jQ4AEAwPSy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('addRow',{\r\n row:{\r\n 部门名称: param.部门名称,\r\n 上级部门ID: param.上级部门ID,\r\n 是否禁用:0,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "部门名称",
- "上级部门ID"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_TaetSk3sXr",
- "type": "state",
- "children": []
- },
- {
- "id": "services_8ySS6cizZX",
- "type": "services",
- "children": [
- {
- "id": "group_NrSDpMdKGr",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_NrSDpMdKGr"
- },
- "children": [
- {
- "id": "dbTableTemp_nr37DhHs56",
- "name": "部门表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_nr37DhHs56",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int"
- },
- {
- "columnName": "部门名称",
- "columnType": "text"
- },
- {
- "columnName": "上级部门ID",
- "columnType": "text"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "int"
- },
- {
- "columnName": "_update",
- "columnType": "int"
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_EyYxZ6nFyk",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_EyYxZ6nFyk"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "front_K4Xe5AWCMH",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_BAKYscBfHn",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_xjDs75sKS6",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_6hdT5CzeXJ",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_C4ai7WmPsa",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_D2pYjjJcQT",
- "type": "state",
- "children": []
- },
- {
- "id": "method_ASGZDsmDaP",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_EGb6rjBaJj",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_BjQ3ZjDD2h",
- "name": "部门编辑后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_fNRWBJ426W",
- "name": "角色管理后台组件",
- "type": "module",
- "props": {
- "devId": "module_fNRWBJ426W",
- "appModuleId": "74",
- "appModuleVersion": 14
- },
- "children": [
- {
- "id": "modules_bYE8ZiwMpJ",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_mA7jikxK7d",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_f448H8f2JX",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_Cpz8hcFEri",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_MmYYheCTAE",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_zYN6Kpynpy",
- "name": "角色关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_zYN6Kpynpy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0?parseInt(param.当前页码):1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0?parseInt(param.每页大小):10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', ()=>{\r\n\r\n deptList = deptList.map(item => {\r\n if(item.菜单IDs)\r\n item.菜单IDs = JSON.parse(item.菜单IDs);\r\n \r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code:200,\r\n errMsg:'ok',\r\n result:deptList,\r\n total:deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', ()=>{\r\n if(param.hasOwnProperty('角色名称'))condition['角色名称'] = ['like',param.角色名称];\r\n if(param.hasOwnProperty('是否删除'))condition['是否删除'] = param.是否删除;\r\n if(param.hasOwnProperty('是否禁用'))condition['是否禁用'] = param.是否禁用;\r\n});\r\n\r\nemitter.on('getTotal', ()=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getCount',{\r\n condition,\r\n success:(res)=>{\r\n emitter.emit('getList',res[0].count);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表总数失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getList', (total)=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby:'_update',\r\n sort:'desc',\r\n success:(res)=>{\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('output');\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "角色名称",
- "当前页码",
- "每页大小",
- "是否删除",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_FHxSD7RYtT",
- "name": "角色删除服务",
- "type": "service",
- "props": {
- "devId": "service_FHxSD7RYtT",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('角色ID') && param['角色ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入角色ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.角色ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "角色ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_cF6TRXP68X",
- "name": "角色编辑服务",
- "type": "service",
- "props": {
- "devId": "service_cF6TRXP68X",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('角色ID') && param['角色ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入角色ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.角色ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('角色名称'))editObj['角色名称'] = param.角色名称;\r\n if(param.hasOwnProperty('菜单IDs'))editObj['菜单IDs'] = JSON.stringify(param.菜单IDs);\r\n if(param.hasOwnProperty('是否禁用'))editObj['是否禁用'] = param.是否禁用 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "角色ID",
- "角色名称",
- "菜单IDs",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_jQ4AEAwPSy",
- "name": "角色新增服务",
- "type": "service",
- "props": {
- "devId": "service_jQ4AEAwPSy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('addRow',{\r\n row:{\r\n 角色名称: param.角色名称,\r\n 菜单IDs: JSON.stringify(param.菜单IDs),\r\n 是否禁用:0,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "角色名称",
- "菜单IDs"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_2zA8fGATNB",
- "type": "state",
- "children": []
- },
- {
- "id": "services_zSCRm43KkY",
- "type": "services",
- "children": [
- {
- "id": "group_NrSDpMdKGr",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_NrSDpMdKGr"
- },
- "children": [
- {
- "id": "dbTableTemp_nr37DhHs56",
- "name": "角色表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_nr37DhHs56",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int"
- },
- {
- "columnName": "角色名称",
- "columnType": "text"
- },
- {
- "columnName": "菜单IDs",
- "columnType": "json"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "int"
- },
- {
- "columnName": "_update",
- "columnType": "int"
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_EyYxZ6nFyk",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_EyYxZ6nFyk"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "front_RSEDbaGaei",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_xmbZQeKcxw",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_3t3RexJZYm",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_xFW5AJcNx2",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_sFSeEFkRSz",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_B3ciDxXQ8Y",
- "type": "state",
- "children": []
- },
- {
- "id": "method_DyDF7SCeFd",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_syf5aeScmy",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_py35XxFsrX",
- "name": "角色管理后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_iCEhkHXdGz",
- "name": "分类编辑后台组件",
- "type": "module",
- "props": {
- "devId": "module_iCEhkHXdGz",
- "appModuleId": "90",
- "appModuleVersion": 6
- },
- "children": [
- {
- "id": "modules_StipNdQ8ms",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_WnP7TD48at",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_KskWJxWz4w",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_RKAHea5Swf",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_rjpe8mB6CD",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_zYN6Kpynpy",
- "name": "分类关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_zYN6Kpynpy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0?parseInt(param.当前页码):1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0?parseInt(param.每页大小):10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', (parentNames)=>{\r\n\r\n deptList = deptList.map(item => {\r\n let pInfo = parentNames.find(tmp => item.上级分类ID == tmp._id);\r\n item.上级分类名称 = pInfo?pInfo.分类名称:'';\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code:200,\r\n errMsg:'ok',\r\n result:deptList,\r\n total:deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', ()=>{\r\n if(param.hasOwnProperty('分类名称'))condition['分类名称'] = ['like',param.分类名称];\r\n if(param.hasOwnProperty('上级分类ID'))condition['上级分类ID'] = param.上级分类ID;\r\n if(param.hasOwnProperty('是否删除'))condition['是否删除'] = param.是否删除;\r\n if(param.hasOwnProperty('是否禁用'))condition['是否禁用'] = param.是否禁用;\r\n});\r\n\r\nemitter.on('getTotal', ()=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getCount',{\r\n condition,\r\n success:(res)=>{\r\n emitter.emit('getList',res[0].count);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表总数失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getList', (total)=>{\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby:'_update',\r\n sort:'desc',\r\n success:(res)=>{\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('getPids');\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取列表失败',\r\n result:err,\r\n total:0\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.on('getPids', ()=>{\r\n let pids = [];\r\n deptList.map(item => pids.push(item.上级分类ID));\r\n emitter.emit('getParentNames',pids);\r\n})\r\n\r\nemitter.on('getParentNames', (pids)=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('getRows',{\r\n condition:{\r\n _id:['in',pids]\r\n },\r\n pageNum:1,\r\n pageSize:100,\r\n orderby:'_update',\r\n sort:'desc',\r\n success:(res)=>{\r\n emitter.emit('output',res);\r\n },\r\n fail:(err)=>{\r\n _funcCb({\r\n code:0,\r\n errMsg:'获取上级分类列表失败',\r\n result:err,\r\n });\r\n },\r\n \r\n });\r\n});\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "分类名称",
- "上级分类ID",
- "当前页码",
- "每页大小",
- "是否删除",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_FHxSD7RYtT",
- "name": "分类删除服务",
- "type": "service",
- "props": {
- "devId": "service_FHxSD7RYtT",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('分类ID') && param['分类ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入分类ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.分类ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "分类ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_cF6TRXP68X",
- "name": "分类编辑服务",
- "type": "service",
- "props": {
- "devId": "service_cF6TRXP68X",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('分类ID') && param['分类ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入分类ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.分类ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('分类名称'))editObj['分类名称'] = param.分类名称;\r\n if(param.hasOwnProperty('上级分类ID'))editObj['上级分类ID'] = param.上级分类ID;\r\n if(param.hasOwnProperty('是否禁用'))editObj['是否禁用'] = param.是否禁用 == 1?1:0;\r\n\r\n _F('dbTableTemp_nr37DhHs56').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "分类ID",
- "分类名称",
- "上级分类ID",
- "是否禁用"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_jQ4AEAwPSy",
- "name": "分类新增服务",
- "type": "service",
- "props": {
- "devId": "service_jQ4AEAwPSy",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_nr37DhHs56').callMethod('addRow',{\r\n row:{\r\n 分类名称: param.分类名称,\r\n 上级分类ID: param.上级分类ID,\r\n 是否禁用:0,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "分类名称",
- "上级分类D"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_NbeQnQbKX7",
- "type": "state",
- "children": []
- },
- {
- "id": "services_ZGk27b25Zn",
- "type": "services",
- "children": [
- {
- "id": "group_NrSDpMdKGr",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_NrSDpMdKGr"
- },
- "children": [
- {
- "id": "dbTableTemp_nr37DhHs56",
- "name": "积分分类表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_nr37DhHs56",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int"
- },
- {
- "columnName": "分类名称",
- "columnType": "text"
- },
- {
- "columnName": "上级分类ID",
- "columnType": "text"
- },
- {
- "columnName": "是否禁用",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "int"
- },
- {
- "columnName": "_update",
- "columnType": "int"
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_EyYxZ6nFyk",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_EyYxZ6nFyk"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "front_mcftY8knak",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_7RBrYSekBZ",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_BpJBrieFbm",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_Wfmi8NEiAk",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_c8SHxfyxFe",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_zxdpkFrz8h",
- "type": "state",
- "children": []
- },
- {
- "id": "method_Gi5W6mY3tB",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_eYiMsQ4mpG",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_WAfs4TBySe",
- "name": "积分分类编辑后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_Pj3CGzPFxA",
- "name": "微信小程序后台服务组件",
- "type": "module",
- "props": {
- "devId": "module_Pj3CGzPFxA",
- "appModuleId": "936",
- "appModuleVersion": 2
- },
- "children": [
- {
- "id": "modules_yetYBZE6iG",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_YT65iwRANC",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_b5mtR6C282",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_3jNjrtWnrp",
- "type": "bPAttr",
- "children": [
- {
- "id": "variable_FS858Nw8zp",
- "name": "APPSECRET",
- "type": "variable",
- "props": {
- "devId": "variable_FS858Nw8zp",
- "value": null
- }
- },
- {
- "id": "variable_hQPh5XXb7r",
- "name": "APPID",
- "type": "variable",
- "props": {
- "devId": "variable_hQPh5XXb7r",
- "value": null
- }
- }
- ]
- },
- {
- "id": "bPMethod_G2jMcGcfdh",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_x42XREiaWn",
- "name": "获取accessToken服务",
- "type": "service",
- "props": {
- "devId": "service_x42XREiaWn",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nconst APPID = _F('variable_hQPh5XXb7r').callMethod('get');\r\nconst APPSECRET = _F('variable_FS858Nw8zp').callMethod('get');\r\nconst cacheKey = 'wx_mp_access_token_' + APPID;\r\n\r\nconsole.log('APPID',APPID)\r\nconsole.log('APPSECRET',APPSECRET)\r\n\r\nemitter.on('getAccessTokenFromCache', async () => {\r\n _F('bCacheTemp_i326Wbnmrd').callMethod('get', {\r\n key: cacheKey,\r\n success: (data) => {\r\n if (data) {\r\n console.log('从缓存中获取 access_token');\r\n const accessToken = JSON.parse(data);\r\n emitter.emit('accessTokenObtained', accessToken);\r\n } else {\r\n emitter.emit('getAccessTokenFromServer');\r\n }\r\n },\r\n fail: () => {\r\n emitter.emit('accessTokenObtainFailed', '获取缓存失败');\r\n }\r\n });\r\n});\r\n\r\nemitter.on('getAccessTokenFromServer', async () => {\r\n \r\n const urllib = (await _F('module_func').callMethod('import', 'urllib')).default;\r\n const url = `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${APPID}&secret=${APPSECRET}`;\r\n urllib.request(url, { method: 'GET', dataType: 'json' }).then((response) => {\r\n \r\n console.log('access_token response',response.data);\r\n\r\n const { access_token, expires_in } = response.data;\r\n\r\n if(!access_token){\r\n emitter.emit('accessTokenObtainFailed', response.data.errmsg);\r\n return;\r\n }\r\n\r\n // 将 access_token 存入缓存中,缓存时间为 2 小时(注意:微信服务器返回的 expires_in 为秒)\r\n _F('bCacheTemp_i326Wbnmrd').callMethod('set', {\r\n key: cacheKey,\r\n value: JSON.stringify(access_token),\r\n expire: expires_in,\r\n success: () => {\r\n console.log('access_token 缓存设置成功');\r\n },\r\n fail: () => {\r\n console.log('access_token 缓存设置失败');\r\n }\r\n });\r\n emitter.emit('accessTokenObtained', access_token);\r\n }).catch(err => {\r\n emitter.emit('accessTokenObtainFailed', err);\r\n });\r\n});\r\n\r\n// 事件监听:accessTokenObtained\r\nemitter.on('accessTokenObtained', async (accessToken) => {\r\n _funcCb({code:200,errMsg:'ok',result:accessToken});\r\n});\r\n\r\n// 事件监听:accessTokenObtainFailed\r\nemitter.on('accessTokenObtainFailed', async (error) => {\r\n _funcCb({code:0,errMsg:'fail',result:error});\r\n});\r\n\r\n// 开始执行\r\nemitter.emit('getAccessTokenFromCache');\r\n",
- "inParams": [],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_ffMzCYBtWN",
- "name": "授权code获取用户信息服务",
- "type": "service",
- "props": {
- "devId": "service_ffMzCYBtWN",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\nconst code = param.code;\r\nconst APPID = _F('variable_hQPh5XXb7r').callMethod('get');\r\nconst APPSECRET = _F('variable_FS858Nw8zp').callMethod('get');\r\nconst cacheKey = 'wx_mp_user_session_key_';\r\n\r\nif (!code) {\r\n _funcCb({ code: 0, errMsg: '请传入code', result: {} });\r\n return;\r\n}\r\n\r\n// 调用获取 accessToken 的服务\r\n// _F('service_x42XREiaWn').call({}, (res) => {\r\n// if(res.code === 200){\r\n// // 在这里可以继续发出下一个事件,获取用户信息\r\n// let accessToken = res.result;\r\n// emitter.emit('getUserInfo', accessToken);\r\n// }else{\r\n// _funcCb(res);\r\n// }\r\n\r\n// });\r\n\r\n\r\n\r\nemitter.on('getUserInfo', async () => {\r\n const urllib = (await _F('module_func').callMethod('import', 'urllib')).default;\r\n // 在这里可以使用 accessToken,调用获取用户信息的 API\r\n\r\n const url = `https://api.weixin.qq.com/sns/jscode2session?appid=${APPID}&secret=${APPSECRET}&js_code=${code}&grant_type=authorization_code`;\r\n urllib.request(url, { method: 'GET', dataType: 'json' }).then((response) => {\r\n // 在这里处理获取到的用户信息\r\n const { openid, session_key, unionid } = response.data;\r\n\r\n if (!session_key) {\r\n console.log('获取session_key出错:', response.data);\r\n _funcCb({ code: 0, errMsg: '获取session_key出错', result: response.data.errmsg });\r\n return;\r\n }\r\n\r\n\r\n // _F('bCacheTemp_i326Wbnmrd').callMethod('set', {\r\n // key: cacheKey + openid,\r\n // value: JSON.stringify(session_key),\r\n // expire: expires_in,\r\n // success: () => {\r\n // console.log('session_key 缓存设置成功');\r\n // },\r\n // fail: () => {\r\n // console.log('session_key 缓存设置失败');\r\n // }\r\n // });\r\n\r\n _funcCb({ code: 200, errMsg: 'ok', result: response.data });\r\n }).catch(err => {\r\n _funcCb({ code: 0, errMsg: 'fail', result: err });\r\n });\r\n\r\n})\r\n\r\nemitter.emit('getUserInfo');",
- "inParams": [
- "code"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_SRpWwwnwb7",
- "name": "通过 access_token 和 openid 获取用户信息服务",
- "type": "service",
- "props": {
- "devId": "service_SRpWwwnwb7",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\n\r\nconst access_token = param.access_token;\r\nconst openid = param.openid;\r\n\r\nif (!access_token) {\r\n _funcCb({ code: 0, errMsg: '请传入access_token', result: {} });\r\n return;\r\n}\r\n\r\nif (!openid) {\r\n _funcCb({ code: 0, errMsg: '请传入openid', result: {} });\r\n return;\r\n}\r\n\r\n//通过 access_token 和 openid 获取用户信息\r\nemitter.on('fetchUserInfo', async () => {\r\n const urllib = (await _F('module_func').callMethod('import', 'urllib')).default;\r\n\r\n const url = `https://api.weixin.qq.com/sns/userinfo?access_token=${access_token}&openid=${openid}&lang=zh_CN`;\r\n\r\n urllib.request(url, { method: 'GET', dataType: 'json' }).then((response) => {\r\n const userInfo = response.data;\r\n\r\n console.log(userInfo);\r\n\r\n if (userInfo.errMsg) {\r\n _funcCb({ code: 0, errMsg: 'fail', result: userInfo.errMsg });\r\n } else {\r\n _funcCb({ code: 200, errMsg: 'ok', result: userInfo });\r\n }\r\n }).catch(err => {\r\n _funcCb({ code: 0, errMsg: 'fail', result: err });\r\n });\r\n\r\n});\r\n\r\nemitter.emit('fetchUserInfo');",
- "inParams": [
- "access_token",
- "openid"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_d8m3KpwS7X",
- "name": "通过 access_token 和 code 获取用户手机号服务",
- "type": "service",
- "props": {
- "devId": "service_d8m3KpwS7X",
- "isOpen": false,
- "isSync": true,
- "jsCode": "const emitter = new events.EventEmitter();\r\n\r\n\r\nlet access_token = param.access_token;\r\nconst code = param.code;\r\n\r\nif (!access_token) {\r\n\r\n const atRes = await _F('service_x42XREiaWn').call({});\r\n\r\n if(atRes.code === 200){\r\n access_token = atRes.result;\r\n }else{\r\n _funcCb({ code: 0, errMsg: '请传入access_token', result: {} });\r\n return;\r\n }\r\n\r\n \r\n}\r\n\r\nif (!code) {\r\n _funcCb({ code: 0, errMsg: '请传入code', result: {} });\r\n return;\r\n}\r\n\r\n//通过 access_token 和 code 获取用户信息\r\nemitter.on('fetchUserInfo', async () => {\r\n const urllib = (await _F('module_func').callMethod('import', 'urllib')).default;\r\n\r\n const url = `https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=${access_token}`;\r\n\r\n urllib.request(url, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n },\r\n data: {\r\n code\r\n },\r\n dataType: 'json'\r\n }).then((response) => {\r\n const userInfo = response.data;\r\n\r\n console.log(userInfo);\r\n\r\n if (userInfo.errcode === 0) {\r\n _funcCb({ code: 200, errMsg: 'ok', result: userInfo.phone_info });\r\n } else {\r\n _funcCb({ code: 0, errMsg: userInfo.errmsg , result: userInfo });\r\n }\r\n }).catch(err => {\r\n _funcCb({ code: 0, errMsg: 'fail', result: err });\r\n });\r\n\r\n});\r\n\r\nemitter.emit('fetchUserInfo');",
- "inParams": [
- "access_token",
- "code"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_R48XmRjFyt",
- "type": "state",
- "children": []
- },
- {
- "id": "services_ywWwbMM8mT",
- "type": "services",
- "children": [
- {
- "id": "bCacheTemp_i326Wbnmrd",
- "name": "accessToken缓存",
- "type": "bCacheTemp",
- "props": {
- "devId": "bCacheTemp_i326Wbnmrd"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "front_rwHYJt8YEF",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "overflow": "hidden auto",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_TYs3ZXKwiF",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_3jmCs3ZQmJ",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_kMxY7XkdBK",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_j4wx78ZtKD",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_Ec8zzBTDis",
- "type": "state",
- "children": []
- },
- {
- "id": "method_EJtmBC5tiB",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_JTW8MjsZaC",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_kN3aWJXmiy",
- "name": "微信公众平台后台服务组件",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_PEK2CxS7xC",
- "name": "微信支付代金券SDK模块",
- "type": "module",
- "props": {},
- "children": [
- {
- "id": "front_cSXPhYbDkb",
- "type": "front",
- "children": [
- {
- "id": "props_smxAswpEAT",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_zSJzdpak86",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_TQ6KhNapCP",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_nwX8Gmz5TB",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_2FK5whd58k",
- "type": "state",
- "children": []
- },
- {
- "id": "method_Nc7c8Wtnx8",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_Fpf8QfeRjd",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "backend_xAHiPcNRxM",
- "type": "backend",
- "children": [
- {
- "id": "props_5mzA8NhJSp",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_jpE2w4EJCK",
- "type": "bPAttr",
- "children": [
- {
- "id": "variable_CECZhxwhdG",
- "name": "商户私钥",
- "type": "variable",
- "props": {}
- },
- {
- "id": "variable_WGWwxWXhtP",
- "name": "商户号",
- "type": "variable",
- "props": {}
- },
- {
- "id": "variable_Ye37GiY7pQ",
- "name": "证书序列号",
- "type": "variable",
- "props": {}
- },
- {
- "id": "variable_TKQnZxySr4",
- "name": "AppId",
- "type": "variable",
- "props": {
- "value": ""
- }
- }
- ]
- },
- {
- "id": "bPMethod_FXzCaAM23b",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_iibHYYjx5m",
- "name": "计算V3签名串",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const crypto = await Import('crypto');\r\nconst { URL } = await Import('url');\r\n\r\nfunction generateWechatPayV3Signature(httpMethod, url, body, mch_private_key, merchant_id, serial_no, nonce) {\r\n \r\n const privateKey = `-----BEGIN PRIVATE KEY-----\\n${mch_private_key}\\n-----END PRIVATE KEY-----`;\r\n\r\n const timestamp = Math.floor(Date.now() / 1000);\r\n\r\n const urlParts = new URL(url);\r\n const canonicalUrl = urlParts.pathname + (urlParts.search || '');\r\n\r\n const message = `${httpMethod}\\n${canonicalUrl}\\n${timestamp}\\n${nonce}\\n${body}\\n`;\r\n //const message = `GET\\n/v3/marketing/favor/users/oP-y45xbf7hrhC6yeabpjXzIhUWg/coupons/31829742841?appid=wx90d230c69b82b4c0\\n1686129065\\nrl6KrYyF6Zx5nAPeqOJSqLoTJs3gBzkk\\n\\n`;\r\n console.log('message',JSON.stringify(message));\r\n\r\n const sign = crypto.createSign('RSA-SHA256');\r\n sign.write(message);\r\n sign.end();\r\n const rawSign = sign.sign(privateKey, 'base64');\r\n\r\n const schema = 'WECHATPAY2-SHA256-RSA2048';\r\n const token = `${schema} mchid=\"${merchant_id}\",nonce_str=\"${nonce}\",timestamp=\"${timestamp}\",serial_no=\"${serial_no}\",signature=\"${rawSign}\"`;\r\n\r\n return token;\r\n}\r\nfunction generateNonceStr(length = 32) {\r\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\r\n const maxPos = chars.length;\r\n let nonceStr = '';\r\n for (let i = 0; i < length; i++) {\r\n nonceStr += chars.charAt(Math.floor(Math.random() * maxPos));\r\n }\r\n return nonceStr;\r\n}\r\n\r\nconsole.log('param',param);\r\n\r\n// 调用示例\r\nconst httpMethod = param.httpMethod;\r\nconst url = param.url;\r\nconst body = param.body ? JSON.stringify(param.body) : '';\r\nconst mch_private_key = _F('variable_CECZhxwhdG').callMethod('get');\r\nconst merchant_id = _F('variable_WGWwxWXhtP').callMethod('get');\r\nconst serial_no = _F('variable_Ye37GiY7pQ').callMethod('get');\r\n\r\nconst nonce = generateNonceStr(16);\r\n\r\nconst signature = generateWechatPayV3Signature(httpMethod, url, body, mch_private_key, merchant_id, serial_no, nonce);\r\nconsole.log(signature);\r\n\r\n_funcCb(signature);\r\n",
- "inParams": [
- "httpMethod",
- "url",
- "body"
- ]
- }
- },
- {
- "id": "service_iyScbpEKBk",
- "name": "发起请求API",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const urllib = await Import('urllib');\r\n\r\nconsole.log('param', param);\r\n\r\n// 调用示例\r\nconst httpMethod = param.httpMethod;\r\nconst body = param.body;\r\nconst url = param.url;\r\n\r\nconst signature = await _F('service_iibHYYjx5m').call({ httpMethod, url, body });\r\nconsole.log(signature);\r\n\r\n// 发送请求\r\nconst reqRes = await urllib.request(url, {\r\n method: httpMethod,\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Authorization': signature,\r\n 'Accept': 'application/json',\r\n //'User-Agent': 'Your User Agent'\r\n },\r\n data:body\r\n});\r\n\r\n_funcCb(reqRes.data.toString());\r\n",
- "inParams": [
- "httpMethod",
- "url",
- "body"
- ]
- }
- },
- {
- "id": "service_7cSwKHSNyz",
- "name": "查询代金券详情API",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const urllib = await Import('urllib');\r\n\r\nconsole.log('param', param);\r\n\r\n// 调用示例\r\nconst httpMethod = 'GET';\r\nconst body = '';\r\nconst openid = param.openid;\r\nconst couponId = param.couponId;\r\nconst appid = _F('variable_TKQnZxySr4').callMethod('get');\r\nconst url = `https://api.mch.weixin.qq.com/v3/marketing/favor/users/${openid}/coupons/${couponId}?appid=${appid}`;\r\n\r\nconst reqRes = await _F('service_iyScbpEKBk').call({ httpMethod, url, body });\r\n\r\nconsole.log(reqRes);\r\n\r\n_funcCb(reqRes);\r\n\r\n// const signature = await _F('service_iibHYYjx5m').call({ httpMethod, url, body });\r\n// console.log(signature);\r\n\r\n// // 发送请求\r\n// //\r\n\r\n// console.log(urllib);\r\n\r\n// const reqRes = await urllib.request(url, {\r\n// method: httpMethod,\r\n// headers: {\r\n// 'Content-Type': 'application/json',\r\n// 'Authorization': signature,\r\n// 'Accept': 'application/json',\r\n// 'User-Agent': 'Your User Agent'\r\n// },\r\n// });\r\n\r\n// _funcCb(reqRes.data.toString());\r\n",
- "inParams": [
- "openid",
- "couponId"
- ]
- }
- },
- {
- "id": "service_FFZCEpzHrA",
- "name": "发放代金券批次API",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const urllib = await Import('urllib');\r\n\r\nconsole.log('param', param);\r\n\r\n// 调用示例\r\nconst httpMethod = 'POST';\r\nconst openid = param.openid;\r\nconst appid = _F('variable_TKQnZxySr4').callMethod('get');\r\nconst url = `https://api.mch.weixin.qq.com/v3/marketing/favor/users/${openid}/coupons`;\r\n\r\nconst body = {\r\n \"stock_id\": param.stock_id,\r\n \"out_request_no\": param.out_request_no,\r\n \"appid\": appid,\r\n \"stock_creator_mchid\": param.stock_creator_mchid\r\n};\r\nconst reqRes = await _F('service_iyScbpEKBk').call({ httpMethod, url, body });\r\n\r\nconsole.log(reqRes);\r\n\r\n_funcCb(reqRes);\r\n\r\n",
- "inParams": [
- "openid",
- "stock_id",
- "out_request_no",
- "stock_creator_mchid"
- ]
- }
- },
- {
- "id": "service_x7kn8sGBdy",
- "name": "条件查询批次列表API",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const urllib = await Import('urllib');\r\n\r\nconsole.log('param', param);\r\n\r\n// 调用示例\r\nconst httpMethod = 'GET';\r\nconst body = '';\r\nconst offset = param.offset;\r\nconst limit = param.limit;\r\nconst stock_creator_mchid = param.stock_creator_mchid;\r\nconst status = param.status;\r\nconst appid = _F('variable_TKQnZxySr4').callMethod('get');\r\nlet url = `https://api.mch.weixin.qq.com/v3/marketing/favor/stocks?offset=${offset}&limit=${limit}&stock_creator_mchid=${stock_creator_mchid}`;\r\n\r\nif(status)url += `&status=${status}`;\r\n\r\nconst reqRes = await _F('service_iyScbpEKBk').call({ httpMethod, url, body });\r\n\r\nconsole.log(reqRes);\r\n\r\n_funcCb(reqRes);\r\n",
- "inParams": [
- "offset",
- "limit",
- "stock_creator_mchid",
- "status"
- ]
- }
- },
- {
- "id": "service_z8227dt5h3",
- "name": "创建代金券批次API",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const urllib = await Import('urllib');\r\n\r\nconsole.log('param', param);\r\n\r\n// 调用示例\r\nconst httpMethod = 'POST';\r\nconst openid = param.openid;\r\nconst url = `https://api.mch.weixin.qq.com/v3/marketing/favor/coupon-stocks`;\r\n\r\nconst body = param.body;\r\nconst reqRes = await _F('service_iyScbpEKBk').call({ httpMethod, url, body });\r\n\r\nconsole.log(reqRes);\r\n\r\n_funcCb(reqRes);\r\n\r\n",
- "inParams": [
- "body"
- ]
- }
- },
- {
- "id": "service_kx2ADaXesE",
- "name": "激活代金券批次API",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const urllib = await Import('urllib');\r\n\r\nconsole.log('param', param);\r\n\r\n// 调用示例\r\nconst httpMethod = 'POST';\r\nconst body = {\r\n stock_creator_mchid: param.stock_creator_mchid\r\n};\r\nconst stock_id = param.stock_id;\r\nconst url = `https://api.mch.weixin.qq.com/v3/marketing/favor/stocks/${stock_id}/start`;\r\n\r\nconst reqRes = await _F('service_iyScbpEKBk').call({ httpMethod, url, body });\r\n\r\nconsole.log(reqRes);\r\n\r\n_funcCb(reqRes);\r\n\r\n",
- "inParams": [
- "stock_creator_mchid",
- "stock_id"
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_Hn26xE86s3",
- "type": "state",
- "children": []
- },
- {
- "id": "services_jG7AyHGwYh",
- "type": "services",
- "children": [
- {
- "id": "group_Pkn8kmsMyQ",
- "name": "回收站",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_2zXSYKzNfr",
- "name": "计算微信支付V3签名串服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const crypto = await Import('crypto');\r\nconst { URL } = await Import('url');\r\n\r\nfunction generateWechatPayV3Signature(httpMethod, url, body, mch_private_key, merchant_id, serial_no, nonce) {\r\n \r\n\r\n const privateKey = `-----BEGIN PRIVATE KEY-----\r\n ${mch_private_key}\r\n -----END PRIVATE KEY-----`;\r\n\r\n const timestamp = Math.floor(Date.now() / 1000);\r\n\r\n const urlParts = new URL(url);\r\n const canonicalUrl = urlParts.pathname + (urlParts.search || '');\r\n\r\n const message = `${httpMethod}\\n${canonicalUrl}\\n${timestamp}\\n${nonce}\\n${body}\\n`;\r\n\r\nconsole.log('message',message);\r\n\r\n // const sign = crypto.createSign('RSA-SHA256');\r\n // sign.write(message);\r\n // sign.end();\r\n // const rawSign = sign.sign(privateKey, 'base64');\r\n\r\n // const schema = 'WECHATPAY2-SHA256-RSA2048';\r\n // const token = `mchid=\"${merchant_id}\",nonce_str=\"${nonce}\",timestamp=\"${timestamp}\",serial_no=\"${serial_no}\",signature=\"${rawSign}\"`;\r\n\r\n // return token;\r\n return '';\r\n}\r\n\r\nconsole.log('param',param);\r\n\r\n// 调用示例\r\nconst httpMethod = param.httpMethod;\r\nconst url = param.url;\r\nconst body = JSON.stringify(param.body);\r\nconst mch_private_key = _F('variable_CECZhxwhdG').callMethod('get');\r\nconst merchant_id = _F('variable_WGWwxWXhtP').callMethod('get');\r\nconst serial_no = _F('variable_Ye37GiY7pQ').callMethod('get');\r\nconst nonce = 'nonce';\r\n\r\nconst signature = generateWechatPayV3Signature(httpMethod, url, body, mch_private_key, merchant_id, serial_no, nonce);\r\nconsole.log(signature);\r\n\r\n_funcCb(signature);",
- "inParams": [
- "httpMethod",
- "url",
- "body"
- ]
- }
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "modules_Hx4fGfEQP3",
- "type": "modules",
- "children": []
- }
- ]
- },
- {
- "id": "module_ByNbsAd5hD",
- "name": "代金券管理后台组件",
- "type": "module",
- "props": {
- "devId": "module_ByNbsAd5hD",
- "appModuleId": "",
- "appModuleVersion": 14
- },
- "children": [
- {
- "id": "modules_b4NiAAEBP5",
- "name": "模块",
- "type": "modules",
- "props": {}
- },
- {
- "id": "backend_sww7YXfce4",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_i5NC3DS6Q6",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_XbXBmfcErS",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_sJTYpzpd65",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_twyCJwfKE8",
- "name": "代金券批次关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_twyCJwfKE8",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0 ? parseInt(param.当前页码) : 1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0 ? parseInt(param.每页大小) : 10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', () => {\r\n\r\n deptList = deptList.map(item => {\r\n\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code: 200,\r\n errMsg: 'ok',\r\n result: deptList,\r\n total: deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', () => {\r\n let 搜索条件 = param.搜索条件 || {};\r\n if (搜索条件.hasOwnProperty('批次名称') && 搜索条件.批次名称) condition['批次名称'] = ['like', 搜索条件.批次名称];\r\n if (搜索条件.hasOwnProperty('批次号') && 搜索条件.批次号) condition['批次号'] = ['like', 搜索条件.批次号];\r\n if (搜索条件.hasOwnProperty('批次分类ID')) condition['批次分类ID'] = 搜索条件.批次分类ID;\r\n if (搜索条件.hasOwnProperty('是否首页展示')) condition['是否首页展示'] = 搜索条件.是否首页展示;\r\n if (搜索条件.hasOwnProperty('是否上架')) condition['是否上架'] = 搜索条件.是否上架;\r\n if (搜索条件.hasOwnProperty('是否删除')) condition['是否删除'] = 搜索条件.是否删除;\r\n\r\n console.log('搜索条件condition',condition);\r\n});\r\n\r\nemitter.on('getTotal', () => {\r\n\r\n _F('dbViewTemp_AJyyXTd2RD').callMethod('getCount', {\r\n condition,\r\n success: (res) => {\r\n emitter.emit('getList', res[0].count);\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表总数失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\nemitter.on('getList', (total) => {\r\n\r\n _F('dbViewTemp_AJyyXTd2RD').callMethod('getRows', {\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby: '_update',\r\n sort: 'desc',\r\n success: (res) => {\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('output');\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "搜索条件",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_A4myyJ8cfF",
- "name": "批次删除服务",
- "type": "service",
- "props": {
- "devId": "service_A4myyJ8cfF",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('批次ID') && param['批次ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入批次ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.批次ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_DeEzJeMkjd').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "批次ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_bWAJYa85dp",
- "name": "批次编辑服务",
- "type": "service",
- "props": {
- "devId": "service_bWAJYa85dp",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('行ID') && param['行ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入行ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.行ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('批次分类ID'))editObj['批次分类ID'] = param.批次分类ID;\r\n if(param.hasOwnProperty('批次名称'))editObj['批次名称'] = param.批次名称;\r\n if(param.hasOwnProperty('批次号'))editObj['批次号'] = param.批次号;\r\n if(param.hasOwnProperty('制券商户号'))editObj['制券商户号'] = param.制券商户号;\r\n if(param.hasOwnProperty('发券商户号'))editObj['发券商户号'] = param.发券商户号;\r\n if(param.hasOwnProperty('是否首页展示'))editObj['是否首页展示'] = param.是否首页展示;\r\n if(param.hasOwnProperty('批次简介'))editObj['批次简介'] = param.批次简介;\r\n if(param.hasOwnProperty('是否上架'))editObj['是否上架'] = param.是否上架 == 1?1:0;\r\n\r\n _F('dbTableTemp_DeEzJeMkjd').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "行ID",
- "批次号",
- "上架时间",
- "下架时间",
- "图片链接",
- "批次名称",
- "批次简介",
- "是否上架",
- "批次分类ID",
- "制券商户号",
- "发券商户号",
- "是否首页展示"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "行ID": "",
- "批次号": "",
- "上架时间": "",
- "下架时间": "",
- "图片链接": "",
- "批次名称": "",
- "批次简介": "",
- "是否上架": "",
- "批次分类ID": "",
- "制券商户号": "",
- "发券商户号": "",
- "是否首页展示": ""
- }
- }
- },
- {
- "id": "service_6CQ846mkJ2",
- "name": "批次新增服务",
- "type": "service",
- "props": {
- "devId": "service_6CQ846mkJ2",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_DeEzJeMkjd').callMethod('addRow',{\r\n row:{\r\n ...param,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "批次分类ID",
- "批次号",
- "制券商户号",
- "发券商户号",
- "批次名称",
- "批次简介",
- "图片链接",
- "是否首页展示"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "批次号": "",
- "图片链接": "",
- "批次名称": "",
- "批次简介": "",
- "批次分类ID": "",
- "制券商户号": "",
- "发券商户号": "",
- "是否首页展示": ""
- }
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_jdABxjd4ts",
- "type": "state",
- "children": []
- },
- {
- "id": "services_NY8G3hzB7Q",
- "type": "services",
- "children": [
- {
- "id": "group_TSzxhRhprz",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_TSzxhRhprz"
- },
- "children": [
- {
- "id": "dbTableTemp_DeEzJeMkjd",
- "name": "代金券批次列表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_DeEzJeMkjd",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "批次分类ID",
- "columnType": "int"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "制券商户号",
- "columnType": "text"
- },
- {
- "columnName": "发券商户号",
- "columnType": "text"
- },
- {
- "columnName": "批次名称",
- "columnType": "text"
- },
- {
- "columnName": "批次简介",
- "columnType": "text"
- },
- {
- "columnName": "图片链接",
- "columnType": "text"
- },
- {
- "columnName": "是否首页展示",
- "columnType": "int"
- },
- {
- "columnName": "是否上架",
- "columnType": "int"
- },
- {
- "columnName": "上架时间",
- "columnType": "int"
- },
- {
- "columnName": "下架时间",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbViewTemp_AJyyXTd2RD",
- "name": "批次表+分类表视图",
- "type": "dbViewTemp",
- "props": {}
- }
- ]
- },
- {
- "id": "group_KkEhGCkAbW",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_KkEhGCkAbW"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "front_sWWJCwh5Qx",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_hAdRtKdkbY",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_kee5k3EaQa",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_c46hPfWMZE",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_a84xYdMpY5",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_SQyjPwSp74",
- "type": "state",
- "children": []
- },
- {
- "id": "method_sDbxC8w4n2",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_5AieJpRH3Z",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "config_7jGGckwm63",
- "name": "角色管理后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- }
- ]
- },
- {
- "id": "module_fE35nbENiD",
- "name": "领券日志后台组件",
- "type": "module",
- "props": {
- "devId": "module_fE35nbENiD",
- "appModuleId": "",
- "appModuleVersion": 14
- },
- "children": [
- {
- "id": "config_FEeRx8knhJ",
- "name": "角色管理后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- },
- {
- "id": "front_zC73MhsdrJ",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_rdfFtj6dJc",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_7PryRzyW83",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_MmbmtZ4kYa",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_ENTC52tHDB",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_pCcKtNH85E",
- "type": "state",
- "children": []
- },
- {
- "id": "method_nCjTGemYXr",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_sxidiX6Bj8",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "backend_JJW5X6ZbEE",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_JATSbPKZBJ",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_pr5GTEsZ2n",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_wheC6d8TEp",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_AcidSxppYx",
- "name": "领券日志关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_AcidSxppYx",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0 ? parseInt(param.当前页码) : 1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0 ? parseInt(param.每页大小) : 10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', () => {\r\n\r\n deptList = deptList.map(item => {\r\n\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code: 200,\r\n errMsg: 'ok',\r\n result: deptList,\r\n total: deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', () => {\r\n let 搜索条件 = param.搜索条件 || {};\r\n if (搜索条件.hasOwnProperty('批次分类ID') && 搜索条件.批次分类ID) condition['批次分类ID'] = 搜索条件.批次分类ID;\r\n if (搜索条件.hasOwnProperty('批次名称') && 搜索条件.批次名称) condition['批次名称'] = ['like', 搜索条件.批次名称];\r\n if (搜索条件.hasOwnProperty('批次号') && 搜索条件.批次号) condition['批次号'] = ['like', 搜索条件.批次号];\r\n if (搜索条件.hasOwnProperty('领取结果')) condition['领取结果'] = 搜索条件.领取结果;\r\n if (搜索条件.hasOwnProperty('用户ID')) condition['用户ID'] = 搜索条件.用户ID;\r\n if (搜索条件.hasOwnProperty('兑换码ID')) condition['兑换码ID'] = 搜索条件.兑换码ID;\r\n if (搜索条件.hasOwnProperty('是否删除')) condition['是否删除'] = 搜索条件.是否删除;\r\n\r\n console.log('领券日志关键字搜索服务.condition',condition);\r\n});\r\n\r\nemitter.on('getTotal', () => {\r\n\r\n _F('dbViewTemp_ySBFNYEzPe').callMethod('getCount', {\r\n condition,\r\n success: (res) => {\r\n emitter.emit('getList', res[0].count);\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表总数失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\nemitter.on('getList', (total) => {\r\n\r\n _F('dbViewTemp_ySBFNYEzPe').callMethod('getRows', {\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby: '_update',\r\n sort: 'desc',\r\n success: (res) => {\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('output');\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_m6jj8rdeSp",
- "name": "批次删除服务",
- "type": "service",
- "props": {
- "devId": "service_m6jj8rdeSp",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('批次ID') && param['批次ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入批次ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.批次ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_aGxy3Zp8YK').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "批次ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_Di2yTiEnB3",
- "name": "批次编辑服务",
- "type": "service",
- "props": {
- "devId": "service_Di2yTiEnB3",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('批次ID') && param['批次ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入批次ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.批次ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('批次分类ID'))editObj['批次分类ID'] = param.批次分类ID;\r\n if(param.hasOwnProperty('批次名称'))editObj['批次名称'] = param.批次名称;\r\n if(param.hasOwnProperty('是否上架'))editObj['是否上架'] = param.是否上架 == 1?1:0;\r\n\r\n _F('dbTableTemp_aGxy3Zp8YK').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "批次ID",
- "批次分类ID",
- "批次号",
- "制券商户号",
- "发券商户号",
- "批次名称",
- "批次简介",
- "图片链接",
- "是否首页展示",
- "是否上架",
- "上架时间",
- "下架时间"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "批次ID": "",
- "批次号": "",
- "上架时间": "",
- "下架时间": "",
- "图片链接": "",
- "批次名称": "",
- "批次简介": "",
- "是否上架": "",
- "批次分类ID": "",
- "制券商户号": "",
- "发券商户号": "",
- "是否首页展示": ""
- }
- }
- },
- {
- "id": "service_azwnbpdzmE",
- "name": "领券日志新增服务",
- "type": "service",
- "props": {
- "devId": "service_azwnbpdzmE",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_aGxy3Zp8YK').callMethod('addRow',{\r\n row:{\r\n ...param,\r\n //是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "批次分类ID",
- "批次号",
- "用户ID",
- "领取结果",
- "券ID",
- "失败原因"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "券ID": "",
- "用户ID": "",
- "批次号": "",
- "失败原因": "",
- "领取结果": "",
- "批次分类ID": ""
- }
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_5P2FPzFXCY",
- "type": "state",
- "children": []
- },
- {
- "id": "services_TtnrzQsZC4",
- "type": "services",
- "children": [
- {
- "id": "group_c5PKsWN3nS",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_c5PKsWN3nS"
- },
- "children": [
- {
- "id": "dbTableTemp_aGxy3Zp8YK",
- "name": "领券日志列表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_aGxy3Zp8YK",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "兑换码ID",
- "columnType": "int"
- },
- {
- "columnName": "批次分类ID",
- "columnType": "int"
- },
- {
- "columnName": "批次号",
- "columnType": "text"
- },
- {
- "columnName": "用户ID",
- "columnType": "int"
- },
- {
- "columnName": "领取结果",
- "columnType": "int"
- },
- {
- "columnName": "券ID",
- "columnType": "text"
- },
- {
- "columnName": "失败原因",
- "columnType": "text"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbViewTemp_ySBFNYEzPe",
- "name": "领券日志+批次分类+兑换码视图",
- "type": "dbViewTemp",
- "props": {}
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "modules_x85zWT6y3T",
- "name": "模块",
- "type": "modules",
- "props": {}
- }
- ]
- },
- {
- "id": "module_KQRf23H6p8",
- "name": "活动分类管理后台组件",
- "type": "module",
- "props": {
- "devId": "module_KQRf23H6p8",
- "appModuleId": "",
- "appModuleVersion": 14
- },
- "children": [
- {
- "id": "config_hywwdAkckw",
- "name": "角色管理后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- },
- {
- "id": "front_scGiAkrp88",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_N3R2Y6eSDE",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_ShYp3RhM43",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_nsbfjJG3bW",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_XjyPDZiCxF",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_EW84sDKHtd",
- "type": "state",
- "children": []
- },
- {
- "id": "method_wspZHY8GiN",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_QPdXaT7BsW",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "backend_72rEaNwNR2",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_t2b8Hzf2Ej",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_XGmWhQt57t",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_YrAcTPAbkY",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_MeJ5kQx5GB",
- "name": "活动分类关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_MeJ5kQx5GB",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0 ? parseInt(param.当前页码) : 1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0 ? parseInt(param.每页大小) : 10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', () => {\r\n\r\n deptList = deptList.map(item => {\r\n\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code: 200,\r\n errMsg: 'ok',\r\n result: deptList,\r\n total: deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', () => {\r\n let 搜索条件 = param.搜索条件 || {};\r\n if (搜索条件.hasOwnProperty('批次分类ID') && 搜索条件.批次分类ID) condition['_id'] = 搜索条件.批次分类ID;\r\n if (搜索条件.hasOwnProperty('分类名称') && 搜索条件.分类名称) condition['分类名称'] = ['like', 搜索条件.分类名称];\r\n if (搜索条件.hasOwnProperty('批次分类') && 搜索条件.批次分类) condition['批次分类'] = ['like', 搜索条件.批次分类];\r\n if (搜索条件.hasOwnProperty('是否删除')) condition['是否删除'] = 搜索条件.是否删除;\r\n});\r\n\r\nemitter.on('getTotal', () => {\r\n\r\n _F('dbTableTemp_pTM2d2xs45').callMethod('getCount', {\r\n condition,\r\n success: (res) => {\r\n emitter.emit('getList', res[0].count);\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表总数失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\nemitter.on('getList', (total) => {\r\n\r\n _F('dbTableTemp_pTM2d2xs45').callMethod('getRows', {\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby: '_update',\r\n sort: 'desc',\r\n success: (res) => {\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('output');\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_zAxmdNYtSs",
- "name": "活动分类删除服务",
- "type": "service",
- "props": {
- "devId": "service_zAxmdNYtSs",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('批次分类ID') && param['批次分类ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入批次分类ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.批次分类ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_pTM2d2xs45').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "批次分类ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_64NNTKrwb3",
- "name": "活动分类编辑服务",
- "type": "service",
- "props": {
- "devId": "service_64NNTKrwb3",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('行ID') && param['行ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入行ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.行ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('批次分类'))editObj['批次分类'] = param.批次分类;\r\n if(param.hasOwnProperty('分类名称'))editObj['分类名称'] = param.分类名称;\r\n if(param.hasOwnProperty('最大领取次数'))editObj['最大领取次数'] = param.最大领取次数;\r\n if(param.hasOwnProperty('图片地址'))editObj['图片地址'] = typeof param.图片地址 === 'object'?JSON.stringify(param.图片地址):param.图片地址;\r\n\r\n _F('dbTableTemp_pTM2d2xs45').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "行ID",
- "分类名称",
- "图片地址",
- "批次分类",
- "最大领取次数"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "行ID": "",
- "分类名称": "",
- "图片地址": "",
- "批次分类": "",
- "最大领取次数": ""
- }
- }
- },
- {
- "id": "service_7nGTY6s3nQ",
- "name": "活动分类新增服务",
- "type": "service",
- "props": {
- "devId": "service_7nGTY6s3nQ",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_pTM2d2xs45').callMethod('addRow',{\r\n row:{\r\n ...param,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "分类名称",
- "图片地址",
- "批次分类",
- "最大领取次数"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "分类名称": "",
- "图片地址": "",
- "批次分类": "",
- "最大领取次数": ""
- }
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_4pBQZFEN2h",
- "type": "state",
- "children": []
- },
- {
- "id": "services_DfAWB5FNNp",
- "type": "services",
- "children": [
- {
- "id": "group_rHDfDzjx3r",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_rHDfDzjx3r"
- },
- "children": [
- {
- "id": "dbTableTemp_pTM2d2xs45",
- "name": "活动分类表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_pTM2d2xs45",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "批次分类",
- "columnType": "text"
- },
- {
- "columnName": "分类名称",
- "columnType": "text"
- },
- {
- "columnName": "图片地址",
- "columnType": "json"
- },
- {
- "columnName": "最大领取次数",
- "columnType": "int"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_BbcQDQhknr",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_BbcQDQhknr"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "modules_W8ZkM2KcfC",
- "name": "模块",
- "type": "modules",
- "props": {}
- }
- ]
- },
- {
- "id": "module_3GdzS7iAEJ",
- "name": "广告管理后台组件",
- "type": "module",
- "props": {
- "devId": "module_3GdzS7iAEJ",
- "appModuleId": "",
- "appModuleVersion": 14
- },
- "children": [
- {
- "id": "config_tZnAKbdXQQ",
- "name": "角色管理后台组件",
- "type": "config",
- "props": {
- "style": {}
- }
- },
- {
- "id": "front_EDwBCQXGay",
- "name": "前台",
- "type": "front",
- "props": {
- "style": {
- "width": "100%",
- "height": "100%",
- "display": "flex",
- "overflow": "hidden auto",
- "alignItems": "flex-start",
- "flexDirection": "column",
- "backgroundColor": "#ffffff"
- }
- },
- "children": [
- {
- "id": "props_5FFQ88SCwi",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_AzSnXW2ZMG",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_PRfeh2f4TE",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_J2AArbjZ63",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_wjFmzkmXJ4",
- "type": "state",
- "children": []
- },
- {
- "id": "method_6DP5hXDJEH",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_BZ4AdFFCFJ",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "backend_nk8YMFyiba",
- "name": "后台",
- "type": "backend",
- "props": {
- "style": {
- "height": "200px",
- "backgroundColor": "red"
- }
- },
- "children": [
- {
- "id": "props_sAZihzGFS6",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_7ra575ttC8",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_cazTnGfGsG",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_nwS5JzCrxZ",
- "name": "广告关键字搜索服务",
- "type": "service",
- "props": {
- "devId": "service_nwS5JzCrxZ",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter();\r\nlet condition = {};\r\n\r\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0 ? parseInt(param.当前页码) : 1;\r\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小 > 0 ? parseInt(param.每页大小) : 10;\r\nlet deptTotal = 0;\r\nlet deptList = [];\r\n\r\n\r\nemitter.on('output', () => {\r\n\r\n deptList = deptList.map(item => {\r\n\r\n return item;\r\n })\r\n\r\n _funcCb({\r\n code: 200,\r\n errMsg: 'ok',\r\n result: deptList,\r\n total: deptTotal\r\n });\r\n})\r\n\r\nemitter.on('setCondition', () => {\r\n let 搜索条件对象 = param.搜索条件对象 || {};\r\n if (搜索条件对象.hasOwnProperty('广告位ID') && 搜索条件对象.广告位ID) condition['广告位ID'] = 搜索条件对象.广告位ID;\r\n // if (搜索条件对象.hasOwnProperty('批次分类') && 搜索条件对象.批次分类) condition['批次分类'] = ['like', 搜索条件对象.批次分类];\r\n if (搜索条件对象.hasOwnProperty('是否删除')) condition['是否删除'] = 搜索条件对象.是否删除;\r\n});\r\n\r\nemitter.on('getTotal', () => {\r\n\r\n _F('dbTableTemp_Gf83SMhtNs').callMethod('getCount', {\r\n condition,\r\n success: (res) => {\r\n emitter.emit('getList', res[0].count);\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表总数失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\nemitter.on('getList', (total) => {\r\n\r\n _F('dbTableTemp_Gf83SMhtNs').callMethod('getRows', {\r\n condition,\r\n pageNum,\r\n pageSize,\r\n orderby: '_update',\r\n sort: 'desc',\r\n success: (res) => {\r\n deptTotal = total;\r\n deptList = res;\r\n emitter.emit('output');\r\n },\r\n fail: (err) => {\r\n _funcCb({\r\n code: 0,\r\n errMsg: '获取列表失败',\r\n result: err,\r\n total: 0\r\n });\r\n },\r\n\r\n });\r\n});\r\n\r\n\r\nemitter.emit('setCondition');\r\nemitter.emit('getTotal');",
- "inParams": [
- "搜索条件对象",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_JpDz6Yr5WS",
- "name": "广告删除服务",
- "type": "service",
- "props": {
- "devId": "service_JpDz6Yr5WS",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('广告ID') && param['广告ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入广告ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.广告ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('是否删除'))editObj['是否删除'] = param.是否删除 == 1?1:0;\r\n\r\n _F('dbTableTemp_Gf83SMhtNs').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'操作成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "广告ID",
- "是否删除"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_MjCiFc8xna",
- "name": "广告编辑服务",
- "type": "service",
- "props": {
- "devId": "service_MjCiFc8xna",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nif(param.hasOwnProperty('行ID') && param['行ID'] > 0)emitter.emit('editDept');\r\nelse emitter.emit('noDeptID');\r\n\r\n\r\nemitter.on('noDeptID', ()=>{\r\n _funcCb({code:0,errMsg:'请传入行ID',result:{}});\r\n})\r\n\r\nemitter.on('editDept', ()=>{\r\n let condition = {};\r\n condition['_id'] = param.行ID;\r\n\r\n let editObj = {};\r\n if(param.hasOwnProperty('广告位ID'))editObj['广告位ID'] = param.广告位ID;\r\n if(param.hasOwnProperty('链接地址'))editObj['链接地址'] = param.链接地址;\r\n if(param.hasOwnProperty('图片地址'))editObj['图片地址'] = param.图片地址;\r\n\r\n _F('dbTableTemp_Gf83SMhtNs').callMethod('editRow',{\r\n row:editObj,\r\n condition,\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'编辑成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('editDept');",
- "inParams": [
- "行ID",
- "广告位ID",
- "链接地址",
- "图片地址"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "广告ID": "",
- "广告位ID": "",
- "图片地址": "",
- "链接地址": ""
- }
- }
- },
- {
- "id": "service_PeFDMcznnm",
- "name": "广告新增服务",
- "type": "service",
- "props": {
- "devId": "service_PeFDMcznnm",
- "isOpen": false,
- "jsCode": "const emitter = new events.EventEmitter(); \r\n\r\nemitter.on('addDept', ()=>{\r\n _F('dbTableTemp_Gf83SMhtNs').callMethod('addRow',{\r\n row:{\r\n ...param,\r\n 是否删除:0\r\n },\r\n success:(data)=>{\r\n _funcCb({code:200,errMsg:'新增成功',result:data});\r\n },\r\n fail:()=>{\r\n }\r\n });\r\n})\r\n\r\nemitter.emit('addDept');",
- "inParams": [
- "广告位ID",
- "链接地址",
- "图片地址"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "广告位ID": "",
- "图片地址": "",
- "链接地址": ""
- }
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_NYRHDyMSGi",
- "type": "state",
- "children": []
- },
- {
- "id": "services_PBX2CiEpTT",
- "type": "services",
- "children": [
- {
- "id": "group_TPp8aS7e5i",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_TPp8aS7e5i"
- },
- "children": [
- {
- "id": "dbTableTemp_Gf83SMhtNs",
- "name": "广告表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_Gf83SMhtNs",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "广告位ID",
- "columnType": "int"
- },
- {
- "columnName": "链接地址",
- "columnType": "text"
- },
- {
- "columnName": "图片地址",
- "columnType": "text"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_dHSeAbZkDa",
- "name": "中台服务",
- "type": "group",
- "props": {
- "devId": "group_dHSeAbZkDa"
- }
- }
- ]
- }
- ]
- },
- {
- "id": "modules_CPmWnMHXfB",
- "name": "模块",
- "type": "modules",
- "props": {}
- }
- ]
- },
- {
- "id": "module_asYA84dpEi",
- "name": "兑换码后台组件",
- "type": "module",
- "props": {
- "expandedKeys": [
- "backend_PDahQ77wBZ",
- "props_Z33ebPNASi",
- "bPMethod_TykwkDH7RS",
- "services_HNYwNKEH3w",
- "group_wxnJzZy4aj"
- ]
- },
- "children": [
- {
- "id": "backend_PDahQ77wBZ",
- "name": "后台",
- "type": "backend",
- "props": {},
- "children": [
- {
- "id": "props_Z33ebPNASi",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_Yx5jwB8krp",
- "type": "bPAttr",
- "children": []
- },
- {
- "id": "bPMethod_TykwkDH7RS",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_7XJCaaNJiy",
- "name": "兑换码搜索服务",
- "type": "service",
- "props": {
- "devId": "service_7XJCaaNJiy",
- "isOpen": false,
- "jsCode": "// 搜索服务\n\nconst emitter = new events.EventEmitter();\n\n\nlet condition = {};\n\n\nlet pageNum = param.hasOwnProperty('当前页码') && param.当前页码 > 0\n? parseInt(param.当前页码) : 1;\n\nlet pageSize = param.hasOwnProperty('每页大小') && param.每页大小\n> 0 ? parseInt(param.每页大小) : 10;\n\nlet list = [];\n\nlet total = 0;\n\n\nemitter.on('output', () => {\n \n list = list.map(item => {\n return item;\n })\n \n _funcCb({\n code: 200, \n errMsg: 'ok',\n result: list, \n total: total\n });\n})\n\n\nemitter.on('setCondition', () => {\n let 搜索条件 = param.搜索条件 || {};\n \n if(搜索条件.关键字) {\n condition['兑换码'] = ['like', `%${搜索条件.关键字}%`]; \n }\n \n if (搜索条件.hasOwnProperty('兑换状态')) {\n condition['兑换状态'] = 搜索条件.兑换状态;\n }\n \n if (搜索条件.hasOwnProperty('兑换码')) {\n condition['兑换码'] = 搜索条件.兑换码;\n }\n \n});\n\n\nemitter.on('getTotal', () => {\n \n _F('dbViewTemp_BjKtp3Di7c').callMethod('getCount', {\n condition,\n success: (res) => {\n emitter.emit('getList', res[0].count); \n },\n fail: (err) => {\n _funcCb({\n code: 0,\n errMsg: '获取总数失败',\n result: err,\n total: 0\n });\n }\n });\n \n});\n\n\nemitter.on('getList', (total) => {\n \n _F('dbViewTemp_BjKtp3Di7c').callMethod('getRows', {\n condition,\n pageNum,\n pageSize,\n orderby: '_update',\n sort: 'desc',\n success: (res) => {\n list = res;\n total = total;\n emitter.emit('output');\n },\n fail: (err) => {\n _funcCb({\n code: 0,\n errMsg: '获取列表失败',\n result: err,\n total: 0\n });\n }\n });\n \n});\n\n\nemitter.emit('setCondition');\n\nemitter.emit('getTotal');\n",
- "inParams": [
- "搜索条件",
- "当前页码",
- "每页大小"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {}
- }
- },
- {
- "id": "service_HEyriYsYDd",
- "name": "兑换码编辑服务",
- "type": "service",
- "props": {
- "devId": "service_HEyriYsYDd",
- "isOpen": false,
- "jsCode": "// 编辑服务\nconst emitter = new events.EventEmitter();\n\nif (param.hasOwnProperty('行ID') && param['行ID'] > 0) {\n emitter.emit('edit');\n} else {\n emitter.emit('noId'); \n return;\n}\n\nemitter.on('noId', () => {\n _funcCb({code: 0, errMsg: '请传入行ID', result: {}});\n});\n\nemitter.on('edit', () => {\n \n let condition = {};\n condition['_id'] = param.行ID;\n \n let updateObj = {};\n \n if(param.hasOwnProperty('兑换码')) {\n updateObj['兑换码'] = param.兑换码; \n }\n \n if(param.hasOwnProperty('兑换状态')) {\n updateObj['兑换状态'] = param.兑换状态; \n }\n \n if(param.hasOwnProperty('批次ID')) {\n updateObj['批次ID'] = param.批次ID; \n }\n \n if(param.hasOwnProperty('兑换结果')) {\n updateObj['兑换结果'] = param.兑换结果; \n }\n \n _F('dbTableTemp_cryyss64wp').callMethod('editRow', {\n row: updateObj,\n condition,\n success: () => {\n _funcCb({code: 200, errMsg: '编辑成功', result: {}});\n },\n fail: (err) => {\n // 编辑失败\n _funcCb({code: 0, errMsg: '编辑失败', result: err});\n }\n });\n \n});\n\nemitter.emit('edit');\n",
- "inParams": [
- "兑换码",
- "兑换状态",
- "批次ID",
- "兑换结果"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "批次ID": "",
- "兑换码": "",
- "兑换状态": "",
- "兑换结果": ""
- }
- }
- },
- {
- "id": "service_8BYpSxRD3x",
- "name": "兑换码新增服务",
- "type": "service",
- "props": {
- "devId": "service_8BYpSxRD3x",
- "isOpen": false,
- "jsCode": "// 新增服务\nconst emitter = new events.EventEmitter();\n\nemitter.on('add', () => {\n \n let insertObj = {\n 兑换码:param.兑换码, \n 兑换状态:0, \n 批次ID:param.批次ID, \n 兑换结果:param.兑换结果, \n };\n \n _F('dbTableTemp_cryyss64wp').callMethod('addRow', {\n row: insertObj,\n success: () => {\n _funcCb({code: 200, errMsg: '新增成功', result: {}});\n },\n fail: (err) => {\n // 新增失败\n _funcCb({code: 0, errMsg: '新增失败', result: err});\n }\n });\n \n});\n\nemitter.emit('add');\n",
- "inParams": [
- "兑换码",
- "兑换状态",
- "批次ID",
- "兑换结果"
- ],
- "outParams": [],
- "openApiPath": "",
- "inParamsDebug": {
- "批次ID": "",
- "兑换码": "",
- "兑换状态": "",
- "兑换结果": ""
- }
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_NQxscsS2EP",
- "type": "state",
- "children": []
- },
- {
- "id": "services_HNYwNKEH3w",
- "type": "services",
- "children": [
- {
- "id": "group_wxnJzZy4aj",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_wxnJzZy4aj"
- },
- "children": [
- {
- "id": "dbTableTemp_cryyss64wp",
- "name": "兑换码表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_cryyss64wp",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "兑换码",
- "columnType": "varchar(100)"
- },
- {
- "columnName": "兑换状态",
- "columnType": "int"
- },
- {
- "columnName": "批次ID",
- "columnType": "int"
- },
- {
- "columnName": "兑换结果",
- "columnType": "varchar(500)"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbViewTemp_BjKtp3Di7c",
- "name": "兑换码+批次视图",
- "type": "dbViewTemp",
- "props": {}
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "modules_RydscackjD",
- "type": "modules",
- "children": []
- }
- ]
- },
- {
- "id": "module_remk87B6S2",
- "name": "通用后台组件",
- "type": "module",
- "props": {
- "appModuleId": "1003",
- "expandedKeys": [
- "backend_NahAfpsQQ4",
- "services_dwCPAntfce",
- "group_XwdWSEiFX4"
- ],
- "appModuleVersion": 25
- },
- "children": [
- {
- "id": "front_RDjfT7s2G7",
- "type": "front",
- "children": [
- {
- "id": "props_mchDrMtD2Z",
- "type": "props",
- "children": [
- {
- "id": "fPAttr_rP8EJjK7jX",
- "type": "fPAttr",
- "children": []
- },
- {
- "id": "fPMethod_WRGYSxt4Cp",
- "type": "fPMethod",
- "children": []
- },
- {
- "id": "fPEvent_bd3XzQSixC",
- "type": "fPEvent",
- "children": []
- }
- ]
- },
- {
- "id": "state_EbzKKjdwJ2",
- "type": "state",
- "children": []
- },
- {
- "id": "method_Antnkr3Ji4",
- "type": "method",
- "children": []
- },
- {
- "id": "dom_k4b7p3iFXx",
- "type": "dom",
- "children": []
- }
- ]
- },
- {
- "id": "backend_NahAfpsQQ4",
- "type": "backend",
- "children": [
- {
- "id": "props_nezD2bWSix",
- "type": "props",
- "children": [
- {
- "id": "bPAttr_XhZpRRZR87",
- "type": "bPAttr",
- "children": [
- {
- "id": "variable_QcWhAZe56c",
- "name": "数据表字段",
- "type": "variable",
- "props": {
- "memo": "<pre><code class=\"language-javascript\">[\r\n {\r\n \"dataIndex\": \"用户名\",\r\n \"operate\": \"search|filter|add|edit\",\r\n },\r\n {\r\n \"dataIndex\": \"密码\",\r\n \"operate\": \"filter|add|edit\",\r\n },\r\n]</code></pre><pre><code >\r 字段名: `dataIndex`\r\n 字段操作权限(多个以|分隔): `operate` (\r\n `search`: 关键字搜索,\r\n `filter`: 精确匹配,\r\n `add`: 新增,\r\n `edit`: 编辑,\r\n )\r\n 匹配类型:`filterType` (\r\n `between`: 范围\r\n )</code></pre><p><br></p>",
- "devId": "variable_QcWhAZe56c"
- }
- }
- ]
- },
- {
- "id": "bPMethod_eNXrCFdpcQ",
- "type": "bPMethod",
- "children": [
- {
- "id": "service_ZX7EkSNxjR",
- "name": "新增服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const emitter = new events.EventEmitter();\n\nconst 新增操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'add' });\n\nemitter.on('add', () => {\n\n let data = {};\n 新增操作字段.map(field => {\n const defVal = typeof field?.default === 'function' ? field.default() : field?.default;\n data[field.dataIndex] = param[field.dataIndex] === undefined? defVal : param[field.dataIndex]\n })\n\n _F('dbTableTemp_xiMSY5yJNc').callMethod('addRow', {\n row: data,\n success: (res) => {\n // console.log('新增服务结果',{res})\n data._id = res.insertId;\n _funcCb({ code: 200, errMsg: '新增成功',result: data});\n },\n fail: (err) => {\n _funcCb({ code: 0, errMsg: '新增失败',result: err});\n }\n });\n\n});\n\nemitter.emit('add');\n",
- "inParams": [],
- "outParams": []
- }
- },
- {
- "id": "service_SmQXCDGN2Z",
- "name": "编辑服务",
- "type": "service",
- "props": {
- "isOpen": false,
- "isSync": true,
- "jsCode": "const emitter = new events.EventEmitter();\n\nemitter.on('noId', () => {\n _funcCb({ code: 0, errMsg: '请提供行ID' });\n});\n\nconst 编辑条件字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'eKey' });\nconst 编辑操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'edit' });\n\n\nlet condition = {};\n编辑条件字段.map(field => {\n if (param.hasOwnProperty(field.dataIndex)) {\n condition[field.dataIndex] = param[field.dataIndex];\n }\n})\n\nif (Object.keys(condition)?.length === 0) {\n\n if (param.行ID !== undefined) {\n condition = { _id: param.行ID };\n } else {\n emitter.emit('noId');\n return;\n }\n}\n\nemitter.on('edit', () => {\n\n\n\n\n let updateData = {};\n\n 编辑操作字段.map(field => {\n\n if (param.hasOwnProperty(field.dataIndex)) {\n updateData[field.dataIndex] = param[field.dataIndex];\n }\n })\n\n _F('dbTableTemp_xiMSY5yJNc').callMethod('editRow', {\n condition,\n row: updateData,\n success: () => {\n _funcCb({ code: 200, errMsg: '修改成功' });\n },\n fail: (err) => {\n _funcCb({ code: 0, errMsg: '修改失败', result: err });\n }\n });\n\n});\n\nemitter.emit('edit');\n",
- "inParams": [
- "行ID"
- ],
- "outParams": []
- }
- },
- {
- "id": "service_HnxkCD6Ys7",
- "name": "搜索服务",
- "type": "service",
- "props": {
- "isOpen": false,
- "isSync": true,
- "jsCode": "\nconst emitter = new events.EventEmitter();\n\nlet pageNum = 1;\nlet pageSize = 10;\nlet condition = {};\n\nif (param.当前页码) {\n pageNum = param.当前页码;\n}\n\nif (param.每页大小) {\n pageSize = param.每页大小;\n}\n\nconst 筛选操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'filter' });\nconst 搜索操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'search' });\nconst 总和操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'sum' });\nconst 总数操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'count' });\n\n\nif (param.搜索条件 !== undefined && Object.keys(param.搜索条件).length) {\n\n let 搜索条件 = param.搜索条件;\n condition['and'] = [];\n\n if (搜索条件.关键字 && 搜索操作字段?.length > 0) {\n // condition['通道参数'] = ['like', `%${搜索条件.关键字}%`];\n let search = {\n 'or': []\n };\n 搜索操作字段.map(field => {\n search['or'].push({\n [field.dataIndex] : ['like', `%${搜索条件.关键字}%`]\n });\n })\n condition['and'].push(search);\n }\n\n if (筛选操作字段?.length > 0) {\n let filter = {\n 'and': []\n };\n 筛选操作字段.map(field => {\n\n if (搜索条件[field.dataIndex] !== undefined) {\n if (Array.isArray(搜索条件[field.dataIndex])) {\n if (field?.filterType === 'between' && 搜索条件[field.dataIndex]?.length === 2) {\n\n filter.and.push({\n 'and': [\n { [field.dataIndex]: ['>=', 搜索条件[field.dataIndex][0]] },\n { [field.dataIndex]: ['<=', 搜索条件[field.dataIndex][1]] }\n ]\n })\n } else {\n filter.and.push({\n [field.dataIndex]: ['in', 搜索条件[field.dataIndex]]\n })\n }\n } else {\n filter.and.push({\n [field.dataIndex]: 搜索条件[field.dataIndex]\n })\n }\n\n }\n })\n if(filter.and?.length > 0)\n condition['and'].push(filter);\n }\n\n if(condition['and']?.length === 1){\n condition = condition['and'][0];\n }\n\n}\n\nif (param.固定条件 !== undefined && Object.keys(param.固定条件).length) {\n\n let 固定条件 = param.固定条件;\n if(condition?.and){\n condition['and'].push(固定条件);\n }else{\n condition = {\n ...condition,\n 固定条件\n }\n }\n \n}\n\nlet total = 0;\nlet list = [];\nlet tongji = {};\n\nemitter.on('output', () => {\n\n let result = {\n code: 200,\n errMsg: 'ok',\n result: list,\n total: total,\n tongji: tongji,\n // condition\n };\n\n _funcCb(result);\n\n});\n\nemitter.on('error', (error) => {\n\n let result = {\n code: 0,\n errMsg: '查询失败',\n result: error\n };\n\n _funcCb(result);\n\n});\n\nemitter.on('getCount', (field) => {\n\n _F('dbViewTemp_wfrWwAbZJe').callMethod('getCount', {\n condition,\n field,\n success: (res) => {\n tongji[field] = res[0].count;\n },\n fail: (error) => {\n\n emitter.emit('output', error);\n }\n });\n\n});\n\nemitter.on('getSum', (field) => {\n\n _F('dbViewTemp_wfrWwAbZJe').callMethod('getSum', {\n condition,\n field,\n success: (res) => {\n const result = res[0] || {};\n Object.keys(result).map(field => tongji[field] = result[field]);\n\n },\n fail: (error) => {\n\n emitter.emit('output', error);\n }\n });\n\n});\n\nemitter.on('getTotal', () => {\n\n _F('dbViewTemp_wfrWwAbZJe').callMethod('getCount', {\n condition,\n success: (res) => {\n total = res[0].count;\n emitter.emit('getList');\n },\n fail: (error) => {\n emitter.emit('output', error);\n }\n });\n\n});\n\nemitter.on('getList', () => {\n\n _F('dbViewTemp_wfrWwAbZJe').callMethod('getRows', {\n condition,\n pageNum,\n pageSize,\n orderby: '_update',\n sort: 'desc',\n success: (res) => {\n list = res;\n emitter.emit('output');\n },\n fail: (error) => {\n\n emitter.emit('output', error);\n }\n });\n\n});\n\nif (param?.统计字段?.length) {\n\n let 统计字段 = param.统计字段;\n\n\n let 总和字段 = 统计字段?.filter(field => 总和操作字段?.find(opField => opField.dataIndex === field)) || [];\n let 总数字段 = 统计字段?.filter(field => 总数操作字段?.find(opField => opField.dataIndex === field)) || [];\n\n if (总数字段?.length > 0)\n 总数字段?.map(field => emitter.emit('getCount', field))\n\n if (总和字段?.length > 0)\n emitter.emit('getSum', 总和字段);\n}\n\n\n\nemitter.emit('getTotal');\n",
- "inParams": [
- {
- "name": "当前页码",
- "default": null
- },
- {
- "name": "每页大小",
- "default": null
- },
- {
- "name": "搜索条件",
- "default": null
- },
- {
- "name": "固定条件"
- }
- ],
- "outParams": [],
- "inParamsDebug": null
- }
- },
- {
- "id": "service_ERbTR6esDz",
- "name": "逻辑删除服务",
- "type": "service",
- "props": {
- "isOpen": false,
- "jsCode": "\nconst emitter = new events.EventEmitter();\n\nif(param.hasOwnProperty('行ID')) {\n emitter.emit('delete');\n} else {\n emitter.emit('noId');\n}\n\nemitter.on('noId', () => {\n _funcCb({code: 0, errMsg: '请提供行ID'});\n});\n\nemitter.on('delete', () => {\n\n let condition = {_id: param.行ID};\n let updateData = {\n 是否删除: 1\n };\n\n _F('dbTableTemp_xiMSY5yJNc').callMethod('editRow', {\n condition,\n row: updateData,\n success: () => {\n _funcCb({code: 200, errMsg:'删除成功'});\n },\n fail: (err) => {\n _funcCb({ code: 0, errMsg: '删除失败',result: err});\n }\n });\n\n});\n\nemitter.emit('delete');\n",
- "inParams": [
- "行ID"
- ],
- "outParams": []
- }
- },
- {
- "id": "service_Fz8RK7rnPj",
- "name": "批量新增服务",
- "type": "service",
- "props": {
- "isSync": true,
- "jsCode": "const emitter = new events.EventEmitter();\n\nconst 行数组 = param.行数组 || [];\n\nconst 新增操作字段 = await _F('service_S6zwFPhEp5').call({ 操作: 'add' });\n\nemitter.on('add', () => {\n\n const rows = [];\n 行数组.map((row) => {\n let data = {};\n 新增操作字段.map(field => {\n const defVal = typeof field?.default === 'function' ? field.default() : field?.default;\n data[field.dataIndex] = row[field.dataIndex] || defVal\n })\n rows.push(data)\n })\n\n\n _F('dbTableTemp_xiMSY5yJNc').callMethod('addRows', {\n rows,\n success: () => {\n _funcCb({ code: 200, errMsg: '新增成功', result: {} });\n },\n fail: (err) => {\n _funcCb({ code: 0, errMsg: '新增失败', result: err });\n }\n });\n\n});\n\nemitter.emit('add');\n",
- "inParams": [
- {
- "name": "行数组",
- "default": null
- }
- ],
- "outParams": []
- }
- }
- ]
- }
- ]
- },
- {
- "id": "state_chH5de2tQB",
- "type": "state",
- "children": []
- },
- {
- "id": "services_dwCPAntfce",
- "type": "services",
- "children": [
- {
- "id": "group_r3zcZErBYX",
- "name": "内部方法",
- "type": "group",
- "props": {},
- "children": [
- {
- "id": "service_S6zwFPhEp5",
- "name": "字段配置处理",
- "type": "service",
- "props": {
- "jsCode": "let 数据表字段 = _F('variable_QcWhAZe56c').callMethod('get') || [];\nconst 操作 = param.操作;\n\n数据表字段 = 数据表字段.filter(item => item?.operate.split('|').includes(操作));\n\n_funcCb(数据表字段);",
- "inParams": [
- {
- "name": "操作",
- "default": null
- }
- ]
- }
- }
- ]
- },
- {
- "id": "group_XwdWSEiFX4",
- "name": "数据表",
- "type": "group",
- "props": {
- "devId": "group_XwdWSEiFX4"
- },
- "children": [
- {
- "id": "dbTableTemp_xiMSY5yJNc",
- "name": "数据表",
- "type": "dbTableTemp",
- "props": {
- "devId": "dbTableTemp_xiMSY5yJNc",
- "fields": [
- {
- "columnName": "_id",
- "columnType": "int unsigned"
- },
- {
- "columnName": "是否删除",
- "columnType": "int"
- },
- {
- "columnName": "_create",
- "columnType": "bigint unsigned"
- },
- {
- "columnName": "_update",
- "columnType": "bigint unsigned"
- }
- ]
- }
- },
- {
- "id": "dbViewTemp_wfrWwAbZJe",
- "name": "视图",
- "type": "dbViewTemp",
- "props": {}
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id": "modules_Q43pJDCHSZ",
- "type": "modules",
- "children": []
- }
- ],
- "appModuleVersion": 25
- }
- ]
- }
- ]
|