Goods.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * 控制器
  12. */
  13. class Goods extends BaseGoods
  14. {
  15. public function initialize()
  16. {
  17. parent::initialize();
  18. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/goods.lang.php');
  19. }
  20. /**
  21. * 单个商品信息页
  22. */
  23. public function index()
  24. {
  25. $goods_id = intval(input('param.goods_id'));
  26. // 商品详细信息
  27. $goods_model = model('goods');
  28. $goods_detail = $goods_model->getGoodsDetail($goods_id);
  29. $goods_info = $goods_detail['goods_info'];
  30. if (empty($goods_info)) {
  31. $this->error(lang('goods_index_no_goods'), HOME_SITE_URL);
  32. }
  33. // 获取销量 BEGIN
  34. $rs = $goods_model->getGoodsList(array('goods_commonid' => $goods_info['goods_commonid']));
  35. $count = 0;
  36. foreach ($rs as $v) {
  37. $count += $v['goods_salenum'];
  38. }
  39. $goods_info['goods_salenum'] = $count;
  40. // 获取销量 END
  41. $this->getStoreInfo($goods_info['store_id']);
  42. // 看了又看(同分类本店随机商品)
  43. $goods_rand_list = model('goods')->getGoodsGcStoreRandList($goods_info['gc_id_1'], $goods_info['store_id'], $goods_info['goods_id'], 2);
  44. View::assign('goods_rand_list', $goods_rand_list);
  45. View::assign('spec_list', $goods_detail['spec_list']);
  46. View::assign('spec_image', $goods_detail['spec_image']);
  47. View::assign('goods_image', $goods_detail['goods_image']);
  48. View::assign('mansong_info', $goods_detail['mansong_info']);
  49. View::assign('gift_array', $goods_detail['gift_array']);
  50. View::assign('baidu_ak', config('ds_config.baidu_ak'));
  51. $chain_model = model('chain');
  52. $chain_ids = Db::name('chain_goods')->where(array(array('goods_id', '=', $goods_id), array('goods_storage', '>', 0)))->column('chain_id');
  53. $chain_info = $chain_model->getChainOpenInfo(array(array('chain_if_pickup', '=', 1), array('chain_id', 'in', $chain_ids)));
  54. View::assign('if_chain', $chain_info ? 1 : 0);
  55. $inform_switch = true;
  56. // 检测商品是否下架,检查是否为店主本人
  57. if ($goods_info['goods_state'] != 1 || $goods_info['goods_verify'] != 1 || $goods_info['store_id'] == session('store_id')) {
  58. $inform_switch = false;
  59. }
  60. View::assign('inform_switch', $inform_switch);
  61. // 如果使用售卖区域
  62. if ($goods_info['transport_id'] > 0) {
  63. // 取得三种运送方式默认运费
  64. $transport_model = model('transport');
  65. $transport = $transport_model->getTransportextendList(array('transport_id' => $goods_info['transport_id'], 'transportext_is_default' => 1));
  66. if (!empty($transport) && is_array($transport)) {
  67. foreach ($transport as $v) {
  68. $goods_info["transport_price"] = $v['transportext_sprice'];
  69. }
  70. }
  71. }
  72. $inviter_model = model('inviter');
  73. $goods_info['inviter_money'] = 0;
  74. if (config('ds_config.inviter_show') && config('ds_config.inviter_open') && $goods_info['inviter_open'] && session('member_id') && $inviter_model->getInviterInfo('i.inviter_id=' . session('member_id') . ' AND i.inviter_state=1')) {
  75. $inviter_money = round($goods_info['inviter_ratio'] / 100 * $goods_info['goods_price'] * floatval(config('ds_config.inviter_ratio_1')) / 100, 2);
  76. if ($inviter_money > 0) {
  77. $goods_info['inviter_money'] = $inviter_money;
  78. }
  79. }
  80. $goods_info['goodsvideo_url'] = goods_video($goods_info['goodsvideo_name']);
  81. // halt($goods_info);
  82. View::assign('goods', $goods_info);
  83. //抢购商品是否开始
  84. $IsHaveBuy = 0;
  85. if (session('member_id')) {
  86. $buyer_id = session('member_id');
  87. $promotion_type = isset($goods_info["promotion_type"]) ? $goods_info["promotion_type"] : '';
  88. if ($promotion_type == 'groupbuy') {
  89. //检测是否限购数量
  90. $upper_limit = $goods_info["upper_limit"];
  91. if ($upper_limit > 0) {
  92. //查询些会员的订单中,是否已买过了
  93. $order_model = model('order');
  94. //取商品列表
  95. $order_goods_list = $order_model->getOrdergoodsList(array('goods_id' => $goods_id, 'buyer_id' => $buyer_id, 'goods_type' => 2));
  96. if ($order_goods_list) {
  97. //取得上次购买的活动编号(防一个商品参加多次抢购活动的问题)
  98. $promotions_id = $order_goods_list[0]["promotions_id"];
  99. //用此编号取数据,检测是否这次活动的订单商品。
  100. $groupbuy_model = model('groupbuy');
  101. $groupbuy_info = $groupbuy_model->getGroupbuyInfo(array('groupbuy_id' => $promotions_id));
  102. if ($groupbuy_info) {
  103. $IsHaveBuy = 1;
  104. } else {
  105. $IsHaveBuy = 0;
  106. }
  107. }
  108. }
  109. }
  110. }
  111. View::assign('IsHaveBuy', $IsHaveBuy);
  112. //end
  113. $storeplate_model = model('storeplate');
  114. // 顶部关联版式
  115. if ($goods_info['plateid_top'] > 0) {
  116. $plate_top = $storeplate_model->getStoreplateInfoByID($goods_info['plateid_top']);
  117. View::assign('plate_top', $plate_top);
  118. }
  119. // 底部关联版式
  120. if ($goods_info['plateid_bottom'] > 0) {
  121. $plate_bottom = $storeplate_model->getStoreplateInfoByID($goods_info['plateid_bottom']);
  122. View::assign('plate_bottom', $plate_bottom);
  123. }
  124. View::assign('store_id', $goods_info['store_id']);
  125. //推荐商品
  126. $goods_commend_list = $goods_model->getGoodsOnlineList(array(array('store_id', '=', $goods_info['store_id']), array('goods_commend', '=', 1)), 'goods_id,goods_name,goods_advword,goods_image,store_id,goods_price', 0, '', 5, 'goods_commonid');
  127. View::assign('goods_commend', $goods_commend_list);
  128. // 当前位置导航
  129. $nav_link_list = model('goodsclass')->getGoodsclassnav($goods_info['gc_id'], 0);
  130. $nav_link_list[] = array('title' => $goods_info['goods_name']);
  131. View::assign('nav_link_list', $nav_link_list);
  132. //评价信息
  133. $goods_evaluate_info = model('evaluategoods')->getEvaluategoodsInfoByGoodsID($goods_id);
  134. View::assign('goods_evaluate_info', $goods_evaluate_info);
  135. //SEO 设置
  136. $seo_param = array();
  137. $seo_param['name'] = $goods_info['goods_name'];
  138. $seo_param['key'] = $goods_info['goods_name'];
  139. $seo_param['description'] = ds_substing(htmlspecialchars_decode($goods_info['goods_body']));
  140. $this->_assign_seo(model('seo')->type('product')->param($seo_param)->show());
  141. return View::fetch($this->template_dir . 'goods');
  142. }
  143. /**
  144. * 记录浏览历史
  145. */
  146. public function addbrowse()
  147. {
  148. $goods_id = intval(input('param.gid'));
  149. model('goodsbrowse')->addViewedGoods($goods_id, session('member_id'), session('store_id'));
  150. exit();
  151. }
  152. /**
  153. * 商品评论
  154. */
  155. public function comments()
  156. {
  157. $goods_id = intval(input('param.goods_id'));
  158. $type = input('param.type');
  159. $this->_get_comments($goods_id, $type, 10);
  160. echo View::fetch($this->template_dir . 'goods_comments');
  161. }
  162. /**
  163. * 商品评价详细页
  164. */
  165. public function comments_list()
  166. {
  167. $goods_id = intval(input('param.goods_id'));
  168. // 商品详细信息
  169. $goods_model = model('goods');
  170. $goods_info = $goods_model->getGoodsInfoByID($goods_id);
  171. // 验证商品是否存在
  172. if (empty($goods_info)) {
  173. $this->error(lang('goods_index_no_goods'));
  174. }
  175. View::assign('goods', $goods_info);
  176. $this->getStoreInfo($goods_info['store_id']);
  177. // 当前位置导航
  178. $nav_link_list = model('goodsclass')->getGoodsclassnav($goods_info['gc_id'], 0);
  179. $nav_link_list[] = array('title' => $goods_info['goods_name'], 'link' => (string)url('Goods/index', ['goods_id' => $goods_id]));
  180. $nav_link_list[] = array('title' => lang('goods_index_evaluation'));
  181. View::assign('nav_link_list', $nav_link_list);
  182. //评价信息
  183. $goods_evaluate_info = model('evaluategoods')->getEvaluategoodsInfoByGoodsID($goods_id);
  184. View::assign('goods_evaluate_info', $goods_evaluate_info);
  185. //SEO 设置
  186. $seo_param = array();
  187. $seo_param['name'] = $goods_info['goods_name'];
  188. $seo_param['description'] = ds_substing($goods_info['goods_name']);
  189. $this->_assign_seo(model('seo')->type('product')->param($seo_param)->show());
  190. $this->_get_comments($goods_id, input('param.type'), 20);
  191. return View::fetch($this->template_dir . 'comments_list');
  192. }
  193. private function _get_comments($goods_id, $type, $page)
  194. {
  195. $condition = array();
  196. $condition[] = array('geval_goodsid', '=', $goods_id);
  197. switch ($type) {
  198. case '1':
  199. $condition[] = array('geval_scores', 'in', '5,4');
  200. View::assign('type', '1');
  201. break;
  202. case '2':
  203. $condition[] = array('geval_scores', 'in', '3,2');
  204. View::assign('type', '2');
  205. break;
  206. case '3':
  207. $condition[] = array('geval_scores', 'in', '1');
  208. View::assign('type', '3');
  209. break;
  210. default:
  211. View::assign('type', '');
  212. break;
  213. }
  214. //查询商品评分信息
  215. $evaluategoods_model = model('evaluategoods');
  216. $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, $page);
  217. View::assign('goodsevallist', $goodsevallist);
  218. View::assign('show_page', $evaluategoods_model->page_info->render());
  219. }
  220. /**
  221. * 销售记录
  222. */
  223. public function salelog()
  224. {
  225. $goods_id = intval(input('param.goods_id'));
  226. $vr = intval('param.vr');
  227. if ($vr) {
  228. $vrorder_model = model('vrorder');
  229. $sales = $vrorder_model->getVrorderAndOrderGoodsSalesRecordList(array(array('goods_id', '=', $goods_id)), '*', 10);
  230. View::assign('show_page', $vrorder_model->page_info->render());
  231. } else {
  232. $order_model = model('order');
  233. $sales = $order_model->getOrderAndOrderGoodsSalesRecordList(array(array('order_goods.goods_id', '=', $goods_id)), 'order_goods.*, order.buyer_name, order.add_time', 10);
  234. View::assign('show_page', $order_model->page_info->render());
  235. }
  236. View::assign('sales', $sales);
  237. View::assign('order_type', array(2 => lang('ds_xianshi_rob'), 3 => lang('ds_xianshi_flag'), '4' => lang('ds_xianshi_suit')));
  238. echo View::fetch($this->template_dir . 'goods_salelog');
  239. }
  240. /**
  241. * 产品咨询
  242. */
  243. public function consulting()
  244. {
  245. $goods_id = intval(input('param.goods_id'));
  246. if ($goods_id <= 0) {
  247. $this->error(lang('param_error'), '', 'html', 'error');
  248. }
  249. //得到商品咨询信息
  250. $consult_model = model('consult');
  251. $condition = array();
  252. $condition[] = array('goods_id', '=', $goods_id);
  253. $ctid = intval(input('param.ctid'));
  254. if ($ctid > 0) {
  255. $condition[] = array('consulttype_id', '=', $ctid);
  256. }
  257. $consult_list = $consult_model->getConsultList($condition, '*', '10');
  258. View::assign('consult_list', $consult_list);
  259. // 咨询类型
  260. $consult_type = rkcache('consulttype', true);
  261. View::assign('consult_type', $consult_type);
  262. View::assign('consult_able', $this->checkConsultAble());
  263. echo View::fetch($this->template_dir . 'goods_consulting');
  264. }
  265. /**
  266. * 产品咨询
  267. */
  268. public function consulting_list()
  269. {
  270. View::assign('hidden_nctoolbar', 1);
  271. $goods_id = intval(input('param.goods_id'));
  272. if ($goods_id <= 0) {
  273. $this->error(lang('param_error'));
  274. }
  275. // 商品详细信息
  276. $goods_model = model('goods');
  277. $goods_info = $goods_model->getGoodsInfoByID($goods_id);
  278. // 验证商品是否存在
  279. if (empty($goods_info)) {
  280. $this->error(lang('goods_index_no_goods'));
  281. }
  282. View::assign('goods', $goods_info);
  283. $this->getStoreInfo($goods_info['store_id']);
  284. // 当前位置导航
  285. $nav_link_list = model('goodsclass')->getGoodsclassnav($goods_info['gc_id'], 0);
  286. $nav_link_list[] = array('title' => $goods_info['goods_name'], 'link' => (string)url('Goods/index', ['goods_id' => $goods_id]));
  287. $nav_link_list[] = array('title' => lang('goods_commodity_consulting'));
  288. View::assign('nav_link_list', $nav_link_list);
  289. //得到商品咨询信息
  290. $consult_model = model('consult');
  291. $condition = array();
  292. $condition[] = array('goods_id', '=', $goods_id);
  293. if (intval(input('param.ctid')) > 0) {
  294. $condition[] = array('consulttype_id', '=', intval(input('param.ctid')));
  295. }
  296. $consult_list = $consult_model->getConsultList($condition, '*');
  297. View::assign('consult_list', $consult_list);
  298. View::assign('show_page', $consult_model->page_info->render());
  299. // 咨询类型
  300. $consult_type = rkcache('consulttype', true);
  301. View::assign('consult_type', $consult_type);
  302. //SEO 设置
  303. $seo_param = array();
  304. $seo_param['name'] = $goods_info['goods_name'];
  305. $seo_param['description'] = ds_substing($goods_info['goods_name']);
  306. $this->_assign_seo(model('seo')->type('product')->param($seo_param)->show());
  307. View::assign('consult_able', $this->checkConsultAble($goods_info['store_id']));
  308. return View::fetch($this->template_dir . 'consulting_list');
  309. }
  310. private function checkConsultAble($store_id = 0)
  311. {
  312. //检查是否为店主本身
  313. $store_self = false;
  314. if (session('store_id')) {
  315. if (($store_id == 0 && intval(input('param.store_id')) == session('store_id')) || ($store_id != 0 && $store_id == session('store_id'))) {
  316. $store_self = true;
  317. }
  318. }
  319. //查询会员信息
  320. $member_info = array();
  321. $member_model = model('member');
  322. if (session('member_id'))
  323. $member_info = $member_model->getMemberInfoByID(session('member_id'));
  324. //检查是否可以评论
  325. $consult_able = true;
  326. if ((!config('ds_config.guest_comment') && !session('member_id')) || $store_self == true || (session('member_id') > 0 && $member_info['is_allowtalk'] == 0)) {
  327. $consult_able = false;
  328. }
  329. return $consult_able;
  330. }
  331. /**
  332. * 商品咨询添加
  333. */
  334. public function save_consult()
  335. {
  336. //检查是否可以评论
  337. if (!config('ds_config.guest_comment') && !session('member_id')) {
  338. ds_json_encode(10001, lang('goods_index_goods_noallow'));
  339. }
  340. $goods_id = intval(input('post.goods_id'));
  341. if ($goods_id <= 0) {
  342. ds_json_encode(10001, lang('param_error'));
  343. }
  344. //咨询内容的非空验证
  345. if (trim(input('post.goods_content')) == "") {
  346. ds_json_encode(10001, lang('goods_index_input_consult'));
  347. }
  348. //表单验证
  349. $data = [
  350. 'goods_content' => input('post.goods_content')
  351. ];
  352. $res = word_filter($data['goods_content']);
  353. if (!$res['code']) {
  354. ds_json_encode(10001, $res['msg']);
  355. }
  356. $data['goods_content'] = $res['data']['text'];
  357. $goods_validate = ds_validate('goods');
  358. if (!$goods_validate->scene('save_consult')->check($data)) {
  359. ds_json_encode(10001, $goods_validate->getError());
  360. }
  361. if (session('member_id')) {
  362. //查询会员信息
  363. $member_model = model('member');
  364. $member_info = $member_model->getMemberInfo(array('member_id' => session('member_id')));
  365. if (empty($member_info) || $member_info['is_allowtalk'] == 0) {
  366. ds_json_encode(10001, lang('goods_index_goods_noallow'));
  367. }
  368. }
  369. //判断商品编号的存在性和合法性
  370. $goods = model('goods');
  371. $goods_info = $goods->getGoodsInfoByID($goods_id);
  372. if (empty($goods_info)) {
  373. ds_json_encode(10001, lang('goods_index_goods_not_exists'));
  374. }
  375. //判断是否是店主本人
  376. if (session('store_id') && $goods_info['store_id'] == session('store_id')) {
  377. ds_json_encode(10001, lang('goods_index_consult_store_error'));
  378. }
  379. //检查店铺状态
  380. $store_model = model('store');
  381. $store_info = $store_model->getStoreInfoByID($goods_info['store_id']);
  382. if ($store_info['store_state'] == '0' || intval($store_info['store_state']) == '2' || (intval($store_info['store_endtime']) != 0 && $store_info['store_endtime'] <= TIMESTAMP)) {
  383. ds_json_encode(10001, lang('goods_index_goods_store_closed'));
  384. }
  385. //接收数据并保存
  386. $input = array();
  387. $input['goods_id'] = $goods_id;
  388. $input['goods_name'] = $goods_info['goods_name'];
  389. $input['member_id'] = intval(session('member_id')) > 0 ? session('member_id') : 0;
  390. $input['member_name'] = session('member_name') ? session('member_name') : '';
  391. $input['store_id'] = $store_info['store_id'];
  392. $input['store_name'] = $store_info['store_name'];
  393. $input['consulttype_id'] = intval(input('post.consult_type_id', 1));
  394. $input['consult_addtime'] = TIMESTAMP;
  395. $input['consult_content'] = $data['goods_content'];
  396. $input['consult_isanonymous'] = input('post.hide_name') == 'hide' ? 1 : 0;
  397. $consult_model = model('consult');
  398. if ($consult_model->addConsult($input)) {
  399. ds_json_encode(10000, lang('goods_index_consult_success'));
  400. } else {
  401. ds_json_encode(10001, lang('goods_index_consult_fail'));
  402. }
  403. }
  404. /**
  405. * 异步显示优惠套装/推荐组合
  406. */
  407. public function get_bundling()
  408. {
  409. $goods_id = intval(input('param.goods_id'));
  410. if ($goods_id <= 0) {
  411. exit();
  412. }
  413. $goods_model = model('goods');
  414. $goods_info = $goods_model->getGoodsOnlineInfoByID($goods_id);
  415. if (empty($goods_info)) {
  416. exit();
  417. }
  418. // 优惠套装
  419. $array = model('pbundling')->getBundlingCacheByGoodsId($goods_id);
  420. if (!empty($array)) {
  421. View::assign('bundling_array', unserialize($array['bundling_array']));
  422. View::assign('b_goods_array', unserialize($array['b_goods_array']));
  423. }
  424. // 推荐组合
  425. if (!empty($goods_info) && $goods_model->checkIsGeneral($goods_info)) {
  426. $array = model('goodscombo')->getGoodscomboCacheByGoodsId($goods_id);
  427. View::assign('goods_info', $goods_info);
  428. View::assign('gcombo_list', unserialize($array['gcombo_list']));
  429. }
  430. echo View::fetch($this->template_dir . 'goods_bundling');
  431. }
  432. /**
  433. * 商品详细页运费显示
  434. *
  435. * @return unknown
  436. */
  437. public function calc()
  438. {
  439. if (!is_numeric(input('param.area_id')) || !is_numeric(input('param.tid')))
  440. return false;
  441. $freight_total = model('transport')->calcTransport(intval(input('param.tid')), intval(input('param.area_id')));
  442. if ($freight_total > 0) {
  443. if (input('param.myf') > 0) {
  444. if ($freight_total >= input('param.myf')) {
  445. $freight_total = lang('free_shipping');
  446. } else {
  447. $freight_total = lang('freight') . ':' . $freight_total . lang('shop_with') . input('param.myf') . lang('ds_yuan') . ' ' . lang('free_shipping');
  448. }
  449. } else {
  450. $freight_total = lang('freight') . ':' . $freight_total . lang('ds_yuan');
  451. }
  452. } else {
  453. if ($freight_total !== false) {
  454. $freight_total = lang('free_shipping');
  455. }
  456. }
  457. echo input('param.callback') . '(' . json_encode(array('total' => $freight_total)) . ')';
  458. }
  459. /**
  460. * 到货通知
  461. */
  462. public function arrival_notice()
  463. {
  464. if (!session('is_login')) {
  465. $this->error(lang('param_error'));
  466. }
  467. $member_info = model('member')->getMemberInfoByID(session('member_id'));
  468. View::assign('member_info', $member_info);
  469. return View::fetch($this->template_dir . 'arrival_notice_submit');
  470. }
  471. /**
  472. * 到货通知表单
  473. */
  474. public function arrival_notice_submit()
  475. {
  476. $type = intval(input('post.type')) == 2 ? 2 : 1;
  477. $goods_id = intval(input('post.goods_id'));
  478. if ($goods_id <= 0) {
  479. ds_json_encode(10001, lang('param_error'));
  480. }
  481. // 验证商品数是否充足
  482. $goods_info = model('goods')->getGoodsInfoByID($goods_id);
  483. if (empty($goods_info) || ($goods_info['goods_storage'] > 0 && $goods_info['goods_state'] == 1)) {
  484. ds_json_encode(10001, lang('param_error'));
  485. }
  486. $arrivalnotice_model = model('arrivalnotice');
  487. // 验证会员是否已经添加到货通知
  488. $condition = array();
  489. $condition[] = array('goods_id', '=', $goods_info['goods_id']);
  490. $condition[] = array('member_id', '=', session('member_id'));
  491. $condition[] = array('arrivalnotice_type', '=', $type);
  492. $notice_info = $arrivalnotice_model->getArrivalNoticeInfo($condition);
  493. if (!empty($notice_info)) {
  494. if ($type == 1) {
  495. ds_json_encode(10001, lang('goods_no_repeat_add'));
  496. } else {
  497. ds_json_encode(10001, lang('goods_no_repeat_appointment'));
  498. }
  499. }
  500. $mobile = input('post.mobile');
  501. $member_info = model('member')->getMemberInfoByID(session('member_id'));
  502. if ($mobile == encrypt_show($member_info['member_mobile'], 4, 4)) {
  503. $mobile = $member_info['member_mobile'];
  504. }
  505. $insert = array();
  506. $insert['goods_id'] = $goods_info['goods_id'];
  507. $insert['goods_name'] = $goods_info['goods_name'];
  508. $insert['member_id'] = session('member_id');
  509. $insert['arrivalnotice_mobile'] = $mobile;
  510. $insert['arrivalnotice_email'] = input('post.email');
  511. $insert['arrivalnotice_type'] = $type;
  512. $arrivalnotice_model->addArrivalNotice($insert);
  513. ds_json_encode(10000, lang('successful_booking_goods'));
  514. }
  515. public function json_area()
  516. {
  517. echo input('param.callback') . '(' . json_encode(model('area')->getAreaArrayForJson()) . ')';
  518. }
  519. public function show_chain()
  520. {
  521. $goods_id = input('param.goods_id');
  522. $chain_model = model('chain');
  523. $chain_ids = Db::name('chain_goods')->where(array(array('goods_id', '=', $goods_id), array('goods_storage', '>', 0)))->column('chain_id');
  524. $chain_list = $chain_model->getChainOpenList(array(array('chain_if_pickup', '=', 1), array('chain_id', 'in', $chain_ids)));
  525. View::assign('chain_list', $chain_list);
  526. return View::fetch($this->template_dir . 'show_chain');
  527. }
  528. }