├── LICENSE ├── README.md ├── ddxp.js ├── ddxpMitm.json ├── ddxpTask.json ├── ddxpautoeval.js ├── ddxpcouponsjm.js ├── ddxpgetsale.js ├── ddxpsign.js ├── ddxptime.js ├── ddxpxd.js ├── img.jpg ├── img0.jpg ├── img1.jpg └── img2.jpg /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 叮咚买菜自动领取脚本 2 | 我的已经黑了各位自重. 3 | 4 | 建议手动抓包. 5 | anyproxy我抓取不到相关连接,QX可以自测看看是否能抓到. 6 | 手动抓包签到后搜索关键词"https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=*&app_client_id=*&station_id=*&native_version=*&app_version=*&uid=*&latitude=*&longitude=*&gameId=*&taskCode=* ",将整段url存在变量ddxpurl中 7 | 整串连接应该是类似于"/task/achieve?&station_id=*&uid=*&latitude=*&longitude=*",这几个参数是关键 8 | 然后同个连接下的ck存在ddxphd中就能跑脚本了. 9 | 翻牌默认十次全翻完(基本是赚的),不想翻完的可以通过ddxpffl设置次数 10 | 多账号的用@分割,或者去脚本中修改变量即可 11 | 自动浇水需要设置ddxpjs为true,自动喂鱼需要设置ddxpwy为ture,默认不浇水喂鱼. 12 | PS:抢券需要自己修改定时"task justplayscript_ddxp_ddxpcouponsjm.js now"(青龙有延迟,我不会写标头 13 | -------------------------------------------------------------------------------- /ddxp.js: -------------------------------------------------------------------------------- 1 | /* 2 | app叮咚买菜 3 | ck获取:打开app,翻翻乐玩一次,领取即可 4 | 每个脚本需要单独抓包,有冲突 5 | [MITM] 6 | hostname = farm.api.ddxq.mobi 7 | [task_local] 8 | 10 0 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxp.js, tag=叮咚买菜签到, enabled=true 9 | [rewrite_local] 10 | https://farm.api.ddxq.mobi/api/v2/task/achieve url script-request-header https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxp.js 11 | */ 12 | 13 | const $ = new Env('叮咚整合签到'); 14 | const dr = "@" 15 | let ddxpurlArr = [], 16 | ddxphdArr = [], 17 | ddxpcount = '' 18 | let time = Math.round(Date.now() / 1000) 19 | let ddxpurl = $.getdata('ddxpurl') 20 | let ddxphd = $.getdata('ddxphd') 21 | let fflNum = +($.getval('ddxpffl') || "10") 22 | !(async () => { 23 | if (typeof $request !== "undefined") { 24 | await ddxpck() 25 | } else { 26 | ddxpurlArr = ($.getdata('ddxpurl') || "").split(dr) 27 | ddxphdArr = ($.getdata('ddxphd') || "").split(dr) 28 | 29 | console.log(`------------- 共${ddxphdArr.length}个账号-------------\n`) 30 | for (let i = 0; i < ddxphdArr.length; i++) { 31 | if (ddxphdArr[i]) { 32 | getUrl(ddxpurlArr[i]) 33 | ddxphd = ddxphdArr[i]; 34 | 35 | $.index = i + 1; 36 | console.log(`\n开始【叮咚浇水${$.index}】`) 37 | await $.wait(10000); 38 | await ddxpyt1(); 39 | await $.wait(10000); 40 | await ddxpyt2(); 41 | await $.wait(10000); 42 | for (let j = 0; j < fflNum; j++) { 43 | await ddxffl(); 44 | await $.wait(10000); 45 | } 46 | await $.wait(50000); 47 | await ddxlook(); 48 | await $.wait(50000); 49 | await ddxlook2(); 50 | await $.wait(10000); 51 | await ddxTaskLog(); 52 | await $.wait(10000); 53 | await ddxfflget() 54 | await $.wait(10000); 55 | await ddxlookend(); 56 | await $.wait(10000); 57 | await ddxlookend2(); 58 | await $.wait(10000); 59 | await ddxpgettask(); 60 | await $.wait(10000); 61 | await ddxgyqd1(); 62 | await $.wait(10000); 63 | await ddxgyqd2(); 64 | await $.wait(50000); 65 | await ddxgylook(); 66 | await $.wait(10000); 67 | await ddxgylookend(); 68 | } 69 | } 70 | } 71 | })() 72 | .catch((e) => $.logErr(e)) 73 | .finally(() => $.done()) 74 | 75 | //抓包ck 76 | function ddxpck() { 77 | if ($request.url.indexOf("task/achieve?") > -1) { 78 | if ($request.url.indexOf("&uid=") > -1) { 79 | const ddxpurl = $request.url 80 | if (ddxpurl) { 81 | let v = $.getdata(`ddxpurl`) || "" 82 | if (v == "") 83 | v = ddxpurl 84 | else 85 | v += dr + ddxpurl 86 | $.setdata(v, `ddxpurl`) 87 | } 88 | $.log(ddxpurl) 89 | const ddxphd = $request.headers.cookie 90 | if (ddxphd) { 91 | let v = $.getdata(`ddxphd`) || "" 92 | if (v == "") 93 | v = ddxphd 94 | else 95 | v += dr + ddxphd 96 | $.setdata(v, `ddxphd`) 97 | } 98 | $.log(ddxphd) 99 | $.msg($.name, "", `叮咚ck获取成功`) 100 | } 101 | } 102 | } 103 | 104 | /** 105 | * 共用header 106 | */ 107 | function pubHeader() { 108 | return { 109 | 'accept': '*/*', 110 | 'cookie': ddxphd, 111 | 'accept-language': 'zh-cn', 112 | 'user-agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.35.1 station_id/${station_id}`, 113 | 'accept-encoding': 'gzip, deflate, br' 114 | } 115 | } 116 | 117 | uid = "" 118 | latitude = "" 119 | longitude = "" 120 | station_id = "" 121 | userTaskLogId = "" 122 | userTasks = [] 123 | 124 | function getUrl(ddxpurl) { 125 | let url = ddxpurl.split("?") 126 | let ddxpurls = url[url.length - 1].split("&") 127 | let sendInfo = {} 128 | for (const val of ddxpurls) { 129 | let vals = val.split("&") 130 | for (const val1 of vals) { 131 | let kv = val1.split("=") 132 | sendInfo[kv[0]] = kv[1] 133 | } 134 | } 135 | uid = sendInfo["uid"] 136 | latitude = sendInfo["latitude"] 137 | longitude = sendInfo["longitude"] 138 | station_id = sendInfo["station_id"] 139 | } 140 | 141 | //鱼塘签到1 142 | function ddxpyt1(timeout = 0) { 143 | return new Promise((resolve) => { 144 | let header = pubHeader() 145 | header["origin"] = "https://game.m.ddxq.mobi" 146 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 147 | let url = { 148 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&taskCode=CONTINUOUS_SIGN`, 149 | headers: header, 150 | } 151 | 152 | $.get(url, async (err, resp, data) => { 153 | try { 154 | const result = JSON.parse(data) 155 | if (result.code == 0) { 156 | console.log('\n鱼塘签到1: ' + result.msg) 157 | } else { 158 | console.log(result) 159 | } 160 | } catch (e) { 161 | //$.logErr(e, resp); 162 | } finally { 163 | resolve() 164 | } 165 | }, timeout) 166 | }) 167 | } 168 | 169 | //鱼塘签到2 170 | function ddxpyt2(timeout = 0) { 171 | return new Promise((resolve) => { 172 | let header = pubHeader() 173 | header["origin"] = "https://game.m.ddxq.mobi" 174 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 175 | let url = { 176 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&taskCode=DAILY_SIGN`, 177 | headers: header, 178 | } 179 | 180 | $.get(url, async (err, resp, data) => { 181 | try { 182 | const result = JSON.parse(data) 183 | if (result.code == 0) { 184 | console.log('\n鱼塘签到2: ' + result.msg) 185 | } else { 186 | console.log(result) 187 | } 188 | } catch (e) { 189 | //$.logErr(e, resp); 190 | } finally { 191 | resolve() 192 | } 193 | }, timeout) 194 | }) 195 | } 196 | 197 | //鱼塘翻牌 198 | function ddxffl(timeout = 0) { 199 | return new Promise((resolve) => { 200 | let header = pubHeader() 201 | header["origin"] = "https://activity.m.ddxq.mobi" 202 | header["Connection"] = "keep-alive" 203 | header["referer"] = 'https://activity.m.ddxq.mobi/' 204 | header["DDMC-GAME-TID"] = '1' 205 | let url = { 206 | url: `https://farm.api.ddxq.mobi/api/v2/lucky-draw-activity/draw?api_version=9.7.3&app_version=1.0.0&app_client_id=3&station_id=${station_id}&native_version=9.35.1&city_number=1103&latitude=${latitude}&longitude=${longitude}&gameId=1`, 207 | headers: header, 208 | } 209 | 210 | $.get(url, async (err, resp, data) => { 211 | try { 212 | const result = JSON.parse(data) 213 | if (result.code == 0) { 214 | console.log('\n鱼塘翻牌: ' + result.data.chosen.rewardText) 215 | } else { 216 | console.log(result) 217 | } 218 | } catch (e) { 219 | //$.logErr(e, resp); 220 | } finally { 221 | resolve() 222 | } 223 | }, timeout) 224 | }) 225 | } 226 | 227 | //获取所有TaskLog 228 | function ddxTaskLog(timeout = 0) { 229 | userTaskLogId = "" 230 | return new Promise((resolve) => { 231 | let header = pubHeader() 232 | header["origin"] = "https://game.m.ddxq.mobi" 233 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 234 | let url = { 235 | url: `https://farm.api.ddxq.mobi/api/v2/task/list?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&cityCode=1103`, 236 | headers: header, 237 | } 238 | 239 | $.get(url, async (err, resp, data) => { 240 | try { 241 | const result = JSON.parse(data) 242 | if (result.code == 0) { 243 | console.log('\n鱼塘任务列表: ' + result.msg) 244 | userTasks = result.data.userTasks 245 | } else { 246 | console.log(result) 247 | } 248 | } catch (e) { 249 | //$.logErr(e, resp); 250 | } finally { 251 | resolve() 252 | } 253 | }, timeout) 254 | }) 255 | } 256 | 257 | //鱼塘翻翻乐后领取 258 | function ddxfflget(timeout = 0) { 259 | userTaskLogId = "" 260 | if (userTasks != null) { 261 | for (const task of userTasks) { 262 | //翻牌 263 | if (task.taskCode == "LUCK_DRAW") { 264 | userTaskLogId = task.userTaskLogId 265 | } 266 | } 267 | } 268 | return new Promise((resolve) => { 269 | let header = pubHeader() 270 | header["origin"] = "https://game.m.ddxq.mobi" 271 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 272 | let url = { 273 | url: `https://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&userTaskLogId=${userTaskLogId}`, 274 | headers: header, 275 | } 276 | 277 | $.get(url, async (err, resp, data) => { 278 | try { 279 | const result = JSON.parse(data) 280 | if (result.code == 0) { 281 | console.log('\n鱼塘翻翻乐领取: ' + result.msg) 282 | } else { 283 | console.log(result) 284 | } 285 | } catch (e) { 286 | //$.logErr(e, resp); 287 | } finally { 288 | resolve() 289 | } 290 | }, timeout) 291 | }) 292 | } 293 | 294 | //鱼塘观看商品 295 | function ddxlook(timeout = 0) { 296 | userTaskLogId = "" 297 | return new Promise((resolve) => { 298 | let header = pubHeader() 299 | header["origin"] = "https://cms.api.ddxq.mobi" 300 | header["ddmc-game-tid"] = "1" 301 | header["referer"] = `https://cms.api.ddxq.mobi/cms-service/client/page/v1/getPageInfo?uuid=${uid}&themeColor=72b1ff&hideShare=true&gameTask=BROWSE_GOODS&s=mine_farm_new&native_city_number=1103` 302 | let url = { 303 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?latitude=${latitude}&longitude=${longitude}&env=PE&station_id=${station_id}&city_number=1103&api_version=9.28.0&app_client_id=3&native_version=9.35.1&h5_source=&page_type=2&gameId=1&taskCode=BROWSE_GOODS`, 304 | headers: header, 305 | } 306 | 307 | $.get(url, async (err, resp, data) => { 308 | try { 309 | const result = JSON.parse(data) 310 | if (result.code == 0) { 311 | console.log('\n鱼塘浏览30秒: ' + result.msg) 312 | if (result.data) userTaskLogId = result.data.userTaskLogId 313 | console.log('\nuserTaskLogId: ' + userTaskLogId) 314 | } else { 315 | console.log(result) 316 | } 317 | } catch (e) { 318 | //$.logErr(e, resp); 319 | } finally { 320 | resolve() 321 | } 322 | }, timeout) 323 | }) 324 | } 325 | 326 | //鱼塘观看商品领取 327 | function ddxlookend(timeout = 0) { 328 | userTaskLogId = "" 329 | if (userTasks != null) { 330 | for (const task of userTasks) { 331 | if (task.taskCode == "BROWSE_GOODS") { 332 | userTaskLogId = task.userTaskLogId 333 | } 334 | } 335 | } 336 | return new Promise((resolve) => { 337 | let header = pubHeader() 338 | header["origin"] = "https://cms.api.ddxq.mobi" 339 | header["ddmc-game-tid"] = "1" 340 | header["referer"] = `https://cms.api.ddxq.mobi/cms-service/client/page/v1/getPageInfo?uuid=${uid}&themeColor=72b1ff&hideShare=true&gameTask=BROWSE_GOODS&s=mine_farm_new&native_city_number=1103` 341 | let url = { 342 | url: `https://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&userTaskLogId=${userTaskLogId}`, 343 | headers: header, 344 | } 345 | 346 | $.get(url, async (err, resp, data) => { 347 | try { 348 | const result = JSON.parse(data) 349 | if (result.code == 0) { 350 | console.log('\n鱼塘浏览30秒: ' + result.msg) 351 | } else { 352 | console.log(result) 353 | } 354 | } catch (e) { 355 | //$.logErr(e, resp); 356 | } finally { 357 | resolve() 358 | } 359 | }, timeout) 360 | }) 361 | } 362 | 363 | //鱼塘观看商品 364 | function ddxlook2(timeout = 0) { 365 | userTaskLogId = "" 366 | return new Promise((resolve) => { 367 | let header = pubHeader() 368 | header["origin"] = "https://cms.api.ddxq.mobi" 369 | header["ddmc-game-tid"] = "1" 370 | header["referer"] = `https://cms.api.ddxq.mobi/cms-service/client/page/v1/getPageInfo?uuid=${uid}&themeColor=72b1ff&hideShare=true&gameTask=BROWSE_GOODS2S&s=mine_farm_new&native_city_number=1103` 371 | let url = { 372 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?latitude=${latitude}&longitude=${longitude}&env=PE&station_id=${station_id}&city_number=1103&api_version=9.28.0&app_client_id=3&native_version=9.35.1&h5_source=&page_type=2&gameId=1&taskCode=BROWSE_GOODS2`, 373 | headers: header, 374 | } 375 | 376 | $.get(url, async (err, resp, data) => { 377 | try { 378 | const result = JSON.parse(data) 379 | if (result.code == 0) { 380 | console.log('\n鱼塘浏览30秒: ' + result.msg) 381 | if (result.data) userTaskLogId = result.data.userTaskLogId 382 | console.log('\nuserTaskLogId: ' + userTaskLogId) 383 | } else { 384 | console.log(result) 385 | } 386 | } catch (e) { 387 | //$.logErr(e, resp); 388 | } finally { 389 | resolve() 390 | } 391 | }, timeout) 392 | }) 393 | } 394 | 395 | //鱼塘观看商品领取 396 | function ddxlookend2(timeout = 0) { 397 | userTaskLogId = "" 398 | if (userTasks != null) { 399 | for (const task of userTasks) { 400 | if (task.taskCode == "BROWSE_GOODS2") { 401 | userTaskLogId = task.userTaskLogId 402 | } 403 | } 404 | } 405 | return new Promise((resolve) => { 406 | let header = pubHeader() 407 | header["origin"] = "https://game.m.ddxq.mobi" 408 | header["ddmc-game-tid"] = "1" 409 | header["referer"] = `https://game.m.ddxq.mobi/index.html` 410 | let url = { 411 | url: `https://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.3&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&userTaskLogId=${userTaskLogId}`, 412 | headers: header, 413 | } 414 | 415 | $.get(url, async (err, resp, data) => { 416 | try { 417 | const result = JSON.parse(data) 418 | if (result.code == 0) { 419 | console.log('\n鱼塘浏览拼团活动得饲料: ' + result.msg) 420 | } else { 421 | console.log(result) 422 | } 423 | } catch (e) { 424 | //$.logErr(e, resp); 425 | } finally { 426 | resolve() 427 | } 428 | }, timeout) 429 | }) 430 | } 431 | 432 | //领取鱼塘下单任务 433 | function ddxpgettask(timeout = 0) { 434 | return new Promise((resolve) => { 435 | let header = pubHeader() 436 | header["origin"] = "https://game.m.ddxq.mobi" 437 | header["referer"] = `https://game.m.ddxq.mobi/index.html` 438 | let url = { 439 | url: `https://farm.api.ddxq.mobi/api/v2/task/receive?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.37.0&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&taskCode=ANY_ORDER`, 440 | headers: header, 441 | } 442 | 443 | $.get(url, async (err, resp, data) => { 444 | try { 445 | const result = JSON.parse(data) 446 | if (result.code == 0) { 447 | console.log('\n领取下单任务: ' + result.msg) 448 | } else { 449 | console.log(result) 450 | } 451 | } catch (e) { 452 | //$.logErr(e, resp); 453 | } finally { 454 | resolve() 455 | } 456 | }, timeout) 457 | }) 458 | } 459 | 460 | //果园签到1 461 | function ddxgyqd1(timeout = 0) { 462 | return new Promise((resolve) => { 463 | let header = pubHeader() 464 | header["host"] = "farm.api.ddxq.mobi" 465 | header["origin"] = "https://orchard-m.ddxq.mobi" 466 | header["connection"] = "keep-alive" 467 | header["ddmc-game-tid"] = "2" 468 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 469 | let url = { 470 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&taskCode=CONTINUOUS_SIGN`, 471 | headers: header, 472 | } 473 | 474 | $.get(url, async (err, resp, data) => { 475 | try { 476 | const result = JSON.parse(data) 477 | if (result.code == 0) { 478 | console.log('\n果园签到1: ' + result.msg) 479 | } else { 480 | console.log(result) 481 | } 482 | } catch (e) { 483 | //$.logErr(e, resp); 484 | } finally { 485 | resolve() 486 | } 487 | }, timeout) 488 | }) 489 | } 490 | 491 | //果园签到2 492 | function ddxgyqd2(timeout = 0) { 493 | return new Promise((resolve) => { 494 | let header = pubHeader() 495 | header["host"] = "farm.api.ddxq.mobi" 496 | header["origin"] = "https://orchard-m.ddxq.mobi" 497 | header["connection"] = "keep-alive" 498 | header["DDMC-GAME-TID"] = "2" 499 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 500 | let url = { 501 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&taskCode=DAILY_SIGN`, 502 | headers: header, 503 | } 504 | 505 | $.get(url, async (err, resp, data) => { 506 | try { 507 | const result = JSON.parse(data) 508 | if (result.code == 0) { 509 | console.log('\n果园签到2: ' + result.msg) 510 | } else { 511 | console.log(result) 512 | } 513 | } catch (e) { 514 | //$.logErr(e, resp); 515 | } finally { 516 | resolve() 517 | } 518 | }, timeout) 519 | }) 520 | } 521 | 522 | //果园观看商品 523 | function ddxgylook(timeout = 0) { 524 | userTaskLogId = "" 525 | return new Promise((resolve) => { 526 | let header = pubHeader() 527 | header["host"] = "farm.api.ddxq.mobi" 528 | header["origin"] = "https://cms.api.ddxq.mobi" 529 | header["DDMC-GAME-TID"] = "2" 530 | header["referer"] = `https://cms.api.ddxq.mobi/cms-service/client/page/v1/getPageInfo?uuid=${uid}&themeColor=e7fbd6&hideShare=true&gameTask=BROWSE_GOODS&s=mine_orchard&native_city_number=1103` 531 | let url = { 532 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?latitude=${latitude}&longitude=${longitude}&env=PE&station_id=${station_id}&city_number=1103&api_version=9.28.0&app_client_id=3&native_version=9.35.1&h5_source=&page_type=2&gameId=2&taskCode=BROWSE_GOODS&`, 533 | headers: header, 534 | } 535 | 536 | $.get(url, async (err, resp, data) => { 537 | try { 538 | const result = JSON.parse(data) 539 | if (result.code == 0) { 540 | console.log('\n果园观看商品: ' + result.msg) 541 | if (result.data) userTaskLogId = result.data.userTaskLogId 542 | console.log('\nuserTaskLogId: ' + userTaskLogId) 543 | } else { 544 | console.log(result) 545 | } 546 | } catch (e) { 547 | //$.logErr(e, resp); 548 | } finally { 549 | resolve() 550 | } 551 | }, timeout) 552 | }) 553 | } 554 | 555 | //果园观看商品后领取 556 | function ddxgylookend(timeout = 0) { 557 | return new Promise((resolve) => { 558 | let header = pubHeader() 559 | header["host"] = "farm.api.ddxq.mobi" 560 | header["origin"] = "https://orchard-m.ddxq.mobi" 561 | header["Connection"] = "keep-alive" 562 | header["DDMC-GAME-TID"] = "2" 563 | header["Referer"] = `https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard` 564 | let url = { 565 | url: `https://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&userTaskLogId=${userTaskLogId}`, 566 | headers: header, 567 | } 568 | 569 | $.get(url, async (err, resp, data) => { 570 | try { 571 | const result = JSON.parse(data) 572 | if (result.code == 0) { 573 | console.log('\n果园观看商品后领取: ' + result.msg) 574 | } else { 575 | console.log(result) 576 | } 577 | } catch (e) { 578 | //$.logErr(e, resp); 579 | } finally { 580 | resolve() 581 | } 582 | }, timeout) 583 | }) 584 | } 585 | 586 | function Env(t, e) { 587 | class s { 588 | constructor(t) { 589 | this.env = t 590 | } 591 | 592 | send(t, e = "GET") { 593 | t = "string" == typeof t ? { 594 | url: t 595 | } : t; 596 | let s = this.get; 597 | return "POST" === e && (s = this.post), new Promise((e, i) => { 598 | s.call(this, t, (t, s, r) => { 599 | t ? i(t) : e(s) 600 | }) 601 | }) 602 | } 603 | 604 | get(t) { 605 | return this.send.call(this.env, t) 606 | } 607 | 608 | post(t) { 609 | return this.send.call(this.env, t, "POST") 610 | } 611 | } 612 | 613 | return new class { 614 | constructor(t, e) { 615 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) 616 | } 617 | 618 | isNode() { 619 | return "undefined" != typeof module && !!module.exports 620 | } 621 | 622 | isQuanX() { 623 | return "undefined" != typeof $task 624 | } 625 | 626 | isSurge() { 627 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 628 | } 629 | 630 | isLoon() { 631 | return "undefined" != typeof $loon 632 | } 633 | 634 | toObj(t, e = null) { 635 | try { 636 | return JSON.parse(t) 637 | } catch { 638 | return e 639 | } 640 | } 641 | 642 | toStr(t, e = null) { 643 | try { 644 | return JSON.stringify(t) 645 | } catch { 646 | return e 647 | } 648 | } 649 | 650 | getjson(t, e) { 651 | let s = e; 652 | const i = this.getdata(t); 653 | if (i) try { 654 | s = JSON.parse(this.getdata(t)) 655 | } catch { 656 | } 657 | return s 658 | } 659 | 660 | setjson(t, e) { 661 | try { 662 | return this.setdata(JSON.stringify(t), e) 663 | } catch { 664 | return !1 665 | } 666 | } 667 | 668 | getScript(t) { 669 | return new Promise(e => { 670 | this.get({ 671 | url: t 672 | }, (t, s, i) => e(i)) 673 | }) 674 | } 675 | 676 | runScript(t, e) { 677 | return new Promise(s => { 678 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 679 | i = i ? i.replace(/\n/g, "").trim() : i; 680 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 681 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; 682 | const [o, h] = i.split("@"), a = { 683 | url: `http://${h}/v1/scripting/evaluate`, 684 | body: { 685 | script_text: t, 686 | mock_type: "cron", 687 | timeout: r 688 | }, 689 | headers: { 690 | "X-Key": o, 691 | Accept: "*/*" 692 | } 693 | }; 694 | this.post(a, (t, e, i) => s(i)) 695 | }).catch(t => this.logErr(t)) 696 | } 697 | 698 | loaddata() { 699 | if (!this.isNode()) return {}; 700 | { 701 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 702 | const t = this.path.resolve(this.dataFile), 703 | e = this.path.resolve(process.cwd(), this.dataFile), 704 | s = this.fs.existsSync(t), 705 | i = !s && this.fs.existsSync(e); 706 | if (!s && !i) return {}; 707 | { 708 | const i = s ? t : e; 709 | try { 710 | return JSON.parse(this.fs.readFileSync(i)) 711 | } catch (t) { 712 | return {} 713 | } 714 | } 715 | } 716 | } 717 | 718 | writedata() { 719 | if (this.isNode()) { 720 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 721 | const t = this.path.resolve(this.dataFile), 722 | e = this.path.resolve(process.cwd(), this.dataFile), 723 | s = this.fs.existsSync(t), 724 | i = !s && this.fs.existsSync(e), 725 | r = JSON.stringify(this.data); 726 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 727 | } 728 | } 729 | 730 | lodash_get(t, e, s) { 731 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 732 | let r = t; 733 | for (const t of i) 734 | if (r = Object(r)[t], void 0 === r) return s; 735 | return r 736 | } 737 | 738 | lodash_set(t, e, s) { 739 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) 740 | } 741 | 742 | getdata(t) { 743 | let e = this.getval(t); 744 | if (/^@/.test(t)) { 745 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; 746 | if (r) try { 747 | const t = JSON.parse(r); 748 | e = t ? this.lodash_get(t, i, "") : e 749 | } catch (t) { 750 | e = "" 751 | } 752 | } 753 | return e 754 | } 755 | 756 | setdata(t, e) { 757 | let s = !1; 758 | if (/^@/.test(e)) { 759 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), 760 | h = i ? "null" === o ? null : o || "{}" : "{}"; 761 | try { 762 | const e = JSON.parse(h); 763 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) 764 | } catch (e) { 765 | const o = {}; 766 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) 767 | } 768 | } else s = this.setval(t, e); 769 | return s 770 | } 771 | 772 | getval(t) { 773 | if (this.isNode()) { 774 | return process.env[t] 775 | } else { 776 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null 777 | } 778 | } 779 | 780 | setval(t, e) { 781 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null 782 | } 783 | 784 | initGotEnv(t) { 785 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 786 | } 787 | 788 | get(t, e = (() => { 789 | })) { 790 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 791 | "X-Surge-Skip-Scripting": !1 792 | })), $httpClient.get(t, (t, s, i) => { 793 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 794 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 795 | hints: !1 796 | })), $task.fetch(t).then(t => { 797 | const { 798 | statusCode: s, 799 | statusCode: i, 800 | headers: r, 801 | body: o 802 | } = t; 803 | e(null, { 804 | status: s, 805 | statusCode: i, 806 | headers: r, 807 | body: o 808 | }, o) 809 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 810 | try { 811 | if (t.headers["set-cookie"]) { 812 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 813 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar 814 | } 815 | } catch (t) { 816 | this.logErr(t) 817 | } 818 | }).then(t => { 819 | const { 820 | statusCode: s, 821 | statusCode: i, 822 | headers: r, 823 | body: o 824 | } = t; 825 | e(null, { 826 | status: s, 827 | statusCode: i, 828 | headers: r, 829 | body: o 830 | }, o) 831 | }, t => { 832 | const { 833 | message: s, 834 | response: i 835 | } = t; 836 | e(s, i, i && i.body) 837 | })) 838 | } 839 | 840 | post(t, e = (() => { 841 | })) { 842 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 843 | "X-Surge-Skip-Scripting": !1 844 | })), $httpClient.post(t, (t, s, i) => { 845 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 846 | }); 847 | else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 848 | hints: !1 849 | })), $task.fetch(t).then(t => { 850 | const { 851 | statusCode: s, 852 | statusCode: i, 853 | headers: r, 854 | body: o 855 | } = t; 856 | e(null, { 857 | status: s, 858 | statusCode: i, 859 | headers: r, 860 | body: o 861 | }, o) 862 | }, t => e(t)); 863 | else if (this.isNode()) { 864 | this.initGotEnv(t); 865 | const { 866 | url: s, 867 | ...i 868 | } = t; 869 | this.got.post(s, i).then(t => { 870 | const { 871 | statusCode: s, 872 | statusCode: i, 873 | headers: r, 874 | body: o 875 | } = t; 876 | e(null, { 877 | status: s, 878 | statusCode: i, 879 | headers: r, 880 | body: o 881 | }, o) 882 | }, t => { 883 | const { 884 | message: s, 885 | response: i 886 | } = t; 887 | e(s, i, i && i.body) 888 | }) 889 | } 890 | } 891 | 892 | time(t) { 893 | let e = { 894 | "M+": (new Date).getMonth() + 1, 895 | "d+": (new Date).getDate(), 896 | "H+": (new Date).getHours(), 897 | "m+": (new Date).getMinutes(), 898 | "s+": (new Date).getSeconds(), 899 | "q+": Math.floor(((new Date).getMonth() + 3) / 3), 900 | S: (new Date).getMilliseconds() 901 | }; 902 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); 903 | for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); 904 | return t 905 | } 906 | 907 | msg(e = t, s = "", i = "", r) { 908 | const o = t => { 909 | if (!t) return t; 910 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { 911 | "open-url": t 912 | } : this.isSurge() ? { 913 | url: t 914 | } : void 0; 915 | if ("object" == typeof t) { 916 | if (this.isLoon()) { 917 | let e = t.openUrl || t.url || t["open-url"], 918 | s = t.mediaUrl || t["media-url"]; 919 | return { 920 | openUrl: e, 921 | mediaUrl: s 922 | } 923 | } 924 | if (this.isQuanX()) { 925 | let e = t["open-url"] || t.url || t.openUrl, 926 | s = t["media-url"] || t.mediaUrl; 927 | return { 928 | "open-url": e, 929 | "media-url": s 930 | } 931 | } 932 | if (this.isSurge()) { 933 | let e = t.url || t.openUrl || t["open-url"]; 934 | return { 935 | url: e 936 | } 937 | } 938 | } 939 | }; 940 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); 941 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; 942 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) 943 | } 944 | 945 | log(...t) { 946 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) 947 | } 948 | 949 | logErr(t, e) { 950 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 951 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) 952 | } 953 | 954 | wait(t) { 955 | return new Promise(e => setTimeout(e, t)) 956 | } 957 | 958 | done(t = {}) { 959 | const e = (new Date).getTime(), 960 | s = (e - this.startTime) / 1e3; 961 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 962 | } 963 | }(t, e) 964 | } -------------------------------------------------------------------------------- /ddxpMitm.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "叮咚重写订阅", 3 | "author": "elecV2p", 4 | "mitmhost": [ 5 | "farm.api.ddxq.mobi" 6 | ], 7 | "rewrite": [ 8 | { 9 | "match": "https://farm.api.ddxq.mobi/api/v2/task/achieve?", 10 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxp.js", 11 | "enable": true 12 | }, 13 | { 14 | "match": "https://farm.api.ddxq.mobi/api/v2/task/achieve?", 15 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpgy.js", 16 | "enable": true 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /ddxpTask.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "叮咚买菜自动签到", 3 | "desc": "无", 4 | "date": "2021-9-14 22:40:00", 5 | "resource": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpTask.json", 6 | "list": [ 7 | { 8 | "name": "叮咚整合签到", 9 | "type": "cron", 10 | "time": "10 0 * * *", 11 | "job": { 12 | "type": "runjs", 13 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxp.js" 14 | } 15 | }, 16 | { 17 | "name": "叮咚准点签到", 18 | "type": "cron", 19 | "time": "1 7,10,16 * * *", 20 | "job": { 21 | "type": "runjs", 22 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxptime.js" 23 | } 24 | }, 25 | { 26 | "name": "叮咚下单后自动领取", 27 | "type": "cron", 28 | "time": "55 23 * * *", 29 | "job": { 30 | "type": "runjs", 31 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpxd.js" 32 | } 33 | }, 34 | { 35 | "name": "叮咚每日签到积分", 36 | "type": "cron", 37 | "time": "1 0 * * *", 38 | "job": { 39 | "type": "runjs", 40 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpsign.js" 41 | } 42 | }, 43 | { 44 | "name": "叮咚自动喂鱼浇水", 45 | "type": "cron", 46 | "time": "30 0 * * *", 47 | "job": { 48 | "type": "runjs", 49 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpautoeval.js" 50 | } 51 | }, 52 | { 53 | "name": "叮咚自动抢券", 54 | "type": "cron", 55 | "time": "59 59 23 * * *", 56 | "job": { 57 | "type": "runjs", 58 | "target": "https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpcouponsjm.js" 59 | } 60 | } 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /ddxpautoeval.js: -------------------------------------------------------------------------------- 1 | /* 2 | 叮咚自动喂鱼浇水 3 | [task_local] 4 | 30 23 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpautoeval.js, tag=叮咚自动喂鱼浇水, enabled=true 5 | */ 6 | 7 | const $ = new Env('叮咚自动喂鱼浇水'); 8 | const notify = $.isNode() ? require('./sendNotify') : null; 9 | 10 | const dr = "@" 11 | let ddxpurlArr = [], 12 | ddxphdArr = [], 13 | ddxpcount = '' 14 | let time = Math.round(Date.now() / 1000) 15 | let ddxpurl = $.getdata('ddxpurl') 16 | let ddxphd = $.getdata('ddxphd') 17 | let ddxpwy = $.getdata('ddxpwy') 18 | let ddxpjs = $.getdata('ddxpjs') 19 | !(async () => { 20 | ddxpurlArr = ($.getdata('ddxpurl') || "").split(dr) 21 | ddxphdArr = ($.getdata('ddxphd') || "").split(dr) 22 | 23 | console.log(`------------- 共${ddxphdArr.length}个账号-------------\n`) 24 | for (let i = 0; i < ddxphdArr.length; i++) { 25 | if (ddxphdArr[i]) { 26 | getUrl(ddxpurlArr[i]) 27 | ddxphd = ddxphdArr[i]; 28 | 29 | $.index = i + 1; 30 | console.log(`\n开始【叮咚浇水${$.index}】`) 31 | await ddxTaskLog(); 32 | await $.wait(1000); 33 | await ddxpyt(); 34 | await $.wait(10000); 35 | await ddxpgyGetsy(); 36 | await $.wait(1000); 37 | await ddxpgysf(); 38 | await $.wait(10000); 39 | await ddxpgyjs(); 40 | } 41 | } 42 | })() 43 | .catch((e) => $.logErr(e)) 44 | .finally(() => $.done()) 45 | 46 | /** 47 | * 共用header 48 | */ 49 | function pubHeader() { 50 | return { 51 | 'accept': '*/*', 52 | 'cookie': ddxphd, 53 | 'accept-language': 'zh-cn', 54 | 'user-agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.35.1 station_id/${station_id}`, 55 | 'accept-encoding': 'gzip, deflate, br' 56 | } 57 | } 58 | 59 | uid = "" 60 | latitude = "" 61 | longitude = "" 62 | station_id = "" 63 | 64 | seedId = null 65 | propsId = null 66 | expPercent = null 67 | 68 | function getUrl(ddxpurl) { 69 | let url = ddxpurl.split("?") 70 | let ddxpurls = url[url.length - 1].split("&") 71 | let sendInfo = {} 72 | for (const val of ddxpurls) { 73 | let vals = val.split("&") 74 | for (const val1 of vals) { 75 | let kv = val1.split("=") 76 | sendInfo[kv[0]] = kv[1] 77 | } 78 | } 79 | uid = sendInfo["uid"] 80 | latitude = sendInfo["latitude"] 81 | longitude = sendInfo["longitude"] 82 | station_id = sendInfo["station_id"] 83 | } 84 | 85 | //获取鱼塘鱼列表 86 | function ddxTaskLog(timeout = 0) { 87 | userTaskLogId = "" 88 | return new Promise((resolve) => { 89 | let header = pubHeader() 90 | header["origin"] = "https://game.m.ddxq.mobi" 91 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 92 | let url = { 93 | url: `https://farm.api.ddxq.mobi/api/v2/userguide/detail?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.38.1&latitude=${latitude}&longitude=${longitude}&gameId=1&guideCode=FISHPOND_NEW`, 94 | headers: header, 95 | } 96 | 97 | $.get(url, async (err, resp, data) => { 98 | try { 99 | const result = JSON.parse(data) 100 | if (result.code == 0) { 101 | console.log('\n鱼塘喂鱼列表: ' + result.data.baseSeed.msg) 102 | seedId = result.data.baseSeed.seedId 103 | propsId = result.data.feed.propsId 104 | expPercent = result.data.baseSeed.expPercent 105 | } else { 106 | console.log(result) 107 | } 108 | } catch (e) { 109 | //$.logErr(e, resp); 110 | } finally { 111 | resolve() 112 | } 113 | }, timeout) 114 | }) 115 | } 116 | 117 | //鱼塘浇水 118 | function ddxpyt(timeout = 0) { 119 | return new Promise((resolve) => { 120 | if (ddxpwy) { 121 | if (seedId && propsId && expPercent < 100) { 122 | let header = pubHeader() 123 | header["origin"] = "https://game.m.ddxq.mobi" 124 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 125 | let url = { 126 | url: `https://farm.api.ddxq.mobi/api/v2/props/feed?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.38.1&latitude=${latitude}&longitude=${longitude}&gameId=1&propsId=${propsId}&seedId=${seedId}&cityCode=1103&feedPro=0&triggerMultiFeed=1`, 127 | headers: header, 128 | } 129 | 130 | $.get(url, async (err, resp, data) => { 131 | try { 132 | const result = JSON.parse(data) 133 | if (result.code == 0) { 134 | console.log(`\n鱼儿已完成: ${result.data.seed.expPercent}%`) 135 | if (result.data.seed.expPercent >= 100) { 136 | console.log(`\n鱼儿已养成,请及时收取`) 137 | if (notify){await notify.sendNotify($.name, `\n恭喜你,鱼儿已养成,请及时收取`);} 138 | else $.msg($.name, "", `\n恭喜你,鱼儿已养成,请及时收取`) 139 | } else if (result.data.feed.amount >= 10) { 140 | console.log(`鱼饵数量${result.data.feed.amount}`) 141 | await $.wait(1000); 142 | seedId = result.data.seed.seedId 143 | propsId = result.data.feed.propsId 144 | expPercent = result.data.seed.expPercent 145 | //继续喂鱼 146 | await ddxpyt(); 147 | } else { 148 | console.log(`\n鱼饵不足,停止喂鱼`) 149 | } 150 | } else { 151 | console.log(result) 152 | } 153 | } catch (e) { 154 | //$.logErr(e, resp); 155 | } finally { 156 | resolve() 157 | } 158 | }, timeout) 159 | } else { 160 | $.log("获取鱼塘异常") 161 | resolve() 162 | } 163 | } else { 164 | $.log("未开启喂鱼,如需开启设置环境变量ddxpwy为true") 165 | resolve() 166 | } 167 | }) 168 | } 169 | 170 | fertilizeramount = null 171 | feedamount = null 172 | fertilizerpropsId = null 173 | feedpropsId = null 174 | 175 | //获取果园水滴,肥料 176 | function ddxpgyGetsy(timeout = 0) { 177 | fertilizeramount = null 178 | feedamount = null 179 | fertilizerpropsId = null 180 | feedpropsId = null 181 | seedId = null 182 | return new Promise((resolve) => { 183 | let header = pubHeader() 184 | header["origin"] = "https://orchard-m.ddxq.mobi" 185 | header["ddmc-game-tid"] = "2" 186 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 187 | let url = { 188 | url: `https://farm.api.ddxq.mobi/api/v2/userguide/orchard/detail?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=2&cityCode=1103`, 189 | headers: header, 190 | } 191 | 192 | $.get(url, async (err, resp, data) => { 193 | try { 194 | const result = JSON.parse(data) 195 | if (result.code == 0) { 196 | console.log('\n果园肥料剩余: ' + result.data.fertilizer.amount) 197 | console.log('\n果园水滴剩余: ' + result.data.feed.amount) 198 | fertilizeramount = result.data.fertilizer.amount 199 | feedamount = result.data.feed.amount 200 | 201 | fertilizerpropsId = result.data.fertilizer.propsId 202 | feedpropsId = result.data.feed.propsId 203 | 204 | seedId = result.data.baseSeed.seedId 205 | } else { 206 | console.log(result) 207 | } 208 | } catch (e) { 209 | //$.logErr(e, resp); 210 | } finally { 211 | resolve() 212 | } 213 | }, timeout) 214 | }) 215 | } 216 | 217 | //果园施肥 218 | function ddxpgysf(timeout = 0) { 219 | return new Promise((resolve) => { 220 | if (ddxpjs) { 221 | if (seedId && fertilizerpropsId && fertilizeramount >= 10) { 222 | let header = pubHeader() 223 | header["origin"] = "https://orchard-m.ddxq.mobi" 224 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 225 | header["ddmc-game-tid"] = "2" 226 | let url = { 227 | url: `https://farm.api.ddxq.mobi/api/v2/props/props-use?api_version=9.1.0&app_client_id=1&station_id=$station_id{}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&propsCode=FERTILIZER&propsId=${fertilizerpropsId}&seedId=${seedId}`, 228 | headers: header, 229 | } 230 | 231 | $.get(url, async (err, resp, data) => { 232 | try { 233 | const result = JSON.parse(data) 234 | if (result.code == 0) { 235 | console.log(`\n果园肥料: ${result.data.propsUseResultVo.amount}`) 236 | 237 | if (result.data.propsUse.amount >= 10) { 238 | await $.wait(1000); 239 | fertilizerpropsId = result.data.feed.propsId 240 | //继续施肥 241 | await ddxpgysf(); 242 | } else { 243 | console.log(`\n肥料不足,停止施肥`) 244 | } 245 | } else { 246 | console.log(result) 247 | } 248 | } catch (e) { 249 | //$.logErr(e, resp); 250 | } finally { 251 | resolve() 252 | } 253 | }, timeout) 254 | } else { 255 | $.log("获取鱼塘异常") 256 | resolve() 257 | } 258 | } else { 259 | $.log("未开启浇水,如需开启设置环境变量ddxpjs为true") 260 | resolve() 261 | } 262 | }) 263 | } 264 | 265 | //果园浇水 266 | function ddxpgyjs(timeout = 0) { 267 | return new Promise((resolve) => { 268 | if (ddxpjs) { 269 | if (seedId && feedpropsId && feedamount >= 10) { 270 | let header = pubHeader() 271 | header["origin"] = "https://orchard-m.ddxq.mobi" 272 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 273 | header["ddmc-game-tid"] = "2" 274 | let url = { 275 | url: `https://farm.api.ddxq.mobi/api/v2/props/feed?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&propsCode=FEED&seedId=${seedId}&propsId=${feedpropsId}`, 276 | headers: header, 277 | } 278 | 279 | $.get(url, async (err, resp, data) => { 280 | try { 281 | const result = JSON.parse(data) 282 | if (result.code == 0) { 283 | console.log(`\n果园水滴: ${result.data.feed.amount}`) 284 | 285 | if (result.data.seed.expPercent >= 100) { 286 | console.log(`\n水果已种成,请及时收取`) 287 | if (notify){await notify.sendNotify($.name, `\n恭喜你,水果已种成,请及时收取`);} 288 | else $.msg($.name, "", `\n恭喜你,水果已种成,请及时收取`) 289 | } else if (result.data.feed.amount >= 10) { 290 | console.log(`水滴数量${result.data.feed.amount}`) 291 | await $.wait(1000); 292 | seedId = result.data.seed.seedId 293 | feedpropsId = result.data.feed.propsId 294 | expPercent = result.data.seed.expPercent 295 | //继续浇水 296 | await ddxpgyjs(); 297 | } else { 298 | console.log(`\n水滴不足,停止浇水`) 299 | } 300 | } else { 301 | console.log(result) 302 | } 303 | } catch (e) { 304 | //$.logErr(e, resp); 305 | } finally { 306 | resolve() 307 | } 308 | }, timeout) 309 | } else { 310 | $.log("获取鱼塘异常") 311 | resolve() 312 | } 313 | } else { 314 | $.log("未开启浇水,如需开启设置环境变量ddxpjs为true") 315 | resolve() 316 | } 317 | }) 318 | } 319 | 320 | function Env(t, e) { 321 | class s { 322 | constructor(t) { 323 | this.env = t 324 | } 325 | 326 | send(t, e = "GET") { 327 | t = "string" == typeof t ? { 328 | url: t 329 | } : t; 330 | let s = this.get; 331 | return "POST" === e && (s = this.post), new Promise((e, i) => { 332 | s.call(this, t, (t, s, r) => { 333 | t ? i(t) : e(s) 334 | }) 335 | }) 336 | } 337 | 338 | get(t) { 339 | return this.send.call(this.env, t) 340 | } 341 | 342 | post(t) { 343 | return this.send.call(this.env, t, "POST") 344 | } 345 | } 346 | 347 | return new class { 348 | constructor(t, e) { 349 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) 350 | } 351 | 352 | isNode() { 353 | return "undefined" != typeof module && !!module.exports 354 | } 355 | 356 | isQuanX() { 357 | return "undefined" != typeof $task 358 | } 359 | 360 | isSurge() { 361 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 362 | } 363 | 364 | isLoon() { 365 | return "undefined" != typeof $loon 366 | } 367 | 368 | toObj(t, e = null) { 369 | try { 370 | return JSON.parse(t) 371 | } catch { 372 | return e 373 | } 374 | } 375 | 376 | toStr(t, e = null) { 377 | try { 378 | return JSON.stringify(t) 379 | } catch { 380 | return e 381 | } 382 | } 383 | 384 | getjson(t, e) { 385 | let s = e; 386 | const i = this.getdata(t); 387 | if (i) try { 388 | s = JSON.parse(this.getdata(t)) 389 | } catch { 390 | } 391 | return s 392 | } 393 | 394 | setjson(t, e) { 395 | try { 396 | return this.setdata(JSON.stringify(t), e) 397 | } catch { 398 | return !1 399 | } 400 | } 401 | 402 | getScript(t) { 403 | return new Promise(e => { 404 | this.get({ 405 | url: t 406 | }, (t, s, i) => e(i)) 407 | }) 408 | } 409 | 410 | runScript(t, e) { 411 | return new Promise(s => { 412 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 413 | i = i ? i.replace(/\n/g, "").trim() : i; 414 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 415 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; 416 | const [o, h] = i.split("@"), a = { 417 | url: `http://${h}/v1/scripting/evaluate`, 418 | body: { 419 | script_text: t, 420 | mock_type: "cron", 421 | timeout: r 422 | }, 423 | headers: { 424 | "X-Key": o, 425 | Accept: "*/*" 426 | } 427 | }; 428 | this.post(a, (t, e, i) => s(i)) 429 | }).catch(t => this.logErr(t)) 430 | } 431 | 432 | loaddata() { 433 | if (!this.isNode()) return {}; 434 | { 435 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 436 | const t = this.path.resolve(this.dataFile), 437 | e = this.path.resolve(process.cwd(), this.dataFile), 438 | s = this.fs.existsSync(t), 439 | i = !s && this.fs.existsSync(e); 440 | if (!s && !i) return {}; 441 | { 442 | const i = s ? t : e; 443 | try { 444 | return JSON.parse(this.fs.readFileSync(i)) 445 | } catch (t) { 446 | return {} 447 | } 448 | } 449 | } 450 | } 451 | 452 | writedata() { 453 | if (this.isNode()) { 454 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 455 | const t = this.path.resolve(this.dataFile), 456 | e = this.path.resolve(process.cwd(), this.dataFile), 457 | s = this.fs.existsSync(t), 458 | i = !s && this.fs.existsSync(e), 459 | r = JSON.stringify(this.data); 460 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 461 | } 462 | } 463 | 464 | lodash_get(t, e, s) { 465 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 466 | let r = t; 467 | for (const t of i) 468 | if (r = Object(r)[t], void 0 === r) return s; 469 | return r 470 | } 471 | 472 | lodash_set(t, e, s) { 473 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) 474 | } 475 | 476 | getdata(t) { 477 | let e = this.getval(t); 478 | if (/^@/.test(t)) { 479 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; 480 | if (r) try { 481 | const t = JSON.parse(r); 482 | e = t ? this.lodash_get(t, i, "") : e 483 | } catch (t) { 484 | e = "" 485 | } 486 | } 487 | return e 488 | } 489 | 490 | setdata(t, e) { 491 | let s = !1; 492 | if (/^@/.test(e)) { 493 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), 494 | h = i ? "null" === o ? null : o || "{}" : "{}"; 495 | try { 496 | const e = JSON.parse(h); 497 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) 498 | } catch (e) { 499 | const o = {}; 500 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) 501 | } 502 | } else s = this.setval(t, e); 503 | return s 504 | } 505 | 506 | getval(t) { 507 | if (this.isNode()) { 508 | return process.env[t] 509 | } else { 510 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null 511 | } 512 | } 513 | 514 | setval(t, e) { 515 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null 516 | } 517 | 518 | initGotEnv(t) { 519 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 520 | } 521 | 522 | get(t, e = (() => { 523 | })) { 524 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 525 | "X-Surge-Skip-Scripting": !1 526 | })), $httpClient.get(t, (t, s, i) => { 527 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 528 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 529 | hints: !1 530 | })), $task.fetch(t).then(t => { 531 | const { 532 | statusCode: s, 533 | statusCode: i, 534 | headers: r, 535 | body: o 536 | } = t; 537 | e(null, { 538 | status: s, 539 | statusCode: i, 540 | headers: r, 541 | body: o 542 | }, o) 543 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 544 | try { 545 | if (t.headers["set-cookie"]) { 546 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 547 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar 548 | } 549 | } catch (t) { 550 | this.logErr(t) 551 | } 552 | }).then(t => { 553 | const { 554 | statusCode: s, 555 | statusCode: i, 556 | headers: r, 557 | body: o 558 | } = t; 559 | e(null, { 560 | status: s, 561 | statusCode: i, 562 | headers: r, 563 | body: o 564 | }, o) 565 | }, t => { 566 | const { 567 | message: s, 568 | response: i 569 | } = t; 570 | e(s, i, i && i.body) 571 | })) 572 | } 573 | 574 | post(t, e = (() => { 575 | })) { 576 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 577 | "X-Surge-Skip-Scripting": !1 578 | })), $httpClient.post(t, (t, s, i) => { 579 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 580 | }); 581 | else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 582 | hints: !1 583 | })), $task.fetch(t).then(t => { 584 | const { 585 | statusCode: s, 586 | statusCode: i, 587 | headers: r, 588 | body: o 589 | } = t; 590 | e(null, { 591 | status: s, 592 | statusCode: i, 593 | headers: r, 594 | body: o 595 | }, o) 596 | }, t => e(t)); 597 | else if (this.isNode()) { 598 | this.initGotEnv(t); 599 | const { 600 | url: s, 601 | ...i 602 | } = t; 603 | this.got.post(s, i).then(t => { 604 | const { 605 | statusCode: s, 606 | statusCode: i, 607 | headers: r, 608 | body: o 609 | } = t; 610 | e(null, { 611 | status: s, 612 | statusCode: i, 613 | headers: r, 614 | body: o 615 | }, o) 616 | }, t => { 617 | const { 618 | message: s, 619 | response: i 620 | } = t; 621 | e(s, i, i && i.body) 622 | }) 623 | } 624 | } 625 | 626 | time(t) { 627 | let e = { 628 | "M+": (new Date).getMonth() + 1, 629 | "d+": (new Date).getDate(), 630 | "H+": (new Date).getHours(), 631 | "m+": (new Date).getMinutes(), 632 | "s+": (new Date).getSeconds(), 633 | "q+": Math.floor(((new Date).getMonth() + 3) / 3), 634 | S: (new Date).getMilliseconds() 635 | }; 636 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); 637 | for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); 638 | return t 639 | } 640 | 641 | msg(e = t, s = "", i = "", r) { 642 | const o = t => { 643 | if (!t) return t; 644 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { 645 | "open-url": t 646 | } : this.isSurge() ? { 647 | url: t 648 | } : void 0; 649 | if ("object" == typeof t) { 650 | if (this.isLoon()) { 651 | let e = t.openUrl || t.url || t["open-url"], 652 | s = t.mediaUrl || t["media-url"]; 653 | return { 654 | openUrl: e, 655 | mediaUrl: s 656 | } 657 | } 658 | if (this.isQuanX()) { 659 | let e = t["open-url"] || t.url || t.openUrl, 660 | s = t["media-url"] || t.mediaUrl; 661 | return { 662 | "open-url": e, 663 | "media-url": s 664 | } 665 | } 666 | if (this.isSurge()) { 667 | let e = t.url || t.openUrl || t["open-url"]; 668 | return { 669 | url: e 670 | } 671 | } 672 | } 673 | }; 674 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); 675 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; 676 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) 677 | } 678 | 679 | log(...t) { 680 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) 681 | } 682 | 683 | logErr(t, e) { 684 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 685 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) 686 | } 687 | 688 | wait(t) { 689 | return new Promise(e => setTimeout(e, t)) 690 | } 691 | 692 | done(t = {}) { 693 | const e = (new Date).getTime(), 694 | s = (e - this.startTime) / 1e3; 695 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 696 | } 697 | }(t, e) 698 | } 699 | -------------------------------------------------------------------------------- /ddxpcouponsjm.js: -------------------------------------------------------------------------------- 1 | /* 2 | 叮咚自动抢券 3 | [task_local] 4 | 50 23 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpcoupons.js, tag=自动抢券, enabled=true 5 | 配置变量 ddxpquan 为 3 5 8 15 抢不同券 6 | 配置变量 ddxpquanyc 设置延迟(防黑) 默认1000ms,建议1000-3000都可以,基本能抢到 7 | */ 8 | 9 | const _0x42127d=_0x53fc;(function(_0x221bdd,_0x58eee3){const _0x44bdee=_0x53fc,_0x152b0c=_0x221bdd();while(!![]){try{const _0x2741bf=parseInt(_0x44bdee(0x154))/0x1+-parseInt(_0x44bdee(0x1c8))/0x2*(-parseInt(_0x44bdee(0x18d))/0x3)+-parseInt(_0x44bdee(0x1ca))/0x4+parseInt(_0x44bdee(0x16d))/0x5*(-parseInt(_0x44bdee(0x19f))/0x6)+-parseInt(_0x44bdee(0x16e))/0x7*(-parseInt(_0x44bdee(0x1a7))/0x8)+parseInt(_0x44bdee(0x130))/0x9+-parseInt(_0x44bdee(0x186))/0xa;if(_0x2741bf===_0x58eee3)break;else _0x152b0c['push'](_0x152b0c['shift']());}catch(_0x41984a){_0x152b0c['push'](_0x152b0c['shift']());}}}(_0xbb52,0xe57c5));const $=new Env(_0x42127d(0x139)),dr='@';let ddxpurlArr=[],ddxphdArr=[],ddxpcount='',time=Math[_0x42127d(0x1c7)](Date[_0x42127d(0x1c5)]()/0x3e8),ddxpurl=$[_0x42127d(0x18b)](_0x42127d(0x183)),ddxphd=$[_0x42127d(0x18b)](_0x42127d(0x17f)),ddxpquan=$[_0x42127d(0x18b)]('ddxpquan'),ddxpquanyc=$[_0x42127d(0x18b)](_0x42127d(0x193)),uid='',latitude='',longitude='',station_id='',userTaskLogId='',activityId=null,sendtime=0x0,lesstime=0x0,userTasks=[];function _0x53fc(_0x25c86c,_0xb6831f){const _0xbb525=_0xbb52();return _0x53fc=function(_0x53fcaa,_0x1d5ffa){_0x53fcaa=_0x53fcaa-0x12c;let _0x2ffeed=_0xbb525[_0x53fcaa];return _0x2ffeed;},_0x53fc(_0x25c86c,_0xb6831f);}!(async()=>{const _0xa074b=_0x42127d;ddxpurlArr=(ddxpurl||'')[_0xa074b(0x156)](dr),ddxphdArr=(ddxphd||'')['split'](dr),ddxpquanyc=+(ddxpquanyc||0x3e8);let _0x1e48f4=+ddxpquan;if(_0x1e48f4!=0x3&&_0x1e48f4!=0x5&&_0x1e48f4!=0x8&&_0x1e48f4!=0xf){console[_0xa074b(0x1b6)](_0xa074b(0x169));return;}console[_0xa074b(0x1b6)]('-------------\x20共'+ddxphdArr[_0xa074b(0x135)]+_0xa074b(0x1ab));for(let _0x1e51aa=0x0;_0x1e51aa$['logErr'](_0x1da6c0))[_0x42127d(0x1b9)](()=>$[_0x42127d(0x143)]());function pubHeader(){const _0x2db9a1=_0x42127d;return{'accept':'*/*','cookie':ddxphd,'accept-language':'zh-cn','user-agent':'Mozilla/5.0\x20(iPhone;\x20CPU\x20iPhone\x20OS\x2014_7_1\x20like\x20Mac\x20OS\x20X)\x20AppleWebKit/605.1.15\x20(KHTML,\x20like\x20Gecko)\x20Mobile/15E148\x20xzone/9.35.1\x20station_id/'+station_id,'accept-encoding':_0x2db9a1(0x1c4)};}function getUrl(_0x4b14aa){const _0x217991=_0x42127d;let _0x45e8cf=_0x4b14aa['split']('?'),_0xaa0997=_0x45e8cf[_0x45e8cf[_0x217991(0x135)]-0x1][_0x217991(0x156)]('&'),_0x4b828c={};for(const _0xad5a65 of _0xaa0997){let _0x4ecdf2=_0xad5a65[_0x217991(0x156)]('&');for(const _0x5e7139 of _0x4ecdf2){let _0x1ef1ce=_0x5e7139[_0x217991(0x156)]('=');_0x4b828c[_0x1ef1ce[0x0]]=_0x1ef1ce[0x1];}}uid=_0x4b828c[_0x217991(0x192)],latitude=_0x4b828c[_0x217991(0x1cf)],longitude=_0x4b828c[_0x217991(0x162)],station_id=_0x4b828c['station_id'];}function ddxpgetquan(_0x2ff131=0x0){return new Promise(_0x61ba5a=>{const _0x22cf0d=_0x53fc;let _0x26ee95=pubHeader();_0x26ee95['origin']=_0x22cf0d(0x152),_0x26ee95[_0x22cf0d(0x1b2)]=_0x22cf0d(0x1b3),_0x26ee95[_0x22cf0d(0x131)]=_0x22cf0d(0x1a1);let _0x152111={'url':_0x22cf0d(0x1b8),'headers':_0x26ee95,'body':{'api_version':'9.7.3','app_client_id':0x3,'app_version':'1.0.0','biz_type':_0x22cf0d(0x148),'city_number':'1103','latitude':latitude,'longitude':longitude,'native_version':'9.38.1','station_id':station_id}};_0x152111[_0x22cf0d(0x19e)]=JSON[_0x22cf0d(0x155)](_0x152111['body']),$[_0x22cf0d(0x16f)](_0x152111,async(_0x3223cd,_0x52da8d,_0x3fa538)=>{const _0x5cd467=_0x22cf0d;try{const _0x215f06=JSON['parse'](_0x3fa538);if(_0x215f06['code']==0x0)for(const _0x75c242 of _0x215f06['data']){let _0x5dcdc0=_0x75c242[_0x5cd467(0x13f)][0x0];if(+_0x5dcdc0['outerInfo'][_0x5cd467(0x150)]==ddxpquan){console[_0x5cd467(0x1b6)]('\x0a'+_0x5dcdc0[_0x5cd467(0x134)]+'每天'+_0x5dcdc0['extendInfo'][_0x5cd467(0x18a)]+_0x5cd467(0x1cd)),activityId=_0x5dcdc0[_0x5cd467(0x157)],console[_0x5cd467(0x1b6)](_0x5cd467(0x15e)+activityId);let _0x420a39=new Date()[_0x5cd467(0x18f)](0x0,0x0,0x0,0x0)+0x5265c00,_0x59a9b5=Date[_0x5cd467(0x1c5)]();sendtime=_0x420a39,lesstime=_0x420a39-_0x59a9b5;ddxpquanyc>0x0&&(lesstime+=ddxpquanyc);console[_0x5cd467(0x1b6)](_0x5cd467(0x18c)+_0x59a9b5+_0x5cd467(0x184)+lesstime+_0x5cd467(0x137));break;}}else console[_0x5cd467(0x1b6)](_0x215f06);}catch(_0x22dea2){}finally{_0x61ba5a();}},_0x2ff131);});}function _0xbb52(){const _0x510388=['slice','opts','longitude','readFileSync','http','getMinutes','==============📣系统通知📣==============','getval','set-cookie','未设置抢券价格或格式错误,退出脚本\x0a','setjson','then','isMute','20705qEZcEq','165032jBJvQe','post','CookieJar','prizeName','code','ckjar','openUrl','get','cookieJar','index',',\x20开始!','substr','logSeparator','logs','msg','call','map','ddxphd','status','wait','box.dat','ddxpurl',',将于','isSurge','27091450yBPXbj','replace','extendInfo','lodash_set','dayLimit','getdata','\x0a现在时间为','5364159GiYCBj',',\x20结束!\x20🕛\x20','setHours','getMilliseconds','media-url','uid','ddxpquanyc','test','cron','runScript','isQuanX','writedata','floor','send','&bizNo=','join','isArray','body','1626bUYtJR','\x0a开始【叮咚抢券','application/json;charset=UTF-8','isLoon','env','fetch','getDate','POST','400QvJCtB','GET','Cookie','exec','个账号-------------\x0a','path','dataFile','got','null','object','assign','referer','https://activity.m.ddxq.mobi/','@chavy_boxjs_userCfgs.httpapi','http://','log','data','https://gw.api.ddxq.mobi/promocore-service/client/maicai/mcActivityClient/v1/listByStationId','finally','origin','resolve','headers','prizeSendRecords','getSeconds','trim','startTime','cktough','parse','timeout','gzip,\x20deflate,\x20br','now','catch','round','2qClyup','redirect','2228076Kukqyq','match','loaddata','个,如果一直抢不到建议抢个数多的','write','latitude','valueForKey','toStr','undefined','getHours','isNeedRewrite','15605343Lnmapx','Content-Type','mediaUrl','setValueForKey','name','length','open-url','毫秒后开抢',',\x20错误!','自动抢券','/v1/scripting/evaluate','application/x-www-form-urlencoded','prizeInfo','existsSync','Content-Length','prizes','abs','getScript','toObj','done','&longitude=','url','statusCode','setval','POINT_BUY_TICKET','string','exports','logErr','stack','toString','getTime','read','prizeValue','writeFileSync','https://activity.m.ddxq.mobi','cwd','627568KFwjKb','stringify','split','activityId','lodash_get','setdata','getMonth','reduce','isNode','initGotEnv','\x0aactivityId:','push'];_0xbb52=function(){return _0x510388;};return _0xbb52();}let testNum=0x0;function ddxpqq(_0x463257=0x0){return new Promise(_0x453f6b=>{const _0x1bbf87=_0x53fc;let _0x33388b=pubHeader();_0x33388b[_0x1bbf87(0x1ba)]=_0x1bbf87(0x152),_0x33388b[_0x1bbf87(0x1b2)]=_0x1bbf87(0x1b3),_0x33388b[_0x1bbf87(0x131)]=_0x1bbf87(0x13b);let _0x24b773=Date[_0x1bbf87(0x1c5)](),_0x5e594e={'url':'https://gw.api.ddxq.mobi/promocore-service/client/maicai/mcActivityTrigger/v1/trigger','headers':_0x33388b,'body':'api_version=9.7.3&app_version=1.0.0&app_client_id=3&station_id='+station_id+'&native_version=9.40.0&city_number=1103&latitude='+latitude+_0x1bbf87(0x144)+longitude+'&activityId='+activityId+_0x1bbf87(0x19b)+_0x24b773};$[_0x1bbf87(0x16f)](_0x5e594e,async(_0x5be52f,_0x4b2459,_0x147610)=>{const _0x2d0c59=_0x1bbf87;try{const _0xf065cc=JSON[_0x2d0c59(0x1c2)](_0x147610);if(_0xf065cc[_0x2d0c59(0x172)]==0x0&&_0xf065cc['prizeSendRecords']!=null&&_0xf065cc[_0x2d0c59(0x1bd)]['length']>0x0)for(const _0xed6581 of _0xf065cc[_0x2d0c59(0x1b7)][_0x2d0c59(0x1bd)]){console[_0x2d0c59(0x1b6)]('\x0a恭喜你,抢到了'+_0xed6581[_0x2d0c59(0x188)]['prizeInfo']['prizeName']),$[_0x2d0c59(0x17c)]($[_0x2d0c59(0x134)],'','\x0a恭喜你,抢到了'+_0xed6581['extendInfo'][_0x2d0c59(0x13c)][_0x2d0c59(0x171)]);}else console[_0x2d0c59(0x1b6)]('\x0a'+_0xf065cc[_0x2d0c59(0x17c)]);}catch(_0x4a5d4b){}finally{_0x453f6b();}},_0x463257);});}function Env(_0x29f4cb,_0x5e1090){const _0x3bbf7a=_0x42127d;class _0x2f6250{constructor(_0xae1f65){const _0x107cfd=_0x53fc;this[_0x107cfd(0x1a3)]=_0xae1f65;}['send'](_0x225ff5,_0x29476c=_0x3bbf7a(0x1a8)){const _0x2d1dd5=_0x3bbf7a;_0x225ff5='string'==typeof _0x225ff5?{'url':_0x225ff5}:_0x225ff5;let _0x52ed08=this[_0x2d1dd5(0x175)];return _0x2d1dd5(0x1a6)===_0x29476c&&(_0x52ed08=this[_0x2d1dd5(0x16f)]),new Promise((_0x22c4c2,_0x398ad4)=>{const _0x9b5a54=_0x2d1dd5;_0x52ed08[_0x9b5a54(0x17d)](this,_0x225ff5,(_0x38d8c0,_0x146b9d,_0x427889)=>{_0x38d8c0?_0x398ad4(_0x38d8c0):_0x22c4c2(_0x146b9d);});});}[_0x3bbf7a(0x175)](_0x403857){const _0x1e975d=_0x3bbf7a;return this['send']['call'](this[_0x1e975d(0x1a3)],_0x403857);}['post'](_0x8897f6){const _0x3975f9=_0x3bbf7a;return this[_0x3975f9(0x19a)][_0x3975f9(0x17d)](this[_0x3975f9(0x1a3)],_0x8897f6,'POST');}}return new class{constructor(_0x532e49,_0x3d7f41){const _0x5a0162=_0x3bbf7a;this[_0x5a0162(0x134)]=_0x532e49,this[_0x5a0162(0x164)]=new _0x2f6250(this),this['data']=null,this['dataFile']=_0x5a0162(0x182),this[_0x5a0162(0x17b)]=[],this[_0x5a0162(0x16c)]=!0x1,this['isNeedRewrite']=!0x1,this[_0x5a0162(0x17a)]='\x0a',this[_0x5a0162(0x1c0)]=new Date()[_0x5a0162(0x14e)](),Object[_0x5a0162(0x1b1)](this,_0x3d7f41),this[_0x5a0162(0x1b6)]('','🔔'+this[_0x5a0162(0x134)]+_0x5a0162(0x178));}['isNode'](){const _0x5e1952=_0x3bbf7a;return _0x5e1952(0x12d)!=typeof module&&!!module[_0x5e1952(0x14a)];}[_0x3bbf7a(0x197)](){const _0x26039b=_0x3bbf7a;return _0x26039b(0x12d)!=typeof $task;}['isSurge'](){const _0x43b0e4=_0x3bbf7a;return _0x43b0e4(0x12d)!=typeof $httpClient&&_0x43b0e4(0x12d)==typeof $loon;}['isLoon'](){const _0x441252=_0x3bbf7a;return _0x441252(0x12d)!=typeof $loon;}[_0x3bbf7a(0x142)](_0x7d46d7,_0x28f53d=null){const _0x505406=_0x3bbf7a;try{return JSON[_0x505406(0x1c2)](_0x7d46d7);}catch{return _0x28f53d;}}[_0x3bbf7a(0x12c)](_0x273606,_0x4cff6d=null){const _0x723106=_0x3bbf7a;try{return JSON[_0x723106(0x155)](_0x273606);}catch{return _0x4cff6d;}}['getjson'](_0x457543,_0x4a5c14){const _0x5af0f0=_0x3bbf7a;let _0x4b2573=_0x4a5c14;const _0x3633fc=this[_0x5af0f0(0x18b)](_0x457543);if(_0x3633fc)try{_0x4b2573=JSON['parse'](this[_0x5af0f0(0x18b)](_0x457543));}catch{}return _0x4b2573;}[_0x3bbf7a(0x16a)](_0x9eeba9,_0x161dd8){const _0x4d0c6b=_0x3bbf7a;try{return this[_0x4d0c6b(0x159)](JSON[_0x4d0c6b(0x155)](_0x9eeba9),_0x161dd8);}catch{return!0x1;}}[_0x3bbf7a(0x141)](_0x52b2dd){return new Promise(_0xc7d189=>{const _0x299c62=_0x53fc;this[_0x299c62(0x175)]({'url':_0x52b2dd},(_0x4f3296,_0x49b435,_0x470a14)=>_0xc7d189(_0x470a14));});}[_0x3bbf7a(0x196)](_0x19648f,_0x1e7bdd){const _0x16b508=_0x3bbf7a;return new Promise(_0x538cfe=>{const _0x5e0d59=_0x53fc;let _0xecbfb=this['getdata'](_0x5e0d59(0x1b4));_0xecbfb=_0xecbfb?_0xecbfb[_0x5e0d59(0x187)](/\n/g,'')[_0x5e0d59(0x1bf)]():_0xecbfb;let _0x5ccdad=this[_0x5e0d59(0x18b)]('@chavy_boxjs_userCfgs.httpapi_timeout');_0x5ccdad=_0x5ccdad?0x1*_0x5ccdad:0x14,_0x5ccdad=_0x1e7bdd&&_0x1e7bdd[_0x5e0d59(0x1c3)]?_0x1e7bdd[_0x5e0d59(0x1c3)]:_0x5ccdad;const [_0x15f4e4,_0x2a75c8]=_0xecbfb['split']('@'),_0x3ef655={'url':_0x5e0d59(0x1b5)+_0x2a75c8+_0x5e0d59(0x13a),'body':{'script_text':_0x19648f,'mock_type':_0x5e0d59(0x195),'timeout':_0x5ccdad},'headers':{'X-Key':_0x15f4e4,'Accept':'*/*'}};this['post'](_0x3ef655,(_0x1b7db0,_0x392dcd,_0x500ef7)=>_0x538cfe(_0x500ef7));})[_0x16b508(0x1c6)](_0x5a730d=>this['logErr'](_0x5a730d));}[_0x3bbf7a(0x1cc)](){const _0x176742=_0x3bbf7a;if(!this['isNode']())return{};{this['fs']=this['fs']?this['fs']:require('fs'),this[_0x176742(0x1ac)]=this[_0x176742(0x1ac)]?this[_0x176742(0x1ac)]:require(_0x176742(0x1ac));const _0x5db644=this[_0x176742(0x1ac)][_0x176742(0x1bb)](this[_0x176742(0x1ad)]),_0x3b605d=this[_0x176742(0x1ac)][_0x176742(0x1bb)](process['cwd'](),this['dataFile']),_0x395d3d=this['fs'][_0x176742(0x13d)](_0x5db644),_0x4d8045=!_0x395d3d&&this['fs']['existsSync'](_0x3b605d);if(!_0x395d3d&&!_0x4d8045)return{};{const _0x922c26=_0x395d3d?_0x5db644:_0x3b605d;try{return JSON[_0x176742(0x1c2)](this['fs'][_0x176742(0x163)](_0x922c26));}catch(_0x2bda40){return{};}}}}[_0x3bbf7a(0x198)](){const _0x33a8bc=_0x3bbf7a;if(this['isNode']()){this['fs']=this['fs']?this['fs']:require('fs'),this['path']=this[_0x33a8bc(0x1ac)]?this['path']:require(_0x33a8bc(0x1ac));const _0x1c1161=this[_0x33a8bc(0x1ac)][_0x33a8bc(0x1bb)](this[_0x33a8bc(0x1ad)]),_0x2c46ed=this[_0x33a8bc(0x1ac)][_0x33a8bc(0x1bb)](process[_0x33a8bc(0x153)](),this[_0x33a8bc(0x1ad)]),_0x350a60=this['fs'][_0x33a8bc(0x13d)](_0x1c1161),_0x23547c=!_0x350a60&&this['fs'][_0x33a8bc(0x13d)](_0x2c46ed),_0x50c23a=JSON[_0x33a8bc(0x155)](this['data']);_0x350a60?this['fs'][_0x33a8bc(0x151)](_0x1c1161,_0x50c23a):_0x23547c?this['fs']['writeFileSync'](_0x2c46ed,_0x50c23a):this['fs'][_0x33a8bc(0x151)](_0x1c1161,_0x50c23a);}}[_0x3bbf7a(0x158)](_0x44bd04,_0x91491f,_0x4f6666){const _0x436382=_0x3bbf7a,_0x5b3fa7=_0x91491f[_0x436382(0x187)](/\[(\d+)\]/g,'.$1')[_0x436382(0x156)]('.');let _0x17a6ea=_0x44bd04;for(const _0x30686d of _0x5b3fa7)if(_0x17a6ea=Object(_0x17a6ea)[_0x30686d],void 0x0===_0x17a6ea)return _0x4f6666;return _0x17a6ea;}[_0x3bbf7a(0x189)](_0x5ccf25,_0x1177b6,_0x2357e4){const _0x41acff=_0x3bbf7a;return Object(_0x5ccf25)!==_0x5ccf25?_0x5ccf25:(Array[_0x41acff(0x19d)](_0x1177b6)||(_0x1177b6=_0x1177b6[_0x41acff(0x14d)]()[_0x41acff(0x1cb)](/[^.[\]]+/g)||[]),_0x1177b6[_0x41acff(0x160)](0x0,-0x1)[_0x41acff(0x15b)]((_0x55cf8a,_0xc3ed61,_0xbc16fc)=>Object(_0x55cf8a[_0xc3ed61])===_0x55cf8a[_0xc3ed61]?_0x55cf8a[_0xc3ed61]:_0x55cf8a[_0xc3ed61]=Math[_0x41acff(0x140)](_0x1177b6[_0xbc16fc+0x1])>>0x0==+_0x1177b6[_0xbc16fc+0x1]?[]:{},_0x5ccf25)[_0x1177b6[_0x1177b6[_0x41acff(0x135)]-0x1]]=_0x2357e4,_0x5ccf25);}[_0x3bbf7a(0x18b)](_0x4623d6){const _0x15e43d=_0x3bbf7a;let _0x3587ab=this['getval'](_0x4623d6);if(/^@/[_0x15e43d(0x194)](_0x4623d6)){const [,_0x14da5c,_0x3b723d]=/^@(.*?)\.(.*?)$/[_0x15e43d(0x1aa)](_0x4623d6),_0x13b299=_0x14da5c?this['getval'](_0x14da5c):'';if(_0x13b299)try{const _0x39aa75=JSON[_0x15e43d(0x1c2)](_0x13b299);_0x3587ab=_0x39aa75?this['lodash_get'](_0x39aa75,_0x3b723d,''):_0x3587ab;}catch(_0x112cc8){_0x3587ab='';}}return _0x3587ab;}['setdata'](_0x62e7e0,_0x91282a){const _0x555ff4=_0x3bbf7a;let _0x347d1a=!0x1;if(/^@/[_0x555ff4(0x194)](_0x91282a)){const [,_0x1518e2,_0x488a45]=/^@(.*?)\.(.*?)$/['exec'](_0x91282a),_0x214676=this['getval'](_0x1518e2),_0x3000bb=_0x1518e2?_0x555ff4(0x1af)===_0x214676?null:_0x214676||'{}':'{}';try{const _0x387078=JSON['parse'](_0x3000bb);this['lodash_set'](_0x387078,_0x488a45,_0x62e7e0),_0x347d1a=this[_0x555ff4(0x147)](JSON[_0x555ff4(0x155)](_0x387078),_0x1518e2);}catch(_0x28951d){const _0x4b1428={};this[_0x555ff4(0x189)](_0x4b1428,_0x488a45,_0x62e7e0),_0x347d1a=this[_0x555ff4(0x147)](JSON[_0x555ff4(0x155)](_0x4b1428),_0x1518e2);}}else _0x347d1a=this[_0x555ff4(0x147)](_0x62e7e0,_0x91282a);return _0x347d1a;}[_0x3bbf7a(0x167)](_0x1cf866){const _0x7994a6=_0x3bbf7a;return this[_0x7994a6(0x15c)]()?process[_0x7994a6(0x1a3)][_0x1cf866]:this[_0x7994a6(0x185)]()||this[_0x7994a6(0x1a2)]()?$persistentStore[_0x7994a6(0x14f)](_0x1cf866):this[_0x7994a6(0x197)]()?$prefs[_0x7994a6(0x1d0)](_0x1cf866):this[_0x7994a6(0x15c)]()?(this['data']=this[_0x7994a6(0x1cc)](),this[_0x7994a6(0x1b7)][_0x1cf866]):this[_0x7994a6(0x1b7)]&&this[_0x7994a6(0x1b7)][_0x1cf866]||null;}[_0x3bbf7a(0x147)](_0x172ae6,_0x1df24b){const _0x41fd65=_0x3bbf7a;return this[_0x41fd65(0x185)]()||this[_0x41fd65(0x1a2)]()?$persistentStore[_0x41fd65(0x1ce)](_0x172ae6,_0x1df24b):this['isQuanX']()?$prefs[_0x41fd65(0x133)](_0x172ae6,_0x1df24b):this[_0x41fd65(0x15c)]()?(this['data']=this[_0x41fd65(0x1cc)](),this[_0x41fd65(0x1b7)][_0x1df24b]=_0x172ae6,this[_0x41fd65(0x198)](),!0x0):this['data']&&this[_0x41fd65(0x1b7)][_0x1df24b]||null;}[_0x3bbf7a(0x15d)](_0x14f283){const _0x49445f=_0x3bbf7a;this[_0x49445f(0x1ae)]=this[_0x49445f(0x1ae)]?this[_0x49445f(0x1ae)]:require(_0x49445f(0x1ae)),this[_0x49445f(0x1c1)]=this[_0x49445f(0x1c1)]?this[_0x49445f(0x1c1)]:require('tough-cookie'),this[_0x49445f(0x173)]=this[_0x49445f(0x173)]?this[_0x49445f(0x173)]:new this[(_0x49445f(0x1c1))][(_0x49445f(0x170))](),_0x14f283&&(_0x14f283['headers']=_0x14f283[_0x49445f(0x1bc)]?_0x14f283[_0x49445f(0x1bc)]:{},void 0x0===_0x14f283['headers'][_0x49445f(0x1a9)]&&void 0x0===_0x14f283['cookieJar']&&(_0x14f283['cookieJar']=this[_0x49445f(0x173)]));}['get'](_0x3600f3,_0x5b1d21=()=>{}){const _0x25d260=_0x3bbf7a;_0x3600f3['headers']&&(delete _0x3600f3[_0x25d260(0x1bc)][_0x25d260(0x131)],delete _0x3600f3[_0x25d260(0x1bc)]['Content-Length']),this[_0x25d260(0x185)]()||this[_0x25d260(0x1a2)]()?(this[_0x25d260(0x185)]()&&this['isNeedRewrite']&&(_0x3600f3[_0x25d260(0x1bc)]=_0x3600f3[_0x25d260(0x1bc)]||{},Object[_0x25d260(0x1b1)](_0x3600f3['headers'],{'X-Surge-Skip-Scripting':!0x1})),$httpClient[_0x25d260(0x175)](_0x3600f3,(_0x3ba8ac,_0x2de765,_0x431c37)=>{const _0x498f79=_0x25d260;!_0x3ba8ac&&_0x2de765&&(_0x2de765[_0x498f79(0x19e)]=_0x431c37,_0x2de765[_0x498f79(0x146)]=_0x2de765[_0x498f79(0x180)]),_0x5b1d21(_0x3ba8ac,_0x2de765,_0x431c37);})):this[_0x25d260(0x197)]()?(this[_0x25d260(0x12f)]&&(_0x3600f3[_0x25d260(0x161)]=_0x3600f3[_0x25d260(0x161)]||{},Object[_0x25d260(0x1b1)](_0x3600f3['opts'],{'hints':!0x1})),$task[_0x25d260(0x1a4)](_0x3600f3)[_0x25d260(0x16b)](_0x146b05=>{const {statusCode:_0x322419,statusCode:_0x33f7a5,headers:_0x3bae28,body:_0x17ae32}=_0x146b05;_0x5b1d21(null,{'status':_0x322419,'statusCode':_0x33f7a5,'headers':_0x3bae28,'body':_0x17ae32},_0x17ae32);},_0x2abaeb=>_0x5b1d21(_0x2abaeb))):this[_0x25d260(0x15c)]()&&(this[_0x25d260(0x15d)](_0x3600f3),this['got'](_0x3600f3)['on'](_0x25d260(0x1c9),(_0x3ddfa1,_0x8331ed)=>{const _0x23774b=_0x25d260;try{if(_0x3ddfa1[_0x23774b(0x1bc)][_0x23774b(0x168)]){const _0x244649=_0x3ddfa1[_0x23774b(0x1bc)][_0x23774b(0x168)][_0x23774b(0x17e)](this['cktough'][_0x23774b(0x1a9)][_0x23774b(0x1c2)])['toString']();this[_0x23774b(0x173)]['setCookieSync'](_0x244649,null),_0x8331ed[_0x23774b(0x176)]=this[_0x23774b(0x173)];}}catch(_0x24a98e){this[_0x23774b(0x14b)](_0x24a98e);}})[_0x25d260(0x16b)](_0xdbaf2c=>{const {statusCode:_0x122bd1,statusCode:_0x4434b9,headers:_0x186975,body:_0x72a070}=_0xdbaf2c;_0x5b1d21(null,{'status':_0x122bd1,'statusCode':_0x4434b9,'headers':_0x186975,'body':_0x72a070},_0x72a070);},_0x4e019a=>{const _0x510a43=_0x25d260,{message:_0xcd93cd,response:_0x410858}=_0x4e019a;_0x5b1d21(_0xcd93cd,_0x410858,_0x410858&&_0x410858[_0x510a43(0x19e)]);}));}[_0x3bbf7a(0x16f)](_0x326af0,_0xbfde77=()=>{}){const _0x35d647=_0x3bbf7a;if(_0x326af0[_0x35d647(0x19e)]&&_0x326af0['headers']&&!_0x326af0[_0x35d647(0x1bc)][_0x35d647(0x131)]&&(_0x326af0[_0x35d647(0x1bc)][_0x35d647(0x131)]=_0x35d647(0x13b)),_0x326af0['headers']&&delete _0x326af0[_0x35d647(0x1bc)][_0x35d647(0x13e)],this[_0x35d647(0x185)]()||this[_0x35d647(0x1a2)]())this['isSurge']()&&this[_0x35d647(0x12f)]&&(_0x326af0[_0x35d647(0x1bc)]=_0x326af0[_0x35d647(0x1bc)]||{},Object[_0x35d647(0x1b1)](_0x326af0['headers'],{'X-Surge-Skip-Scripting':!0x1})),$httpClient[_0x35d647(0x16f)](_0x326af0,(_0x406dc5,_0x27106c,_0x2398a6)=>{const _0x15041d=_0x35d647;!_0x406dc5&&_0x27106c&&(_0x27106c[_0x15041d(0x19e)]=_0x2398a6,_0x27106c[_0x15041d(0x146)]=_0x27106c['status']),_0xbfde77(_0x406dc5,_0x27106c,_0x2398a6);});else{if(this[_0x35d647(0x197)]())_0x326af0['method']=_0x35d647(0x1a6),this[_0x35d647(0x12f)]&&(_0x326af0[_0x35d647(0x161)]=_0x326af0[_0x35d647(0x161)]||{},Object[_0x35d647(0x1b1)](_0x326af0['opts'],{'hints':!0x1})),$task[_0x35d647(0x1a4)](_0x326af0)['then'](_0x29b872=>{const {statusCode:_0x142f41,statusCode:_0x1b83de,headers:_0x2e1087,body:_0x2f894c}=_0x29b872;_0xbfde77(null,{'status':_0x142f41,'statusCode':_0x1b83de,'headers':_0x2e1087,'body':_0x2f894c},_0x2f894c);},_0x502dd8=>_0xbfde77(_0x502dd8));else{if(this[_0x35d647(0x15c)]()){this['initGotEnv'](_0x326af0);const {url:_0xd5b02d,..._0x3e9d8a}=_0x326af0;this[_0x35d647(0x1ae)]['post'](_0xd5b02d,_0x3e9d8a)[_0x35d647(0x16b)](_0x56b628=>{const {statusCode:_0x1f2175,statusCode:_0x340d9f,headers:_0x235bec,body:_0x47a464}=_0x56b628;_0xbfde77(null,{'status':_0x1f2175,'statusCode':_0x340d9f,'headers':_0x235bec,'body':_0x47a464},_0x47a464);},_0x1f164=>{const {message:_0x3b5a76,response:_0x740a68}=_0x1f164;_0xbfde77(_0x3b5a76,_0x740a68,_0x740a68&&_0x740a68['body']);});}}}}['time'](_0x5eae88){const _0x31d517=_0x3bbf7a;let _0x3e758e={'M+':new Date()[_0x31d517(0x15a)]()+0x1,'d+':new Date()[_0x31d517(0x1a5)](),'H+':new Date()[_0x31d517(0x12e)](),'m+':new Date()[_0x31d517(0x165)](),'s+':new Date()[_0x31d517(0x1be)](),'q+':Math[_0x31d517(0x199)]((new Date()[_0x31d517(0x15a)]()+0x3)/0x3),'S':new Date()[_0x31d517(0x190)]()};/(y+)/['test'](_0x5eae88)&&(_0x5eae88=_0x5eae88[_0x31d517(0x187)](RegExp['$1'],(new Date()['getFullYear']()+'')[_0x31d517(0x179)](0x4-RegExp['$1'][_0x31d517(0x135)])));for(let _0x28e026 in _0x3e758e)new RegExp('('+_0x28e026+')')[_0x31d517(0x194)](_0x5eae88)&&(_0x5eae88=_0x5eae88[_0x31d517(0x187)](RegExp['$1'],0x1==RegExp['$1'][_0x31d517(0x135)]?_0x3e758e[_0x28e026]:('00'+_0x3e758e[_0x28e026])[_0x31d517(0x179)]((''+_0x3e758e[_0x28e026])[_0x31d517(0x135)])));return _0x5eae88;}['msg'](_0x4bac0c=_0x29f4cb,_0x3be4b4='',_0x3a49bd='',_0x57c91d){const _0x354e4f=_0x3bbf7a,_0x3158ba=_0x17e1fe=>{const _0x558101=_0x53fc;if(!_0x17e1fe)return _0x17e1fe;if(_0x558101(0x149)==typeof _0x17e1fe)return this[_0x558101(0x1a2)]()?_0x17e1fe:this['isQuanX']()?{'open-url':_0x17e1fe}:this[_0x558101(0x185)]()?{'url':_0x17e1fe}:void 0x0;if(_0x558101(0x1b0)==typeof _0x17e1fe){if(this['isLoon']()){let _0x2dd92f=_0x17e1fe[_0x558101(0x174)]||_0x17e1fe[_0x558101(0x145)]||_0x17e1fe[_0x558101(0x136)],_0x38b871=_0x17e1fe[_0x558101(0x132)]||_0x17e1fe[_0x558101(0x191)];return{'openUrl':_0x2dd92f,'mediaUrl':_0x38b871};}if(this['isQuanX']()){let _0x1bcc93=_0x17e1fe[_0x558101(0x136)]||_0x17e1fe[_0x558101(0x145)]||_0x17e1fe[_0x558101(0x174)],_0x177e11=_0x17e1fe[_0x558101(0x191)]||_0x17e1fe[_0x558101(0x132)];return{'open-url':_0x1bcc93,'media-url':_0x177e11};}if(this['isSurge']()){let _0x51349d=_0x17e1fe['url']||_0x17e1fe[_0x558101(0x174)]||_0x17e1fe[_0x558101(0x136)];return{'url':_0x51349d};}}};this[_0x354e4f(0x16c)]||(this['isSurge']()||this[_0x354e4f(0x1a2)]()?$notification[_0x354e4f(0x16f)](_0x4bac0c,_0x3be4b4,_0x3a49bd,_0x3158ba(_0x57c91d)):this[_0x354e4f(0x197)]()&&$notify(_0x4bac0c,_0x3be4b4,_0x3a49bd,_0x3158ba(_0x57c91d)));let _0x162792=['',_0x354e4f(0x166)];_0x162792[_0x354e4f(0x15f)](_0x4bac0c),_0x3be4b4&&_0x162792[_0x354e4f(0x15f)](_0x3be4b4),_0x3a49bd&&_0x162792[_0x354e4f(0x15f)](_0x3a49bd),console[_0x354e4f(0x1b6)](_0x162792['join']('\x0a')),this['logs']=this[_0x354e4f(0x17b)]['concat'](_0x162792);}[_0x3bbf7a(0x1b6)](..._0xee0968){const _0x41de58=_0x3bbf7a;_0xee0968[_0x41de58(0x135)]>0x0&&(this[_0x41de58(0x17b)]=[...this[_0x41de58(0x17b)],..._0xee0968]),console[_0x41de58(0x1b6)](_0xee0968[_0x41de58(0x19c)](this['logSeparator']));}[_0x3bbf7a(0x14b)](_0x3c154d,_0x20527b){const _0x3914db=_0x3bbf7a,_0x4c5478=!this[_0x3914db(0x185)]()&&!this['isQuanX']()&&!this[_0x3914db(0x1a2)]();_0x4c5478?this['log']('','❗️'+this[_0x3914db(0x134)]+_0x3914db(0x138),_0x3c154d[_0x3914db(0x14c)]):this[_0x3914db(0x1b6)]('','❗️'+this[_0x3914db(0x134)]+_0x3914db(0x138),_0x3c154d);}[_0x3bbf7a(0x181)](_0x506825){return new Promise(_0x6b71ba=>setTimeout(_0x6b71ba,_0x506825));}[_0x3bbf7a(0x143)](_0x585575={}){const _0x3f4275=_0x3bbf7a,_0x1a4b29=new Date()[_0x3f4275(0x14e)](),_0x45bdec=(_0x1a4b29-this[_0x3f4275(0x1c0)])/0x3e8;this[_0x3f4275(0x1b6)]('','🔔'+this[_0x3f4275(0x134)]+_0x3f4275(0x18e)+_0x45bdec+'\x20秒'),this['log'](),(this['isSurge']()||this[_0x3f4275(0x197)]()||this['isLoon']())&&$done(_0x585575);}}(_0x29f4cb,_0x5e1090);} 10 | -------------------------------------------------------------------------------- /ddxpgetsale.js: -------------------------------------------------------------------------------- 1 | /* 2 | 叮咚获取当前折扣商品 3 | [task_local] 4 | 0 9-23 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpautoeval.js, tag=叮咚获取当前折扣商品, enabled=true 5 | 配置变量 ddxpzk="供港壹号鲜牛奶@纯悦&9.9" 6 | */ 7 | 8 | const $ = new Env('叮咚获取当前折扣商品'); 9 | const notify = $.isNode() ? require('./sendNotify') : null; 10 | const dr = "@" 11 | const dr2 = "&" 12 | let ddxpurlArr = [], 13 | ddxphdArr = [], 14 | ddxpcount = '' 15 | let time = Math.round(Date.now() / 1000) 16 | let ddxpurl = $.getdata('ddxpurl') 17 | let ddxphd = $.getdata('ddxphd') 18 | let ddxpzk = $.getdata('ddxpzk') 19 | let keyword = "" 20 | let sale = "" 21 | 22 | let uid = "" 23 | let latitude = "" 24 | let longitude = "" 25 | let station_id = "" 26 | 27 | let saleArr = "特价列表" 28 | !(async () => { 29 | ddxpurlArr = ($.getdata('ddxpurl') || "").split(dr) 30 | ddxphdArr = ($.getdata('ddxphd') || "").split(dr) 31 | ddxpzkArr = ($.getdata('ddxpzk') || "").split(dr) 32 | 33 | if ($.getdata('ddxpzk')) { 34 | console.log(`------------- 共${ddxpzkArr.length}个商品-------------\n`) 35 | getUrl(ddxpurlArr[0]) 36 | ddxphd = ddxphdArr[0]; 37 | for (let i = 0; i < ddxpzkArr.length; i++) { 38 | if (ddxphdArr[0]) { 39 | let v = ddxpzkArr[i].split(dr2) 40 | keyword = v[0] 41 | sale = v[1] == null ? 0 : +v[1] 42 | 43 | $.index = i + 1; 44 | console.log(`\n开始【叮咚判断折扣${$.index}】`) 45 | await ddxpSale(); 46 | } 47 | } 48 | if (saleArr != "特价列表") { 49 | $.msg($.name, "", saleArr) 50 | if (notify) notify.sendNotify($.name, saleArr) 51 | } 52 | } 53 | })() 54 | .catch((e) => $.logErr(e)) 55 | .finally(() => $.done()) 56 | 57 | /** 58 | * 共用header 59 | */ 60 | function pubHeader() { 61 | return { 62 | 'accept': '*/*', 63 | 'cookie': ddxphd, 64 | 'accept-language': 'zh-cn', 65 | 'user-agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.35.1 station_id/${station_id}`, 66 | 'accept-encoding': 'gzip, deflate, br' 67 | } 68 | } 69 | 70 | function getUrl(ddxpurl) { 71 | let url = ddxpurl.split("?") 72 | let ddxpurls = url[url.length - 1].split("&") 73 | let sendInfo = {} 74 | for (const val of ddxpurls) { 75 | let vals = val.split("&") 76 | for (const val1 of vals) { 77 | let kv = val1.split("=") 78 | sendInfo[kv[0]] = kv[1] 79 | } 80 | } 81 | uid = sendInfo["uid"] 82 | latitude = sendInfo["latitude"] 83 | longitude = sendInfo["longitude"] 84 | station_id = sendInfo["station_id"] 85 | } 86 | 87 | //获取折扣 88 | function ddxpSale(timeout = 0) { 89 | return new Promise((resolve) => { 90 | let header = pubHeader() 91 | let url = { 92 | url: `https://maicai.api.ddxq.mobi/search/searchProduct?app_client_id=1&countryCode=HK&keyword=${keyword}&page=1&station_id=${station_id}`, 93 | headers: header, 94 | } 95 | console.log(keyword,station_id) 96 | $.get(url, async (err, resp, data) => { 97 | try { 98 | const result = JSON.parse(data) 99 | if (result.code == 0) { 100 | for (const val of result.data.product_list) { 101 | console.log(sale == 0 , val.price <= sale , val.name.indexOf(keyword) > -1 , val.stock_number > 0) 102 | if (val.name.indexOf(keyword) > -1 && val.stock_number > 0) { 103 | if (+val.price < +val.origin_price) { 104 | if (sale == 0 || val.price <= sale) 105 | saleArr += `${val.name}\n原价${val.origin_price}现:${val.price}\n` 106 | } else if (val.vip_price != null && val.vip_price != "" && +val.vip_price < +val.origin_price) { 107 | if (sale == 0 || val.vip_price <= sale) 108 | saleArr += `${val.name}\n原价${val.origin_price} 现vip:${val.vip_price}\n` 109 | } 110 | break; 111 | } 112 | } 113 | } else { 114 | console.log(result) 115 | } 116 | } catch (e) { 117 | //$.logErr(e, resp); 118 | } finally { 119 | resolve() 120 | } 121 | }, timeout) 122 | }) 123 | } 124 | 125 | function sendsale(timeout = 0) { 126 | return new Promise((resolve) => { 127 | // let header = pubHeader() 128 | let url = { 129 | url: `http://www.pushplus.plus/send`, 130 | headers: { 131 | 'accept': '*/*', 132 | }, 133 | body: { 134 | "token": '625fa950d66e4bd2bc0d8d949bf8b819', 135 | "title": $.name, 136 | "content": saleArr, 137 | "template": 'txt' 138 | } 139 | } 140 | 141 | $.post(url, async (err, resp, data) => { 142 | try { 143 | const result = JSON.parse(data) 144 | console.log(data) 145 | } catch (e) { 146 | //$.logErr(e, resp); 147 | } finally { 148 | resolve() 149 | } 150 | }, timeout) 151 | }) 152 | } 153 | 154 | function Env(t, e) { 155 | class s { 156 | constructor(t) { 157 | this.env = t 158 | } 159 | 160 | send(t, e = "GET") { 161 | t = "string" == typeof t ? { 162 | url: t 163 | } : t; 164 | let s = this.get; 165 | return "POST" === e && (s = this.post), new Promise((e, i) => { 166 | s.call(this, t, (t, s, r) => { 167 | t ? i(t) : e(s) 168 | }) 169 | }) 170 | } 171 | 172 | get(t) { 173 | return this.send.call(this.env, t) 174 | } 175 | 176 | post(t) { 177 | return this.send.call(this.env, t, "POST") 178 | } 179 | } 180 | 181 | return new class { 182 | constructor(t, e) { 183 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) 184 | } 185 | 186 | isNode() { 187 | return "undefined" != typeof module && !!module.exports 188 | } 189 | 190 | isQuanX() { 191 | return "undefined" != typeof $task 192 | } 193 | 194 | isSurge() { 195 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 196 | } 197 | 198 | isLoon() { 199 | return "undefined" != typeof $loon 200 | } 201 | 202 | toObj(t, e = null) { 203 | try { 204 | return JSON.parse(t) 205 | } catch { 206 | return e 207 | } 208 | } 209 | 210 | toStr(t, e = null) { 211 | try { 212 | return JSON.stringify(t) 213 | } catch { 214 | return e 215 | } 216 | } 217 | 218 | getjson(t, e) { 219 | let s = e; 220 | const i = this.getdata(t); 221 | if (i) try { 222 | s = JSON.parse(this.getdata(t)) 223 | } catch { 224 | } 225 | return s 226 | } 227 | 228 | setjson(t, e) { 229 | try { 230 | return this.setdata(JSON.stringify(t), e) 231 | } catch { 232 | return !1 233 | } 234 | } 235 | 236 | getScript(t) { 237 | return new Promise(e => { 238 | this.get({ 239 | url: t 240 | }, (t, s, i) => e(i)) 241 | }) 242 | } 243 | 244 | runScript(t, e) { 245 | return new Promise(s => { 246 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 247 | i = i ? i.replace(/\n/g, "").trim() : i; 248 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 249 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; 250 | const [o, h] = i.split("@"), a = { 251 | url: `http://${h}/v1/scripting/evaluate`, 252 | body: { 253 | script_text: t, 254 | mock_type: "cron", 255 | timeout: r 256 | }, 257 | headers: { 258 | "X-Key": o, 259 | Accept: "*/*" 260 | } 261 | }; 262 | this.post(a, (t, e, i) => s(i)) 263 | }).catch(t => this.logErr(t)) 264 | } 265 | 266 | loaddata() { 267 | if (!this.isNode()) return {}; 268 | { 269 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 270 | const t = this.path.resolve(this.dataFile), 271 | e = this.path.resolve(process.cwd(), this.dataFile), 272 | s = this.fs.existsSync(t), 273 | i = !s && this.fs.existsSync(e); 274 | if (!s && !i) return {}; 275 | { 276 | const i = s ? t : e; 277 | try { 278 | return JSON.parse(this.fs.readFileSync(i)) 279 | } catch (t) { 280 | return {} 281 | } 282 | } 283 | } 284 | } 285 | 286 | writedata() { 287 | if (this.isNode()) { 288 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 289 | const t = this.path.resolve(this.dataFile), 290 | e = this.path.resolve(process.cwd(), this.dataFile), 291 | s = this.fs.existsSync(t), 292 | i = !s && this.fs.existsSync(e), 293 | r = JSON.stringify(this.data); 294 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 295 | } 296 | } 297 | 298 | lodash_get(t, e, s) { 299 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 300 | let r = t; 301 | for (const t of i) 302 | if (r = Object(r)[t], void 0 === r) return s; 303 | return r 304 | } 305 | 306 | lodash_set(t, e, s) { 307 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) 308 | } 309 | 310 | getdata(t) { 311 | let e = this.getval(t); 312 | if (/^@/.test(t)) { 313 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; 314 | if (r) try { 315 | const t = JSON.parse(r); 316 | e = t ? this.lodash_get(t, i, "") : e 317 | } catch (t) { 318 | e = "" 319 | } 320 | } 321 | return e 322 | } 323 | 324 | setdata(t, e) { 325 | let s = !1; 326 | if (/^@/.test(e)) { 327 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), 328 | h = i ? "null" === o ? null : o || "{}" : "{}"; 329 | try { 330 | const e = JSON.parse(h); 331 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) 332 | } catch (e) { 333 | const o = {}; 334 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) 335 | } 336 | } else s = this.setval(t, e); 337 | return s 338 | } 339 | 340 | getval(t) { 341 | if (this.isNode()) { 342 | return process.env[t] 343 | } else { 344 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null 345 | } 346 | } 347 | 348 | setval(t, e) { 349 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null 350 | } 351 | 352 | initGotEnv(t) { 353 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 354 | } 355 | 356 | get(t, e = (() => { 357 | })) { 358 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 359 | "X-Surge-Skip-Scripting": !1 360 | })), $httpClient.get(t, (t, s, i) => { 361 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 362 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 363 | hints: !1 364 | })), $task.fetch(t).then(t => { 365 | const { 366 | statusCode: s, 367 | statusCode: i, 368 | headers: r, 369 | body: o 370 | } = t; 371 | e(null, { 372 | status: s, 373 | statusCode: i, 374 | headers: r, 375 | body: o 376 | }, o) 377 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 378 | try { 379 | if (t.headers["set-cookie"]) { 380 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 381 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar 382 | } 383 | } catch (t) { 384 | this.logErr(t) 385 | } 386 | }).then(t => { 387 | const { 388 | statusCode: s, 389 | statusCode: i, 390 | headers: r, 391 | body: o 392 | } = t; 393 | e(null, { 394 | status: s, 395 | statusCode: i, 396 | headers: r, 397 | body: o 398 | }, o) 399 | }, t => { 400 | const { 401 | message: s, 402 | response: i 403 | } = t; 404 | e(s, i, i && i.body) 405 | })) 406 | } 407 | 408 | post(t, e = (() => { 409 | })) { 410 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 411 | "X-Surge-Skip-Scripting": !1 412 | })), $httpClient.post(t, (t, s, i) => { 413 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 414 | }); 415 | else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 416 | hints: !1 417 | })), $task.fetch(t).then(t => { 418 | const { 419 | statusCode: s, 420 | statusCode: i, 421 | headers: r, 422 | body: o 423 | } = t; 424 | e(null, { 425 | status: s, 426 | statusCode: i, 427 | headers: r, 428 | body: o 429 | }, o) 430 | }, t => e(t)); 431 | else if (this.isNode()) { 432 | this.initGotEnv(t); 433 | const { 434 | url: s, 435 | ...i 436 | } = t; 437 | this.got.post(s, i).then(t => { 438 | const { 439 | statusCode: s, 440 | statusCode: i, 441 | headers: r, 442 | body: o 443 | } = t; 444 | e(null, { 445 | status: s, 446 | statusCode: i, 447 | headers: r, 448 | body: o 449 | }, o) 450 | }, t => { 451 | const { 452 | message: s, 453 | response: i 454 | } = t; 455 | e(s, i, i && i.body) 456 | }) 457 | } 458 | } 459 | 460 | time(t) { 461 | let e = { 462 | "M+": (new Date).getMonth() + 1, 463 | "d+": (new Date).getDate(), 464 | "H+": (new Date).getHours(), 465 | "m+": (new Date).getMinutes(), 466 | "s+": (new Date).getSeconds(), 467 | "q+": Math.floor(((new Date).getMonth() + 3) / 3), 468 | S: (new Date).getMilliseconds() 469 | }; 470 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); 471 | for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); 472 | return t 473 | } 474 | 475 | msg(e = t, s = "", i = "", r) { 476 | const o = t => { 477 | if (!t) return t; 478 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { 479 | "open-url": t 480 | } : this.isSurge() ? { 481 | url: t 482 | } : void 0; 483 | if ("object" == typeof t) { 484 | if (this.isLoon()) { 485 | let e = t.openUrl || t.url || t["open-url"], 486 | s = t.mediaUrl || t["media-url"]; 487 | return { 488 | openUrl: e, 489 | mediaUrl: s 490 | } 491 | } 492 | if (this.isQuanX()) { 493 | let e = t["open-url"] || t.url || t.openUrl, 494 | s = t["media-url"] || t.mediaUrl; 495 | return { 496 | "open-url": e, 497 | "media-url": s 498 | } 499 | } 500 | if (this.isSurge()) { 501 | let e = t.url || t.openUrl || t["open-url"]; 502 | return { 503 | url: e 504 | } 505 | } 506 | } 507 | }; 508 | 509 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); 510 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; 511 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) 512 | } 513 | 514 | log(...t) { 515 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) 516 | } 517 | 518 | logErr(t, e) { 519 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 520 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) 521 | } 522 | 523 | wait(t) { 524 | return new Promise(e => setTimeout(e, t)) 525 | } 526 | 527 | done(t = {}) { 528 | const e = (new Date).getTime(), 529 | s = (e - this.startTime) / 1e3; 530 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 531 | } 532 | }(t, e) 533 | } 534 | 535 | -------------------------------------------------------------------------------- /ddxpsign.js: -------------------------------------------------------------------------------- 1 | /* 2 | 叮咚每日签到积分 3 | [task_local] 4 | 1 0 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpsign.js, tag=叮咚每日签到积分, enabled=true 5 | */ 6 | 7 | const $ = new Env('叮咚每日签到积分'); 8 | const dr = "@" 9 | let ddxpurlArr = [], 10 | ddxphdArr = [], 11 | ddxpcount = '' 12 | let time = Math.round(Date.now() / 1000) 13 | let ddxpurl = $.getdata('ddxpurl') 14 | let ddxphd = $.getdata('ddxphd') 15 | !(async () => { 16 | ddxpurlArr = (ddxpurl || "").split(dr) 17 | ddxphdArr = (ddxphd || "").split(dr) 18 | 19 | console.log(`------------- 共${ddxphdArr.length}个账号-------------\n`) 20 | for (let i = 0; i < ddxphdArr.length; i++) { 21 | if (ddxphdArr[i]) { 22 | getUrl(ddxpurlArr[i]) 23 | ddxphd = ddxphdArr[i]; 24 | 25 | $.index = i + 1; 26 | console.log(`\n开始【叮咚签到${$.index}】`) 27 | await ddxpqd(); 28 | } 29 | } 30 | })() 31 | .catch((e) => $.logErr(e)) 32 | .finally(() => $.done()) 33 | 34 | 35 | /** 36 | * 共用header 37 | */ 38 | function pubHeader() { 39 | return { 40 | 'accept': '*/*', 41 | 'cookie': ddxphd, 42 | 'accept-language': 'zh-cn', 43 | 'user-agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.35.1 station_id/${station_id}`, 44 | 'accept-encoding': 'gzip, deflate, br' 45 | } 46 | } 47 | 48 | uid = "" 49 | latitude = "" 50 | longitude = "" 51 | station_id = "" 52 | userTaskLogId = "" 53 | userTasks = [] 54 | 55 | function getUrl(ddxpurl) { 56 | let url = ddxpurl.split("?") 57 | let ddxpurls = url[url.length - 1].split("&") 58 | let sendInfo = {} 59 | for (const val of ddxpurls) { 60 | let vals = val.split("&") 61 | for (const val1 of vals) { 62 | let kv = val1.split("=") 63 | sendInfo[kv[0]] = kv[1] 64 | } 65 | } 66 | uid = sendInfo["uid"] 67 | latitude = sendInfo["latitude"] 68 | longitude = sendInfo["longitude"] 69 | station_id = sendInfo["station_id"] 70 | } 71 | 72 | //积分签到 73 | function ddxpqd(timeout = 0) { 74 | return new Promise((resolve) => { 75 | let header = pubHeader() 76 | header["origin"] = "https://activity.m.ddxq.mobi" 77 | header["referer"] = "https://activity.m.ddxq.mobi/" 78 | let url = { 79 | url: `https://sunquan.api.ddxq.mobi/api/v2/user/signin/`, 80 | headers: header, 81 | body: { 82 | api_version: "9.7.3", 83 | app_version: "1.0.0", 84 | app_client_id: 3, 85 | station_id: station_id, 86 | native_version: "9.36.2", 87 | city_number: 1103, 88 | latitude: latitude, 89 | longitude: longitude, 90 | } 91 | } 92 | 93 | if($.isNode()) { 94 | url.body = `api_version=9.7.3&app_version=1.0.0&app_client_id=3&station_id=${station_id}&native_version=9.36.2&city_number=1103&latitude=${latitude}&longitude=${longitude}` 95 | } 96 | 97 | $.post(url, async (err, resp, data) => { 98 | try { 99 | const result = JSON.parse(data) 100 | if (result.success) { 101 | console.log('\n积分签到: 成功') 102 | } else { 103 | console.log(result) 104 | } 105 | } catch (e) { 106 | //$.logErr(e, resp); 107 | } finally { 108 | resolve() 109 | } 110 | }, timeout) 111 | }) 112 | } 113 | 114 | function Env(t, e) { 115 | class s { 116 | constructor(t) { 117 | this.env = t 118 | } 119 | 120 | send(t, e = "GET") { 121 | t = "string" == typeof t ? { 122 | url: t 123 | } : t; 124 | let s = this.get; 125 | return "POST" === e && (s = this.post), new Promise((e, i) => { 126 | s.call(this, t, (t, s, r) => { 127 | t ? i(t) : e(s) 128 | }) 129 | }) 130 | } 131 | 132 | get(t) { 133 | return this.send.call(this.env, t) 134 | } 135 | 136 | post(t) { 137 | return this.send.call(this.env, t, "POST") 138 | } 139 | } 140 | 141 | return new class { 142 | constructor(t, e) { 143 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) 144 | } 145 | 146 | isNode() { 147 | return "undefined" != typeof module && !!module.exports 148 | } 149 | 150 | isQuanX() { 151 | return "undefined" != typeof $task 152 | } 153 | 154 | isSurge() { 155 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 156 | } 157 | 158 | isLoon() { 159 | return "undefined" != typeof $loon 160 | } 161 | 162 | toObj(t, e = null) { 163 | try { 164 | return JSON.parse(t) 165 | } catch { 166 | return e 167 | } 168 | } 169 | 170 | toStr(t, e = null) { 171 | try { 172 | return JSON.stringify(t) 173 | } catch { 174 | return e 175 | } 176 | } 177 | 178 | getjson(t, e) { 179 | let s = e; 180 | const i = this.getdata(t); 181 | if (i) try { 182 | s = JSON.parse(this.getdata(t)) 183 | } catch { 184 | } 185 | return s 186 | } 187 | 188 | setjson(t, e) { 189 | try { 190 | return this.setdata(JSON.stringify(t), e) 191 | } catch { 192 | return !1 193 | } 194 | } 195 | 196 | getScript(t) { 197 | return new Promise(e => { 198 | this.get({ 199 | url: t 200 | }, (t, s, i) => e(i)) 201 | }) 202 | } 203 | 204 | runScript(t, e) { 205 | return new Promise(s => { 206 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 207 | i = i ? i.replace(/\n/g, "").trim() : i; 208 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 209 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; 210 | const [o, h] = i.split("@"), a = { 211 | url: `http://${h}/v1/scripting/evaluate`, 212 | body: { 213 | script_text: t, 214 | mock_type: "cron", 215 | timeout: r 216 | }, 217 | headers: { 218 | "X-Key": o, 219 | Accept: "*/*" 220 | } 221 | }; 222 | this.post(a, (t, e, i) => s(i)) 223 | }).catch(t => this.logErr(t)) 224 | } 225 | 226 | loaddata() { 227 | if (!this.isNode()) return {}; 228 | { 229 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 230 | const t = this.path.resolve(this.dataFile), 231 | e = this.path.resolve(process.cwd(), this.dataFile), 232 | s = this.fs.existsSync(t), 233 | i = !s && this.fs.existsSync(e); 234 | if (!s && !i) return {}; 235 | { 236 | const i = s ? t : e; 237 | try { 238 | return JSON.parse(this.fs.readFileSync(i)) 239 | } catch (t) { 240 | return {} 241 | } 242 | } 243 | } 244 | } 245 | 246 | writedata() { 247 | if (this.isNode()) { 248 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 249 | const t = this.path.resolve(this.dataFile), 250 | e = this.path.resolve(process.cwd(), this.dataFile), 251 | s = this.fs.existsSync(t), 252 | i = !s && this.fs.existsSync(e), 253 | r = JSON.stringify(this.data); 254 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 255 | } 256 | } 257 | 258 | lodash_get(t, e, s) { 259 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 260 | let r = t; 261 | for (const t of i) 262 | if (r = Object(r)[t], void 0 === r) return s; 263 | return r 264 | } 265 | 266 | lodash_set(t, e, s) { 267 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) 268 | } 269 | 270 | getdata(t) { 271 | let e = this.getval(t); 272 | if (/^@/.test(t)) { 273 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; 274 | if (r) try { 275 | const t = JSON.parse(r); 276 | e = t ? this.lodash_get(t, i, "") : e 277 | } catch (t) { 278 | e = "" 279 | } 280 | } 281 | return e 282 | } 283 | 284 | setdata(t, e) { 285 | let s = !1; 286 | if (/^@/.test(e)) { 287 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), 288 | h = i ? "null" === o ? null : o || "{}" : "{}"; 289 | try { 290 | const e = JSON.parse(h); 291 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) 292 | } catch (e) { 293 | const o = {}; 294 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) 295 | } 296 | } else s = this.setval(t, e); 297 | return s 298 | } 299 | 300 | getval(t) { 301 | if (this.isNode()) { 302 | return process.env[t] 303 | } else { 304 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null 305 | } 306 | } 307 | 308 | setval(t, e) { 309 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null 310 | } 311 | 312 | initGotEnv(t) { 313 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 314 | } 315 | 316 | get(t, e = (() => { 317 | })) { 318 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 319 | "X-Surge-Skip-Scripting": !1 320 | })), $httpClient.get(t, (t, s, i) => { 321 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 322 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 323 | hints: !1 324 | })), $task.fetch(t).then(t => { 325 | const { 326 | statusCode: s, 327 | statusCode: i, 328 | headers: r, 329 | body: o 330 | } = t; 331 | e(null, { 332 | status: s, 333 | statusCode: i, 334 | headers: r, 335 | body: o 336 | }, o) 337 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 338 | try { 339 | if (t.headers["set-cookie"]) { 340 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 341 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar 342 | } 343 | } catch (t) { 344 | this.logErr(t) 345 | } 346 | }).then(t => { 347 | const { 348 | statusCode: s, 349 | statusCode: i, 350 | headers: r, 351 | body: o 352 | } = t; 353 | e(null, { 354 | status: s, 355 | statusCode: i, 356 | headers: r, 357 | body: o 358 | }, o) 359 | }, t => { 360 | const { 361 | message: s, 362 | response: i 363 | } = t; 364 | e(s, i, i && i.body) 365 | })) 366 | } 367 | 368 | post(t, e = (() => { 369 | })) { 370 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 371 | "X-Surge-Skip-Scripting": !1 372 | })), $httpClient.post(t, (t, s, i) => { 373 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 374 | }); 375 | else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 376 | hints: !1 377 | })), $task.fetch(t).then(t => { 378 | const { 379 | statusCode: s, 380 | statusCode: i, 381 | headers: r, 382 | body: o 383 | } = t; 384 | e(null, { 385 | status: s, 386 | statusCode: i, 387 | headers: r, 388 | body: o 389 | }, o) 390 | }, t => e(t)); 391 | else if (this.isNode()) { 392 | this.initGotEnv(t); 393 | const { 394 | url: s, 395 | ...i 396 | } = t; 397 | this.got.post(s, i).then(t => { 398 | const { 399 | statusCode: s, 400 | statusCode: i, 401 | headers: r, 402 | body: o 403 | } = t; 404 | e(null, { 405 | status: s, 406 | statusCode: i, 407 | headers: r, 408 | body: o 409 | }, o) 410 | }, t => { 411 | const { 412 | message: s, 413 | response: i 414 | } = t; 415 | e(s, i, i && i.body) 416 | }) 417 | } 418 | } 419 | 420 | time(t) { 421 | let e = { 422 | "M+": (new Date).getMonth() + 1, 423 | "d+": (new Date).getDate(), 424 | "H+": (new Date).getHours(), 425 | "m+": (new Date).getMinutes(), 426 | "s+": (new Date).getSeconds(), 427 | "q+": Math.floor(((new Date).getMonth() + 3) / 3), 428 | S: (new Date).getMilliseconds() 429 | }; 430 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); 431 | for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); 432 | return t 433 | } 434 | 435 | msg(e = t, s = "", i = "", r) { 436 | const o = t => { 437 | if (!t) return t; 438 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { 439 | "open-url": t 440 | } : this.isSurge() ? { 441 | url: t 442 | } : void 0; 443 | if ("object" == typeof t) { 444 | if (this.isLoon()) { 445 | let e = t.openUrl || t.url || t["open-url"], 446 | s = t.mediaUrl || t["media-url"]; 447 | return { 448 | openUrl: e, 449 | mediaUrl: s 450 | } 451 | } 452 | if (this.isQuanX()) { 453 | let e = t["open-url"] || t.url || t.openUrl, 454 | s = t["media-url"] || t.mediaUrl; 455 | return { 456 | "open-url": e, 457 | "media-url": s 458 | } 459 | } 460 | if (this.isSurge()) { 461 | let e = t.url || t.openUrl || t["open-url"]; 462 | return { 463 | url: e 464 | } 465 | } 466 | } 467 | }; 468 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); 469 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; 470 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) 471 | } 472 | 473 | log(...t) { 474 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) 475 | } 476 | 477 | logErr(t, e) { 478 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 479 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) 480 | } 481 | 482 | wait(t) { 483 | return new Promise(e => setTimeout(e, t)) 484 | } 485 | 486 | done(t = {}) { 487 | const e = (new Date).getTime(), 488 | s = (e - this.startTime) / 1e3; 489 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 490 | } 491 | }(t, e) 492 | } 493 | -------------------------------------------------------------------------------- /ddxptime.js: -------------------------------------------------------------------------------- 1 | /* 2 | 叮咚买菜准点签到 3 | [task_local] 4 | 1 7,10,16 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxptime.js, tag=叮咚买菜准点签到, enabled=true 5 | */ 6 | 7 | 8 | const $ = new Env('叮咚买菜准点签到'); 9 | const dr = "@" 10 | let ddxpurlArr = [], 11 | ddxphdArr = [], 12 | ddxpcount = '' 13 | let time = Math.round(Date.now() / 1000) 14 | let ddxpurl = $.getdata('ddxpurl') 15 | let ddxphd = $.getdata('ddxphd') 16 | !(async () => { 17 | ddxpurlArr = ($.getdata('ddxpurl') || "").split(dr) 18 | ddxphdArr = ($.getdata('ddxphd') || "").split(dr) 19 | 20 | console.log(`------------- 共${ddxphdArr.length}个账号-------------\n`) 21 | for (let i = 0; i < ddxphdArr.length; i++) { 22 | if (ddxphdArr[i]) { 23 | getUrl(ddxpurlArr[i]) 24 | ddxphd = ddxphdArr[i]; 25 | 26 | $.index = i + 1; 27 | console.log(`\n开始【叮咚准点签到${$.index}】`) 28 | await $.wait(10000); 29 | await ddxpyt1(); 30 | await $.wait(10000); 31 | await ddxpyt2(); 32 | } 33 | } 34 | })() 35 | .catch((e) => $.logErr(e)) 36 | .finally(() => $.done()) 37 | 38 | /** 39 | * 共用header 40 | */ 41 | function pubHeader() { 42 | return { 43 | 'accept': '*/*', 44 | 'cookie': ddxphd, 45 | 'accept-language': 'zh-cn', 46 | 'user-agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.35.1 station_id/${station_id}`, 47 | 'accept-encoding': 'gzip, deflate, br' 48 | } 49 | } 50 | 51 | uid = "" 52 | latitude = "" 53 | longitude = "" 54 | station_id = "" 55 | 56 | function getUrl(ddxpurl) { 57 | let url = ddxpurl.split("?") 58 | let ddxpurls = url[url.length - 1].split("&") 59 | let sendInfo = {} 60 | for (const val of ddxpurls) { 61 | let vals = val.split("&") 62 | for (const val1 of vals) { 63 | let kv = val1.split("=") 64 | sendInfo[kv[0]] = kv[1] 65 | } 66 | } 67 | uid = sendInfo["uid"] 68 | latitude = sendInfo["latitude"] 69 | longitude = sendInfo["longitude"] 70 | station_id = sendInfo["station_id"] 71 | } 72 | 73 | //鱼塘准点 74 | function ddxpyt1(timeout = 0) { 75 | return new Promise((resolve) => { 76 | let header = pubHeader() 77 | header["origin"] = "https://game.m.ddxq.mobi" 78 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 79 | let url = { 80 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&taskCode=LOTTERY`, 81 | headers: header, 82 | } 83 | 84 | $.get(url, async (err, resp, data) => { 85 | try { 86 | const result = JSON.parse(data) 87 | if (result.code == 0) { 88 | console.log('\n鱼塘准点签到: ' + result.msg) 89 | } else { 90 | console.log(result) 91 | } 92 | } catch (e) { 93 | //$.logErr(e, resp); 94 | } finally { 95 | resolve() 96 | } 97 | }, timeout) 98 | }) 99 | } 100 | 101 | //果园准点 102 | function ddxpyt2(timeout = 0) { 103 | return new Promise((resolve) => { 104 | let header = pubHeader() 105 | header["origin"] = "https://game.m.ddxq.mobi" 106 | header["ddmc-game-tid"] = "2" 107 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 108 | let url = { 109 | url: `https://farm.api.ddxq.mobi/api/v2/task/achieve?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&taskCode=LOTTERY`, 110 | headers: header, 111 | } 112 | 113 | $.get(url, async (err, resp, data) => { 114 | try { 115 | const result = JSON.parse(data) 116 | if (result.code == 0) { 117 | console.log('\n果园准点签到: ' + result.msg) 118 | } else { 119 | console.log(result) 120 | } 121 | } catch (e) { 122 | //$.logErr(e, resp); 123 | } finally { 124 | resolve() 125 | } 126 | }, timeout) 127 | }) 128 | } 129 | 130 | function Env(t, e) { 131 | class s { 132 | constructor(t) { 133 | this.env = t 134 | } 135 | 136 | send(t, e = "GET") { 137 | t = "string" == typeof t ? { 138 | url: t 139 | } : t; 140 | let s = this.get; 141 | return "POST" === e && (s = this.post), new Promise((e, i) => { 142 | s.call(this, t, (t, s, r) => { 143 | t ? i(t) : e(s) 144 | }) 145 | }) 146 | } 147 | 148 | get(t) { 149 | return this.send.call(this.env, t) 150 | } 151 | 152 | post(t) { 153 | return this.send.call(this.env, t, "POST") 154 | } 155 | } 156 | 157 | return new class { 158 | constructor(t, e) { 159 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) 160 | } 161 | 162 | isNode() { 163 | return "undefined" != typeof module && !!module.exports 164 | } 165 | 166 | isQuanX() { 167 | return "undefined" != typeof $task 168 | } 169 | 170 | isSurge() { 171 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 172 | } 173 | 174 | isLoon() { 175 | return "undefined" != typeof $loon 176 | } 177 | 178 | toObj(t, e = null) { 179 | try { 180 | return JSON.parse(t) 181 | } catch { 182 | return e 183 | } 184 | } 185 | 186 | toStr(t, e = null) { 187 | try { 188 | return JSON.stringify(t) 189 | } catch { 190 | return e 191 | } 192 | } 193 | 194 | getjson(t, e) { 195 | let s = e; 196 | const i = this.getdata(t); 197 | if (i) try { 198 | s = JSON.parse(this.getdata(t)) 199 | } catch { 200 | } 201 | return s 202 | } 203 | 204 | setjson(t, e) { 205 | try { 206 | return this.setdata(JSON.stringify(t), e) 207 | } catch { 208 | return !1 209 | } 210 | } 211 | 212 | getScript(t) { 213 | return new Promise(e => { 214 | this.get({ 215 | url: t 216 | }, (t, s, i) => e(i)) 217 | }) 218 | } 219 | 220 | runScript(t, e) { 221 | return new Promise(s => { 222 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 223 | i = i ? i.replace(/\n/g, "").trim() : i; 224 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 225 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; 226 | const [o, h] = i.split("@"), a = { 227 | url: `http://${h}/v1/scripting/evaluate`, 228 | body: { 229 | script_text: t, 230 | mock_type: "cron", 231 | timeout: r 232 | }, 233 | headers: { 234 | "X-Key": o, 235 | Accept: "*/*" 236 | } 237 | }; 238 | this.post(a, (t, e, i) => s(i)) 239 | }).catch(t => this.logErr(t)) 240 | } 241 | 242 | loaddata() { 243 | if (!this.isNode()) return {}; 244 | { 245 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 246 | const t = this.path.resolve(this.dataFile), 247 | e = this.path.resolve(process.cwd(), this.dataFile), 248 | s = this.fs.existsSync(t), 249 | i = !s && this.fs.existsSync(e); 250 | if (!s && !i) return {}; 251 | { 252 | const i = s ? t : e; 253 | try { 254 | return JSON.parse(this.fs.readFileSync(i)) 255 | } catch (t) { 256 | return {} 257 | } 258 | } 259 | } 260 | } 261 | 262 | writedata() { 263 | if (this.isNode()) { 264 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 265 | const t = this.path.resolve(this.dataFile), 266 | e = this.path.resolve(process.cwd(), this.dataFile), 267 | s = this.fs.existsSync(t), 268 | i = !s && this.fs.existsSync(e), 269 | r = JSON.stringify(this.data); 270 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 271 | } 272 | } 273 | 274 | lodash_get(t, e, s) { 275 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 276 | let r = t; 277 | for (const t of i) 278 | if (r = Object(r)[t], void 0 === r) return s; 279 | return r 280 | } 281 | 282 | lodash_set(t, e, s) { 283 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) 284 | } 285 | 286 | getdata(t) { 287 | let e = this.getval(t); 288 | if (/^@/.test(t)) { 289 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; 290 | if (r) try { 291 | const t = JSON.parse(r); 292 | e = t ? this.lodash_get(t, i, "") : e 293 | } catch (t) { 294 | e = "" 295 | } 296 | } 297 | return e 298 | } 299 | 300 | setdata(t, e) { 301 | let s = !1; 302 | if (/^@/.test(e)) { 303 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), 304 | h = i ? "null" === o ? null : o || "{}" : "{}"; 305 | try { 306 | const e = JSON.parse(h); 307 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) 308 | } catch (e) { 309 | const o = {}; 310 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) 311 | } 312 | } else s = this.setval(t, e); 313 | return s 314 | } 315 | 316 | getval(t) { 317 | if (this.isNode()) { 318 | return process.env[t] 319 | } else { 320 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null 321 | } 322 | } 323 | 324 | setval(t, e) { 325 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null 326 | } 327 | 328 | initGotEnv(t) { 329 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 330 | } 331 | 332 | get(t, e = (() => { 333 | })) { 334 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 335 | "X-Surge-Skip-Scripting": !1 336 | })), $httpClient.get(t, (t, s, i) => { 337 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 338 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 339 | hints: !1 340 | })), $task.fetch(t).then(t => { 341 | const { 342 | statusCode: s, 343 | statusCode: i, 344 | headers: r, 345 | body: o 346 | } = t; 347 | e(null, { 348 | status: s, 349 | statusCode: i, 350 | headers: r, 351 | body: o 352 | }, o) 353 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 354 | try { 355 | if (t.headers["set-cookie"]) { 356 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 357 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar 358 | } 359 | } catch (t) { 360 | this.logErr(t) 361 | } 362 | }).then(t => { 363 | const { 364 | statusCode: s, 365 | statusCode: i, 366 | headers: r, 367 | body: o 368 | } = t; 369 | e(null, { 370 | status: s, 371 | statusCode: i, 372 | headers: r, 373 | body: o 374 | }, o) 375 | }, t => { 376 | const { 377 | message: s, 378 | response: i 379 | } = t; 380 | e(s, i, i && i.body) 381 | })) 382 | } 383 | 384 | post(t, e = (() => { 385 | })) { 386 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 387 | "X-Surge-Skip-Scripting": !1 388 | })), $httpClient.post(t, (t, s, i) => { 389 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 390 | }); 391 | else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 392 | hints: !1 393 | })), $task.fetch(t).then(t => { 394 | const { 395 | statusCode: s, 396 | statusCode: i, 397 | headers: r, 398 | body: o 399 | } = t; 400 | e(null, { 401 | status: s, 402 | statusCode: i, 403 | headers: r, 404 | body: o 405 | }, o) 406 | }, t => e(t)); 407 | else if (this.isNode()) { 408 | this.initGotEnv(t); 409 | const { 410 | url: s, 411 | ...i 412 | } = t; 413 | this.got.post(s, i).then(t => { 414 | const { 415 | statusCode: s, 416 | statusCode: i, 417 | headers: r, 418 | body: o 419 | } = t; 420 | e(null, { 421 | status: s, 422 | statusCode: i, 423 | headers: r, 424 | body: o 425 | }, o) 426 | }, t => { 427 | const { 428 | message: s, 429 | response: i 430 | } = t; 431 | e(s, i, i && i.body) 432 | }) 433 | } 434 | } 435 | 436 | time(t) { 437 | let e = { 438 | "M+": (new Date).getMonth() + 1, 439 | "d+": (new Date).getDate(), 440 | "H+": (new Date).getHours(), 441 | "m+": (new Date).getMinutes(), 442 | "s+": (new Date).getSeconds(), 443 | "q+": Math.floor(((new Date).getMonth() + 3) / 3), 444 | S: (new Date).getMilliseconds() 445 | }; 446 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); 447 | for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); 448 | return t 449 | } 450 | 451 | msg(e = t, s = "", i = "", r) { 452 | const o = t => { 453 | if (!t) return t; 454 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { 455 | "open-url": t 456 | } : this.isSurge() ? { 457 | url: t 458 | } : void 0; 459 | if ("object" == typeof t) { 460 | if (this.isLoon()) { 461 | let e = t.openUrl || t.url || t["open-url"], 462 | s = t.mediaUrl || t["media-url"]; 463 | return { 464 | openUrl: e, 465 | mediaUrl: s 466 | } 467 | } 468 | if (this.isQuanX()) { 469 | let e = t["open-url"] || t.url || t.openUrl, 470 | s = t["media-url"] || t.mediaUrl; 471 | return { 472 | "open-url": e, 473 | "media-url": s 474 | } 475 | } 476 | if (this.isSurge()) { 477 | let e = t.url || t.openUrl || t["open-url"]; 478 | return { 479 | url: e 480 | } 481 | } 482 | } 483 | }; 484 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); 485 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; 486 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) 487 | } 488 | 489 | log(...t) { 490 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) 491 | } 492 | 493 | logErr(t, e) { 494 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 495 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) 496 | } 497 | 498 | wait(t) { 499 | return new Promise(e => setTimeout(e, t)) 500 | } 501 | 502 | done(t = {}) { 503 | const e = (new Date).getTime(), 504 | s = (e - this.startTime) / 1e3; 505 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 506 | } 507 | }(t, e) 508 | } -------------------------------------------------------------------------------- /ddxpxd.js: -------------------------------------------------------------------------------- 1 | /* 2 | 叮咚下单后自动领取 3 | [task_local] 4 | 55 23 * * * https://raw.githubusercontent.com/justplayscript/ddxp/main/ddxpxd.js, tag=叮咚下单后自动领取, enabled=true 5 | */ 6 | 7 | const $ = new Env('叮咚下单后自动领取'); 8 | const dr = "@" 9 | let ddxpurlArr = [], 10 | ddxphdArr = [], 11 | ddxpcount = '' 12 | let time = Math.round(Date.now() / 1000) 13 | let ddxpurl = $.getdata('ddxpurl') 14 | let ddxphd = $.getdata('ddxphd') 15 | let fflNum = +($.getval('ddxpffl') || "10") 16 | !(async () => { 17 | ddxpurlArr = ($.getdata('ddxpurl') || "").split(dr) 18 | ddxphdArr = ($.getdata('ddxphd') || "").split(dr) 19 | 20 | console.log(`------------- 共${ddxphdArr.length}个账号-------------\n`) 21 | for (let i = 0; i < ddxphdArr.length; i++) { 22 | if (ddxphdArr[i]) { 23 | getUrl(ddxpurlArr[i]) 24 | ddxphd = ddxphdArr[i]; 25 | 26 | $.index = i + 1; 27 | console.log(`\n开始【叮咚浇水${$.index}】`) 28 | await ddxTaskLog(); 29 | await $.wait(10000); 30 | await ddxpyt(); 31 | await $.wait(10000); 32 | await ddxpgyTaskLog(); 33 | await $.wait(10000); 34 | await ddxgy(); 35 | } 36 | } 37 | })() 38 | .catch((e) => $.logErr(e)) 39 | .finally(() => $.done()) 40 | 41 | /** 42 | * 共用header 43 | */ 44 | function pubHeader() { 45 | return { 46 | 'accept': '*/*', 47 | 'cookie': ddxphd, 48 | 'accept-language': 'zh-cn', 49 | 'user-agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.35.1 station_id/${station_id}`, 50 | 'accept-encoding': 'gzip, deflate, br' 51 | } 52 | } 53 | 54 | uid = "" 55 | latitude = "" 56 | longitude = "" 57 | station_id = "" 58 | userTaskLogId = "" 59 | userTasks = [] 60 | 61 | function getUrl(ddxpurl) { 62 | let url = ddxpurl.split("?") 63 | let ddxpurls = url[url.length - 1].split("&") 64 | let sendInfo = {} 65 | for (const val of ddxpurls) { 66 | let vals = val.split("&") 67 | for (const val1 of vals) { 68 | let kv = val1.split("=") 69 | sendInfo[kv[0]] = kv[1] 70 | } 71 | } 72 | uid = sendInfo["uid"] 73 | latitude = sendInfo["latitude"] 74 | longitude = sendInfo["longitude"] 75 | station_id = sendInfo["station_id"] 76 | } 77 | 78 | //获取所有TaskLog 79 | function ddxTaskLog(timeout = 0) { 80 | userTaskLogId = "" 81 | return new Promise((resolve) => { 82 | let header = pubHeader() 83 | header["origin"] = "https://game.m.ddxq.mobi" 84 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 85 | let url = { 86 | url: `https://farm.api.ddxq.mobi/api/v2/task/list?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.1&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&cityCode=1103`, 87 | headers: header, 88 | } 89 | 90 | $.get(url, async (err, resp, data) => { 91 | try { 92 | const result = JSON.parse(data) 93 | if (result.code == 0) { 94 | console.log('\n鱼塘任务列表: ' + result.msg) 95 | userTasks = result.data.userTasks 96 | } else { 97 | console.log(result) 98 | } 99 | } catch (e) { 100 | //$.logErr(e, resp); 101 | } finally { 102 | resolve() 103 | } 104 | }, timeout) 105 | }) 106 | } 107 | 108 | //鱼塘下单后领取 109 | function ddxpyt(timeout = 0) { 110 | userTaskLogId = "" 111 | if (userTasks != null) { 112 | for (const task of userTasks) { 113 | if (task.taskCode == "ANY_ORDER") { 114 | userTaskLogId = task.userTaskLogId 115 | } 116 | } 117 | } 118 | return new Promise((resolve) => { 119 | if (userTaskLogId) { 120 | let header = pubHeader() 121 | header["origin"] = "https://game.m.ddxq.mobi" 122 | header["referer"] = "https://game.m.ddxq.mobi/index.html" 123 | let url = { 124 | url: `https://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&app_version=9.35.3&uid=${uid}&latitude=${latitude}&longitude=${longitude}&gameId=1&userTaskLogId=${userTaskLogId}`, 125 | headers: header, 126 | } 127 | 128 | $.get(url, async (err, resp, data) => { 129 | try { 130 | const result = JSON.parse(data) 131 | if (result.code == 0) { 132 | console.log('\n鱼塘下单后领取: ' + result.msg) 133 | } else { 134 | console.log(result) 135 | } 136 | } catch (e) { 137 | //$.logErr(e, resp); 138 | } finally { 139 | resolve() 140 | } 141 | }, timeout) 142 | } else { 143 | $.log("今日未下单") 144 | } 145 | }) 146 | } 147 | 148 | //获取果园所有任务 149 | function ddxpgyTaskLog(timeout = 0) { 150 | userTaskLogId = "" 151 | return new Promise((resolve) => { 152 | let header = pubHeader() 153 | header["origin"] = "https://orchard-m.ddxq.mobi" 154 | header["ddmc-game-tid"] = "2" 155 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 156 | let url = { 157 | url: `https://farm.api.ddxq.mobi/api/v2/task/list-orchard?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&reward=FERTILIZER&cityCode=1103`, 158 | headers: header, 159 | } 160 | 161 | $.get(url, async (err, resp, data) => { 162 | try { 163 | const result = JSON.parse(data) 164 | if (result.code == 0) { 165 | console.log('\n果园任务列表: ' + result.msg) 166 | userTasks = result.data.userTasks 167 | } else { 168 | console.log(result) 169 | } 170 | } catch (e) { 171 | //$.logErr(e, resp); 172 | } finally { 173 | resolve() 174 | } 175 | }, timeout) 176 | }) 177 | } 178 | 179 | //果园下单 180 | function ddxgy(timeout = 0) { 181 | userTaskLogId = "" 182 | if (userTasks != null) { 183 | for (const task of userTasks) { 184 | $.log(task.taskCode) 185 | if (task.taskCode == "ANY_ORDER") { 186 | userTaskLogId = task.userTaskLogId 187 | } 188 | } 189 | } 190 | return new Promise((resolve) => { 191 | $.log(userTaskLogId) 192 | if (userTaskLogId) { 193 | let header = pubHeader() 194 | header["origin"] = "https://orchard-m.ddxq.mobi" 195 | header["connection"] = "keep-alive" 196 | header["ddmc-game-tid"] = "2" 197 | header["referer"] = "https://orchard-m.ddxq.mobi/?is_nav_hide=true&isResetAudio=true&s=mine_orchard" 198 | let url = { 199 | url: `https://farm.api.ddxq.mobi/api/v2/task/reward?api_version=9.1.0&app_client_id=1&station_id=${station_id}&native_version=&uid=${uid}&latitude=${latitude}&longitude=${longitude}&userTaskLogId=${userTaskLogId}`, 200 | headers: header, 201 | } 202 | 203 | $.get(url, async (err, resp, data) => { 204 | try { 205 | const result = JSON.parse(data) 206 | if (result.code == 0) { 207 | console.log('\n果园下单后领取: ' + result.msg) 208 | } else { 209 | console.log(result) 210 | } 211 | } catch (e) { 212 | //$.logErr(e, resp); 213 | } finally { 214 | resolve() 215 | } 216 | }, timeout) 217 | } else { 218 | $.log("今日未下单") 219 | } 220 | }) 221 | } 222 | 223 | function Env(t, e) { 224 | class s { 225 | constructor(t) { 226 | this.env = t 227 | } 228 | 229 | send(t, e = "GET") { 230 | t = "string" == typeof t ? { 231 | url: t 232 | } : t; 233 | let s = this.get; 234 | return "POST" === e && (s = this.post), new Promise((e, i) => { 235 | s.call(this, t, (t, s, r) => { 236 | t ? i(t) : e(s) 237 | }) 238 | }) 239 | } 240 | 241 | get(t) { 242 | return this.send.call(this.env, t) 243 | } 244 | 245 | post(t) { 246 | return this.send.call(this.env, t, "POST") 247 | } 248 | } 249 | 250 | return new class { 251 | constructor(t, e) { 252 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) 253 | } 254 | 255 | isNode() { 256 | return "undefined" != typeof module && !!module.exports 257 | } 258 | 259 | isQuanX() { 260 | return "undefined" != typeof $task 261 | } 262 | 263 | isSurge() { 264 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 265 | } 266 | 267 | isLoon() { 268 | return "undefined" != typeof $loon 269 | } 270 | 271 | toObj(t, e = null) { 272 | try { 273 | return JSON.parse(t) 274 | } catch { 275 | return e 276 | } 277 | } 278 | 279 | toStr(t, e = null) { 280 | try { 281 | return JSON.stringify(t) 282 | } catch { 283 | return e 284 | } 285 | } 286 | 287 | getjson(t, e) { 288 | let s = e; 289 | const i = this.getdata(t); 290 | if (i) try { 291 | s = JSON.parse(this.getdata(t)) 292 | } catch { 293 | } 294 | return s 295 | } 296 | 297 | setjson(t, e) { 298 | try { 299 | return this.setdata(JSON.stringify(t), e) 300 | } catch { 301 | return !1 302 | } 303 | } 304 | 305 | getScript(t) { 306 | return new Promise(e => { 307 | this.get({ 308 | url: t 309 | }, (t, s, i) => e(i)) 310 | }) 311 | } 312 | 313 | runScript(t, e) { 314 | return new Promise(s => { 315 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 316 | i = i ? i.replace(/\n/g, "").trim() : i; 317 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 318 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; 319 | const [o, h] = i.split("@"), a = { 320 | url: `http://${h}/v1/scripting/evaluate`, 321 | body: { 322 | script_text: t, 323 | mock_type: "cron", 324 | timeout: r 325 | }, 326 | headers: { 327 | "X-Key": o, 328 | Accept: "*/*" 329 | } 330 | }; 331 | this.post(a, (t, e, i) => s(i)) 332 | }).catch(t => this.logErr(t)) 333 | } 334 | 335 | loaddata() { 336 | if (!this.isNode()) return {}; 337 | { 338 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 339 | const t = this.path.resolve(this.dataFile), 340 | e = this.path.resolve(process.cwd(), this.dataFile), 341 | s = this.fs.existsSync(t), 342 | i = !s && this.fs.existsSync(e); 343 | if (!s && !i) return {}; 344 | { 345 | const i = s ? t : e; 346 | try { 347 | return JSON.parse(this.fs.readFileSync(i)) 348 | } catch (t) { 349 | return {} 350 | } 351 | } 352 | } 353 | } 354 | 355 | writedata() { 356 | if (this.isNode()) { 357 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); 358 | const t = this.path.resolve(this.dataFile), 359 | e = this.path.resolve(process.cwd(), this.dataFile), 360 | s = this.fs.existsSync(t), 361 | i = !s && this.fs.existsSync(e), 362 | r = JSON.stringify(this.data); 363 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 364 | } 365 | } 366 | 367 | lodash_get(t, e, s) { 368 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 369 | let r = t; 370 | for (const t of i) 371 | if (r = Object(r)[t], void 0 === r) return s; 372 | return r 373 | } 374 | 375 | lodash_set(t, e, s) { 376 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) 377 | } 378 | 379 | getdata(t) { 380 | let e = this.getval(t); 381 | if (/^@/.test(t)) { 382 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; 383 | if (r) try { 384 | const t = JSON.parse(r); 385 | e = t ? this.lodash_get(t, i, "") : e 386 | } catch (t) { 387 | e = "" 388 | } 389 | } 390 | return e 391 | } 392 | 393 | setdata(t, e) { 394 | let s = !1; 395 | if (/^@/.test(e)) { 396 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), 397 | h = i ? "null" === o ? null : o || "{}" : "{}"; 398 | try { 399 | const e = JSON.parse(h); 400 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) 401 | } catch (e) { 402 | const o = {}; 403 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) 404 | } 405 | } else s = this.setval(t, e); 406 | return s 407 | } 408 | 409 | getval(t) { 410 | if (this.isNode()) { 411 | return process.env[t] 412 | } else { 413 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null 414 | } 415 | } 416 | 417 | setval(t, e) { 418 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null 419 | } 420 | 421 | initGotEnv(t) { 422 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 423 | } 424 | 425 | get(t, e = (() => { 426 | })) { 427 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 428 | "X-Surge-Skip-Scripting": !1 429 | })), $httpClient.get(t, (t, s, i) => { 430 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 431 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 432 | hints: !1 433 | })), $task.fetch(t).then(t => { 434 | const { 435 | statusCode: s, 436 | statusCode: i, 437 | headers: r, 438 | body: o 439 | } = t; 440 | e(null, { 441 | status: s, 442 | statusCode: i, 443 | headers: r, 444 | body: o 445 | }, o) 446 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 447 | try { 448 | if (t.headers["set-cookie"]) { 449 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 450 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar 451 | } 452 | } catch (t) { 453 | this.logErr(t) 454 | } 455 | }).then(t => { 456 | const { 457 | statusCode: s, 458 | statusCode: i, 459 | headers: r, 460 | body: o 461 | } = t; 462 | e(null, { 463 | status: s, 464 | statusCode: i, 465 | headers: r, 466 | body: o 467 | }, o) 468 | }, t => { 469 | const { 470 | message: s, 471 | response: i 472 | } = t; 473 | e(s, i, i && i.body) 474 | })) 475 | } 476 | 477 | post(t, e = (() => { 478 | })) { 479 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 480 | "X-Surge-Skip-Scripting": !1 481 | })), $httpClient.post(t, (t, s, i) => { 482 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) 483 | }); 484 | else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 485 | hints: !1 486 | })), $task.fetch(t).then(t => { 487 | const { 488 | statusCode: s, 489 | statusCode: i, 490 | headers: r, 491 | body: o 492 | } = t; 493 | e(null, { 494 | status: s, 495 | statusCode: i, 496 | headers: r, 497 | body: o 498 | }, o) 499 | }, t => e(t)); 500 | else if (this.isNode()) { 501 | this.initGotEnv(t); 502 | const { 503 | url: s, 504 | ...i 505 | } = t; 506 | this.got.post(s, i).then(t => { 507 | const { 508 | statusCode: s, 509 | statusCode: i, 510 | headers: r, 511 | body: o 512 | } = t; 513 | e(null, { 514 | status: s, 515 | statusCode: i, 516 | headers: r, 517 | body: o 518 | }, o) 519 | }, t => { 520 | const { 521 | message: s, 522 | response: i 523 | } = t; 524 | e(s, i, i && i.body) 525 | }) 526 | } 527 | } 528 | 529 | time(t) { 530 | let e = { 531 | "M+": (new Date).getMonth() + 1, 532 | "d+": (new Date).getDate(), 533 | "H+": (new Date).getHours(), 534 | "m+": (new Date).getMinutes(), 535 | "s+": (new Date).getSeconds(), 536 | "q+": Math.floor(((new Date).getMonth() + 3) / 3), 537 | S: (new Date).getMilliseconds() 538 | }; 539 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); 540 | for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); 541 | return t 542 | } 543 | 544 | msg(e = t, s = "", i = "", r) { 545 | const o = t => { 546 | if (!t) return t; 547 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { 548 | "open-url": t 549 | } : this.isSurge() ? { 550 | url: t 551 | } : void 0; 552 | if ("object" == typeof t) { 553 | if (this.isLoon()) { 554 | let e = t.openUrl || t.url || t["open-url"], 555 | s = t.mediaUrl || t["media-url"]; 556 | return { 557 | openUrl: e, 558 | mediaUrl: s 559 | } 560 | } 561 | if (this.isQuanX()) { 562 | let e = t["open-url"] || t.url || t.openUrl, 563 | s = t["media-url"] || t.mediaUrl; 564 | return { 565 | "open-url": e, 566 | "media-url": s 567 | } 568 | } 569 | if (this.isSurge()) { 570 | let e = t.url || t.openUrl || t["open-url"]; 571 | return { 572 | url: e 573 | } 574 | } 575 | } 576 | }; 577 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); 578 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; 579 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) 580 | } 581 | 582 | log(...t) { 583 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) 584 | } 585 | 586 | logErr(t, e) { 587 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 588 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) 589 | } 590 | 591 | wait(t) { 592 | return new Promise(e => setTimeout(e, t)) 593 | } 594 | 595 | done(t = {}) { 596 | const e = (new Date).getTime(), 597 | s = (e - this.startTime) / 1e3; 598 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 599 | } 600 | }(t, e) 601 | } -------------------------------------------------------------------------------- /img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justplayscript/ddxp/26864cd5f6831580ec5cfa113ecb9c048df26610/img.jpg -------------------------------------------------------------------------------- /img0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justplayscript/ddxp/26864cd5f6831580ec5cfa113ecb9c048df26610/img0.jpg -------------------------------------------------------------------------------- /img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justplayscript/ddxp/26864cd5f6831580ec5cfa113ecb9c048df26610/img1.jpg -------------------------------------------------------------------------------- /img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justplayscript/ddxp/26864cd5f6831580ec5cfa113ecb9c048df26610/img2.jpg --------------------------------------------------------------------------------