diff --git a/backstage/application/api/controllers/api/Applet.php b/backstage/application/api/controllers/api/Applet.php index 99f8aaa..6057c46 100644 --- a/backstage/application/api/controllers/api/Applet.php +++ b/backstage/application/api/controllers/api/Applet.php @@ -193,6 +193,9 @@ class Applet extends REST_Controller { } $applet_openid = $this->input->post("applet_openid", true); + // 先清空关于这个openid的数据 + $this->User_model->clearAppletOpenid($applet_openid); + $res = $this->User_model->update_user(array('applet_openid' => $applet_openid), $user_id); if($res){ $this->response(array( diff --git a/backstage/application/api/models/User_model.php b/backstage/application/api/models/User_model.php index 73b0f74..e1d51d8 100644 --- a/backstage/application/api/models/User_model.php +++ b/backstage/application/api/models/User_model.php @@ -1174,4 +1174,11 @@ class User_model extends CI_Model $rs = $this->db->query($sql)->result_array(); return $rs[0]; } + + // 清空指定applet_openid + public function clearAppletOpenid($openid){ + $this->db->where('applet_openid', $openid); + $data = array('applet_openid' => ''); + return $this->db->update('tb_user', $data); + } }