instoreinfo.inc.php 4.4 KB

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