模型
// 修改密码接口
public static function Uppassword($rel){
if(empty($rel['password'])){
$array['status']=1;
$array['msg']="密码不能为空";
return $array;
}
if(strlen($rel['password'])<6){
$array['status']=2;
$array['msg']="密码不得小于6位";
return $array;
}
$sql = DB::table('jy_user')->where('password',md5($rel['password']))->first();
if(!$sql){
$array['status']=3;
$array['msg']="原始密码不正确";
return $array;
}
if($rel['pwd']!=$rel['passworda']){
$array['status']=4;
$array['msg']="两次密码不一致";
return $array;
}else{
$id = $_GET['id'];
$password=array(
'password'=>md5($rel['passworda'])
);
$data = DB::table('jy_user')->where('id',$id)->update($password);
$array['status']=5;
$array['msg']="修改密码成功";
return $array;
}
}
控制器
// 修改密码接口
public function uppwd(Request $request){
$data = $request->all();
$info = Api::Uppassword($data);
return json_encode($info);
}
// 未支付的状态接口
public function noorder(){
$uid = $_GET['uid'];
$sql = DB::select("select jy_id.order,jy_goodsclass.stateof,jy_goodsclass.gc_name from jy_goodsclass,jy_id where jy_goodsclass.id=jy_id.pid and uid={$uid} and stateof=1");
if($sql){
$array["list"]=$sql;
$array['status']=100;
$array['msg']="成功";
}
return json_encode($array);
}
//已支付的状态接口
public function yesorder(){
$uid = $_GET['uid'];
$sql = DB::select("select jy_id.order,jy_goodsclass.stateof,jy_goodsclass.gc_name,jy_goodsclass.gc_price,jy_goodsclass.gc_endprice from jy_goodsclass,jy_id where jy_goodsclass.id=jy_id.pid and uid={$uid} and stateof=2");
if($sql){
$array['list']=$sql;
$array['status']=100;
$array['msg']="成功";
}
return json_encode($array);
}
// 已取消的状态接口
public function escorder(){
$uid = $_GET['uid'];
$sql = DB::select("select jy_id.order,jy_goodsclass.stateof,jy_goodsclass.gc_name from jy_goodsclass,jy_id where jy_goodsclass.id=jy_id.pid and uid={$uid} and stateof=3");
if($sql){
$array['list']=$sql;
$array['status']=100;
$array['msg']="成功";
}
return json_encode($array);
}