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

修改后台七牛云配置,前端老师接口

... ... @@ -9,7 +9,7 @@ return array (
'content' =>
array (
),
'value' => '-5ozVJMiyjFqls8LWSXNciKa6rkedQBAxLyPazuJ',
'value' => '6DkadxfgumXmtcS3XHAIupjiKdwxnA09HgI3iB7j',
'rule' => 'required',
'msg' => '',
'tip' => '请在个人中心 > 密钥管理中获取 > AK',
... ... @@ -24,7 +24,7 @@ return array (
'content' =>
array (
),
'value' => 'nztK57AGUF6TKhfftSviQdakMK0VCsPYwRwjBJDg',
'value' => 'UoeyUoVoj4J2BRELkPz0VAlnlXxAgSwPusEaE23L',
'rule' => 'required',
'msg' => '',
'tip' => '请在个人中心 > 密钥管理中获取 > SK',
... ... @@ -39,7 +39,7 @@ return array (
'content' =>
array (
),
'value' => 'guoquestions',
'value' => 'xiaoquestions',
'rule' => 'required',
'msg' => '',
'tip' => '存储空间名称',
... ... @@ -74,7 +74,7 @@ return array (
'content' =>
array (
),
'value' => 'http://q3veqhmi6.bkt.clouddn.com',
'value' => 'http://questions.qiniu.brotop.cn',
'rule' => 'required',
'msg' => '',
'tip' => '未绑定CDN的话可使用七牛分配的测试域名',
... ...
... ... @@ -18,6 +18,7 @@ return [
'Desc' => '个人简历',
'Online' => '在线时段',
'Status' => '状态',
'Is_recommend' =>'是否推荐',
'Territory_id' => '擅长领域ID',
'Help_num' => '帮助人数',
'Level' => '星级',
... ...
... ... @@ -114,6 +114,12 @@
{:build_radios('row[status]', ['1'=>__('审核通过'), '2'=>__('审核未通过')], $row['status'])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_recommend')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[is_recommend]', ['0'=>__('不推荐'), '1'=>__('推荐')], $row['is_recommend'])}
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('Territory_id')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
... ...
... ... @@ -85,23 +85,179 @@ class Index extends Api
}
/**
* @ApiTitle (首页今日推荐列表)
* @ApiSummary (首页今日推荐列表)
* @ApiTitle (咨询分类更多列表)
* @ApiSummary (咨询分类更多列表)
* @ApiMethod (POST)
* @ApiRoute (/api/index/moreList)
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": //id,
"title"://标题,
"type"://1经营管理2职业发展
}
})
*/
public function moreList(){
$data = Db::name('contype')
->field('updatetime,createtime',true)
->order('id desc')
->select();
$this->success('success',$data);
}
/**
* @ApiTitle (首页今日推荐/更多老师列表)
* @ApiSummary (首页今日推荐/更多老师列表)
* @ApiMethod (POST)
* @ApiRoute (/api/index/today)
*
* @ApiParams (name="type", type="int", required=false, description="类型(如果为空或者为1是今日推荐列表 2是更多老师列表)")
* @ApiParams (name="keyword", type="string", required=false, description="关键字")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": //老师id,
"title"://标题,
"id": //老师id,
"user_id"://用户ID
"name"://老师名字
"sex"://性别
"birth"://出生日期
"idcard"://身份证号
"before"://身份证正面照
"behind"://身份证反面照
"phone"://手机号
"thumbnail"://头像
"address"://常住地
"honor"://头衔
"content"://个人履历
"show"://展示在最前
"desc"://个人简历
"online"://在线时段
"territory_id"://擅长领域ID
"help_num"://帮助人数
"level"://星级
"createtime"://创建时间
}
})
*/
public function today()
{
$token = $this->request->header('token');
if(empty($token)){
$type = $this->request->param('type');
$keyword = $this->request->param('keyword');
if($type == '' || $type == 1){
$data = Db::name('teacher')
->where('status',1)
->where('is_recommend',1)
->field('status,updatetime',true)
->select();
}else{
if(!empty($keyword)){
$contype = Db::name('contype')
->where('title',$keyword)
->field('id,title')
->find();
$territory = Db::name('territory')
->where('contype_id',$contype['id'])
->column('user_id');
$data = Db::name('teacher')
->where('status',1)
->where('name','Like',"%$keyword%")
->whereOr('honor','Like',"%$keyword%")
->whereOr('user_id','In',$territory)
->field('status,updatetime',true)
->select();
}else{
$data = Db::name('teacher')
->where('status',1)
->field('status,updatetime',true)
->select();
}
}
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
foreach ($data as &$v){
if($v['sex'] == 1){
$v['sex'] = '男';
}else{
$v['sex'] = '女';
}
$v['before'] = $http.$v['before'];
$v['behind'] = $http.$v['behind'];
$v['thumbnail'] = $http.$v['thumbnail'];
$v['territory_id'] = explode(',',$v['territory_id']);
foreach ($v['territory_id'] as &$val){
$val = Db::name('territory')
->alias('a')
->join('contype b','a.contype_id = b.id')
->where('a.id',$val)
->column('b.title');
}
}
$this->success('success',$data);
}
$type = $this->request->param('type');
$keyword = $this->request->param('keyword');
if($type == '' || $type == 1){
$data = Db::name('teacher')
->where('status',1)
->where('is_recommend',1)
->field('status,updatetime',true)
->select();
}else{
if(!empty($keyword)){
$contype = Db::name('contype')
->where('title',$keyword)
->field('id,title')
->find();
$territory = Db::name('territory')
->where('contype_id',$contype['id'])
->column('user_id');
$data = Db::name('teacher')
->where('status',1)
->where('name','Like',"%$keyword%")
->whereOr('honor','Like',"%$keyword%")
->whereOr('user_id','In',$territory)
->field('status,updatetime',true)
->select();
}else{
$data = Db::name('teacher')
->where('status',1)
->field('status,updatetime',true)
->select();
}
}
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
foreach ($data as &$v){
if($v['sex'] == 1){
$v['sex'] = '男';
}else{
$v['sex'] = '女';
}
$v['before'] = $http.$v['before'];
$v['behind'] = $http.$v['behind'];
$v['thumbnail'] = $http.$v['thumbnail'];
$v['territory_id'] = explode(',',$v['territory_id']);
foreach ($v['territory_id'] as &$val){
$val = Db::name('territory')
->alias('a')
->join('contype b','a.contype_id = b.id')
->where('a.id',$val)
->column('b.title');
}
}
$this->success('success',$data);
}
}
... ...
... ... @@ -76,6 +76,11 @@ class Teacher extends Api
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
$param['before'] = str_replace($http,'',$param['before']);
$param['behind'] = str_replace($http,'',$param['behind']);
$param['thumbnail'] = str_replace($http,'',$param['thumbnail']);
$param['createtime'] = time();
$data = Db::name('teacher')->insertGetId($param);
if(empty($data)){
... ...
... ... @@ -18,7 +18,7 @@ return [
// 应用命名空间
'app_namespace' => 'app',
// 应用调试模式
'app_debug' => Env::get('app.debug', false),
'app_debug' => Env::get('app.debug', true),
// 应用Trace
'app_trace' => Env::get('app.trace', false),
// 应用模式状态
... ...
... ... @@ -38,6 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'honor', title: __('Honor'), operate:false},
{field: 'online', title: __('Online'), operate:false},
{field: 'status', title: __('Status'),formatter: Table.api.formatter.status,custom: {1:'success', 2:'error'},searchList:{'0':'待审核','1': '审核通过','2':'审核未通过'}},
{field: 'is_recommend', title: __('Is_recommend'),formatter: Table.api.formatter.label,searchList:{'0': '不推荐','1':'推荐'}},
{field: 'territory_id', title: __('Territory_id'), operate:false},
{field: 'help_num', title: __('Help_num'), operate:false},
{field: 'level', title: __('Level'), operate:false},
... ...