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