Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Unishop.php 45 KiB

há 4 anos
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <?php
  2. namespace addons\unishop;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. use think\Loader;
  6. /**
  7. * 插件
  8. */
  9. class unishop extends Addons
  10. {
  11. /**
  12. * 插件安装方法
  13. * @return bool
  14. */
  15. public function install()
  16. {
  17. $menu = [
  18. 0 =>
  19. [
  20. 'name' => 'unishop',
  21. 'title' => '喂喂商城',
  22. 'icon' => 'fa fa-font-awesome',
  23. 'remark' => '',
  24. 'sublist' =>
  25. [
  26. 0 =>
  27. [
  28. 'name' => 'unishop/ads',
  29. 'title' => '广告图管理',
  30. 'remark' => '',
  31. 'icon' => 'fa fa-buysellads',
  32. 'sublist' =>
  33. [
  34. 0 =>
  35. [
  36. 'name' => 'unishop/ads/index',
  37. 'title' => '查看',
  38. 'remark' => '',
  39. 'icon' => 'fa fa-circle-o',
  40. 'sublist' =>
  41. [
  42. ],
  43. ],
  44. 1 =>
  45. [
  46. 'name' => 'unishop/ads/add',
  47. 'title' => '添加',
  48. 'remark' => '',
  49. 'icon' => 'fa fa-circle-o',
  50. 'sublist' =>
  51. [
  52. ],
  53. ],
  54. 2 =>
  55. [
  56. 'name' => 'unishop/ads/edit',
  57. 'title' => '编辑',
  58. 'remark' => '',
  59. 'icon' => 'fa fa-circle-o',
  60. 'sublist' =>
  61. [
  62. ],
  63. ],
  64. 3 =>
  65. [
  66. 'name' => 'unishop/ads/del',
  67. 'title' => '删除',
  68. 'remark' => '',
  69. 'icon' => 'fa fa-circle-o',
  70. 'sublist' =>
  71. [
  72. ],
  73. ],
  74. 4 =>
  75. [
  76. 'name' => 'unishop/ads/multi',
  77. 'title' => '批量更新',
  78. 'remark' => '',
  79. 'icon' => 'fa fa-circle-o',
  80. 'sublist' =>
  81. [
  82. ],
  83. ],
  84. ],
  85. ],
  86. 1 =>
  87. [
  88. 'name' => 'unishop/category',
  89. 'title' => '分类管理',
  90. 'remark' => '注意:产品只支持二级分类。',
  91. 'icon' => 'fa fa-align-justify',
  92. 'sublist' =>
  93. [
  94. 0 =>
  95. [
  96. 'name' => 'unishop/category/index',
  97. 'title' => '查看',
  98. 'remark' => '',
  99. 'icon' => 'fa fa-circle-o',
  100. 'sublist' =>
  101. [
  102. ],
  103. ],
  104. 1 =>
  105. [
  106. 'name' => 'unishop/category/del',
  107. 'title' => '删除',
  108. 'remark' => '',
  109. 'icon' => 'fa fa-circle-o',
  110. 'sublist' =>
  111. [
  112. ],
  113. ],
  114. 2 =>
  115. [
  116. 'name' => 'unishop/category/edit',
  117. 'title' => '修改',
  118. 'remark' => '',
  119. 'icon' => 'fa fa-circle-o',
  120. 'sublist' =>
  121. [
  122. ],
  123. ],
  124. 3 =>
  125. [
  126. 'name' => 'unishop/category/add',
  127. 'title' => '添加',
  128. 'remark' => '',
  129. 'icon' => 'fa fa-circle-o',
  130. 'sublist' =>
  131. [
  132. ],
  133. ],
  134. 4 =>
  135. [
  136. 'name' => 'unishop/category/multi',
  137. 'title' => '批量操作',
  138. 'remark' => '',
  139. 'icon' => 'fa fa-circle-o',
  140. 'sublist' =>
  141. [
  142. ],
  143. ],
  144. ],
  145. ],
  146. 2 =>
  147. [
  148. 'name' => 'unishop/product',
  149. 'title' => '产品管理',
  150. 'remark' => '',
  151. 'icon' => 'fa fa-product-hunt',
  152. 'sublist' =>
  153. [
  154. 0 =>
  155. [
  156. 'name' => 'unishop/product/index',
  157. 'title' => '查看',
  158. 'remark' => '',
  159. 'icon' => 'fa fa-circle-o',
  160. 'sublist' =>
  161. [
  162. ],
  163. ],
  164. 1 =>
  165. [
  166. 'name' => 'unishop/product/add',
  167. 'title' => '添加',
  168. 'remark' => '',
  169. 'icon' => 'fa fa-circle-o',
  170. 'sublist' =>
  171. [
  172. ],
  173. ],
  174. 2 =>
  175. [
  176. 'name' => 'unishop/product/edit',
  177. 'title' => '编辑',
  178. 'remark' => '',
  179. 'icon' => 'fa fa-circle-o',
  180. 'sublist' =>
  181. [
  182. ],
  183. ],
  184. 3 =>
  185. [
  186. 'name' => 'unishop/product/del',
  187. 'title' => '删除',
  188. 'remark' => '',
  189. 'icon' => 'fa fa-circle-o',
  190. 'sublist' =>
  191. [
  192. ],
  193. ],
  194. 4 =>
  195. [
  196. 'name' => 'unishop/product/multi',
  197. 'title' => '批量更新',
  198. 'remark' => '',
  199. 'icon' => 'fa fa-circle-o',
  200. 'sublist' =>
  201. [
  202. ],
  203. ],
  204. 5 =>
  205. [
  206. 'name' => 'unishop/product/recyclebin',
  207. 'title' => '回收站',
  208. 'remark' => '',
  209. 'icon' => 'fa fa-circle-o',
  210. 'sublist' =>
  211. [
  212. ],
  213. ],
  214. 6 =>
  215. [
  216. 'name' => 'unishop/product/destroy',
  217. 'title' => '真是删除',
  218. 'remark' => '',
  219. 'icon' => 'fa fa-circle-o',
  220. 'sublist' =>
  221. [
  222. ],
  223. ],
  224. 7 =>
  225. [
  226. 'name' => 'unishop/product/restore',
  227. 'title' => '还原',
  228. 'remark' => '',
  229. 'icon' => 'fa fa-circle-o',
  230. 'sublist' =>
  231. [
  232. ],
  233. ],
  234. 8 =>
  235. [
  236. 'name' => 'unishop/product/copy',
  237. 'title' => '复制',
  238. 'remark' => '',
  239. 'icon' => 'fa fa-circle-o',
  240. 'sublist' =>
  241. [
  242. ],
  243. ],
  244. ],
  245. ],
  246. 3 =>
  247. [
  248. 'name' => 'unishop/delivery',
  249. 'title' => '运费模板',
  250. 'remark' => '',
  251. 'icon' => 'fa fa-delicious',
  252. 'sublist' =>
  253. [
  254. 0 =>
  255. [
  256. 'name' => 'unishop/delivery/index',
  257. 'title' => '查看',
  258. 'remark' => '',
  259. 'icon' => 'fa fa-circle-o',
  260. 'sublist' =>
  261. [
  262. ],
  263. ],
  264. 1 =>
  265. [
  266. 'name' => 'unishop/delivery/add',
  267. 'title' => '添加',
  268. 'remark' => '',
  269. 'icon' => 'fa fa-circle-o',
  270. 'sublist' =>
  271. [
  272. ],
  273. ],
  274. 2 =>
  275. [
  276. 'name' => 'unishop/delivery/edit',
  277. 'title' => '编辑',
  278. 'remark' => '',
  279. 'icon' => 'fa fa-circle-o',
  280. 'sublist' =>
  281. [
  282. ],
  283. ],
  284. 3 =>
  285. [
  286. 'name' => 'unishop/delivery/del',
  287. 'title' => '删除',
  288. 'remark' => '',
  289. 'icon' => 'fa fa-circle-o',
  290. 'sublist' =>
  291. [
  292. ],
  293. ],
  294. 4 =>
  295. [
  296. 'name' => 'unishop/delivery/multi',
  297. 'title' => '批量更新',
  298. 'remark' => '',
  299. 'icon' => 'fa fa-circle-o',
  300. 'sublist' =>
  301. [
  302. ],
  303. ],
  304. ],
  305. ],
  306. 4 =>
  307. [
  308. 'name' => 'unishop/config',
  309. 'title' => '系统配置',
  310. 'remark' => '更新配置缓存不会立即生效,如需立即生效请清空缓存。',
  311. 'icon' => 'fa fa-certificate',
  312. 'sublist' =>
  313. [
  314. 0 =>
  315. [
  316. 'name' => 'unishop/config/index',
  317. 'title' => '查看',
  318. 'remark' => '',
  319. 'icon' => 'fa fa-circle-o',
  320. 'sublist' =>
  321. [
  322. ],
  323. ],
  324. 1 =>
  325. [
  326. 'name' => 'unishop/config/add',
  327. 'title' => '添加',
  328. 'remark' => '',
  329. 'icon' => 'fa fa-circle-o',
  330. 'sublist' =>
  331. [
  332. ],
  333. ],
  334. 2 =>
  335. [
  336. 'name' => 'unishop/config/edit',
  337. 'title' => '编辑',
  338. 'remark' => '',
  339. 'icon' => 'fa fa-circle-o',
  340. 'sublist' =>
  341. [
  342. ],
  343. ],
  344. 3 =>
  345. [
  346. 'name' => 'unishop/config/del',
  347. 'title' => '删除',
  348. 'remark' => '',
  349. 'icon' => 'fa fa-circle-o',
  350. 'sublist' =>
  351. [
  352. ],
  353. ],
  354. 4 =>
  355. [
  356. 'name' => 'unishop/config/multi',
  357. 'title' => '批量更新',
  358. 'remark' => '',
  359. 'icon' => 'fa fa-circle-o',
  360. 'sublist' =>
  361. [
  362. ],
  363. ],
  364. ],
  365. ],
  366. 5 =>
  367. [
  368. 'name' => 'unishop/market',
  369. 'title' => '营销中心',
  370. 'remark' => '',
  371. 'icon' => 'fa fa-list',
  372. 'sublist' =>
  373. [
  374. 0 =>
  375. [
  376. 'name' => 'unishop/market/coupon',
  377. 'title' => '优惠券管理',
  378. 'remark' => '',
  379. 'icon' => 'fa fa-gratipay',
  380. 'sublist' =>
  381. [
  382. 0 =>
  383. [
  384. 'name' => 'unishop/market/coupon/index',
  385. 'title' => '查看',
  386. 'icon' => 'fa fa-circle-o',
  387. ],
  388. 1 =>
  389. [
  390. 'name' => 'unishop/market/coupon/add',
  391. 'title' => '添加',
  392. 'icon' => 'fa fa-circle-o',
  393. ],
  394. 2 =>
  395. [
  396. 'name' => 'unishop/market/coupon/edit',
  397. 'title' => '编辑',
  398. 'icon' => 'fa fa-circle-o',
  399. ],
  400. 3 =>
  401. [
  402. 'name' => 'unishop/market/coupon/del',
  403. 'title' => '删除',
  404. 'icon' => 'fa fa-circle-o',
  405. ],
  406. 4 =>
  407. [
  408. 'name' => 'unishop/market/coupon/multi',
  409. 'title' => '批量更新',
  410. 'icon' => 'fa fa-circle-o',
  411. ],
  412. 5 =>
  413. [
  414. 'name' => 'unishop/market/coupon/recyclebin',
  415. 'title' => '回收站',
  416. 'icon' => 'fa fa-circle-o',
  417. ],
  418. 6 =>
  419. [
  420. 'name' => 'unishop/market/coupon/destroy',
  421. 'title' => '真实删除',
  422. 'icon' => 'fa fa-circle-o',
  423. ],
  424. 7 =>
  425. [
  426. 'name' => 'unishop/market/coupon/restore',
  427. 'title' => '还原',
  428. 'icon' => 'fa fa-circle-o',
  429. ],
  430. ],
  431. ],
  432. 1 =>
  433. [
  434. 'name' => 'unishop/market/flash_sale',
  435. 'title' => '秒杀管理',
  436. 'remark' => '1,归档结束会把商品的真实售量和剩余数量同步到对应商品。
  437. 2,已归档、已开始、上架状态的秒杀信息不能够修改。
  438. 3,商品列表下架的商品也可以参与秒杀,建议复制一份商品专门提供给秒杀使用。
  439. 4,秒杀进行中的商品可以单个下架。
  440. 5,必须启动redis才能使用秒杀功能',
  441. 'icon' => 'fa fa-flag',
  442. 'sublist' =>
  443. [
  444. 0 =>
  445. [
  446. 'name' => 'unishop/market/flash_sale/index',
  447. 'title' => '查看',
  448. 'icon' => 'fa fa-circle-o',
  449. ],
  450. 1 =>
  451. [
  452. 'name' => 'unishop/market/flash_sale/add',
  453. 'title' => '添加',
  454. 'icon' => 'fa fa-circle-o',
  455. ],
  456. 2 =>
  457. [
  458. 'name' => 'unishop/market/flash_sale/edit',
  459. 'title' => '编辑',
  460. 'icon' => 'fa fa-circle-o',
  461. ],
  462. 3 =>
  463. [
  464. 'name' => 'unishop/market/flash_sale/del',
  465. 'title' => '删除',
  466. 'icon' => 'fa fa-circle-o',
  467. ],
  468. 4 =>
  469. [
  470. 'name' => 'unishop/market/flash_sale/multi',
  471. 'title' => '批量更新',
  472. 'icon' => 'fa fa-circle-o',
  473. ],
  474. 5 =>
  475. [
  476. 'name' => 'unishop/market/flash_sale/recyclebin',
  477. 'title' => '回收站',
  478. 'icon' => 'fa fa-circle-o',
  479. ],
  480. 6 =>
  481. [
  482. 'name' => 'unishop/market/flash_sale/destroy',
  483. 'title' => '真实删除',
  484. 'icon' => 'fa fa-circle-o',
  485. ],
  486. 7 =>
  487. [
  488. 'name' => 'unishop/market/flash_sale/restroy',
  489. 'title' => '还原',
  490. 'icon' => 'fa fa-circle-o',
  491. ],
  492. 8 =>
  493. [
  494. 'name' => 'unishop/market/flash_product/multi',
  495. 'title' => '更新秒杀产品状态',
  496. 'icon' => 'fa fa-circle-o',
  497. ],
  498. ],
  499. ],
  500. ],
  501. ],
  502. 6 =>
  503. [
  504. 'name' => 'unishop/order',
  505. 'title' => '订单管理',
  506. 'remark' => '1,货到付款默认支付状态为已支付,请留意发快递的时候选择收付模式。',
  507. 'icon' => 'fa fa-print',
  508. 'sublist' =>
  509. [
  510. 0 =>
  511. [
  512. 'name' => 'unishop/order/delivery',
  513. 'title' => '物流管理',
  514. 'remark' => '',
  515. 'icon' => 'fa fa-circle-o',
  516. 'sublist' =>
  517. [
  518. ],
  519. ],
  520. 1 =>
  521. [
  522. 'name' => 'unishop/order/multi',
  523. 'title' => '批量更新',
  524. 'remark' => '',
  525. 'icon' => 'fa fa-circle-o',
  526. 'sublist' =>
  527. [
  528. ],
  529. ],
  530. 2 =>
  531. [
  532. 'name' => 'unishop/order/restore',
  533. 'title' => '还原',
  534. 'remark' => '',
  535. 'icon' => 'fa fa-circle-o',
  536. 'sublist' =>
  537. [
  538. ],
  539. ],
  540. 3 =>
  541. [
  542. 'name' => 'unishop/order/destroy',
  543. 'title' => '真实删除',
  544. 'remark' => '',
  545. 'icon' => 'fa fa-circle-o',
  546. 'sublist' =>
  547. [
  548. ],
  549. ],
  550. 4 =>
  551. [
  552. 'name' => 'unishop/order/del',
  553. 'title' => '删除',
  554. 'remark' => '',
  555. 'icon' => 'fa fa-circle-o',
  556. 'sublist' =>
  557. [
  558. ],
  559. ],
  560. 5 =>
  561. [
  562. 'name' => 'unishop/order/edit',
  563. 'title' => '编辑',
  564. 'remark' => '',
  565. 'icon' => 'fa fa-circle-o',
  566. 'sublist' =>
  567. [
  568. ],
  569. ],
  570. 6 =>
  571. [
  572. 'name' => 'unishop/order/recyclebin',
  573. 'title' => '回收站',
  574. 'remark' => '',
  575. 'icon' => 'fa fa-circle-o',
  576. 'sublist' =>
  577. [
  578. ],
  579. ],
  580. 7 =>
  581. [
  582. 'name' => 'unishop/order/index',
  583. 'title' => '查看',
  584. 'remark' => '',
  585. 'icon' => 'fa fa-circle-o',
  586. 'sublist' =>
  587. [
  588. ],
  589. ],
  590. 8 =>
  591. [
  592. 'name' => 'unishop/order/product',
  593. 'title' => '商品管理',
  594. 'remark' => '',
  595. 'icon' => 'fa fa-circle-o',
  596. 'sublist' =>
  597. [
  598. ],
  599. ],
  600. 9 =>
  601. [
  602. 'name' => 'unishop/order/refund',
  603. 'title' => '退货',
  604. 'remark' => '',
  605. 'icon' => 'fa fa-circle-o',
  606. 'sublist' =>
  607. [
  608. ],
  609. ],
  610. ],
  611. ],
  612. 7 =>
  613. [
  614. 'name' => 'unishop/evaluate',
  615. 'title' => '商品评价管理',
  616. 'remark' => '',
  617. 'icon' => 'fa fa-commenting',
  618. 'sublist' =>
  619. [
  620. 0 =>
  621. [
  622. 'name' => 'unishop/evaluate/index',
  623. 'title' => '查看',
  624. 'remark' => '',
  625. 'icon' => 'fa fa-circle-o',
  626. 'sublist' =>
  627. [
  628. ],
  629. ],
  630. 1 =>
  631. [
  632. 'name' => 'unishop/evaluate/recyclebin',
  633. 'title' => '回收站',
  634. 'remark' => '',
  635. 'icon' => 'fa fa-circle-o',
  636. 'sublist' =>
  637. [
  638. ],
  639. ],
  640. 2 =>
  641. [
  642. 'name' => 'unishop/evaluate/add',
  643. 'title' => '添加',
  644. 'remark' => '',
  645. 'icon' => 'fa fa-circle-o',
  646. 'sublist' =>
  647. [
  648. ],
  649. ],
  650. 3 =>
  651. [
  652. 'name' => 'unishop/evaluate/edit',
  653. 'title' => '编辑',
  654. 'remark' => '',
  655. 'icon' => 'fa fa-circle-o',
  656. 'sublist' =>
  657. [
  658. ],
  659. ],
  660. 4 =>
  661. [
  662. 'name' => 'unishop/evaluate/del',
  663. 'title' => '删除',
  664. 'remark' => '',
  665. 'icon' => 'fa fa-circle-o',
  666. 'sublist' =>
  667. [
  668. ],
  669. ],
  670. 5 =>
  671. [
  672. 'name' => 'unishop/evaluate/destroy',
  673. 'title' => '真实删除',
  674. 'remark' => '',
  675. 'icon' => 'fa fa-circle-o',
  676. 'sublist' =>
  677. [
  678. ],
  679. ],
  680. 6 =>
  681. [
  682. 'name' => 'unishop/evaluate/restore',
  683. 'title' => '还原',
  684. 'remark' => '',
  685. 'icon' => 'fa fa-circle-o',
  686. 'sublist' =>
  687. [
  688. ],
  689. ],
  690. 7 =>
  691. [
  692. 'name' => 'unishop/evaluate/multi',
  693. 'title' => '批量更新',
  694. 'remark' => '',
  695. 'icon' => 'fa fa-circle-o',
  696. 'sublist' =>
  697. [
  698. ],
  699. ],
  700. ],
  701. ],
  702. ],
  703. ],
  704. ];
  705. Menu::create($menu);
  706. return true;
  707. }
  708. /**
  709. * 插件卸载方法
  710. * @return bool
  711. */
  712. public function uninstall()
  713. {
  714. Menu::delete('unishop');
  715. return true;
  716. }
  717. /**
  718. * 插件启用方法
  719. * @return bool
  720. */
  721. public function enable()
  722. {
  723. Menu::enable('unishop');
  724. return true;
  725. }
  726. /**
  727. * 插件禁用方法
  728. * @return bool
  729. */
  730. public function disable()
  731. {
  732. Menu::disable('unishop');
  733. return true;
  734. }
  735. public function appInit()
  736. {
  737. Loader::addNamespace('Hashids', ADDON_PATH . 'unishop' . DS . 'library' . DS . 'Hashids' . DS);
  738. Loader::addNamespace('Godruoyi\Snowflake', ADDON_PATH . 'unishop' . DS . 'library' . DS . 'Godruoyi' . DS . 'Snowflake' . DS);
  739. Loader::addNamespace('Yansongda', ADDON_PATH . 'epay' . DS . 'library' . DS . 'Yansongda' . DS);
  740. }
  741. }