storeinfo.inc.php 6.4 KB

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