wangmingchuan321@qq.com 1 year ago
commit b0f58984c3
  1. 70
      app/api/controller/Recovery.php
  2. 14
      app/api/controller/Server.php
  3. 53
      app/api/model/Server/RecoveryCategory.php
  4. 21
      app/api/model/Server/ServerRecovery.php
  5. 21
      app/api/service/identity/PaySuccess.php
  6. 2
      app/common/model/article/Category.php
  7. 6
      app/common/service/server/Order.php
  8. 6
      app/store/controller/Recovery.php
  9. 44
      app/store/controller/user/Feedback.php
  10. 34
      app/store/controller/user/GoodsSource.php
  11. 56
      app/store/model/user/Feedback.php
  12. 49
      app/store/model/user/GoodsSource.php

@ -4,15 +4,70 @@ declare (strict_types=1);
namespace app\api\controller; namespace app\api\controller;
use app\api\model\RecoveryOrder; use app\api\model\RecoveryOrder;
use app\api\model\Server\RecoveryCategory;
use app\api\model\Server\ServerRecovery;
use app\common\enum\RecoveryStatusEnum; use app\common\enum\RecoveryStatusEnum;
use app\common\enum\RecoveryTypeEnum; use app\common\enum\RecoveryTypeEnum;
use app\common\library\helper; use app\common\library\helper;
use cores\exception\BaseException; use cores\exception\BaseException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\response\Json; use think\response\Json;
class Recovery extends Controller class Recovery extends Controller
{ {
/**
* @notes:分类列表
* @return Json
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author: wanghousheng
*/
public function categoryList(): Json
{
$model = new RecoveryCategory();
$list = $model->list();
if (!empty($list)) {
foreach ($list as $key => $value) {
unset($list[$key]['image']);
}
}
return $this->renderSuccess(compact('list'));
}
/**
* @notes:服务列表页
* @throws DbException
* @author: wanghousheng
*/
public function recoveryList(): Json
{
$recovery_name = $this->request->post('recovery_name');
$category_id = intval($this->request->post('category_id'));
$where = [];
if ($recovery_name) {
$where[] = ['server_recovery.recovery_name', 'like', "%$recovery_name%"];
}
if ($category_id) {
$where[] = ['server_recovery.category_id', '=', $category_id];
}
$where[] = ['server_recovery.status', '=', 1];
$model = new ServerRecovery();
$list = $model->getList($where);
$data['list'] = $list->items();
$data['total'] = $list->total();
if (!$list->isEmpty()) {
foreach ($data['list'] as $key => $value) {
unset($data['list'][$key]['image']);
unset($data['list'][$key]['category']);
}
}
return $this->renderSuccess($data);
}
/** /**
* @notes:用户回收订单列表 * @notes:用户回收订单列表
* @return Json * @return Json
@ -20,7 +75,7 @@ class Recovery extends Controller
* @throws DbException * @throws DbException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function list(): Json public function orderList(): Json
{ {
$where = []; $where = [];
$order_status = intval($this->request->post('order_status')); $order_status = intval($this->request->post('order_status'));
@ -59,7 +114,7 @@ class Recovery extends Controller
* @throws BaseException * @throws BaseException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function detail(): Json public function orderDetail(): Json
{ {
$orderId = intval($this->request->post('order_id')); $orderId = intval($this->request->post('order_id'));
if (!$orderId) { if (!$orderId) {
@ -89,7 +144,7 @@ class Recovery extends Controller
* @throws BaseException * @throws BaseException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function cancel(): Json public function cancelOrder(): Json
{ {
$orderId = intval($this->request->post('order_id')); $orderId = intval($this->request->post('order_id'));
if (!$orderId) { if (!$orderId) {
@ -109,7 +164,7 @@ class Recovery extends Controller
* @throws BaseException * @throws BaseException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function add(): Json public function addOrder(): Json
{ {
$imageIds = $this->request->post('image_ids'); $imageIds = $this->request->post('image_ids');
if ($imageIds) { if ($imageIds) {
@ -123,6 +178,10 @@ class Recovery extends Controller
if (!$shop_id) { if (!$shop_id) {
return $this->renderError('门店不能为空'); return $this->renderError('门店不能为空');
} }
$recovery_id = intval($this->request->post('recovery_id'));
if (!$recovery_id) {
return $this->renderError('缺少必要参数');
}
$recovery_type_arr = array_values(RecoveryStatusEnum::data()); $recovery_type_arr = array_values(RecoveryStatusEnum::data());
$recovery_type_arr = array_column($recovery_type_arr, 'value'); $recovery_type_arr = array_column($recovery_type_arr, 'value');
$recovery_type = intval($this->request->post('recovery_type')); $recovery_type = intval($this->request->post('recovery_type'));
@ -171,6 +230,7 @@ class Recovery extends Controller
$express_id = intval($this->request->post('express_id')); $express_id = intval($this->request->post('express_id'));
$express_no = $this->request->post('express_no'); $express_no = $this->request->post('express_no');
$data = [ $data = [
'recovery_id' => $recovery_id,
'express_id' => $express_id, 'express_id' => $express_id,
'express_no' => $express_no, 'express_no' => $express_no,
'shipping_address' => $shipping_address, 'shipping_address' => $shipping_address,
@ -198,7 +258,7 @@ class Recovery extends Controller
* @return Json * @return Json
* @author: wanghousheng * @author: wanghousheng
*/ */
public function update(): Json public function updateOrder(): Json
{ {
$order_id = intval($this->request->post('order_id')); $order_id = intval($this->request->post('order_id'));
if (!$order_id) { if (!$order_id) {

@ -47,6 +47,8 @@ class Server extends Controller
{ {
$server_name = $this->request->post('server_name'); $server_name = $this->request->post('server_name');
$category_id = intval($this->request->post('category_id')); $category_id = intval($this->request->post('category_id'));
$order_field = $this->request->post('order_field');
$order_sort = $this->request->post('order_sort', 'desc');
$where = []; $where = [];
if ($server_name) { if ($server_name) {
$where[] = ['server.server_name', 'like', "%$server_name%"]; $where[] = ['server.server_name', 'like', "%$server_name%"];
@ -56,7 +58,7 @@ class Server extends Controller
} }
$where[] = ['server.status', '=', 1]; $where[] = ['server.status', '=', 1];
$model = new \app\api\model\Server(); $model = new \app\api\model\Server();
$list = $model->getList($where); $list = $model->getList($where, $order_field, $order_sort);
$data['list'] = $list->items(); $data['list'] = $list->items();
$data['total'] = $list->total(); $data['total'] = $list->total();
if (!$list->isEmpty()) { if (!$list->isEmpty()) {
@ -147,12 +149,20 @@ class Server extends Controller
{ {
$serverId = intval($this->request->post('server_id')); $serverId = intval($this->request->post('server_id'));
$couponId = intval($this->request->post('coupon_id')); $couponId = intval($this->request->post('coupon_id'));
$server_time = $this->request->post('server_time');
if (!$server_time) {
return $this->renderError('服务时间不能为空');
}
$server_address = $this->request->post('server_address');
if (!$server_address) {
return $this->renderError('服务地址不能为空');
}
$remake = (string)$this->request->post('remake'); $remake = (string)$this->request->post('remake');
if (!$serverId) { if (!$serverId) {
return $this->renderError('非法请求'); return $this->renderError('非法请求');
} }
$orderService = new ServerServiceOrder(); $orderService = new ServerServiceOrder();
$result = $orderService->createOrder($serverId, $couponId, $remake); $result = $orderService->createOrder($serverId, $couponId, $server_address, $server_time, $remake);
if ($result) { if ($result) {
return $this->renderSuccess($result); return $this->renderSuccess($result);
} }

@ -0,0 +1,53 @@
<?php
declare (strict_types=1);
namespace app\api\model\Server;
use app\api\model\UploadFile;
use app\common\model\server\RecoveryCategory as BaseRecoveryCategory;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\model\relation\HasOne;
class RecoveryCategory extends BaseRecoveryCategory
{
/**
* 隐藏字段
* @var array
*/
protected $hidden = [
'store_id',
'create_time',
'update_time',
'status',
'image_id',
];
/**
* 分类图片
* @return HasOne
*/
public function image(): HasOne
{
return $this->hasOne(UploadFile::class, 'file_id', 'image_id')
->bind(['image_url' => 'preview_url']);
}
/**
* @notes:获取全部记录
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author: wanghousheng
*/
public function list(): array
{
return $this->with(['image'])
->where(['status' => 1])
->order(['sort', 'create_time'])
->select()
->toArray();
}
}

@ -0,0 +1,21 @@
<?php
namespace app\api\model\Server;
use app\common\model\server\ServerRecovery as BaseServerRecovery;
class ServerRecovery extends BaseServerRecovery
{
/**
* 隐藏字段
* @var array
*/
protected $hidden = [
'store_id',
'create_time',
'update_time',
'status',
'image_id',
'delete_time',
];
}

@ -356,7 +356,7 @@ class PaySuccess extends BaseService
$orderInfo = $this->orderInfo; $orderInfo = $this->orderInfo;
$userInfo = $this->userInfo; $userInfo = $this->userInfo;
//判断当前用户角色 //判断当前用户角色
$orderType = $orderInfo['type']; $orderType = $orderInfo['order_type'];
$userType = $userInfo['user_type']; $userType = $userInfo['user_type'];
if ($userType == UserTypeEnum::STORE) { if ($userType == UserTypeEnum::STORE) {
return; return;
@ -364,15 +364,25 @@ class PaySuccess extends BaseService
$userModel = new UserModel(); $userModel = new UserModel();
$up = []; $up = [];
$time = date('Y-m-d'); $time = date('Y-m-d');
if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) {
$time = $userInfo['effective_time'];
}
//已经是会员或者未开通会员 //已经是会员或者未开通会员
if ($orderType == IdentityEnum::MEMBER && $userType != UserTypeEnum::DEALER) { if ($orderType == IdentityEnum::MEMBER && $userType != UserTypeEnum::DEALER) {
$up['user_type'] = UserTypeEnum::MEMBER; $up['user_type'] = UserTypeEnum::MEMBER;
//已经是会员
if ($userType == UserTypeEnum::MEMBER) {
//是否到期
if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) {
$time = $userInfo['effective_time'];
}
}
} else { } else {
//分销商
$up['user_type'] = UserTypeEnum::DEALER; $up['user_type'] = UserTypeEnum::DEALER;
//已经是分销商
if ($userType == UserTypeEnum::DEALER) {
//是否到期
if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) {
$time = $userInfo['effective_time'];
}
}
if (!User::isDealerUser($userInfo['user_id'])) { if (!User::isDealerUser($userInfo['user_id'])) {
// 新增分销商用户 // 新增分销商用户
User::add($userInfo['user_id'], [ User::add($userInfo['user_id'], [
@ -383,5 +393,6 @@ class PaySuccess extends BaseService
} }
$up['effective_time'] = date("Y-m-d", strtotime("+{$orderInfo['month']} months", strtotime($time))); $up['effective_time'] = date("Y-m-d", strtotime("+{$orderInfo['month']} months", strtotime($time)));
$userModel->where(['user_id' => $userInfo['user_id']])->save($up); $userModel->where(['user_id' => $userInfo['user_id']])->save($up);
} }
} }

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

@ -163,13 +163,15 @@ class Order extends BaseService
* @notes:生成订单 * @notes:生成订单
* @param int $serverId * @param int $serverId
* @param int $couponId * @param int $couponId
* @param string $server_address
* @param string $server_time
* @param string $buyer_remark * @param string $buyer_remark
* @return array * @return array
* @throws BaseException * @throws BaseException
* @throws DbException * @throws DbException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function createOrder(int $serverId, int $couponId, string $buyer_remark = ''): array public function createOrder(int $serverId, int $couponId, string $server_address, string $server_time, string $buyer_remark = ''): array
{ {
$userId = UserService::getCurrentLoginUserId(); $userId = UserService::getCurrentLoginUserId();
$data = $this->onCheck($serverId, $couponId); $data = $this->onCheck($serverId, $couponId);
@ -190,6 +192,8 @@ class Order extends BaseService
'buyer_remark' => $buyer_remark, 'buyer_remark' => $buyer_remark,
'create_time' => time(), 'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
'server_time' => $server_time,
'server_address' => $server_address,
]; ];
$model = new ServerOrder(); $model = new ServerOrder();
$order_id = $model->insertGetId($order_data); $order_id = $model->insertGetId($order_data);

@ -94,13 +94,13 @@ class Recovery extends Controller
$status = intval($this->request->post('status')); $status = intval($this->request->post('status'));
$where = []; $where = [];
if ($recovery_name) { if ($recovery_name) {
$where[] = ['recovery.server_name', 'like', "%$recovery_name%"]; $where[] = ['server_recovery.server_name', 'like', "%$recovery_name%"];
} }
if ($category_id) { if ($category_id) {
$where[] = ['recovery.category_id', '=', $category_id]; $where[] = ['server_recovery.category_id', '=', $category_id];
} }
if ($status) { if ($status) {
$where[] = ['recovery.status', '=', $status]; $where[] = ['server_recovery.status', '=', $status];
} }
try { try {
$list = $model->getList($where); $list = $model->getList($where);

@ -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