new-admin-api/app/controller/admin/store/Point.php

71 lines
1.8 KiB
PHP

<?php
namespace app\controller\admin\store;
use app\common\repositories\store\PointRepository;
use think\App;
use crmeb\basic\BaseController;
class Point extends BaseController{
protected $repository;
public function __construct(App $app, PointRepository $repository){
parent::__construct($app);
$this->repository = $repository;
}
/**
* Common: 列表获取
* Author: wu-hui
* Time: 2024/04/10 18:20
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(){
[$page, $limit] = $this->getPage();
$params = $this->request->params(['mer_take_name']);
$data = $this->repository->getList((array)$params,(int)$page,(int)$limit);
return app('json')->success($data);
}
/**
* Common: 编辑信息
* Author: wu-hui
* Time: 2024/04/10 18:19
* @return mixed
* @throws \think\db\exception\DbException
*/
public function editInfo(){
$params = $this->request->params([
['id', 0],
'mer_take_name',
'mer_take_phone',
'mer_take_location',
'mer_take_address',
'mer_take_day',
'mer_take_time'
]);
$params['mer_id'] = (int)$this->request->merId();
$this->repository->editInfo($params);
return app('json')->success();
}
/**
* Common: 删除信息
* Author: wu-hui
* Time: 2024/04/10 18:42
* @param $id
* @return mixed
*/
public function delInfo($id){
$id = (int)$this->request->param('id');
$this->repository->update($id,['is_del' => 1]);
return app('json')->success('删除成功');
}
}