commit
9250121560
@ -117,7 +117,7 @@ class StoreOrderController extends BaseAdminController
|
||||
*/
|
||||
public function refund()
|
||||
{
|
||||
$params = (new StoreOrderValidate())->goCheck('refund');
|
||||
$params = $this->request->post();
|
||||
$detail = StoreOrder::where('order_id', $params['order_id'])->findOrEmpty();
|
||||
if (empty($detail)) {
|
||||
return $this->fail('无该订单请检查');
|
||||
@ -164,12 +164,14 @@ class StoreOrderController extends BaseAdminController
|
||||
$find=StoreProduct::where('id',$value->product_id)->find();
|
||||
$value->store_name=$find['store_name']??'';
|
||||
$value->store_info=$find['store_info']??'';
|
||||
$value->total_price=bcmul($value['price'],$value['cart_num'],2);
|
||||
if(!empty($find['unit'])){
|
||||
$value->unit_name=StoreProductUnit::where('id',$find['unit'])->value('name');
|
||||
}else{
|
||||
$value->unit_name='';
|
||||
}
|
||||
}
|
||||
$order['total_price']=$order['pay_price'];
|
||||
$file_path = $xlsx->export($data,$system_store,$order);
|
||||
|
||||
return $this->success('导出成功', ['url' => $file_path]);
|
||||
|
@ -9,8 +9,11 @@ use app\api\logic\order\OrderLogic;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\logic\CommissionnLogic;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
|
||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\user\User;
|
||||
@ -43,17 +46,16 @@ class StoreOrderLogic extends BaseLogic
|
||||
$v['uid'] = $params['user_id'];
|
||||
$v['store_id'] = $params['store_id'];
|
||||
$v['cart_num'] = $v['stock'];
|
||||
StoreBranchProduct::where('id',$v['id'])->update(['price'=>$v['price'],'vip_price'=>$v['price'],'cost'=>$v['price'],'purchase'=>$v['price']]);
|
||||
StoreBranchProduct::where('id', $v['id'])->update(['price' => $v['price'], 'vip_price' => $v['price'], 'cost' => $v['price'], 'purchase' => $v['price']]);
|
||||
unset($v['id']);
|
||||
$res = CartLogic::add($v);
|
||||
$cartId[] = $res['id'];
|
||||
}
|
||||
$user = User::where('id', $params['user_id'])->find();
|
||||
$params['shipping_type']=2;
|
||||
$params['shipping_type'] = 2;
|
||||
$params['pay_type'] = 7;
|
||||
$order = OrderLogic::createOrder($cartId, null, $user, $params);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -112,35 +114,120 @@ class StoreOrderLogic extends BaseLogic
|
||||
|
||||
public static function refund($detail, $params)
|
||||
{
|
||||
//微信支付
|
||||
if (in_array($detail['pay_type'], [PayEnum::WECHAT_PAY_MINI, PayEnum::WECHAT_PAY_BARCODE])) {
|
||||
$money = (int)bcmul($detail['pay_price'], 100);
|
||||
$refund = (new \app\common\logic\store_order\StoreOrderLogic())
|
||||
->refund($params['order_id'], $money, $money);
|
||||
if ($refund) {
|
||||
StoreOrderCartInfo::where('oid',$detail['id'])->update(['is_pay'=>-1]);
|
||||
if (isset($params['product_arr']) && count($params['product_arr']) > 0) {
|
||||
$refund_price = $params['refund_price'];
|
||||
$refund_num = 0;
|
||||
foreach ($params['product_arr'] as $k => $v) {
|
||||
$find = StoreOrderCartInfo::where('oid', $detail['id'])->where('product_id', $v['product_id'])->find();
|
||||
if ($find) {
|
||||
$refund_num += $v['cart_num'];
|
||||
$cart_num = bcsub($find['cart_num'], $v['cart_num']);
|
||||
$total_price = bcmul($find['price'], $cart_num);
|
||||
$data = ['cart_num' => $cart_num, 'total_price' => $total_price];
|
||||
StoreOrderCartInfo::where('id', $find['id'])->update($data);
|
||||
$arr = StoreFinanceFlowProduct::where('oid', $detail['id'])->where('product_id', $v['product_id'])->select()->toArray();
|
||||
foreach ($arr as $key => $value) {
|
||||
$value['cart_num'] = $cart_num;
|
||||
$value['total_price'] = bcmul($cart_num, $value['price'], 2);
|
||||
$value['number'] = bcmul($value['total_price'], $value['rate'], 2);
|
||||
StoreFinanceFlowProduct::where('id', $value['id'])->update(['delete_time' => time()]);
|
||||
unset($value['id']);
|
||||
$value['create_time'] = strtotime($value['create_time']);
|
||||
$value['update_time'] = strtotime($value['update_time']);
|
||||
StoreFinanceFlowProduct::create($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
$village_uid = StoreFinanceFlow::where('order_id', $detail['id'])->where('financial_type', 14)->value('other_uid');
|
||||
$brigade_uid = StoreFinanceFlow::where('order_id', $detail['id'])->where('financial_type', 15)->value('other_uid');
|
||||
$transaction_id = StoreFinanceFlow::where('order_id', $detail['id'])->value('transaction_id');
|
||||
StoreFinanceFlow::where('order_id', $detail['id'])->update(['delete_time' => time()]);
|
||||
CommissionnLogic::setStore($detail, $village_uid, $brigade_uid, $transaction_id);
|
||||
|
||||
StoreOrder::where('id', $detail['oid'])->update(['refund_price' => $refund_price, 'refund_num' => $refund_num]);
|
||||
//微信支付
|
||||
if (in_array($detail['pay_type'], [PayEnum::WECHAT_PAY_MINI, PayEnum::WECHAT_PAY_BARCODE])) {
|
||||
$money = (int)bcmul($params['refund_price'], 100);
|
||||
$refund = (new \app\common\logic\store_order\StoreOrderLogic())
|
||||
->refund($params['order_id'], $money, $detail['pay_price']);
|
||||
if ($refund) {
|
||||
return '退款成功';
|
||||
}
|
||||
}
|
||||
//余额支付 采购款支付
|
||||
if (in_array($detail['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
PayNotifyLogic::balance_purchase_refund($detail,0,$params['refund_price']);
|
||||
return '退款成功';
|
||||
|
||||
}
|
||||
//现金支付
|
||||
if ($detail['pay_type'] = PayEnum::CASH_PAY) {
|
||||
PayNotifyLogic::cash_refund($params['order_id']);
|
||||
return '退款成功';
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
} else {
|
||||
//微信支付
|
||||
if (in_array($detail['pay_type'], [PayEnum::WECHAT_PAY_MINI, PayEnum::WECHAT_PAY_BARCODE])) {
|
||||
$money = (int)bcmul($detail['pay_price'], 100);
|
||||
$refund = (new \app\common\logic\store_order\StoreOrderLogic())
|
||||
->refund($params['order_id'], $money, $money);
|
||||
if ($refund) {
|
||||
StoreOrderCartInfo::where('oid', $detail['id'])->update(['is_pay' => -1]);
|
||||
return '退款成功';
|
||||
}
|
||||
}
|
||||
//余额支付 采购款支付
|
||||
if (in_array($detail['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
PayNotifyLogic::balance_purchase_refund($detail);
|
||||
StoreOrderCartInfo::where('oid', $detail['id'])->update(['is_pay' => -1]);
|
||||
return '退款成功';
|
||||
}
|
||||
//现金支付
|
||||
if ($detail['pay_type'] = PayEnum::CASH_PAY) {
|
||||
PayNotifyLogic::cash_refund($params['order_id']);
|
||||
StoreOrderCartInfo::where('oid', $detail['id'])->update(['is_pay' => -1]);
|
||||
return '退款成功';
|
||||
}
|
||||
return false;
|
||||
//todo 支付包支付
|
||||
}
|
||||
//余额支付 采购款支付
|
||||
if (in_array($detail['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
$money = bcmul($detail['pay_price'], 100);
|
||||
$arr = [
|
||||
'amount' => [
|
||||
'refund' => $money
|
||||
]
|
||||
];
|
||||
PayNotifyLogic::refund($params['order_id'], $arr);
|
||||
StoreOrderCartInfo::where('oid',$detail['id'])->update(['is_pay'=>-1]);
|
||||
return '退款成功';
|
||||
}
|
||||
|
||||
public function refundProduct($detail, $params)
|
||||
{
|
||||
$refund_price = $params['refund_price'];
|
||||
$refund_num = 0;
|
||||
foreach ($params['product_arr'] as $k => $v) {
|
||||
$find = StoreOrderCartInfo::where('oid', $detail['id'])->where('product_id', $v['product_id'])->find();
|
||||
if ($find) {
|
||||
$refund_num += $v['cart_num'];
|
||||
$cart_num = bcsub($find['cart_num'], $v['cart_num']);
|
||||
$total_price = bcmul($find['price'], $cart_num);
|
||||
$data = ['cart_num' => $cart_num, 'total_price' => $total_price];
|
||||
StoreOrderCartInfo::where('id', $find['id'])->update($data);
|
||||
$arr = StoreFinanceFlowProduct::where('oid', $detail['id'])->where('product_id', $v['product_id'])->select()->toArray();
|
||||
foreach ($arr as $key => $value) {
|
||||
$value['cart_num'] = $cart_num;
|
||||
$value['total_price'] = bcmul($cart_num, $value['price'], 2);
|
||||
$value['number'] = bcmul($value['total_price'], $value['rate'], 2);
|
||||
StoreFinanceFlowProduct::where('id', $value['id'])->update(['delete_time' => time()]);
|
||||
unset($value['id']);
|
||||
$value['create_time'] = strtotime($value['create_time']);
|
||||
$value['update_time'] = strtotime($value['update_time']);
|
||||
StoreFinanceFlowProduct::create($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
//现金支付
|
||||
if ($detail['pay_type'] = PayEnum::CASH_PAY) {
|
||||
PayNotifyLogic::cash_refund($params['order_id']);
|
||||
StoreOrderCartInfo::where('oid',$detail['id'])->update(['is_pay'=>-1]);
|
||||
return '退款成功';
|
||||
}
|
||||
return false;
|
||||
//todo 支付包支付
|
||||
$village_uid = StoreFinanceFlow::where('order_id', $detail['id'])->where('financial_type', 14)->value('other_uid');
|
||||
$brigade_uid = StoreFinanceFlow::where('order_id', $detail['id'])->where('financial_type', 15)->value('other_uid');
|
||||
$transaction_id = StoreFinanceFlow::where('order_id', $detail['id'])->value('transaction_id');
|
||||
StoreFinanceFlow::where('order_id', $detail['id'])->update(['delete_time' => time()]);
|
||||
CommissionnLogic::setStore($detail, $village_uid, $brigade_uid, $transaction_id);
|
||||
|
||||
StoreOrder::where('id', $detail['oid'])->update(['refund_price' => $refund_price, 'refund_num' => $refund_num]);
|
||||
StoreOrderCartInfo::where('oid', $detail['id'])->update(['is_pay' => -1]);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ class IndexController extends BaseApiController
|
||||
|
||||
public function index()
|
||||
{
|
||||
return json([1]);
|
||||
|
||||
return json(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,6 +168,7 @@ class OrderLogic extends BaseLogic
|
||||
$cart_select[$k]['imgs'] = $find['image'];
|
||||
$cart_select[$k]['store_id'] = $params['store_id'] ?? 0;
|
||||
$cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name');
|
||||
$cart_select[$k]['total_price'] =$cart_select[$k]['pay_price'];
|
||||
self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2);
|
||||
self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
|
||||
self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
|
||||
|
@ -13,6 +13,7 @@ use app\common\service\sms\SmsDriver;
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\user\User;
|
||||
use support\Cache;
|
||||
use support\exception\BusinessException;
|
||||
use think\Exception;
|
||||
use Webman\Config;
|
||||
/**
|
||||
@ -92,7 +93,7 @@ class LoginAccountValidate extends BaseValidate
|
||||
//账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
$userAccountSafeCache = new UserAccountSafeCache();
|
||||
if (!$userAccountSafeCache->isSafe()) {
|
||||
return '密码连续' . $userAccountSafeCache->count . '次输入错误,请' . $userAccountSafeCache->minute . '分钟后重试';
|
||||
throw new BusinessException( '密码连续' . $userAccountSafeCache->count . '次输入错误,请' . $userAccountSafeCache->minute . '分钟后重试');
|
||||
}
|
||||
|
||||
$where = [];
|
||||
@ -106,22 +107,22 @@ class LoginAccountValidate extends BaseValidate
|
||||
->findOrEmpty();
|
||||
|
||||
if ($userInfo->isEmpty()) {
|
||||
return '用户不存在';
|
||||
throw new BusinessException( '用户不存在');
|
||||
}
|
||||
|
||||
if ($userInfo['is_disable'] === YesNoEnum::YES) {
|
||||
return '用户已禁用';
|
||||
throw new BusinessException( '用户已禁用');
|
||||
}
|
||||
|
||||
if (empty($userInfo['password'])) {
|
||||
$userAccountSafeCache->record();
|
||||
return '用户不存在';
|
||||
throw new BusinessException( '用户不存在');
|
||||
}
|
||||
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
if ($userInfo['password'] !== create_password($password, $passwordSalt)) {
|
||||
$userAccountSafeCache->record();
|
||||
return '密码错误';
|
||||
throw new BusinessException( '密码错误');
|
||||
}
|
||||
|
||||
$userAccountSafeCache->relieve();
|
||||
@ -147,10 +148,10 @@ class LoginAccountValidate extends BaseValidate
|
||||
}
|
||||
$code = Cache::get($remark);
|
||||
if(empty($code)){
|
||||
return '验证码不存在';
|
||||
throw new BusinessException( '验证码不存在');
|
||||
}
|
||||
if (isset($data['code']) && $code != $data['code']) {
|
||||
return '验证码错误';
|
||||
throw new BusinessException( '验证码错误');
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -181,6 +181,10 @@ class CapitalFlowLogic extends BaseLogic
|
||||
return "用户减少{$amount}元";
|
||||
case 'user_withdrawal':
|
||||
return "用户提现{$amount}元";
|
||||
case 'now_money_refund':
|
||||
return "订单退回到余额{$amount}元";
|
||||
case 'purchase_refund':
|
||||
return "订单退回到采购款{$amount}元";
|
||||
default:
|
||||
return "订单支付{$amount}元";
|
||||
}
|
||||
|
@ -55,15 +55,22 @@ class CommissionProductLogic extends BaseLogic
|
||||
// $rose = bcdiv($product['rose'], 100, 2);
|
||||
if($user_ship==4){
|
||||
$total_price = bcmul($product['cost'], $find['cart_num']);
|
||||
$price=$product['cost'];
|
||||
}else{
|
||||
$total_price = bcmul($product['price'], $find['cart_num']);
|
||||
$price=$product['price'];
|
||||
}
|
||||
// $Distribution = Distribution::where('rate', $rose)->find();
|
||||
//门店
|
||||
$data[] = [
|
||||
'nickname' => '门店',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.05,
|
||||
'number' => bcmul($total_price, 0.05, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 1,
|
||||
@ -71,9 +78,14 @@ class CommissionProductLogic extends BaseLogic
|
||||
];
|
||||
//平台
|
||||
$data[] = [
|
||||
'nickname' => '平台',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.02,
|
||||
'number' => bcmul($total_price, 0.02, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 2,
|
||||
@ -81,9 +93,14 @@ class CommissionProductLogic extends BaseLogic
|
||||
];
|
||||
//村长
|
||||
$data[] = [
|
||||
'nickname' => '村长',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'price' => $price,
|
||||
'other_uid' => $village_uid,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.01,
|
||||
'number' => bcmul($total_price, 0.01, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 3,
|
||||
@ -91,9 +108,14 @@ class CommissionProductLogic extends BaseLogic
|
||||
];
|
||||
//队长
|
||||
$data[] = [
|
||||
'nickname' => '队长',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'price' => $price,
|
||||
'other_uid' => $brigade_uid,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.01,
|
||||
'number' => bcmul($total_price, 0.01, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 4,
|
||||
@ -116,12 +138,17 @@ class CommissionProductLogic extends BaseLogic
|
||||
// ];
|
||||
|
||||
//会员
|
||||
if ($order['spread_uid'] > 0) {
|
||||
if ($order['spread_uid'] > 0 ||$user_ship>0) {
|
||||
if (in_array($user_ship, [2, 3])) {
|
||||
$data[] = [
|
||||
'nickname' => '会员',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'price' => $price,
|
||||
'other_uid' => $order['spread_uid'],
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.05,
|
||||
'number' => bcmul($total_price, 0.05, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 0,
|
||||
@ -129,9 +156,14 @@ class CommissionProductLogic extends BaseLogic
|
||||
];
|
||||
} else {
|
||||
$data[] = [
|
||||
'nickname' => '会员',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => $order['spread_uid'],
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.07,
|
||||
'number' => bcmul($total_price, 0.07, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 0,
|
||||
@ -140,9 +172,14 @@ class CommissionProductLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
$data[] = [
|
||||
'nickname' => '消耗',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.01,
|
||||
'number' => bcmul($total_price, 0.01, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 6,
|
||||
@ -158,11 +195,17 @@ class CommissionProductLogic extends BaseLogic
|
||||
{
|
||||
// $rose = bcdiv($product['rose'], 100, 2);
|
||||
$total_price = bcmul($product['cost'], $find['cart_num']);
|
||||
$price = $product['cost'];
|
||||
//门店
|
||||
$data[] = [
|
||||
'nickname' => '门店',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.05,
|
||||
'number' => bcmul($total_price, 0.05, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 1,
|
||||
@ -170,18 +213,28 @@ class CommissionProductLogic extends BaseLogic
|
||||
];
|
||||
//平台
|
||||
$data[] = [
|
||||
'nickname' => '平台',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.02,
|
||||
'number' => bcmul($total_price, 0.02, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 2,
|
||||
'status' => 1,
|
||||
];
|
||||
$data[] = [
|
||||
'nickname' => '消耗',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.01,
|
||||
'number' => bcmul($total_price, 0.01, 2),
|
||||
'oid' => $order['id'],
|
||||
'type' => 6,
|
||||
@ -196,7 +249,7 @@ class CommissionProductLogic extends BaseLogic
|
||||
// $rose = bcdiv($product['rose'], 100, 2);
|
||||
$total_price = bcmul($product['price'], $find['cart_num']);
|
||||
$purchase_price = bcmul($product['purchase'], $find['cart_num']);
|
||||
|
||||
$price=$product['price'];
|
||||
$brigade_number = bcmul($total_price, 0.02, 2);
|
||||
$village_number = bcmul($brigade_number, 0.1, 2);
|
||||
$platform_number = bcmul($total_price, 0.02, 2);
|
||||
@ -212,43 +265,67 @@ class CommissionProductLogic extends BaseLogic
|
||||
|
||||
//队长
|
||||
$data[] = [
|
||||
'nickname' => '活动队长',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => $brigade_uid,
|
||||
'price' => $price,
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.02,
|
||||
'number' => $brigade_number,
|
||||
'oid' => $order['id'],
|
||||
'type' => 4,
|
||||
'status' => 1,
|
||||
'is_activity' => 1,
|
||||
];
|
||||
//村长
|
||||
$data[] = [
|
||||
'nickname' => '活动村长',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => $village_uid,
|
||||
'price' => $price,
|
||||
'total_price' => $brigade_number,
|
||||
'cart_num' => 0,
|
||||
'rate' => 0.01,
|
||||
'number' => $village_number,
|
||||
'oid' => $order['id'],
|
||||
'type' => 3,
|
||||
'status' => 1,
|
||||
'is_activity' => 1,
|
||||
];
|
||||
//门店
|
||||
$data[] = [
|
||||
'nickname' => '活动门店',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $store_number,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0,
|
||||
'number' => $store_number,
|
||||
'oid' => $order['id'],
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
'is_activity' => 1,
|
||||
];
|
||||
//平台
|
||||
$data[] = [
|
||||
'nickname' => '活动平台',
|
||||
'store_id' => $order['store_id'],
|
||||
'product_id' => $find['product_id'],
|
||||
'other_uid' => 0,
|
||||
'price' => $price,
|
||||
'total_price' => $platform_number,
|
||||
'cart_num' => $find['cart_num'],
|
||||
'rate' => 0.02,
|
||||
'number' => $platform_number,
|
||||
'oid' => $order['id'],
|
||||
'type' => 2,
|
||||
'status' => 1,
|
||||
'is_activity' => 1,
|
||||
];
|
||||
(new StoreFinanceFlowProduct())->saveAll($data);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ use app\common\model\user_sign\UserSign;
|
||||
use app\common\model\vip_flow\VipFlow;
|
||||
use app\common\service\Curl;
|
||||
use app\common\service\PushService;
|
||||
use support\exception\BusinessException;
|
||||
use support\Log;
|
||||
use think\facade\Db;
|
||||
use Webman\RedisQueue\Redis;
|
||||
@ -52,7 +53,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
|
||||
throw new \Exception($e->getMessage());
|
||||
throw new BusinessException($e->getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,13 +72,13 @@ class PayNotifyLogic extends BaseLogic
|
||||
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
|
||||
$user = User::where('id', $order['uid'])->find();
|
||||
if ($user['now_money'] < $order['pay_price']) {
|
||||
throw new \Exception('余额不足');
|
||||
throw new BusinessException('余额不足');
|
||||
}
|
||||
// $order->money = $order['pay_price'];
|
||||
$order->paid = 1;
|
||||
$order->pay_time = time();
|
||||
if (!$order->save()) {
|
||||
throw new \Exception('订单保存出错');
|
||||
throw new BusinessException('订单保存出错');
|
||||
}
|
||||
if ($order['is_storage'] == 1) {
|
||||
$order->status = 2;
|
||||
@ -192,8 +194,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
UserProductStorageLogic::add($order);
|
||||
}
|
||||
// 减去采购款
|
||||
$user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2);
|
||||
$user->save();
|
||||
User::update(['purchase_funds' => bcsub($user['purchase_funds'], $order['pay_price'], 2)], ['id' => $user['id']]);
|
||||
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'], '', 18, $order['store_id']);
|
||||
@ -323,34 +324,10 @@ class PayNotifyLogic extends BaseLogic
|
||||
|
||||
//订单购物详情
|
||||
StoreOrderCartInfo::where('oid', $order['id'])->update(['status' => OrderEnum::REFUND_STATUS_FINISH]);
|
||||
|
||||
self::balance_purchase_refund($order);
|
||||
//处理财务流水退还
|
||||
(new StoreFinanceFlowLogic())->store_finance_back($orderSn, $order['store_id']);
|
||||
if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额支付
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$user->now_money = bcadd($user['now_money'], $order['pay_price'], 2);
|
||||
$user->save();
|
||||
//增加数量
|
||||
self::addStock($order['id']);
|
||||
//退款
|
||||
$capitalFlowDao->userIncome('system_balance_add', 'system_back', $order['id'], $order['pay_price']);
|
||||
}
|
||||
if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款支付
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$user->purchase_funds = bcadd($user['purchase_funds'], $order['pay_price'], 2);
|
||||
$user->save();
|
||||
//增加数量
|
||||
self::addStock($order['id']);
|
||||
//退款
|
||||
$capitalFlowDao->userIncome('system_purchase_back', 'system_back', $order['id'], $order['pay_price']);
|
||||
}
|
||||
UserSignLogic::RefundOrder($order);
|
||||
|
||||
return true;
|
||||
}
|
||||
//积分
|
||||
UserSignLogic::RefundOrder($order);
|
||||
//微信日志 user_order_refund
|
||||
@ -361,6 +338,46 @@ class PayNotifyLogic extends BaseLogic
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额采购款退款
|
||||
*/
|
||||
public static function balance_purchase_refund($order, $type = 1, $money = 0)
|
||||
{
|
||||
if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
|
||||
if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额支付
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
if ($type == 1) {
|
||||
$capitalFlowDao->userIncome('now_money_refund', 'system_back', $order['id'], $order['pay_price'], '', 0);
|
||||
$user->now_money = bcadd($user['now_money'], $order['pay_price'], 2);
|
||||
} else {
|
||||
$capitalFlowDao->userIncome('now_money_refund', 'system_back', $order['id'], $money, '', 0);
|
||||
$user->now_money = bcadd($user['now_money'], $money, 2);
|
||||
}
|
||||
$user->save();
|
||||
//增加数量
|
||||
self::addStock($order['id']);
|
||||
}
|
||||
if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款支付
|
||||
$user = User::where('id', $order['uid'])->findOrEmpty();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
if ($type == 1) {
|
||||
$capitalFlowDao->userIncome('purchase_refund', 'system_back', $order['id'], $order['pay_price'], '', 1);
|
||||
$user->purchase_funds = bcadd($user['purchase_funds'], $order['pay_price'], 2);
|
||||
} else {
|
||||
$capitalFlowDao->userIncome('purchase_refund', 'system_back', $order['id'], $money, '', 1);
|
||||
$user->purchase_funds = bcadd($user['purchase_funds'], $money, 2);
|
||||
}
|
||||
$user->save();
|
||||
//增加数量
|
||||
self::addStock($order['id']);
|
||||
}
|
||||
UserSignLogic::RefundOrder($order);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 现金退款相关
|
||||
* @param $orderSn
|
||||
@ -574,42 +591,48 @@ class PayNotifyLogic extends BaseLogic
|
||||
{
|
||||
StoreOrderCartInfo::where('oid', $order['id'])->update(['is_pay' => 1]);
|
||||
$arr = StoreOrderCartInfo::where('oid', $order['id'])->field('id,oid,product_id,store_id,cart_num')->select();
|
||||
try{
|
||||
try {
|
||||
foreach ($arr as $k => $v) {
|
||||
$branchProduct=StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id',$v['store_id'])->find();
|
||||
if($branchProduct){
|
||||
$stock=bcsub($branchProduct['stock'],$v['cart_num'],2);
|
||||
onBeforeUpdate($branchProduct->toArray(),'branch_product');
|
||||
|
||||
StoreBranchProduct::where('id',$branchProduct['id'])->update(['stock'=>$stock,'total_price'=>bcmul($stock,$branchProduct['purchase'],2),
|
||||
'sales'=>bcadd($branchProduct['sales'],$v['cart_num'],2)]);
|
||||
|
||||
$branchProduct=$branchProduct->toArray();
|
||||
$branchProduct['stock']=$stock;
|
||||
$branchProduct['total_price']=bcmul($stock,$branchProduct['purchase'],2);
|
||||
$branchProduct['sales']=bcadd($branchProduct['sales'],$v['cart_num'],2);
|
||||
onAfterUpdate($branchProduct,'branch_product');
|
||||
$branchProduct = StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id', $v['store_id'])->find();
|
||||
if ($branchProduct) {
|
||||
$stock = bcsub($branchProduct['stock'], $v['cart_num'], 2);
|
||||
onBeforeUpdate($branchProduct->toArray(), 'branch_product');
|
||||
|
||||
StoreBranchProduct::where('id', $branchProduct['id'])->update([
|
||||
'stock' => $stock,
|
||||
'total_price' => bcmul($stock, $branchProduct['purchase'], 2),
|
||||
'sales' => bcadd($branchProduct['sales'], $v['cart_num'], 2)
|
||||
]);
|
||||
|
||||
$branchProduct = $branchProduct->toArray();
|
||||
$branchProduct['stock'] = $stock;
|
||||
$branchProduct['total_price'] = bcmul($stock, $branchProduct['purchase'], 2);
|
||||
$branchProduct['sales'] = bcadd($branchProduct['sales'], $v['cart_num'], 2);
|
||||
onAfterUpdate($branchProduct, 'branch_product');
|
||||
}
|
||||
$storeProduct=StoreProduct::where('id', $v['product_id'])->find();
|
||||
if($storeProduct){
|
||||
$stock=bcsub($storeProduct['stock'],$v['cart_num'],2);
|
||||
onBeforeUpdate($storeProduct->toArray(),'product');
|
||||
|
||||
StoreProduct::where('id', $v['product_id'])->update(['stock'=>$stock,'total_price'=>bcmul($stock,$storeProduct['purchase'],2),
|
||||
'sales'=>bcadd($storeProduct['sales'],$v['cart_num'],2)]);
|
||||
|
||||
$storeProduct=$storeProduct->toArray();
|
||||
$storeProduct['stock']=$stock;
|
||||
$storeProduct['total_price']=bcmul($stock,$storeProduct['purchase'],2);
|
||||
$storeProduct['sales']=bcadd($storeProduct['sales'],$v['cart_num'],2);
|
||||
onAfterUpdate($storeProduct,'product');
|
||||
$storeProduct = StoreProduct::where('id', $v['product_id'])->find();
|
||||
if ($storeProduct) {
|
||||
$stock = bcsub($storeProduct['stock'], $v['cart_num'], 2);
|
||||
onBeforeUpdate($storeProduct->toArray(), 'product');
|
||||
|
||||
StoreProduct::where('id', $v['product_id'])->update([
|
||||
'stock' => $stock,
|
||||
'total_price' => bcmul($stock, $storeProduct['purchase'], 2),
|
||||
'sales' => bcadd($storeProduct['sales'], $v['cart_num'], 2)
|
||||
]);
|
||||
|
||||
$storeProduct = $storeProduct->toArray();
|
||||
$storeProduct['stock'] = $stock;
|
||||
$storeProduct['total_price'] = bcmul($stock, $storeProduct['purchase'], 2);
|
||||
$storeProduct['sales'] = bcadd($storeProduct['sales'], $v['cart_num'], 2);
|
||||
onAfterUpdate($storeProduct, 'product');
|
||||
}
|
||||
}
|
||||
}catch (\Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('订单库存更新失败:' . $e->getMessage());
|
||||
// 异常处理代码,例如记录日志或发送通知等。
|
||||
}
|
||||
|
||||
|
||||
$financeLogic = new StoreFinanceFlowLogic();
|
||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||
$village_uid = 0;
|
||||
@ -649,79 +672,36 @@ class PayNotifyLogic extends BaseLogic
|
||||
// if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
|
||||
// $order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']);
|
||||
// }
|
||||
if ($order['spread_uid'] > 0 || $user_ship > 0) {
|
||||
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
||||
$user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
|
||||
if ($user_ship == 2) {
|
||||
$village_uid = $order['spread_uid'];
|
||||
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
} elseif ($user_ship == 3) {
|
||||
$brigade_uid = $order['spread_uid'];
|
||||
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($order['uid']>0){
|
||||
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
} else {
|
||||
//查询用户对应的村长和队长
|
||||
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($order['spread_uid'] > 0) {
|
||||
$user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
|
||||
}
|
||||
|
||||
try {
|
||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
||||
$comm = new CommissionProductLogic();
|
||||
try {
|
||||
foreach ($info as $k => $v) {
|
||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
||||
}
|
||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('分润报错' . $e->getMessage());
|
||||
return false;
|
||||
foreach ($info as $k => $v) {
|
||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
||||
$comm = new CommissionProductLogic();
|
||||
foreach ($info as $k => $v) {
|
||||
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);
|
||||
}
|
||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('分润报错' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
CommissionnLogic::setStore($order, $village_uid, $brigade_uid, $transaction_id);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('分润报错' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\system_store\SystemStoreStaff;
|
||||
use app\common\model\user\User;
|
||||
use support\Log;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ use app\common\model\BaseModel;
|
||||
use app\common\model\user_label\UserLabel;
|
||||
use app\common\model\user_ship\UserShip;
|
||||
use app\common\service\FileService;
|
||||
use support\Log;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
@ -25,15 +26,14 @@ class User extends BaseModel
|
||||
//会员类型
|
||||
public function userShip()
|
||||
{
|
||||
return $this->hasOne(UserShip::class,'id','user_ship')
|
||||
->bind(['vip_name'=>'title','discount','limit']);
|
||||
return $this->hasOne(UserShip::class, 'id', 'user_ship')
|
||||
->bind(['vip_name' => 'title', 'discount', 'limit']);
|
||||
}
|
||||
|
||||
public function userLabel()
|
||||
{
|
||||
return $this->hasOne(UserLabel::class,'label_id','label_id')
|
||||
return $this->hasOne(UserLabel::class, 'label_id', 'label_id')
|
||||
->bind(['label_name']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,15 +184,16 @@ class User extends BaseModel
|
||||
* @param $timeType
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTrendData($time, $where, $timeType,$create_time='create_time')
|
||||
public function getTrendData($time, $where, $timeType, $create_time = 'create_time')
|
||||
{
|
||||
return $this->where($where)->where(function ($query) use ($time,$create_time) {
|
||||
return $this->where($where)->where(function ($query) use ($time, $create_time) {
|
||||
if ($time[0] == $time[1]) {
|
||||
$query->whereDay($create_time, date('Y-m-d',$time[0]));
|
||||
$query->whereDay($create_time, date('Y-m-d', $time[0]));
|
||||
} else {
|
||||
$time[1] = $time[1] + 86400;
|
||||
$query->whereTime($create_time, 'between', $time);
|
||||
}
|
||||
})->field("FROM_UNIXTIME($create_time,'$timeType') as days,count(id) as num")->group('days')->select()->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -517,3 +517,9 @@ function onAfterUpdate($data, $type)
|
||||
$log = Log::channel($type);
|
||||
$log->info('更新后:' ,$data);
|
||||
}
|
||||
|
||||
function channelLog($data, $type,$title='更新前')
|
||||
{
|
||||
$log = Log::channel($type);
|
||||
$log->info($title ,$data);
|
||||
}
|
@ -27,7 +27,7 @@
|
||||
"php": ">=8.1",
|
||||
"workerman/webman-framework": "^1.5.22",
|
||||
"monolog/monolog": "^2.2",
|
||||
"webman/think-orm": "v1.1.1",
|
||||
"webman/think-orm": "v1.1.3",
|
||||
"vlucas/phpdotenv": "^5.4",
|
||||
"psr/container": "^1.1.1",
|
||||
"ext-json": "*",
|
||||
|
22
composer.lock
generated
22
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "fb2dcd2b6d5f80016cfae906588f8bb9",
|
||||
"content-hash": "883e9ccf0087df3fcbef974d5c9317f3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aliyuncs/oss-sdk-php",
|
||||
@ -7319,23 +7319,17 @@
|
||||
},
|
||||
{
|
||||
"name": "webman/think-orm",
|
||||
"version": "v1.1.1",
|
||||
"version": "v1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webman-php/think-orm.git",
|
||||
"reference": "9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2"
|
||||
"reference": "1c20a9bbedf8a3c0b741f19b175eb929907101c6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webman-php/think-orm/zipball/9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2",
|
||||
"reference": "9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"url": "https://api.github.com/repos/webman-php/think-orm/zipball/1c20a9bbedf8a3c0b741f19b175eb929907101c6",
|
||||
"reference": "1c20a9bbedf8a3c0b741f19b175eb929907101c6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"topthink/think-orm": "^2.0.53 || ^3.0.0",
|
||||
@ -7353,9 +7347,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webman-php/think-orm/issues",
|
||||
"source": "https://github.com/webman-php/think-orm/tree/v1.1.1"
|
||||
"source": "https://github.com/webman-php/think-orm/tree/v1.1.3"
|
||||
},
|
||||
"time": "2023-04-23T14:40:18+00:00"
|
||||
"time": "2024-08-14T03:46:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
@ -117,4 +117,52 @@ return [
|
||||
]
|
||||
],
|
||||
],
|
||||
'user' => [
|
||||
// 处理默认通道的handler,可以设置多个
|
||||
'handlers' => [
|
||||
[
|
||||
// handler类的名字
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
// handler类的构造函数参数
|
||||
'constructor' => [
|
||||
runtime_path() . '/user/'.date('Ym').'/.log',
|
||||
2048,
|
||||
Monolog\Logger::DEBUG,
|
||||
true,
|
||||
0755
|
||||
],
|
||||
// 格式相关
|
||||
'formatter' => [
|
||||
// 格式化处理类的名字
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
// 格式化处理类的构造函数参数
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
'system_store' => [
|
||||
// 处理默认通道的handler,可以设置多个
|
||||
'handlers' => [
|
||||
[
|
||||
// handler类的名字
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
// handler类的构造函数参数
|
||||
'constructor' => [
|
||||
runtime_path() . '/system_store/'.date('Ym').'/.log',
|
||||
2048,
|
||||
Monolog\Logger::DEBUG,
|
||||
true,
|
||||
0755
|
||||
],
|
||||
// 格式相关
|
||||
'formatter' => [
|
||||
// 格式化处理类的名字
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
// 格式化处理类的构造函数参数
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
|
14
vendor/composer/installed.json
vendored
14
vendor/composer/installed.json
vendored
@ -7268,24 +7268,24 @@
|
||||
},
|
||||
{
|
||||
"name": "webman/think-orm",
|
||||
"version": "v1.1.1",
|
||||
"version_normalized": "1.1.1.0",
|
||||
"version": "v1.1.3",
|
||||
"version_normalized": "1.1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webman-php/think-orm.git",
|
||||
"reference": "9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2"
|
||||
"reference": "1c20a9bbedf8a3c0b741f19b175eb929907101c6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webman-php/think-orm/zipball/9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2",
|
||||
"reference": "9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2",
|
||||
"url": "https://api.github.com/repos/webman-php/think-orm/zipball/1c20a9bbedf8a3c0b741f19b175eb929907101c6",
|
||||
"reference": "1c20a9bbedf8a3c0b741f19b175eb929907101c6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"topthink/think-orm": "^2.0.53 || ^3.0.0",
|
||||
"workerman/webman-framework": "^1.2.1"
|
||||
},
|
||||
"time": "2023-04-23T14:40:18+00:00",
|
||||
"time": "2024-08-14T03:46:14+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -7299,7 +7299,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webman-php/think-orm/issues",
|
||||
"source": "https://github.com/webman-php/think-orm/tree/v1.1.1"
|
||||
"source": "https://github.com/webman-php/think-orm/tree/v1.1.3"
|
||||
},
|
||||
"install-path": "../webman/think-orm"
|
||||
},
|
||||
|
6
vendor/composer/installed.php
vendored
6
vendor/composer/installed.php
vendored
@ -993,9 +993,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'webman/think-orm' => array(
|
||||
'pretty_version' => 'v1.1.1',
|
||||
'version' => '1.1.1.0',
|
||||
'reference' => '9f1e525c5c4b5a2e1eee6a4f82ef5d23c69139a2',
|
||||
'pretty_version' => 'v1.1.3',
|
||||
'version' => '1.1.3.0',
|
||||
'reference' => '1c20a9bbedf8a3c0b741f19b175eb929907101c6',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../webman/think-orm',
|
||||
'aliases' => array(),
|
||||
|
@ -75,7 +75,6 @@ trait ModelEvent
|
||||
}
|
||||
|
||||
$call = 'on' . Str::studly($event);
|
||||
|
||||
try {
|
||||
if (method_exists(static::class, $call)) {
|
||||
$result = call_user_func([static::class, $call], $this);
|
||||
|
2
vendor/webman/think-orm/src/ThinkOrm.php
vendored
2
vendor/webman/think-orm/src/ThinkOrm.php
vendored
@ -40,7 +40,7 @@ class ThinkOrm implements Bootstrap
|
||||
}
|
||||
foreach ($instances as $connection) {
|
||||
/* @var \think\db\connector\Mysql $connection */
|
||||
if (in_array($connection->getConfig('type'), ['mysql', 'oracle', 'sqlsrv'])) {
|
||||
if (in_array($connection->getConfig('type'), ['mysql', 'oracle', 'sqlsrv']) && method_exists($connection, 'getPdo') && $connection->getPdo()) {
|
||||
try {
|
||||
$connection->query('select 1');
|
||||
} catch (Throwable $e) {}
|
||||
|
@ -27,8 +27,6 @@ return [
|
||||
'prefix' => '',
|
||||
// 断线重连
|
||||
'break_reconnect' => true,
|
||||
// 关闭SQL监听日志
|
||||
'trigger_sql' => false,
|
||||
// 自定义分页类
|
||||
'bootstrap' => ''
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user