Goods.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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. * ============================================================================
  14. * 控制器
  15. */
  16. class Goods extends BaseGoods {
  17. public function initialize() {
  18. parent::initialize();
  19. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/goods.lang.php');
  20. }
  21. /**
  22. * 单个商品信息页
  23. */
  24. public function index() {
  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. $goods_id = intval(input('param.gid'));
  148. model('goodsbrowse')->addViewedGoods($goods_id, session('member_id'), session('store_id'));
  149. exit();
  150. }
  151. /**
  152. * 商品评论
  153. */
  154. public function comments() {
  155. $goods_id = intval(input('param.goods_id'));
  156. $type = input('param.type');
  157. $this->_get_comments($goods_id, $type, 10);
  158. echo View::fetch($this->template_dir . 'goods_comments');
  159. }
  160. /**
  161. * 商品评价详细页
  162. */
  163. public function comments_list() {
  164. $goods_id = intval(input('param.goods_id'));
  165. // 商品详细信息
  166. $goods_model = model('goods');
  167. $goods_info = $goods_model->getGoodsInfoByID($goods_id);
  168. // 验证商品是否存在
  169. if (empty($goods_info)) {
  170. $this->error(lang('goods_index_no_goods'));
  171. }
  172. View::assign('goods', $goods_info);
  173. $this->getStoreInfo($goods_info['store_id']);
  174. // 当前位置导航
  175. $nav_link_list = model('goodsclass')->getGoodsclassnav($goods_info['gc_id'], 0);
  176. $nav_link_list[] = array('title' => $goods_info['goods_name'], 'link' => (string)url('Goods/index', ['goods_id' => $goods_id]));
  177. $nav_link_list[] = array('title' => lang('goods_index_evaluation'));
  178. View::assign('nav_link_list', $nav_link_list);
  179. //评价信息
  180. $goods_evaluate_info = model('evaluategoods')->getEvaluategoodsInfoByGoodsID($goods_id);
  181. View::assign('goods_evaluate_info', $goods_evaluate_info);
  182. //SEO 设置
  183. $seo_param = array();
  184. $seo_param['name'] = $goods_info['goods_name'];
  185. $seo_param['description'] = ds_substing($goods_info['goods_name']);
  186. $this->_assign_seo(model('seo')->type('product')->param($seo_param)->show());
  187. $this->_get_comments($goods_id, input('param.type'), 20);
  188. return View::fetch($this->template_dir . 'comments_list');
  189. }
  190. private function _get_comments($goods_id, $type, $page) {
  191. $condition = array();
  192. $condition[]=array('geval_goodsid','=',$goods_id);
  193. switch ($type) {
  194. case '1':
  195. $condition[]=array('geval_scores','in', '5,4');
  196. View::assign('type', '1');
  197. break;
  198. case '2':
  199. $condition[]=array('geval_scores','in', '3,2');
  200. View::assign('type', '2');
  201. break;
  202. case '3':
  203. $condition[]=array('geval_scores','in', '1');
  204. View::assign('type', '3');
  205. break;
  206. default:
  207. View::assign('type','');
  208. break;
  209. }
  210. //查询商品评分信息
  211. $evaluategoods_model = model('evaluategoods');
  212. $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, $page);
  213. View::assign('goodsevallist', $goodsevallist);
  214. View::assign('show_page', $evaluategoods_model->page_info->render());
  215. }
  216. /**
  217. * 销售记录
  218. */
  219. public function salelog() {
  220. $goods_id = intval(input('param.goods_id'));
  221. $vr = intval('param.vr');
  222. if ($vr) {
  223. $vrorder_model = model('vrorder');
  224. $sales = $vrorder_model->getVrorderAndOrderGoodsSalesRecordList(array(array('goods_id' ,'=', $goods_id)), '*', 10);
  225. View::assign('show_page', $vrorder_model->page_info->render());
  226. } else {
  227. $order_model = model('order');
  228. $sales = $order_model->getOrderAndOrderGoodsSalesRecordList(array(array('order_goods.goods_id' ,'=', $goods_id)), 'order_goods.*, order.buyer_name, order.add_time', 10);
  229. View::assign('show_page', $order_model->page_info->render());
  230. }
  231. View::assign('sales', $sales);
  232. View::assign('order_type', array(2 => lang('ds_xianshi_rob'), 3 => lang('ds_xianshi_flag'), '4' => lang('ds_xianshi_suit')));
  233. echo View::fetch($this->template_dir . 'goods_salelog');
  234. }
  235. /**
  236. * 产品咨询
  237. */
  238. public function consulting() {
  239. $goods_id = intval(input('param.goods_id'));
  240. if ($goods_id <= 0) {
  241. $this->error(lang('param_error'), '', 'html', 'error');
  242. }
  243. //得到商品咨询信息
  244. $consult_model = model('consult');
  245. $condition = array();
  246. $condition[] = array('goods_id','=',$goods_id);
  247. $ctid = intval(input('param.ctid'));
  248. if ($ctid > 0) {
  249. $condition[] = array('consulttype_id','=',$ctid);
  250. }
  251. $consult_list = $consult_model->getConsultList($condition, '*', '10');
  252. View::assign('consult_list', $consult_list);
  253. // 咨询类型
  254. $consult_type = rkcache('consulttype', true);
  255. View::assign('consult_type', $consult_type);
  256. View::assign('consult_able', $this->checkConsultAble());
  257. echo View::fetch($this->template_dir . 'goods_consulting');
  258. }
  259. /**
  260. * 产品咨询
  261. */
  262. public function consulting_list() {
  263. View::assign('hidden_nctoolbar', 1);
  264. $goods_id = intval(input('param.goods_id'));
  265. if ($goods_id <= 0) {
  266. $this->error(lang('param_error'));
  267. }
  268. // 商品详细信息
  269. $goods_model = model('goods');
  270. $goods_info = $goods_model->getGoodsInfoByID($goods_id);
  271. // 验证商品是否存在
  272. if (empty($goods_info)) {
  273. $this->error(lang('goods_index_no_goods'));
  274. }
  275. View::assign('goods', $goods_info);
  276. $this->getStoreInfo($goods_info['store_id']);
  277. // 当前位置导航
  278. $nav_link_list = model('goodsclass')->getGoodsclassnav($goods_info['gc_id'], 0);
  279. $nav_link_list[] = array('title' => $goods_info['goods_name'], 'link' => (string)url('Goods/index', ['goods_id' => $goods_id]));
  280. $nav_link_list[] = array('title' => lang('goods_commodity_consulting'));
  281. View::assign('nav_link_list', $nav_link_list);
  282. //得到商品咨询信息
  283. $consult_model = model('consult');
  284. $condition = array();
  285. $condition[] = array('goods_id','=',$goods_id);
  286. if (intval(input('param.ctid')) > 0) {
  287. $condition[] = array('consulttype_id','=',intval(input('param.ctid')));
  288. }
  289. $consult_list = $consult_model->getConsultList($condition, '*');
  290. View::assign('consult_list', $consult_list);
  291. View::assign('show_page', $consult_model->page_info->render());
  292. // 咨询类型
  293. $consult_type = rkcache('consulttype', true);
  294. View::assign('consult_type', $consult_type);
  295. //SEO 设置
  296. $seo_param = array ();
  297. $seo_param['name'] = $goods_info['goods_name'];
  298. $seo_param['description'] = ds_substing($goods_info['goods_name']);
  299. $this->_assign_seo(model('seo')->type('product')->param($seo_param)->show());
  300. View::assign('consult_able', $this->checkConsultAble($goods_info['store_id']));
  301. return View::fetch($this->template_dir . 'consulting_list');
  302. }
  303. private function checkConsultAble($store_id = 0) {
  304. //检查是否为店主本身
  305. $store_self = false;
  306. if (session('store_id')) {
  307. if (($store_id == 0 && intval(input('param.store_id')) == session('store_id')) || ($store_id != 0 && $store_id == session('store_id'))) {
  308. $store_self = true;
  309. }
  310. }
  311. //查询会员信息
  312. $member_info = array();
  313. $member_model = model('member');
  314. if (session('member_id'))
  315. $member_info = $member_model->getMemberInfoByID(session('member_id'));
  316. //检查是否可以评论
  317. $consult_able = true;
  318. if ((!config('ds_config.guest_comment') && !session('member_id') ) || $store_self == true || (session('member_id') > 0 && $member_info['is_allowtalk'] == 0)) {
  319. $consult_able = false;
  320. }
  321. return $consult_able;
  322. }
  323. /**
  324. * 商品咨询添加
  325. */
  326. public function save_consult() {
  327. //检查是否可以评论
  328. if (!config('ds_config.guest_comment') && !session('member_id')) {
  329. ds_json_encode(10001,lang('goods_index_goods_noallow'));
  330. }
  331. $goods_id = intval(input('post.goods_id'));
  332. if ($goods_id <= 0) {
  333. ds_json_encode(10001,lang('param_error'));
  334. }
  335. //咨询内容的非空验证
  336. if (trim(input('post.goods_content')) == "") {
  337. ds_json_encode(10001,lang('goods_index_input_consult'));
  338. }
  339. //表单验证
  340. $data = [
  341. 'goods_content' => input('post.goods_content')
  342. ];
  343. $res=word_filter($data['goods_content']);
  344. if(!$res['code']){
  345. ds_json_encode(10001,$res['msg']);
  346. }
  347. $data['goods_content']=$res['data']['text'];
  348. $goods_validate = ds_validate('goods');
  349. if (!$goods_validate->scene('save_consult')->check($data)) {
  350. ds_json_encode(10001,$goods_validate->getError());
  351. }
  352. if (session('member_id')) {
  353. //查询会员信息
  354. $member_model = model('member');
  355. $member_info = $member_model->getMemberInfo(array('member_id' => session('member_id')));
  356. if (empty($member_info) || $member_info['is_allowtalk'] == 0) {
  357. ds_json_encode(10001,lang('goods_index_goods_noallow'));
  358. }
  359. }
  360. //判断商品编号的存在性和合法性
  361. $goods = model('goods');
  362. $goods_info = $goods->getGoodsInfoByID($goods_id);
  363. if (empty($goods_info)) {
  364. ds_json_encode(10001,lang('goods_index_goods_not_exists'));
  365. }
  366. //判断是否是店主本人
  367. if (session('store_id') && $goods_info['store_id'] == session('store_id')) {
  368. ds_json_encode(10001,lang('goods_index_consult_store_error'));
  369. }
  370. //检查店铺状态
  371. $store_model = model('store');
  372. $store_info = $store_model->getStoreInfoByID($goods_info['store_id']);
  373. if ($store_info['store_state'] == '0' || intval($store_info['store_state']) == '2' || (intval($store_info['store_endtime']) != 0 && $store_info['store_endtime'] <= TIMESTAMP)) {
  374. ds_json_encode(10001,lang('goods_index_goods_store_closed'));
  375. }
  376. //接收数据并保存
  377. $input = array();
  378. $input['goods_id'] = $goods_id;
  379. $input['goods_name'] = $goods_info['goods_name'];
  380. $input['member_id'] = intval(session('member_id')) > 0 ? session('member_id') : 0;
  381. $input['member_name'] = session('member_name') ? session('member_name') : '';
  382. $input['store_id'] = $store_info['store_id'];
  383. $input['store_name'] = $store_info['store_name'];
  384. $input['consulttype_id'] = intval(input('post.consult_type_id',1));
  385. $input['consult_addtime'] = TIMESTAMP;
  386. $input['consult_content'] = $data['goods_content'];
  387. $input['consult_isanonymous'] = input('post.hide_name')=='hide'?1:0;
  388. $consult_model = model('consult');
  389. if ($consult_model->addConsult($input)) {
  390. ds_json_encode(10000,lang('goods_index_consult_success'));
  391. } else {
  392. ds_json_encode(10001,lang('goods_index_consult_fail'));
  393. }
  394. }
  395. /**
  396. * 异步显示优惠套装/推荐组合
  397. */
  398. public function get_bundling() {
  399. $goods_id = intval(input('param.goods_id'));
  400. if ($goods_id <= 0) {
  401. exit();
  402. }
  403. $goods_model = model('goods');
  404. $goods_info = $goods_model->getGoodsOnlineInfoByID($goods_id);
  405. if (empty($goods_info)) {
  406. exit();
  407. }
  408. // 优惠套装
  409. $array = model('pbundling')->getBundlingCacheByGoodsId($goods_id);
  410. if (!empty($array)) {
  411. View::assign('bundling_array', unserialize($array['bundling_array']));
  412. View::assign('b_goods_array', unserialize($array['b_goods_array']));
  413. }
  414. // 推荐组合
  415. if (!empty($goods_info) && $goods_model->checkIsGeneral($goods_info)) {
  416. $array = model('goodscombo')->getGoodscomboCacheByGoodsId($goods_id);
  417. View::assign('goods_info', $goods_info);
  418. View::assign('gcombo_list', unserialize($array['gcombo_list']));
  419. }
  420. echo View::fetch($this->template_dir . 'goods_bundling');
  421. }
  422. /**
  423. * 商品详细页运费显示
  424. *
  425. * @return unknown
  426. */
  427. public function calc() {
  428. if (!is_numeric(input('param.area_id')) || !is_numeric(input('param.tid')))
  429. return false;
  430. $freight_total = model('transport')->calcTransport(intval(input('param.tid')), intval(input('param.area_id')));
  431. if ($freight_total > 0) {
  432. if (input('param.myf') > 0) {
  433. if ($freight_total >= input('param.myf')) {
  434. $freight_total = lang('free_shipping');
  435. } else {
  436. $freight_total = lang('freight').':' . $freight_total . lang('shop_with') . input('param.myf') . lang('ds_yuan'). ' '. lang('free_shipping');
  437. }
  438. } else {
  439. $freight_total =lang('freight').':' . $freight_total . lang('ds_yuan');
  440. }
  441. } else {
  442. if ($freight_total !== false) {
  443. $freight_total = lang('free_shipping');
  444. }
  445. }
  446. echo input('param.callback') . '(' . json_encode(array('total' => $freight_total)) . ')';
  447. }
  448. /**
  449. * 到货通知
  450. */
  451. public function arrival_notice() {
  452. if (!session('is_login')) {
  453. $this->error(lang('param_error'));
  454. }
  455. $member_info = model('member')->getMemberInfoByID(session('member_id'));
  456. View::assign('member_info', $member_info);
  457. return View::fetch($this->template_dir . 'arrival_notice_submit');
  458. }
  459. /**
  460. * 到货通知表单
  461. */
  462. public function arrival_notice_submit() {
  463. $type = intval(input('post.type')) == 2 ? 2 : 1;
  464. $goods_id = intval(input('post.goods_id'));
  465. if ($goods_id <= 0) {
  466. ds_json_encode(10001,lang('param_error'));
  467. }
  468. // 验证商品数是否充足
  469. $goods_info = model('goods')->getGoodsInfoByID($goods_id);
  470. if (empty($goods_info) || ($goods_info['goods_storage'] > 0 && $goods_info['goods_state'] == 1)) {
  471. ds_json_encode(10001,lang('param_error'));
  472. }
  473. $arrivalnotice_model = model('arrivalnotice');
  474. // 验证会员是否已经添加到货通知
  475. $condition = array();
  476. $condition[] = array('goods_id','=',$goods_info['goods_id']);
  477. $condition[] = array('member_id','=',session('member_id'));
  478. $condition[] = array('arrivalnotice_type','=',$type);
  479. $notice_info = $arrivalnotice_model->getArrivalNoticeInfo($condition);
  480. if (!empty($notice_info)) {
  481. if ($type == 1) {
  482. ds_json_encode(10001,lang('goods_no_repeat_add'));
  483. } else {
  484. ds_json_encode(10001,lang('goods_no_repeat_appointment'));
  485. }
  486. }
  487. $mobile=input('post.mobile');
  488. $member_info = model('member')->getMemberInfoByID(session('member_id'));
  489. if($mobile==encrypt_show($member_info['member_mobile'],4,4)){
  490. $mobile=$member_info['member_mobile'];
  491. }
  492. $insert = array();
  493. $insert['goods_id'] = $goods_info['goods_id'];
  494. $insert['goods_name'] = $goods_info['goods_name'];
  495. $insert['member_id'] = session('member_id');
  496. $insert['arrivalnotice_mobile'] = $mobile;
  497. $insert['arrivalnotice_email'] = input('post.email');
  498. $insert['arrivalnotice_type'] = $type;
  499. $arrivalnotice_model->addArrivalNotice($insert);
  500. ds_json_encode(10000,lang('successful_booking_goods'));
  501. }
  502. public function json_area() {
  503. echo input('param.callback') . '(' . json_encode(model('area')->getAreaArrayForJson()) . ')';
  504. }
  505. public function show_chain(){
  506. $goods_id=input('param.goods_id');
  507. $chain_model=model('chain');
  508. $chain_ids=Db::name('chain_goods')->where(array(array('goods_id','=',$goods_id),array('goods_storage','>',0)))->column('chain_id');
  509. $chain_list=$chain_model->getChainOpenList(array(array('chain_if_pickup','=',1),array('chain_id','in',$chain_ids)));
  510. View::assign('chain_list', $chain_list);
  511. return View::fetch($this->template_dir . 'show_chain');
  512. }
  513. }