diff --git a/admin/index.html b/admin/index.html
index 79f29a1..08cdea0 100644
--- a/admin/index.html
+++ b/admin/index.html
@@ -18,7 +18,7 @@
break
}
}
- // env = 'online'
+ env = 'online'
// env = 'dev'
const api_url = {
main: 'https://health.cjy.net.cn'
diff --git a/admin/src/api/index.js b/admin/src/api/index.js
index c875ac3..aa05120 100644
--- a/admin/src/api/index.js
+++ b/admin/src/api/index.js
@@ -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)
diff --git a/admin/src/components/additional/additional12.vue b/admin/src/components/additional/additional12.vue
new file mode 100644
index 0000000..79a752c
--- /dev/null
+++ b/admin/src/components/additional/additional12.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+ 确定
+ 取消
+
+
+
+
+
+
+
+ 项目ID
+
+
+
+
+
+ 项目描述
+
+
+
+
确定
+
+
+
+
+
+
+ 项目ID
+
+
+
+
+
+ 项目描述
+
+
+
+
确定
+
+
+
+
+
+
+
+ 新建
+ 删除
+ 修改信息
+
+
+
+
+
+
+
+
diff --git a/admin/src/pages/config/additional.vue b/admin/src/pages/config/additional.vue
index 6a5afca..8eeb053 100644
--- a/admin/src/pages/config/additional.vue
+++ b/admin/src/pages/config/additional.vue
@@ -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)
+
diff --git a/admin/src/pages/order/super_sharing.vue b/admin/src/pages/order/super_sharing.vue
index ad7e849..e814d28 100644
--- a/admin/src/pages/order/super_sharing.vue
+++ b/admin/src/pages/order/super_sharing.vue
@@ -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',
diff --git a/app/Http/Controllers/ComboItemController.php b/app/Http/Controllers/ComboItemController.php
index eb2aec0..b3486b5 100644
--- a/app/Http/Controllers/ComboItemController.php
+++ b/app/Http/Controllers/ComboItemController.php
@@ -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']);
diff --git a/app/Http/Controllers/HospitalController.php b/app/Http/Controllers/HospitalController.php
index 328dd0d..7718c47 100644
--- a/app/Http/Controllers/HospitalController.php
+++ b/app/Http/Controllers/HospitalController.php
@@ -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();
diff --git a/app/Http/Controllers/NoProfitsharingController.php b/app/Http/Controllers/NoProfitsharingController.php
new file mode 100644
index 0000000..28f5ecd
--- /dev/null
+++ b/app/Http/Controllers/NoProfitsharingController.php
@@ -0,0 +1,82 @@
+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()
+ ]);
+ }
+}
diff --git a/app/Http/Controllers/ProfitsharingActionLogController.php b/app/Http/Controllers/ProfitsharingActionLogController.php
new file mode 100644
index 0000000..8ca7790
--- /dev/null
+++ b/app/Http/Controllers/ProfitsharingActionLogController.php
@@ -0,0 +1,25 @@
+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
+ ]);
+ }
+}
diff --git a/app/Http/Controllers/ProfitsharingController.php b/app/Http/Controllers/ProfitsharingController.php
index 0bdeee9..ae57a3c 100644
--- a/app/Http/Controllers/ProfitsharingController.php
+++ b/app/Http/Controllers/ProfitsharingController.php
@@ -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
+ ]),
]);
}
diff --git a/app/Http/Controllers/UserOrderController.php b/app/Http/Controllers/UserOrderController.php
index 7bd9c6d..1b2d787 100644
--- a/app/Http/Controllers/UserOrderController.php
+++ b/app/Http/Controllers/UserOrderController.php
@@ -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) {
diff --git a/app/Http/Requests/EditProfitsharingsInput.php b/app/Http/Requests/EditProfitsharingsInput.php
index 4c4388b..05671e2 100644
--- a/app/Http/Requests/EditProfitsharingsInput.php
+++ b/app/Http/Requests/EditProfitsharingsInput.php
@@ -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'],
];
}
diff --git a/app/Models/NoProfitsharing.php b/app/Models/NoProfitsharing.php
new file mode 100644
index 0000000..8bdc4c9
--- /dev/null
+++ b/app/Models/NoProfitsharing.php
@@ -0,0 +1,11 @@
+ '描述长度在80位字符以内',
200087 => '请输入分账名称',
200088 => '分账名称长度在1-50位字符之间',
+ 200089 => '分账类型不支持追回',
];
diff --git a/database/migrations/2023_09_05_230430_create_profitsharings_table.php b/database/migrations/2023_09_05_230430_create_profitsharings_table.php
index 608b1f7..c425620 100644
--- a/database/migrations/2023_09_05_230430_create_profitsharings_table.php
+++ b/database/migrations/2023_09_05_230430_create_profitsharings_table.php
@@ -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);
diff --git a/database/migrations/2024_01_19_092133_create_no_profitsharings_table.php b/database/migrations/2024_01_19_092133_create_no_profitsharings_table.php
new file mode 100644
index 0000000..e32a0a1
--- /dev/null
+++ b/database/migrations/2024_01_19_092133_create_no_profitsharings_table.php
@@ -0,0 +1,34 @@
+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');
+ }
+}
diff --git a/database/migrations/2024_01_20_101329_create_profitsharing_action_logs_table.php b/database/migrations/2024_01_20_101329_create_profitsharing_action_logs_table.php
new file mode 100644
index 0000000..1eb131f
--- /dev/null
+++ b/database/migrations/2024_01_20_101329_create_profitsharing_action_logs_table.php
@@ -0,0 +1,38 @@
+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');
+ }
+}
diff --git a/routes/web.php b/routes/web.php
index 5797bec..2ca2e8f 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -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']);