You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/api/service/Feedback.php

60 lines
2.1 KiB

11 months ago
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\api\service;
use app\common\model\UserFeedback;
use app\common\service\BaseService;
use cores\exception\BaseException;
/**
* 用户余额充值服务
* Class Recharge
* @package app\api\controller
*/
class Feedback extends BaseService
{
//添加反馈
public function addFeedback($data, $user_data)
{
$addData = [
'user_id' => $user_data['user_id'],
11 months ago
'shop_id' => $data['shop_id'] ?? 0,
11 months ago
'type' => $data['type'],
'object_type' => $data['object_type'],
'content' => $data['content'],
'user_name' => $user_data['user_name'],
'mobile' => $user_data['mobile'],
'status' => 0,
'created_at' => time(),
11 months ago
'shop_id' => $this->storeId,
11 months ago
];
$model = new UserFeedback();
return $model->insert($addData);
}
//反馈列表
public function getFeedback($params, $listRows = 10)
{
$query = new UserFeedback();
if (!empty($params['is_my']) && !empty($params['user_id'])) {
$query = $query->where(['user_id' => $params['user_id']]);
}
11 months ago
$list = $query->with(['shop'])
11 months ago
->paginate($listRows)->toArray();
foreach ($list['data'] as $k => $v) {
11 months ago
$list['data'][$k]['shop_name'] = !empty($v['shop']['shop_name']) ? $v['shop']['shop_name'] : '';
unset($list['data'][$k]['shop']);
11 months ago
}
return $list;
}
}