diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index b3c777f0..140ccd5b 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -2,6 +2,7 @@ namespace app\api\controller; +use app\common\logic\StoreFinanceFlowLogic; use app\admin\logic\store_product\StoreProductLogic; use app\admin\validate\tools\GenerateTableValidate; use app\admin\logic\tools\GeneratorLogic; @@ -10,6 +11,7 @@ use app\common\logic\PayNotifyLogic; use app\common\logic\store_order\StoreOrderLogic; use app\common\model\Config as ModelConfig; use app\common\model\store_branch_product\StoreBranchProduct; +use app\common\model\store_finance_flow\StoreFinanceFlow; use app\common\model\store_order\StoreOrder; use app\common\model\system_store\SystemStore; use app\common\model\user\User; @@ -38,6 +40,36 @@ class IndexController extends BaseApiController { return json([1]); + $financeFlow = new StoreFinanceFlow(); + $order_id=544; + $store_id=3; + $staff_id=3; + Db::startTrans(); + try { + // $res = $financeFlow->where('order_id', $order_id)->update(['store_id' => $store_id, 'staff_id' => $staff_id]); + // if ($res) { + // $order['store_id'] =$store_id; + // } + $financeFlowLogic = new StoreFinanceFlowLogic(); + //other_uid大于0的 + $select_1 = $financeFlow->where(['order_id' => $order_id, 'financial_pm' => 1,'status'=>0])->where('other_uid','>',0)->select(); + foreach ($select_1 as $k => $v) { + if ($v['other_uid'] > 0) { + $financeFlowLogic->updateStatusUser($v['id'], $v['other_uid'], $v['number'], $v['order_id']); + } + } + + $deposit = $financeFlow->where(['order_id' => $order_id, 'financial_pm' => 0, 'financial_type' => 11,'status'=>0])->value('number') ?? 0; + $money = $financeFlow->where(['order_id' => $order_id, 'financial_pm' => 1, 'financial_type' => 2,'status'=>0])->value('number') ?? 0; + $financeFlowLogic->updateStatusStore($order_id, $store_id, $money, $deposit); + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + d($e); + return false; + } + $all_where['paid'] = 1; d(OrderLogic::dayPayPrice($all_where,date('Y-m-d',time()))); $uid=9;