|
|
@@ -554,22 +554,6 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
554
|
554
|
//定时任务写日账单,月账单
|
|
555
|
555
|
public function cron($day,$mer_id=496)
|
|
556
|
556
|
{
|
|
557
|
|
- // $day=date('Y-m-d', strtotime('-1 days'));
|
|
558
|
|
- // $enterprise_bill_item=[];
|
|
559
|
|
- // $order= $order_query->select();
|
|
560
|
|
- // foreach ($order as $v) {
|
|
561
|
|
- // $arr = [];
|
|
562
|
|
- // $arr['mer_id'] = $mer_id;
|
|
563
|
|
- // $arr['transaction_time'] = $v['pay_time'];
|
|
564
|
|
- // $arr['money'] = $v['pay_price'];
|
|
565
|
|
- // $arr['uid'] = $v['uid'];
|
|
566
|
|
- // $arr['order_sn'] = $v['order_sn'];
|
|
567
|
|
- // $arr['type'] = 1;
|
|
568
|
|
- // $enterprise_bill_item[] = $arr;
|
|
569
|
|
- // }
|
|
570
|
|
- // if ($enterprise_bill_item) {
|
|
571
|
|
- // Db::name('enterprise_bill_item')->insertAll($enterprise_bill_item);
|
|
572
|
|
- // }
|
|
573
|
557
|
|
|
574
|
558
|
Db::name('enterprise_day_bill')->where('mer_id', $mer_id)->where('day', $day)->delete();
|
|
575
|
559
|
|
|
|
@@ -1154,7 +1138,16 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1154
|
1138
|
return app('json')->success('获取平台收支明细成功');
|
|
1155
|
1139
|
}
|
|
1156
|
1140
|
|
|
1157
|
|
- public function platform_income_detail_get1()
|
|
|
1141
|
+ /**
|
|
|
1142
|
+ * 生成平台收支明细,从而生成 日账单 月账单
|
|
|
1143
|
+ * 平台收入:线上订单表、线下订单表、话费表
|
|
|
1144
|
+ * 平台支出:用户提现、商户分账
|
|
|
1145
|
+ * @return mixed
|
|
|
1146
|
+ * @throws DataNotFoundException
|
|
|
1147
|
+ * @throws DbException
|
|
|
1148
|
+ * @throws ModelNotFoundException
|
|
|
1149
|
+ */
|
|
|
1150
|
+ public function platform_income_detail_get_new($start_time, $end_time)
|
|
1158
|
1151
|
{
|
|
1159
|
1152
|
|
|
1160
|
1153
|
// 1、获取所有 商户 商户名称非空, 状态为正常、商户状态为开启
|
|
|
@@ -1198,29 +1191,62 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1198
|
1191
|
->toArray();
|
|
1199
|
1192
|
$group_order_map = array_column($group_order, null, 'group_order_id');
|
|
1200
|
1193
|
// 京豆
|
|
1201
|
|
- $jingdou_list = Db::name("user_sign_jingdou")
|
|
|
1194
|
+ $jingdou_list_by_online = Db::name("user_sign_jingdou")
|
|
1202
|
1195
|
->where('order_type', '=','0')
|
|
1203
|
1196
|
->where('status', '=',1)
|
|
1204
|
1197
|
->whereIn('order_id', array_column($store_order_list,'order_id'))
|
|
1205
|
1198
|
->select()
|
|
1206
|
1199
|
->toArray();
|
|
1207
|
|
- $jingdou_map = array_reduce($jingdou_list, function($result, $jingdou) {
|
|
|
1200
|
+ $jingdou_map_by_online = array_reduce($jingdou_list_by_online, function($result, $jingdou_by_online) {
|
|
1208
|
1201
|
// 根据 mer_id 进行分组
|
|
1209
|
|
- $result[$jingdou['order_id']][] = $jingdou;
|
|
|
1202
|
+ $result[$jingdou_by_online['order_id']][] = $jingdou_by_online;
|
|
1210
|
1203
|
return $result;
|
|
1211
|
1204
|
}, []);
|
|
1212
|
|
- // // 查询分账信息
|
|
1213
|
|
- // $store_split_order = Db::name('store_split_order')
|
|
1214
|
|
- // ->whereIn('group_order_id', array_column($group_order,'group_order_sn'))
|
|
1215
|
|
- // ->where('status', 1)
|
|
1216
|
|
- // ->select()
|
|
1217
|
|
- // ->toArray();
|
|
1218
|
|
- // $store_split_order_map = array_column($store_split_order, null, 'group_order_id');
|
|
|
1205
|
+
|
|
|
1206
|
+ // 线下扫码
|
|
|
1207
|
+ $order_merchant_list = Db::name('order_merchant')
|
|
|
1208
|
+ ->whereIn('mer_id', $merchant_list)
|
|
|
1209
|
+ ->where('status', 1) // '0待支付,1已支付,2申请退款,3退款完成 5 已失效',
|
|
|
1210
|
+ // ->where('arrive', 1) // 是否到账,系统应该是没对该字段进行维护 全是0
|
|
|
1211
|
+ ->where('paid', 1)
|
|
|
1212
|
+ ->where('binds', 0)
|
|
|
1213
|
+ ->whereNotNull('pay_time')
|
|
|
1214
|
+ ->order('id', 'desc')
|
|
|
1215
|
+ ->select()
|
|
|
1216
|
+ ->toArray();
|
|
|
1217
|
+ $order_merchant_map = array_reduce($order_merchant_list, function($result, $order) {
|
|
|
1218
|
+ // 根据 mer_id 进行分组
|
|
|
1219
|
+ $result[$order['mer_id']][] = $order;
|
|
|
1220
|
+ return $result;
|
|
|
1221
|
+ }, []);
|
|
|
1222
|
+ // 京豆
|
|
|
1223
|
+ $jingdou_list_by_offline = Db::name("user_sign_jingdou")
|
|
|
1224
|
+ ->where('order_type', '=','10')
|
|
|
1225
|
+ ->where('status', '=',1)
|
|
|
1226
|
+ ->whereIn('order_id', array_column($order_merchant_list,'id'))
|
|
|
1227
|
+ ->select()
|
|
|
1228
|
+ ->toArray();
|
|
|
1229
|
+ $jingdou_map_by_offline = array_reduce($jingdou_list_by_offline, function($result, $jingdou_by_offline) {
|
|
|
1230
|
+ // 根据 mer_id 进行分组
|
|
|
1231
|
+ $result[$jingdou_by_offline['order_id']][] = $jingdou_by_offline;
|
|
|
1232
|
+ return $result;
|
|
|
1233
|
+ }, []);
|
|
|
1234
|
+ // 话费
|
|
|
1235
|
+ $order_huafei_list = Db::name('order_huafei')
|
|
|
1236
|
+ ->where('status', 2) // '订单状态 0 待支付 1 已付 充值中 2充值成功 3充值失败 需要退款 4退款成功 5已超时 6待充值 7 已匹配 8已存单 9 已取消 10返销 11部分到账 12取消中'
|
|
|
1237
|
+ // ->where('arrive', 1) // 是否到账,系统应该是没对该字段进行维护 全是0
|
|
|
1238
|
+ // ->whereNotNull('finish_time')
|
|
|
1239
|
+ ->order('order_huafei_id', 'desc')
|
|
|
1240
|
+ ->select()
|
|
|
1241
|
+ ->toArray();
|
|
|
1242
|
+
|
|
1219
|
1243
|
|
|
1220
|
1244
|
// 4、循环所有商户ID
|
|
1221
|
1245
|
/** @var OrderMerchantRepository $OrderMerchantRepository */
|
|
1222
|
1246
|
$OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
|
|
1223
|
1247
|
foreach ($merchant_list as $mer_id) {
|
|
|
1248
|
+ // 线上订单
|
|
|
1249
|
+ $online_data_list = [];
|
|
1224
|
1250
|
foreach ($store_order_map[$mer_id] as $store_order) {
|
|
1225
|
1251
|
// 判断该笔订单是否已 存在 平台收支明细表 的记录中
|
|
1226
|
1252
|
if (!in_array('1' . $store_order['uid'] . $store_order['order_sn'] . $store_order['order_id'] . '0' . $mer_id, $unique_list)) {
|
|
|
@@ -1231,8 +1257,9 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1231
|
1257
|
$vr = 0.00;
|
|
1232
|
1258
|
$jd = 0.00;
|
|
1233
|
1259
|
$fg = 0.00;
|
|
|
1260
|
+ $fenrun = $store_order['con_pri'] ?: 0.00;
|
|
1234
|
1261
|
if (!empty($store_order['fzone_pay_type'])) {
|
|
1235
|
|
- $cost = bcsub($store_order['total_price'], $store_order['con_pri'] ?: 0.00, 2);
|
|
|
1262
|
+ $cost = bcsub($store_order['total_price'], $fenrun, 2);
|
|
1236
|
1263
|
if (in_array($store_order['fzone_pay_type'], ['a2', 'a3', 'b2', 'b4', 'b6'])) {
|
|
1237
|
1264
|
$money = $cost;
|
|
1238
|
1265
|
} else if (in_array($store_order['fzone_pay_type'], ['a1', 'b1', 'b5'])) {
|
|
|
@@ -1241,12 +1268,12 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1241
|
1268
|
$fg = $cost;
|
|
1242
|
1269
|
}
|
|
1243
|
1270
|
}
|
|
1244
|
|
- if (!empty($jingdou_map[$store_order['order_id']])) {
|
|
1245
|
|
- $jd = array_sum(array_column($jingdou_map[$store_order['order_id']], 'number'));
|
|
|
1271
|
+ if (!empty($jingdou_map_by_online[$store_order['order_id']])) {
|
|
|
1272
|
+ $jd = array_sum(array_column($jingdou_map_by_online[$store_order['order_id']], 'number'));
|
|
1246
|
1273
|
}
|
|
1247
|
1274
|
|
|
1248
|
|
- Db::name('enterprise_platform_income_detail')
|
|
1249
|
|
- ->insert([
|
|
|
1275
|
+
|
|
|
1276
|
+ $online_data_list[] = [
|
|
1250
|
1277
|
'mer_id' => $mer_id,
|
|
1251
|
1278
|
'uid' => $store_order['uid'],
|
|
1252
|
1279
|
'title' => '订单入账',
|
|
|
@@ -1254,17 +1281,66 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1254
|
1281
|
'deal_time' => $store_order['pay_time'] ?: date('Y-m-d H:i:s'),
|
|
1255
|
1282
|
'money' => $money,
|
|
1256
|
1283
|
'deal_type' => 1,
|
|
|
1284
|
+ 'order_type' => 0,
|
|
1257
|
1285
|
'order_id' => $store_order['order_id'],
|
|
1258
|
1286
|
'order_sn' => $store_order['order_sn'],
|
|
1259
|
1287
|
'user_extra_id' => '',
|
|
1260
|
1288
|
'pm' => 1,
|
|
1261
|
1289
|
'create_time' => date('Y-m-d H:i:s'),
|
|
1262
|
1290
|
'vr' => $vr,
|
|
1263
|
|
- 'jd' => $jd,
|
|
1264
|
|
- 'fg' => $fg
|
|
1265
|
|
- ]);
|
|
|
1291
|
+ 'jingdou' => $jd,
|
|
|
1292
|
+ 'fg' => $fg,
|
|
|
1293
|
+ 'fenrun' => $fenrun, // 让利
|
|
|
1294
|
+ ];
|
|
|
1295
|
+ }
|
|
|
1296
|
+ }
|
|
|
1297
|
+ if (!empty($online_data_list)) {
|
|
|
1298
|
+ Db::name('enterprise_platform_income_detail')
|
|
|
1299
|
+ ->insertAll($online_data_list);
|
|
|
1300
|
+ }
|
|
|
1301
|
+
|
|
|
1302
|
+ // 线下订单 0平台1多多进宝2唯品会3苏宁易购4网易考拉5淘宝客6京东联盟7饿了么8线上 9话费 10 线下
|
|
|
1303
|
+ $offline_data_list = [];
|
|
|
1304
|
+ foreach ($order_merchant_map[$mer_id] as $order_merchant) {
|
|
|
1305
|
+ // 判断该笔订单是否已 存在 平台收支明细表 的记录中
|
|
|
1306
|
+ if (!in_array('1' . $order_merchant['uid'] . $order_merchant['out_trade_no'] . $order_merchant['order_id'] . '0' . $mer_id, $unique_list)) {
|
|
|
1307
|
+ // 经过和领导确认,入账 金额为 订单金额 - 让利金额 - 手续费
|
|
|
1308
|
+
|
|
|
1309
|
+ $money = $order_merchant['mer_money'] ?: 0.00;
|
|
|
1310
|
+ $vr = 0.00;
|
|
|
1311
|
+ $jd = 0.00;
|
|
|
1312
|
+ $fg = 0.00;
|
|
|
1313
|
+ $fenrun = $order_merchant['mer_fanyong'] ?: 0.00;
|
|
|
1314
|
+ if (!empty($jingdou_map_by_offline[$order_merchant['id']])) {
|
|
|
1315
|
+ $jd = array_sum(array_column($jingdou_map_by_offline[$order_merchant['id']], 'number'));
|
|
|
1316
|
+ }
|
|
|
1317
|
+
|
|
|
1318
|
+ $offline_data_list[] = [
|
|
|
1319
|
+ 'mer_id' => $mer_id,
|
|
|
1320
|
+ 'uid' => $order_merchant['uid'],
|
|
|
1321
|
+ 'title' => '订单入账',
|
|
|
1322
|
+ 'deal_order_sn' => $OrderMerchantRepository->getNewOrderId('jy2'),
|
|
|
1323
|
+ 'deal_time' => $order_merchant['pay_time'] ?: date('Y-m-d H:i:s'),
|
|
|
1324
|
+ 'money' => $money,
|
|
|
1325
|
+ 'deal_type' => 1,
|
|
|
1326
|
+ 'order_type' => 10,
|
|
|
1327
|
+ 'order_id' => $order_merchant['id'],
|
|
|
1328
|
+ 'order_sn' => $order_merchant['out_trade_no'],
|
|
|
1329
|
+ 'user_extra_id' => '',
|
|
|
1330
|
+ 'pm' => 1,
|
|
|
1331
|
+ 'create_time' => date('Y-m-d H:i:s'),
|
|
|
1332
|
+ 'vr' => $vr,
|
|
|
1333
|
+ 'jingdou' => $jd,
|
|
|
1334
|
+ 'fg' => $fg,
|
|
|
1335
|
+ 'fenrun' => $fenrun,
|
|
|
1336
|
+ ];
|
|
1266
|
1337
|
}
|
|
1267
|
1338
|
}
|
|
|
1339
|
+ if (!empty($offline_data_list)) {
|
|
|
1340
|
+ Db::name('enterprise_platform_income_detail')
|
|
|
1341
|
+ ->insertAll($offline_data_list);
|
|
|
1342
|
+ }
|
|
|
1343
|
+
|
|
1268
|
1344
|
$start_time = '2025-01-22';
|
|
1269
|
1345
|
for ($i = 0; $i < 1000; $i++) {
|
|
1270
|
1346
|
$day = date('Y-m-d', strtotime("+{$i} days", strtotime($start_time)));
|
|
|
@@ -1275,8 +1351,38 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1275
|
1351
|
}
|
|
1276
|
1352
|
}
|
|
1277
|
1353
|
|
|
1278
|
|
- //5用户佣金提现
|
|
1279
|
1354
|
$mer_id = 0;
|
|
|
1355
|
+
|
|
|
1356
|
+ $order_huafei_data_list = [];
|
|
|
1357
|
+ foreach ($order_huafei_list as $order_huafei) {
|
|
|
1358
|
+ if (!in_array('1' . $order_huafei['uid'] . $order_huafei['order_sn'] . $order_huafei['order_huafei_id'] . '0' . $mer_id, $unique_list)) {
|
|
|
1359
|
+ $order_huafei_data_list[] = [
|
|
|
1360
|
+ 'mer_id' => $mer_id,
|
|
|
1361
|
+ 'uid' => $order_huafei['uid'],
|
|
|
1362
|
+ 'title' => '订单入账',
|
|
|
1363
|
+ 'deal_order_sn' => $OrderMerchantRepository->getNewOrderId('jy2'),
|
|
|
1364
|
+ 'deal_time' => $order_huafei['finish_time'] ?: date('Y-m-d H:i:s'),
|
|
|
1365
|
+ 'money' => $order_huafei['cost_price'],
|
|
|
1366
|
+ 'deal_type' => 1,
|
|
|
1367
|
+ 'order_type' => 9,
|
|
|
1368
|
+ 'order_id' => $order_huafei['order_huafei_id'],
|
|
|
1369
|
+ 'order_sn' => $order_huafei['order_sn'],
|
|
|
1370
|
+ 'user_extra_id' => '',
|
|
|
1371
|
+ 'pm' => 1,
|
|
|
1372
|
+ 'create_time' => date('Y-m-d H:i:s'),
|
|
|
1373
|
+ 'vr' => 0.00,
|
|
|
1374
|
+ 'jingdou' => 0.00,
|
|
|
1375
|
+ 'fg' => 0.00,
|
|
|
1376
|
+ 'fenrun' => $order_huafei['fanli_price'] // 让利
|
|
|
1377
|
+ ];
|
|
|
1378
|
+ }
|
|
|
1379
|
+ }
|
|
|
1380
|
+ if (!empty($order_huafei_data_list)) {
|
|
|
1381
|
+ Db::name('enterprise_platform_income_detail')
|
|
|
1382
|
+ ->insertAll($order_huafei_data_list);
|
|
|
1383
|
+ }
|
|
|
1384
|
+
|
|
|
1385
|
+ // 5用户佣金提现
|
|
1280
|
1386
|
$user_extract_list = Db::name('user_extract')
|
|
1281
|
1387
|
->field('extract_id,uid,extract_type,extract_price,service_money,order_sn,status_time')
|
|
1282
|
1388
|
->where('status', 1)
|
|
|
@@ -1301,9 +1407,160 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
|
|
1301
|
1407
|
'create_time' => date('Y-m-d H:i:s'),
|
|
1302
|
1408
|
]);
|
|
1303
|
1409
|
}
|
|
|
1410
|
+
|
|
|
1411
|
+ // // 查询分账信息
|
|
|
1412
|
+ // $store_split_order = Db::name('store_split_order')
|
|
|
1413
|
+ // ->where('status', 1)
|
|
|
1414
|
+ // ->select()
|
|
|
1415
|
+ // ->toArray();
|
|
|
1416
|
+ // $store_split_order_map = array_column($store_split_order, null, 'group_order_id');
|
|
|
1417
|
+ // 待完善
|
|
|
1418
|
+
|
|
1304
|
1419
|
return app('json')->success('获取平台收支明细成功');
|
|
1305
|
1420
|
}
|
|
1306
|
1421
|
|
|
|
1422
|
+ public function set_enterprise_bill($start_time, $end_time)
|
|
|
1423
|
+ {
|
|
|
1424
|
+ // 1、查出 时间范围内的 平台收支明细
|
|
|
1425
|
+ $enterprise_platform_income_detail_list = Db::name('enterprise_platform_income_detail')
|
|
|
1426
|
+ // deal_time格式 2025-03-10 10:44:34
|
|
|
1427
|
+ ->whereBetween('deal_time', [$start_time, $end_time])
|
|
|
1428
|
+ ->select()
|
|
|
1429
|
+ ->toArray();
|
|
|
1430
|
+
|
|
|
1431
|
+ // 2、根据时间进行分组
|
|
|
1432
|
+ $enterprise_platform_income_detail_map = array_reduce($enterprise_platform_income_detail_list, function ($result, $enterprise_platform_income_detail) {
|
|
|
1433
|
+ // 根据 mer_id 进行分组
|
|
|
1434
|
+ $result[date('Y-m-d', strtotime($enterprise_platform_income_detail['deal_time']))][] = $enterprise_platform_income_detail;
|
|
|
1435
|
+ return $result;
|
|
|
1436
|
+ }, []);
|
|
|
1437
|
+
|
|
|
1438
|
+ // 3、循环计算平台当天内的 收支流水
|
|
|
1439
|
+ foreach ($enterprise_platform_income_detail_map as $day => $enterprise_platform_income_detail_list_by_day) {
|
|
|
1440
|
+ $day_bill_map = [];
|
|
|
1441
|
+ // 平台的日账单
|
|
|
1442
|
+ $day_bill_map[$day . '-0'] = [
|
|
|
1443
|
+ 'mer_id' => 0,
|
|
|
1444
|
+ 'day' => $day,
|
|
|
1445
|
+ 'flow' => 0.00,
|
|
|
1446
|
+ 'expenditure' => 0.00,
|
|
|
1447
|
+ 'balance' => 0.00,
|
|
|
1448
|
+ 'jingdou' => 0.00,
|
|
|
1449
|
+ 'fenrun' => 0.00,
|
|
|
1450
|
+ 'vr' => 0.00,
|
|
|
1451
|
+ 'jd' => 0.00,
|
|
|
1452
|
+ 'fg' => 0.00
|
|
|
1453
|
+ ];
|
|
|
1454
|
+ foreach ($enterprise_platform_income_detail_list_by_day as $enterprise_platform_income_detail) {
|
|
|
1455
|
+ /**
|
|
|
1456
|
+ * `id` int(10) NOT NULL AUTO_INCREMENT,
|
|
|
1457
|
+ * `mer_id` int(11) NOT NULL DEFAULT '0' COMMENT '商户id',
|
|
|
1458
|
+ * `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
1459
|
+ * `day` date DEFAULT NULL COMMENT '日期',
|
|
|
1460
|
+ * `flow` double(11,2) NOT NULL DEFAULT '0.00' COMMENT '订单流水',
|
|
|
1461
|
+ * `expenditure` double(11,2) NOT NULL DEFAULT '0.00' COMMENT '支出金额',
|
|
|
1462
|
+ * `accounting` double(11,2) NOT NULL DEFAULT '0.00' COMMENT '入账金额',
|
|
|
1463
|
+ * `balance` double(11,2) NOT NULL DEFAULT '0.00' COMMENT '结余',
|
|
|
1464
|
+ * `jingdou` double(11,2) NOT NULL DEFAULT '0.00' COMMENT '京豆',
|
|
|
1465
|
+ * `fenrun` double(11,2) NOT NULL DEFAULT '0.00' COMMENT '分润',
|
|
|
1466
|
+ * `vr` decimal(12,2) DEFAULT NULL COMMENT 'VR',
|
|
|
1467
|
+ * `jd` decimal(12,2) DEFAULT NULL COMMENT '京豆',
|
|
|
1468
|
+ * `fg` decimal(12,2) DEFAULT NULL COMMENT '复购金',
|
|
|
1469
|
+ */
|
|
|
1470
|
+ if (!isset($day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']])) {
|
|
|
1471
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']] = [
|
|
|
1472
|
+ 'mer_id' => $enterprise_platform_income_detail['mer_id'],
|
|
|
1473
|
+ 'day' => $day,
|
|
|
1474
|
+ 'flow' => 0.00,
|
|
|
1475
|
+ 'expenditure' => 0.00,
|
|
|
1476
|
+ 'balance' => 0.00,
|
|
|
1477
|
+ 'jingdou' => 0.00,
|
|
|
1478
|
+ 'fenrun' => 0.00,
|
|
|
1479
|
+ 'vr' => 0.00,
|
|
|
1480
|
+ 'jd' => 0.00,
|
|
|
1481
|
+ 'fg' => 0.00
|
|
|
1482
|
+ ];
|
|
|
1483
|
+ }
|
|
|
1484
|
+ if($enterprise_platform_income_detail['pm'] == 1) {
|
|
|
1485
|
+ // 订单总价
|
|
|
1486
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['flow'] += ($enterprise_platform_income_detail['money'] + $enterprise_platform_income_detail['vr'] + $enterprise_platform_income_detail['fg'] + $enterprise_platform_income_detail['fenrun']);
|
|
|
1487
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1488
|
+ $day_bill_map[$day . '-0']['flow'] += ($enterprise_platform_income_detail['money'] + $enterprise_platform_income_detail['vr'] + $enterprise_platform_income_detail['fg'] + $enterprise_platform_income_detail['fenrun']);
|
|
|
1489
|
+ }
|
|
|
1490
|
+ // 入账现金
|
|
|
1491
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['accounting'] += $enterprise_platform_income_detail['money'];
|
|
|
1492
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1493
|
+ $day_bill_map[$day . '-0']['accounting'] += $enterprise_platform_income_detail['money'];
|
|
|
1494
|
+ }
|
|
|
1495
|
+ // VR
|
|
|
1496
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['vr'] += $enterprise_platform_income_detail['vr'];
|
|
|
1497
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1498
|
+ $day_bill_map[$day . '-0']['vr'] += $enterprise_platform_income_detail['vr'];
|
|
|
1499
|
+ }
|
|
|
1500
|
+ // 复购
|
|
|
1501
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['fg'] += $enterprise_platform_income_detail['fg'];
|
|
|
1502
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1503
|
+ $day_bill_map[$day . '-0']['fg'] += $enterprise_platform_income_detail['fg'];
|
|
|
1504
|
+ }
|
|
|
1505
|
+ // 分润
|
|
|
1506
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['fenrun'] += $enterprise_platform_income_detail['fenrun'];
|
|
|
1507
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1508
|
+ $day_bill_map[$day . '-0']['fenrun'] += $enterprise_platform_income_detail['fenrun'];
|
|
|
1509
|
+ }
|
|
|
1510
|
+ // 获得的京豆
|
|
|
1511
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['jingdou'] += $enterprise_platform_income_detail['jingdou'];
|
|
|
1512
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1513
|
+ $day_bill_map[$day . '-0']['jingdou'] += $enterprise_platform_income_detail['jingdou'];
|
|
|
1514
|
+ }
|
|
|
1515
|
+ // 现金结余
|
|
|
1516
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['balance'] += $enterprise_platform_income_detail['money'];
|
|
|
1517
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1518
|
+ $day_bill_map[$day . '-0']['balance'] += $enterprise_platform_income_detail['money'];
|
|
|
1519
|
+ }
|
|
|
1520
|
+ }
|
|
|
1521
|
+ if($enterprise_platform_income_detail['pm'] == 0) {
|
|
|
1522
|
+
|
|
|
1523
|
+ // 支出现金
|
|
|
1524
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['expenditure'] += $enterprise_platform_income_detail['money'];
|
|
|
1525
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1526
|
+ $day_bill_map[$day . '-0']['expenditure'] += $enterprise_platform_income_detail['money'];
|
|
|
1527
|
+ }
|
|
|
1528
|
+ // VR
|
|
|
1529
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['vr'] -= $enterprise_platform_income_detail['vr'];
|
|
|
1530
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1531
|
+ $day_bill_map[$day . '-0']['vr'] -= $enterprise_platform_income_detail['vr'];
|
|
|
1532
|
+ }
|
|
|
1533
|
+ // 复购
|
|
|
1534
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['fg'] -= $enterprise_platform_income_detail['fg'];
|
|
|
1535
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1536
|
+ $day_bill_map[$day . '-0']['fg'] -= $enterprise_platform_income_detail['fg'];
|
|
|
1537
|
+ }
|
|
|
1538
|
+ // 分润
|
|
|
1539
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['fenrun'] -= $enterprise_platform_income_detail['fenrun'];
|
|
|
1540
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1541
|
+ $day_bill_map[$day . '-0']['fenrun'] -= $enterprise_platform_income_detail['fenrun'];
|
|
|
1542
|
+ }
|
|
|
1543
|
+ // 获得的京豆
|
|
|
1544
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['jingdou'] -= $enterprise_platform_income_detail['jingdou'];
|
|
|
1545
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1546
|
+ $day_bill_map[$day . '-0']['jingdou'] -= $enterprise_platform_income_detail['jingdou'];
|
|
|
1547
|
+ }
|
|
|
1548
|
+ // 现金结余
|
|
|
1549
|
+ $day_bill_map[$day . '-' . $enterprise_platform_income_detail['mer_id']]['balance'] -= $enterprise_platform_income_detail['money'];
|
|
|
1550
|
+ if ($enterprise_platform_income_detail['mer_id'] != 0) {
|
|
|
1551
|
+ $day_bill_map[$day . '-0']['balance'] -= $enterprise_platform_income_detail['money'];
|
|
|
1552
|
+ }
|
|
|
1553
|
+ }
|
|
|
1554
|
+
|
|
|
1555
|
+ }
|
|
|
1556
|
+
|
|
|
1557
|
+ }
|
|
|
1558
|
+ // 3.1 再根据每天内的商户分组
|
|
|
1559
|
+
|
|
|
1560
|
+ // 4、根据开始时间,的上一个月,到当前时间的上一个月,查看是否有 月统计数据
|
|
|
1561
|
+ // 4.1补齐月数据
|
|
|
1562
|
+ }
|
|
|
1563
|
+
|
|
1307
|
1564
|
public function clear_platform_income_detail()
|
|
1308
|
1565
|
{
|
|
1309
|
1566
|
|