Sellercallcenter.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. *
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 控制器
  14. */
  15. class Sellercallcenter extends BaseSeller
  16. {
  17. public function initialize()
  18. {
  19. parent::initialize(); // TODO: Change the autogenerated stub
  20. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/sellercallcenter.lang.php');
  21. }
  22. public function index()
  23. {
  24. $store_model = model('store');
  25. $store_info = $store_model->getStoreInfo(array('store_id' => session('store_id')));
  26. View::assign('storeinfo', $store_info);
  27. $seller_model = model('seller');
  28. $seller_list = $seller_model->getSellerList(array('seller.store_id' => $store_info['store_id']), 'seller.seller_id asc'); //账号列表
  29. $this->setSellerCurMenu('Sellercallcenter');
  30. $this->setSellerCurItem('index');
  31. View::assign('seller_list', $seller_list);
  32. return View::fetch($this->template_dir . 'index');
  33. }
  34. /**
  35. * 保存
  36. */
  37. public function save()
  38. {
  39. if (request()->isPost()) {
  40. $update = array();
  41. $i = 0;
  42. $pre_array = input('post.pre/a'); #获取数组
  43. if (is_array($pre_array) && !empty($pre_array)) {
  44. foreach ($pre_array as $val) {
  45. if (empty($val['name']) || empty($val['type']) || empty($val['num']))
  46. continue;
  47. $update['store_presales'][$i]['name'] = $val['name'];
  48. $update['store_presales'][$i]['type'] = intval($val['type']);
  49. $update['store_presales'][$i]['num'] = $val['num'];
  50. $i++;
  51. }
  52. $update['store_presales'] = @serialize($update['store_presales']);
  53. } else {
  54. $update['store_presales'] = serialize(null);
  55. }
  56. $i = 0;
  57. $after_array = input('post.after/a'); #获取数组
  58. if (is_array($after_array) && !empty($after_array)) {
  59. foreach ($after_array as $val) {
  60. if (empty($val['name']) || empty($val['type']) || empty($val['num']))
  61. continue;
  62. $update['store_aftersales'][$i]['name'] = $val['name'];
  63. $update['store_aftersales'][$i]['type'] = intval($val['type']);
  64. $update['store_aftersales'][$i]['num'] = $val['num'];
  65. $i++;
  66. }
  67. $update['store_aftersales'] = @serialize($update['store_aftersales']);
  68. } else {
  69. $update['store_aftersales'] = serialize(null);
  70. }
  71. $update['store_workingtime'] = input('post.working_time');
  72. $condition = array();
  73. $condition[] = array('store_id', '=', session('store_id'));
  74. model('store')->editStore($update, $condition);
  75. ds_json_encode(10000, lang('ds_common_save_succ'));
  76. }
  77. }
  78. /**
  79. * 用户中心右边,小导航
  80. *
  81. * @param string $menu_type 导航类型
  82. * @param string $menu_key 当前导航的menu_key
  83. * @return
  84. */
  85. protected function getSellerItemList()
  86. {
  87. $menu_array = array(
  88. array(
  89. 'name' => 'index', 'text' => lang('ds_member_path_store_callcenter'),
  90. 'url' => (string)url('Sellercallcenter/index')
  91. ),
  92. );
  93. return $menu_array;
  94. }
  95. }