function checktoken() { if ($this->shopid) { $config = new config("autorun_{$this->shopid}.php", hopedir); } else { $config = new config('autorun.php', hopedir); } $tempinfo = $config->getInfo(); if (isset($tempinfo['access_token']) && isset($tempinfo['wx_time'])) { $btime = time() - $tempinfo['wx_time']; if ($btime < 7000) { $this->access_token = $tempinfo['access_token']; return true; } } //通过post方法获取 当前token; $info = $this->vpost('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $this->wxappid . '&secret=' . $this->wxsecret); $info = json_decode($info, true); if (isset($info['access_token'])) { $test['access_token'] = $info['access_token']; $this->access_token = $info['access_token']; $test['wx_time'] = time(); $config->write($test); return true; } else { $this->errId = $info['errcode']; return false; } }
function saveadvtype() { $arrtypename = IReq::get('typename'); $arrtypeurl = IReq::get('typeurl'); $arrtypeorder = IReq::get('typeorder'); if (empty($arrtypename)) { $this->message('广告类型不能为空'); } if (is_array($arrtypename)) { $orderinfo = array(); foreach ($arrtypename as $key => $value) { if (isset($arrtypeorder[$key])) { $dokey = !empty($arrtypeorder[$key]) ? $arrtypeorder[$key] : 0; array_push($orderinfo, $dokey); } else { array_push($orderinfo, 0); } } $orderinfo = array_unique($orderinfo); sort($orderinfo); $newinfo = array(); foreach ($orderinfo as $key => $value) { foreach ($arrtypename as $k => $v) { if (isset($arrtypeorder[$k])) { $checkcode = !empty($arrtypeorder[$k]) ? $arrtypeorder[$k] : 0; } else { $checkcode = 0; } if ($checkcode == $value) { $data['typename'] = $v; $data['typeurl'] = isset($arrtypeurl[$k]) ? $arrtypeurl[$k] : ''; $data['typeorder'] = $checkcode; $newinfo[] = $data; } } } } else { $newinfo['typename'] = $arrtypename; $newinfo['typeurl'] = $arrtypeurl; $newinfo['typeorder'] = $arrtypeorder; } $siteinfo['advtype'] = serialize($newinfo); $config = new config('hopeconfig.php', hopedir); $config->write($siteinfo); $this->success('操作成功'); }
function wxsetsave() { $info['wxtoken'] = trim(IReq::get('wxtoken')); $info['wxappid'] = trim(IReq::get('wxappid')); $info['wxsecret'] = trim(IReq::get('wxsecret')); if (empty($info['wxtoken'])) { $this->message('自定义token不能为空'); } if (empty($info['wxappid'])) { $this->message('微信appid不能为空'); } if (empty($info['wxsecret'])) { $this->message('微信secret不能为空'); } $config = new config('hopeconfig.php', hopedir); $config->write($info); $this->success('操作成功'); }
function savepsset() { $locationtype = intval(IFilter::act(IReq::get('locationtype'))); if ($locationtype == 1) { $test = Mysite::$app->config['baidumapkey']; if (empty($test)) { $this->message('请先设置百度地图的secrkey'); } } $pstype = intval(IFilter::act(IReq::get('pstype'))); $savearray['locationtype'] = $locationtype; $savearray['pstype'] = $pstype; $savearray['psvalue1'] = IFilter::act(IReq::get('mapay1')); $savearray['psvalue2'] = IFilter::act(IReq::get('mapay2')); $savearray['psvalue3'] = IFilter::act(IReq::get('mapay3')); if ($pstype == 1) { //统一配送费时 $savearray['psvalue1'] = IFilter::act(IReq::get('allpay')); } elseif ($pstype == 5) { $savearray['psvalue1'] = IFilter::act(IReq::get('caipay1')); $savearray['psvalue2'] = IFilter::act(IReq::get('caipay2')); } $siteinfo['psset'] = serialize($savearray); $siteinfo['opensitesend'] = intval(IFilter::act(IReq::get('opensitesend'))); $siteinfo['openshopsend'] = intval(IFilter::act(IReq::get('openshopsend'))); $config = new config('hopeconfig.php', hopedir); $config->write($siteinfo); $this->success('操作成功!'); }
function saveorderbz() { $this->checkadminlogin(); $arrtypename = IReq::get('typename'); $arrtypename = is_array($arrtypename) ? $arrtypename : array($arrtypename); $siteinfo['orderbz'] = serialize($arrtypename); $config = new config('hopeconfig.php', hopedir); $config->write($siteinfo); $this->success('操作成功'); }
function savescore() { $siteinfo['commentscore'] = intval(IReq::get('commentscore')); $siteinfo['loginscore'] = intval(IReq::get('loginscore')); $siteinfo['regesterscore'] = intval(IReq::get('regesterscore')); $siteinfo['commenttype'] = intval(IReq::get('commenttype')); $siteinfo['scoretocost'] = intval(IReq::get('scoretocost')); $siteinfo['maxdayscore'] = intval(IReq::get('maxdayscore')); $siteinfo['commentday'] = intval(IReq::get('commentday')); $config = new config('hopeconfig.php', hopedir); $config->write($siteinfo); $this->success('操作成功'); }
function savetempset() { $tempname = IFilter::act(IReq::get('modulename')); if (empty($tempname)) { $this->message('模板名称不能为空'); } $logindir = hopedir . '/templates'; if (!file_exists($logindir . '/' . $tempname . '/stro.txt')) { $this->message('模板文件不存在'); } $siteinfo['sitetemp'] = $tempname; $config = new config('hopeconfig.php', hopedir); $config->write($siteinfo); IFile::clearDir('templates_c'); $this->success('操作成功'); }
function smssetsave() { $config = new config('hopeconfig.php', hopedir); $siteinfo['smstype'] = IReq::get('smstype'); if ($siteinfo['smstype'] == 1) { $siteinfo['smkey'] = IReq::get('smkey'); $siteinfo['smpassword'] = IReq::get('smpassword'); $siteinfo['smacount'] = IReq::get('smacount'); $siteinfo['smeName'] = IReq::get('smeName'); $siteinfo['smlinkMan'] = IReq::get('smlinkMan'); $siteinfo['smphoneNum'] = IReq::get('smphoneNum'); $siteinfo['smmobile'] = IReq::get('smmobile'); $siteinfo['smemail'] = IReq::get('smemail'); $siteinfo['smfax'] = IReq::get('smfax'); $siteinfo['smaddress'] = IReq::get('smaddress'); $siteinfo['smpostcode'] = IReq::get('smpostcode'); if (empty($siteinfo['smkey'])) { $this->message('账号不能为空'); } if (empty($siteinfo['smpassword'])) { $this->message('密码不能为空'); } if (empty($siteinfo['smacount'])) { $this->message('KEY不能为空'); } if (empty($siteinfo['smeName'])) { $this->message('公司名称不能为空'); } if (empty($siteinfo['smlinkMan'])) { $this->message('联系人不能为空'); } if (empty($siteinfo['smphoneNum'])) { $this->message('联系电话不能为空'); } if (empty($siteinfo['smmobile'])) { $this->message('联系手机不能为空'); } if (empty($siteinfo['smemail'])) { $this->message('联系人邮箱不能为空'); } if (empty($siteinfo['smfax'])) { $this->message('传真号不能为空'); } if (empty($siteinfo['smaddress'])) { $this->message('联系地址不能为空'); } if (empty($siteinfo['smpostcode'])) { $this->message('邮政编码不能空'); } $docheck['smkey'] = $siteinfo['smkey']; $docheck['smpassword'] = $siteinfo['smpassword']; $docheck['smacount'] = $siteinfo['smacount']; $config->write($docheck); $sendmobile = new mobile(); $checkinfo = $sendmobile->login(); if ($checkinfo != 'ok') { $this->message($checkinfo); } $checkinfo = $sendmobile->registDetailInfo($siteinfo); if ($checkinfo != 'ok') { $this->message($checkinfo); } } else { $siteinfo['sms86ac'] = IReq::get('sms86ac'); $siteinfo['sms86pd'] = IReq::get('sms86pd'); $siteinfo['smstype'] = IReq::get('smstype'); if (empty($siteinfo['sms86ac'])) { $this->message('账号不能为空'); } if (empty($siteinfo['sms86pd'])) { $this->message('密码不能为空'); } } $config->write($siteinfo); $this->success('操作成功! '); }