35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\code\controller;
|
||
|
|
|
||
|
|
use think\Controller;
|
||
|
|
use think\Db;
|
||
|
|
use think\Cache;
|
||
|
|
use think\Log;
|
||
|
|
|
||
|
|
class Base extends Controller{
|
||
|
|
|
||
|
|
|
||
|
|
################################################################接口################################################################
|
||
|
|
################################################################接口################################################################
|
||
|
|
################################################################接口################################################################
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
public function msg($data,$str='',$result = []){
|
||
|
|
if(is_array($data)){
|
||
|
|
if($str != ''){
|
||
|
|
return json(['code'=>0,'msg'=>$str,'data'=>$data]);
|
||
|
|
}else{
|
||
|
|
return json(['code'=>0,'msg'=>'操作成功','data'=>$data]);
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
if($str != ''){
|
||
|
|
return json(['code'=>$data,'msg'=>$str,'data'=>$result]);
|
||
|
|
}
|
||
|
|
return json(['code'=>$data,'msg'=>$this->return_data_all[$data],'data'=>$result]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|