main
鹿和sa0ChunLuyu 2 years ago
parent f5dbd3bab5
commit 03eeada5d6

@ -18,7 +18,7 @@
break
}
}
// env = 'online'
env = 'online'
// env = 'dev'
const api_url = {
main: 'https://health.cjy.net.cn'

@ -8,6 +8,18 @@ const $token = useToken()
const $config = useConfig()
const admin_api = 'Admin'
export const yo = async (data) => await $post({url: `${$config.value.api.url}/api/yo`, data}, true)
export const NoProfitsharingCreateAction = async (data) => await $post({
url: `${$config.value.api.url}/api/${admin_api}/NoProfitsharing/create`, data
}, true)
export const NoProfitsharingUpdateAction = async (data) => await $post({
url: `${$config.value.api.url}/api/${admin_api}/NoProfitsharing/update`, data
}, true)
export const NoProfitsharingDeleteAction = async (data) => await $post({
url: `${$config.value.api.url}/api/${admin_api}/NoProfitsharing/delete`, data
}, true)
export const NoProfitsharingListAction = async (data) => await $post({
url: `${$config.value.api.url}/api/${admin_api}/NoProfitsharing/list`, data
}, true)
export const ProfitsharingTestAction = async (data) => await $post({
url: `${$config.value.api.url}/api/${admin_api}/Profitsharing/test`, data
}, true)

@ -0,0 +1,186 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2023年3月24日 11:52:52
*/
import {
NoProfitsharingCreateAction,
NoProfitsharingUpdateAction,
NoProfitsharingDeleteAction,
NoProfitsharingListAction,
$response
} from '~/api'
import {h} from "vue";
import {NTag} from "naive-ui";
const $props = defineProps({
hospital: {
type: Number,
default: 0
}
})
const no_profitsharing_list = ref([])
const NoProfitsharingList = async () => {
const response = await NoProfitsharingListAction({
hospital: $props.hospital
})
$response(response, () => {
no_profitsharing_list.value = response.data.list
})
}
const no_profitsharing_active = ref([])
const no_profitsharing_columns = [{
type: 'selection'
}, {
title: '项目ID',
key: 'item_id'
}, {
title: '项目描述',
key: 'desc'
}]
const create_show = ref(false)
const create_data_default = {
item_id: '',
desc: '',
}
const create_data = ref(JSON.parse(JSON.stringify(create_data_default)))
const NoProfitsharingCreate = async () => {
let data = {
...create_data.value,
hospital: $props.hospital
}
const response = await NoProfitsharingCreateAction(data)
$response(response, () => {
window.$message().success(response.message)
create_show.value = false
create_data.value = JSON.parse(JSON.stringify(create_data_default))
NoProfitsharingList()
})
}
const createShowClick = () => {
create_data.value = JSON.parse(JSON.stringify(create_data_default))
create_show.value = true
}
const update_show = ref(false)
const update_data_default = {
id: 0,
item_id: '',
desc: '',
}
const update_data = ref(JSON.parse(JSON.stringify(update_data_default)))
const updateShowClick = () => {
if (no_profitsharing_active.value.length !== 1) return window.$message().error('请选择一个分账设置')
update_data.value = JSON.parse(JSON.stringify(update_data_default))
for (let i = 0; i < no_profitsharing_list.value.length; i++) {
if (no_profitsharing_active.value[0] === no_profitsharing_list.value[i].id) {
update_data.value = JSON.parse(JSON.stringify(no_profitsharing_list.value[i]))
update_show.value = true
return
}
}
}
const NoProfitsharingUpdate = async () => {
let data = {
...update_data.value,
hospital: $props.hospital
}
const response = await NoProfitsharingUpdateAction(data)
$response(response, () => {
window.$message().success(response.message)
update_show.value = false
update_data.value = JSON.parse(JSON.stringify(update_data_default))
NoProfitsharingList()
})
}
const delete_show = ref(false)
const deleteShowClick = () => {
if (no_profitsharing_active.value.length <= 0) return window.$message().error('请选择一个分账设置')
delete_show.value = true
}
const NoProfitsharingDelete = async () => {
const response = await NoProfitsharingDeleteAction({
id: no_profitsharing_active.value[0],
hospital: $props.hospital
})
$response(response, () => {
window.$message().success(response.message)
delete_show.value = false
no_profitsharing_active.value = []
NoProfitsharingList()
})
}
onMounted(() => {
NoProfitsharingList()
})
</script>
<template>
<div>
<n-modal v-model:show="delete_show" preset="card" :style="{width: '400px'}" title="删除确认" :auto-focus="false"
:bordered="false">
<div>
<n-space justify="center">
<n-button @click="NoProfitsharingDelete()" type="info">确定</n-button>
<n-button @click="delete_show = false">取消</n-button>
</n-space>
</div>
</n-modal>
<n-modal v-model:show="update_show" preset="card" :style="{width: '700px'}" title="修改信息" :auto-focus="false"
:bordered="false">
<div>
<n-space align="center">
<n-tag>
<div class="form_tag_wrapper">项目ID</div>
</n-tag>
<n-input class="form_input_wrapper" v-model:value="update_data.item_id"></n-input>
</n-space>
<n-space mt-2 align="center">
<n-tag>
<div class="form_tag_wrapper">项目描述</div>
</n-tag>
<n-input class="form_input_wrapper" v-model:value="update_data.desc"></n-input>
</n-space>
<n-button @click="NoProfitsharingUpdate()" type="info" mt-2>确定</n-button>
</div>
</n-modal>
<n-modal v-model:show="create_show" preset="card" :style="{width: '700px'}" title="新建" :auto-focus="false"
:bordered="false">
<div>
<n-space align="center">
<n-tag>
<div class="form_tag_wrapper">项目ID</div>
</n-tag>
<n-input class="form_input_wrapper" v-model:value="create_data.item_id"></n-input>
</n-space>
<n-space mt-2 align="center">
<n-tag>
<div class="form_tag_wrapper">项目描述</div>
</n-tag>
<n-input class="form_input_wrapper" v-model:value="create_data.desc"></n-input>
</n-space>
<n-button @click="NoProfitsharingCreate()" type="info" mt-2>确定</n-button>
</div>
</n-modal>
<n-card mt-2 title="分账项目">
<div>
<div mt-2>
<n-space>
<n-button @click="createShowClick()" type="success">新建</n-button>
<n-button @click="deleteShowClick()" type="error">删除</n-button>
<n-button @click="updateShowClick()" type="info">修改信息</n-button>
</n-space>
</div>
<n-data-table mt-2 v-model:checked-row-keys="no_profitsharing_active" :columns="no_profitsharing_columns"
:row-key="row=>row.id" :data="no_profitsharing_list"/>
</div>
</n-card>
</div>
</template>
<style scoped>
.form_textarea_wrapper {
width: 300px;
}
</style>

@ -71,6 +71,7 @@ const tab_arr = ref([
'新闻管理',
'问答管理',
'分账管理',
'分账项目',
])
const tabChange = (e) => {
page_options.value.type = e
@ -108,6 +109,7 @@ const hospital_id = ref(0)
<Additional9 :hospital="hospital_id" v-if="page_options.type === 9"></Additional9>
<Additional10 :hospital="hospital_id" v-if="page_options.type === 10"></Additional10>
<Additional11 :hospital="hospital_id" v-if="page_options.type === 11"></Additional11>
<Additional12 :hospital="hospital_id" v-if="page_options.type === 12"></Additional12>
</div>
</n-card>
</div>

@ -69,6 +69,22 @@ const profitsharing_log_columns = [{
const response = JSON.parse(row.response)
return response.order_id
}
}, {
title: '类型',
key: 'type',
render(row) {
return h(
NTag,
{
type: row.type === 1 ? 'success' : 'error'
},
{
default: () => {
return row.type === 1 ? '微信分账' : '站内分账'
}
}
)
}
}, {
title: '收账信息',
key: 'order',

@ -75,6 +75,8 @@ class ComboItemController extends Controller
'id' => $item['Id'],
'name' => $item['名称'],
'price' => $item['价格'],
'discount_type' => $item['优惠方式'],
'discount_value' => $item['优惠值'],
];
}
$info['count'] = count($info['items']);

@ -25,13 +25,15 @@ class HospitalController extends Controller
$id = $request->post('id');
$latitude = $request->post('latitude');
$longitude = $request->post('longitude');
$info = Hospital::select('id', 'address', 'logo', 'name', 'phone', 'latitude', 'longitude', DB::raw('(ROUND(6371 * acos(cos(radians(' . $latitude . ')) * cos(radians(latitude)) * cos(radians(longitude) - radians(' . $longitude . ')) + sin(radians(' . $latitude . ')) * sin(radians(latitude))), 2)) AS distance'))
$info = Hospital::select('id', 'address', 'logo', 'name', 'phone', 'latitude', 'longitude', DB::raw('(ROUND(6371 * acos(cos(radians(?)) * cos(radians(latitude)) * cos(radians(longitude) - radians(?)) + sin(radians(?)) * sin(radians(latitude))), 2)) AS distance'))
->setBindings([$latitude, $longitude, $latitude])
->where('id', $id)
->where('status', 1)
->where('del', 2)
->first();
if (!$info) {
$info = Hospital::select('id', 'address', 'logo', 'name', 'phone', 'latitude', 'longitude', DB::raw('(ROUND(6371 * acos(cos(radians(' . $latitude . ')) * cos(radians(latitude)) * cos(radians(longitude) - radians(' . $longitude . ')) + sin(radians(' . $latitude . ')) * sin(radians(latitude))), 2)) AS distance'))
$info = Hospital::select('id', 'address', 'logo', 'name', 'phone', 'latitude', 'longitude', DB::raw('(ROUND(6371 * acos(cos(radians(?)) * cos(radians(latitude)) * cos(radians(longitude) - radians(?)) + sin(radians(?)) * sin(radians(latitude))), 2)) AS distance'))
->setBindings([$latitude, $longitude, $latitude])
->where('dev', 2)
->where('status', 1)
->where('del', 2)
@ -58,7 +60,8 @@ class HospitalController extends Controller
Login::user();
$latitude = $request->post('latitude');
$longitude = $request->post('longitude');
$query = Hospital::select('id', 'address', 'logo', 'name', 'phone', DB::raw('(ROUND(6371 * acos(cos(radians(' . $latitude . ')) * cos(radians(latitude)) * cos(radians(longitude) - radians(' . $longitude . ')) + sin(radians(' . $latitude . ')) * sin(radians(latitude))), 2)) AS distance'))
$query = Hospital::select('id', 'address', 'logo', 'name', 'phone', DB::raw('(ROUND(6371 * acos(cos(radians(?)) * cos(radians(latitude)) * cos(radians(longitude) - radians(?)) + sin(radians(?)) * sin(radians(latitude))), 2)) AS distance'))
->setBindings([$latitude, $longitude, $latitude])
->where('status', 1)->where('del', 2);
if (Login::$info->dev != 1) $query->where('dev', 2);
$list = $query->orderBy('distance', 'asc')->get();

@ -0,0 +1,82 @@
<?php
namespace App\Http\Controllers;
use App\Models\NoProfitsharing;
use Illuminate\Http\Request;
use Login;
use Yo;
class NoProfitsharingController extends Controller
{
public function create(Request $request)
{
Login::admin([], [31, 32]);
$hospital = $request->post('hospital');
if (Login::$info->hospital != 0) {
if ($hospital != Login::$info->hospital) {
Yo::error_echo(100000, ['机构/医院']);
}
}
$item_id = $request->post('item_id');
$desc = $request->post('desc');
$np = new NoProfitsharing();
$np->hospital = $hospital;
$np->item_id = $item_id;
$np->desc = $desc;
$np->save();
return Yo::create_echo();
}
public function update(Request $request)
{
Login::admin([], [31, 32]);
$hospital = $request->post('hospital');
if (Login::$info->hospital != 0) {
if ($hospital != Login::$info->hospital) {
Yo::error_echo(100000, ['机构/医院']);
}
}
$id = $request->post('id');
$np = NoProfitsharing::find($id);
if (!$np) Yo::error_echo(100000, ['分账项目']);
if ($np->hospital != $hospital) Yo::error_echo(100000, ['分账项目']);
$item_id = $request->post('item_id');
$desc = $request->post('desc');
$np->item_id = $item_id;
$np->desc = $desc;
$np->save();
return Yo::update_echo();
}
public function delete(Request $request)
{
Login::admin([], [31, 32]);
$hospital = $request->post('hospital');
if (Login::$info->hospital != 0) {
if ($hospital != Login::$info->hospital) {
Yo::error_echo(100000, ['机构/医院']);
}
}
$id = $request->post('id');
$np = NoProfitsharing::find($id);
if (!$np) Yo::error_echo(100000, ['分账项目']);
if ($np->hospital != $hospital) Yo::error_echo(100000, ['分账项目']);
$np->delete();
return Yo::delete_echo();
}
public function list(Request $request)
{
Login::admin([], [31, 32]);
$hospital = $request->post('hospital');
if (Login::$info->hospital != 0) {
if ($hospital != Login::$info->hospital) {
Yo::error_echo(100000, ['机构/医院']);
}
}
return Yo::echo([
'list' => NoProfitsharing::where('hospital', $hospital)->orderBy('id', 'desc')->get()
]);
}
}

@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use App\Models\Profitsharing;
use App\Models\ProfitsharingActionLog;
use Illuminate\Http\Request;
class ProfitsharingActionLogController extends Controller
{
public function list()
{
Login::admin([], [17, 25]);
$hospital = $request->post('hospital');
if (Login::$info->hospital != 0) {
if ($hospital != Login::$info->hospital) {
Yo::error_echo(100000, ['机构/医院']);
}
}
$p = ProfitsharingActionLog::where('hospital', $hospital)->where('del', 2)->get();
return Yo::echo([
'list' => $p
]);
}
}

@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Http\Requests\EditProfitsharingsInput;
use App\Models\Config;
use App\Models\Profitsharing;
use App\Models\ProfitsharingLog;
use App\Models\UserOrder;
@ -25,6 +26,7 @@ class ProfitsharingController extends Controller
$id = $request->post('id');
$pl = ProfitsharingLog::where('id', $id)->where('status', 1)->first();
if (!$pl) Yo::error_echo(100000, ['分账记录']);
if ($pl->type != 1) Yo::error_echo(200089);
$wcp = new WeChatPayController();
$builder_config = json_decode($pl->builder, JSON_UNESCAPED_UNICODE);
$receivers = json_decode($pl->receivers, JSON_UNESCAPED_UNICODE);
@ -78,11 +80,18 @@ class ProfitsharingController extends Controller
return Yo::create_echo($p->id);
}
public function eval_action($php, $in_value, $surplus)
public function ee()
{
}
public function eval_action($php, $in_value)
{
$out_value = 0;
if ($php) {
try {
$service_config = Config::where('label', '微信手续费')->first();
$service = $service_config->value;
eval($php);
} catch (Exception $e) {
$out_value = 0;
@ -91,12 +100,22 @@ class ProfitsharingController extends Controller
return $out_value;
}
public function bcceilDecimal($value, $decimal)
{
$multipliedValue = bcmul($value, $decimal, 1);
$roundedValue = ceil($multipliedValue);
return bcdiv($roundedValue, $decimal, 2);
}
public function test(Request $request)
{
$php = $request->post('php');
$in_value = $request->post('in_value');
return Yo::echo([
'out_value' => self::eval_action($php, $in_value, 0),
'out_value' => self::eval_action($php, [
'price' => $in_value,
'hold' => 0
]),
]);
}

@ -5,6 +5,8 @@ namespace App\Http\Controllers;
use App\Models\Appointment;
use App\Models\Hospital;
use App\Models\HospitalExtra;
use App\Models\NoProfitsharing;
use App\Models\ProfitsharingActionLog;
use App\Models\ProfitsharingLog;
use App\Models\UserAccount;
use App\Models\UserOrder;
@ -38,69 +40,116 @@ class UserOrderController extends Controller
$user_order->check_status = 2;
$user_order->check_time = date('Y-m-d H:i:s');
$user_order->save();
if ($user_order->price == $user_order->true_price) {
$hospital_sharing_content = self::sharing_config($user_order->hospital, false);
if ($hospital_sharing_content['open'] == 1
|| $hospital_sharing_content['open'] == 3) {
$slc = ProfitsharingLog::where('order', $user_order->id)->first();
if (!$slc) {
$p = new ProfitsharingController();
$sharing = $p->sharing($user_order->id, $hospital_sharing_content['hospital']);
$receivers = [];
$sharing_map = [];
$hospital_sharing_content = self::sharing_config($user_order->hospital, false);
if ($hospital_sharing_content['open'] == 1
|| $hospital_sharing_content['open'] == 3) {
$slc = ProfitsharingLog::where('order', $user_order->id)->first();
if (!$slc) {
$p = new ProfitsharingController();
$sharing = $p->sharing($user_order->id, $hospital_sharing_content['hospital']);
$receivers = [];
$sharing_map = [];
$price = $user_order->true_price;
$surplus = $price;
foreach ($sharing as $item) {
$formula = $item->formula;
$amount = number_format($p->eval_action($formula, $price, $surplus), 2);
$receivers[] = [
'type' => $item->type == 1 ? 'MERCHANT_ID' : 'PERSONAL_OPENID',
'account' => $item->account,
'amount' => $amount * 100,
'description' => $item->desc
];
$surplus = $surplus - $amount;
$sharing_map[] = [
'amount' => $amount,
'surplus' => $surplus,
'formula' => $formula,
];
}
$np = NoProfitsharing::where('hospital', $user_order->hospital)->orderBy('id', 'desc')->get();
$mp_items = [];
foreach ($np as $item) {
$mp_items[] = $item->item_id;
}
$price = 0;
$hold = 0;
$buy_info = json_decode($user_order->buy_info, true);
if ($buy_info['combo']['id'] != 0) {
foreach ($buy_info['combo']['items'] as $item) {
if ($item['discount_type'] == '打折') {
$item_price = $item['price'] * $item['discount_value'];
} else {
$item_price = $item['price'] - $item['discount_value'];
}
$item_price = floor($item_price * 100) / 100;
if (!in_array($item['id'], $mp_items)) {
$price += $item_price;
} else {
$hold += $item_price;
}
}
}
foreach ($buy_info['items'] as $item) {
$item_price = $item['price'];
if (!in_array($item['id'], $mp_items)) {
$price += $item_price;
} else {
$hold += $item_price;
}
}
if (count($receivers) != 0) {
if ($hospital_sharing_content['open'] == 1) {
$sharing_data = [
'transaction_id' => $user_order->transaction,
'receivers' => $receivers
foreach ($sharing as $item) {
$formula = $item->formula;
$amount = $p->eval_action($formula, [
'price' => $price, // 参与分账的金额
'hold' => $hold, // 不参与分账的金额
]);
$receivers[] = [
'type' => $item->type == 1 ? 'MERCHANT_ID' : 'PERSONAL_OPENID',
'account' => $item->account,
'amount' => intval(bcmul($amount, 100, 0)),
'description' => $item->desc
];
$hospital_extra_content = self::pay_config($user_order->hospital);
$wcp = new WeChatPayController();
$builder_config = [
'appid' => env('WX_APP_ID'),
'pem_path' => base_path() . $hospital_extra_content['wxp']['key'],
'cer_path' => base_path() . $hospital_extra_content['wxp']['crt'],
'cer_num' => $hospital_extra_content['wxp']['number'],
'mchid' => $hospital_extra_content['wxp']['id'],
'v3' => $hospital_extra_content['wxp']['v3'],
$sharing_map[] = [
'amount' => $amount,
'formula' => $formula,
];
$wcp->builder($builder_config);
$res = $wcp->profitsharing($sharing_data);
} else {
$builder_config = [];
$res = [];
$pal = new ProfitsharingActionLog();
$pal->hospital = $item->hospital;
$pal->order = $user_order->id;
$pal->pro_id = $item->id;
$pal->formula = $formula;
$pal->price = $price;
$pal->hold = $hold;
$pal->money = $amount;
$pal->save();
}
$sl = new ProfitsharingLog();
$sl->hospital = $user_order->hospital;
$sl->type = $hospital_sharing_content['open'];
$sl->order = $user_order->id;
$sl->builder = json_encode($builder_config, JSON_UNESCAPED_UNICODE);
$sl->receivers = json_encode($receivers, JSON_UNESCAPED_UNICODE);
$sl->sharing = json_encode($sharing_map, JSON_UNESCAPED_UNICODE);
$sl->response = json_encode($res, JSON_UNESCAPED_UNICODE);
$sl->recover = '{}';
$sl->status = 1;
$sl->save();
if (count($receivers) != 0) {
if ($hospital_sharing_content['open'] == 1) {
$sharing_data = [
'transaction_id' => $user_order->transaction,
'receivers' => $receivers
];
$hospital_extra_content = self::pay_config($user_order->hospital);
$wcp = new WeChatPayController();
$builder_config = [
'appid' => env('WX_APP_ID'),
'pem_path' => base_path() . $hospital_extra_content['wxp']['key'],
'cer_path' => base_path() . $hospital_extra_content['wxp']['crt'],
'cer_num' => $hospital_extra_content['wxp']['number'],
'mchid' => $hospital_extra_content['wxp']['id'],
'v3' => $hospital_extra_content['wxp']['v3'],
];
$wcp->builder($builder_config);
$res = $wcp->profitsharing($sharing_data);
} else {
$builder_config = [];
$res = [
'hold' => $hold,
'price' => $price,
];
}
$sl = new ProfitsharingLog();
$sl->hospital = $user_order->hospital;
$sl->type = $hospital_sharing_content['open'];
$sl->order = $user_order->id;
$sl->builder = json_encode($builder_config, JSON_UNESCAPED_UNICODE);
$sl->receivers = json_encode($receivers, JSON_UNESCAPED_UNICODE);
$sl->sharing = json_encode($sharing_map, JSON_UNESCAPED_UNICODE);
$sl->response = json_encode($res, JSON_UNESCAPED_UNICODE);
$sl->recover = '{}';
$sl->status = 1;
$sl->save();
}
}
}
}
@ -117,6 +166,79 @@ class UserOrderController extends Controller
return Yo::update_echo($appointment_number);
}
public function done_test(Request $request)
{
$id = $request->post('id');
$user_order = UserOrder::where('id', $id)->first();
if (!$user_order) Yo::error_echo(100000, ['订单']);
$hospital_sharing_content = self::sharing_config($user_order->hospital, false);
$receivers = [];
$sharing_map = [];
$price = 0;
$hold = 0;
if ($hospital_sharing_content['open'] == 1
|| $hospital_sharing_content['open'] == 3) {
$p = new ProfitsharingController();
$sharing = $p->sharing($user_order->id, $hospital_sharing_content['hospital']);
$np = NoProfitsharing::where('hospital', $user_order->hospital)->orderBy('id', 'desc')->get();
$mp_items = [];
foreach ($np as $item) {
$mp_items[] = $item->item_id;
}
$price = 0;
$hold = 0;
$buy_info = json_decode($user_order->buy_info, true);
if ($buy_info['combo']['id'] != 0) {
foreach ($buy_info['combo']['items'] as $item) {
if ($item['discount_type'] == '打折') {
$item_price = $item['price'] * $item['discount_value'];
} else {
$item_price = $item['price'] - $item['discount_value'];
}
$item_price = floor($item_price * 100) / 100;;
if (!in_array($item['id'], $mp_items)) {
$price += $item_price;
} else {
$hold += $item_price;
}
}
}
foreach ($buy_info['items'] as $item) {
$item_price = $item['price'];
if (!in_array($item['id'], $mp_items)) {
$price += $item_price;
} else {
$hold += $item_price;
}
}
foreach ($sharing as $item) {
$formula = $item->formula;
$amount = $p->eval_action($formula, [
'price' => $price, // 参与分账的金额
'hold' => $hold, // 不参与分账的金额
]);
$receivers[] = [
'type' => $item->type == 1 ? 'MERCHANT_ID' : 'PERSONAL_OPENID',
'account' => $item->account,
'amount' => intval(bcmul($amount, 100, 0)),
'description' => $item->desc
];
$sharing_map[] = [
'amount' => $amount,
'formula' => $formula,
];
}
}
return Yo::update_echo([
'$hold' => $hold,
'$price' => $price,
'a' => $receivers,
'b' => $sharing_map,
]);
}
public function create_appointment($hospital, $data)
{
$peis = new PEISApiController();
@ -183,6 +305,7 @@ class UserOrderController extends Controller
'id' => 0,
'name' => '自选项目',
'price' => 0,
'items' => []
],
'items' => [],
'group' => [
@ -193,11 +316,13 @@ class UserOrderController extends Controller
$combo_info = $cic->combo_info($hospital, [
'套餐Id' => $combo,
]);
$price += $combo_info['price'];
$buy_info['combo'] = [
'id' => $combo_info['id'],
'name' => $combo_info['name'],
'price' => $combo_info['price'],
'items' => $combo_info['items'],
];
}
$items = $request->post('items');
@ -246,7 +371,9 @@ class UserOrderController extends Controller
}
$check_items = [];
foreach ($items as $item) {
$check_items[] = ['Id' => $item];
$check_items[] = [
'Id' => $item
];
}
if (!!($combo == 0 ? null : $combo) || count($check_items) != 0) {
$item_check = self::item_check($hospital, [
@ -467,7 +594,10 @@ class UserOrderController extends Controller
$buy_info = json_decode($order_info->buy_info, true);
$check_items = [];
foreach ($buy_info['items'] as $item) {
$check_items[] = ['Id' => $item['id']];
$check_items[] = [
'Id' => $item['id'],
'价格' => $item['price']
];
}
$combo = $order_info->combo;
if (!!($combo == 0 ? null : $combo) || count($check_items) != 0) {

@ -28,7 +28,7 @@ class EditProfitsharingsInput extends FormRequest
return [
'account' => ['required', 'between:1,50'],
'name' => ['required', 'between:1,50'],
'formula' => ['required', 'between:1,200'],
'formula' => ['required', 'between:1,2000'],
'desc' => ['between:0,80'],
];
}

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class NoProfitsharing extends Model
{
use HasFactory;
}

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProfitsharingActionLog extends Model
{
use HasFactory;
}

@ -136,4 +136,5 @@ return [
200086 => '描述长度在80位字符以内',
200087 => '请输入分账名称',
200088 => '分账名称长度在1-50位字符之间',
200089 => '分账类型不支持追回',
];

@ -19,7 +19,6 @@ class CreateProfitsharingsTable extends Migration
$table->tinyInteger('type')->comment('1-商户 MERCHANT_ID 2-个人 PERSONAL_OPENID');
$table->string('account', 50);
$table->string('formula', 200);
$table->decimal('max')->comment('最大金额 0-不限制');
$table->string('desc', 80);
$table->tinyInteger('status');
$table->tinyInteger('del')->default(2);

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNoProfitsharingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('no_profitsharings', function (Blueprint $table) {
$table->id();
$table->bigInteger('hospital')->default(0)->index();
$table->string('item_id', 50)->comment('项目ID');
$table->string('desc', 80);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('no_profitsharings');
}
}

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProfitsharingActionLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('profitsharing_action_logs', function (Blueprint $table) {
$table->id();
$table->bigInteger('hospital')->index();
$table->bigInteger('order')->index();
$table->bigInteger('pro_id')->index();
$table->string('formula', 200);
$table->decimal('price');
$table->decimal('hold');
$table->decimal('money');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('profitsharing_action_logs');
}
}

@ -21,6 +21,12 @@ Route::get('/', function () {
Route::any('api/yo', \App\Http\Controllers\YoController::class);
Route::post("api/In/Order/update", [\App\Http\Controllers\UserOrderController::class, 'check_order']);
Route::post("api/Pay/Wxp/callback/{id}", [\App\Http\Controllers\UserOrderController::class, 'callback']);
Route::post("api/Test/UserOrder/done_test", [\App\Http\Controllers\UserOrderController::class, 'done_test']);
Route::post("api/$admin_api/NoProfitsharing/create", [\App\Http\Controllers\NoProfitsharingController::class, 'create']);
Route::post("api/$admin_api/NoProfitsharing/update", [\App\Http\Controllers\NoProfitsharingController::class, 'update']);
Route::post("api/$admin_api/NoProfitsharing/delete", [\App\Http\Controllers\NoProfitsharingController::class, 'delete']);
Route::post("api/$admin_api/NoProfitsharing/list", [\App\Http\Controllers\NoProfitsharingController::class, 'list']);
Route::post("api/$admin_api/ProfitsharingLog/list", [\App\Http\Controllers\ProfitsharingLogController::class, 'list']);

Loading…
Cancel
Save