dlinstoreinfo.inc.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. global $_GPC, $_W;
  3. $action = 'start';
  4. $GLOBALS['frames'] = $this->getNaveMenu($_COOKIE['cityname'], $action);
  5. $info = pdo_get('zhtc_store', array('id' => $_GPC['id']));
  6. $area = pdo_getall('zhtc_area', array('uniacid' => $_W['uniacid']));
  7. $type = pdo_getall('zhtc_storetype', array('uniacid' => $_W['uniacid'], 'state' => 1), array(), '', 'num asc');
  8. $type2 = pdo_get('zhtc_storetype2', array('id' => $info['storetype2_id']));
  9. //入住类型
  10. //$typein=pdo_getall('zhtc_in',array('uniacid'=>$_W['uniacid']));
  11. $time = 24 * 60 * 60 * 7; //一周
  12. $time2 = 24 * 182 * 60 * 60; //半年
  13. $time3 = 24 * 365 * 60 * 60; //一年
  14. if ($info['ad']) {
  15. if (strpos($info['ad'], ',')) {
  16. $ad = explode(',', $info['ad']);
  17. } else {
  18. $ad = array(
  19. 0 => $info['ad'],
  20. );
  21. }
  22. }
  23. if ($info['img']) {
  24. if (strpos($info['img'], ',')) {
  25. $img = explode(',', $info['img']);
  26. } else {
  27. $img = array(
  28. 0 => $info['img'],
  29. );
  30. }
  31. }
  32. if (checksubmit('submit')) {
  33. if ($_GPC['ad']) {
  34. $data['ad'] = implode(",", $_GPC['ad']);
  35. } else {
  36. $data['ad'] = '';
  37. }
  38. if ($_GPC['img']) {
  39. $data['img'] = implode(",", $_GPC['img']);
  40. } else {
  41. $data['img'] = '';
  42. }
  43. if ($_GPC['user_name']) {
  44. $rst = pdo_get('zhtc_store', array('user_name' => $_GPC['user_name'], 'uniacid' => $_W['uniacid'], 'id !=' => $_GPC['id']));
  45. if ($rst) {
  46. message('用户名已存在,请更换用户名', '', 'error');
  47. }
  48. }
  49. $data['store_name'] = $_GPC['store_name'];
  50. $data['tel'] = $_GPC['tel'];
  51. $data['address'] = $_GPC['address'];
  52. $data['logo'] = $_GPC['logo'];
  53. $data['ewm_logo'] = $_GPC['ewm_logo'];
  54. $data['weixin_logo'] = $_GPC['weixin_logo'];
  55. $data['announcement'] = $_GPC['announcement'];
  56. $data['coordinates'] = $_GPC['coordinates'];
  57. //$data['yy_time']=$_GPC['yy_time'];
  58. $data['start_time'] = $_GPC['start_time'];
  59. $data['end_time'] = $_GPC['end_time'];
  60. $data['keyword'] = $_GPC['keyword'];
  61. $data['skzf'] = $_GPC['skzf'];
  62. $data['wifi'] = $_GPC['wifi'];
  63. $data['mftc'] = $_GPC['mftc'];
  64. $data['jzxy'] = $_GPC['jzxy'];
  65. $data['tgbj'] = $_GPC['tgbj'];
  66. $data['sfxx'] = $_GPC['sfxx'];
  67. $data['area_id'] = $_GPC['area_id'];
  68. $data['user_id'] = $_GPC['user_id'];
  69. $data['details'] = $_GPC['details'];
  70. $data['vr_link'] = $_GPC['vr_link'];
  71. $data['num'] = $_GPC['num'];
  72. $data['user_name'] = $_GPC['user_name'];
  73. //$data['cityname']=$_GPC['cityname'];
  74. $data['views'] = $_GPC['views'];
  75. $data['storetype_id'] = $_GPC['storetype_id'];
  76. $data['pwd'] = md5($_GPC['pwd']);
  77. $data['is_top'] = $_GPC['is_top'];
  78. $data['dq_time'] = strtotime($_GPC['dq_time']);
  79. if ($data['dq_time'] <= time()) {
  80. $data['time_over'] = 1;
  81. } else {
  82. $data['time_over'] = 2;
  83. }
  84. // if($_GPC['type']){
  85. // $data['type']=$_GPC['type'];
  86. // if($_GPC['type']==1){
  87. // $data['dq_time']=$info['sh_time']+$time;
  88. // }
  89. // if($_GPC['type']==2){
  90. // $data['dq_time']=$info['sh_time']+$time2;
  91. // }
  92. // if($_GPC['type']==3){
  93. // $data['dq_time']=$info['sh_time']+$time3;
  94. // }
  95. // $data['time_over']=2;
  96. // }
  97. $res = pdo_update('zhtc_store', $data, array('id' => $_GPC['id']));
  98. if ($res) {
  99. message('编辑成功', $this->createWebUrl2('dlinstore', array()), 'success');
  100. } else {
  101. message('编辑失败', '', 'error');
  102. }
  103. }
  104. function getCoade($md_id) {
  105. function getaccess_token() {
  106. global $_W, $_GPC;
  107. $res = pdo_get('zhtc_system', array('uniacid' => $_W['uniacid']));
  108. $appid = $res['appid'];
  109. $secret = $res['appsecret'];
  110. /* $appid='wx648013d2ed95099f';
  111. $secret='7b072b70439afc58bc5531fc60aaa203';*/
  112. $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret . "";
  113. $ch = curl_init();
  114. curl_setopt($ch, CURLOPT_URL, $url);
  115. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  116. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  117. $data = curl_exec($ch);
  118. curl_close($ch);
  119. $data = json_decode($data, true);
  120. return $data['access_token'];
  121. }
  122. function set_msg($md_id) {
  123. $access_token = getaccess_token();
  124. $data2 = array(
  125. "scene" => $md_id,
  126. "page" => "zh_tcwq/pages/sellerinfo/sellerinfo",
  127. "width" => 100,
  128. );
  129. $data2 = json_encode($data2);
  130. $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" . $access_token . "";
  131. $ch = curl_init();
  132. curl_setopt($ch, CURLOPT_URL, $url);
  133. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  134. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  135. curl_setopt($ch, CURLOPT_POST, 1);
  136. curl_setopt($ch, CURLOPT_POSTFIELDS, $data2);
  137. $data = curl_exec($ch);
  138. curl_close($ch);
  139. return $data;
  140. }
  141. $img = set_msg($md_id);
  142. $img = base64_encode($img);
  143. return $img;
  144. }
  145. if ($_GPC['id']) {
  146. $img2 = getCoade($_GPC['id']);
  147. }
  148. include $this->template('web/dlinstoreinfo');