Spec.php 707 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Scm_product\Lib;
  3. use Dever;
  4. class Spec
  5. {
  6. # 获取当前的规格
  7. public function get_api()
  8. {
  9. $id = Dever::input('id');
  10. return $this->getData($id);
  11. }
  12. # 获取基本信息列表
  13. public function getData($info_id, $method = 'getAll')
  14. {
  15. $result = array();
  16. if ($info_id) {
  17. $result = Dever::db('scm_product/info_spec')->$method(array('info_id' => $info_id));
  18. if ($result) {
  19. foreach ($result as $k => $v) {
  20. $result[$k]['child'] = Dever::db('scm_product/info_spec_value')->$method(array('info_id' => $info_id, 'spec_id' => $v['id']));
  21. }
  22. }
  23. }
  24. return $result;
  25. }
  26. }