diff --git a/app/api/controller/LoginController.php b/app/api/controller/LoginController.php index 4c4ce8d18..dd8ab2244 100644 --- a/app/api/controller/LoginController.php +++ b/app/api/controller/LoginController.php @@ -82,7 +82,7 @@ class LoginController extends BaseApiController if ($result === false) { return $this->fail(LoginLogic::getError()); } - return $this->success('操作成功', [], 1, 1); + return $this->success('操作成功', [], 1, 0); } /** diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index 5ca9d4c29..798b3b577 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -443,12 +443,12 @@ class LoginLogic extends BaseLogic { $find=User::where(['mobile' =>$params['mobile']])->find(); if($find){ - $auth=UserAuth::where(['user_id'=>$find['id'],'terminal'=>1])->find(); + $auth=UserAuth::where(['user_id'=>$find['id']])->find();//别人的 if($auth){ - self::$error ='该手机号已被绑定'; + self::$error ='该手机号已绑定'; return false; }else{ - UserAuth::where(['user_id'=>$find['id'],'terminal'=>1])->update(['user_id'=>$find['id']]); + UserAuth::where(['user_id'=>$userId])->update(['user_id'=>$find['id']]); } } $data=[ diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index 5564d4ef7..1ffb751c1 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -46,6 +46,7 @@ class OrderEnum const CASHIER_FACE_PAY = 17;//现金收银 const PURCHASE_FUNDS = 18;//采购款收银 + const PAY_BACK =-1; /** @@ -183,10 +184,10 @@ class OrderEnum public static function getOrderType($value = true) { $data = [ - self::RECEIVED_GOODS => '已收货', + self::RECEIVED_GOODS => '已完成', self::WAIT_EVALUATION => '待评价', self::WAIT_DELIVERY => '待发货', - self::WAIT_RECEIVING => '待收货', + self::WAIT_RECEIVING => '待核销', self::RETURN_SUCCESS => '退货成功', self::ALREADY_REFUND => '已退款', self::RECEIVED_BACK => '已退款', diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 0f08b7da8..fe50ec195 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -293,11 +293,38 @@ class PayNotifyLogic extends BaseLogic } //微信日志 user_order_refund $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money,'',1); + //处理财务流水退还 + self::store_finance_back($orderSn); self::addStock($order['id']);//微信 // self::afterPay($order,$extra['transaction_id']); } + + /** + * 财务退还金额相关 + * @param $orderSn + * @return void + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function store_finance_back($orderSn) + { + $data = StoreFinanceFlow::where('order_sn',$orderSn) + ->where(['financial_pm'=>1]) + ->select()->toArray(); + foreach ($data as &$value){ + unset($value['id']); + $value['financial_record_sn']=(new StoreFinanceFlowLogic)->getSn(); + $value['financial_pm']=0; + $value['financial_type']= OrderEnum::PAY_BACK; + $value['create_time']=time(); + } + (new StoreFinanceFlow)->saveAll($data); + + } + /** * 现金退款相关 * @param $orderSn diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index dc37fd612..59a98e78d 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -54,8 +54,8 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface } elseif ($is_sashier == 2) { //小程序订单 $this->searchWhere[] = ['pay_type', 'in', [7, 3, 18,19]]; } - return StoreOrder::where($this->searchWhere) - ->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status', 'paid', 'total_num']) + return StoreOrder::where($this->searchWhere)->with(['user']) + ->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) use ($store_id) {