Arrivalnotice.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. *
  7. *
  8. * ----------------------------------------------------------------------------
  9. *
  10. * 控制器
  11. */
  12. class Arrivalnotice extends AdminControl
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize();
  17. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/arrivalnotice.lang.php');
  18. }
  19. /**
  20. * 到货通知列表
  21. * @return mixed
  22. */
  23. public function index()
  24. {
  25. $arrivalnotice_model = model('arrivalnotice');
  26. $condition = array();
  27. if (!empty(input('param.search_goods'))) {
  28. $condition[] = array('goods_name', 'like', '%' . input('param.search_goods') . '%');
  29. }
  30. if (!empty(input('param.search_state'))) {
  31. $condition[] = array('arrivalnotice_state', '=', input('param.search_state'));
  32. }
  33. $arrivalnotice_list = $arrivalnotice_model->getArrivalNoticeList($condition, '', '', '', 5);
  34. foreach ($arrivalnotice_list as $key => $value) {
  35. $arrivalnotice_list[$key]['member_name'] = model('member')->getMemberInfo(['member_id' => $value['member_id']], 'member_name')['member_name'];
  36. }
  37. View::assign('arrivalnotice_list', $arrivalnotice_list);
  38. View::assign('show_page', $arrivalnotice_model->page_info->render());
  39. $this->setAdminCurItem('index');
  40. View::assign('filtered', $condition ? 1 : 0); //是否有查询条件
  41. return View::fetch();
  42. }
  43. /**
  44. * 到货通知删除
  45. */
  46. public function arrivalnotice_del()
  47. {
  48. $arrivalnotice_id = input('param.arrivalnotice_id');
  49. $arrivalnotice_id_array = ds_delete_param($arrivalnotice_id);
  50. if ($arrivalnotice_id_array == FALSE) {
  51. ds_json_encode('10001', lang('param_error'));
  52. }
  53. $condition = array();
  54. $condition[] = array('arrivalnotice_id', 'in', $arrivalnotice_id_array);
  55. $arrivalnotice_model = model('arrivalnotice');
  56. //批量删除
  57. $result = $arrivalnotice_model->delArrivalNotice($condition);
  58. if ($result) {
  59. ds_json_encode(10000, lang('ds_common_del_succ'));
  60. } else {
  61. ds_json_encode(10001, lang('ds_common_del_fail'));
  62. }
  63. }
  64. }