Goodsvideo.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /*
  3. * 空间管理
  4. */
  5. namespace app\admin\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. *
  10. *
  11. * ----------------------------------------------------------------------------
  12. *
  13. * 控制器
  14. */
  15. class Goodsvideo extends AdminControl
  16. {
  17. public function initialize()
  18. {
  19. parent::initialize();
  20. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/goodsvideo.lang.php');
  21. }
  22. /**
  23. * 视频列表
  24. */
  25. public function index()
  26. {
  27. $goods_model = model('goods');
  28. $video_list = $goods_model->getGoodsVideoList(array(), '*', 'goodsvideo_id desc', 0, 16);
  29. foreach ($video_list as $key => $val) {
  30. $video_list[$key]['goodsvideo_url'] = goods_video($val['goodsvideo_name']);
  31. }
  32. View::assign('video_list', $video_list);
  33. View::assign('show_page', $goods_model->page_info->render());
  34. $this->setAdminCurItem('index');
  35. return View::fetch();
  36. }
  37. /**
  38. * 删除视频
  39. *
  40. */
  41. public function del_video()
  42. {
  43. $goodsvideo_id = input('param.goodsvideo_id');
  44. $goodsvideo_id_array = ds_delete_param($goodsvideo_id);
  45. if ($goodsvideo_id_array === FALSE) {
  46. ds_json_encode('10001', lang('param_error'));
  47. }
  48. $condition = array();
  49. $condition[] = array('goodsvideo_id', 'in', $goodsvideo_id_array);
  50. $goods_model = model('goods');
  51. //批量删除视频
  52. $goods_model->delGoodsVideo($condition);
  53. $this->log(lang('ds_del') . lang('goodsvideo') . '[ID:' . $goodsvideo_id . ']', 1);
  54. ds_json_encode('10000', lang('ds_common_op_succ'));
  55. }
  56. protected function getAdminItemList()
  57. {
  58. $menu_array = array(
  59. array(
  60. 'name' => 'index',
  61. 'text' => lang('ds_list'),
  62. 'url' => (string)url('Goodsvideo/index')
  63. )
  64. );
  65. return $menu_array;
  66. }
  67. }