$model_item ) { $updateSqlPath = APP_PATH . $model_name . '/info/UpdateSql.php' ; $lockPath = APP_PATH . $model_name . '/info/UpdateSql.lock' ; $infoPath = APP_PATH . $model_name . '/info/Info.php' ; $infoData = include $infoPath ; $isUpdate = false ; $nowVersion = array_key_exists('version',$infoData) ? $infoData['version'] : '0.0.0'; if(file_exists($lockPath)){ // 有锁定文件,需要进一步判断模块版本号 $lockVersion = file_get_contents($lockPath); //读取锁定文件版本号 $isUpdate = longbing_compare_version($lockVersion, $nowVersion) ? true : false ; }else{ //锁定文件不存在,直接升级 $isUpdate = true ; } if($types==0){ $isUpdate = true ; } if($isUpdate && file_exists($updateSqlPath)){ $sql = include $updateSqlPath ; $sql = str_replace(PHP_EOL, '', $sql); $sqlArray = explode(';', $sql); foreach ($sqlArray as $_value) { if(!empty($_value)){ try{ Db::query($_value) ; }catch (\Exception $e){ if (!APP_DEBUG){ //echo '操作失败: '.$_value . '

' ; } } } } //调试模式下,不写入锁定文件 ,方便调试 if (!APP_DEBUG){ file_put_contents($lockPath , $nowVersion) ; } } } } /** * 初始化微擎数据 * * @author shuixian * @DataTime: 2020/1/4 9:42 */ public static function initWeiqinConfigData(){ if(longbingIsWeiqin()) { //获取uniacid global $_GPC, $_W; $uniacid = $_W[ 'uniacid' ]; if(!empty($uniacid)) { //获取数据 //获取config $app_config = longbingGetAppConfig($uniacid); //判断config是否存在或者是否同步 if(empty($app_config) || empty($app_config['is_sync'])) { //获取微擎配置 $weiqing_wx_app_model = new WxAppWeqingWxApp(); $weiqing_wx_app = $weiqing_wx_app_model->getApp(['uniacid' => $uniacid]); // var_dump($weiqing_wx_app);die; if(!empty($weiqing_wx_app)) { $data = ['is_sync' => 1]; if(isset($weiqing_wx_app['key']) && !empty($weiqing_wx_app['key'])) $data['appid'] = $weiqing_wx_app['key']; if(isset($weiqing_wx_app['secret']) && !empty($weiqing_wx_app['secret'])) $data['app_secret'] = $weiqing_wx_app['secret']; if(isset($weiqing_wx_app['name']) && !empty($weiqing_wx_app['name'])) $data['mini_app_name'] = $weiqing_wx_app['name']; $app_config_model = new AppConfig(); if(empty($app_config)) { $data['uniacid'] = $uniacid; $data['force_phone'] = 0; $app_config_model->createConfig($data); }else{ $app_config_model->updateConfig(['uniacid' => $uniacid],$data); } longbingGetAppConfig($uniacid ,true); } } //同步存储设置 $oss_config = longbingGetOssConfig($uniacid); if(empty($oss_config) || empty($oss_config['is_sync'])){ $weiqing_oss = null; if(isset($_W['setting']['remote_complete_info'][$_W['uniacid']])) $weiqing_oss = $_W['setting']['remote_complete_info'][$_W['uniacid']]; if(empty($weiqing_oss) && isset($_W['setting']['remote_complete_info'])) $weiqing_oss = $_W['setting']['remote_complete_info']; if(!empty($weiqing_oss)) { $data = ['is_sync' => 1]; if(isset($weiqing_oss['qiniu'])){ $data['open_oss'] = 2; if(isset($weiqing_oss['qiniu']['accesskey']) && !empty($weiqing_oss['qiniu']['accesskey'])) $data['qiniu_accesskey'] = $weiqing_oss['qiniu']['accesskey']; if(isset($weiqing_oss['qiniu']['secretkey']) && !empty($weiqing_oss['qiniu']['secretkey'])) $data['qiniu_secretkey'] = $weiqing_oss['qiniu']['secretkey']; if(isset($weiqing_oss['qiniu']['bucket']) && !empty($weiqing_oss['qiniu']['bucket'])) $data['qiniu_bucket'] = $weiqing_oss['qiniu']['bucket']; if(isset($weiqing_oss['qiniu']['url']) && !empty($weiqing_oss['qiniu']['url'])) $data['qiniu_yuming'] = $weiqing_oss['qiniu']['url']; } $oss_config_model = new OssConfig(); if(empty($oss_config)) { $data['uniacid'] = $uniacid; $oss_config_model->createConfig($data); }else{ $oss_config_model->updateConfig(['uniacid' => $uniacid] ,$data); } longbingGetOssConfig($uniacid ,true); } } //初始化地步菜单 /*$tabbars = longbingGetAppTabbar($uniacid); if(empty($tabbars)) { $tabbar_model = new AppTabbar(); $data = array( 'uniacid' => $uniacid, 'menu2_is_hide' => 0, 'menu3_is_hide' => 0, 'menu4_is_hide' => 0, 'menu_activity_is_show' => 0, 'menu_house_is_show' => 0, 'menu_appoint_is_hide' => 0 ); $tabbar_model->createTabbar($data); $tabbars = longbingGetAppTabbar($uniacid ,true); }*/ longbingGetCompanyConfig($uniacid); } } } }