// +---------------------------------------------------------------------- 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'], 'shop_id' => $data['shop_id'] ?? 0, '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(), 'shop_id' => $this->storeId, ]; $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']]); } $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; } }