Memberflea.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. use think\facade\Db;
  6. /**
  7. * ============================================================================
  8. * DSMall多用户商城
  9. * ============================================================================
  10. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  11. * 网站地址: http://www.csdeshang.com
  12. * ----------------------------------------------------------------------------
  13. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  14. * 不允许对程序代码以任何形式任何目的的再发布。
  15. * ============================================================================
  16. * 控制器
  17. */
  18. class Memberflea extends BaseFleaMember {
  19. public function initialize() {
  20. parent::initialize(); // TODO: Change the autogenerated stub
  21. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/fleacommon.lang.php');
  22. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/memberflea.lang.php');
  23. }
  24. /**
  25. * 默认显示闲置列表
  26. */
  27. public function index() {
  28. /**
  29. * 实例化闲置物品模型
  30. */
  31. $flea_model = model('flea');
  32. $special_condition['member_id'] = session('member_id');
  33. $special_condition['keyword'] = addslashes(trim(input('keyword')));
  34. $special_condition['order'] = 'goods_id desc';
  35. $list_goods = $flea_model->getFleaList($special_condition, 10, '*', 'goods_id desc', 14);
  36. if (is_array($list_goods) and ! empty($list_goods)) {
  37. foreach ($list_goods as $key => $val) {
  38. $list_goods[$key]['goods_image'] = $list_goods[$key]['goods_image'] == '' ? '' : ds_get_pic( ATTACH_MFLEA . '/' . session('member_id') , str_replace('_1024', '_240', $val['goods_image']));
  39. }
  40. }
  41. View::assign('show_page', $flea_model->page_info->render());
  42. View::assign('list_goods', $list_goods);
  43. //查询会员信息
  44. $this->member_info = $this->getMemberAndGradeInfo(true);
  45. View::assign('menu_sign', 'flea');
  46. View::assign('menu_sign_url', (string) url('Memberflea/index'));
  47. View::assign('menu_sign1', 'flea_list');
  48. $this->setMemberCurItem('index');
  49. $this->setMemberCurMenu('member_flea');
  50. return View::fetch($this->template_dir . 'store_flea_list');
  51. }
  52. /**
  53. * 添加闲置
  54. */
  55. public function add_goods() {
  56. /**
  57. * 检测用户发布闲置物品个数
  58. */
  59. $flea_model = model('flea');
  60. $goods_num = $flea_model->getFleaCount(array('member_id' => session('member_id')));
  61. if ($goods_num >= 10) {
  62. $this->error(lang('store_goods_index_flea_notice1'));
  63. }
  64. /**
  65. * 实例化商品分类模型
  66. */
  67. $fleaclass_model = model('fleaclass');
  68. $goods_class = $fleaclass_model->getTreeClassList(1);
  69. View::assign('goods_class', $goods_class);
  70. /**
  71. * 地区
  72. */
  73. $this->fleaarea_show();
  74. $goods_image_path = ATTACH_MFLEA . '/' . session('member_id') ; //店铺商品图片目录地址
  75. View::assign('goods_image_path', $goods_image_path);
  76. View::assign('item_id', '');
  77. //查询会员信息
  78. $this->member_info = $this->getMemberAndGradeInfo(true);
  79. $this->setMemberCurItem('goods_add');
  80. $this->setMemberCurMenu('member_flea');
  81. View::assign('menu_sign', 'flea');
  82. View::assign('menu_sign_url', (string) url('Memberflea/index'));
  83. View::assign('menu_sign1', 'add_flea_goods');
  84. echo View::fetch($this->template_dir . 'store_flea_goods_add');
  85. }
  86. /**
  87. * 保存闲置物品
  88. */
  89. public function save_goods() {
  90. /**
  91. * 清除前一天冗余图片数据
  92. */
  93. $fleaupload_model = model('fleaupload');
  94. $upload_array = array();
  95. $upload_array[] = array('store_id', '=', session('member_id'));
  96. $upload_array[] = array('fleaupload_type', '=', '12');
  97. $upload_array[] = array('item_id', '=', '0');
  98. $upload_array[] = array('fleaupload_time', '<', TIMESTAMP - 24 * 60 * 60);
  99. $fleaupload_model->delFleaupload($upload_array, session('member_id'));
  100. unset($upload_array);
  101. if (request()->isPost()) {
  102. /**
  103. * 验证表单
  104. */
  105. $data = [
  106. 'goods_name' => input('post.goods_name'),
  107. 'goods_price' => input('post.goods_price')
  108. ];
  109. $memberflea_validate = ds_validate('memberflea');
  110. if (!$memberflea_validate->scene('save_goods')->check($data)) {
  111. ds_json_encode(10001, $memberflea_validate->getError());
  112. }
  113. /**
  114. * 实例化店铺商品模型
  115. */
  116. $flea_model = model('flea');
  117. $goods_array = array();
  118. $goods_array['member_id'] = session('member_id');
  119. $goods_array['member_name'] = session('member_name');
  120. $goods_array['goods_name'] = input('post.goods_name');
  121. $goods_array['fleaclass_id'] = input('post.cate_id');
  122. $goods_array['fleaclass_name'] = input('post.cate_name');
  123. $goods_array['flea_quality'] = input('post.sh_quality');
  124. $goods_array['flea_pname'] = input('post.flea_pname');
  125. $goods_array['fleaarea_id'] = input('post.area_id');
  126. $goods_array['fleaarea_name'] = input('post.area_info');
  127. $goods_array['flea_pphone'] = input('post.flea_pphone');
  128. $goods_array['goods_tag'] = input('post.goods_tag');
  129. $goods_array['goods_price'] = input('post.goods_price');
  130. $goods_array['goods_store_price'] = input('post.goods_store_price');
  131. $goods_array['goods_show'] = '1';
  132. $goods_array['goods_body'] = input('post.mct_introduce');
  133. $goods_array['goods_keywords'] = input('post.seo_keywords');
  134. $goods_array['goods_description'] = input('post.seo_description');
  135. $res=word_filter($goods_array['goods_name'].' '.$goods_array['goods_tag'].' '.$goods_array['goods_body'].' '.$goods_array['flea_pname'].' '.$goods_array['goods_keywords'].' '.$goods_array['goods_description']);
  136. if(!$res['code']){
  137. ds_json_encode(10001,$res['msg']);
  138. }
  139. if($res['data']['if_sensitive']){
  140. ds_json_encode(10001,implode('、',$res['data']['sensitive_msg']));
  141. }
  142. $state = $flea_model->addFlea($goods_array);
  143. if ($state) {
  144. /**
  145. * 更新闲置物品多图
  146. */
  147. $upload_array = array();
  148. $upload_array[] = array('store_id', '=', session('member_id'));
  149. $upload_array[] = array('item_id', '=', '0');
  150. $upload_array[] = array('fleaupload_type', 'in', array('12', '13'));
  151. $goods_file_id_array = input('post.goods_file_id/a');
  152. $upload_array[] = array('fleaupload_id', 'in', implode(",", $goods_file_id_array));
  153. $fleaupload_model->editFleaupload(array('item_id' => $state), $upload_array);
  154. /**
  155. * 商品封面图片修改
  156. */
  157. if (!empty($goods_file_id_array[0])) {
  158. $image_info = $flea_model->getFleauploadList(array('fleaupload_id' => intval($goods_file_id_array[0])));
  159. $goods_image = $image_info[0]['fleafile_name'];
  160. $flea_model->editFlea(array('goods_image' => $goods_image), array('goods_id' => $state, 'member_id' => $this->member_info['member_id']));
  161. }
  162. ds_json_encode(10000, lang('store_goods_index_flea_add_success'));
  163. } else {
  164. ds_json_encode(10001, lang('store_goods_index_flea_add_fail'));
  165. }
  166. }
  167. }
  168. /**
  169. * 删除闲置物品
  170. */
  171. public function flea_del() {
  172. /**
  173. * 实例化闲置物品模型
  174. */
  175. $flea_model = model('flea');
  176. /**
  177. * 检查商品是否属于店铺
  178. */
  179. $goods_id = trim(input('goods_id'));
  180. if (empty($goods_id)) {
  181. ds_json_encode(10001, lang('param_error'));
  182. }
  183. //统计输入数量
  184. $goods_id_array = explode(',', $goods_id);
  185. $input_goods_count = count($goods_id_array);
  186. //统计确认的数量
  187. $condition = array();
  188. $condition[] = array('member_id', '=', session('member_id'));
  189. $condition[] = array('goods_id', 'in', $goods_id);
  190. $verify_count = $flea_model->getFleaCount($condition);
  191. //判断输入和确认是否一致
  192. if ($input_goods_count !== $verify_count) {
  193. ds_json_encode(10001, lang('param_error'));
  194. }
  195. $state = $flea_model->delFlea($goods_id);
  196. if ($state) {
  197. ds_json_encode(10000, lang('store_goods_index_flea_del_success'));
  198. } else {
  199. ds_json_encode(10001, lang('store_goods_index_flea_del_fail'));
  200. }
  201. }
  202. public function drop_image() {
  203. $id = intval(input('id'));
  204. $fleaupload_model = model('fleaupload');
  205. $drop_stata = $fleaupload_model->delFleaupload(array('fleaupload_id' => $id, 'store_id' => session('member_id')), session('member_id'));
  206. if ($drop_stata) {
  207. echo json_encode(array('done' => true));
  208. exit;
  209. }
  210. }
  211. /**
  212. * 编辑闲置物品页面
  213. */
  214. public function edit_goods() {
  215. /**
  216. * 实例化店铺商品模型
  217. */
  218. $flea_model = model('flea');
  219. $goods_array = $flea_model->getFleaList(array('goods_id' => intval(input('param.goods_id'))));
  220. View::assign('goods', $goods_array[0]);
  221. View::assign('goods_id', $goods_array[0]['goods_id']);
  222. $goods_image_path = ATTACH_MFLEA . '/' . session('member_id'); //店铺商品图片目录地址
  223. $goods_image = $flea_model->getFleauploadList(array('store_id' => session('member_id'), 'item_id' => $goods_array[0]['goods_id'], 'fleaupload_type' => 12));
  224. if (is_array($goods_image) and ! empty($goods_image)) {
  225. $goods_image_1 = ds_get_pic($goods_image_path , $goods_array[0]['goods_image']); //封面图
  226. $image_key = 0;
  227. foreach ($goods_image as $key => $val) {
  228. $goods_image[$key] = $val;
  229. if ($goods_array[0]['goods_image'] == $val['fleafile_name'])
  230. $image_key = $key;
  231. }
  232. if ($image_key > 0) {//将封面图放到第一位显示
  233. $goods_image_0 = $goods_image[0];
  234. $goods_image[0] = $goods_image[$image_key];
  235. $goods_image[$image_key] = $goods_image_0;
  236. }
  237. }
  238. View::assign('goods_image', $goods_image);
  239. View::assign('goods_image_path', $goods_image_path);
  240. /**
  241. * 实例化商品分类模型
  242. */
  243. $fleaclass_model = model('fleaclass');
  244. $goods_class = $fleaclass_model->getTreeClassList(1);
  245. View::assign('goods_class', $goods_class);
  246. View::assign('item_id', $goods_array[0]['goods_id']);
  247. //查询会员信息
  248. $this->member_info = $this->getMemberAndGradeInfo(true);
  249. $this->setMemberCurItem('goods_edit');
  250. $this->setMemberCurMenu('member_flea');
  251. View::assign('menu_sign', 'flea');
  252. View::assign('menu_sign_url', (string) url('Memberflea/index'));
  253. View::assign('menu_sign1', 'edit_flea');
  254. /**
  255. * 地区
  256. */
  257. $this->fleaarea_show();
  258. return View::fetch($this->template_dir . 'store_flea_goods_add');
  259. }
  260. /**
  261. * 编辑闲置物品保存
  262. */
  263. public function edit_save_goods() {
  264. $goods_id = intval(input('post.goods_id'));
  265. if ($goods_id != 0) {
  266. /**
  267. * 验证表单
  268. */
  269. $data = [
  270. 'goods_name' => input('post.goods_name'),
  271. 'goods_price' => input('post.goods_price')
  272. ];
  273. $memberflea_validate = ds_validate('memberflea');
  274. if (!$memberflea_validate->scene('edit_save_goods')->check($data)) {
  275. ds_json_encode(10001, $memberflea_validate->getError());
  276. }
  277. /**
  278. * 实例化闲置物品模型
  279. */
  280. $flea_model = model('flea');
  281. $goods_array = array();
  282. $goods_array['goods_name'] = input('post.goods_name');
  283. $goods_array['fleaclass_id'] = input('post.cate_id');
  284. $goods_array['fleaclass_name'] = input('post.cate_name');
  285. $goods_array['flea_quality'] = input('post.sh_quality');
  286. $goods_array['flea_pname'] = input('post.flea_pname');
  287. $goods_array['fleaarea_id'] = input('post.area_id');
  288. $goods_array['fleaarea_name'] = input('post.area_info');
  289. $goods_array['flea_pphone'] = input('post.flea_pphone');
  290. $goods_array['goods_tag'] = input('post.goods_tag');
  291. $goods_array['goods_price'] = input('post.goods_price');
  292. $goods_array['goods_store_price'] = input('post.goods_store_price');
  293. $goods_array['goods_show'] = '1';
  294. $goods_array['goods_body'] = input('post.mct_introduce');
  295. $goods_array['goods_keywords'] = input('post.seo_keywords');
  296. $goods_array['goods_description'] = input('post.seo_description');
  297. $state = $flea_model->editFlea($goods_array, array('goods_id' => $goods_id, 'member_id' => $this->member_info['member_id']));
  298. if ($state >= 0) {
  299. /**
  300. * 闲置物品封面图片修改
  301. */
  302. if (!empty($_POST['goods_file_id'][0])) {
  303. $image_info = $flea_model->getFleauploadList(array('fleaupload_id' => intval($_POST['goods_file_id'][0])));
  304. $goods_image = $image_info[0]['fleafile_name'];
  305. $flea_model->editFlea(array('goods_image' => $goods_image), array('goods_id' => $goods_id, 'member_id' => $this->member_info['member_id']));
  306. }
  307. ds_json_encode(10000, lang('store_goods_index_flea_goods_edit_success'));
  308. } else {
  309. ds_json_encode(10001, lang('store_goods_index_flea_goods_edit_fail'));
  310. }
  311. }
  312. }
  313. /**
  314. * 上传图片
  315. */
  316. public function image_upload() {
  317. if (input('upload_type') == 'uploadedfile') {
  318. $fleaupload_model = model('fleaupload');
  319. $file_id = intval(input('post.file_id'));
  320. if ($file_id > 0) {
  321. $drop_stata = $fleaupload_model->delFleaupload(array('fleaupload_id' => $file_id, 'store_id' => session('member_id')), session('member_id'));
  322. }
  323. /**
  324. * 实例化json模型
  325. */
  326. /**
  327. * 上传图片
  328. */
  329. $upload_path = BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_MFLEA . DIRECTORY_SEPARATOR . session('member_id') . DIRECTORY_SEPARATOR;
  330. $file_name = session('member_id') . '_' . date('YmdHis') . rand(10000, 99999) . '.png';
  331. $res = ds_upload_pic(ATTACH_MFLEA . DIRECTORY_SEPARATOR . session('member_id'), 'file', $file_name);
  332. if ($res['code']) {
  333. $file_name = $res['data']['file_name'];
  334. //生成缩略图
  335. ds_create_thumb($upload_path, $file_name, '240,1024', '240,1024', '_small,_normal');
  336. } else {
  337. echo "<script type='text/javascript'>alert('" . $e->getMessage() . "');history.back();</script>";
  338. exit;
  339. }
  340. /**
  341. * 取得图像大小
  342. */
  343. list($width, $height, $type, $attr) = getimagesize(ds_get_pic(ATTACH_MFLEA . DIRECTORY_SEPARATOR . session('member_id'), $file_name));
  344. /**
  345. * 图片数据入库
  346. */
  347. $insert_array = array();
  348. $image_type = array('goods_image' => 12, 'desc_image' => 13); //debug
  349. $insert_array['fleafile_name'] = $file_name;
  350. $insert_array['fleafile_size'] = intval($_FILES['file']['size']);
  351. $insert_array['fleaupload_time'] = TIMESTAMP;
  352. $insert_array['item_id'] = intval(input('post.item_id'));
  353. $insert_array['store_id'] = session('member_id');
  354. $insert_array['fleaupload_type'] = $image_type['goods_image'];
  355. $result2 = $fleaupload_model->addFleaupload($insert_array);
  356. $data = array();
  357. $data['file_id'] = $result2;
  358. $data['file_name'] = $file_name;
  359. $data['file_path'] = $file_name;
  360. $data['file_url'] = ds_get_pic(ATTACH_MFLEA . '/' . session('member_id'),$file_name);
  361. $data['instance'] = 'goods_image';
  362. $data['id'] = intval(input('post.id'));
  363. /**
  364. * 整理为json格式
  365. */
  366. $output = json_encode($data);
  367. echo "<script type='text/javascript'>window.parent.add_uploadedfile('" . $output . "');</script>";
  368. }
  369. return View::fetch($this->template_dir . 'flea_upload_image');
  370. }
  371. /**
  372. * 判断当前分类是否为最后一级分类
  373. */
  374. public function check_class() {
  375. if (input('required') == 'false' and input('cate_id') == '0') {
  376. echo 'true';
  377. exit;
  378. }
  379. /**
  380. * 实例化商品分类模型
  381. */
  382. $fleaclass_model = model('fleaclass');
  383. $sub_class = $fleaclass_model->getFleaclassList(array('fleaclass_parent_id' => intval(input('get.cate_id'))));
  384. if (is_array($sub_class) and ! empty($sub_class)) {
  385. echo 'false';
  386. } else {
  387. echo 'true';
  388. }
  389. }
  390. /**
  391. * 买家闲置收藏
  392. *
  393. * @param
  394. * @return
  395. */
  396. public function favorites() {
  397. /**
  398. * 实例化模型
  399. */
  400. $fleafavorites_model = model('fleafavorites');
  401. /**
  402. * 类型
  403. */
  404. /**
  405. * 删除操作
  406. */
  407. if (input('drop') && input('drop') == 'ok' && input('fav_id')) {
  408. $fav_arr = explode(',', input('fav_id'));
  409. if (!empty($fav_arr) && is_array($fav_arr)) {
  410. /**
  411. * 批量删除
  412. */
  413. foreach ($fav_arr as $fav_id) {
  414. if (intval($fav_id) > 0) {
  415. $condition = array();
  416. $condition[] = array('fleafav_id', '=', intval($fav_id));
  417. $condition[] = array('member_id', '=', session('member_id'));
  418. $condition[] = array('fleafav_type', '=', 'flea');
  419. if (!$fleafavorites_model->delFleafavorites($condition)) {
  420. ds_json_encode(10001, lang('flea_favorite_del_fail'));
  421. }
  422. }
  423. }
  424. Db::name('flea')->where('goods_id', 'in', $fav_arr)->dec('flea_collect_num')->update();
  425. } else {
  426. if (intval(input('get.fav_id')) > 0) {
  427. $condition = array();
  428. $condition[] = array('fleafav_id', '=', intval(input('get.fav_id')));
  429. $condition[] = array('member_id', '=', session('member_id'));
  430. $condition[] = array('fleafav_type', '=', 'flea');
  431. if (!$fleafavorites_model->delFleafavorites($condition)) {
  432. ds_json_encode(10001, lang('flea_favorite_del_fail'));
  433. }
  434. Db::name('flea')->where('goods_id', input('fav_id'))->dec('flea_collect_num')->update();
  435. }
  436. }
  437. ds_json_encode(10000, lang('flea_favorite_del_success'));
  438. }
  439. /**
  440. * 分页
  441. */
  442. /**
  443. * 得到收藏列表
  444. */
  445. $subQuery = Db::name('fleafavorites')->field('fleafav_id')->where(array('member_id' => session('member_id'), 'fleafav_type' => 'flea'))->buildSql();
  446. $show_page = Db::name('flea')->field('goods_id,goods_name,goods_image,goods_store_price,member_name,member_id')->where('goods_id in ' . $subQuery)->paginate(['list_rows' => 10, 'query' => request()->param()], false);
  447. $type_list = $show_page->items();
  448. if (!empty($type_list) && is_array($type_list)) {
  449. foreach ($type_list as $key => $fav) {
  450. if ($fav['goods_image']) {
  451. $type_list[$key]['goods_image'] = ds_get_pic( ATTACH_MFLEA . '/' . $fav['member_id'] , str_replace('_1024', '_240', $fav['goods_image']));
  452. }
  453. }
  454. }
  455. //查询会员信息
  456. $this->member_info = $this->getMemberAndGradeInfo(true);
  457. /**
  458. * 页面输出
  459. */
  460. $this->setMemberCurItem('fav_flea');
  461. $this->setMemberCurMenu('member_flea');
  462. View::assign('menu_sign', 'flea_favorites');
  463. View::assign('favorites_list', $type_list);
  464. View::assign('show_page', $show_page);
  465. View::assign('menu_sign_url', (string) url('Memberflea/favorites'));
  466. View::assign('menu_sign1', 'flea_favorites_list');
  467. return View::fetch($this->template_dir . "favorites_flea_index");
  468. }
  469. /**
  470. * 增加买家收藏
  471. *
  472. * @param
  473. * @return
  474. */
  475. public function addfavorites() {
  476. if (intval(input('fav_id')) > 0) {
  477. /**
  478. * 实例化模型
  479. */
  480. $fleafavorites_model = model('fleafavorites');
  481. //判断商品,店铺是否为当前会员
  482. $flea_model = model('flea');
  483. $flea_info = $flea_model->getFleaList(array('goods_id' => intval(input('param.fav_id'))));
  484. if ($flea_info[0]['member_id'] == session('member_id')) {
  485. echo json_encode(array('done' => false, 'msg' => lang('flea_favorite_no_my_product')));
  486. die;
  487. }
  488. //闲置物品收藏次数增加1
  489. $check_rss = $fleafavorites_model->checkFleafavorites(intval(input('fav_id')), 'flea', session('member_id'));
  490. if (!$check_rss) {
  491. Db::name('flea')->where('goods_id', input('fav_id'))->inc('flea_collect_num')->update();
  492. $add_rs = $fleafavorites_model->addFleafavorites(array(
  493. 'member_id' => session('member_id'),
  494. 'fleafav_id' => intval(input('fav_id')),
  495. 'fleafav_type' => 'flea',
  496. 'fleafav_time' => TIMESTAMP
  497. ));
  498. if (!$add_rs) {
  499. echo json_encode(array('done' => false, 'msg' => lang('flea_favorite_collect_fail')));
  500. }
  501. echo json_encode(array('done' => true, 'msg' => lang('flea_favorite_collect_success')));
  502. }
  503. echo json_encode(array('done' => true, 'msg' => lang('flea_favorite_collect_tips')));
  504. } else {
  505. echo json_encode(array('done' => false, 'msg' => lang('flea_favorite_collect_fail')));
  506. }
  507. }
  508. private function fleaarea_show() {
  509. /**
  510. * 加载模型
  511. */
  512. $fleaarea_model = model('fleaarea');
  513. $condition[] = array('fleaarea_parent_id', '=', 0);
  514. $area_one_level = $fleaarea_model->getFleaareaList($condition, 'fleaarea_id,fleaarea_name');
  515. View::assign('area_one_level', $area_one_level);
  516. }
  517. protected function getMemberItemList() {
  518. $menu_array = array();
  519. switch (request()->action()) {
  520. case 'index':
  521. $menu_array = array(
  522. array('name' => 'index', 'text' => lang('idle_list'), 'url' => (string) url('Memberflea/index'))
  523. );
  524. break;
  525. case 'add_goods':
  526. $menu_array = array(
  527. array('name' => 'index', 'text' => lang('idle_list'), 'url' => (string) url('Memberflea/index')),
  528. array('name' => 'goods_add', 'text' => lang('release_idle'), 'url' => (string) url('Memberflea/add_goods'))
  529. );
  530. break;
  531. case 'favorites':
  532. $menu_array = array(
  533. array(
  534. 'name' => 'fav_goods', 'text' => lang('ds_member_path_collect_list'),
  535. 'url' => (string) url('Memberfavorites/fglist')
  536. ), array(
  537. 'name' => 'fav_store', 'text' => lang('ds_member_path_collect_store'),
  538. 'url' => (string) url('Memberfavorites/fslist')
  539. ),
  540. array(
  541. 'name' => 'fav_flea', 'text' => lang('collection_idle'), 'url' => (string) url('Memberflea/favorites')
  542. )
  543. );
  544. }
  545. return $menu_array;
  546. }
  547. }