作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

修改token

... ... @@ -104,13 +104,13 @@ class Index extends Api
if(empty($type) || $type == 1){
$data['total_num'] = Db::name('application')
->field('id,image,name,createtime')
// ->where('city_id',$city_id)
->where('city_id',$city_id)
->where('status',1)
->where('is_choiceness',1)
->count();
$data['info'] = Db::name('application')
->field('id,image,name,createtime')
// ->where('city_id',$city_id)
->where('city_id',$city_id)
->where('status',1)
->where('is_choiceness',1)
->order('createtime desc')
... ... @@ -123,12 +123,12 @@ class Index extends Api
}else{
$data['total_num'] = Db::name('application')
->field('id,image,name,createtime')
// ->where('city_id',$city_id)
->where('city_id',$city_id)
->where('status',1)
->count();
$data['info'] = Db::name('application')
->field('id,image,name,createtime')
// ->where('city_id',$city_id)
->where('city_id',$city_id)
->where('status',1)
->order('createtime desc')
->page($page,$pageNum)
... ...
... ... @@ -287,38 +287,62 @@ class Store extends Api
*/
public function detail()
{
$user_id = $this->getUserId();
$id = $this->request->param('id');
if(empty($id)){
$this->error('缺少必要参数');
}
//查询我的足迹
$foot = Db::name('footprint')->where('user_id',$user_id)->where('application_id',$id)->find();
if(empty($foot)){
$info['user_id'] = $user_id;
$info['application_id'] = $id;
$info['createtime'] = time();
Db::name('footprint')->insertGetId($info);
$token = $this->request->header('token');
if(empty($token)){
$id = $this->request->param('id');
if(empty($id)){
$this->error('缺少必要参数');
}
$data = Db::name('application')
->where('id',$id)
->field('updatetime',true)
->find();
if(empty($data)){
$this->error('数据错误');
}
$qiniu = get_addon_config('qiniu')['cdnurl'];
$data['yuan_image'] = $data['image'];
$data['image'] = $qiniu.$data['image'];
$data['lon'] = floatval($data['lon']);
$data['city_name'] = Db::name('area')->where('id',$data['city_id'])->value('name');
$data['type_name'] = Db::name('type')->where('id',$data['type_id'])->value('name');
$data['lat'] = floatval($data['lat']);
$data['createtime'] = date('Y-m-d H:i:s',$data['createtime']);
$this->success('success',$data);
}else{
$createtime = time();
Db::name('footprint')->where('id',$foot['id'])->update(['createtime'=>$createtime]);
}
$data = Db::name('application')
->where('id',$id)
->field('updatetime',true)
->find();
if(empty($data)){
$this->error('数据错误');
$user_id = $this->getUserId();
$id = $this->request->param('id');
if(empty($id)){
$this->error('缺少必要参数');
}
//查询我的足迹
$foot = Db::name('footprint')->where('user_id',$user_id)->where('application_id',$id)->find();
if(empty($foot)){
$info['user_id'] = $user_id;
$info['application_id'] = $id;
$info['createtime'] = time();
Db::name('footprint')->insertGetId($info);
}else{
$createtime = time();
Db::name('footprint')->where('id',$foot['id'])->update(['createtime'=>$createtime]);
}
$data = Db::name('application')
->where('id',$id)
->field('updatetime',true)
->find();
if(empty($data)){
$this->error('数据错误');
}
$qiniu = get_addon_config('qiniu')['cdnurl'];
$data['yuan_image'] = $data['image'];
$data['image'] = $qiniu.$data['image'];
$data['lon'] = floatval($data['lon']);
$data['city_name'] = Db::name('area')->where('id',$data['city_id'])->value('name');
$data['type_name'] = Db::name('type')->where('id',$data['type_id'])->value('name');
$data['lat'] = floatval($data['lat']);
$data['createtime'] = date('Y-m-d H:i:s',$data['createtime']);
$this->success('success',$data);
}
$qiniu = get_addon_config('qiniu')['cdnurl'];
$data['yuan_image'] = $data['image'];
$data['image'] = $qiniu.$data['image'];
$data['lon'] = floatval($data['lon']);
$data['city_name'] = Db::name('area')->where('id',$data['city_id'])->value('name');
$data['type_name'] = Db::name('type')->where('id',$data['type_id'])->value('name');
$data['lat'] = floatval($data['lat']);
$data['createtime'] = date('Y-m-d H:i:s',$data['createtime']);
$this->success('success',$data);
}
/**
... ...