Sellercallcenter.php 3.9 KB

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