Compare commits

...

9 Commits
master ... dev

Author SHA1 Message Date
liu
a8ffc7adfa 修改查询 2024-03-18 10:25:10 +08:00
liu
47a17f8f37 修改下载逻辑是ios去除wgt的包 2024-03-18 10:12:24 +08:00
weipengfei
3da5ebcabf 更新h5, 恢复授权 2024-03-18 09:47:49 +08:00
5944ab0832 调整补贴进度 2024-03-16 16:31:16 +08:00
611fe543d9 调整补贴发放 2024-03-16 16:30:00 +08:00
7e30f10919 调整补贴发放 2024-03-16 16:27:30 +08:00
6c651cd8a2 调整补贴发放 2024-03-16 16:24:39 +08:00
29060c709a 调整补贴发放 2024-03-16 15:31:05 +08:00
e95efacd95 修改保证金展示的错误 2024-03-16 14:22:59 +08:00
22 changed files with 104 additions and 39 deletions

19
app/common/Enum.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace app\common;
class Enum
{
/** 消费金状态 */
const CONSUMPTION_STATUS_REPEAL = -1; //未激活
const CONSUMPTION_STATUS_AUDIT = 0; //审核中
const CONSUMPTION_STATUS_CONFIRM = 1; //待确认
const CONSUMPTION_STATUS_FINISHED = 2; //已完成
const CONSUMPTION_STATUS_MAP = [
self::CONSUMPTION_STATUS_REPEAL => '未激活',
self::CONSUMPTION_STATUS_AUDIT => '审核中',
self::CONSUMPTION_STATUS_CONFIRM => '待确认',
self::CONSUMPTION_STATUS_FINISHED => '已到账',
];
}

View File

