| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927 |
- <?php
- declare (strict_types=1);
- namespace app\command;
- use app\common\model\merchant\order\OrderMerchant;
- use app\common\model\store\order\StoreOrder;
- use app\common\model\user\User;
- use app\common\model\user\UserCertification;
- use app\common\repositories\merchant\order\OrderGzcRepository;
- use app\common\repositories\merchant\order\OrderMerchantRepository;
- use app\common\repositories\store\order\StoreOrderStatusRepository;
- use app\common\repositories\store\product\ProductRepository;
- use app\common\repositories\user\UserBillRepository;
- use app\common\repositories\user\UserRepository;
- use app\traits\GzcApiRequest;
- use Carbon\Carbon;
- use think\console\Command;
- use think\console\Input;
- use think\console\Output;
- use think\Exception;
- use think\facade\Db;
- use think\facade\Log;
- use app\common\repositories\store\order\StoreOrderRepository;
- /**
- * Class PensionTasks
- * @package app\command
- * @author: php迷途小书童
- * @created: 2021/3/19 9:14
- */
- class PensionTasks extends Command
- {
- use GzcApiRequest;
- protected function configure()
- {
- // 指令配置
- $this->setName('pensiontask')
- ->setDescription('the pensiontask command');
- }
- protected function execute(Input $input, Output $output)
- {
- //1线下2在线3拼多多4京东5苏宁6淘宝7VIP
- $nowTime = time();
- try {
- //线下符合条件的养老金收集(线下交易后第8天)
- // $this->doOfflineOrderGzc($nowTime, $timeLimit = 1);
- // $this->doOnlineOrderGzc($timeLimit = 30);
- // $this->doOnlineHuuafeiOrderGzc($timeLimit = 30);
- $this->onlineOrderNew($timeLimit = 30);
- $this->huafeiOrderNew($timeLimit = 30);
- $this->pddOrderNew($timeLimit = 30);
- $this->jdOrderNew($timeLimit = 30);
- $this->suOrderNew($timeLimit = 30);
- $this->taobaoOrderNew($timeLimit = 30);
- $this->vipOrderNew($timeLimit = 30);
- $this->dyOrderNew($timeLimit = 30);
- // $this->doThridPddOrderGzc($nowTime, $timeLimit = 30);
- // $this->doThridJdOrderGzc($nowTime, $timeLimit = 30);
- // $this->doThridSnOrderGzc($nowTime, $timeLimit = 30);
- // $this->doThridTaobaoOrderGzc($nowTime, $timeLimit = 30);
- // $this->doThridVipOrderGzc($nowTime, $timeLimit = 30);
- // $this->doThridDyOrderGzc($nowTime, $timeLimit = 30);
- // $this->doThridHfOrderGzc($nowTime, $timeLimit = 30);
- // $this->billGzcAdd($nowTime);
- //升级
- // $this -> doUpgrade();
- } catch (\Throwable $e) {
- Log::info('公证处入账:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】');
- var_dump('公证处入账:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】');
- }
- // 指令输出
- $output->writeln('pensiontask');
- }
- /**
- * 线下支付订单公证处IN10入账
- * @param $nowTime
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function billGzcAdd($nowTime)
- {
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- $cursor = Db::name('user_bill')
- ->where('status', 1)
- ->where('is_gzc', 0)
- ->where('commission_type', 5)
- ->select()->toArray();
- if($cursor) {
- foreach ($cursor as $bill) {
- $type_shop = $bill['type_shop'] ?? 0;
- switch ($type_shop){
- case "0":
- $online = $cursor = Db::table('rrx_store_order')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->where('paid', 1)->find();
- break;
- case "1":
- $online = Db::table('rrx_order_pdd')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
- break;
- case "2":
- $online = Db::table('rrx_order_vip')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
- break;
- case "3":
- $online = Db::table('rrx_order_su')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
- break;
- case "4":
- $online = '';
- break;
- case "5":
- $online = Db::table('rrx_order_tb')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
- break;
- case "6":
- $online = Db::table('rrx_order_jd')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
- break;
- case "7":
- $online = '';
- break;
- case "8":
- $online = '';
- break;
- case "9":
- $online = Db::table('rrx_order_huafei')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->find();
- break;
- default:
- $online = Db::table('rrx_store_order')->where('uid', $bill['uid'])->where('order_sn', $bill['order_sn'])->where('paid', 1)->find();
- }
- if (!$online) {
- Log::info($bill['uid'] . '查询不到订单');
- continue;
- }
- $certification = UserCertification::getInstance()->where('uid', $bill['uid'])->find();
- if (!$certification) {
- Log::info($online['uid'] . '没有实名认证');
- continue;
- }
- $pension = $bill['number'] ?? 0;
- if ($pension <= 0) {
- Log::info($online['order_sn'] . 'pension' . $pension);
- continue;
- }
- //新增入账明细记录
- $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- $create = [
- 'uid' => $online['uid'],
- 'platform_no' => $orderId,
- 'account_type' => 1,
- 'user_name' => $certification['user_name'],
- 'mobile' => $certification['mobile'],
- 'user_card' => $certification['user_card'],
- 'pension' => $pension,
- 'order_type' => $type_shop,
- 'out_trade_no' => $online['order_sn'],
- 'link_id'=> $bill['bill_id']
- ];
- $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
- $check = Db::name("gzc_logs")->where("link_id", $bill['bill_id'])->where("order_type", $type_shop)->count();
- if ($test_user == 0 && $check <= 0) {
- $OrderGzcRepository->create($create);
- Db::name('user_bill')
- ->where('bill_id', $bill['bill_id'])
- ->where('commission_type', 5)
- ->update([
- 'is_gzc' => 1,
- 'gzc' => 1
- ]);
- }
- }
- }
- }
- /**
- * 线下支付订单公证处IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doOfflineOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_merchant')
- ->whereNotNull('pay_time')
- ->where('paid', 1)
- ->where('gzc', 0)
- ->whereTime('pay_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $offline) {
- if ($offline['mer_id'] == 496) {
- continue;
- }
- $uid = 0;
- switch ($offline['trade_type']) {
- case 'WX':
- $uid = User::getInstance()->where('wechat_user_id', $offline['pay_user_id'])->value('uid');
- $accountType = 3;
- break;
- case 'ALI':
- $uid = User::getInstance()->where('ali_user_id', $offline['pay_user_id'])->value('uid');
- $accountType = 2;
- break;
- default:
- break;
- }
- if (!$uid) {
- Log::info($offline['pay_user_id'] . '未绑定用户');
- continue;
- }
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info($offline['pay_user_id'] . '未实名认证');
- // continue;
- // }
- //查询养老金金额
- $UserBillRepository = app()->make(UserBillRepository::class);
- $bill = $UserBillRepository->getWhere(['uid' => $uid, 'link_id' => $offline['id'], 'order_sn' => $offline['out_trade_no'], 'title' => '养老金']);
- $pension = $bill->number ?? 0;
- // if ($pension <= 0) {
- // Log::info($offline['out_trade_no'] . 'pension' . $pension);
- // continue;
- // }
- // Db::transaction(function () use ($uid, $certification, $accountType, $offline, $OrderGzcRepository, $OrderMerchantRepository, $pension, $StoreOrderRepository) {
- Db::transaction(function () use ($uid, $accountType, $offline, $OrderGzcRepository, $OrderMerchantRepository, $pension, $StoreOrderRepository) {
- $order = OrderMerchant::getInstance()->find($offline['id']);
- $order->gzc = 1;
- $order->is_settlement = 1;
- $order->settlement_time = date('Y-m-d H:i:s');
- $order->save();
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'account_type' => $accountType,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 1,
- // 'out_trade_no' => $offline['out_trade_no']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- // // 养老金区域奖励
- // $order_data = [
- // 'pay_price' => $pension,
- // 'user_address_ids' => $offline['user_address_ids'],
- // 'uid' => $offline['uid'],
- // 'order_sn' => $offline['out_trade_no']
- // ];
- // $StoreOrderRepository->area_manage_details($order_data, 0, 2);
- // 结算红包
- // $user_sign_hongbao_list = Db::name('user_sign_hongbao')
- // ->where('status', -1)
- // ->where('order_id', $offline['id'])
- // ->whereIn('type', [1, 2])
- // ->select()
- // ->toArray();
- // foreach ($user_sign_hongbao_list as $user_sign_hongbao) {
- // if($user_sign_hongbao['uid']){
- // // 修改红包
- // Db::name('user')
- // ->where('uid', $user_sign_hongbao['uid'])
- // ->inc('hongbao', (float)$user_sign_hongbao['number'])
- // ->update();
- // Db::name('user_sign_hongbao')
- // ->where('status', -1)
- // ->where('id', $user_sign_hongbao['id'])
- // ->update([
- // 'status' => 1,
- // 'settlement_time' => date('Y-m-d H:i:s')
- // ]);
- // }
- // }
- // // 结算积分
- // $user_sign_score_list = Db::name('user_sign_score')
- // ->where('status', -1)
- // ->where('order_id', $offline['id'])
- // ->whereIn('type', [1, 2])
- // ->select()
- // ->toArray();
- // foreach ($user_sign_score_list as $user_sign_score) {
- // if($user_sign_score['uid']){
- // // 修改积分
- // Db::name('user')
- // ->where('uid', $user_sign_score['uid'])
- // ->inc('score', (float)$user_sign_score['reward_socre'])
- // ->update();
- // Db::name('user_sign_score')
- // ->where('status', -1)
- // ->where('id', $user_sign_score['id'])
- // ->update([
- // 'status' => 1,
- // 'settlement_time' => date('Y-m-d H:i:s')
- // ]);
- // }
- // }
- // // 结算贡献值
- // $user_sign_gongxian_list = Db::name('user_sign_gongxian')
- // ->where('status', -1)
- // ->where('order_id', $offline['id'])
- // ->whereIn('type', [1, 2])
- // ->select()
- // ->toArray();
- // foreach ($user_sign_gongxian_list as $user_sign_gongxian) {
- // if($user_sign_gongxian['uid']){
- // // 修改贡献值
- // Db::name('user')
- // ->where('uid', $user_sign_gongxian['uid'])
- // ->inc('contribute', (float)$user_sign_gongxian['number'])
- // ->update();
- // Db::name('user_sign_gongxian')
- // ->where('status', -1)
- // ->where('id', $user_sign_gongxian['id'])
- // ->update([
- // 'status' => 1,
- // 'settlement_time' => date('Y-m-d H:i:s')
- // ]);
- // }
- // }
- // // 结算佣金
- // $user_bill_list = Db::name('user_bill')
- // ->where('status', 0)
- // ->where('commission_type','<>', 5)
- // ->where([ 'link_id' => $offline['id'], 'order_sn' => $offline['order_sn']])
- // ->select()
- // ->toArray();
- // foreach ($user_bill_list as $user_bill) {
- // if($user_bill['uid']){
- // if ($user_bill['commission_type'] != 5) {
- // if (in_array($user_bill['commission_type'], [7,12,19])) {
- // Db::name("merchant")
- // ->where("mer_id", $user_bill['mer_id'])
- // ->inc('brokerage_price', (float)$user_bill['number'])
- // ->update();
- // } else {
- // Db::name('user')
- // ->where('uid', $user_bill['uid'])
- // ->inc('brokerage_price', (float)$user_bill['number'])
- // ->update();
- // }
- // }
- // }
- // }
- });
- }
- }
- /**
- * 话费支付订单公证处IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doOnlineHuuafeiOrderGzc($timeLimit)
- {
- // 普通订单
- $cursor = Db::table('rrx_order_huafei')->where('status', 3)->where('gzc', 0)->cursor();
- $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- foreach ($cursor as $online) {
-
- if (time() < strtotime($online['finish_time']) + 3600 * 24) {
- Log::info('还没有话费到账后' . $timeLimit . '天');
- continue;
- }
-
- $certification = UserCertification::getInstance()->where('uid', $online['uid'])->find();
- if (!$certification) {
- Log::info($online['uid'] . '没有实名认证');
- continue;
- }
- //查询养老金金额
- $UserBillRepository = app()->make(UserBillRepository::class);
- $bill = $UserBillRepository->getWhere(['uid' => $online['uid'], 'order_sn' => $online['order_sn'], 'commission_type' => 5]);
- $pension = $bill->number ?? 0;
- if ($pension <= 0) {
- Log::info($online['order_sn'] . 'pension' . $pension);
- continue;
- }
-
- //首信易分账
- // $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- // if ($online['pay_type'] > 0) {
- // $StoreOrderRepository->splitOrder($online);
- // }
- $StoreOrderRepository = [];
- Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- $create = [
- 'uid' => $online['uid'],
- 'platform_no' => $orderId,
- 'account_type' => 3,//账号类型1银行卡2支付宝3微信
- 'user_name' => $certification['user_name'],
- 'mobile' => $certification['mobile'],
- 'user_card' => $certification['user_card'],
- 'pension' => $pension,
- 'order_type' => 2,
- 'out_trade_no' => $online['order_sn']
- ];
- $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
- $check = Db::name("gzc_logs")->where("out_trade_no", $online['order_sn'])->where("order_type", 2)->count();
- if ($test_user == 0 && $check <= 0) {
- $OrderGzcRepository->create($create);
- }
- $order = StoreOrder::getInstance()->find($online['order_id']);
- $order->gzc = 1;
- $order->save();
- });
- }
- // 普通订单(红包,积分,京东,佣金,复购金,养老金,贡献值)
- $cursor = Db::table('rrx_order_huafei')->where('status', 3)->where('bill_status', 0)->cursor();
- $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- foreach ($cursor as $online) {
- if (time() < strtotime($online['finish_time']) + 3600 * 24) {
- Log::info('还没有话费到账后' . $timeLimit . '天');
- continue;
- }
-
- Db::transaction(function () use ($online) {
- //订单状态改为已结算
- Db::name('rrx_order_huafei')
- ->where('status', 3)->where('bill_status', 0)
- ->where('order_sn', $online['order_sn'])
- ->update([
- 'bill_status'=> 1,
- 'bill_create_time' => time()
- ]);
- // 结算积分
- $user_sign_score_list = Db::name('user_sign_score')
- ->where('status', -1)
- ->where('order_id', $online['order_sn'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_score_list as $user_sign_score) {
- // 修改积分
- Db::name('user')
- ->where('uid', $user_sign_score['uid'])
- ->inc('score', (float)$user_sign_score['reward_socre'])
- ->update();
- Db::name('user_sign_score')
- ->where('status', -1)
- ->where('id', $user_sign_score['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- // 结算复购金
- $user_sign_fugou_list = Db::name('user_sign_fugou')
- ->where('status', -1)
- ->where('order_id', $online['order_sn'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_fugou_list as $user_sign_fugou) {
- // 修改复购金
- Db::name('user')
- ->where('uid', $user_sign_fugou['uid'])
- ->inc('fugou', (float)$user_sign_fugou['number'])
- ->update();
- Db::name('user_sign_fugou')
- ->where('status', -1)
- ->where('id', $user_sign_fugou['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- // 结算贡献值
- $user_sign_gongxian_list = Db::name('user_sign_gongxian')
- ->where('status', -1)
- ->where('order_id', $online['order_sn'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_gongxian_list as $user_sign_gongxian) {
- // 修改贡献值
- Db::name('user')
- ->where('uid', $user_sign_gongxian['uid'])
- ->inc('contribute', (float)$user_sign_gongxian['number'])
- ->update();
- Db::name('user_sign_gongxian')
- ->where('status', -1)
- ->where('id', $user_sign_gongxian['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- /** @var UserRepository $userRepository */
- $userRepository = app()->make(UserRepository::class);
- $userRepository->setUserIdentity($user_sign_gongxian['uid']);
- }
- });
- }
- }
-
- /**
- * 在线支付公证处IN10入账 (红包,积分,京东,佣金,复购金,养老金,贡献值)
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:25
- */
- public function doOnlineOrderGzc($timeLimit)
- {
- return true;
- // 普通订单
- $cursor = Db::table('rrx_store_order')->where('paid', 1)->where('gzc', 0)->where('pay_type', 'in', '0,1,2,4')->cursor();
- $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- foreach ($cursor as $online) {
- $status = $StoreOrderStatusRepository->getWhere(['order_id' => $online['order_id'], 'change_type' => 'take']);
- if ($online['mer_id'] == 496) {
- if (!in_array($online['status'], [0, 1, 2, 3])) {
- continue;
- }
- // if (time() < strtotime($online['pay_time']) + 3600 * 24) {
- // Log::info('还没有到收货后' . $timeLimit . '天');
- // continue;
- // }
- } else {
- if (!in_array($online['status'], [2, 3])) {
- continue;
- }
- if (Carbon::now()->modify("-{$timeLimit} days")->lt($status->change_time ?? $status['change_time'])) {
- Log::info('还没有到收货后' . $timeLimit . '天');
- continue;
- }
- }
- // $certification = UserCertification::getInstance()->where('uid', $online['uid'])->find();
- // if (!$certification) {
- // Log::info($online['uid'] . '没有实名认证');
- // continue;
- // }
- //查询养老金金额
- $UserBillRepository = app()->make(UserBillRepository::class);
- $bill = $UserBillRepository->getWhere(['uid' => $online['uid'], 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn'], 'commission_type' => 5]);
- $pension = $bill->number ?? 0;
- // if ($pension <= 0) {
- // Log::info($online['order_sn'] . 'pension' . $pension);
- // continue;
- // }
- //首信易分账
- // $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- // if ($online['pay_type'] > 0) {
- // $StoreOrderRepository->splitOrder($online);
- // }
- Db::transaction(function () use ($online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $online['uid'],
- // 'platform_no' => $orderId,
- // 'account_type' => $online['pay_type'] == 1 ? 3 : 2,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 2,
- // 'out_trade_no' => $online['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
- // $check = Db::name("gzc_logs")->where("out_trade_no", $online['order_sn'])->where("order_type", 2)->count();
- // if ($test_user == 0 && $check <= 0) {
- // $OrderGzcRepository->create($create);
- // }
- $order = StoreOrder::getInstance()->find($online['order_id']);
- $order->gzc = 1;
- $order->save();
- Db::name('user_bill')
- ->where('order_sn', $online['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- // $order_data = [
- // 'pay_price' => $pension,
- // 'user_address_ids' => $online['user_address_ids'],
- // 'uid' => $online['uid'],
- // 'order_sn' => $online['order_sn']
- // ];
- // $StoreOrderRepository->area_manage_details($order_data, 8, 2);
- });
- }
- // 普通订单(红包,积分,京东,佣金,复购金,贡献值)
- $cursor = Db::table('rrx_store_order')->where('paid', 1)->where('is_settlement', 0)->where('pay_type', 'in', '0,1,2,4')->cursor();
- $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- foreach ($cursor as $online) {
- $status = $StoreOrderStatusRepository->getWhere(['order_id' => $online['order_id'], 'change_type' => 'take']);
- if ($online['mer_id'] == 496) {
- if (!in_array($online['status'], [0, 1, 2, 3])) {
- continue;
- }
- if (time() < strtotime($online['pay_time']) + 3600 * 24) {
- Log::info('还没有到收货后' . $timeLimit . '天');
- continue;
- }
- } else {
- if (!in_array($online['status'], [2, 3])) {
- continue;
- }
- if (Carbon::now()->modify("-{$timeLimit} days")->lt($status->change_time ?? $status['change_time'])) {
- Log::info('还没有到收货后' . $timeLimit . '天');
- continue;
- }
- }
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- Db::transaction(function () use ($online, $StoreOrderRepository) {
- $order = StoreOrder::getInstance()->find($online['order_id']);
- $order->is_settlement = 1;
- $order->settlement_time = date('Y-m-d H:i:s');
- $order->save();
- // 结算积分
- $user_sign_score_list = Db::name('user_sign_score')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_score_list as $user_sign_score) {
- // 修改积分
- Db::name('user')
- ->where('uid', $user_sign_score['uid'])
- ->inc('score', (float)$user_sign_score['reward_socre'])
- ->update();
- Db::name('user_sign_score')
- ->where('status', -1)
- ->where('id', $user_sign_score['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- // 结算红包
- $user_sign_hongbao_list = Db::name('user_sign_hongbao')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_hongbao_list as $user_sign_hongbao) {
- // 修改红包
- Db::name('user')
- ->where('uid', $user_sign_hongbao['uid'])
- ->inc('hongbao', (float)$user_sign_hongbao['number'])
- ->update();
- Db::name('user_sign_hongbao')
- ->where('status', -1)
- ->where('id', $user_sign_hongbao['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- // 结算京豆
- $user_sign_jingdou_list = Db::name('user_sign_jingdou')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_jingdou_list as $user_sign_jingdou) {
- // 修改京豆
- Db::name('user')
- ->where('uid', $user_sign_jingdou['uid'])
- ->inc('jingdou', (float)$user_sign_jingdou['number'])
- ->update();
- Db::name('user_sign_jingdou')
- ->where('status', -1)
- ->where('id', $user_sign_jingdou['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- // 结算复购金
- $user_sign_fugou_list = Db::name('user_sign_fugou')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_fugou_list as $user_sign_fugou) {
- // 修改复购金
- Db::name('user')
- ->where('uid', $user_sign_fugou['uid'])
- ->inc('fugou', (float)$user_sign_fugou['number'])
- ->update();
- Db::name('user_sign_fugou')
- ->where('status', -1)
- ->where('id', $user_sign_fugou['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- // 结算贡献值
- $user_sign_gongxian_list = Db::name('user_sign_gongxian')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- foreach ($user_sign_gongxian_list as $user_sign_gongxian) {
- // 修改贡献值
- Db::name('user')
- ->where('uid', $user_sign_gongxian['uid'])
- ->inc('contribute', (float)$user_sign_gongxian['number'])
- ->update();
- Db::name('user_sign_gongxian')
- ->where('status', -1)
- ->where('id', $user_sign_gongxian['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- /** @var UserRepository $userRepository */
- $userRepository = app()->make(UserRepository::class);
- $userRepository->setUserIdentity($user_sign_gongxian['uid']);
- }
- // 结算PV值
- $user_pv_list = Db::name('user_pv_log')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->whereIn('type', [1, 2])
- ->select()
- ->toArray();
- if($user_pv_list) {
- foreach ($user_pv_list as $user_pv) {
- // 修改pv
- Db::name('user')
- ->where('uid', $user_pv['uid'])
- ->inc('pv', (float)$user_pv['pv'])
- ->update();
- Db::name('user_pv_log')
- ->where('status', -1)
- ->where('id', $user_pv['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- // 结算佣金
- $user_bill_list = Db::name('user_bill')
- ->where('status', 0)
- ->where('commission_type','<>', 5)
- ->where([ 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn']])
- ->select()
- ->toArray();
- foreach ($user_bill_list as $user_bill) {
- if ($user_bill['commission_type'] != 5) {
- if (in_array($user_bill['commission_type'], [7,12,19])) {
- Db::name("merchant")
- ->where("mer_id", $user_bill['mer_id'])
- ->inc('brokerage_price', (float)$user_bill['number'])
- ->update();
- } else {
- Db::name('user')
- ->where('uid', $user_bill['uid'])
- ->inc('brokerage_price', (float)$user_bill['number'])
- ->update();
- }
- }
- if ($online['pay_type'] == 0 && $user_bill['commission_type'] == 5) {
- } else {
- // 虚拟支付的养老金不修改不结算
- Db::name('user_bill')
- ->where('status', 0)
- ->where('bill_id', $user_bill['bill_id'])
- ->update([
- 'status' => 1,
- 'take_time' => time()
- ]);
- }
- if ($online['pay_type'] == 0 && $user_bill['commission_type'] == 5) {
- } else {
- // 虚拟支付的养老金不修改不结算
- Db::name('user_bill')
- ->where('status', 0)
- ->where('bill_id', $user_bill['bill_id'])
- ->update([
- 'status' => 1,
- 'take_time' => time()
- ]);
- }
- }
- //按角色结算
- $StoreOrderRepository->close_order($online['order_id']);
- });
- }
- }
- /**
- * 第三方订单拼多多IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridPddOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_pdd')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 3,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- // $OrderGzcRepository->create($create);
- Db::table('rrx_order_pdd')
- ->update(['gzc' => 1, 'order_pdd_id' => $thrid['order_pdd_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- $order_data = [
- 'pay_price' => $pension,
- 'user_address_ids' => $thrid['user_address_ids'],
- 'uid' => $thrid['uid'],
- 'order_sn' => $thrid['order_sn']
- ];
- // $StoreOrderRepository->area_manage_details($order_data, 1, 2);
- });
- }
- }
- /**
- * 第三方订单京东IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridJdOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_jd')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- // Db::name('log')->insert(['data'=>'abbbb入库语句'.$nowTime - bcmul((string)$timeLimit, (string)86400)]);
- // Db::name('log')->insert(['data'=>'abbbb'.json_encode($cursor)]);
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 4,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- // $OrderGzcRepository->create($create);
- Db::table('rrx_order_jd')
- ->update(['gzc' => 1, 'order_jd_id' => $thrid['order_jd_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- // $order_data = [
- // 'pay_price' => $pension,
- // 'user_address_ids' => $thrid['user_address_ids'],
- // 'uid' => $thrid['uid'],
- // 'order_sn' => $thrid['order_sn']
- // ];
- // $StoreOrderRepository->area_manage_details($order_data, 6, 2);
- });
- }
- }
- /**
- * 第三方订单苏宁IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridSnOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_su')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 5,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- // $OrderGzcRepository->create($create);
- Db::table('rrx_order_su')
- ->update(['gzc' => 1, 'order_su_id' => $thrid['order_su_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- $order_data = [
- 'pay_price' => $pension,
- 'user_address_ids' => $thrid['user_address_ids'],
- 'uid' => $thrid['uid'],
- 'order_sn' => $thrid['order_sn']
- ];
- // $StoreOrderRepository->area_manage_details($order_data, 3, 2);
- });
- }
- }
- /**
- * 第三方订单话费IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridHfOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_huafei')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository) {
- // //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 6,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- Db::table('rrx_order_huafei')->update(['gzc' => 1, 'order_tb_id' => $thrid['order_tb_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- });
- }
- }
- /**
- * 第三方订单淘宝IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridTaobaoOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_tb')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 6,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- // $OrderGzcRepository->create($create);
- Db::table('rrx_order_tb')
- ->update(['gzc' => 1, 'order_tb_id' => $thrid['order_tb_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- $order_data = [
- 'pay_price' => $pension,
- 'user_address_ids' => $thrid['user_address_ids'],
- 'uid' => $thrid['uid'],
- 'order_sn' => $thrid['order_sn']
- ];
- // $StoreOrderRepository->area_manage_details($order_data, 5, 2);
- });
- }
- }
- /**
- * 第三方订单唯品会IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridVipOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_vip')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 7,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- // $OrderGzcRepository->create($create);
- Db::table('rrx_order_vip')
- ->update(['gzc' => 1, 'order_vip_id' => $thrid['order_vip_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- $order_data = [
- 'pay_price' => $pension,
- 'user_address_ids' => $thrid['user_address_ids'],
- 'uid' => $thrid['uid'],
- 'order_sn' => $thrid['order_sn']
- ];
- // $StoreOrderRepository->area_manage_details($order_data, 2, 2);
- });
- }
- }
- /**
- * 第三方订单抖音IN10入账
- * @param $nowTime
- * @param $timeLimit
- * author: php迷途小书童
- * created: 2021/3/20 9:26
- */
- public function doThridDyOrderGzc($nowTime, $timeLimit)
- {
- $cursor = Db::table('rrx_order_dy')
- ->where('gzc', 0)
- ->where('bill_status', 1)
- ->where('commission', '>', 0)
- ->whereTime('bill_end_time', '<', $nowTime - bcmul((string)$timeLimit, (string)86400))
- ->cursor();
- $ProductRepository = app()->make(ProductRepository::class);
- $OrderGzcRepository = app()->make(OrderGzcRepository::class);
- $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
- foreach ($cursor as $thrid) {
- $uid = $thrid['uid'];
- if (!$uid)
- continue;
- // $certification = UserCertification::getInstance()->where('uid', $uid)->find();
- // if (!$certification) {
- // Log::info('用户ID' . $uid . '未实名认证');
- // continue;
- // }
- $pension = $ProductRepository->yanglaojin(0, sprintf('%.2f', $thrid['commission']));
- Db::transaction(function () use ($uid, $thrid, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
- // //新增入账明细记录
- // $orderId = $OrderMerchantRepository->getNewOrderId('IN10');
- // $create = [
- // 'uid' => $uid,
- // 'platform_no' => $orderId,
- // 'user_name' => $certification['user_name'],
- // 'mobile' => $certification['mobile'],
- // 'user_card' => $certification['user_card'],
- // 'pension' => $pension,
- // 'order_type' => 8,
- // 'out_trade_no' => $thrid['order_sn']
- // ];
- // $test_user = Db::name('user')->where('uid', $uid)->value('test_user');
- // if ($test_user == 0) {
- // $OrderGzcRepository->create($create);
- // }
- Db::table('rrx_order_dy')
- ->update(['gzc' => 1, 'order_dy_id' => $thrid['order_dy_id']]);
- Db::name('user_bill')
- ->where('order_sn', $thrid['order_sn'])
- ->where('commission_type', 5)
- ->update(['status'=> 1]);
- // 养老金区域奖励
- $order_data = [
- 'pay_price' => $pension,
- 'user_address_ids' => $thrid['user_address_ids'],
- 'uid' => $thrid['uid'],
- 'order_sn' => $thrid['order_sn']
- ];
- // $StoreOrderRepository->area_manage_details($order_data, 9, 2);
- });
- }
- }
- /**
- * 志愿者升级
- * */
- public function doUpgrade()
- {
- set_time_limit(0);
- try {
- //志愿者条件
- $volunteer_achievement = systemConfig("volunteer_achievement"); //volunteer_achievement:用户本人满足养老金要求可升级为志愿者
- //一星条件
- $a_volunteer_achievement = systemConfig("a_volunteer_achievement");//团队养老金要求
- $a_volunteer_number = systemConfig("a_volunteer_number"); //团队人数要求
- //二星条件
- $b_volunteer_achievement = systemConfig("b_volunteer_achievement");//团队养老金要求
- $b_volunteer_number = systemConfig("b_volunteer_number"); //团队人数要求
- //三星条件
- $c_volunteer_achievement = systemConfig("c_volunteer_achievement");//团队养老金要求
- $c_volunteer_number = systemConfig("c_volunteer_number"); //团队人数要求
- //董事条件
- $d_volunteer_achievement = systemConfig("d_volunteer_achievement");//团队养老金要求
- $d_volunteer_number = systemConfig("d_volunteer_number"); //团队人数要求
- //用户列表
- $userList = Db::name("User")
- ->field("uid")
- ->select();
- foreach ($userList as $key => $value) {
- $volunteer = $this->volunteer($value['uid']);
- //本人养老金小于志愿者要求
- if ($volunteer['self_yanglao'] < $volunteer_achievement) {
- $this->grade($value['uid'], 0, $volunteer);
- }
- //满足志愿者要求
- if ($volunteer['self_yanglao'] >= $volunteer_achievement) {
- //志愿者
- if ($volunteer['team'] < $a_volunteer_number || $volunteer['yanglao'] < $a_volunteer_achievement) {
- $this->grade($value['uid'], 1, $volunteer);
- }
- //一星
- if ($volunteer['team'] >= $a_volunteer_number && $volunteer['yanglao'] >= $a_volunteer_achievement//满足一星条件
- &&
- ($volunteer['team'] < $b_volunteer_number || $volunteer['yanglao'] < $b_volunteer_achievement)//未满足二星条件
- ) {
- $this->grade($value['uid'], 2, $volunteer);
- }
- //二星
- if ($volunteer['team'] >= $b_volunteer_number && $volunteer['yanglao'] >= $b_volunteer_achievement//满足二星条件
- &&
- ($volunteer['team'] < $c_volunteer_number || $volunteer['yanglao'] < $c_volunteer_achievement)//未满足三星条件
- ) {
- $this->grade($value['uid'], 3, $volunteer);
- }
- //三星
- if ($volunteer['team'] >= $c_volunteer_number && $volunteer['yanglao'] >= $c_volunteer_achievement//满足三星条件
- &&
- ($volunteer['team'] < $d_volunteer_number || $volunteer['yanglao'] < $d_volunteer_achievement)//未满足董事条件
- ) {
- $this->grade($value['uid'], 4, $volunteer);
- }
- //董事
- if ($volunteer['team'] >= $d_volunteer_number && $volunteer['yanglao'] >= $d_volunteer_achievement) {
- $this->grade($value['uid'], 5, $volunteer);
- }
- }
- //团队各等级数量统计
- $this->statistics($value['uid']);
- }
- } catch (Exception $e) {
- Log::info('志愿者升级:' . $e->getMessage());
- }
- }
- //志愿者信息
- public function volunteer($uid)
- {
- if (!$uid) {
- return false;
- }
- //本人养老金
- $data['self_yanglao'] = $this->getYanglao($uid);
- //团队人数
- $data['team'] = $this->volunteer_number($uid);
- //团队养老金
- $data['yanglao'] = $this->volunteer_achievement($uid);
- //直推人数
- $data['extension'] = Db::name("user_identity_log")->where(["uid" => $uid])->count();
- //直推商户数量
- $data['shop'] = Db::name("user_identity_log")->where(["uid" => $uid, 'identity' => 4])->whereNotIn("identity", "0")->count();
- return $data;
- }
- //团队人数
- public function volunteer_number($uid)
- {
- $number = 0;
- $number1 = Db::name("user_identity_log")->where(["uid" => $uid])->field("link_id")->select();
- $number += count($number1);
- foreach ($number1 as $key => $value) {
- $number += Db::name("user_identity_log")->where(["uid" => $value['link_id']])->field("link_id")->count();
- }
- return $number;
- }
- //团队养老金
- public function volunteer_achievement($uid)
- {
- $yanglao = 0;
- $number1 = Db::name("user_identity_log")->where(["uid" => $uid])->field("link_id")->select();
- foreach ($number1 as $key => $value) {
- $yanglao += $this->getYanglao($value['link_id']);
- $number2 = Db::name("user_identity_log")->where(["uid" => $value['link_id']])->field("link_id")->select();
- foreach ($number2 as $k => $v) {
- $yanglao += $this->getYanglao($v['link_id']);
- }
- unset($number2);
- }
- return $yanglao;
- }
- //用户养老金
- public function getYanglao($uid)
- {
- return Db::name("UserBill")
- ->where([
- 'uid' => $uid,
- 'commission_type' => 5,
- 'status' => 1,
- 'pm' => 1
- ])
- ->sum("number");
- }
- //升级
- public function grade($uid, $grade, $volunteer)
- {
- $exist = Db::name("Volunteer")->where(["uid" => $uid])->find();
- if ($exist) {
- Db::name("Volunteer")
- ->where(["uid" => $uid])
- ->update([
- "grade" => $grade,
- "team" => $volunteer['team'],
- "yanglao" => $volunteer['yanglao'],
- "extension" => $volunteer['extension'],
- "shop" => $volunteer['shop'],
- "time" => time()
- ]);
- return true;
- }
- Db::name("Volunteer")
- ->insert([
- "uid" => $uid,
- "grade" => $grade,
- "team" => $volunteer['team'],
- "yanglao" => $volunteer['yanglao'],
- "extension" => $volunteer['extension'],
- "shop" => $volunteer['shop'],
- "time" => time()
- ]
- );
- return true;
- }
- //下级各等级数量统计
- public function statistics($uid)
- {
- $data = [
- 'v' => 0,
- 'v1' => 0,
- 'v2' => 0,
- 'v3' => 0,
- 'v4' => 0
- ];
- $fns = function ($uid) use (&$fns, &$data) {
- $identity = Db::name("user_identity_log")
- ->alias("u")
- ->join("Volunteer v", "u.link_id = v.uid")
- ->where(["u.uid" => $uid])
- ->field("u.link_id,v.grade")
- ->select();
- if ($identity) {
- foreach ($identity as $key => $value) {
- if ($value['grade'] == 1) {
- $data['v']++;
- }
- if ($value['grade'] == 2) {
- $data['v1']++;
- }
- if ($value['grade'] == 3) {
- $data['v2']++;
- }
- if ($value['grade'] == 4) {
- $data['v3']++;
- }
- if ($value['grade'] == 5) {
- $data['v4']++;
- }
- $fns($value['link_id']);
- }
- }
- };
- $fns($uid);
- Db::name("Volunteer")
- ->where(["uid" => $uid])
- ->update([
- "v" => $data['v'],
- "v1" => $data['v1'],
- "v2" => $data['v2'],
- "v3" => $data['v3'],
- "v4" => $data['v4'],
- "time" => time()
- ]);
- return $data;
- }
- /**
- * 线上订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function onlineOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('store_order')->where('paid', 1)->where('is_settlement', 0)->where('pay_type', 'in', '0,1,2,4')->where([['status','in','2,3']])->select();
- $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('store_order')->where('order_id', $online['order_id'])->update(['is_settlement' => 1 ,'settlement_time' => date('Y-m-d H:i:s')]);
- });
- }
- }
- }
- /**
- * 话费订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function huafeiOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_huafei')->where('status', 2)->where('gzc' , 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_huafei_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_huafei')->where('order_huafei_id', $online['order_huafei_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 拼多多订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function pddOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_pdd')->where('pin_order_status', 5)->where('gzc', 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_pdd_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_pdd')->where('order_pdd_id', $online['order_pdd_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 京东订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function jdOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_jd')->where('status', 17)->where('gzc', 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_jd_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_jd')->where('order_jd_id', $online['order_jd_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 苏宁订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function suOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_su')->where('status', '确认收货')->where('gzc', 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_su_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_su')->where('order_su_id', $online['order_su_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 淘宝订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function taobaoOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_tb')->where('tk_status', 3)->where('gzc', 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_tb_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_tb')->where('order_tb_id', $online['order_tb_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 唯品会订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function vipOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_vip')->where('status', 2)->where('gzc', 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_vip_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_vip')->where('order_vip_id', $online['order_vip_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 抖音订单结算
- * @param $timeLimit
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function dyOrderNew($timeLimit)
- {
- // 普通订单
- $order_data = Db::name('order_dy')->where('flow_point', 'SETTLE')->where('gzc', 0)->select();
- if($order_data) {
- $order_data = $order_data->toArray();
- foreach ($order_data as $online) {
- $date = date('Y-m-d H:i:s', strtotime('-' . $timeLimit . ' days'));
- if($date < $online['create_time']) continue;
- $online['order_id'] = $online['order_dy_id'];
- Db::transaction(function () use ($online) {
- $this->settleAward($online);
- Db::name('order_dy')->where('order_dy_id', $online['order_dy_id'])->update(['gzc' => 1]);
- });
- }
- }
- }
- /**
- * 结算奖励
- * @param $online
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function settleAward($online)
- {
- // 结算积分
- $user_sign_score_list = Db::name('user_sign_score')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->where('pm', 1)
- ->select()
- ->toArray();
- if($user_sign_score_list){
- foreach ($user_sign_score_list as $user_sign_score) {
- // 修改积分
- Db::name('user')
- ->where('uid', $user_sign_score['uid'])
- ->inc('score', floatval($user_sign_score['reward_socre']))
- ->update();
- Db::name('user_sign_score')
- ->where('id', $user_sign_score['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- // 结算红包
- $user_sign_hongbao_list = Db::name('user_sign_hongbao')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->where('type', 1)
- ->select()
- ->toArray();
- if($user_sign_hongbao_list){
- foreach ($user_sign_hongbao_list as $user_sign_hongbao) {
- // 修改红包
- Db::name('user')
- ->where('uid', $user_sign_hongbao['uid'])
- ->inc('hongbao', floatval($user_sign_hongbao['number']))
- ->update();
- Db::name('user_sign_hongbao')
- ->where('id', $user_sign_hongbao['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- // 结算京豆
- $user_sign_jingdou_list = Db::name('user_sign_jingdou')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->where('type', 1)
- ->select()
- ->toArray();
- if($user_sign_jingdou_list){
- foreach ($user_sign_jingdou_list as $user_sign_jingdou) {
- // 修改京豆
- Db::name('user')
- ->where('uid', $user_sign_jingdou['uid'])
- ->inc('jingdou', floatval($user_sign_jingdou['number']))
- ->update();
- Db::name('user_sign_jingdou')
- ->where('id', $user_sign_jingdou['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- // 结算复购金
- $user_sign_fugou_list = Db::name('user_sign_fugou')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->where('type', 1)
- ->select()
- ->toArray();
- if($user_sign_fugou_list){
- foreach ($user_sign_fugou_list as $user_sign_fugou) {
- // 修改复购金
- Db::name('user')
- ->where('uid', $user_sign_fugou['uid'])
- ->inc('fugou', floatval($user_sign_fugou['number']))
- ->update();
- Db::name('user_sign_fugou')
- ->where('id', $user_sign_fugou['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- // 结算贡献值
- $user_sign_gongxian_list = Db::name('user_sign_gongxian')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->where('type', 1)
- ->select()
- ->toArray();
- if($user_sign_gongxian_list){
- foreach ($user_sign_gongxian_list as $user_sign_gongxian) {
- // 修改贡献值
- Db::name('user')
- ->where('uid', $user_sign_gongxian['uid'])
- ->inc('contribute', floatval($user_sign_gongxian['number']))
- ->update();
- Db::name('user_sign_gongxian')
- ->where('id', $user_sign_gongxian['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- /** @var UserRepository $userRepository */
- $userRepository = app()->make(UserRepository::class);
- $userRepository->setUserIdentity($user_sign_gongxian['uid']);
- }
- }
- // 结算PV值
- $user_pv_list = Db::name('user_pv_log')
- ->where('status', -1)
- ->where('order_id', $online['order_id'])
- ->select()
- ->toArray();
- if($user_pv_list) {
- foreach ($user_pv_list as $user_pv) {
- // 修改pv
- Db::name('user')
- ->where('uid', $user_pv['uid'])
- ->inc('pv', floatval($user_pv['pv']))
- ->update();
- Db::name('user_pv_log')
- ->where('id', $user_pv['id'])
- ->update([
- 'status' => 1,
- 'settlement_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- // 结算佣金养老金
- $user_bill_list = Db::name('user_bill')
- ->where('status', 0)
- ->where([ 'link_id' => $online['order_id']])
- ->where([ 'pm' => 1])
- ->select()
- ->toArray();
- if($user_bill_list){
- foreach ($user_bill_list as $user_bill) {
- if($user_bill['commission_type'] == 5){
- Db::name('user')
- ->where('uid', $user_bill['uid'])
- ->inc('annuity', floatval($user_bill['number']))
- ->update();
- }else{
- Db::name('user')
- ->where('uid', $user_bill['uid'])
- ->inc('brokerage_price', floatval($user_bill['number']))
- ->update();
- }
- Db::name('user_bill')
- ->where('bill_id', $user_bill['bill_id'])
- ->update([
- 'status' => 1,
- 'take_time' => date('Y-m-d H:i:s')
- ]);
- }
- }
- //按角色结算
- // $StoreOrderRepository->close_order($online['order_id']);
- }
- }
|