123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | tester 体验者设置
- |--------------------------------------------------------------------------
- */
- namespace Component\Src;
- use Dever;
- use Main\Lib\Wechat;
- class Version extends Core
- {
- public $table = 'version';
- public function handle($oauth, $info, $delete, $user, $wechat)
- {
- $template = Dever::db('component/template')->one($info['template_id']);
- $oauth['method'] = 'applet_commit';
- $oauth['template_id'] = $template['template'] - 1;
- $oauth['user_version'] = $info['name'];
- $oauth['user_desc'] = $info['desc'];
- $project = Dever::db('main/project')->one($info['project_id']);
- $user = Dever::db('component/user')->one($user);
- //$pageInfo = Dever::db('component/page')->state(array('option_template_id' => $template['id']));
- $pageInfo = Dever::db('component/page')->state();
- $page = array();
- if ($pageInfo) {
- $i = 0;
- foreach ($pageInfo as $k => $v) {
- $page[$i] = $v['pagepath'];
- $i++;
- }
- }
- $tabbar = Dever::db('component/tabbar')->state(array('option_template_id' => $template['id']));
- $tab = array();
- if ($tabbar) {
- $i = 0;
- foreach ($tabbar as $k => $v) {
- $tab[$i]['pagePath'] = $pageInfo[$v['page_id']]['pagepath'];
- if ($i == 0) {
- /*
- $key = array_search($tab[$i]['pagePath'], $page);
- if ($key && isset($page[$key])) {
- unset($page[$key]);
- }
- */
- array_unshift($page, $tab[$i]['pagePath']);
- }
- $tab[$i]['text'] = $v['name'];
- $tab[$i]['iconPath'] = $v['iconpath'];
- $tab[$i]['selectedIconPath'] = $v['selectediconpath'];
- $i++;
- }
- }
- /*
- $page = array
- (
- "pages/shop/index",
- "pages/shop-dl/index",
- "pages/index/index",
- "pages/thelecture/index",
- "pages/toAttend/index",
- "pages/index-dl/index",
- "pages/toAttend-dl/index",
- "pages/thelecture-dl/index",
- "pages/service-2/index",
- "pages/service-dl/index",
- "pages/article/index",
- "pages/cooperation-1/index",
- "pages/cooperation-2/index",
- "pages/service-1/index"
- );
- */
- if (!isset($template['act_id'])) {
- $template['act_id'] = 0;
- }
- $ext = array
- (
- 'extEnable' => true,
- 'extAppid' => $oauth['openid'],
- 'directCommit' => false,
- 'ext' => array
- (
- 'version' => $info['name'],
- 'desc' => $user['desc'],
- 'project' => $project['id'],
- 'act' => $template['act_id'],
- ),
- 'extPages' => array(),
- 'pages' => $page,
- 'window' => array
- (
- 'navigationBarTitleText' => $user['name'],
- ),
- 'tabBar' => array
- (
- 'color' => '#666666',
- 'selectedColor' => '#ff8903',
- 'backgroundColor' => '#FAFAFA',
- 'list' => $tab,
- ),
- );
- if (!$tab) {
- unset($ext['tabBar']);
- }
- if (!$page) {
- unset($ext['pages']);
- }
- $oauth['ext_json'] = json_encode($ext, JSON_UNESCAPED_UNICODE);
- //print_r($oauth);die;
- return $oauth;
- }
- }
|