| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace app\index\controller;
- use Symfony\Component\HttpFoundation\RedirectResponse;
- use think\Controller;
- use think\Db;
- use think\Request;
- class Index extends Controller
- {
- public function login(Request $request)
- {
- $code = $request->param("code");
- $openid = (new AccessToken())->getOpenid($code);
- return json(["result"=>1,"openid"=>$openid]);
- }
- public function getGongMessage()
- {
- $data = Db::name("gonginfo")->select();
- return json(['result'=>1,'content'=>$data]);
- }
- public function identify(Request $request)
- {
- $password = $request->param("password");
- $list = Db::name("gonginfo")->where("password",$password)->select();
- return json(['result'=>1,"content"=>$list]);
- }
- public function admin(Request $request)
- {
- $id = $request->param("id");
- $formid = $request->param("formid");
- $openid = $request->param("openid");
- $sql = "Update gonginfo set fromid = $formid,openid=$openid where id = $id";
- $result = Db::query($sql);
- if($result){
- return json(['result'=>1,'msg'=>'更改成功']);
- }else{
- return json(['result'=>0,'msg'=>'更改失败']);
- }
- }
- }
|