|
@@ -274,6 +274,45 @@ class PayDetailController extends Curd
|
|
|
return json_success('success');
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 余额账户赠送
|
|
|
+ */
|
|
|
+ public function insertGive(Request $request): Response
|
|
|
+ {
|
|
|
+ if ($this->validate && !$this->validateClass->scene('add')->check($request->post())) {
|
|
|
+ return json_fail($this->validateClass->getError());
|
|
|
+ }
|
|
|
+
|
|
|
+ $password = $request->post('recharge_password', '');
|
|
|
+ if (!$password || $password != '123456') {
|
|
|
+ return json_fail('赠送密码错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ $data = $this->insertGiveInput($request);
|
|
|
+ $data['pay_prepayid'] = $data['join_pay_member_id'] . '-CASH';
|
|
|
+
|
|
|
+ $this->doInsert($data);
|
|
|
+
|
|
|
+
|
|
|
+ $memberAccount = MemberAccount::where('join_account_member_id', $data['join_pay_member_id'])->where('member_account_classify', 'WELFARE')->first();
|
|
|
+ $memberAccount->member_account_income = $memberAccount->member_account_income + $data['pay_amount'];
|
|
|
+ $memberAccount->member_account_surplus = $memberAccount->member_account_surplus + $data['pay_amount'];
|
|
|
+ $memberAccount->save();
|
|
|
+
|
|
|
+ Db::commit();
|
|
|
+ } catch (BusinessException $customException) {
|
|
|
+ Db::rollBack();
|
|
|
+ return json_fail($customException->getMessage());
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ dump($e->getMessage());
|
|
|
+ return json_fail('数据写入失败11');
|
|
|
+ }
|
|
|
+ return json_success('success');
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
* 福利账户充值
|
|
@@ -407,6 +446,88 @@ class PayDetailController extends Curd
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * @Desc
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/6/5 13:39
|
|
|
+ *
|
|
|
+ * @param Request $request
|
|
|
+ * @return array
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+ protected function insertGiveInput(Request $request, $type = "CASH"): array
|
|
|
+ {
|
|
|
+ $params = $request->post();
|
|
|
+ $data = $this->inputFilter($params);
|
|
|
+ $goods = Goods::find($params['goods_id']);
|
|
|
+ $extendJson = [];
|
|
|
+
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ if (!$params['is_custom']) {
|
|
|
+ $data['pay_amount'] = $goods->goods_sales_price;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ dump($e->getMessage());
|
|
|
+ Db::rollBack();
|
|
|
+
|
|
|
+ throw new BusinessException("数据错误");
|
|
|
+ }
|
|
|
+ $data['join_pay_order_id'] = "SYSTEM";
|
|
|
+ $data['join_pay_object_json'] = json_encode(['order_id' => 'SYSTEM']);
|
|
|
+
|
|
|
+ $rate = 0;
|
|
|
+ $extendJson['added_amount'] = number_format($data['pay_amount'] * $rate, 2, '.', '');
|
|
|
+ $extendJson['added_rate'] = $rate;
|
|
|
+ $data['pay_extend_json'] = json_encode($extendJson);
|
|
|
+ $data['pay_paytimes'] = date('Y-m-d H:i:s', strtotime($data['pay_paytimes']));
|
|
|
+ $data['pay_prepayid'] = 0;
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* @Desc 加备注-门店、服务人员、业务人员
|
|
|
* @Author Gorden
|