From 71259316c329b870e59653c7f613bcc48c9893e9 Mon Sep 17 00:00:00 2001 From: "home.fengxinyhyl" Date: Sun, 21 Apr 2024 21:35:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/StoreOrderCreateRepository.php | 2 +- .../user/UserAssetsLogRepository.php | 44 ++++++++++++------- .../user/UserAssetsRepository.php | 2 +- app/controller/admin/store/StoreProduct.php | 11 +++++ app/controller/admin/user/UserExtract.php | 18 ++++++++ public/mer.html | 2 +- public/system.html | 2 +- route/admin/accounts.php | 3 ++ view/admin/src/api/accounts.js | 9 +++- view/admin/src/views/user/list/index.vue | 2 +- .../src/views/product/addProduct/index.vue | 20 ++++----- 11 files changed, 83 insertions(+), 32 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 63df268..8940d33 100755 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -39,7 +39,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository { $uid = $user->uid; $assets = app(UserAssetsRepository::class)->assets($uid); - $userIntegral = $assets['integral_buy']; + $userIntegral = $assets['integral_buy'] + $assets['integral_withdraw']; $key = md5(json_encode(compact('cartId', 'takes', 'useCoupon', 'useIntegral', 'addressId'))) . $uid; //去掉过期的优惠券信息 diff --git a/app/common/repositories/user/UserAssetsLogRepository.php b/app/common/repositories/user/UserAssetsLogRepository.php index 4bc07ce..2d33516 100644 --- a/app/common/repositories/user/UserAssetsLogRepository.php +++ b/app/common/repositories/user/UserAssetsLogRepository.php @@ -40,16 +40,16 @@ class UserAssetsLogRepository extends BaseRepository const INTEGRAL_BUY_SHARE = 2; // '分享奖返佣--复购积分', const INTEGRAL_WITHDRAW_SERVE = 3; // '服务奖返佣--提现积分', const INTEGRAL_BUY_SERVE = 4; // '服务奖返佣--复购积分', - const INTEGRAL_WITHDRAW_SEND = 5; // '他人转让--提现积分', - const INTEGRAL_WITHDRAW_GET = 6; // '转让他人--提现积分', + const INTEGRAL_WITHDRAW_SEND = 5; // '转让他人--提现积分', + const INTEGRAL_WITHDRAW_GET = 6; // '他人转让--提现积分', const INTEGRAL_WITHDRAW_DIAMOND = 7; // '兑换钻石--提现积分', const INTEGRAL_WITHDRAW_HOT = 8; // '爆单奖--提现积分', const INTEGRAL_BUY_HOT = 9; // '爆单奖--复购积分', - const INTEGRAL_BUY = 10; // '消费--复购积分', + const INTEGRAL_BUY = 10; // '消费--积分', const INTEGRAL_WITHDRAW = 11; // '提现--提现积分', - const DIAMOND_SEND = 20; //他人转让 - const DIAMOND_GET = 21; //转让他人 + const DIAMOND_SEND = 20; //转让他人 + const DIAMOND_GET = 21; //他人转让 const DIAMOND_STOCK = 22; //兑换本票 const DIAMOND_INTEGRAL = 23; //积分兑换 const DIAMOND_SHARE = 24; //分享奖返佣 @@ -96,16 +96,16 @@ class UserAssetsLogRepository extends BaseRepository self::INTEGRAL_BUY_SHARE => '分享奖返佣--复购积分', self::INTEGRAL_WITHDRAW_SERVE => '服务奖返佣--提现积分', self::INTEGRAL_BUY_SERVE => '服务奖返佣--复购积分', - self::INTEGRAL_WITHDRAW_SEND => '他人转让--提现积分', - self::INTEGRAL_WITHDRAW_GET => '转让他人--提现积分', + self::INTEGRAL_WITHDRAW_SEND => '转让他人--提现积分', + self::INTEGRAL_WITHDRAW_GET => '他人转让--提现积分', self::INTEGRAL_WITHDRAW_DIAMOND => '兑换钻石--提现积分', self::INTEGRAL_WITHDRAW_HOT => '爆单奖--提现积分', self::INTEGRAL_BUY_HOT => '爆单奖--复购积分', - self::INTEGRAL_BUY => '消费--复购积分', + self::INTEGRAL_BUY => '消费--积分', self::INTEGRAL_WITHDRAW => '提现--提现积分', - self::DIAMOND_SEND => '他人转让', - self::DIAMOND_GET => '转让他人', + self::DIAMOND_SEND => '转让他人', + self::DIAMOND_GET => '他人转让', self::DIAMOND_STOCK => '兑换本票', self::DIAMOND_INTEGRAL => '积分兑换', self::DIAMOND_SHARE => '分享奖返佣', @@ -143,26 +143,38 @@ class UserAssetsLogRepository extends BaseRepository if ($item) { $item->status = self::STATUS_REFUND; $item->save(); + $this->userAssetsRepository->updateAssets($orderItem['uid'], $item['ext']); } - $this->userAssetsRepository->updateAssets($orderItem['uid'], array('integral_buy' => -1 * $item['count'])); } public function userPayEvent($groupOrder) { + $assets = $this->userAssetsRepository->assets($groupOrder['uid']); foreach ($groupOrder['orderList'] as $orderItem) { // 5. 本人使用的福利积分 if ($orderItem['integral']) { + $updateData = array('integral_buy' => 0, 'integral_withdraw' => 0); + if ($orderItem['integral'] > $assets['integral_buy']) { + $updateData['integral_buy'] = $assets['integral_buy']; + $updateData['integral_withdraw'] = $orderItem['integral'] - $assets['integral_buy']; + } else { + $updateData['integral_buy'] = $orderItem['integral']; + } $log = array('uid' => $orderItem['uid'], 'asset_type' => self::ASSET_INTEGRAL, 'type' => self::INTEGRAL_BUY, 'status' => self::STATUS_BUY, 'order_id' => $orderItem['order_id'], 'count' => -$orderItem['integral'], + 'ext' => $updateData, ); $this->addLog([$log]); - $this->userAssetsRepository->updateAssets($orderItem['uid'], array('integral_buy' => -$orderItem['integral'])); + foreach ($updateData as $key => $value){ + $assets[$key] -= $value; + } + $this->userAssetsRepository->updateAssets($orderItem['uid'], $updateData, false); } } } @@ -374,16 +386,16 @@ class UserAssetsLogRepository extends BaseRepository } // 计算每个购买当前爆单商品的积分数据 - $profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num']; - $where = array(); + $profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num']; + $where = array(); // $where[] = array('product_id', '=', $productItem['product_id']); - $list = $hotRepository->getList($where); + $list = $hotRepository->getList($where); $logList = array(); foreach ($list as $item) { $tmp = $this->_getIntegral($profit * $product['hot_integral_rate'] / 100 / count($list)); if ($item['total'] - $item['current'] < $tmp['integral_buy'] + $tmp['integral_withdraw']) { - $tmp = $this->_getIntegral($item['total'] - $item['current']); + $tmp = $this->_getIntegral($item['total'] - $item['current']); // $item['status'] = 1; } $this->userAssetsRepository->updateAssets($item['uid'], $tmp); diff --git a/app/common/repositories/user/UserAssetsRepository.php b/app/common/repositories/user/UserAssetsRepository.php index 57b16b0..1841dc4 100644 --- a/app/common/repositories/user/UserAssetsRepository.php +++ b/app/common/repositories/user/UserAssetsRepository.php @@ -222,7 +222,7 @@ class UserAssetsRepository extends BaseRepository $logList[] = array( 'uid' => $uid, 'asset_type' => UserAssetsLogRepository::ASSET_DIAMOND, - 'type' => UserAssetsLogRepository::DIAMOND_DEPOSIT, + 'type' => UserAssetsLogRepository::DIAMOND_STOCK, 'status' => UserAssetsLogRepository::STATUS_USE, 'count' => $diamond, ); diff --git a/app/controller/admin/store/StoreProduct.php b/app/controller/admin/store/StoreProduct.php index de055a3..847a9e8 100755 --- a/app/controller/admin/store/StoreProduct.php +++ b/app/controller/admin/store/StoreProduct.php @@ -12,6 +12,7 @@ namespace app\controller\admin\store; +use app\common\repositories\store\product\ProductAttrValueRepository; use app\common\repositories\store\product\SpuRepository; use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\system\operate\OperateLogRepository; @@ -24,6 +25,7 @@ use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; use think\facade\Queue; +use think\facade\Request; class StoreProduct extends BaseController { @@ -164,6 +166,15 @@ class StoreProduct extends BaseController { $data = $this->checkParams($validate); $this->repository->adminUpdate($id, $data); + + $productAttrRepository = \app(ProductAttrValueRepository::class); + $attrValue = Request::post('attrValue'); + if($attrValue){ + foreach ($attrValue as $item){ + $productAttrRepository->update($item['value_id'], array('price' => $item['price'],'cost' => $item['cost'])); + } + } + return app('json')->success('编辑成功'); } diff --git a/app/controller/admin/user/UserExtract.php b/app/controller/admin/user/UserExtract.php index 1d1c823..9eb56cc 100755 --- a/app/controller/admin/user/UserExtract.php +++ b/app/controller/admin/user/UserExtract.php @@ -76,6 +76,24 @@ class UserExtract extends BaseController return app('json')->success('审核成功'); } + /** + * TODO + * @param $id + * @return mixed + * @author Qinii + * @day 2020-06-16 + */ + public function updateImage($id) + { + $data = $this->request->params(['image']); + + if (!$this->repository->getWhereCount($id)) + return app('json')->fail('数据不存在或状态错误'); + halt($data); + $this->repository->update($id, $data); + return app('json')->success('审核成功'); + } + public function export() { $where = $this->request->params(['status', 'keyword', 'date', 'extract_type']); diff --git a/public/mer.html b/public/mer.html index 197cfb5..9cdcbb4 100755 --- a/public/mer.html +++ b/public/mer.html @@ -1 +1 @@ -加载中...
\ No newline at end of file +加载中...
\ No newline at end of file diff --git a/public/system.html b/public/system.html index f56815a..7adbaf6 100755 --- a/public/system.html +++ b/public/system.html @@ -1,3 +1,3 @@ -加载中...
\ No newline at end of file diff --git a/route/admin/accounts.php b/route/admin/accounts.php index cab4238..8a9422c 100755 --- a/route/admin/accounts.php +++ b/route/admin/accounts.php @@ -87,6 +87,9 @@ Route::group(function () { Route::post('status/:id', 'UserExtract/switchStatus')->name('systemUserExtractSwitchStatus')->option([ '_alias' => '审核', ]); + Route::post('image/:id', 'UserExtract/switchStatus')->name('systemUserExtractSwitchStatus')->option([ + '_alias' => '上传凭证', + ]); Route::get('export', 'UserExtract/export')->name('systemUserExtractExport')->option([ '_alias' => '导出', ]); diff --git a/view/admin/src/api/accounts.js b/view/admin/src/api/accounts.js index f1211b6..f28959f 100644 --- a/view/admin/src/api/accounts.js +++ b/view/admin/src/api/accounts.js @@ -23,6 +23,13 @@ export function extractStatusApi(id, data) { return request.post(`user/extract/status/${id}`, data) } +/** + * @description 提现 -- 审核 + */ +export function extractImageApi(id, data) { + return request.post(`user/extract/image/${id}`, data) +} + /** * @description 充值记录 -- 列表 */ @@ -271,4 +278,4 @@ export function singleMerBillExport(type,data) { */ export function singleMerBillHeader(id,data) { return request.get(`financial_record/mer_title/${id}`, data) -} \ No newline at end of file +} diff --git a/view/admin/src/views/user/list/index.vue b/view/admin/src/views/user/list/index.vue index c231940..d97eb7f 100644 --- a/view/admin/src/views/user/list/index.vue +++ b/view/admin/src/views/user/list/index.vue @@ -25,7 +25,7 @@ - + diff --git a/view/mer/src/views/product/addProduct/index.vue b/view/mer/src/views/product/addProduct/index.vue index 3def0cd..75c368f 100644 --- a/view/mer/src/views/product/addProduct/index.vue +++ b/view/mer/src/views/product/addProduct/index.vue @@ -45,14 +45,14 @@ - - - - 普通商品 - 爆单商品 - - - + + + + + + + +