作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

提现失败问题

... ... @@ -63,12 +63,48 @@ class SchoolController extends AdminBaseController{
return $this -> fetch();
}
public function getArea(){
$parent_id = $this->request->param('pid');
$where['name'] = ['like',"%$parent_id%"];
$where['pid'] = ['eq',0];
$data = Db::name('area')->where($where)->select();
$this->success('SUCCESS','',$data);
/**
* 获取城市
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function select_city(){
$province_name = $this->request->param('province_name');
if(!isset($province_name)){
$arr['code'] = 40005;
$arr['msg'] = '缺少必要参数';
}else{
$province = Db::name('area')->where(['name'=>$province_name,'level'=>1])->find();
$city = Db::name('area')->where(['pid'=>$province['id'],'level'=>2])->select();
$arr['code'] = 20000;
$arr['msg'] = 'SUCCESS';
$arr['data'] = $city;
}
return json_encode($arr);
}
/**
* 获取区/县
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function select_county(){
$city_name = $this->request->param('city_name');
if(!isset($city_name)){
$arr['code'] = 40005;
$arr['msg'] = '缺少必要参数';
}else{
$city = Db::name('area')->where(['name'=>$city_name,'level'=>2])->find();
$county = Db::name('area')->where(['pid'=>$city['id'],'level'=>3])->select();
$arr['code'] = 20000;
$arr['msg'] = 'SUCCESS';
$arr['data'] = $county;
}
return json_encode($arr);
}
... ...
... ... @@ -47,15 +47,16 @@
</body>
<script src="__STATIC__/js/admin.js"></script>
<script>
//获取城市
$('#province').change(function(){
var province_id = $('#province option:selected').val();
var province_name = $('#province option:selected').val();
$.ajax({
url:"{:url('getArea')}",
url:"{:url('select_city')}",
type:"GET",
data:{'pid':province_id},
data:{'province_name':province_name},
success:function(data) {
if(data.code==1){
var result = data;
var result = eval("(" + data + ")");
if(result.code==20000){
var mydata = "<option value=''>请选择</option>";
for (var i = 0; i < result.data.length; i++) {
var data = result.data[i];
... ... @@ -63,7 +64,7 @@
}
$('#city').html(mydata);
$('#county').html("<option value=''>请选择</option>");
}else {
}else if(result.code==40005){
alert('获取失败!');
}
}
... ... @@ -71,21 +72,21 @@
})
//获取区/县
$('#city').change(function(){
var city_id = $('#city option:selected').val();
var city_name = $('#city option:selected').val();
$.ajax({
url:"{:url('getArea')}",
url:"{:url('select_county')}",
type:"GET",
data:{'pid':city_id},
data:{'city_name':city_name},
success:function(data) {
if(data.code==1){
var result = data;
var result = eval("(" + data + ")");
if(result.code==20000){
var mydata = "<option value=''>请选择</option>";
for (var i = 0; i < result.data.length; i++) {
var data = result.data[i];
mydata += '<option value="'+data.name+'">'+data.name+'</option>';
}
$('#county').html(mydata);
}else {
}else if(result.code==40005){
alert('获取失败!');
}
}
... ...