sjstoreinfo.inc.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid = $_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $info = pdo_get('zhtc_store', array('id' => $storeid));
  7. $area = pdo_getall('zhtc_area', array('uniacid' => $_W['uniacid']));
  8. $type = pdo_get('zhtc_storetype', array('id' => $info['storetype_id']));
  9. $type2 = pdo_get('zhtc_storetype2', array('id' => $info['storetype2_id']));
  10. // //查出已是商家用户
  11. // $sjuser=pdo_getall('zhtc_store',array('uniacid'=>$_W['uniacid']),'user_id');
  12. // //二维数组转一维
  13. // //
  14. // function i_array_column($input, $columnKey, $indexKey=null){
  15. // if(!function_exists('array_column')){
  16. // $columnKeyIsNumber = (is_numeric($columnKey))?true:false;
  17. // $indexKeyIsNull = (is_null($indexKey))?true :false;
  18. // $indexKeyIsNumber = (is_numeric($indexKey))?true:false;
  19. // $result = array();
  20. // foreach((array)$input as $key=>$row){
  21. // if($columnKeyIsNumber){
  22. // $tmp= array_slice($row, $columnKey, 1);
  23. // $tmp= (is_array($tmp) && !empty($tmp))?current($tmp):null;
  24. // }else{
  25. // $tmp= isset($row[$columnKey])?$row[$columnKey]:null;
  26. // }
  27. // if(!$indexKeyIsNull){
  28. // if($indexKeyIsNumber){
  29. // $key = array_slice($row, $indexKey, 1);
  30. // $key = (is_array($key) && !empty($key))?current($key):null;
  31. // $key = is_null($key)?0:$key;
  32. // }else{
  33. // $key = isset($row[$indexKey])?$row[$indexKey]:0;
  34. // }
  35. // }
  36. // $result[$key] = $tmp;
  37. // }
  38. // return $result;
  39. // }else{
  40. // return array_column($input, $columnKey, $indexKey);
  41. // }
  42. // }
  43. // $yuser=i_array_column($sjuser, 'user_id');
  44. // foreach( $yuser as $k=>$v) {
  45. // if($info['user_id'] == $v) unset($yuser[$k]);
  46. // }
  47. // //用户
  48. // $user=pdo_getall('zhtc_user',array('uniacid'=>$_W['uniacid'],'id !='=>$yuser));
  49. //入住类型
  50. //$typein=pdo_getall('zhtc_in',array('uniacid'=>$_W['uniacid']));
  51. $time = 24 * 60 * 60 * 7; //一周
  52. $time2 = 24 * 182 * 60 * 60; //半年
  53. $time3 = 24 * 365 * 60 * 60; //一年
  54. if ($info['ad']) {
  55. if (strpos($info['ad'], ',')) {
  56. $ad = explode(',', $info['ad']);
  57. } else {
  58. $ad = array(
  59. 0 => $info['ad'],
  60. );
  61. }
  62. }
  63. if ($info['img']) {
  64. if (strpos($info['img'], ',')) {
  65. $img = explode(',', $info['img']);
  66. } else {
  67. $img = array(
  68. 0 => $info['img'],
  69. );
  70. }
  71. }
  72. if (checksubmit('submit')) {
  73. if ($_GPC['ad']) {
  74. $data['ad'] = implode(",", $_GPC['ad']);
  75. } else {
  76. $data['ad'] = '';
  77. }
  78. if ($_GPC['img']) {
  79. $data['img'] = implode(",", $_GPC['img']);
  80. } else {
  81. $data['img'] = '';
  82. }
  83. if ($_GPC['user_name']) {
  84. $rst = pdo_get('zhtc_store', array('user_name' => $_GPC['user_name'], 'uniacid' => $_W['uniacid'], 'id !=' => $storeid));
  85. if ($rst) {
  86. message('用户名已存在,请更换用户名', '', 'error');
  87. }
  88. }
  89. $data['store_name'] = $_GPC['store_name'];
  90. $data['tel'] = $_GPC['tel'];
  91. $data['address'] = $_GPC['address'];
  92. $data['logo'] = $_GPC['logo'];
  93. //$data['ewm_logo']=$_GPC['ewm_logo'];
  94. $data['weixin_logo'] = $_GPC['weixin_logo'];
  95. $data['announcement'] = $_GPC['announcement'];
  96. $data['coordinates'] = $_GPC['coordinates'];
  97. //$data['yy_time']=$_GPC['yy_time'];
  98. $data['start_time'] = $_GPC['start_time'];
  99. $data['end_time'] = $_GPC['end_time'];
  100. $data['keyword'] = $_GPC['keyword'];
  101. $data['skzf'] = $_GPC['skzf'];
  102. $data['wifi'] = $_GPC['wifi'];
  103. $data['mftc'] = $_GPC['mftc'];
  104. $data['jzxy'] = $_GPC['jzxy'];
  105. $data['tgbj'] = $_GPC['tgbj'];
  106. $data['sfxx'] = $_GPC['sfxx'];
  107. $data['area_id'] = $_GPC['area_id'];
  108. $data['user_id'] = $_GPC['user_id'];
  109. $data['details'] = $_GPC['details'];
  110. //$data['vr_link']=$_GPC['vr_link'];
  111. $data['video'] = $_GPC['video'];
  112. $data['num'] = $_GPC['num'];
  113. $data['user_name'] = $_GPC['user_name'];
  114. $data['cityname'] = $_GPC['cityname'];
  115. $data['views'] = $_GPC['views'];
  116. // $data['storetype_id']=$_GPC['storetype_id'];
  117. // $data['storetype2_id']=$_GPC['storetype2_id'];
  118. $data['sfz_img'] = $_GPC['sfz_img'];
  119. $data['yyzz_img'] = $_GPC['yyzz_img'];
  120. $data['pwd'] = md5($_GPC['pwd']);
  121. //$data['is_top']=$_GPC['is_top'];
  122. //$data['is_rm']=$_GPC['is_rm'];
  123. //$data['dq_time']=strtotime($_GPC['dq_time']);
  124. if ($data['dq_time'] <= time()) {
  125. $data['time_over'] = 1;
  126. } else {
  127. $data['time_over'] = 2;
  128. }
  129. $res = pdo_update('zhtc_store', $data, array('id' => $storeid));
  130. if ($res) {
  131. message('编辑成功', $this->createWebUrl2('sjstoreinfo', array()), 'success');
  132. } else {
  133. message('编辑失败', '', 'error');
  134. }
  135. }
  136. function getCoade($md_id) {
  137. function getaccess_token() {
  138. global $_W, $_GPC;
  139. $res = pdo_get('zhtc_system', array('uniacid' => $_W['uniacid']));
  140. $appid = $res['appid'];
  141. $secret = $res['appsecret'];
  142. /* $appid='wx648013d2ed95099f';
  143. $secret='7b072b70439afc58bc5531fc60aaa203';*/
  144. $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret . "";
  145. $ch = curl_init();
  146. curl_setopt($ch, CURLOPT_URL, $url);
  147. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  148. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  149. $data = curl_exec($ch);
  150. curl_close($ch);
  151. $data = json_decode($data, true);
  152. return $data['access_token'];
  153. }
  154. function set_msg($md_id) {
  155. $access_token = getaccess_token();
  156. $data2 = array(
  157. "scene" => $md_id,
  158. "page" => "zh_tcwq/pages/sellerinfo/sellerinfo",
  159. "width" => 100,
  160. );
  161. $data2 = json_encode($data2);
  162. $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" . $access_token . "";
  163. $ch = curl_init();
  164. curl_setopt($ch, CURLOPT_URL, $url);
  165. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  166. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  167. curl_setopt($ch, CURLOPT_POST, 1);
  168. curl_setopt($ch, CURLOPT_POSTFIELDS, $data2);
  169. $data = curl_exec($ch);
  170. curl_close($ch);
  171. return $data;
  172. }
  173. $img = set_msg($md_id);
  174. $img = base64_encode($img);
  175. return $img;
  176. }
  177. if ($storeid) {
  178. $img2 = getCoade($_GPC['id']);
  179. }
  180. include $this->template('web/sjstoreinfo');