更新若干功能
This commit is contained in:
41
app/Service/wx/WxFeedbackService.php
Normal file
41
app/Service/wx/WxFeedbackService.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\wx;
|
||||
|
||||
use App\BaseApp\BaseWxService;
|
||||
use App\Models\business\FeedbackModel;
|
||||
|
||||
/**
|
||||
* 小程序用户反馈
|
||||
*/
|
||||
class WxFeedbackService extends BaseWxService
|
||||
{
|
||||
public function list(): array
|
||||
{
|
||||
return FeedbackModel::where('user_id', $this->userId)
|
||||
->where('deleted_at', 0)
|
||||
->orderByDesc('id')
|
||||
->get()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function create(array $params): array
|
||||
{
|
||||
$content = trim((string) ($params['content'] ?? ''));
|
||||
if ($content === '') {
|
||||
$this->utils->errorThrow('请填写反馈内容');
|
||||
}
|
||||
$now = time();
|
||||
$id = (int) FeedbackModel::insertGetId([
|
||||
'user_id' => $this->userId,
|
||||
'content' => mb_substr($content, 0, 500),
|
||||
'images' => is_array($params['images'] ?? null)
|
||||
? implode(',', $params['images'])
|
||||
: (string) ($params['images'] ?? ''),
|
||||
'status' => FeedbackModel::STATUS_PENDING,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
return FeedbackModel::where('id', $id)->first()->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user