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