...
|
...
|
@@ -206,11 +206,17 @@ class Project extends Api |
|
|
$param['image'] = str_replace($http,'',$param['image']);
|
|
|
$param['createtime'] = time();
|
|
|
$data = Db::name('project')->insertGetId($param);
|
|
|
//项目二维码
|
|
|
$common = new Common();
|
|
|
$url = 'pages/ShopDetail/ShopDetail?id='.$data;
|
|
|
$thumbnail = $common->imgcode($data,$url);
|
|
|
Db::name('project')->where('id',$data)->update(['thumbnail'=>$thumbnail]);
|
|
|
|
|
|
//授权二维码
|
|
|
$farm_id = $param['farm_id'];
|
|
|
$project_id = $data;
|
|
|
$page = 'pages/UserAdmin/UserAdmin';
|
|
|
$pic = $common->shou($farm_id,$project_id,$page);
|
|
|
Db::name('project')->where('id',$data)->update(['thumbnail'=>$thumbnail,'pic'=>$pic]);
|
|
|
//修改农场项目数
|
|
|
$project_num = Db::name('farm')->where('id',$param['farm_id'])->field('id,project_num')->find();
|
|
|
$project_num = $project_num['project_num'] + 1;
|
...
|
...
|
@@ -1228,4 +1234,30 @@ class Project extends Api |
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (项目授权码)
|
|
|
* @ApiSummary (项目授权码)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/project/shou)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
*
|
|
|
* @ApiParams (name="id", type="int", required=false, description="项目id")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "SUCCESS",
|
|
|
"time": "1553839125",
|
|
|
"data": {
|
|
|
"id"://项目id
|
|
|
"pic"://项目授权码
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function shou()
|
|
|
{
|
|
|
$id = $this->request->param('id');
|
|
|
$data = Db::name('project')->where('id',$id)->field('id,pic')->find();
|
|
|
$this->success('success',$data);
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|