diff --git a/backstage/application/api/controllers/api/Applet.php b/backstage/application/api/controllers/api/Applet.php index 1052830..99f8aaa 100644 --- a/backstage/application/api/controllers/api/Applet.php +++ b/backstage/application/api/controllers/api/Applet.php @@ -180,4 +180,30 @@ class Applet extends REST_Controller { ) ), REST_Controller::HTTP_OK); } + + public function updateAppletOpenid_post(){ + $user_id = $this->user->id; + $uid = $this->input->post("uid", true); + if($user_id != $uid){ + $this->response(array( + 'status' => 0, + 'message' => 'token和uid不匹配', + + ), REST_Controller::HTTP_OK); + } + $applet_openid = $this->input->post("applet_openid", true); + + $res = $this->User_model->update_user(array('applet_openid' => $applet_openid), $user_id); + if($res){ + $this->response(array( + 'status' => 1, + 'message' => '更新成功', + ), REST_Controller::HTTP_OK); + }else{ + $this->response(array( + 'status' => 0, + 'message' => '更新失败', + ), REST_Controller::HTTP_OK); + } + } }