Manage.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Scm_servicer\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. public function __construct()
  7. {
  8. Dever::load('manage/auth.init');
  9. }
  10. public function getStore($id)
  11. {
  12. $table = array();
  13. $table['head'] = array('仓库名称', '仓库编码', '操作');
  14. $table['body'] = array();
  15. $data = Dever::db('scm_servicer/store')->select(array('servicer_id' => $id));
  16. if ($data) {
  17. $status = Dever::db('scm_servicer/store')->config['status'];
  18. foreach ($data as $k => $v) {
  19. $status_name = '';
  20. if ($v['status'] == 2) {
  21. $status_name = '(已禁用)';
  22. }
  23. $oper = '<a class="layui-btn" href="'.Dever::url('lib/set.home?role=servicer/store&id=' . $v['id'], 'scm_product').'">商品列表</a>';
  24. $table['body'][$k][] = $v['name'] . $status_name;
  25. $table['body'][$k][] = $v['code'];
  26. $table['body'][$k][] = $oper;
  27. }
  28. }
  29. $body[''] = array
  30. (
  31. 'type' => 'table',
  32. 'content' => $table,
  33. );
  34. if ($table['body']) {
  35. return Dever::show('', $body);
  36. } else {
  37. return '暂无';
  38. }
  39. }
  40. public function updateGoods($id, $name, $data)
  41. {
  42. $table = Dever::input('table');
  43. $goods = Dever::param('goods', $data);
  44. $temp = explode('-', $goods);
  45. $update['where_id'] = $id;
  46. $update['goods_id'] = $temp[0];
  47. $update['sku_id'] = $temp[1];
  48. Dever::db('scm_servicer/' . $table)->update($update);
  49. Dever::config('base')->hook = false;
  50. }
  51. }