From 2c06abadf494f10716e58d2f5421f68ed2de24d3 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Mon, 11 Mar 2024 10:32:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BA=A2=E5=8C=85?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/StoreActivityUserDao.php | 29 +++++++++++++++++++ app/controller/api/store/StoreActivity.php | 20 ++++++++++++- route/api.php | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/app/common/dao/store/StoreActivityUserDao.php b/app/common/dao/store/StoreActivityUserDao.php index 1006aa55..56ee6dff 100755 --- a/app/common/dao/store/StoreActivityUserDao.php +++ b/app/common/dao/store/StoreActivityUserDao.php @@ -5,6 +5,7 @@ namespace app\common\dao\store; use app\common\dao\BaseDao; use app\common\dao\store\consumption\StoreConsumptionUserDao; use app\common\model\store\consumption\StoreConsumption; +use app\common\model\store\consumption\StoreConsumptionDetail; use app\common\model\store\consumption\StoreConsumptionUser; use app\common\model\store\StoreActivityOrder; use app\common\model\store\StoreActivityUser; @@ -249,6 +250,34 @@ class StoreActivityUserDao extends BaseDao return ['total_amount' => $totalAmount, 'count' => $count, 'record' => $record]; } + /** + * 红包获取记录 + * @param int $userId + * @param int $type + * @param int $page + * @param int $limit + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function useRecord(int $userId, int $type, int $page, int $limit) + { + $totalAmount = StoreConsumptionUser::where('uid', $userId) + ->whereIn('type', $type) + ->where('status', StoreConsumptionUser::STATUS_UNUSED) + ->sum('balance'); + $query = StoreConsumptionDetail::field('create_time,order_id,amount coupon_price,pay_price') + ->where('user_id', $userId) + ->where('type', 1); + $count = $query->count(); + $record = $query->page($page)->limit($limit)->select()->toArray(); + foreach ($record as &$item) { + $item['order_amount'] = bcadd($item['coupon_price'], $item['pay_price'], 2); + } + return ['total_amount' => $totalAmount, 'count' => $count, 'record' => $record]; + } + /** * 红包余额统计 * @param int $userId diff --git a/app/controller/api/store/StoreActivity.php b/app/controller/api/store/StoreActivity.php index ecb77a82..4aa74048 100755 --- a/app/controller/api/store/StoreActivity.php +++ b/app/controller/api/store/StoreActivity.php @@ -133,4 +133,22 @@ class StoreActivity extends BaseController return app('json')->success($result); } -} \ No newline at end of file + /** + * 红包获取记录 + * @param StoreActivityUserDao $dao + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function useRecord(StoreActivityUserDao $dao) + { + $userId = $this->request->uid(); + $type = $this->request->get('type', 1); + $page = $this->request->get('page', 1); + $limit = $this->request->get('limit', 10); + $result = $dao->useRecord($userId, $type, $page, $limit); + return app('json')->success($result); + } + +} diff --git a/route/api.php b/route/api.php index e5ed425a..ad1f009c 100755 --- a/route/api.php +++ b/route/api.php @@ -476,6 +476,7 @@ Route::group('api/', function () { Route::get('total', 'api.store.StoreActivity/total'); //活动红包统计 Route::get('product', 'api.store.StoreActivity/product'); //活动商品专区 Route::get('district', 'api.store.StoreActivity/district'); //活动地区列表 + Route::get('useRecord', 'api.store.StoreActivity/useRecord'); //活动红包获取记录 }); })->middleware(UserTokenMiddleware::class, true); From db8e9eb6b3ddaa67c53ca37b7e57e20f511a6216 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Mon, 11 Mar 2024 10:45:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index a6494276..20217f76 100755 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -395,9 +395,6 @@ class Auth extends BaseController $data['mer_info']['type_code'] = $merType['type_code']; $data['mer_info']['type_name'] = $merType['type_name']; $data['mer_info']['setting_status'] = 0; - if (($mer_arr['update_time'] ?? '') > ($mer_arr['create_time'] ?? '')) { - $data['mer_info']['setting_status'] = 1; - } } $data['fan_num'] = app()->make(RelevanceRepository::class)->getUserFans($user->uid, 1, 1, 1); $data['focus_num'] = app()->make(RelevanceRepository::class)->getUserFocus($user->uid, 1, 1, 1); From 9b066cdfb3dd9a59ac8a1107273877cf3258b8ff Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Mon, 11 Mar 2024 10:55:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E8=AE=A2=E5=8D=95=E5=AE=9E=E4=BB=98=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/server/StoreOrder.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controller/api/server/StoreOrder.php b/app/controller/api/server/StoreOrder.php index 7feaef9f..212dedd6 100755 --- a/app/controller/api/server/StoreOrder.php +++ b/app/controller/api/server/StoreOrder.php @@ -80,7 +80,11 @@ class StoreOrder extends BaseController $where['order_search'] = $this->request->param('search_info'); $where['mer_id'] = $merId; $where['is_del'] = 0; - return app('json')->success($repository->merchantGetList($where, $page, $limit)); + $result = $repository->merchantGetList($where, $page, $limit); + foreach ($result['list'] as &$item) { + $item['pay_price'] = $item['consumption_money'] > 0 ? bcadd($item['pay_price'], $item['consumption_money'], 2) : $item['pay_price']; + } + return app('json')->success($result); } public function order($merId, $id, StoreOrderRepository $repository) From f7f1d7c3887d64f3b2c1ed43c3ce7ffed70ac513 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 11 Mar 2024 10:56:35 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0excel?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/services/ExcelService.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crmeb/services/ExcelService.php b/crmeb/services/ExcelService.php index 5a153e7d..18e6f7fc 100755 --- a/crmeb/services/ExcelService.php +++ b/crmeb/services/ExcelService.php @@ -122,7 +122,7 @@ class ExcelService */ public function order(array $where, int $page, int $limit) { - $paytype = [0 => '余额', 1 => '微信', 2 => '小程序', 3 => 'H5', 4 => '支付宝', 5 => '支付宝扫码', 6 => '微信扫码',]; + $paytype = [0 => '余额', 1 => '微信', 2 => '小程序', 3 => 'H5', 4 => '支付宝', 5 => '支付宝扫码', 6 => '微信扫码',8=>'信用购-先货后款',9=>'商户余额支付']; $make = app()->make(StoreOrderRepository::class); $status = $where['status']; $del = $where['mer_id'] > 0 ? 0 : null; @@ -140,12 +140,14 @@ class ExcelService $export = []; foreach ($list as $item) { $product = []; + foreach ($item['orderProduct'] as $value) { $product[] = [ - $value['cart_info']['product']['store_name'], + $value['cart_info']['product']['store_name']??'', $value['cart_info']['productAttr']['sku'] ?: '无', - $value['product_num'] . ' ' . $value['unit_name'], - $value['cart_info']['productAttr']['price'] + $value['product_num'] . ' ' . $value['unit_name']??'', + $value['cart_info']['productAttr']['price']??'' + ]; } $one = [ @@ -170,6 +172,8 @@ class ExcelService ]; $export[] = $one; } + + $header = ['商户名称', '订单编号', '订单类型', '推广人', '用户信息', '商品名称', '商品规格', '商品数量', '商品价格', '优惠', '实付邮费(元)', '实付金额(元)', '已退款金额(元)', '收货人', '收货人电话', '收货地址', '物流/电话', '下单时间', '支付方式', '支付状态', '商家备注']; $filename = '订单列表_' . date('YmdHis'); $title = ['订单列表', '导出时间:' . date('Y-m-d H:i:s', time())]; From fa03d63243c9c6cbe120106062bfd278b60e1bdf Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Mon, 11 Mar 2024 10:58:27 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E8=AE=A2=E5=8D=95=E5=AE=9E=E4=BB=98=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/server/StoreOrder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controller/api/server/StoreOrder.php b/app/controller/api/server/StoreOrder.php index 212dedd6..78ade9b0 100755 --- a/app/controller/api/server/StoreOrder.php +++ b/app/controller/api/server/StoreOrder.php @@ -94,6 +94,7 @@ class StoreOrder extends BaseController return app('json')->fail('订单不存在'); if ($detail['mer_id'] != $merId) return app('json')->fail('没有权限'); + $detail['pay_price'] = $detail['consumption_money'] > 0 ? bcadd($detail['pay_price'], $detail['consumption_money'], 2) : $detail['pay_price']; return app('json')->success($detail->toArray()); }