Goods.php 24 KB

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