更新发布管理列表接口

This commit is contained in:
yaooo 2023-08-17 17:04:15 +08:00
parent 2235e975b5
commit f1d7babbdb
2 changed files with 48 additions and 0 deletions

View File

@ -28,6 +28,7 @@ use crmeb\services\MiniProgramService;
use think\App;
use app\common\repositories\community\CommunityRepository as repository;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\Log;
class Community extends BaseController
@ -461,4 +462,45 @@ class Community extends BaseController
return app('json')->success(['cart_id' => $cartIds]);
}
/**
* 转售商品列表
* @return mixed
*/
public function resaleList()
{
[$page, $limit] = $this->getPage();
$status = $this->request->param('status');
$queryBuilder = Db::name('community')->alias('c')->leftJoin('resale r','c.community_id = r.community_id')->where('c.uid', $this->request->uid());
// 在售商品
if ($status == 1) {
$queryBuilder->where('c.status', 1)->where('c.is_show', 1)->where(function ($query) {
$query->where(function ($conn) {
$conn->where('c.resale_type', 1)->where('r.status', 0);
});
$query->whereOr(function ($conn) {
$conn->where('c.resale_type', 2)->where('c.mer_status', 1)->where('r.status', 0);
});
});
}
// 已售出商品
if ($status == 2) {
$queryBuilder->where('c.status', 1)->where('r.status', 1);
}
// 待审核
if ($status == 3) {
$queryBuilder->where('c.status', 0);
}
// 审核未通过
if ($status == 4) {
$queryBuilder->where('c.status', -1);
}
// 审核通过
if ($status == 5) {
$queryBuilder->where('c.status', 1);
}
$count = $queryBuilder->count();
$list = $queryBuilder->field('c.community_id, c.title, c.image')->group('c.community_id')->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(true)->select();
return app('json')->success(compact('count','list'));
}
}

View File

@ -365,6 +365,12 @@ Route::group('api/', function () {
Route::get('order/:id', 'Community/getSpuByOrder');
Route::get('qrcode/:id', 'Community/qrcode');
Route::get('resale/lst', 'Community/resaleList');
Route::get('resale/:id', 'Community/resaleDetail');
Route::post('resale/edit/:id', 'Community/editResale');
Route::post('resale/delete/:id', 'Community/deleteResale');
Route::post('resale/check/:id', 'Community/checkesale');
})->prefix('api.community.');
Route::group('svip', function () {