You've already forked guangan
用户随手拍上传
This commit is contained in:
@ -4,11 +4,44 @@ namespace plugin\ticket\controller\api\auth;
|
|||||||
|
|
||||||
|
|
||||||
use plugin\ticket\controller\api\Auth;
|
use plugin\ticket\controller\api\Auth;
|
||||||
|
use plugin\ticket\model\TicketUserShare;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户随手拍小程序接口
|
* 用户随手拍小程序接口
|
||||||
*/
|
*/
|
||||||
class UserShare extends Auth
|
class UserShare extends Auth
|
||||||
{
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$pageData = TicketUserShare::query()->where(['user_id'=>$this->usid])->paginate();
|
||||||
|
$this->success('获取用户随手拍列表', $pageData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function info()
|
||||||
|
{
|
||||||
|
[$id] = $this->_vali([
|
||||||
|
'id.require' => 'ID不能为空',
|
||||||
|
]);
|
||||||
|
$info = TicketUserShare::query()->where(['user_id'=>$this->usid])->findOrEmpty($id);
|
||||||
|
if ($info->isEmpty()) $this->error('数据不存在');
|
||||||
|
$this->success('获取用户随手拍详情', $info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$data = $this->_vali([
|
||||||
|
'title.default' => '用户随手拍',
|
||||||
|
'content.require' => '内容不能为空',
|
||||||
|
'imgs.default' => [],
|
||||||
|
'imgs.array' => '图片异常',
|
||||||
|
'type_id.require' => '类型不能为空',
|
||||||
|
'contact_phone.require' => '手机号不能为空',
|
||||||
|
'ticket_region.require' => '地址不能为空',
|
||||||
|
'ticket_address.require' => '地址不能为空',
|
||||||
|
'contact_name.default' => $this->account->user() ? $this->account->user()['nickname'] : '用户',
|
||||||
|
]);
|
||||||
|
$data['user_id'] = $this->usid;
|
||||||
|
$id = TicketUserShare::query()->insert($data, true);
|
||||||
|
$this->success('添加随手拍成功', $id);
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user