Goodsvideo.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. * ============================================================================
  16. * 控制器
  17. */
  18. class Goodsvideo extends AdminControl {
  19. public function initialize() {
  20. parent::initialize();
  21. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/goodsvideo.lang.php');
  22. }
  23. /**
  24. * 视频列表
  25. */
  26. public function index() {
  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. $goodsvideo_id = input('param.goodsvideo_id');
  43. $goodsvideo_id_array = ds_delete_param($goodsvideo_id);
  44. if ($goodsvideo_id_array === FALSE) {
  45. ds_json_encode('10001', lang('param_error'));
  46. }
  47. $condition=array();
  48. $condition[]=array('goodsvideo_id','in',$goodsvideo_id_array);
  49. $goods_model = model('goods');
  50. //批量删除视频
  51. $goods_model->delGoodsVideo($condition);
  52. $this->log(lang('ds_del') . lang('goodsvideo') . '[ID:' . $goodsvideo_id . ']', 1);
  53. ds_json_encode('10000', lang('ds_common_op_succ'));
  54. }
  55. protected function getAdminItemList() {
  56. $menu_array = array(
  57. array(
  58. 'name' => 'index',
  59. 'text' => lang('ds_list'),
  60. 'url' => (string)url('Goodsvideo/index')
  61. )
  62. );
  63. return $menu_array;
  64. }
  65. }