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

添加丢失我的领域以及点亮接口

... ... @@ -77,6 +77,10 @@ class Teacher extends Api
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$count = count(explode(',',$param['territory_id']));
if($count>4){
$this->error('最多添加4个擅长领域');
}
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
$param['before'] = str_replace($http, '', $param['before']);
... ... @@ -201,6 +205,10 @@ class Teacher extends Api
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$count = count(explode(',',$param['territory_id']));
if($count>4){
$this->error('最多添加4个擅长领域');
}
$qiniu = get_addon_config('qiniu');
$http = $qiniu['cdnurl'];
$param['before'] = str_replace($http, '', $param['before']);
... ... @@ -216,6 +224,77 @@ class Teacher extends Api
}
/**
* @ApiTitle (我的擅长领域)
* @ApiSummary (我的擅长领域)
* @ApiMethod (POST)
* @ApiRoute (/api/teacher/shanList)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": //id,
"title"://标题,
"is_check"://是否选中(0未点亮1点亮
"money"://价格
"content"://领域优势
}
})
*/
public function shanList()
{
$user_id = $this->getUserId();
$data = Db::name('territory')
->alias('a')
->join('contype b','a.contype_id = b.id')
->where('a.user_id',$user_id)
->field('a.*,b.title')
->select();
$this->success('success',$data);
}
/**
* @ApiTitle (点亮标签/取消点亮)
* @ApiSummary (点亮标签/取消点亮)
* @ApiMethod (POST)
* @ApiRoute (/api/teacher/cancle)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="id", type="int", required=true, description="擅长领域ID")
*
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
}
})
*/
public function cancle()
{
$user_id = $this->getUserId();
$id = $this->request->param('id');
if(empty($id)){
$this->error('缺少必要参数');
}
$data = Db::name('territory')
->where('id',$id)
->find();
if($data['is_check'] == 0){
Db::name('territory')->where('id',$id)->update(['is_check'=>1]);
$this->success('点亮成功');
}else{
Db::name('territory')->where('id',$id)->update(['is_check'=>0]);
$this->success('取消点亮成功');
}
}
/**
* @ApiTitle (新赠擅长领域)
* @ApiSummary (新赠擅长领域)
* @ApiMethod (POST)
... ...
此 diff 太大无法显示。