Merge branch 'master' of ssh://code.srdcloud.cn:29418/fsdxszhpt/yzms
This commit is contained in:
commit
a9faff847a
|
@ -180,4 +180,33 @@ class Applet extends REST_Controller {
|
||||||
)
|
)
|
||||||
), REST_Controller::HTTP_OK);
|
), 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);
|
||||||
|
|
||||||
|
// 先清空关于这个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(
|
||||||
|
'status' => 1,
|
||||||
|
'message' => '更新成功',
|
||||||
|
), REST_Controller::HTTP_OK);
|
||||||
|
}else{
|
||||||
|
$this->response(array(
|
||||||
|
'status' => 0,
|
||||||
|
'message' => '更新失败',
|
||||||
|
), REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1174,4 +1174,11 @@ class User_model extends CI_Model
|
||||||
$rs = $this->db->query($sql)->result_array();
|
$rs = $this->db->query($sql)->result_array();
|
||||||
return $rs[0];
|
return $rs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清空指定applet_openid
|
||||||
|
public function clearAppletOpenid($openid){
|
||||||
|
$this->db->where('applet_openid', $openid);
|
||||||
|
$data = array('applet_openid' => null);
|
||||||
|
return $this->db->update('tb_user', $data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ if($act == 'applet_unifiedorder') {
|
||||||
if($isjsapi) {
|
if($isjsapi) {
|
||||||
$openid = $user['applet_openid'];
|
$openid = $user['applet_openid'];
|
||||||
if(!$openid) {
|
if(!$openid) {
|
||||||
echoRs(0, '非小程序注册用户!不能使用小程序支付!');
|
echoRs(0, '获取openid失败,请在小程序里重新登录再试!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
|
|
Loading…
Reference in New Issue