作者 魏强
1 个管道 的构建 通过 耗费 0 秒
... ... @@ -255,4 +255,8 @@ return [
'cmf_default_theme' => 'simpleboot3',
'cmf_admin_theme_path' => 'themes/admin/',
'cmf_admin_default_theme' => 'simpleboot3',
//小程序配置
'app_id' => 'wxd4445f65df16adca',
'app_secret' => '68043ad6055fd24e25d86c171a1a2057',
];
... ...
... ... @@ -86,7 +86,8 @@ class ResourceController extends RestBaseController
*
* @header name:XX-Token require:1 default: desc:token
*
* @param name:city type:int require:0 other: desc:当前城市ID(默认为当前城市,如果不授权默认为全国)
* @param name:lng type:string require:0 other: desc:当前城市经度(默认为当前城市,如果不授权默认为全国)
* @param name:lat type:string require:0 other: desc:当前城市纬度(默认为当前城市,如果不授权默认为全国)
* @param name:page type:int require:0 other: desc:当前页(默认1)
* @param name:pageNum type:int require:0 other: desc:每页显示数据个数(默认10)
*
... ... @@ -98,12 +99,19 @@ class ResourceController extends RestBaseController
*/
public function index()
{
$user_id = $this->getUserId();
// $user_id = $this->getUserId();
$page = $this->request->param('page',1,'intval');
$pageNum = $this->request->param('pageNum',10,'intval');
$city = $this->request->param('city_id');
if(!empty($city)){
$where['city'] = ['like',"%$city%"];
$param = $this->request->param();
if(!empty($param['lng'])){
if(empty($param['lat'])){
$this->error(['code'=>40005,'msg'=>'确实必要参数']);
}
$city = Db::name('area')
->where('lng',$param['lng'])
->where('lat',$param['lat'])
->find();
$where['city'] = ['like',"%$city[id]%"];
}
$where['delete_time'] = ['eq',0];
$where['job_type'] = ['in',[1,2,3,4]];
... ... @@ -116,6 +124,7 @@ class ResourceController extends RestBaseController
->page($page,$pageNum)
->select()
->toArray();
foreach ($list as $k=>$v){
$list[$k]['create_time'] = date('Y-m-d',$v['create_time']);
}
... ...
... ... @@ -175,4 +175,50 @@ class PublicController extends RestBaseController
}
/**
* @title 通过code获取token
* @description 通过code获取token
* @author Tiger Yang
* @url /wxapp/public/getToken
* @method POST
*
* @param name:code type:string require:1 other: desc:code
*
* @return is_register:是否注册(0未注册,1已注册)
* @return token:token
*/
public function getToken(){
$validate = new Validate([
'code' => 'require',
]);
$validate->message([
'code.require' => '缺少参数code!',
]);
$data = $this->request->param();
if (!$validate->check($data)) {
$this->error(['code'=>'40003','msg'=>$validate->getError()]);
}
$code = $data['code'];
$appId = config('app_id');
$appSecret = config('app_secret');
$response = cmf_curl_get("https://api.weixin.qq.com/sns/jscode2session?appid=$appId&secret=$appSecret&js_code=$code&grant_type=authorization_code");
$response = json_decode($response, true);
if (!empty($response['errcode'])) {
$this->error(['code'=>'41001','msg'=>'操作失败:'.$response['errcode']]);
}
$third_party_user = Db::name('third_party_user')->where(['openid'=>$response['openid']])->find();
if(empty($third_party_user)){
$this->success('SUCCESS',['is_register'=>0]);
}
$user_token = Db::name('user_token')->where(['user_id'=>$third_party_user['user_id'],'device_type'=>'wxapp'])->find();
$data['is_register'] = 1;
$data['token'] = $user_token['token'];
$this->success('SUCCESS',$data);
}
}
... ...
... ... @@ -88,9 +88,6 @@ class AdminIndexController extends AdminBaseController
// $list[$k]['authentication'] = 0;
// }
// }
//
//
//
// 获取分页显示
$page = $list->render();
... ...
... ... @@ -99,6 +99,7 @@ return array (
'ADMIN_SLIDEITEM_EDITPOST' => '幻灯片页面编辑提交',
'ADMIN_SLIDEITEM_INDEX' => '幻灯片页面列表',
'ADMIN_SLIDEITEM_LISTORDER' => '幻灯片页面排序',
'ADMIN_STATISTIC_INDEX' => '信息统计',
'ADMIN_STORAGE_INDEX' => '文件存储',
'ADMIN_STORAGE_SETTINGPOST' => '文件存储设置提交',
'ADMIN_THEME_ACTIVE' => '启用模板',
... ...
... ... @@ -28,7 +28,7 @@
<th>{:lang('REGISTRATION_TIME')}</th>
<th>{:lang('LAST_LOGIN_TIME')}</th>
<th>{:lang('LAST_LOGIN_IP')}</th>
<th>{:lang('STATUS')}</th>
<th>用户状态</th>
<th>认证状态</th>
<th>{:lang('ACTIONS')}</th>
</tr>
... ...