Exemplo n.º 1
0
 /**
  * 生成菜单
  */
 public function setmenu()
 {
     $sub = array();
     $data = array();
     $subs = array();
     $app_id = C("WECHAT_APPID");
     $redirect_uri = U('home/index');
     $site_url = C("SITE_URL");
     $subs3[] = array('type' => 'view', 'name' => '绑定', 'url' => $site_url . U('wechat/oauth'));
     $subs3[] = array('type' => 'click', 'name' => '解除绑定', 'key' => 'unauth');
     $subs3[] = array('type' => 'click', 'name' => '推送设置', 'key' => 'ites_set');
     $oauth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$app_id}&redirect_uri={$site_url}{$redirect_uri}&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
     $sub1 = array('type' => 'view', 'name' => 'OA', 'url' => $oauth_url);
     $sub2 = array('type' => 'click', 'name' => '签到', 'key' => 'sign_up');
     $sub3 = array('name' => '帮助', 'sub_button' => $subs3);
     $data['button'][] = $sub1;
     $data['button'][] = $sub2;
     $data['button'][] = $sub3;
     $data = jsencode($data);
     /* 加载微信SDK */
     import("@.ORG.Util.ThinkWechat");
     $weixin = new ThinkWechat();
     echo $weixin->setMenu($data);
 }
Exemplo n.º 2
0
 /**
  * 生成菜单
  */
 public function setmenu()
 {
     $sub = array();
     $data = array();
     $subs = array();
     $subs1[] = array('type' => 'click', 'name' => '我申请的任务', 'key' => 'apply_task');
     $subs1[] = array('type' => 'click', 'name' => '邀请我的任务', 'key' => 'invite_task');
     $subs1[] = array('type' => 'click', 'name' => '待评价的任务', 'key' => 'comment_task');
     $subs2[] = array('type' => 'click', 'name' => '适合我的任务', 'key' => 'fit_task');
     $subs2[] = array('type' => 'view', 'name' => '任务检索', 'url' => 'http://www.马赛克.com/wechat/search/');
     $subs3[] = array('type' => 'click', 'name' => '功能介绍', 'key' => 'ites_intro');
     $subs3[] = array('type' => 'view', 'name' => '意见反馈', 'url' => 'http://www.马赛克.com/wechat/feedback/');
     $subs3[] = array('type' => 'click', 'name' => '工程师联盟认证', 'key' => 'ites_verify');
     $subs3[] = array('type' => 'click', 'name' => '信息推送设置', 'key' => 'ites_set');
     $sub1 = array('name' => '任务管理', 'sub_button' => $subs1);
     $sub2 = array('name' => '任务查询', 'sub_button' => $subs2);
     $sub3 = array('name' => '系统功能', 'sub_button' => $subs3);
     $data['button'][] = $sub1;
     $data['button'][] = $sub2;
     $data['button'][] = $sub3;
     $data = jsencode($data);
     /* 加载微信SDK */
     import("@.ORG.Util.ThinkWechat");
     $weixin = new ThinkWechat();
     echo $weixin->setMenu($data);
 }