@ -281,34 +281,36 @@ class StoreActivityUserDao extends BaseDao
/**
* 红包余额统计
* @param int $userId
* @return array
* @return array|array[]
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function total(int $userId)
{
$totalAmount = StoreConsumptionUser::where('uid', $userId)
->whereIn('type', [StoreConsumptionUser::TYPE_ONE, StoreConsumptionUser::TYPE_TWO])
->where('status', StoreConsumptionUser::STATUS_UNUSED)
->field('SUM(balance) as total_amount,type')
->group('type')
->whereIn('status', [StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::STATUS_REPEAL])
->field('balance,type')
->select()->toArray();
$totalAmount = reset_index($totalAmount, 'type');
$result = [
[
'1' => [
'type' => 1,
'total_amount' => 0.00
'total_amount' => 0.00,
'type_cn' => StoreConsumptionUser::TYPE_MAP[1],
],
[
'2' => [
'type' => 2,
'total_amount' => 0.00
'total_amount' => 0.00,
'type_cn' => StoreConsumptionUser::TYPE_MAP[2],
]
];
foreach ($result as &$item) {
if (isset($totalAmount[$item['type']])) {
$item['total_amount'] = $totalAmount[$item['type']]['total_amount'];
foreach ($totalAmount as $item) {
if (isset($result[$item['type']])) {
$result[$item['type']]['total_amount']= bcadd($result[$item['type']]['total_amount'], $item['balance'], 2);
}
$item['type_cn'] = StoreConsumptionUser::TYPE_MAP[$item['type']];
}
return $result;
return array_values($result);
}
}

View File

@ -52,6 +52,7 @@ class StoreConsumptionUserDao extends BaseDao
public $startTime;
public $endTime;
public $billExtra;
public $onlyBill = false; // 是否只写入用户账单
protected function getModel(): string
{
@ -241,10 +242,12 @@ class StoreConsumptionUserDao extends BaseDao
$model = StoreConsumptionUser::where('uid', $userId)->where('type', StoreConsumptionUser::TYPE_TWO)->find();
$couponPrice = bcmul($amount, $rate, 2);
if (!empty($model) && $model['type'] == $type) {
$model->coupon_price = bcadd($model->coupon_price, $couponPrice, 2);
$model->balance = bcadd($model->balance, $couponPrice, 2);
if ($model->status != StoreConsumptionUser::STATUS_UNUSED) {
$model->status = StoreConsumptionUser::STATUS_UNUSED;
if (!$this->onlyBill) {
$model->coupon_price = bcadd($model->coupon_price, $couponPrice, 2);
$model->balance = bcadd($model->balance, $couponPrice, 2);
if ($model->status != StoreConsumptionUser::STATUS_UNUSED) {
$model->status = StoreConsumptionUser::STATUS_UNUSED;
}
}
} else {
$model = new StoreConsumptionUser();
@ -260,6 +263,9 @@ class StoreConsumptionUserDao extends BaseDao
$model->end_time = $this->endTime ?: '2026-01-15 23:59:59';
$model->type = $type;
$model->status = $status;
if ($this->onlyBill === true) {
$model->status = StoreConsumptionUser::STATUS_REPEAL;
}
}
if (!$model->save()) {
throw new \Exception('发放失败');

View File

@ -844,10 +844,11 @@ class StoreOrderRepository extends BaseRepository
$money = bcsub($money, $refundPrice, 2);
//订单确认收货,增加商户销售金额
Merchant::where('mer_id', $order->mer_id)->update(['sale_amount' => Db::raw('sale_amount+' . $money)]);
$field = $order->merchant['type_id'] == 22 ? 'official_purchase_amount' : 'purchase_amount';
//订单确认收货,增加商户采购金额
$merId = Merchant::where('uid', $order->uid)->value('mer_id');
if (!empty($merId)) {
Merchant::where('mer_id', $merId)->update(['purchase_amount' => Db::raw('purchase_amount+' . $money)]);
Merchant::where('mer_id', $merId)->update([$field => Db::raw("{$field}+" . $money)]);
}
}
});

View File

@ -1589,10 +1589,17 @@ class Auth extends BaseController
$agent = strtolower($this->request->server('HTTP_USER_AGENT'));
// 检查是否为iOS设备包括iPhone和iPad
if (strpos($agent, 'iphone') !== false || strpos($agent, 'ipad') !== false) {
$appInfo=[];
$appInfo = Db::name('AppUpdate')->where('type', $type)->order('id','desc')->find();
} elseif (strpos($agent, 'android') !== false) {
// 检查是否为Android设备
$appInfo = Db::name('AppUpdate')->where('type', $type)->order('id','desc')->find();
if($agent == 'ios'){
$pattern = '/\.wgt$/i';
if (preg_match($pattern, basename($appInfo['dow_url']))) {
$appInfo =[];
}
}
} else {
$appInfo=[];
// 如果都不是,则输出其他

View File

@ -2,6 +2,7 @@
namespace app\controller\api\server;
use app\common\Enum;
use app\common\model\store\consumption\StoreConsumption;
use app\common\model\store\consumption\StoreConsumptionUser;
use app\common\model\system\merchant\FinancialRecord;
@ -78,15 +79,16 @@ class Store extends BaseController
{
$type = $this->request->get('type', 1);
$uid = $this->request->uid();
$merchant = Merchant::where('mer_id', $this->merId)->field('sale_amount,purchase_amount,type_id')->find()->toArray();
$merchant = Merchant::where('mer_id', $this->merId)->field('sale_amount,purchase_amount,official_purchase_amount,type_id')->find()->toArray();
$saleTarget = '0.00';
$purchaseTarget = '0.00';
$officialPurchaseTarget = '0.00';
$userConsumptionStatus = false;
if ($type == 1) {
//春耕采购补贴
$couponId = StoreConsumption::where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)->value('coupon_id');
$userConsumption = StoreConsumptionUser::where('uid', $uid)
->where('coupon_id', $couponId)
->where('status', '<>', -1)
->field('coupon_price,balance')
->find();
if (!empty($userConsumption)) {
@ -95,9 +97,10 @@ class Store extends BaseController
->where('coupon_id', $couponId)
->value('coupon_price');
$saleTarget = $userConsumption['coupon_price'];
$purchaseTarget = $userConsumption['coupon_price'];
$merchant['purchase_amount'] = bcsub($userConsumption['coupon_price'], $userConsumption['balance'], 2);
$purchaseTarget = bcmul($userConsumption['coupon_price'], 0.4, 2);
$officialPurchaseTarget = bcsub($saleTarget, $purchaseTarget, 2);
$merchant['balance'] = $userConsumption['balance'];
$userConsumptionStatus = in_array($userConsumption['status'], [0, 1, 2]);
}
} else {
//增收销售补贴
@ -105,23 +108,26 @@ class Store extends BaseController
if ($consumption) {
$userConsumption = StoreConsumptionUser::where('uid', $uid)
->where('coupon_id', $consumption['coupon_id'])
->where('status', '<>', -1)
->field('coupon_price,balance,status')
->order('coupon_user_id', 'desc')
->find();
$userConsumptionStatus = in_array($userConsumption['status'] ?? -1, [0, 1, 2]);
$subsidyAmount = $userConsumption['coupon_price'] ?? '0.00';
$merchant['balance'] = $userConsumption['balance'] ?? '0.00';
foreach ($consumption['config'] as $k => $item) {
if (empty($userConsumption) && in_array($merchant['type_id'], $item['type_id'])) {
$saleTarget = $item['amount'];
$subsidyAmount = $item['subsidy'];
$purchaseTarget = bcmul($saleTarget, 0.5, 2);
$purchaseTarget = bcmul($saleTarget, 0.2, 2);
$officialPurchaseTarget = bcmul($saleTarget, 0.3, 2);
break;
}
if (!empty($userConsumption) && in_array($merchant['type_id'], $item['type_id'])) {
$nextItem = $consumption['config'][$k + 1] ?? $item;
$saleTarget = $nextItem['amount'];
$subsidyAmount = $nextItem['subsidy'];
$purchaseTarget = bcmul($saleTarget, 0.5, 2);
$purchaseTarget = bcmul($saleTarget, 0.2, 2);
$officialPurchaseTarget = bcmul($saleTarget, 0.3, 2);
break;
}
}
@ -131,17 +137,27 @@ class Store extends BaseController
$saleFinishRate = bcmul(min($saleFinishRate, 1), 100, 0);
$purchaseFinishRate = $purchaseTarget <= 0 ? 0 : bcdiv($merchant['purchase_amount'], $purchaseTarget, 2);
$purchaseFinishRate = bcmul(min($purchaseFinishRate, 1), 100, 0);
$springSubsidyRate = $purchaseTarget <= 0 ? 0 : bcdiv($merchant['purchase_amount'], $purchaseTarget, 2);
$officialPurchaseFinishRate = $officialPurchaseTarget <= 0 ? 0 : bcdiv($merchant['official_purchase_amount'], $officialPurchaseTarget, 2);
$officialPurchaseFinishRate = bcmul(min($officialPurchaseFinishRate, 1), 100, 0);
$springSubsidyRate = $saleTarget <= 0 ? 0 : bcdiv(bcadd($merchant['purchase_amount'], $merchant['official_purchase_amount'], 2), $saleTarget, 2);
$springSubsidyRate = bcmul(min($springSubsidyRate, 1), 100, 0);
if ($type == 1) {
$status = $saleFinishRate >= 100 && $purchaseFinishRate >= 100 && $merchant['balance'] == 0;
} else {
$status = $saleFinishRate >= 100 && $purchaseFinishRate >= 100;
}
return app('json')->success([
'subsidy_amount' => empty($subsidyAmount) ? '0.00' : $subsidyAmount,
'subsidy_status' => $saleFinishRate >= 100 && $purchaseFinishRate >= 100,
'subsidy_status' => $status && $userConsumptionStatus,
'sale_target' => $saleTarget,
'sale_amount' => $merchant['sale_amount'],
'sale_finish_rate' => $saleFinishRate,
'purchase_target' => $purchaseTarget,
'purchase_amount' => $merchant['purchase_amount'],
'purchase_finish_rate' => $purchaseFinishRate,
'official_purchase_target' => $officialPurchaseTarget,
'official_purchase_amount' => $merchant['official_purchase_amount'],
'official_purchase_finish_rate' => $officialPurchaseFinishRate,
'spring_subsidy' => $saleTarget,
'spring_subsidy_amount' => $merchant['purchase_amount'],
'spring_subsidy_rate' => $springSubsidyRate,
@ -170,7 +186,7 @@ class Store extends BaseController
$couponId = StoreConsumption::where('type', $couponType)->value('coupon_id');
$totalAmount = StoreConsumptionUser::where('uid', $userId)
->whereIn('coupon_id', $couponId)
->where('status', StoreConsumptionUser::STATUS_UNUSED)
->whereIn('status', [StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::STATUS_REPEAL])
->sum('balance');
$query = UserBill::field('link_id,create_time,number coupon_price,mark,extra,status')
->where('uid', $userId)
@ -178,13 +194,19 @@ class Store extends BaseController
->where('status', 1)
->whereRaw("extra->'$.coupon_id'=" . $couponId);
$count = $query->count();
$record = $query->page($page)->limit($limit)->select()->toArray();
$record = $query->page($page)->limit($limit)->order('bill_id', 'desc')->select()->toArray();
foreach ($record as &$item) {
$item['order_amount'] = 0;
if (mb_strpos($item['mark'], '订单金额:') !== false) {
$item['order_amount'] = mb_substr($item['mark'], mb_strpos($item['mark'], '订单金额:') + 5);
}
$item['extra'] = json_decode($item['extra'], true);
if (isset($item['extra']['status'])) {
$item['extra']['status_cn'] = Enum::CONSUMPTION_STATUS_MAP[$item['extra']['status']];
} else {
$item['extra']['status'] = Enum::CONSUMPTION_STATUS_REPEAL;
$item['extra']['status_cn'] = Enum::CONSUMPTION_STATUS_MAP[$item['extra']['status']];
}
unset($item['mark']);
}
$result = ['total_amount' => $totalAmount, 'count' => $count, 'record' => $record];

View File

@ -301,6 +301,7 @@ class Merchant extends BaseController
if (empty($merchantInfo)) {
return app('json')->fail('参数错误');
}
$merchantInfo['paid_margin'] = $merchantInfo['paid_margin'] > $merchantInfo['margin'] ? $merchantInfo['margin'] : $merchantInfo['paid_margin'];
$merchantInfo['unpaid_margin'] = bcsub($merchantInfo['margin'], $merchantInfo['paid_margin'], 2);
if ($merchantInfo['margin'] <= 0) {
$merchantInfo['unpaid_margin'] = 0;

View File

@ -3,6 +3,7 @@
namespace crmeb\listens;
use app\common\dao\store\consumption\StoreConsumptionUserDao;
use app\common\Enum;
use app\common\model\store\consumption\StoreConsumption;
use app\common\model\store\consumption\StoreConsumptionUser;
use app\common\model\system\merchant\Merchant;
@ -23,10 +24,12 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
$count = 0;
if ($consumption) {
foreach ($consumption['config'] as $item) {
$purchaseAmount = $item['amount'] * 0.5;
$purchaseAmount = $item['amount'] * 0.2; //普通店铺采购金额
$officialPurchaseAmount = $item['amount'] * 0.3; //官方店铺采购金额
$merchants = Merchant::whereIn('type_id', $item['type_id'])
->where('sale_amount', '>=', $item['amount'])
->where('purchase_amount', '>=', $purchaseAmount)
->where('official_purchase_amount', '>=', $officialPurchaseAmount)
->select();
foreach ($merchants as $merchant) {
//商户已获得的补贴金额
@ -43,7 +46,10 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
'coupon_id' => $consumption['coupon_id'],
'sale_amount' => $item['amount'],
'purchase_amount' => $purchaseAmount,
'official_purchase_amount' => $officialPurchaseAmount,
'status' => Enum::CONSUMPTION_STATUS_REPEAL,
];
$consumptionRepo->onlyBill = true;
$consumptionRepo->send($consumption, 1, $merchant->uid, 0, $amount, StoreConsumptionUser::STATUS_UNUSED, StoreConsumptionUser::TYPE_TWO);
$count++;
}

View File

@ -2,4 +2,4 @@
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
if(window.location.protocol == 'https:'){
document.write('<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">')
}</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c6349b23.js></script><script src=/static/js/index.c4c24a88.js></script></body></html>
}</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c6349b23.js></script><script src=/static/js/index.e33f0039.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-newActivity-share-share"],{"29be":function(n,e,t){var r=t("24fb");e=r(!1),e.push([n.i,'@charset "UTF-8";\r\n/**\r\n * 这里是uni-app内置的常用样式变量\r\n *\r\n * uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量\r\n * 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App\r\n *\r\n */\r\n/**\r\n * 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能\r\n *\r\n * 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\r\n */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */',""]),n.exports=e},"3ea4":function(n,e,t){"use strict";var r=t("4a8a"),a=t.n(r);a.a},"4a8a":function(n,e,t){var r=t("29be");r.__esModule&&(r=r.default),"string"===typeof r&&(r=[[n.i,r,""]]),r.locals&&(n.exports=r.locals);var a=t("4f06").default;a("26d93d74",r,!0,{sourceMap:!1,shadowMode:!1})},"687b":function(n,e,t){"use strict";t.r(e);var r=t("727a"),a=t("6993");for(var i in a)["default"].indexOf(i)<0&&function(n){t.d(e,n,(function(){return a[n]}))}(i);t("3ea4");var c=t("f0c5"),s=Object(c["a"])(a["default"],r["b"],r["c"],!1,null,"dfe3f692",null,!1,r["a"],void 0);e["default"]=s.exports},6993:function(n,e,t){"use strict";t.r(e);var r=t("9011"),a=t.n(r);for(var i in r)["default"].indexOf(i)<0&&function(n){t.d(e,n,(function(){return r[n]}))}(i);e["default"]=a.a},"727a":function(n,e,t){"use strict";t.d(e,"b",(function(){return r})),t.d(e,"c",(function(){return a})),t.d(e,"a",(function(){}));var r=function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("v-uni-view",{staticClass:"page",on:{longpress:function(e){arguments[0]=e=n.$handleEvent(e),n.handleSavePic.apply(void 0,arguments)}}},[t("v-uni-image",{staticStyle:{width:"100%"},attrs:{mode:"widthFix",src:"https://lihai001.oss-cn-chengdu.aliyuncs.com/def/97359202403161619147876.webp"}})],1)},a=[]},9011:function(n,e,t){"use strict";t("7a82"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r={data:function(){return{}},methods:{handleSavePic:function(){var n="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/97359202403161619147876.webp",e=document.createElement("a");e.download=n,e.href=n,document.body.appendChild(e),e.click(),e.remove()}}};e.default=r}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long