后台接口

pull/1/head
limu 10 months ago
parent b13a55592c
commit 705e74e895
  1. 2
      app/common/model/article/Category.php
  2. 44
      app/store/controller/user/Feedback.php
  3. 34
      app/store/controller/user/GoodsSource.php
  4. 56
      app/store/model/user/Feedback.php
  5. 49
      app/store/model/user/GoodsSource.php

@ -59,7 +59,7 @@ class Category extends BaseModel
*/
public function getList(array $where = []): \think\Collection
{
return $this->where($where)
return $this->where($where)->with(['catImg'])
->order(['sort', $this->getPk()])
->select();
}

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\store\controller\user;
use think\response\Json;
use app\store\controller\Controller;
use app\store\model\user\Feedback as FeedbackModel;
/**
* 反馈
*
* @package app\store\controller\user
*/
class Feedback extends Controller
{
//获取反馈列表
public function getFeedBack(): Json
{
$params = $this->request->param();
$service = new FeedbackModel();
$list = $service->getFeedback($params);
return $this->renderSuccess(compact('list'));
}
public function replay(): Json
{
$params = $this->request->param();
$service = new FeedbackModel();
if ($service->replyFeedback($params)) {
return $this->renderSuccess("回复成功");
}
return $this->renderError($service->getError() ?? "回复失败");
}
}

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\store\controller\user;
use think\response\Json;
use app\store\controller\Controller;
use app\store\model\user\GoodsSource as GoodsSourceModel;
/**
* 反馈
*
* @package app\store\controller\user
*/
class GoodsSource extends Controller
{
//获取列表
public function getList(): Json
{
$params = $this->request->param();
$service = new GoodsSourceModel();
$list = $service->getList($params);
return $this->renderSuccess(compact('list'));
}
}

@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\store\model\user;
use app\common\model\UserFeedback as UserFeedbackModel;
use cores\exception\BaseException;
/**
* 用户余额充值服务
* Class Recharge
* @package app\api\controller
*/
class Feedback extends UserFeedbackModel
{
//反馈列表
public function getFeedback($params, $listRows = 10)
{
$query = new UserFeedbackModel();
if (!empty($params['user_id'])) {
$query = $query->where(['user_id' => $params['user_id']]);
}
$list = $query->with(['shop'])
->paginate($listRows)->toArray();
foreach ($list['data'] as $k => $v) {
$list['data'][$k]['shop_name'] = !empty($v['shop']['shop_name']) ? $v['shop']['shop_name'] : '';
unset($list['data'][$k]['shop']);
}
return $list;
}
public function replyFeedback(array $data)
{
$model = self::get(['id' => $data['id']]);
if($model->status == 1){
$this->error = '请勿重复回复';
return false;
}
return $model->save([
'replay' => $data['content'],
'status' => 1,
'replay_at' => time(),
]);
}
}

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\store\model\user;
use app\common\model\user\GoodSource as GoodSourceModel;
use app\store\model\UploadFile;
use cores\exception\BaseException;
/**
* 用户余额充值服务
* Class Recharge
* @package app\api\controller
*/
class GoodsSource extends GoodSourceModel
{
//反馈列表
public function getList($params, $listRows = 10)
{
$query = new GoodSourceModel();
if (!empty($params['user_id'])) {
$query = $query->where(['user_id' => $params['user_id']]);
}
$list = $query->paginate($listRows)->toArray();
foreach ($list['data'] as $k => $v) {
$img_data = [];
if(!empty($v['imgage_ids'])){
$img_ids = json_decode($v['imgage_ids']);
$img = UploadFile::whereIn('file_id',$img_ids)->select()->toArray();
foreach($img as $ik => $iv){
$img_data[] = $iv['preview_url'];
}
}
$list['data'][$k]['imgs'] = $img_data;
}
return $list;
}
}
Loading…
Cancel
Save