request->params([ ['code', ''], ['type', 'miniprogram'] // miniprogram: 小程序, official: 公众号 ]); return success('获取成功', (new WechatBindService())->getWechatOpenid($data['code'], $data['type'])); } /** * 绑定微信openid * @return \think\Response */ public function bindWechatOpenid() { $data = $this->request->params([ ['miniprogram_openid', ''], ['official_openid', ''], ['type', 'miniprogram'] // miniprogram: 小程序绑定, official: 公众号绑定, both: 同时绑定 ]); return success('绑定成功', (new WechatBindService())->bindWechatOpenid($data)); } /** * 微信授权跳转 * @return \think\Response */ public function wechatAuthorize() { $data = $this->request->params([ ['redirect_uri', ''], ['state', ''] ]); return (new WechatBindService())->wechatAuthorize($data['redirect_uri'], $data['state']); } /** * 微信授权回调 * @return \think\Response */ public function wechatCallback() { $data = $this->request->params([ ['code', ''], ['state', ''], ['personnel_id',''], ['from',''] ]); return (new WechatBindService())->wechatCallback($data['code'], $data['state'],$data['personnel_id'],$data['from']); } /** * 获取绑定状态 * @return \think\Response */ public function getBindStatus() { return success('获取成功', (new WechatBindService())->getBindStatus()); } }