在WeiPHP 3 中使用该插件时,初始化JSSDK 时需要添加AppID 和AppSecret 在IndexController 中修改对应参数。
![](https://box.kancloud.cn/2016-05-05_572afd33db2af.png)
在Application/Common/Common/function 文件中新增相关函数,方便插件调用
~~~
function getUserNameByOpenId($openid){
if(!$openid)
return "无";
$map['openid'] = $openid;
$userInfo = M('RactiveMember')->where($map)->find();
if($userInfo['name'])
return $userInfo['name'];
else
return "信息缺失";
}
function getTelByOpenId($openid){
if(!$openid)
return "无";
$map['openid'] = $openid;
$userInfo = M('RactiveMember')->where($map)->find();
if($userInfo['tel'])
return $userInfo['tel'];
else
return "信息缺失";
}
function get_img_by_ractiveid($ractiveid){
$map['id'] = $ractiveid;
$ractive = M('ractive')->where($map)->find();
return get_picture_url($ractive['cover']);
}
function get_ractivetitle_by_id($id){
$map['id'] = $id;
$ractiveTitle = M('ractive')->where($map)->getField('title');
return $ractiveTitle;
}
~~~